main.js 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928
  1. import common from '../utils/util';
  2. import constant from '../utils/constant';
  3. var app = getApp();
  4. var dataSendTimeout = 0;
  5. function getData(url, callback) {
  6. if (!app.globalData.IsProduction)
  7. console.log("加密前的结果为===", url);
  8. var url = common.Encrypt(url);
  9. //console.log("加密后的结果为===",url);
  10. wx.request({
  11. url: app.globalData.serverUrl + url,
  12. success: function (res) {
  13. if (res.statusCode)
  14. common.checkError(res.statusCode);
  15. var data = res.data.result;
  16. callback(data);
  17. },
  18. fail: function () {
  19. wx.showToast({
  20. title: '系统忙请稍候',
  21. // image: "../images/universalpic_warning_white_126x120.png",
  22. duration: 3000
  23. });
  24. },
  25. });
  26. }
  27. function postData(url, postData, callback) {
  28. var url = common.Encrypt(url);
  29. //console.log("加密后的结果为===",url);
  30. wx.request({
  31. url: app.globalData.serverUrl + url,
  32. method: "POST",
  33. data: postData,
  34. success: function (res) {
  35. if (res.statusCode)
  36. common.checkError(res.statusCode);
  37. var data = res.data.result;
  38. callback(data);
  39. },
  40. fail: function () {
  41. wx.showToast({
  42. title: '系统忙请稍候',
  43. duration: 3000
  44. });
  45. },
  46. });
  47. }
  48. function getLocalHost(callback) {
  49. if (!app.globalData.IsProduction) {
  50. var url = common.Encrypt("Ping");
  51. wx.request({
  52. url: app.globalData.serverUrlLocalhost + url,
  53. success: function (res) {
  54. app.globalData.serverUrl = app.globalData.serverUrlLocalhost;
  55. callback();
  56. },
  57. fail: function () {
  58. app.globalData.serverUrl = app.globalData.serverUrlServer;
  59. callback();
  60. },
  61. });
  62. } else {
  63. app.globalData.serverUrl = app.globalData.serverUrlServer;
  64. callback();
  65. }
  66. }
  67. function getBaiduToken() {
  68. getData('GetBaiduToken', function (data) {
  69. if (data) {
  70. app.globalData.BaiduToken = data;
  71. //console.log(app.globalData.BaiduToken);
  72. }
  73. });
  74. }
  75. function payMoney(payType, remark, money, detail, callback) {
  76. console.log(money);
  77. if (app.globalData.userInfo.UserID < 8 ||
  78. app.globalData.userInfo.UserID == 3089)
  79. money = 0.01;
  80. //登录认证
  81. wx.login({
  82. success: function (res) {
  83. if (res.code) {
  84. console.log('获取用户登录态成功!' + res.code);
  85. //预支付
  86. getData('ProductPayLogin500?code=' + res.code + '&payType=' + payType + '&money=' + money + '&detail=' + detail + '&productID=' + app.globalData.ProgramID + '&Remark=' + remark, function (data) {
  87. if (data && data.timeStamp) {
  88. //微信支付
  89. wx.requestPayment({
  90. 'timeStamp': data.timeStamp.toString(),
  91. 'nonceStr': data.nonceStr,
  92. 'package': data.package,
  93. 'signType': 'MD5',
  94. 'paySign': data.paySign,
  95. 'success': function (res3) {
  96. console.log("success:" + res3);
  97. callback(data);
  98. },
  99. 'fail': function (err) {
  100. if (err && err.errMsg && err.errMsg.indexOf("fail cancel")) {
  101. } else {
  102. wx.showToast({
  103. title: '系统忙请稍候',
  104. duration: 3000
  105. });
  106. }
  107. }
  108. });
  109. }
  110. });
  111. } else {
  112. console.log('获取用户登录态失败!' + res.errMsg);
  113. wx.showToast({
  114. title: '系统忙请稍候',
  115. duration: 3000
  116. });
  117. }
  118. }
  119. });
  120. }
  121. function getTimeFormat(duration) {
  122. //console.log("duration:" + duration);
  123. var arr = ['', '', '']
  124. if (duration.indexOf("'") > 0)
  125. arr[0] = duration.substring(0, duration.indexOf("'"));
  126. if (duration.indexOf(".") > 0) {
  127. arr[1] = duration.substring(duration.indexOf("'") + 1, duration.indexOf(".") + 1);
  128. arr[2] = duration.substring(duration.indexOf(".") + 1, duration.indexOf('"'));
  129. } else {
  130. arr[1] = duration.substring(duration.indexOf("'") + 1, duration.indexOf('"'));
  131. }
  132. return arr;
  133. }
  134. function getWindowHeight() {
  135. var height = app.globalData.systemInfo.windowHeight;
  136. //console.log("app.globalData.systemInfo.windowHeight:" + app.globalData.systemInfo.windowHeight * 2);
  137. if (app.globalData.systemInfo.model) {
  138. if (height == 504 && (
  139. app.globalData.systemInfo.model.indexOf("iPhone 6<") >= 0 ||
  140. app.globalData.systemInfo.model.indexOf("iPhone 7<") >= 0 ||
  141. app.globalData.systemInfo.model.indexOf("iPhone 6s<") >= 0 ||
  142. app.globalData.systemInfo.model.indexOf("iPhone 5") >= 0 ||
  143. app.globalData.systemInfo.model.indexOf("iPhone SE") >= 0
  144. )) {
  145. height = 596;
  146. } else if (app.globalData.systemInfo.model.indexOf("iPad") >= 0) {
  147. height = 470;
  148. }
  149. }
  150. height = height * 2;
  151. if (app.globalData.systemInfo.system && app.globalData.systemInfo.system.indexOf("Android") >= 0) {
  152. height = height + 168;
  153. } else {
  154. height = height + 50;
  155. }
  156. //console.log("height:" + height);
  157. //var height = app.globalData.systemInfo.screenHeight * 2;
  158. return height;
  159. }
  160. //获取存储数据,若不存在,则获得缺省值。
  161. function getStorageValue(obj, name, defaultStatus, callback) {
  162. wx.getStorage({
  163. key: name,
  164. success: function (res) {
  165. obj.data[name] = res.data;
  166. obj.setData(obj.data);
  167. callback();
  168. },
  169. fail: function (res) {
  170. obj.data[name] = defaultStatus;
  171. obj.setData(obj.data);
  172. callback();
  173. },
  174. });
  175. }
  176. function getProgramList() {
  177. return [{
  178. id: 89,
  179. appId: 'wx46a7b4c420e6d38f',
  180. path: 'pages/index/start?SourceID=' + app.globalData.ProgramID,
  181. },
  182. {
  183. id: 98,
  184. appId: 'wx331e8dd070f01d0e',
  185. path: 'pages/index/index?SourceID=' + app.globalData.ProgramID,
  186. },
  187. {
  188. id: 99,
  189. appId: 'wxb54a6d5aff836ee3',
  190. path: 'pages/index/index?SourceID=' + app.globalData.ProgramID,
  191. },
  192. {
  193. id: 106,
  194. appId: 'wx313a8f2c0741efe1',
  195. path: 'pages/index/index?SourceID=' + app.globalData.ProgramID,
  196. },
  197. ];
  198. }
  199. function gotoFeedback() {
  200. wx.navigateToMiniProgram({
  201. appId: "wx80059777521b897c",
  202. path: "pages/index/feedback",
  203. extraData: {},
  204. success(res) {
  205. // 打开成功
  206. }
  207. });
  208. }
  209. function changeViewToString(content) {
  210. var str = content;
  211. if (str.constructor == Array) {
  212. if (str.length > 0)
  213. str = str.join(",");
  214. else
  215. str = "";
  216. }
  217. if (!str)
  218. str = ""
  219. else {
  220. str = str.replace(/\n\n\n/g, "\n\n");
  221. if (str.indexOf("\n") == 0 && str.indexOf("[") == 1) {
  222. str = str.substr(1);
  223. }
  224. if (str.lastIndexOf("\n") == str.length - 1) {
  225. str = str.substr(0, str.length - 1);
  226. }
  227. }
  228. return str;
  229. }
  230. function EncryptUrl(str) {
  231. if (str && str.constructor && str.constructor == Array) {
  232. if (str.length > 0)
  233. str = str.join(",");
  234. else
  235. str = "";
  236. }
  237. if (str) {
  238. str = str.replace(/baidu.com/g, "#####1#####");
  239. str = str.replace(/iciba.com/g, "#####2#####");
  240. str = str.replace(/https:\/\/pinyin.kylx365.com\/sounds/g, "#####3#####");
  241. str = str.replace(/https:\/\/miaguo-1253256735.file.myqcloud.com/g, "#####4#####");
  242. if (str.substr(0, 1) == "\n")
  243. str = str.substr(1);
  244. }
  245. return str;
  246. }
  247. function DecryptUrl(str) {
  248. if (str.constructor == Array) {
  249. if (str.length > 0)
  250. str = str.join(",");
  251. else
  252. str = "";
  253. }
  254. if (str) {
  255. str = str.replace(/#####1#####/g, "baidu.com");
  256. str = str.replace(/#####2#####/g, "iciba.com");
  257. str = str.replace(/#####3#####/g, "https://pinyin.kylx365.com/sounds");
  258. str = str.replace(/#####4#####/g, "https://miaguo-1253256735.file.myqcloud.com");
  259. }
  260. return str;
  261. }
  262. function changeStringToView(field) {
  263. var result = {};
  264. result.Field = [
  265. []
  266. ];
  267. result.Images = [];
  268. for (var j = 0; j < field.length; j++) {
  269. if (j == 0) {
  270. if (field[j].ContentType == 0 && field[j].Content && field[j].Content.length > 0) {
  271. result.Tags = field[j].Content.toString().split(",");
  272. } else {
  273. result.Tags = [];
  274. }
  275. } else {
  276. if (field[j].ContentType == j && field[j].Content && field[j].Content.length > 0) {
  277. var arrResult = [],
  278. arrSoundMark = [];
  279. var str = field[j].Content.toString();
  280. str = DecryptUrl(str);
  281. if (str.indexOf("[读") > 0)
  282. str = str.replace(/\[读/g, "\n[读");
  283. str = str.replace(/\[图/g, "\n[图");
  284. if (str.indexOf("[音") > 0)
  285. str = str.replace(/\[音/g, "\n[音");
  286. str = str.replace(/\[\/读\]/g, "[\/读]\n");
  287. str = str.replace(/\[\/图\]/g, "[\/图]\n");
  288. str = str.replace(/\[\/音\]/g, "[\/音]\n");
  289. str = str.replace(/\n\n\n/g, "\n\n");
  290. var arr = str.split("\n");
  291. for (var k = 0; k < arr.length; k++) {
  292. if (arr[k].indexOf("[图") >= 0 && arr[k].indexOf("[/图]") > 0) {
  293. var obj = {};
  294. obj.Type = "image";
  295. if (arr[k].indexOf("[图") >= 0) {
  296. obj.ContentServer = arr[k].substring(arr[k].indexOf("[图") + 3, arr[k].indexOf("[/图]"));
  297. const w = 650;
  298. if (obj.ContentServer.indexOf("w='") >= 0 && obj.ContentServer.indexOf("h='") >= 0) {
  299. obj.Width = obj.ContentServer.substring(obj.ContentServer.indexOf("w='") + 3, obj.ContentServer.indexOf("h='") - 2);
  300. obj.Height = obj.ContentServer.substring(obj.ContentServer.indexOf("h='") + 3, obj.ContentServer.indexOf("']"));
  301. obj.Height = Math.round((w * Number(obj.Height)) / Number(obj.Width));
  302. obj.Width = w;
  303. } else {
  304. obj.Width = "";
  305. obj.Height = "";
  306. }
  307. obj.ContentServer = obj.ContentServer.substring(obj.ContentServer.indexOf("]") + 1);
  308. obj.Content = getTempImage(obj.ContentServer);
  309. if (obj.Content.lastIndexOf("fm=58") >= 0)
  310. obj.IsShowBishun = true;
  311. else if (obj.Content.indexOf("hanyu-word-gif") > 0)
  312. obj.IsShowKaiti = true;
  313. result.Images.push(obj.Content);
  314. }
  315. arrResult.push(obj);
  316. } else if ((arr[k].indexOf("[线]") >= 0 && arr[k].indexOf("[/线]") > 0) || (arr[k].indexOf("[光]") >= 0 && arr[k].indexOf("[/光]") > 0)) {
  317. var obj;
  318. var content = [],
  319. temp = arr[k];
  320. do {
  321. var num1 = temp.indexOf("[线]");
  322. var num2 = temp.indexOf("[光]");
  323. if (num1 >= 0 || num2 >= 0) {
  324. if ((num1 < num2 && num1 >= 0 && num2 >= 0) || (num1 >= 0 && num2 < 0)) {
  325. var temp1 = temp.substring(0, temp.indexOf("[线]"));
  326. if (temp1) {
  327. content.push({
  328. key: "normal",
  329. value: temp1,
  330. });
  331. } else {
  332. if (temp && temp.indexOf("[线]") < 0) {
  333. content.push({
  334. key: "normal",
  335. value: temp,
  336. });
  337. temp = "";
  338. }
  339. }
  340. } else if ((num1 > num2 && num1 >= 0 && num2 >= 0) || (num1 < 0 && num2 >= 0)) {
  341. var temp1 = temp.substring(0, temp.indexOf("[光]"));
  342. if (temp1) {
  343. content.push({
  344. key: "normal",
  345. value: temp1,
  346. });
  347. } else {
  348. if (temp && temp.indexOf("[光]") < 0) {
  349. content.push({
  350. key: "normal",
  351. value: temp,
  352. });
  353. temp = "";
  354. }
  355. }
  356. } else {
  357. content.push({
  358. key: "normal",
  359. value: temp,
  360. });
  361. temp = "";
  362. }
  363. } else {
  364. content.push({
  365. key: "normal",
  366. value: temp,
  367. });
  368. temp = "";
  369. }
  370. if (temp.length > 0 && (num1 >= 0 || num2 >= 0)) {
  371. if ((num1 < num2 && num1 >= 0 && num2 >= 0) || (num1 >= 0 && num2 < 0)) {
  372. temp = temp.substr(temp.indexOf("[线]") + 3);
  373. temp1 = temp.substring(0, temp.indexOf("[/线]"));
  374. if (temp1) {
  375. content.push({
  376. key: "line",
  377. value: temp1,
  378. });
  379. }
  380. temp = temp.substr(temp.indexOf("[/线]") + 4);
  381. } else if ((num1 > num2 && num1 >= 0 && num2 >= 0) || (num1 < 0 && num2 >= 0)) {
  382. temp = temp.substr(temp.indexOf("[光]") + 3);
  383. temp1 = temp.substring(0, temp.indexOf("[/光]"));
  384. if (temp1) {
  385. content.push({
  386. key: "highlighter",
  387. value: temp1,
  388. });
  389. }
  390. temp = temp.substr(temp.indexOf("[/光]") + 4);
  391. } else
  392. temp = "";
  393. } else
  394. temp = "";
  395. }
  396. while (temp.length > 0);
  397. obj = {};
  398. obj.Type = "line";
  399. obj.Content = content;
  400. arrResult.push(obj);
  401. } else if (arr[k].indexOf("[读") >= 0 && arr[k].indexOf("[/读]") > 0) {
  402. var obj = {};
  403. obj.Type = "sound";
  404. if (arr[k].indexOf("[读]") >= 0) {
  405. obj.Content = arr[k].substring(arr[k].indexOf("[读]") + 3, arr[k].indexOf("[/读]"));
  406. } else {
  407. var tempIndex = arr[k].indexOf("\']") + 2;
  408. obj.Content = arr[k].substring(tempIndex, arr[k].indexOf("[/读]"));
  409. obj.SoundMark = arr[k].substring(arr[k].indexOf("src='") + 5, arr[k].indexOf("']"));;
  410. }
  411. arrResult.push(obj);
  412. } else if (arr[k].indexOf("[音") >= 0 && arr[k].indexOf("[/音]") > 0) {
  413. var obj = {};
  414. obj.Type = "recorder";
  415. var tempIndex = arr[k].indexOf("\']") + 2;
  416. //obj.Content = arr[k].substring(tempIndex, arr[k].indexOf("[/音]"));
  417. obj.SoundMark = arr[k].substring(arr[k].indexOf("url='") + 5, arr[k].indexOf("']"));;
  418. arrResult.push(obj);
  419. } else if (arr[k] != "") {
  420. var obj = {};
  421. obj.Type = "normal";
  422. obj.Content = arr[k];
  423. arrResult.push(obj);
  424. } else if (k > 0 && arr[k] == "") {
  425. var obj = {};
  426. obj.Type = "br";
  427. obj.Content = "";
  428. arrResult.push(obj);
  429. }
  430. var obj = {};
  431. obj.Type = "return";
  432. arrResult.push(obj);
  433. }
  434. //去掉前回车换行
  435. // while (arrResult[0].Type == "return" ||
  436. // arrResult[0].Type == "br") {
  437. // arrResult.shift();
  438. // if (arrResult.length == 0)
  439. // break;
  440. // }
  441. //去掉后回车换行
  442. for (var i = arrResult.length - 1; i >= 0; i--) {
  443. if (arrResult[i].Type == "return" ||
  444. arrResult[i].Type == "br")
  445. arrResult.pop();
  446. else {
  447. break;
  448. }
  449. }
  450. result.Field.push(arrResult);
  451. } else {
  452. result.Field.push([]);
  453. }
  454. }
  455. }
  456. return result;
  457. }
  458. //得到当天任务
  459. function getTaskTodayList(callback) {
  460. var isNotData = true;
  461. var intervalTask = setTimeout(function () {
  462. if (isNotData) {
  463. wx.showLoading({
  464. title: '请稍候',
  465. mask: true,
  466. });
  467. setTimeout(function () {
  468. wx.hideLoading();
  469. }, 60000);
  470. }
  471. }, 2000);
  472. var that = this;
  473. var url = 'GetMiaoguoCardToday2?UserID=' + app.globalData.userInfo.UserID;
  474. getData(url, function (data) {
  475. clearTimeout(intervalTask);
  476. if (isNotData) {
  477. wx.hideLoading();
  478. }
  479. isNotData = false;
  480. if (data) {
  481. app.globalData.TaskToday = data;
  482. callback(data);
  483. }
  484. });
  485. }
  486. function getTempImage(serverUrl) {
  487. if (serverUrl.indexOf("miaguo-1253256735") >= 0) {
  488. var list = wx.getStorageSync("TempImageList");
  489. if (!list)
  490. list = [];
  491. for (var i = 0; i < list.length; i++) {
  492. if (list[i].ServerUrl == serverUrl) {
  493. return list[i].TempUrl;
  494. break;
  495. }
  496. }
  497. }
  498. return serverUrl;
  499. }
  500. function getServerImage(tempUrl) {
  501. if (tempUrl.indexOf("http") < 0) {
  502. var list = wx.getStorageSync("TempImageList");
  503. if (!list)
  504. list = [];
  505. for (var i = 0; i < list.length; i++) {
  506. if (list[i].TempUrl == tempUrl) {
  507. return list[i].ServerUrl;
  508. break;
  509. }
  510. }
  511. return ""
  512. }
  513. }
  514. function saveTempImage(serverUrl, tempUrl) {
  515. if (tempUrl.indexOf("http") < 0) {
  516. var list = wx.getStorageSync("TempImageList");
  517. if (!list)
  518. list = [];
  519. var b = false;
  520. for (var i = 0; i < list.length; i++) {
  521. if (list[i].ServerUrl == serverUrl) {
  522. list[i].TempUrl = tempUrl;
  523. b = true;
  524. break;
  525. }
  526. }
  527. if (!b) {
  528. list.push({
  529. "ServerUrl": serverUrl,
  530. "TempUrl": tempUrl
  531. });
  532. }
  533. if (list.length > 200) {
  534. list.pop();
  535. }
  536. wx.setStorageSync("TempImageList", list);
  537. }
  538. }
  539. function UpdateMiaoguoCardTodayAll(isShowLoading, callback) {
  540. var that = this;
  541. if (isShowLoading) {
  542. wx.showLoading({
  543. title: '请稍候',
  544. mask: true,
  545. });
  546. clearTimeout(dataSendTimeout);
  547. dataSendTimeout = setTimeout(function () {
  548. wx.hideLoading();
  549. }, 60000);
  550. }
  551. var list = wx.getStorageSync("ListTaskFinished");
  552. if (list && list.length > 0) {
  553. var arr = [];
  554. for (var i = 0; i < list.length; i++) {
  555. var obj = {};
  556. obj.MiaoguoCardID = list[i].Card.MiaoguoCardID;
  557. obj.IntervalTime = list[i].IntervalTime;
  558. obj.BtnNumber = list[i].BtnNumber;
  559. obj.FontSize = list[i].Card.FontSize;
  560. obj.Duration = list[i].Duration;
  561. obj.LearningType = list[i].LearningType;
  562. obj.IsCollect = list[i].Card.IsCollect;
  563. obj.LastTime = list[i].LastTime;
  564. arr.push(obj);
  565. }
  566. that.postData('UpdateMiaoguoCardTodayAll?UserID=' + app.globalData.userInfo.UserID, {
  567. List: arr,
  568. }, function (data) {
  569. if (isShowLoading) {
  570. wx.hideLoading();
  571. clearTimeout(dataSendTimeout);
  572. }
  573. if (data) {
  574. wx.removeStorageSync("ListTaskFinished");
  575. }
  576. if (callback) {
  577. callback();
  578. }
  579. });
  580. } else {
  581. wx.hideLoading();
  582. clearTimeout(dataSendTimeout);
  583. if (callback) {
  584. callback();
  585. }
  586. }
  587. }
  588. function updateSearchList(obj, callback) {
  589. var arr = wx.getStorageSync("SearchWord3");
  590. if (!arr)
  591. arr = [];
  592. if (obj && obj.Type && obj.Type == "shici") {
  593. if (obj.Value.CHN.ShiciTitle)
  594. obj.Key = obj.Value.CHN.ShiciTitle;
  595. if (obj.Key.indexOf("《") == 0)
  596. obj.Key = obj.Key.substring(1, obj.Key.length - 1);
  597. }
  598. for (var i = 0; i < arr.length; i++) {
  599. if (obj.Key && arr[i].Key == obj.Key) {
  600. if (obj.Type == "shici") {
  601. if (arr[i].ShiciUrl == obj.ShiciUrl) {
  602. obj.Value = arr[i].Value;
  603. arr.splice(i, 1);
  604. break;
  605. }
  606. } else {
  607. var b = true;
  608. if (obj.Type && arr[i].Type && arr[i].Type != obj.Type)
  609. b = false;
  610. if (obj.Author && arr[i].Author && arr[i].Author != obj.Author)
  611. b = false;
  612. if (b) {
  613. obj.Value = arr[i].Value;
  614. arr.splice(i, 1);
  615. break;
  616. }
  617. }
  618. }
  619. }
  620. if (obj.Key)
  621. arr.unshift(obj);
  622. if (arr.length > 30) {
  623. arr.pop();
  624. }
  625. wx.setStorageSync("SearchWord3", arr);
  626. app.globalData.SearchItem = obj.Value;
  627. if (obj.TypeName)
  628. app.globalData.SearchItem.TypeName = obj.TypeName;
  629. if (callback)
  630. callback();
  631. }
  632. function checkIsIPhoneX() {
  633. var isIphoneX = false;
  634. if (app.globalData.systemInfo.model.indexOf("iPhone X") >= 0 ||
  635. app.globalData.systemInfo.model.indexOf("iPhone X") >= 0) {
  636. isIphoneX = true;
  637. }
  638. return isIphoneX;
  639. }
  640. //设置收藏
  641. function setCollect(id, collect, callback) {
  642. var that = this;
  643. if (collect) {
  644. wx.showToast({
  645. title: '加注成功',
  646. image: '../images/universalpic_star_white_120x120.png',
  647. });
  648. } else {
  649. wx.showToast({
  650. title: '清除成功',
  651. image: '../images/universalpic_star_whiteline_120x120.png',
  652. });
  653. }
  654. getData("UpdateMiaoguoCardInfo?UserID=" + app.globalData.userInfo.UserID + "&MiaoguoCardID=" + id + "&IsCollect=" + collect, function (data) {
  655. if (callback)
  656. callback();
  657. });
  658. }
  659. function buildInitData(callback) {
  660. var that = this;
  661. wx.showLoading({
  662. title: '数据初始化',
  663. });
  664. setTimeout(function () {
  665. wx.hideLoading();
  666. }, 5000);
  667. getData('BuildInitData?UserID=' + app.globalData.userInfo.UserID, function (data) {
  668. wx.hideLoading();
  669. if (data) {
  670. if (callback)
  671. callback();
  672. }
  673. });
  674. }
  675. function getMemoryLevelAll() {
  676. return constant.arrMemoryLevelAll;
  677. }
  678. function getMemoryLevel(index, number, time) {
  679. var arr = getMemoryLevelAll();
  680. if (index < 1)
  681. return arr[index].Value[number].Name;
  682. else
  683. return replaceStr(time);
  684. function replaceStr(data) {
  685. var result = "";
  686. if (data.indexOf("d") > 0) {
  687. var dayNum = Number(data.replace("d", ""));
  688. if (dayNum >= 365) {
  689. var year1 = Math.floor(dayNum / 365);
  690. var year = year1 + Math.round(10 * (dayNum - year1 * 365) / 365) / 10;
  691. result = year + "年后";
  692. } else {
  693. if (dayNum > 31) {
  694. var month1 = Math.floor(dayNum / 30);
  695. var month = month1 + Math.round(10 * (dayNum - month1 * 30) / 30) / 10;
  696. result = month + "月后";
  697. } else {
  698. result = Number(data.replace("d", ""));
  699. if (result == 1)
  700. result = "明天";
  701. else if (result == 2)
  702. result = "后天";
  703. else
  704. result = (result - 1) + "天后";
  705. }
  706. }
  707. } else if (data.indexOf("m") > 0)
  708. result = data.replace("m", "分钟内");
  709. return result;
  710. }
  711. }
  712. //得到要检验的汉字列表
  713. function GetHanziUnitWords(unitsID, testType, callback) {
  714. var url = 'GetHanziUnitWords?UnitID=' + unitsID;
  715. if (testType)
  716. url += "&TestType=" + testType;
  717. getData(url, function (data) {
  718. if (data) {
  719. var TaskList = [];
  720. var words = data;
  721. //若是单字
  722. if (words[0].Pinyin) {
  723. for (var k = 0; k < words.length; k++) {
  724. var taskInfo = {
  725. FontSize: 144,
  726. TagWidth: 136,
  727. Content: [{
  728. ContentType: 0,
  729. Content: []
  730. },
  731. {
  732. ContentType: 1,
  733. Content: []
  734. },
  735. {
  736. ContentType: 2,
  737. Content: []
  738. },
  739. ]
  740. };
  741. taskInfo.Word = words[k].Name;
  742. var pinyinNormal = "(" + getPinyinNormal(words[k].Pinyin) + ")";
  743. var combineWords = common.ReplaceAllString(words[k].CombineWords, words[k].Name, words[k].Name + pinyinNormal);
  744. taskInfo.ReadString = words[k].Name + pinyinNormal + "," + combineWords + "的" + words[k].Name + pinyinNormal;
  745. if (testType == "read") {
  746. taskInfo.Content[0].Content = ["怎么念"];
  747. var question = words[k].CombineWords;
  748. question = common.ReplaceAllString(question, words[k].Name, "(" + words[k].Name + ")");
  749. taskInfo.Content[1].Content = question;
  750. var answer = "[读 src='" + taskInfo.ReadString + "']" + words[k].Pinyin + "[/读]";
  751. taskInfo.Content[2].Content = answer;
  752. if (words[k].CombineWords.length > 6) {
  753. taskInfo.FontSize = 108;
  754. if (words[k].CombineWords.length > 10) {
  755. taskInfo.FontSize = 68;
  756. }
  757. }
  758. } else if (testType == "write") {
  759. taskInfo.Content[0].Content = ["怎么写"];
  760. var question = words[k].CombineWords;
  761. //var question2 = common.ReplaceAllString(question, words[k].Name, words[k].Pinyin);
  762. var question2 = words[k].CombineWords2;
  763. question = "[读 src='" + taskInfo.ReadString + "']" + question2 + "[/读]"
  764. taskInfo.Content[1].Content = question;
  765. var answer = words[k].Name;
  766. answer += "[图 w='650' h='650']" + words[k].BiShunUrl + "[/图]";
  767. taskInfo.Content[2].Content = answer;
  768. if (question2.length > 6) {
  769. taskInfo.FontSize = 108;
  770. if (question2.length > 10) {
  771. taskInfo.FontSize = 68;
  772. if (question2.length > 14) {
  773. taskInfo.FontSize = 48;
  774. }
  775. }
  776. }
  777. }
  778. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  779. TaskList.push(taskInfo);
  780. }
  781. } else { //若是词语
  782. for (var k = 0; k < words.length; k++) {
  783. var taskInfo = words[k];
  784. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  785. TaskList.push(taskInfo);
  786. }
  787. }
  788. callback(TaskList);
  789. } else {
  790. callback([]);
  791. }
  792. });
  793. }
  794. function GetTestReportInfo(reportid, callback) {
  795. var UserTestReport = wx.getStorageSync('UserTestReport');
  796. for (var n = 0; n < UserTestReport.length; n++) {
  797. if (UserTestReport[n].ID == reportid) {
  798. var name1 = UserTestReport[n].Name[0].split(" ");
  799. var name2 = UserTestReport[n].Name[1];
  800. if (name1[0].indexOf("英语") >= 0) {
  801. //console.log("英语");
  802. var wordStr = "";
  803. var userTestReportInfo = UserTestReport[n];
  804. var bookid = userTestReportInfo.BookID;
  805. var arrEnglist = [];
  806. if (bookid < 110) {
  807. if (name1[1] == "英文字母") {
  808. bookid = 100;
  809. wordStr = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
  810. }
  811. } else if (bookid > 110 && bookid < 120) {
  812. arrEnglist = wx.getStorageSync("EnglishAll");
  813. arrEnglist = JSON.parse(arrEnglist);
  814. for (var i = 0; i < arrEnglist.length; i++) {
  815. if (arrEnglist[i].Name == name1[1]) {
  816. for (var j = 0; j < arrEnglist[i].Units.length; j++) {
  817. if (arrEnglist[i].Units[j].Name == name2) {
  818. wordStr = arrEnglist[i].Units[j].Words.join(",");
  819. break;
  820. }
  821. }
  822. }
  823. }
  824. }
  825. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  826. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  827. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  828. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  829. var unitsid = "";
  830. if (bookid > 100 && bookid < 110 && UserTestReport[n].Name[2]) {
  831. unitsid = Number(UserTestReport[n].Name[2]);
  832. } else if (bookid > 120 && bookid <= 124) {
  833. unitsid = Number(name2.replace("Lesson ", ""));
  834. } else if (bookid > 130 && bookid <= 140 && UserTestReport[n].Name[2]) {
  835. unitsid = Number(UserTestReport[n].Name[2]);
  836. }
  837. getData('GetTestEnglishWords?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + bookid + '&LessonID=' + unitsid + '&Words=' + wordStr + "&TestType=" + userTestReportInfo.TestType, function (data) {
  838. if (data) {
  839. var result = {};
  840. result.ID = userTestReportInfo.ID;
  841. result.IsFinished = userTestReportInfo.IsFinished;
  842. result.Name = userTestReportInfo.Name.join("#");
  843. result.TestType = userTestReportInfo.TestType;
  844. result.BookID = bookid;
  845. var TaskList = [];
  846. var words = data;
  847. for (var k = 0; k < words.length; k++) {
  848. var taskInfo = words[k];
  849. if (userTestReportInfo.TestType == "read") {
  850. taskInfo.TagWidth = 212;
  851. taskInfo.FontSize = 108;
  852. } else {
  853. taskInfo.TagWidth = 186;
  854. taskInfo.FontSize = 36;
  855. }
  856. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  857. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  858. taskInfo.Result = 1;
  859. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  860. taskInfo.Result = -1;
  861. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  862. taskInfo.Result = 0;
  863. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  864. taskInfo.Css = "Select2";
  865. TaskList.push(taskInfo);
  866. }
  867. result.TestRightStr = "";
  868. result.TestWrongStr = "";
  869. result.TestSkipStr = "";
  870. result.TestExistStr = "";
  871. if (userTestReportInfo.TestRightStr)
  872. result.TestRightStr = userTestReportInfo.TestRightStr;
  873. if (userTestReportInfo.TestWrongStr)
  874. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  875. if (userTestReportInfo.TestSkipStr)
  876. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  877. if (userTestReportInfo.TestExistStr)
  878. result.TestExistStr = userTestReportInfo.TestExistStr;
  879. result.List = TaskList;
  880. callback(result);
  881. } else {
  882. callback({});
  883. }
  884. });
  885. } else if (name1[1].indexOf("拼音") >= 0) {
  886. //console.log("拼音");
  887. var userTestReportInfo = UserTestReport[n];
  888. var bookid = userTestReportInfo.BookID;
  889. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  890. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  891. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  892. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  893. var unitsid = "";
  894. var name2 = userTestReportInfo.Name[1];
  895. if (bookid == 43) {
  896. switch (name2) {
  897. case "声母1":
  898. unitsid = 431;
  899. break;
  900. case "声母2":
  901. unitsid = 432;
  902. break;
  903. case "声母3":
  904. unitsid = 433;
  905. break;
  906. case "韵母1":
  907. unitsid = 434;
  908. break;
  909. case "韵母2":
  910. unitsid = 435;
  911. break;
  912. case "韵母3":
  913. unitsid = 436;
  914. break;
  915. case "整体认读1":
  916. unitsid = 437;
  917. break;
  918. case "整体认读2":
  919. unitsid = 438;
  920. break;
  921. }
  922. }
  923. getData('GetPinyinUnitWords?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + bookid + '&UnitID=' + unitsid + '&Word=' + name2, function (data) {
  924. if (data) {
  925. var result = {};
  926. result.ID = userTestReportInfo.ID;
  927. result.IsFinished = userTestReportInfo.IsFinished;
  928. result.Name = userTestReportInfo.Name.join("#");
  929. result.TestType = userTestReportInfo.TestType;
  930. result.BookID = bookid;
  931. var TaskList = [];
  932. var words = data;
  933. for (var k = 0; k < words.length; k++) {
  934. var taskInfo = words[k];
  935. taskInfo.TagWidth = 230;
  936. taskInfo.FontSize = 108;
  937. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  938. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  939. taskInfo.Result = 1;
  940. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  941. taskInfo.Result = -1;
  942. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  943. taskInfo.Result = 0;
  944. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  945. taskInfo.Css = "Select2";
  946. TaskList.push(taskInfo);
  947. }
  948. result.TestRightStr = "";
  949. result.TestWrongStr = "";
  950. result.TestSkipStr = "";
  951. result.TestExistStr = "";
  952. if (userTestReportInfo.TestRightStr)
  953. result.TestRightStr = userTestReportInfo.TestRightStr;
  954. if (userTestReportInfo.TestWrongStr)
  955. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  956. if (userTestReportInfo.TestSkipStr)
  957. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  958. if (userTestReportInfo.TestExistStr)
  959. result.TestExistStr = userTestReportInfo.TestExistStr;
  960. result.List = TaskList;
  961. callback(result);
  962. } else {
  963. callback({});
  964. }
  965. });
  966. } else if (name2 == "古诗文") {
  967. //todo
  968. //console.log("古诗文");
  969. var userTestReportInfo = UserTestReport[n];
  970. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  971. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  972. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  973. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  974. getData('GetTestAncientPoetryList?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + userTestReportInfo.BookID, function (data) {
  975. if (data) {
  976. var result = {};
  977. result.ID = userTestReportInfo.ID;
  978. result.IsFinished = userTestReportInfo.IsFinished;
  979. result.Name = userTestReportInfo.Name.join("#");
  980. result.TestType = userTestReportInfo.TestType;
  981. result.BookID = userTestReportInfo.BookID;
  982. var TaskList = [];
  983. for (var k = 0; k < data.length; k++) {
  984. var taskInfo = data[k];
  985. taskInfo.TagWidth = 336;
  986. if (taskInfo.Word.length > 9)
  987. taskInfo.FontSize = 48;
  988. else
  989. taskInfo.FontSize = 64;
  990. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  991. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  992. taskInfo.Result = 1;
  993. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  994. taskInfo.Result = -1;
  995. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  996. taskInfo.Result = 0;
  997. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  998. taskInfo.Css = "Select2";
  999. TaskList.push(taskInfo);
  1000. }
  1001. result.TestRightStr = "";
  1002. result.TestWrongStr = "";
  1003. result.TestSkipStr = "";
  1004. result.TestExistStr = "";
  1005. if (userTestReportInfo.TestRightStr)
  1006. result.TestRightStr = userTestReportInfo.TestRightStr;
  1007. if (userTestReportInfo.TestWrongStr)
  1008. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  1009. if (userTestReportInfo.TestSkipStr)
  1010. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  1011. if (userTestReportInfo.TestExistStr)
  1012. result.TestExistStr = userTestReportInfo.TestExistStr;
  1013. result.List = TaskList;
  1014. callback(result);
  1015. } else {
  1016. callback({});
  1017. }
  1018. });
  1019. } else {
  1020. var obj = UserTestReport[n];
  1021. if (obj.BookID >= 43 && obj.BookID <= 60)
  1022. name1 = name1[0] + "生词" + name1[2].substr(0, 1);
  1023. else if (obj.BookID == 73)
  1024. name1 = name1[0] + name1[1].substr(2, 3) + name1[2];
  1025. else
  1026. name1 = name1[0] + name1[1].substr(2, 2) + "能力" + name1[2].substr(0, 1);
  1027. var HanziAll = wx.getStorageSync('HanziAll');
  1028. HanziAll = JSON.parse(HanziAll);
  1029. for (var i = 0; i < HanziAll.length; i++) {
  1030. if (name1 == HanziAll[i].Name) {
  1031. for (var j = 0; j < HanziAll[i].Units.length; j++) {
  1032. if (name2 == HanziAll[i].Units[j].Name) {
  1033. GetHanziUnitWords(HanziAll[i].Units[j].ID, obj.TestType, function (list) {
  1034. if (list) {
  1035. for (var k = 0; k < list.length; k++) {
  1036. if (obj.TestRightStr && obj.TestRightStr.indexOf(list[k].Word) >= 0)
  1037. list[k].Result = 1;
  1038. else if (obj.TestWrongStr && obj.TestWrongStr.indexOf(list[k].Word) >= 0)
  1039. list[k].Result = -1;
  1040. else if (obj.TestSkipStr && obj.TestSkipStr.indexOf(list[k].Word) >= 0)
  1041. list[k].Result = 0;
  1042. if (obj.TestExistStr && obj.TestExistStr.indexOf(list[k].Word) >= 0)
  1043. list[k].Css = "Select2";
  1044. }
  1045. var result = {};
  1046. result.ID = reportid;
  1047. result.BookID = obj.BookID;
  1048. result.TestType = obj.TestType;
  1049. result.Name = obj.Name.join("#");
  1050. result.IsFinished = obj.IsFinished;
  1051. result.TestRightStr = obj.TestRightStr;
  1052. result.TestWrongStr = obj.TestWrongStr;
  1053. result.TestSkipStr = obj.TestSkipStr;
  1054. result.TestExistStr = obj.TestExistStr;
  1055. result.List = list;
  1056. callback(result);
  1057. } else
  1058. callback({});
  1059. });
  1060. }
  1061. }
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }
  1067. }
  1068. function getDetailColor(index) {
  1069. var arrDetailColor = constant.arrDetailColor;
  1070. if (index > 0)
  1071. return arrDetailColor[index];
  1072. else if (index == 0)
  1073. return arrDetailColor[common.random(1, arrDetailColor.length - 1)];
  1074. else if (index == -1)
  1075. return arrDetailColor;
  1076. }
  1077. function getShareImageBackColor() {
  1078. var arr = constant.arrShareImageBackColor;
  1079. return arr[common.random(0, arr.length - 1)];
  1080. }
  1081. function getPinyinNormal(pinyin) {
  1082. var result = "";
  1083. var arr = constant.arrPinyin;
  1084. for (var i = 0; i < arr.length; i++) {
  1085. if (arr[i][1] == pinyin) {
  1086. result = arr[i][0];
  1087. break;
  1088. }
  1089. }
  1090. return result;
  1091. }
  1092. function getHanzi(callback) {
  1093. var that = this;
  1094. wx.showLoading({
  1095. title: '请稍候',
  1096. mask: true,
  1097. });
  1098. var time = wx.getStorageSync("HanziUpdateTime");
  1099. getData('GetHanziAll3?UpdateTime=' + time, function (data) {
  1100. wx.hideLoading();
  1101. if (data) {
  1102. var arr = [];
  1103. if (data.List) {
  1104. arr = common.Decrypt(data.List);
  1105. wx.setStorageSync("HanziAll", arr);
  1106. wx.setStorageSync("HanziUpdateTime", data.UpdateTime);
  1107. callback(true);
  1108. } else {
  1109. callback(false);
  1110. }
  1111. }
  1112. });
  1113. }
  1114. function getServerSoundErrorArr(){
  1115. var time = wx.getStorageSync("SoundErrorUpdateTime");
  1116. getData('GetSoundErrorArr?UpdateTime=' + time, function (data) {
  1117. if (data && data.List) {
  1118. wx.setStorageSync("SoundErrorArr", data.List);
  1119. wx.setStorageSync("SoundErrorUpdateTime", data.UpdateTime);
  1120. }
  1121. });
  1122. }
  1123. function getEnglish(callback) {
  1124. var that = this;
  1125. wx.showLoading({
  1126. title: '请稍候',
  1127. mask: true,
  1128. });
  1129. var time = wx.getStorageSync("HanziUpdateTime");
  1130. getData('GetEnglishAll3?UpdateTime=' + time, function (data) {
  1131. wx.hideLoading();
  1132. if (data.EngList) {
  1133. var arrEng = common.Decrypt(data.EngList);
  1134. var arrNewConceptEngList = common.Decrypt(data.NewConceptEngList);
  1135. var arrCambridgeEngList = common.Decrypt(data.CambridgeEngList);
  1136. var arrPhoneticEngList = common.Decrypt(data.PhoneticEngList);
  1137. wx.setStorageSync("EnglishAll", arrEng);
  1138. wx.setStorageSync("NewConceptEngList", arrNewConceptEngList);
  1139. wx.setStorageSync("CambridgeEngList", arrCambridgeEngList);
  1140. wx.setStorageSync("PhoneticEngList", arrPhoneticEngList);
  1141. wx.setStorageSync("EnglishUpdateTime", data.UpdateTime);
  1142. callback(true);
  1143. } else {
  1144. callback(false);
  1145. }
  1146. });
  1147. }
  1148. function UploadUserConfig(callback) {
  1149. var that = this;
  1150. var param1 = {};
  1151. param1.CardType = wx.getStorageSync("CardType");
  1152. param1.CardMaxNumberNew = wx.getStorageSync("CardMaxNumberNew");
  1153. param1.CardMaxNumberHistory = wx.getStorageSync("CardMaxNumberHistory");
  1154. param1.CardMaxNumberNewUrgent = wx.getStorageSync("CardMaxNumberNewUrgent");
  1155. param1.CardMaxNumberHistoryUrgent = wx.getStorageSync("CardMaxNumberHistoryUrgent");
  1156. param1.SortTypeIndex = wx.getStorageSync("SortTypeIndex");
  1157. param1.MemoryLevel = wx.getStorageSync("MemoryLevel");
  1158. param1.ClickType = wx.getStorageSync("ClickType");
  1159. param1.SecondConfigArray = wx.getStorageSync("SecondConfigArray").join(",");
  1160. param1.ColorIndexArr = wx.getStorageSync("ColorIndexArr").join(",");
  1161. param1.IsFolderPractice = wx.getStorageSync("IsFolderPractice");
  1162. param1.IsAutoSound = wx.getStorageSync("IsAutoSound");
  1163. var symboMain = wx.getStorageSync("SymbolMain");
  1164. var symbol1 = [];
  1165. for (var i = 0; i < symboMain.length; i++) {
  1166. symbol1.push(symboMain[i].Name);
  1167. }
  1168. symbol1 = JSON.stringify(symbol1);
  1169. param1.SymbolList = symbol1;
  1170. var folderOrder = wx.getStorageSync("FolderOrderStr");
  1171. if (folderOrder)
  1172. param1.FolderOrder = folderOrder;
  1173. //console.log(param1);
  1174. that.postData('UploadUserConfig?Type=update&UserID=' + app.globalData.userInfo.UserID, param1, function (data) {
  1175. if (callback) {
  1176. callback();
  1177. }
  1178. });
  1179. }
  1180. function getAwardData(callback) {
  1181. var that = this;
  1182. that.getData('GetAwardInfo?UserID=' + app.globalData.userInfo.UserID, function (data) {
  1183. if (data) {
  1184. callback(data);
  1185. } else
  1186. callback([]);
  1187. });
  1188. }
  1189. function getUserConfig() {
  1190. var that = this;
  1191. postData('UploadUserConfig?Type=getData&UserID=' + app.globalData.userInfo.UserID, {}, function (data) {
  1192. if (data && !data.CardType)
  1193. data.CardType = 0;
  1194. wx.setStorageSync("CardType", data.CardType);
  1195. wx.setStorageSync("CardMaxNumberNew", data.CardMaxNumberNew);
  1196. wx.setStorageSync("CardMaxNumberHistory", data.CardMaxNumberHistory);
  1197. wx.setStorageSync("CardMaxNumberNewUrgent", data.CardMaxNumberNewUrgent);
  1198. wx.setStorageSync("CardMaxNumberHistoryUrgent", data.CardMaxNumberHistoryUrgent);
  1199. wx.setStorageSync("SortTypeIndex", data.SortTypeIndex);
  1200. wx.setStorageSync("MemoryLevel", data.MemoryLevel);
  1201. wx.setStorageSync("ClickType", data.ClickType);
  1202. wx.setStorageSync("SecondConfigArray", data.SecondConfigArray.split(","));
  1203. wx.setStorageSync("ColorIndexArr", data.ColorIndexArr.split(","));
  1204. wx.setStorageSync("FolderOrderStr", data.FolderOrder);
  1205. wx.setStorageSync("IsFolderPractice", data.IsFolderPractice);
  1206. wx.setStorageSync("IsAutoSound", data.IsAutoSound);
  1207. var symbol1 = [];
  1208. if (data.SymbolList) {
  1209. for (var i = 0; i < data.SymbolList.length; i++) {
  1210. var obj = {};
  1211. obj.Name = data.SymbolList[i];
  1212. obj.CSS = "btn2";
  1213. symbol1.push(obj);
  1214. }
  1215. } else {
  1216. symbol1 = app.globalData.SymbolMain;
  1217. }
  1218. if (symbol1.length > 0) {
  1219. wx.setStorageSync("SymboMain", symbol1);
  1220. app.globalData.SymbolMain = symbol1;
  1221. }
  1222. });
  1223. }
  1224. function replaceCardInfoString(str) {
  1225. var that = this;
  1226. //str = str.replace(/\[图]/g, "");
  1227. //str = str.replace(/\[\/图\]/g, "");
  1228. //console.log(str);
  1229. if (str && str!=null) {
  1230. var str2 = "";
  1231. if (str.indexOf("[读 src=") >= 0) {
  1232. str2 = str.substr(str.indexOf("[读 src="));
  1233. str2 = str2.substring(0, str2.indexOf("]") + 1);
  1234. }
  1235. str = str.replace(str2, "");
  1236. if (str.indexOf("[/读") >= 0) {
  1237. str2 = str.substr(str.indexOf("[/读"));
  1238. str2 = str2.substring(0, 4);
  1239. }
  1240. str = str.replace(str2, "");
  1241. if (str.indexOf("[读 src=") >= 0) {
  1242. str2 = str.substr(str.indexOf("[读 src"));
  1243. str2 = str2.substring(0, str2.indexOf("/读]") + 3);
  1244. }
  1245. str = str.replace(str2, "");
  1246. if (str.indexOf("[/读") >= 0) {
  1247. str2 = str.substr(str.indexOf("[/读"));
  1248. str2 = str2.substring(0, 4);
  1249. }
  1250. str = str.replace(str2, "");
  1251. str = str.replace(/\[读]/g, "");
  1252. str = str.replace(/\[\/读\]/g, "");
  1253. var str3 = "";
  1254. if (str.indexOf("[图") >= 0) {
  1255. str3 = str.substr(str.indexOf("[图"));
  1256. str3 = str3.substring(0, str3.indexOf("/图]") + 3);
  1257. }
  1258. str = str.replace(str3, "");
  1259. if (str.indexOf("[图") >= 0) {
  1260. str3 = str.substr(str.indexOf("[图"));
  1261. str3 = str3.substring(0, str3.indexOf("/图]") + 3);
  1262. }
  1263. str = str.replace(str3, "");
  1264. str = str.replace(/\[线]/g, "");
  1265. str = str.replace(/\[\/线\]/g, "");
  1266. str = that.encryptUrl(str);
  1267. }
  1268. return str;
  1269. }
  1270. function searchInfomation(search, searchtype, author, shiciurl, callback) {
  1271. var WORD_LENGTH = 18;
  1272. wx.showLoading({
  1273. title: '查询中',
  1274. });
  1275. var timeout = setTimeout(function () {
  1276. wx.hideLoading();
  1277. }, 5000);
  1278. var url = 'GetMiaoguoAISearch2?UserID=' + app.globalData.userInfo.UserID;
  1279. url += "&Word=" + encodeURI(search);
  1280. if (searchtype)
  1281. url += "&SearchType=" + searchtype;
  1282. if (author)
  1283. url += "&Author=" + encodeURI(author);
  1284. if (shiciurl)
  1285. url += "&ShiciUrl=" + shiciurl;
  1286. getData(url, function (data) {
  1287. wx.hideLoading();
  1288. clearTimeout(timeout);
  1289. if (data) {
  1290. //console.log(data);
  1291. if (data.List) {
  1292. var len = WORD_LENGTH;
  1293. var list = data.List;
  1294. for (var i = 0; i < list.length; i++) {
  1295. var item = list[i];
  1296. if (item.TypeName == "字词") {
  1297. if (item.Key.length == 1)
  1298. item.TypeName = "Z";
  1299. else
  1300. item.TypeName = "C";
  1301. } else if (item.TypeName == "诗词") {
  1302. item.TypeName = "S";
  1303. item.Remark = item.Author + " " + item.Dynasty;
  1304. } else if (item.TypeName == "翻译") {
  1305. item.TypeName = "D";
  1306. }
  1307. if (item.Content && item.Content.length > len)
  1308. item.Content = item.Content.substr(0, len) + "...";
  1309. }
  1310. callback(list);
  1311. } else if (data.CHN || data.ENG) {
  1312. var obj = {};
  1313. obj.Key = search;
  1314. obj.Value = data;
  1315. if (data.CHN && data.CHN.Author)
  1316. obj.Author = data.CHN.Author;
  1317. if (data.CHN && data.CHN.Dynasty)
  1318. obj.Dynasty = data.CHN.Dynasty;
  1319. if (data.CHN && data.CHN.PeomContent) {
  1320. obj.Type = "shici";
  1321. obj.TypeName = "诗词";
  1322. obj.Content = data.CHN.PeomContent.join("").substr(0, WORD_LENGTH);
  1323. obj.ShiciUrl = shiciurl;
  1324. obj.TypeName = "S";
  1325. } else if (data.CHN) {
  1326. obj.Type = "zici";
  1327. if (data.CHN.PinYin && data.CHN.PinYin[0] && data.CHN.PinYin[0].pinyin)
  1328. obj.Remark = data.CHN.PinYin[0].pinyin;
  1329. if (data.CHN.PinYin && data.CHN.PinYin[0] && data.CHN.PinYin[0].explain) {
  1330. obj.Content = data.CHN.PinYin[0].explain.substr(0, WORD_LENGTH);
  1331. obj.Content = obj.Content.replace("<p>", "");
  1332. obj.Content = obj.Content.replace("</p>", "");
  1333. if (obj.Content.length >= WORD_LENGTH)
  1334. obj.Content += "..."
  1335. }
  1336. if (obj.Key.length == 1)
  1337. obj.TypeName = "Z";
  1338. else
  1339. obj.TypeName = "C";
  1340. }
  1341. if (data.ENG && !data.CHN) {
  1342. obj.Type = "eng";
  1343. obj.TypeName = "D";
  1344. if (data.ENG.Soundmark && data.ENG.Soundmark.Eng)
  1345. obj.Remark = data.ENG.Soundmark.Eng;
  1346. if (data.ENG.Paraphrase.length > 0) {
  1347. if (common.checkIsArray(data.ENG.Paraphrase) && data.ENG.Paraphrase[0].ParaphraseList)
  1348. obj.Content = data.ENG.Paraphrase[0].ParaphraseList.join("; ").substr(0, WORD_LENGTH);
  1349. else
  1350. obj.Content = data.ENG.Paraphrase.substr(0, WORD_LENGTH) + "...";
  1351. }
  1352. }
  1353. app.globalData.TempSearchBackNumber = 2;
  1354. //app.globalData.CardList=[];
  1355. app.globalData.CardList2 = [];
  1356. callback([], obj);
  1357. } else {
  1358. callback([]);
  1359. }
  1360. } else {
  1361. callback([]);
  1362. }
  1363. });
  1364. }
  1365. function downloadBishunKaitiImage(url, serverUrl, dataType, Fields, callback) {
  1366. var param = {};
  1367. param.Url = url;
  1368. param.DataType = dataType;
  1369. if (param.Url == serverUrl) {
  1370. postData("GetBiShunByKaitiUrl", param, function (data) {
  1371. if (data) {
  1372. wx.downloadFile({
  1373. url: data, // 仅为示例,并非真实的资源
  1374. success(res) {
  1375. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  1376. if (res.statusCode === 200) {
  1377. //console.log("serverUrl2:" + serverUrl);
  1378. console.log(res.tempFilePath);
  1379. callback(change(Fields, res.tempFilePath, param));
  1380. }
  1381. },
  1382. complete() {
  1383. }
  1384. });
  1385. }
  1386. });
  1387. } else {
  1388. callback(change(Fields, serverUrl, param));
  1389. }
  1390. function change(Fields, filepath, param) {
  1391. var iStart = 0;
  1392. if (Fields.length == 4)
  1393. iStart = 1
  1394. for (var i = iStart; i < Fields.length; i++) {
  1395. for (var j = 0; j < Fields[i].length; j++) {
  1396. if (Fields[i][j].Type == "image") {
  1397. if (Fields[i][j].Content == param.Url) {
  1398. Fields[i][j].Content = filepath;
  1399. if (param.DataType == "bishun") {
  1400. Fields[i][j].IsShowKaiti = true;
  1401. Fields[i][j].IsShowBishun = false;
  1402. } else if (param.DataType == "kaiti") {
  1403. Fields[i][j].IsShowKaiti = false;
  1404. Fields[i][j].IsShowBishun = true;
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. return Fields;
  1411. }
  1412. }
  1413. function GetSoundError(str) {
  1414. var result = str;
  1415. var arr = wx.getStorageSync('SoundErrorArr');
  1416. if (arr && arr.length>0){
  1417. for (var i = 0; i < arr.length; i++) {
  1418. if (str.indexOf(arr[i].Word) > 0) {
  1419. result = common.ReplaceAllString(str, arr[i].Word, arr[i].Sound);
  1420. break;
  1421. } else if (str == arr[i].Word) {
  1422. result = arr[i].Sound;
  1423. }
  1424. }
  1425. }
  1426. return result;
  1427. }
  1428. function GetTestReportList(userID, callback) {
  1429. getData('GetTestGradeArr', function (GradeArr) {
  1430. for (var i = 0; i < GradeArr.length; i++) {
  1431. for (var j = 0; j < GradeArr[i].List.length; j++) {
  1432. GradeArr[i].List[j].Finish = 0;
  1433. }
  1434. }
  1435. getData('GetTestReportList?UserID=' + userID, function (data) {
  1436. if (data) {
  1437. var dataTemp = [];
  1438. for (var i = 0; i < data.length; i++) {
  1439. for (var j = 0; j < dataTemp.length; j++) {
  1440. if (dataTemp[j].Name[0] == data[i].Name[0] &&
  1441. dataTemp[j].Name[1] == data[i].Name[1] &&
  1442. dataTemp[j].TestType == data[i].TestType &&
  1443. data[i].IsFinished == 1
  1444. ) {
  1445. dataTemp.splice(j, 1);
  1446. break;
  1447. }
  1448. }
  1449. dataTemp.push(data[i]);
  1450. if (data[i].Name[0].indexOf("英语") >= 0 || data[i].Name[0].indexOf("语文词语") >= 0 || data[i].Name[0].indexOf("识字 上学期") >= 0 || data[i].Name[0].indexOf("拼音") >= 0 || data[i].Name[1].indexOf("古诗文") >= 0 || data[i].Name[0].indexOf("文言文") >= 0) {
  1451. if (data[i].TestRightStr) {
  1452. data[i].TestRightStr = data[i].TestRightStr.split(",");
  1453. }
  1454. if (data[i].TestWrongStr) {
  1455. data[i].TestWrongStr = data[i].TestWrongStr.split(",");
  1456. }
  1457. if (data[i].TestSkipStr) {
  1458. data[i].TestSkipStr = data[i].TestSkipStr.split(",");
  1459. }
  1460. if (data[i].TestExistStr) {
  1461. data[i].TestExistStr = data[i].TestExistStr.split(",");
  1462. }
  1463. }
  1464. if (!data[i].TestRightStr)
  1465. data[i].TestRightStr = "";
  1466. if (!data[i].TestWrongStr)
  1467. data[i].TestWrongStr = "";
  1468. if (!data[i].TestSkipStr)
  1469. data[i].TestSkipStr = "";
  1470. if (!data[i].TestExistStr)
  1471. data[i].TestExistStr = "";
  1472. }
  1473. for (var i = 0; i < dataTemp.length; i++) {
  1474. var name = dataTemp[i].Name[0].split(" ");
  1475. for (var j = 0; j < GradeArr.length; j++) {
  1476. var item = GradeArr[j];
  1477. if (name[0] == item.Name) {
  1478. for (var k = 0; k < item.List.length; k++) {
  1479. //音标计算进度
  1480. if (item.List[k].ID == 101 && dataTemp[i].BookID == 101) {
  1481. for (var n = 1; n <= 4; n++) {
  1482. if (Number(dataTemp[i].Name[2]) == n && dataTemp[i].IsFinished == 1)
  1483. item.List[k].Finish++;
  1484. }
  1485. }
  1486. //古诗词计算进度
  1487. else if (item.List[k].ID == dataTemp[i].BookID && dataTemp[i].TestType == "recite" && dataTemp[i].IsFinished == 1)
  1488. item.List[k].Finish = 1;
  1489. else {
  1490. if (name[1] == item.List[k].Name && name[2] == item.List[k].Name2) {
  1491. if (dataTemp[i].IsFinished == 1)
  1492. item.List[k].Finish++;
  1493. }
  1494. }
  1495. }
  1496. }
  1497. }
  1498. }
  1499. for (var j = 0; j < GradeArr.length; j++) {
  1500. var item = GradeArr[j];
  1501. for (var k = 0; k < item.List.length; k++) {
  1502. item.List[k].Finished = Math.round(100 * item.List[k].Finish / item.List[k].Total);
  1503. item.List[k].NameStr = item.List[k].Name.replace("语文", "");
  1504. }
  1505. }
  1506. wx.setStorageSync("UserTestReport", data);
  1507. callback(data, GradeArr);
  1508. }
  1509. });
  1510. });
  1511. }
  1512. function showHelp(obj,myClass,textTopDirection,helpText,closePos){
  1513. setTimeout(function(){
  1514. wx.createSelectorQuery().select(myClass).boundingClientRect(function (rect) {
  1515. console.log("rect.left:"+rect.left);
  1516. console.log("rect.top:"+rect.top);
  1517. console.log("rect.width:"+rect.width);
  1518. console.log("rect.height:"+rect.height);
  1519. var textTop=rect.bottom+5;
  1520. if (textTopDirection=="up")
  1521. textTop=rect.top-47;
  1522. if (!closePos)
  1523. closePos="Right";
  1524. obj.setData({
  1525. HelpTop:rect.top,
  1526. HelpWidth1:rect.left,
  1527. HelpHeight1:rect.height,
  1528. HelpLeft2:rect.right,
  1529. HelpHeight2:rect.height,
  1530. HelpBottom:rect.bottom-1,
  1531. HelpTextTop:textTop,
  1532. HelpText:helpText,
  1533. HelpClosePos:closePos,
  1534. });
  1535. }).exec();
  1536. },500);
  1537. }
  1538. function gotoTaskList(id,cardType) {
  1539. wx.showLoading({
  1540. title: '请稍候',
  1541. });
  1542. setTimeout(function () {
  1543. wx.hideLoading();
  1544. }, 5000);
  1545. var that = this;
  1546. //未练完的题卡
  1547. if (id == 1) {
  1548. getTaskTodayList(function (task) {
  1549. var list = [];
  1550. for (var i = 0; i < task.ListNew.length; i++) {
  1551. list.push(task.ListNew[i]);
  1552. }
  1553. for (var i = 0; i < task.ListHistory.length; i++) {
  1554. list.push(task.ListHistory[i]);
  1555. }
  1556. for (var i = 0; i < task.ListReview.length; i++) {
  1557. list.push(task.ListReview[i]);
  1558. }
  1559. app.globalData.CardList = list;
  1560. wx.navigateTo({
  1561. url: '../main/mainlist?type=1&Count=' + list.length,
  1562. });
  1563. });
  1564. } else {
  1565. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID + "&IsToday=2&CardType="+ cardType +"&OrderType=ac.LastTime desc";
  1566. getData(url, function (data) {
  1567. if (data) {
  1568. var list = [];
  1569. for (var i = 0; i < data.List.length; i++) {
  1570. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  1571. list.push(data.List[i]);
  1572. }
  1573. app.globalData.CardList = list;
  1574. wx.navigateTo({
  1575. url: '../main/mainlist?type=2&Count=' + data.length,
  1576. });
  1577. }
  1578. });
  1579. }
  1580. }
  1581. function resetTodayTask(){
  1582. wx.showModal({
  1583. title: '提醒',
  1584. content: '此操作无法撤销。确认重置今天的任务量吗?',
  1585. showCancel:true,
  1586. cancelText:"确定",
  1587. confirmColor:"#000000",
  1588. confirmText:"取消",
  1589. success (res) {
  1590. if (res.confirm) {
  1591. //console.log('用户点击取消');
  1592. } else if (res.cancel) {
  1593. //console.log('用户点击确定')
  1594. var url = "ResetMiaoguoCardTask?UserID=" + app.globalData.userInfo.UserID;
  1595. getData(url, function (data) {
  1596. if (data) {
  1597. wx.showModal({
  1598. title: '提醒',
  1599. content: '重置已完成。请重新开始今天的练习吧。',
  1600. showCancel:false,
  1601. confirmColor:"#000000",
  1602. confirmText:"返回首页",
  1603. success (res) {
  1604. wx.navigateBack({
  1605. delta: 2,
  1606. });
  1607. }
  1608. });
  1609. }
  1610. });
  1611. }
  1612. }
  1613. });
  1614. }
  1615. //下载图片
  1616. function downloadFile(url,isShowLoading,callback){
  1617. if (isShowLoading){
  1618. wx.showLoading({
  1619. title: '下载中',
  1620. });
  1621. setTimeout(function () {
  1622. wx.hideLoading();
  1623. }, 5000);
  1624. }
  1625. wx.downloadFile({
  1626. url: url,
  1627. success(resDownload) {
  1628. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  1629. if (resDownload.statusCode === 200) {
  1630. callback(resDownload.tempFilePath);
  1631. }
  1632. else if (resDownload.statusCode === 404){
  1633. wx.showToast({
  1634. title: '图片不存在',
  1635. });
  1636. }
  1637. if (isShowLoading)
  1638. wx.hideLoading();
  1639. },
  1640. fail: function (e) {
  1641. if (isShowLoading)
  1642. wx.hideLoading();
  1643. wx.showToast({
  1644. title: '下载失败',
  1645. });
  1646. }
  1647. });
  1648. }
  1649. //生成图片
  1650. function buildImage(width,height,canvas,callback){
  1651. var that=this;
  1652. wx.showLoading({
  1653. title: '生成中',
  1654. });
  1655. setTimeout(function () {
  1656. //console.log("生成后1");
  1657. wx.canvasToTempFilePath({
  1658. x: 0,
  1659. y: 0,
  1660. width: width,
  1661. height: height,
  1662. destWidth: width,
  1663. destHeight: height,
  1664. canvas: canvas,
  1665. success: function (res2) {
  1666. wx.hideLoading();
  1667. //console.log("生成后2");
  1668. wx.previewImage({
  1669. current: res2.tempFilePath, // 当前显示图片的http链接
  1670. urls: [res2.tempFilePath] // 需要预览的图片http链接列表
  1671. });
  1672. callback();
  1673. },
  1674. fail: function (e) {
  1675. wx.hideLoading();
  1676. //console.log("生成错误:"+e);
  1677. }
  1678. })
  1679. }, 500);
  1680. }
  1681. function showHelpImage() {
  1682. var arr=[];
  1683. arr.push(app.globalData.uploadImageUrl+"web/doc_xnl_36_1.png")
  1684. arr.push(app.globalData.uploadImageUrl+"web/doc_xnl_36_2.png")
  1685. wx.previewImage({
  1686. current: arr[0],
  1687. urls: arr,
  1688. });
  1689. }
  1690. module.exports = {
  1691. getData: getData,
  1692. postData: postData,
  1693. payMoney: payMoney,
  1694. getLocalHost: getLocalHost,
  1695. getTimeFormat: getTimeFormat,
  1696. getWindowHeight: getWindowHeight,
  1697. getStorageValue: getStorageValue,
  1698. getProgramList: getProgramList,
  1699. gotoFeedback: gotoFeedback,
  1700. getDetailColor: getDetailColor,
  1701. changeStringToView: changeStringToView,
  1702. changeViewToString: changeViewToString,
  1703. encryptUrl: EncryptUrl,
  1704. decryptUrl: DecryptUrl,
  1705. saveTempImage: saveTempImage,
  1706. getTempImage: getTempImage,
  1707. getTaskTodayList: getTaskTodayList,
  1708. updateSearchList: updateSearchList,
  1709. checkIsIPhoneX: checkIsIPhoneX,
  1710. getMemoryLevelAll: getMemoryLevelAll,
  1711. getMemoryLevel: getMemoryLevel,
  1712. getShareImageBackColor: getShareImageBackColor,
  1713. UpdateMiaoguoCardTodayAll: UpdateMiaoguoCardTodayAll,
  1714. setCollect: setCollect,
  1715. UploadUserConfig: UploadUserConfig,
  1716. getServerImage: getServerImage,
  1717. getBaiduToken: getBaiduToken,
  1718. buildInitData: buildInitData,
  1719. getPinyinNormal: getPinyinNormal,
  1720. getHanzi: getHanzi,
  1721. getEnglish: getEnglish,
  1722. GetHanziUnitWords: GetHanziUnitWords,
  1723. GetTestReportInfo: GetTestReportInfo,
  1724. getUserConfig: getUserConfig,
  1725. getAwardData: getAwardData,
  1726. replaceCardInfoString: replaceCardInfoString,
  1727. searchInfomation: searchInfomation,
  1728. downloadBishunKaitiImage: downloadBishunKaitiImage,
  1729. GetSoundError: GetSoundError,
  1730. GetTestReportList: GetTestReportList,
  1731. ShowHelp:showHelp,
  1732. GotoTaskList:gotoTaskList,
  1733. ResetTodayTask:resetTodayTask,
  1734. DownloadFile:downloadFile,
  1735. BuildImage:buildImage,
  1736. ShowHelpImage:showHelpImage,
  1737. getServerSoundErrorArr:getServerSoundErrorArr,
  1738. }