main.js 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932
  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 || name1[0].indexOf("4000") >= 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. } else if (bookid > 140 && bookid <= 150 && UserTestReport[n].Name[2]) {
  837. unitsid = Number(UserTestReport[n].Name[2]);
  838. }
  839. getData('GetTestEnglishWords?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + bookid + '&LessonID=' + unitsid + '&Words=' + wordStr + "&TestType=" + userTestReportInfo.TestType, function (data) {
  840. if (data) {
  841. var result = {};
  842. result.ID = userTestReportInfo.ID;
  843. result.IsFinished = userTestReportInfo.IsFinished;
  844. result.Name = userTestReportInfo.Name.join("#");
  845. result.TestType = userTestReportInfo.TestType;
  846. result.BookID = bookid;
  847. var TaskList = [];
  848. var words = data;
  849. for (var k = 0; k < words.length; k++) {
  850. var taskInfo = words[k];
  851. if (userTestReportInfo.TestType == "read") {
  852. taskInfo.TagWidth = 212;
  853. taskInfo.FontSize = 108;
  854. } else {
  855. taskInfo.TagWidth = 186;
  856. taskInfo.FontSize = 36;
  857. }
  858. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  859. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  860. taskInfo.Result = 1;
  861. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  862. taskInfo.Result = -1;
  863. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  864. taskInfo.Result = 0;
  865. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  866. taskInfo.Css = "Select2";
  867. TaskList.push(taskInfo);
  868. }
  869. result.TestRightStr = "";
  870. result.TestWrongStr = "";
  871. result.TestSkipStr = "";
  872. result.TestExistStr = "";
  873. if (userTestReportInfo.TestRightStr)
  874. result.TestRightStr = userTestReportInfo.TestRightStr;
  875. if (userTestReportInfo.TestWrongStr)
  876. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  877. if (userTestReportInfo.TestSkipStr)
  878. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  879. if (userTestReportInfo.TestExistStr)
  880. result.TestExistStr = userTestReportInfo.TestExistStr;
  881. result.List = TaskList;
  882. callback(result);
  883. } else {
  884. callback({});
  885. }
  886. });
  887. } else if (name1[1].indexOf("拼音") >= 0) {
  888. //console.log("拼音");
  889. var userTestReportInfo = UserTestReport[n];
  890. var bookid = userTestReportInfo.BookID;
  891. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  892. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  893. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  894. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  895. var unitsid = "";
  896. var name2 = userTestReportInfo.Name[1];
  897. if (bookid == 43) {
  898. switch (name2) {
  899. case "声母1":
  900. unitsid = 431;
  901. break;
  902. case "声母2":
  903. unitsid = 432;
  904. break;
  905. case "声母3":
  906. unitsid = 433;
  907. break;
  908. case "韵母1":
  909. unitsid = 434;
  910. break;
  911. case "韵母2":
  912. unitsid = 435;
  913. break;
  914. case "韵母3":
  915. unitsid = 436;
  916. break;
  917. case "整体认读1":
  918. unitsid = 437;
  919. break;
  920. case "整体认读2":
  921. unitsid = 438;
  922. break;
  923. }
  924. }
  925. getData('GetPinyinUnitWords?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + bookid + '&UnitID=' + unitsid + '&Word=' + name2, function (data) {
  926. if (data) {
  927. var result = {};
  928. result.ID = userTestReportInfo.ID;
  929. result.IsFinished = userTestReportInfo.IsFinished;
  930. result.Name = userTestReportInfo.Name.join("#");
  931. result.TestType = userTestReportInfo.TestType;
  932. result.BookID = bookid;
  933. var TaskList = [];
  934. var words = data;
  935. for (var k = 0; k < words.length; k++) {
  936. var taskInfo = words[k];
  937. taskInfo.TagWidth = 230;
  938. taskInfo.FontSize = 108;
  939. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  940. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  941. taskInfo.Result = 1;
  942. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  943. taskInfo.Result = -1;
  944. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  945. taskInfo.Result = 0;
  946. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  947. taskInfo.Css = "Select2";
  948. TaskList.push(taskInfo);
  949. }
  950. result.TestRightStr = "";
  951. result.TestWrongStr = "";
  952. result.TestSkipStr = "";
  953. result.TestExistStr = "";
  954. if (userTestReportInfo.TestRightStr)
  955. result.TestRightStr = userTestReportInfo.TestRightStr;
  956. if (userTestReportInfo.TestWrongStr)
  957. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  958. if (userTestReportInfo.TestSkipStr)
  959. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  960. if (userTestReportInfo.TestExistStr)
  961. result.TestExistStr = userTestReportInfo.TestExistStr;
  962. result.List = TaskList;
  963. callback(result);
  964. } else {
  965. callback({});
  966. }
  967. });
  968. } else if (name2 == "古诗文") {
  969. //todo
  970. //console.log("古诗文");
  971. var userTestReportInfo = UserTestReport[n];
  972. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  973. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  974. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  975. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  976. getData('GetTestAncientPoetryList?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + userTestReportInfo.BookID, function (data) {
  977. if (data) {
  978. var result = {};
  979. result.ID = userTestReportInfo.ID;
  980. result.IsFinished = userTestReportInfo.IsFinished;
  981. result.Name = userTestReportInfo.Name.join("#");
  982. result.TestType = userTestReportInfo.TestType;
  983. result.BookID = userTestReportInfo.BookID;
  984. var TaskList = [];
  985. for (var k = 0; k < data.length; k++) {
  986. var taskInfo = data[k];
  987. taskInfo.TagWidth = 336;
  988. if (taskInfo.Word.length > 9)
  989. taskInfo.FontSize = 48;
  990. else
  991. taskInfo.FontSize = 64;
  992. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  993. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  994. taskInfo.Result = 1;
  995. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  996. taskInfo.Result = -1;
  997. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  998. taskInfo.Result = 0;
  999. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  1000. taskInfo.Css = "Select2";
  1001. TaskList.push(taskInfo);
  1002. }
  1003. result.TestRightStr = "";
  1004. result.TestWrongStr = "";
  1005. result.TestSkipStr = "";
  1006. result.TestExistStr = "";
  1007. if (userTestReportInfo.TestRightStr)
  1008. result.TestRightStr = userTestReportInfo.TestRightStr;
  1009. if (userTestReportInfo.TestWrongStr)
  1010. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  1011. if (userTestReportInfo.TestSkipStr)
  1012. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  1013. if (userTestReportInfo.TestExistStr)
  1014. result.TestExistStr = userTestReportInfo.TestExistStr;
  1015. result.List = TaskList;
  1016. callback(result);
  1017. } else {
  1018. callback({});
  1019. }
  1020. });
  1021. } else {
  1022. var obj = UserTestReport[n];
  1023. if (obj.BookID >= 43 && obj.BookID <= 60)
  1024. name1 = name1[0] + "生词" + name1[2].substr(0, 1);
  1025. else if (obj.BookID == 73)
  1026. name1 = name1[0] + name1[1].substr(2, 3) + name1[2];
  1027. else
  1028. name1 = name1[0] + name1[1].substr(2, 2) + "能力" + name1[2].substr(0, 1);
  1029. var HanziAll = wx.getStorageSync('HanziAll');
  1030. HanziAll = JSON.parse(HanziAll);
  1031. for (var i = 0; i < HanziAll.length; i++) {
  1032. if (name1 == HanziAll[i].Name) {
  1033. for (var j = 0; j < HanziAll[i].Units.length; j++) {
  1034. if (name2 == HanziAll[i].Units[j].Name) {
  1035. GetHanziUnitWords(HanziAll[i].Units[j].ID, obj.TestType, function (list) {
  1036. if (list) {
  1037. for (var k = 0; k < list.length; k++) {
  1038. if (obj.TestRightStr && obj.TestRightStr.indexOf(list[k].Word) >= 0)
  1039. list[k].Result = 1;
  1040. else if (obj.TestWrongStr && obj.TestWrongStr.indexOf(list[k].Word) >= 0)
  1041. list[k].Result = -1;
  1042. else if (obj.TestSkipStr && obj.TestSkipStr.indexOf(list[k].Word) >= 0)
  1043. list[k].Result = 0;
  1044. if (obj.TestExistStr && obj.TestExistStr.indexOf(list[k].Word) >= 0)
  1045. list[k].Css = "Select2";
  1046. }
  1047. var result = {};
  1048. result.ID = reportid;
  1049. result.BookID = obj.BookID;
  1050. result.TestType = obj.TestType;
  1051. result.Name = obj.Name.join("#");
  1052. result.IsFinished = obj.IsFinished;
  1053. result.TestRightStr = obj.TestRightStr;
  1054. result.TestWrongStr = obj.TestWrongStr;
  1055. result.TestSkipStr = obj.TestSkipStr;
  1056. result.TestExistStr = obj.TestExistStr;
  1057. result.List = list;
  1058. callback(result);
  1059. } else
  1060. callback({});
  1061. });
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }
  1067. }
  1068. }
  1069. }
  1070. function getDetailColor(index) {
  1071. var arrDetailColor = constant.arrDetailColor;
  1072. if (index > 0)
  1073. return arrDetailColor[index];
  1074. else if (index == 0)
  1075. return arrDetailColor[common.random(1, arrDetailColor.length - 1)];
  1076. else if (index == -1)
  1077. return arrDetailColor;
  1078. }
  1079. function getShareImageBackColor() {
  1080. var arr = constant.arrShareImageBackColor;
  1081. return arr[common.random(0, arr.length - 1)];
  1082. }
  1083. function getPinyinNormal(pinyin) {
  1084. var result = "";
  1085. var arr = constant.arrPinyin;
  1086. for (var i = 0; i < arr.length; i++) {
  1087. if (arr[i][1] == pinyin) {
  1088. result = arr[i][0];
  1089. break;
  1090. }
  1091. }
  1092. return result;
  1093. }
  1094. function getHanzi(callback) {
  1095. var that = this;
  1096. wx.showLoading({
  1097. title: '请稍候',
  1098. mask: true,
  1099. });
  1100. var time = wx.getStorageSync("HanziUpdateTime");
  1101. getData('GetHanziAll3?UpdateTime=' + time, function (data) {
  1102. wx.hideLoading();
  1103. if (data) {
  1104. var arr = [];
  1105. if (data.List) {
  1106. arr = common.Decrypt(data.List);
  1107. wx.setStorageSync("HanziAll", arr);
  1108. wx.setStorageSync("HanziUpdateTime", data.UpdateTime);
  1109. callback(true);
  1110. } else {
  1111. callback(false);
  1112. }
  1113. }
  1114. });
  1115. }
  1116. function getServerSoundErrorArr(){
  1117. var time = wx.getStorageSync("SoundErrorUpdateTime");
  1118. getData('GetSoundErrorArr?UpdateTime=' + time, function (data) {
  1119. if (data && data.List) {
  1120. wx.setStorageSync("SoundErrorArr", data.List);
  1121. wx.setStorageSync("SoundErrorUpdateTime", data.UpdateTime);
  1122. }
  1123. });
  1124. }
  1125. function getEnglish(callback) {
  1126. var that = this;
  1127. wx.showLoading({
  1128. title: '请稍候',
  1129. mask: true,
  1130. });
  1131. var time = wx.getStorageSync("HanziUpdateTime");
  1132. getData('GetEnglishAll3?UpdateTime=' + time, function (data) {
  1133. wx.hideLoading();
  1134. if (data.EngList) {
  1135. var arrEng = common.Decrypt(data.EngList);
  1136. var arrNewConceptEngList = common.Decrypt(data.NewConceptEngList);
  1137. var arrCambridgeEngList = common.Decrypt(data.CambridgeEngList);
  1138. var arrEEWEngList = common.Decrypt(data.EEWEngList);
  1139. var arrPhoneticEngList = common.Decrypt(data.PhoneticEngList);
  1140. wx.setStorageSync("EnglishAll", arrEng);
  1141. wx.setStorageSync("NewConceptEngList", arrNewConceptEngList);
  1142. wx.setStorageSync("CambridgeEngList", arrCambridgeEngList);
  1143. wx.setStorageSync("EEWEngList", arrEEWEngList);
  1144. wx.setStorageSync("PhoneticEngList", arrPhoneticEngList);
  1145. wx.setStorageSync("EnglishUpdateTime", data.UpdateTime);
  1146. callback(true);
  1147. } else {
  1148. callback(false);
  1149. }
  1150. });
  1151. }
  1152. function UploadUserConfig(callback) {
  1153. var that = this;
  1154. var param1 = {};
  1155. param1.CardType = wx.getStorageSync("CardType");
  1156. param1.CardMaxNumberNew = wx.getStorageSync("CardMaxNumberNew");
  1157. param1.CardMaxNumberHistory = wx.getStorageSync("CardMaxNumberHistory");
  1158. param1.CardMaxNumberNewUrgent = wx.getStorageSync("CardMaxNumberNewUrgent");
  1159. param1.CardMaxNumberHistoryUrgent = wx.getStorageSync("CardMaxNumberHistoryUrgent");
  1160. param1.SortTypeIndex = wx.getStorageSync("SortTypeIndex");
  1161. param1.MemoryLevel = wx.getStorageSync("MemoryLevel");
  1162. param1.ClickType = wx.getStorageSync("ClickType");
  1163. param1.SecondConfigArray = wx.getStorageSync("SecondConfigArray").join(",");
  1164. param1.ColorIndexArr = wx.getStorageSync("ColorIndexArr").join(",");
  1165. param1.IsFolderPractice = wx.getStorageSync("IsFolderPractice");
  1166. param1.IsAutoSound = wx.getStorageSync("IsAutoSound");
  1167. var symboMain = wx.getStorageSync("SymbolMain");
  1168. var symbol1 = [];
  1169. for (var i = 0; i < symboMain.length; i++) {
  1170. symbol1.push(symboMain[i].Name);
  1171. }
  1172. symbol1 = JSON.stringify(symbol1);
  1173. param1.SymbolList = symbol1;
  1174. var folderOrder = wx.getStorageSync("FolderOrderStr");
  1175. if (folderOrder)
  1176. param1.FolderOrder = folderOrder;
  1177. //console.log(param1);
  1178. that.postData('UploadUserConfig?Type=update&UserID=' + app.globalData.userInfo.UserID, param1, function (data) {
  1179. if (callback) {
  1180. callback();
  1181. }
  1182. });
  1183. }
  1184. function getAwardData(callback) {
  1185. var that = this;
  1186. that.getData('GetAwardInfo?UserID=' + app.globalData.userInfo.UserID, function (data) {
  1187. if (data) {
  1188. callback(data);
  1189. } else
  1190. callback([]);
  1191. });
  1192. }
  1193. function getUserConfig() {
  1194. var that = this;
  1195. postData('UploadUserConfig?Type=getData&UserID=' + app.globalData.userInfo.UserID, {}, function (data) {
  1196. if (data && !data.CardType)
  1197. data.CardType = 0;
  1198. wx.setStorageSync("CardType", data.CardType);
  1199. wx.setStorageSync("CardMaxNumberNew", data.CardMaxNumberNew);
  1200. wx.setStorageSync("CardMaxNumberHistory", data.CardMaxNumberHistory);
  1201. wx.setStorageSync("CardMaxNumberNewUrgent", data.CardMaxNumberNewUrgent);
  1202. wx.setStorageSync("CardMaxNumberHistoryUrgent", data.CardMaxNumberHistoryUrgent);
  1203. wx.setStorageSync("SortTypeIndex", data.SortTypeIndex);
  1204. wx.setStorageSync("MemoryLevel", data.MemoryLevel);
  1205. wx.setStorageSync("ClickType", data.ClickType);
  1206. wx.setStorageSync("SecondConfigArray", data.SecondConfigArray.split(","));
  1207. wx.setStorageSync("ColorIndexArr", data.ColorIndexArr.split(","));
  1208. wx.setStorageSync("FolderOrderStr", data.FolderOrder);
  1209. wx.setStorageSync("IsFolderPractice", data.IsFolderPractice);
  1210. wx.setStorageSync("IsAutoSound", data.IsAutoSound);
  1211. var symbol1 = [];
  1212. if (data.SymbolList) {
  1213. for (var i = 0; i < data.SymbolList.length; i++) {
  1214. var obj = {};
  1215. obj.Name = data.SymbolList[i];
  1216. obj.CSS = "btn2";
  1217. symbol1.push(obj);
  1218. }
  1219. } else {
  1220. symbol1 = app.globalData.SymbolMain;
  1221. }
  1222. if (symbol1.length > 0) {
  1223. wx.setStorageSync("SymboMain", symbol1);
  1224. app.globalData.SymbolMain = symbol1;
  1225. }
  1226. });
  1227. }
  1228. function replaceCardInfoString(str) {
  1229. var that = this;
  1230. //str = str.replace(/\[图]/g, "");
  1231. //str = str.replace(/\[\/图\]/g, "");
  1232. //console.log(str);
  1233. if (str && str!=null) {
  1234. var str2 = "";
  1235. if (str.indexOf("[读 src=") >= 0) {
  1236. str2 = str.substr(str.indexOf("[读 src="));
  1237. str2 = str2.substring(0, str2.indexOf("]") + 1);
  1238. }
  1239. str = str.replace(str2, "");
  1240. if (str.indexOf("[/读") >= 0) {
  1241. str2 = str.substr(str.indexOf("[/读"));
  1242. str2 = str2.substring(0, 4);
  1243. }
  1244. str = str.replace(str2, "");
  1245. if (str.indexOf("[读 src=") >= 0) {
  1246. str2 = str.substr(str.indexOf("[读 src"));
  1247. str2 = str2.substring(0, str2.indexOf("/读]") + 3);
  1248. }
  1249. str = str.replace(str2, "");
  1250. if (str.indexOf("[/读") >= 0) {
  1251. str2 = str.substr(str.indexOf("[/读"));
  1252. str2 = str2.substring(0, 4);
  1253. }
  1254. str = str.replace(str2, "");
  1255. str = str.replace(/\[读]/g, "");
  1256. str = str.replace(/\[\/读\]/g, "");
  1257. var str3 = "";
  1258. if (str.indexOf("[图") >= 0) {
  1259. str3 = str.substr(str.indexOf("[图"));
  1260. str3 = str3.substring(0, str3.indexOf("/图]") + 3);
  1261. }
  1262. str = str.replace(str3, "");
  1263. if (str.indexOf("[图") >= 0) {
  1264. str3 = str.substr(str.indexOf("[图"));
  1265. str3 = str3.substring(0, str3.indexOf("/图]") + 3);
  1266. }
  1267. str = str.replace(str3, "");
  1268. str = str.replace(/\[线]/g, "");
  1269. str = str.replace(/\[\/线\]/g, "");
  1270. str = that.encryptUrl(str);
  1271. }
  1272. return str;
  1273. }
  1274. function searchInfomation(search, searchtype, author, shiciurl, callback) {
  1275. var WORD_LENGTH = 18;
  1276. wx.showLoading({
  1277. title: '查询中',
  1278. });
  1279. var timeout = setTimeout(function () {
  1280. wx.hideLoading();
  1281. }, 5000);
  1282. var url = 'GetMiaoguoAISearch2?UserID=' + app.globalData.userInfo.UserID;
  1283. url += "&Word=" + encodeURI(search);
  1284. if (searchtype)
  1285. url += "&SearchType=" + searchtype;
  1286. if (author)
  1287. url += "&Author=" + encodeURI(author);
  1288. if (shiciurl)
  1289. url += "&ShiciUrl=" + shiciurl;
  1290. getData(url, function (data) {
  1291. wx.hideLoading();
  1292. clearTimeout(timeout);
  1293. if (data) {
  1294. //console.log(data);
  1295. if (data.List) {
  1296. var len = WORD_LENGTH;
  1297. var list = data.List;
  1298. for (var i = 0; i < list.length; i++) {
  1299. var item = list[i];
  1300. if (item.TypeName == "字词") {
  1301. if (item.Key.length == 1)
  1302. item.TypeName = "Z";
  1303. else
  1304. item.TypeName = "C";
  1305. } else if (item.TypeName == "诗词") {
  1306. item.TypeName = "S";
  1307. item.Remark = item.Author + " " + item.Dynasty;
  1308. } else if (item.TypeName == "翻译") {
  1309. item.TypeName = "D";
  1310. }
  1311. if (item.Content && item.Content.length > len)
  1312. item.Content = item.Content.substr(0, len) + "...";
  1313. }
  1314. callback(list);
  1315. } else if (data.CHN || data.ENG) {
  1316. var obj = {};
  1317. obj.Key = search;
  1318. obj.Value = data;
  1319. if (data.CHN && data.CHN.Author)
  1320. obj.Author = data.CHN.Author;
  1321. if (data.CHN && data.CHN.Dynasty)
  1322. obj.Dynasty = data.CHN.Dynasty;
  1323. if (data.CHN && data.CHN.PeomContent) {
  1324. obj.Type = "shici";
  1325. obj.TypeName = "诗词";
  1326. obj.Content = data.CHN.PeomContent.join("").substr(0, WORD_LENGTH);
  1327. obj.ShiciUrl = shiciurl;
  1328. obj.TypeName = "S";
  1329. } else if (data.CHN) {
  1330. obj.Type = "zici";
  1331. if (data.CHN.PinYin && data.CHN.PinYin[0] && data.CHN.PinYin[0].pinyin)
  1332. obj.Remark = data.CHN.PinYin[0].pinyin;
  1333. if (data.CHN.PinYin && data.CHN.PinYin[0] && data.CHN.PinYin[0].explain) {
  1334. obj.Content = data.CHN.PinYin[0].explain.substr(0, WORD_LENGTH);
  1335. obj.Content = obj.Content.replace("<p>", "");
  1336. obj.Content = obj.Content.replace("</p>", "");
  1337. if (obj.Content.length >= WORD_LENGTH)
  1338. obj.Content += "..."
  1339. }
  1340. if (obj.Key.length == 1)
  1341. obj.TypeName = "Z";
  1342. else
  1343. obj.TypeName = "C";
  1344. }
  1345. if (data.ENG && !data.CHN) {
  1346. obj.Type = "eng";
  1347. obj.TypeName = "D";
  1348. if (data.ENG.Soundmark && data.ENG.Soundmark.Eng)
  1349. obj.Remark = data.ENG.Soundmark.Eng;
  1350. if (data.ENG.Paraphrase.length > 0) {
  1351. if (common.checkIsArray(data.ENG.Paraphrase) && data.ENG.Paraphrase[0].ParaphraseList)
  1352. obj.Content = data.ENG.Paraphrase[0].ParaphraseList.join("; ").substr(0, WORD_LENGTH);
  1353. else
  1354. obj.Content = data.ENG.Paraphrase.substr(0, WORD_LENGTH) + "...";
  1355. }
  1356. }
  1357. app.globalData.TempSearchBackNumber = 2;
  1358. //app.globalData.CardList=[];
  1359. app.globalData.CardList2 = [];
  1360. callback([], obj);
  1361. } else {
  1362. callback([]);
  1363. }
  1364. } else {
  1365. callback([]);
  1366. }
  1367. });
  1368. }
  1369. function downloadBishunKaitiImage(url, serverUrl, dataType, Fields, callback) {
  1370. var param = {};
  1371. param.Url = url;
  1372. param.DataType = dataType;
  1373. if (param.Url == serverUrl) {
  1374. postData("GetBiShunByKaitiUrl", param, function (data) {
  1375. if (data) {
  1376. wx.downloadFile({
  1377. url: data, // 仅为示例,并非真实的资源
  1378. success(res) {
  1379. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  1380. if (res.statusCode === 200) {
  1381. //console.log("serverUrl2:" + serverUrl);
  1382. console.log(res.tempFilePath);
  1383. callback(change(Fields, res.tempFilePath, param));
  1384. }
  1385. },
  1386. complete() {
  1387. }
  1388. });
  1389. }
  1390. });
  1391. } else {
  1392. callback(change(Fields, serverUrl, param));
  1393. }
  1394. function change(Fields, filepath, param) {
  1395. var iStart = 0;
  1396. if (Fields.length == 4)
  1397. iStart = 1
  1398. for (var i = iStart; i < Fields.length; i++) {
  1399. for (var j = 0; j < Fields[i].length; j++) {
  1400. if (Fields[i][j].Type == "image") {
  1401. if (Fields[i][j].Content == param.Url) {
  1402. Fields[i][j].Content = filepath;
  1403. if (param.DataType == "bishun") {
  1404. Fields[i][j].IsShowKaiti = true;
  1405. Fields[i][j].IsShowBishun = false;
  1406. } else if (param.DataType == "kaiti") {
  1407. Fields[i][j].IsShowKaiti = false;
  1408. Fields[i][j].IsShowBishun = true;
  1409. }
  1410. }
  1411. }
  1412. }
  1413. }
  1414. return Fields;
  1415. }
  1416. }
  1417. function GetSoundError(str) {
  1418. var result = str;
  1419. var arr = wx.getStorageSync('SoundErrorArr');
  1420. if (arr && arr.length>0){
  1421. for (var i = 0; i < arr.length; i++) {
  1422. if (str.indexOf(arr[i].Word) > 0) {
  1423. result = common.ReplaceAllString(str, arr[i].Word, arr[i].Sound);
  1424. break;
  1425. } else if (str == arr[i].Word) {
  1426. result = arr[i].Sound;
  1427. }
  1428. }
  1429. }
  1430. return result;
  1431. }
  1432. function GetTestReportList(userID, callback) {
  1433. getData('GetTestGradeArr', function (GradeArr) {
  1434. for (var i = 0; i < GradeArr.length; i++) {
  1435. for (var j = 0; j < GradeArr[i].List.length; j++) {
  1436. GradeArr[i].List[j].Finish = 0;
  1437. }
  1438. }
  1439. getData('GetTestReportList?UserID=' + userID, function (data) {
  1440. if (data) {
  1441. var dataTemp = [];
  1442. for (var i = 0; i < data.length; i++) {
  1443. for (var j = 0; j < dataTemp.length; j++) {
  1444. if (dataTemp[j].Name[0] == data[i].Name[0] &&
  1445. dataTemp[j].Name[1] == data[i].Name[1] &&
  1446. dataTemp[j].TestType == data[i].TestType &&
  1447. data[i].IsFinished == 1
  1448. ) {
  1449. dataTemp.splice(j, 1);
  1450. break;
  1451. }
  1452. }
  1453. dataTemp.push(data[i]);
  1454. if (data[i].Name[0].indexOf("英语") >= 0 || data[i].Name[0].indexOf("4000") >= 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) {
  1455. if (data[i].TestRightStr) {
  1456. data[i].TestRightStr = data[i].TestRightStr.split(",");
  1457. }
  1458. if (data[i].TestWrongStr) {
  1459. data[i].TestWrongStr = data[i].TestWrongStr.split(",");
  1460. }
  1461. if (data[i].TestSkipStr) {
  1462. data[i].TestSkipStr = data[i].TestSkipStr.split(",");
  1463. }
  1464. if (data[i].TestExistStr) {
  1465. data[i].TestExistStr = data[i].TestExistStr.split(",");
  1466. }
  1467. }
  1468. if (!data[i].TestRightStr)
  1469. data[i].TestRightStr = "";
  1470. if (!data[i].TestWrongStr)
  1471. data[i].TestWrongStr = "";
  1472. if (!data[i].TestSkipStr)
  1473. data[i].TestSkipStr = "";
  1474. if (!data[i].TestExistStr)
  1475. data[i].TestExistStr = "";
  1476. }
  1477. for (var i = 0; i < dataTemp.length; i++) {
  1478. var name = dataTemp[i].Name[0].split(" ");
  1479. for (var j = 0; j < GradeArr.length; j++) {
  1480. var item = GradeArr[j];
  1481. if (name[0] == item.Name) {
  1482. for (var k = 0; k < item.List.length; k++) {
  1483. //音标计算进度
  1484. if (item.List[k].ID == 101 && dataTemp[i].BookID == 101) {
  1485. for (var n = 1; n <= 4; n++) {
  1486. if (Number(dataTemp[i].Name[2]) == n && dataTemp[i].IsFinished == 1)
  1487. item.List[k].Finish++;
  1488. }
  1489. }
  1490. //古诗词计算进度
  1491. else if (item.List[k].ID == dataTemp[i].BookID && dataTemp[i].TestType == "recite" && dataTemp[i].IsFinished == 1)
  1492. item.List[k].Finish = 1;
  1493. else {
  1494. if (name[1] == item.List[k].Name && name[2] == item.List[k].Name2) {
  1495. if (dataTemp[i].IsFinished == 1)
  1496. item.List[k].Finish++;
  1497. }
  1498. }
  1499. }
  1500. }
  1501. }
  1502. }
  1503. for (var j = 0; j < GradeArr.length; j++) {
  1504. var item = GradeArr[j];
  1505. for (var k = 0; k < item.List.length; k++) {
  1506. item.List[k].Finished = Math.round(100 * item.List[k].Finish / item.List[k].Total);
  1507. item.List[k].NameStr = item.List[k].Name.replace("语文", "");
  1508. }
  1509. }
  1510. wx.setStorageSync("UserTestReport", data);
  1511. callback(data, GradeArr);
  1512. }
  1513. });
  1514. });
  1515. }
  1516. function showHelp(obj,myClass,textTopDirection,helpText,closePos){
  1517. setTimeout(function(){
  1518. wx.createSelectorQuery().select(myClass).boundingClientRect(function (rect) {
  1519. console.log("rect.left:"+rect.left);
  1520. console.log("rect.top:"+rect.top);
  1521. console.log("rect.width:"+rect.width);
  1522. console.log("rect.height:"+rect.height);
  1523. var textTop=rect.bottom+5;
  1524. if (textTopDirection=="up")
  1525. textTop=rect.top-47;
  1526. if (!closePos)
  1527. closePos="Right";
  1528. obj.setData({
  1529. HelpTop:rect.top,
  1530. HelpWidth1:rect.left,
  1531. HelpHeight1:rect.height,
  1532. HelpLeft2:rect.right,
  1533. HelpHeight2:rect.height,
  1534. HelpBottom:rect.bottom-1,
  1535. HelpTextTop:textTop,
  1536. HelpText:helpText,
  1537. HelpClosePos:closePos,
  1538. });
  1539. }).exec();
  1540. },500);
  1541. }
  1542. function gotoTaskList(id,cardType) {
  1543. wx.showLoading({
  1544. title: '请稍候',
  1545. });
  1546. setTimeout(function () {
  1547. wx.hideLoading();
  1548. }, 5000);
  1549. var that = this;
  1550. //未练完的题卡
  1551. if (id == 1) {
  1552. getTaskTodayList(function (task) {
  1553. var list = [];
  1554. for (var i = 0; i < task.ListNew.length; i++) {
  1555. list.push(task.ListNew[i]);
  1556. }
  1557. for (var i = 0; i < task.ListHistory.length; i++) {
  1558. list.push(task.ListHistory[i]);
  1559. }
  1560. for (var i = 0; i < task.ListReview.length; i++) {
  1561. list.push(task.ListReview[i]);
  1562. }
  1563. app.globalData.CardList = list;
  1564. wx.navigateTo({
  1565. url: '../main/mainlist?type=1&Count=' + list.length,
  1566. });
  1567. });
  1568. } else {
  1569. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID + "&IsToday=2&CardType="+ cardType +"&OrderType=ac.LastTime desc";
  1570. getData(url, function (data) {
  1571. if (data) {
  1572. var list = [];
  1573. for (var i = 0; i < data.List.length; i++) {
  1574. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  1575. list.push(data.List[i]);
  1576. }
  1577. app.globalData.CardList = list;
  1578. wx.navigateTo({
  1579. url: '../main/mainlist?type=2&Count=' + data.length,
  1580. });
  1581. }
  1582. });
  1583. }
  1584. }
  1585. function resetTodayTask(){
  1586. wx.showModal({
  1587. title: '提醒',
  1588. content: '此操作无法撤销。确认重置今天的任务量吗?',
  1589. showCancel:true,
  1590. cancelText:"确定",
  1591. confirmColor:"#000000",
  1592. confirmText:"取消",
  1593. success (res) {
  1594. if (res.confirm) {
  1595. //console.log('用户点击取消');
  1596. } else if (res.cancel) {
  1597. //console.log('用户点击确定')
  1598. var url = "ResetMiaoguoCardTask?UserID=" + app.globalData.userInfo.UserID;
  1599. getData(url, function (data) {
  1600. if (data) {
  1601. wx.showModal({
  1602. title: '提醒',
  1603. content: '重置已完成。请重新开始今天的练习吧。',
  1604. showCancel:false,
  1605. confirmColor:"#000000",
  1606. confirmText:"返回首页",
  1607. success (res) {
  1608. wx.navigateBack({
  1609. delta: 2,
  1610. });
  1611. }
  1612. });
  1613. }
  1614. });
  1615. }
  1616. }
  1617. });
  1618. }
  1619. //下载图片
  1620. function downloadFile(url,isShowLoading,callback){
  1621. if (isShowLoading){
  1622. wx.showLoading({
  1623. title: '下载中',
  1624. });
  1625. setTimeout(function () {
  1626. wx.hideLoading();
  1627. }, 5000);
  1628. }
  1629. wx.downloadFile({
  1630. url: url,
  1631. success(resDownload) {
  1632. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  1633. if (resDownload.statusCode === 200) {
  1634. callback(resDownload.tempFilePath);
  1635. }
  1636. else if (resDownload.statusCode === 404){
  1637. wx.showToast({
  1638. title: '图片不存在',
  1639. });
  1640. }
  1641. if (isShowLoading)
  1642. wx.hideLoading();
  1643. },
  1644. fail: function (e) {
  1645. if (isShowLoading)
  1646. wx.hideLoading();
  1647. wx.showToast({
  1648. title: '下载失败',
  1649. });
  1650. }
  1651. });
  1652. }
  1653. //生成图片
  1654. function buildImage(width,height,canvas,callback){
  1655. var that=this;
  1656. wx.showLoading({
  1657. title: '生成中',
  1658. });
  1659. setTimeout(function () {
  1660. //console.log("生成后1");
  1661. wx.canvasToTempFilePath({
  1662. x: 0,
  1663. y: 0,
  1664. width: width,
  1665. height: height,
  1666. destWidth: width,
  1667. destHeight: height,
  1668. canvas: canvas,
  1669. success: function (res2) {
  1670. wx.hideLoading();
  1671. //console.log("生成后2");
  1672. wx.previewImage({
  1673. current: res2.tempFilePath, // 当前显示图片的http链接
  1674. urls: [res2.tempFilePath] // 需要预览的图片http链接列表
  1675. });
  1676. callback();
  1677. },
  1678. fail: function (e) {
  1679. wx.hideLoading();
  1680. //console.log("生成错误:"+e);
  1681. }
  1682. })
  1683. }, 500);
  1684. }
  1685. function showHelpImage() {
  1686. var arr=[];
  1687. arr.push(app.globalData.uploadImageUrl+"web/doc_xnl_36_1.png")
  1688. arr.push(app.globalData.uploadImageUrl+"web/doc_xnl_36_2.png")
  1689. wx.previewImage({
  1690. current: arr[0],
  1691. urls: arr,
  1692. });
  1693. }
  1694. module.exports = {
  1695. getData: getData,
  1696. postData: postData,
  1697. payMoney: payMoney,
  1698. getLocalHost: getLocalHost,
  1699. getTimeFormat: getTimeFormat,
  1700. getWindowHeight: getWindowHeight,
  1701. getStorageValue: getStorageValue,
  1702. getProgramList: getProgramList,
  1703. gotoFeedback: gotoFeedback,
  1704. getDetailColor: getDetailColor,
  1705. changeStringToView: changeStringToView,
  1706. changeViewToString: changeViewToString,
  1707. encryptUrl: EncryptUrl,
  1708. decryptUrl: DecryptUrl,
  1709. saveTempImage: saveTempImage,
  1710. getTempImage: getTempImage,
  1711. getTaskTodayList: getTaskTodayList,
  1712. updateSearchList: updateSearchList,
  1713. checkIsIPhoneX: checkIsIPhoneX,
  1714. getMemoryLevelAll: getMemoryLevelAll,
  1715. getMemoryLevel: getMemoryLevel,
  1716. getShareImageBackColor: getShareImageBackColor,
  1717. UpdateMiaoguoCardTodayAll: UpdateMiaoguoCardTodayAll,
  1718. setCollect: setCollect,
  1719. UploadUserConfig: UploadUserConfig,
  1720. getServerImage: getServerImage,
  1721. getBaiduToken: getBaiduToken,
  1722. buildInitData: buildInitData,
  1723. getPinyinNormal: getPinyinNormal,
  1724. getHanzi: getHanzi,
  1725. getEnglish: getEnglish,
  1726. GetHanziUnitWords: GetHanziUnitWords,
  1727. GetTestReportInfo: GetTestReportInfo,
  1728. getUserConfig: getUserConfig,
  1729. getAwardData: getAwardData,
  1730. replaceCardInfoString: replaceCardInfoString,
  1731. searchInfomation: searchInfomation,
  1732. downloadBishunKaitiImage: downloadBishunKaitiImage,
  1733. GetSoundError: GetSoundError,
  1734. GetTestReportList: GetTestReportList,
  1735. ShowHelp:showHelp,
  1736. GotoTaskList:gotoTaskList,
  1737. ResetTodayTask:resetTodayTask,
  1738. DownloadFile:downloadFile,
  1739. BuildImage:buildImage,
  1740. ShowHelpImage:showHelpImage,
  1741. getServerSoundErrorArr:getServerSoundErrorArr,
  1742. }