main.js 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915
  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-1253256735.file.myqcloud.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. var userid=wx.getStorageSync("ListTaskFinishedUserID");
  567. that.postData('UpdateMiaoguoCardTodayAll?UserID=' + userid, {
  568. List: arr,
  569. }, function (data) {
  570. if (isShowLoading) {
  571. wx.hideLoading();
  572. clearTimeout(dataSendTimeout);
  573. }
  574. if (data) {
  575. wx.removeStorageSync("ListTaskFinished");
  576. wx.removeStorageSync("ListTaskFinishedUserID");
  577. }
  578. if (callback) {
  579. callback();
  580. }
  581. });
  582. } else {
  583. wx.hideLoading();
  584. clearTimeout(dataSendTimeout);
  585. if (callback) {
  586. callback();
  587. }
  588. }
  589. }
  590. function updateSearchList(obj, callback) {
  591. var arr = wx.getStorageSync("SearchWord3");
  592. if (!arr)
  593. arr = [];
  594. if (obj && obj.Type && obj.Type == "shici") {
  595. if (obj.Value.CHN.ShiciTitle)
  596. obj.Key = obj.Value.CHN.ShiciTitle;
  597. if (obj.Key.indexOf("《") == 0)
  598. obj.Key = obj.Key.substring(1, obj.Key.length - 1);
  599. }
  600. for (var i = 0; i < arr.length; i++) {
  601. if (obj.Key && arr[i].Key == obj.Key) {
  602. if (obj.Type == "shici") {
  603. if (arr[i].ShiciUrl == obj.ShiciUrl) {
  604. obj.Value = arr[i].Value;
  605. arr.splice(i, 1);
  606. break;
  607. }
  608. } else {
  609. var b = true;
  610. if (obj.Type && arr[i].Type && arr[i].Type != obj.Type)
  611. b = false;
  612. if (obj.Author && arr[i].Author && arr[i].Author != obj.Author)
  613. b = false;
  614. if (b) {
  615. obj.Value = arr[i].Value;
  616. arr.splice(i, 1);
  617. break;
  618. }
  619. }
  620. }
  621. }
  622. if (obj.Key)
  623. arr.unshift(obj);
  624. if (arr.length > 30) {
  625. arr.pop();
  626. }
  627. wx.setStorageSync("SearchWord3", arr);
  628. app.globalData.SearchItem = obj.Value;
  629. if (obj.TypeName)
  630. app.globalData.SearchItem.TypeName = obj.TypeName;
  631. if (callback)
  632. callback();
  633. }
  634. function checkIsIPhoneX() {
  635. var isIphoneX = false;
  636. if (app.globalData.systemInfo.model.indexOf("iPhone X") >= 0 ||
  637. app.globalData.systemInfo.model.indexOf("iPhone X") >= 0) {
  638. isIphoneX = true;
  639. }
  640. return isIphoneX;
  641. }
  642. //设置收藏
  643. function setCollect(id, collect, callback) {
  644. var that = this;
  645. if (collect) {
  646. wx.showToast({
  647. title: '加注成功',
  648. image: '../images/universalpic_star_white_120x120.png',
  649. });
  650. } else {
  651. wx.showToast({
  652. title: '清除成功',
  653. image: '../images/universalpic_star_whiteline_120x120.png',
  654. });
  655. }
  656. getData("UpdateMiaoguoCardInfo?UserID=" + app.globalData.userInfo.UserID + "&MiaoguoCardID=" + id + "&IsCollect=" + collect, function (data) {
  657. if (callback)
  658. callback();
  659. });
  660. }
  661. function getMemoryLevelAll() {
  662. return constant.arrMemoryLevelAll;
  663. }
  664. function getMemoryLevel(index, number, time) {
  665. var arr = getMemoryLevelAll();
  666. if (index < 1)
  667. return arr[index].Value[number].Name;
  668. else
  669. return replaceStr(time);
  670. function replaceStr(data) {
  671. var result = "";
  672. if (data.indexOf("d") > 0) {
  673. var dayNum = Number(data.replace("d", ""));
  674. if (dayNum >= 365) {
  675. var year1 = Math.floor(dayNum / 365);
  676. var year = year1 + Math.round(10 * (dayNum - year1 * 365) / 365) / 10;
  677. result = year + "年后";
  678. } else {
  679. if (dayNum > 31) {
  680. var month1 = Math.floor(dayNum / 30);
  681. var month = month1 + Math.round(10 * (dayNum - month1 * 30) / 30) / 10;
  682. result = month + "月后";
  683. } else {
  684. result = Number(data.replace("d", ""));
  685. if (result == 1)
  686. result = "明天";
  687. else if (result == 2)
  688. result = "后天";
  689. else
  690. result = (result - 1) + "天后";
  691. }
  692. }
  693. } else if (data.indexOf("m") > 0)
  694. result = data.replace("m", "分钟内");
  695. return result;
  696. }
  697. }
  698. //得到要检验的汉字列表
  699. function GetHanziUnitWords(unitsID, testType, callback) {
  700. var url = 'GetHanziUnitWords?UnitID=' + unitsID;
  701. if (testType)
  702. url += "&TestType=" + testType;
  703. getData(url, function (data) {
  704. if (data) {
  705. var TaskList = [];
  706. var words = data;
  707. //若是单字
  708. if (words[0].Pinyin) {
  709. for (var k = 0; k < words.length; k++) {
  710. var taskInfo = {
  711. FontSize: 144,
  712. TagWidth: 136,
  713. Content: [{
  714. ContentType: 0,
  715. Content: []
  716. },
  717. {
  718. ContentType: 1,
  719. Content: []
  720. },
  721. {
  722. ContentType: 2,
  723. Content: []
  724. },
  725. ]
  726. };
  727. taskInfo.Word = words[k].Name;
  728. var pinyinNormal = "(" + getPinyinNormal(words[k].Pinyin) + ")";
  729. var combineWords = common.ReplaceAllString(words[k].CombineWords, words[k].Name, words[k].Name + pinyinNormal);
  730. taskInfo.ReadString = words[k].Name + pinyinNormal + "," + combineWords + "的" + words[k].Name + pinyinNormal;
  731. if (testType == "read") {
  732. taskInfo.Content[0].Content = ["怎么念"];
  733. var question = words[k].CombineWords;
  734. question = common.ReplaceAllString(question, words[k].Name, "(" + words[k].Name + ")");
  735. taskInfo.Content[1].Content = question;
  736. var answer = "[读 src='" + taskInfo.ReadString + "']" + words[k].Pinyin + "[/读]";
  737. taskInfo.Content[2].Content = answer;
  738. if (words[k].CombineWords.length > 6) {
  739. taskInfo.FontSize = 108;
  740. if (words[k].CombineWords.length > 10) {
  741. taskInfo.FontSize = 68;
  742. }
  743. }
  744. } else if (testType == "write") {
  745. taskInfo.Content[0].Content = ["怎么写"];
  746. var question = words[k].CombineWords;
  747. //var question2 = common.ReplaceAllString(question, words[k].Name, words[k].Pinyin);
  748. var question2 = words[k].CombineWords2;
  749. question = "[读 src='" + taskInfo.ReadString + "']" + question2 + "[/读]"
  750. taskInfo.Content[1].Content = question;
  751. var answer = words[k].Name;
  752. answer += "[图 w='650' h='650']" + words[k].BiShunUrl + "[/图]";
  753. taskInfo.Content[2].Content = answer;
  754. if (question2.length > 6) {
  755. taskInfo.FontSize = 108;
  756. if (question2.length > 10) {
  757. taskInfo.FontSize = 68;
  758. if (question2.length > 14) {
  759. taskInfo.FontSize = 48;
  760. }
  761. }
  762. }
  763. }
  764. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  765. TaskList.push(taskInfo);
  766. }
  767. } else { //若是词语
  768. for (var k = 0; k < words.length; k++) {
  769. var taskInfo = words[k];
  770. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  771. TaskList.push(taskInfo);
  772. }
  773. }
  774. callback(TaskList);
  775. } else {
  776. callback([]);
  777. }
  778. });
  779. }
  780. function GetTestReportInfo(reportid, callback) {
  781. var UserTestReport = wx.getStorageSync('UserTestReport');
  782. for (var n = 0; n < UserTestReport.length; n++) {
  783. if (UserTestReport[n].ID == reportid) {
  784. var name1 = UserTestReport[n].Name[0].split(" ");
  785. var name2 = UserTestReport[n].Name[1];
  786. if (name1[0].indexOf("英语") >= 0 || name1[0].indexOf("4000") >= 0) {
  787. //console.log("英语");
  788. var wordStr = "";
  789. var userTestReportInfo = UserTestReport[n];
  790. var bookid = userTestReportInfo.BookID;
  791. var arrEnglist = [];
  792. if (bookid < 110) {
  793. if (name1[1] == "英文字母") {
  794. bookid = 100;
  795. 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";
  796. }
  797. } else if (bookid > 110 && bookid < 120) {
  798. arrEnglist = wx.getStorageSync("EnglishAll");
  799. arrEnglist = JSON.parse(arrEnglist);
  800. for (var i = 0; i < arrEnglist.length; i++) {
  801. if (arrEnglist[i].Name == name1[1]) {
  802. for (var j = 0; j < arrEnglist[i].Units.length; j++) {
  803. if (arrEnglist[i].Units[j].Name == name2) {
  804. wordStr = arrEnglist[i].Units[j].Words.join(",");
  805. break;
  806. }
  807. }
  808. }
  809. }
  810. }
  811. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  812. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  813. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  814. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  815. var unitsid = "";
  816. if (bookid > 100 && bookid < 110 && UserTestReport[n].Name[2]) {
  817. unitsid = Number(UserTestReport[n].Name[2]);
  818. } else if (bookid > 120 && bookid <= 124) {
  819. unitsid = Number(name2.replace("Lesson ", ""));
  820. } else if (bookid > 130 && bookid <= 140 && UserTestReport[n].Name[2]) {
  821. unitsid = Number(UserTestReport[n].Name[2]);
  822. } else if (bookid > 140 && bookid <= 150 && UserTestReport[n].Name[2]) {
  823. unitsid = Number(UserTestReport[n].Name[2]);
  824. }
  825. getData('GetTestEnglishWords?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + bookid + '&LessonID=' + unitsid + '&Words=' + wordStr + "&TestType=" + userTestReportInfo.TestType, function (data) {
  826. if (data) {
  827. var result = {};
  828. result.ID = userTestReportInfo.ID;
  829. result.IsFinished = userTestReportInfo.IsFinished;
  830. result.Name = userTestReportInfo.Name.join("#");
  831. result.TestType = userTestReportInfo.TestType;
  832. result.BookID = bookid;
  833. var TaskList = [];
  834. var words = data;
  835. for (var k = 0; k < words.length; k++) {
  836. var taskInfo = words[k];
  837. if (userTestReportInfo.TestType == "read") {
  838. taskInfo.TagWidth = 212;
  839. taskInfo.FontSize = 108;
  840. } else {
  841. taskInfo.TagWidth = 186;
  842. taskInfo.FontSize = 36;
  843. }
  844. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  845. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  846. taskInfo.Result = 1;
  847. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  848. taskInfo.Result = -1;
  849. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  850. taskInfo.Result = 0;
  851. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  852. taskInfo.Css = "Select2";
  853. TaskList.push(taskInfo);
  854. }
  855. result.TestRightStr = "";
  856. result.TestWrongStr = "";
  857. result.TestSkipStr = "";
  858. result.TestExistStr = "";
  859. if (userTestReportInfo.TestRightStr)
  860. result.TestRightStr = userTestReportInfo.TestRightStr;
  861. if (userTestReportInfo.TestWrongStr)
  862. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  863. if (userTestReportInfo.TestSkipStr)
  864. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  865. if (userTestReportInfo.TestExistStr)
  866. result.TestExistStr = userTestReportInfo.TestExistStr;
  867. result.List = TaskList;
  868. callback(result);
  869. } else {
  870. callback({});
  871. }
  872. });
  873. } else if (name1[1].indexOf("拼音") >= 0) {
  874. //console.log("拼音");
  875. var userTestReportInfo = UserTestReport[n];
  876. var bookid = userTestReportInfo.BookID;
  877. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  878. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  879. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  880. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  881. var unitsid = "";
  882. var name2 = userTestReportInfo.Name[1];
  883. if (bookid == 43) {
  884. switch (name2) {
  885. case "声母1":
  886. unitsid = 431;
  887. break;
  888. case "声母2":
  889. unitsid = 432;
  890. break;
  891. case "声母3":
  892. unitsid = 433;
  893. break;
  894. case "韵母1":
  895. unitsid = 434;
  896. break;
  897. case "韵母2":
  898. unitsid = 435;
  899. break;
  900. case "韵母3":
  901. unitsid = 436;
  902. break;
  903. case "整体认读1":
  904. unitsid = 437;
  905. break;
  906. case "整体认读2":
  907. unitsid = 438;
  908. break;
  909. }
  910. }
  911. getData('GetPinyinUnitWords?TestType='+userTestReportInfo.TestType+'&UserID=' + app.globalData.userInfo.UserID + '&BookID=' + bookid + '&UnitID=' + unitsid + '&Word=' + name2, function (data) {
  912. if (data) {
  913. var result = {};
  914. result.ID = userTestReportInfo.ID;
  915. result.IsFinished = userTestReportInfo.IsFinished;
  916. result.Name = userTestReportInfo.Name.join("#");
  917. result.TestType = userTestReportInfo.TestType;
  918. result.BookID = bookid;
  919. var TaskList = [];
  920. var words = data;
  921. for (var k = 0; k < words.length; k++) {
  922. var taskInfo = words[k];
  923. taskInfo.TagWidth = 230;
  924. taskInfo.FontSize = 108;
  925. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  926. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  927. taskInfo.Result = 1;
  928. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  929. taskInfo.Result = -1;
  930. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  931. taskInfo.Result = 0;
  932. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  933. taskInfo.Css = "Select2";
  934. TaskList.push(taskInfo);
  935. }
  936. result.TestRightStr = "";
  937. result.TestWrongStr = "";
  938. result.TestSkipStr = "";
  939. result.TestExistStr = "";
  940. if (userTestReportInfo.TestRightStr)
  941. result.TestRightStr = userTestReportInfo.TestRightStr;
  942. if (userTestReportInfo.TestWrongStr)
  943. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  944. if (userTestReportInfo.TestSkipStr)
  945. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  946. if (userTestReportInfo.TestExistStr)
  947. result.TestExistStr = userTestReportInfo.TestExistStr;
  948. result.List = TaskList;
  949. callback(result);
  950. } else {
  951. callback({});
  952. }
  953. });
  954. } else if (name2 == "古诗文") {
  955. //todo
  956. //console.log("古诗文");
  957. var userTestReportInfo = UserTestReport[n];
  958. var tempRight = "," + userTestReportInfo.TestRightStr + ",";
  959. var tempWrong = "," + userTestReportInfo.TestWrongStr + ",";
  960. var tempSkip = "," + userTestReportInfo.TestSkipStr + ",";
  961. var tempExist = "," + userTestReportInfo.TestExistStr + ",";
  962. getData('GetTestAncientPoetryList?UserID=' + app.globalData.userInfo.UserID + '&BookID=' + userTestReportInfo.BookID, function (data) {
  963. if (data) {
  964. var result = {};
  965. result.ID = userTestReportInfo.ID;
  966. result.IsFinished = userTestReportInfo.IsFinished;
  967. result.Name = userTestReportInfo.Name.join("#");
  968. result.TestType = userTestReportInfo.TestType;
  969. result.BookID = userTestReportInfo.BookID;
  970. var TaskList = [];
  971. for (var k = 0; k < data.length; k++) {
  972. var taskInfo = data[k];
  973. taskInfo.TagWidth = 336;
  974. if (taskInfo.Word.length > 9)
  975. taskInfo.FontSize = 48;
  976. else
  977. taskInfo.FontSize = 64;
  978. taskInfo.ContentNew = changeStringToView(taskInfo.Content);
  979. if (tempRight.indexOf("," + taskInfo.Word + ",") >= 0)
  980. taskInfo.Result = 1;
  981. if (tempWrong.indexOf("," + taskInfo.Word + ",") >= 0)
  982. taskInfo.Result = -1;
  983. if (tempSkip.indexOf("," + taskInfo.Word + ",") >= 0)
  984. taskInfo.Result = 0;
  985. if (tempExist.indexOf("," + taskInfo.Word + ",") >= 0)
  986. taskInfo.Css = "Select2";
  987. TaskList.push(taskInfo);
  988. }
  989. result.TestRightStr = "";
  990. result.TestWrongStr = "";
  991. result.TestSkipStr = "";
  992. result.TestExistStr = "";
  993. if (userTestReportInfo.TestRightStr)
  994. result.TestRightStr = userTestReportInfo.TestRightStr;
  995. if (userTestReportInfo.TestWrongStr)
  996. result.TestWrongStr = userTestReportInfo.TestWrongStr;
  997. if (userTestReportInfo.TestSkipStr)
  998. result.TestSkipStr = userTestReportInfo.TestSkipStr;
  999. if (userTestReportInfo.TestExistStr)
  1000. result.TestExistStr = userTestReportInfo.TestExistStr;
  1001. result.List = TaskList;
  1002. callback(result);
  1003. } else {
  1004. callback({});
  1005. }
  1006. });
  1007. } else {
  1008. var obj = UserTestReport[n];
  1009. if (obj.BookID >= 43 && obj.BookID <= 60)
  1010. name1 = name1[0] + "生词" + name1[2].substr(0, 1);
  1011. else if (obj.BookID == 73)
  1012. name1 = name1[0] + name1[1].substr(2, 3) + name1[2];
  1013. else
  1014. name1 = name1[0] + name1[1].substr(2, 2) + "能力" + name1[2].substr(0, 1);
  1015. var HanziAll = wx.getStorageSync('HanziAll');
  1016. HanziAll = JSON.parse(HanziAll);
  1017. for (var i = 0; i < HanziAll.length; i++) {
  1018. if (name1 == HanziAll[i].Name) {
  1019. for (var j = 0; j < HanziAll[i].Units.length; j++) {
  1020. if (name2 == HanziAll[i].Units[j].Name) {
  1021. GetHanziUnitWords(HanziAll[i].Units[j].ID, obj.TestType, function (list) {
  1022. if (list) {
  1023. for (var k = 0; k < list.length; k++) {
  1024. if (obj.TestRightStr && obj.TestRightStr.indexOf(list[k].Word) >= 0)
  1025. list[k].Result = 1;
  1026. else if (obj.TestWrongStr && obj.TestWrongStr.indexOf(list[k].Word) >= 0)
  1027. list[k].Result = -1;
  1028. else if (obj.TestSkipStr && obj.TestSkipStr.indexOf(list[k].Word) >= 0)
  1029. list[k].Result = 0;
  1030. if (obj.TestExistStr && obj.TestExistStr.indexOf(list[k].Word) >= 0)
  1031. list[k].Css = "Select2";
  1032. }
  1033. var result = {};
  1034. result.ID = reportid;
  1035. result.BookID = obj.BookID;
  1036. result.TestType = obj.TestType;
  1037. result.Name = obj.Name.join("#");
  1038. result.IsFinished = obj.IsFinished;
  1039. result.TestRightStr = obj.TestRightStr;
  1040. result.TestWrongStr = obj.TestWrongStr;
  1041. result.TestSkipStr = obj.TestSkipStr;
  1042. result.TestExistStr = obj.TestExistStr;
  1043. result.List = list;
  1044. callback(result);
  1045. } else
  1046. callback({});
  1047. });
  1048. }
  1049. }
  1050. }
  1051. }
  1052. }
  1053. }
  1054. }
  1055. }
  1056. function getDetailColor(index) {
  1057. var arrDetailColor = constant.arrDetailColor;
  1058. if (index > 0)
  1059. return arrDetailColor[index];
  1060. else if (index == 0)
  1061. return arrDetailColor[common.random(1, arrDetailColor.length - 1)];
  1062. else if (index == -1)
  1063. return arrDetailColor;
  1064. }
  1065. function getShareImageBackColor() {
  1066. var arr = constant.arrShareImageBackColor;
  1067. return arr[common.random(0, arr.length - 1)];
  1068. }
  1069. function getPinyinNormal(pinyin) {
  1070. var result = "";
  1071. var arr = constant.arrPinyin;
  1072. for (var i = 0; i < arr.length; i++) {
  1073. if (arr[i][1] == pinyin) {
  1074. result = arr[i][0];
  1075. break;
  1076. }
  1077. }
  1078. return result;
  1079. }
  1080. function getHanzi(callback) {
  1081. var that = this;
  1082. wx.showLoading({
  1083. title: '请稍候',
  1084. mask: true,
  1085. });
  1086. var time = wx.getStorageSync("HanziUpdateTime");
  1087. getData('GetHanziAll3?UpdateTime=' + time, function (data) {
  1088. wx.hideLoading();
  1089. if (data) {
  1090. var arr = [];
  1091. if (data.List) {
  1092. arr = common.Decrypt(data.List);
  1093. wx.setStorageSync("HanziAll", arr);
  1094. wx.setStorageSync("HanziUpdateTime", data.UpdateTime);
  1095. callback(true);
  1096. } else {
  1097. callback(false);
  1098. }
  1099. }
  1100. });
  1101. }
  1102. function getServerSoundErrorArr(){
  1103. var time = wx.getStorageSync("SoundErrorUpdateTime");
  1104. getData('GetSoundErrorArr?UpdateTime=' + time, function (data) {
  1105. if (data && data.List) {
  1106. wx.setStorageSync("SoundErrorArr", data.List);
  1107. wx.setStorageSync("SoundErrorUpdateTime", data.UpdateTime);
  1108. }
  1109. });
  1110. }
  1111. function getEnglish(callback) {
  1112. var that = this;
  1113. wx.showLoading({
  1114. title: '请稍候',
  1115. mask: true,
  1116. });
  1117. var time = wx.getStorageSync("HanziUpdateTime");
  1118. getData('GetEnglishAll3?UpdateTime=' + time, function (data) {
  1119. wx.hideLoading();
  1120. if (data.EngList) {
  1121. var arrEng = common.Decrypt(data.EngList);
  1122. var arrNewConceptEngList = common.Decrypt(data.NewConceptEngList);
  1123. var arrCambridgeEngList = common.Decrypt(data.CambridgeEngList);
  1124. var arrEEWEngList = common.Decrypt(data.EEWEngList);
  1125. var arrPhoneticEngList = common.Decrypt(data.PhoneticEngList);
  1126. wx.setStorageSync("EnglishAll", arrEng);
  1127. wx.setStorageSync("NewConceptEngList", arrNewConceptEngList);
  1128. wx.setStorageSync("CambridgeEngList", arrCambridgeEngList);
  1129. wx.setStorageSync("EEWEngList", arrEEWEngList);
  1130. wx.setStorageSync("PhoneticEngList", arrPhoneticEngList);
  1131. wx.setStorageSync("EnglishUpdateTime", data.UpdateTime);
  1132. callback(true);
  1133. } else {
  1134. callback(false);
  1135. }
  1136. });
  1137. }
  1138. function UploadUserConfig(callback) {
  1139. var that = this;
  1140. var param1 = {};
  1141. param1.CardType = wx.getStorageSync("CardType");
  1142. param1.CardMaxNumberNew = wx.getStorageSync("CardMaxNumberNew");
  1143. param1.CardMaxNumberHistory = wx.getStorageSync("CardMaxNumberHistory");
  1144. param1.CardMaxNumberNewUrgent = wx.getStorageSync("CardMaxNumberNewUrgent");
  1145. param1.CardMaxNumberHistoryUrgent = wx.getStorageSync("CardMaxNumberHistoryUrgent");
  1146. param1.SortTypeIndex = wx.getStorageSync("SortTypeIndex");
  1147. param1.MemoryLevel = wx.getStorageSync("MemoryLevel");
  1148. param1.ClickType = wx.getStorageSync("ClickType");
  1149. param1.SecondConfigArray = wx.getStorageSync("SecondConfigArray").join(",");
  1150. param1.ColorIndexArr = wx.getStorageSync("ColorIndexArr").join(",");
  1151. param1.IsFolderPractice = wx.getStorageSync("IsFolderPractice");
  1152. param1.IsAutoSound = wx.getStorageSync("IsAutoSound");
  1153. var symboMain = wx.getStorageSync("SymbolMain");
  1154. var symbol1 = [];
  1155. for (var i = 0; i < symboMain.length; i++) {
  1156. symbol1.push(symboMain[i].Name);
  1157. }
  1158. symbol1 = JSON.stringify(symbol1);
  1159. param1.SymbolList = symbol1;
  1160. var folderOrder = wx.getStorageSync("FolderOrderStr");
  1161. if (folderOrder)
  1162. param1.FolderOrder = folderOrder;
  1163. //console.log(param1);
  1164. that.postData('UploadUserConfig?Type=update&UserID=' + app.globalData.userInfo.UserID, param1, function (data) {
  1165. if (callback) {
  1166. callback();
  1167. }
  1168. });
  1169. }
  1170. function getAwardData(callback) {
  1171. var that = this;
  1172. that.getData('GetAwardInfo?UserID=' + app.globalData.userInfo.UserID, function (data) {
  1173. if (data) {
  1174. callback(data);
  1175. } else
  1176. callback([]);
  1177. });
  1178. }
  1179. function getUserConfig() {
  1180. var that = this;
  1181. postData('UploadUserConfig?Type=getData&UserID=' + app.globalData.userInfo.UserID, {}, function (data) {
  1182. if (data && !data.CardType)
  1183. data.CardType = 0;
  1184. wx.setStorageSync("CardType", data.CardType);
  1185. wx.setStorageSync("CardMaxNumberNew", data.CardMaxNumberNew);
  1186. wx.setStorageSync("CardMaxNumberHistory", data.CardMaxNumberHistory);
  1187. wx.setStorageSync("CardMaxNumberNewUrgent", data.CardMaxNumberNewUrgent);
  1188. wx.setStorageSync("CardMaxNumberHistoryUrgent", data.CardMaxNumberHistoryUrgent);
  1189. wx.setStorageSync("SortTypeIndex", data.SortTypeIndex);
  1190. wx.setStorageSync("MemoryLevel", data.MemoryLevel);
  1191. wx.setStorageSync("ClickType", data.ClickType);
  1192. wx.setStorageSync("SecondConfigArray", data.SecondConfigArray.split(","));
  1193. wx.setStorageSync("ColorIndexArr", data.ColorIndexArr.split(","));
  1194. wx.setStorageSync("FolderOrderStr", data.FolderOrder);
  1195. wx.setStorageSync("IsFolderPractice", data.IsFolderPractice);
  1196. wx.setStorageSync("IsAutoSound", data.IsAutoSound);
  1197. var symbol1 = [];
  1198. if (data.SymbolList) {
  1199. for (var i = 0; i < data.SymbolList.length; i++) {
  1200. var obj = {};
  1201. obj.Name = data.SymbolList[i];
  1202. obj.CSS = "btn2";
  1203. symbol1.push(obj);
  1204. }
  1205. } else {
  1206. symbol1 = app.globalData.SymbolMain;
  1207. }
  1208. if (symbol1.length > 0) {
  1209. wx.setStorageSync("SymboMain", symbol1);
  1210. app.globalData.SymbolMain = symbol1;
  1211. }
  1212. });
  1213. }
  1214. function replaceCardInfoString(str) {
  1215. var that = this;
  1216. //str = str.replace(/\[图]/g, "");
  1217. //str = str.replace(/\[\/图\]/g, "");
  1218. //console.log(str);
  1219. if (str && str!=null) {
  1220. var str2 = "";
  1221. if (str.indexOf("[读 src=") >= 0) {
  1222. str2 = str.substr(str.indexOf("[读 src="));
  1223. str2 = str2.substring(0, str2.indexOf("]") + 1);
  1224. }
  1225. str = str.replace(str2, "");
  1226. if (str.indexOf("[/读") >= 0) {
  1227. str2 = str.substr(str.indexOf("[/读"));
  1228. str2 = str2.substring(0, 4);
  1229. }
  1230. str = str.replace(str2, "");
  1231. if (str.indexOf("[读 src=") >= 0) {
  1232. str2 = str.substr(str.indexOf("[读 src"));
  1233. str2 = str2.substring(0, str2.indexOf("/读]") + 3);
  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. str = str.replace(/\[读]/g, "");
  1242. str = str.replace(/\[\/读\]/g, "");
  1243. var str3 = "";
  1244. if (str.indexOf("[图") >= 0) {
  1245. str3 = str.substr(str.indexOf("[图"));
  1246. str3 = str3.substring(0, str3.indexOf("/图]") + 3);
  1247. }
  1248. str = str.replace(str3, "");
  1249. if (str.indexOf("[图") >= 0) {
  1250. str3 = str.substr(str.indexOf("[图"));
  1251. str3 = str3.substring(0, str3.indexOf("/图]") + 3);
  1252. }
  1253. str = str.replace(str3, "");
  1254. str = str.replace(/\[线]/g, "");
  1255. str = str.replace(/\[\/线\]/g, "");
  1256. str = that.encryptUrl(str);
  1257. }
  1258. return str;
  1259. }
  1260. function searchInfomation(search, searchtype, author, shiciurl, callback) {
  1261. var WORD_LENGTH = 18;
  1262. wx.showLoading({
  1263. title: '查询中',
  1264. });
  1265. var timeout = setTimeout(function () {
  1266. wx.hideLoading();
  1267. }, 5000);
  1268. var url = 'GetMiaoguoAISearch2?UserID=' + app.globalData.userInfo.UserID;
  1269. url += "&Word=" + encodeURI(search);
  1270. if (searchtype)
  1271. url += "&SearchType=" + searchtype;
  1272. if (author)
  1273. url += "&Author=" + encodeURI(author);
  1274. if (shiciurl)
  1275. url += "&ShiciUrl=" + shiciurl;
  1276. getData(url, function (data) {
  1277. wx.hideLoading();
  1278. clearTimeout(timeout);
  1279. if (data) {
  1280. //console.log(data);
  1281. if (data.List) {
  1282. var len = WORD_LENGTH;
  1283. var list = data.List;
  1284. for (var i = 0; i < list.length; i++) {
  1285. var item = list[i];
  1286. if (item.TypeName == "字词") {
  1287. if (item.Key.length == 1)
  1288. item.TypeName = "Z";
  1289. else
  1290. item.TypeName = "C";
  1291. } else if (item.TypeName == "诗词") {
  1292. item.TypeName = "S";
  1293. item.Remark = item.Author + " " + item.Dynasty;
  1294. } else if (item.TypeName == "翻译") {
  1295. item.TypeName = "D";
  1296. }
  1297. if (item.Content && item.Content.length > len)
  1298. item.Content = item.Content.substr(0, len) + "...";
  1299. }
  1300. callback(list);
  1301. } else if (data.CHN || data.ENG) {
  1302. var obj = {};
  1303. obj.Key = search;
  1304. obj.Value = data;
  1305. if (data.CHN && data.CHN.Author)
  1306. obj.Author = data.CHN.Author;
  1307. if (data.CHN && data.CHN.Dynasty)
  1308. obj.Dynasty = data.CHN.Dynasty;
  1309. if (data.CHN && data.CHN.PeomContent) {
  1310. obj.Type = "shici";
  1311. obj.TypeName = "诗词";
  1312. obj.Content = data.CHN.PeomContent.join("").substr(0, WORD_LENGTH);
  1313. obj.ShiciUrl = shiciurl;
  1314. obj.TypeName = "S";
  1315. } else if (data.CHN) {
  1316. obj.Type = "zici";
  1317. if (data.CHN.PinYin && data.CHN.PinYin[0] && data.CHN.PinYin[0].pinyin)
  1318. obj.Remark = data.CHN.PinYin[0].pinyin;
  1319. if (data.CHN.PinYin && data.CHN.PinYin[0] && data.CHN.PinYin[0].explain) {
  1320. obj.Content = data.CHN.PinYin[0].explain.substr(0, WORD_LENGTH);
  1321. obj.Content = obj.Content.replace("<p>", "");
  1322. obj.Content = obj.Content.replace("</p>", "");
  1323. if (obj.Content.length >= WORD_LENGTH)
  1324. obj.Content += "..."
  1325. }
  1326. if (obj.Key.length == 1)
  1327. obj.TypeName = "Z";
  1328. else
  1329. obj.TypeName = "C";
  1330. }
  1331. if (data.ENG && !data.CHN) {
  1332. obj.Type = "eng";
  1333. obj.TypeName = "D";
  1334. if (data.ENG.Soundmark && data.ENG.Soundmark.Eng)
  1335. obj.Remark = data.ENG.Soundmark.Eng;
  1336. if (data.ENG.Paraphrase.length > 0) {
  1337. if (common.checkIsArray(data.ENG.Paraphrase) && data.ENG.Paraphrase[0].ParaphraseList)
  1338. obj.Content = data.ENG.Paraphrase[0].ParaphraseList.join("; ").substr(0, WORD_LENGTH);
  1339. else
  1340. obj.Content = data.ENG.Paraphrase.substr(0, WORD_LENGTH) + "...";
  1341. }
  1342. }
  1343. app.globalData.TempSearchBackNumber = 2;
  1344. //app.globalData.CardList=[];
  1345. app.globalData.CardList2 = [];
  1346. callback([], obj);
  1347. } else {
  1348. callback([]);
  1349. }
  1350. } else {
  1351. callback([]);
  1352. }
  1353. });
  1354. }
  1355. function downloadBishunKaitiImage(url, serverUrl, dataType, Fields, callback) {
  1356. var param = {};
  1357. param.Url = url;
  1358. param.DataType = dataType;
  1359. if (param.Url == serverUrl) {
  1360. postData("GetBiShunByKaitiUrl", param, function (data) {
  1361. if (data) {
  1362. wx.downloadFile({
  1363. url: data, // 仅为示例,并非真实的资源
  1364. success(res) {
  1365. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  1366. if (res.statusCode === 200) {
  1367. //console.log("serverUrl2:" + serverUrl);
  1368. console.log(res.tempFilePath);
  1369. callback(change(Fields, res.tempFilePath, param));
  1370. }
  1371. },
  1372. complete() {
  1373. }
  1374. });
  1375. }
  1376. });
  1377. } else {
  1378. callback(change(Fields, serverUrl, param));
  1379. }
  1380. function change(Fields, filepath, param) {
  1381. var iStart = 0;
  1382. if (Fields.length == 4)
  1383. iStart = 1
  1384. for (var i = iStart; i < Fields.length; i++) {
  1385. for (var j = 0; j < Fields[i].length; j++) {
  1386. if (Fields[i][j].Type == "image") {
  1387. if (Fields[i][j].Content == param.Url) {
  1388. Fields[i][j].Content = filepath;
  1389. if (param.DataType == "bishun") {
  1390. Fields[i][j].IsShowKaiti = true;
  1391. Fields[i][j].IsShowBishun = false;
  1392. } else if (param.DataType == "kaiti") {
  1393. Fields[i][j].IsShowKaiti = false;
  1394. Fields[i][j].IsShowBishun = true;
  1395. }
  1396. }
  1397. }
  1398. }
  1399. }
  1400. return Fields;
  1401. }
  1402. }
  1403. function GetSoundError(str) {
  1404. var result = str;
  1405. var arr = wx.getStorageSync('SoundErrorArr');
  1406. if (arr && arr.length>0){
  1407. for (var i = 0; i < arr.length; i++) {
  1408. if (str.indexOf(arr[i].Word) > 0) {
  1409. result = common.ReplaceAllString(str, arr[i].Word, arr[i].Sound);
  1410. break;
  1411. } else if (str == arr[i].Word) {
  1412. result = arr[i].Sound;
  1413. }
  1414. }
  1415. }
  1416. return result;
  1417. }
  1418. function GetTestReportList(userID, callback) {
  1419. getData('GetTestGradeArr', function (GradeArr) {
  1420. for (var i = 0; i < GradeArr.length; i++) {
  1421. for (var j = 0; j < GradeArr[i].List.length; j++) {
  1422. GradeArr[i].List[j].Finish = 0;
  1423. }
  1424. }
  1425. getData('GetTestReportList?UserID=' + userID, function (data) {
  1426. if (data) {
  1427. var dataTemp = [];
  1428. for (var i = 0; i < data.length; i++) {
  1429. for (var j = 0; j < dataTemp.length; j++) {
  1430. if (dataTemp[j].Name[0] == data[i].Name[0] &&
  1431. dataTemp[j].Name[1] == data[i].Name[1] &&
  1432. dataTemp[j].TestType == data[i].TestType &&
  1433. data[i].IsFinished == 1
  1434. ) {
  1435. dataTemp.splice(j, 1);
  1436. break;
  1437. }
  1438. }
  1439. dataTemp.push(data[i]);
  1440. 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) {
  1441. if (data[i].TestRightStr) {
  1442. data[i].TestRightStr = data[i].TestRightStr.split(",");
  1443. }
  1444. if (data[i].TestWrongStr) {
  1445. data[i].TestWrongStr = data[i].TestWrongStr.split(",");
  1446. }
  1447. if (data[i].TestSkipStr) {
  1448. data[i].TestSkipStr = data[i].TestSkipStr.split(",");
  1449. }
  1450. if (data[i].TestExistStr) {
  1451. data[i].TestExistStr = data[i].TestExistStr.split(",");
  1452. }
  1453. }
  1454. if (!data[i].TestRightStr)
  1455. data[i].TestRightStr = "";
  1456. if (!data[i].TestWrongStr)
  1457. data[i].TestWrongStr = "";
  1458. if (!data[i].TestSkipStr)
  1459. data[i].TestSkipStr = "";
  1460. if (!data[i].TestExistStr)
  1461. data[i].TestExistStr = "";
  1462. }
  1463. for (var i = 0; i < dataTemp.length; i++) {
  1464. var name = dataTemp[i].Name[0].split(" ");
  1465. for (var j = 0; j < GradeArr.length; j++) {
  1466. var item = GradeArr[j];
  1467. if (name[0] == item.Name) {
  1468. for (var k = 0; k < item.List.length; k++) {
  1469. //音标计算进度
  1470. if (item.List[k].ID == 101 && dataTemp[i].BookID == 101) {
  1471. for (var n = 1; n <= 4; n++) {
  1472. if (Number(dataTemp[i].Name[2]) == n && dataTemp[i].IsFinished == 1)
  1473. item.List[k].Finish++;
  1474. }
  1475. }
  1476. //古诗词计算进度
  1477. else if (item.List[k].ID == dataTemp[i].BookID && dataTemp[i].TestType == "recite" && dataTemp[i].IsFinished == 1)
  1478. item.List[k].Finish = 1;
  1479. else {
  1480. if (name[1] == item.List[k].Name && name[2] == item.List[k].Name2) {
  1481. if (dataTemp[i].IsFinished == 1)
  1482. item.List[k].Finish++;
  1483. }
  1484. }
  1485. }
  1486. }
  1487. }
  1488. }
  1489. for (var j = 0; j < GradeArr.length; j++) {
  1490. var item = GradeArr[j];
  1491. for (var k = 0; k < item.List.length; k++) {
  1492. item.List[k].Finished = Math.round(100 * item.List[k].Finish / item.List[k].Total);
  1493. item.List[k].NameStr = item.List[k].Name.replace("语文", "");
  1494. }
  1495. }
  1496. wx.setStorageSync("UserTestReport", data);
  1497. callback(data, GradeArr);
  1498. }
  1499. });
  1500. });
  1501. }
  1502. function showHelp(obj,myClass,textTopDirection,helpText,closePos){
  1503. setTimeout(function(){
  1504. wx.createSelectorQuery().select(myClass).boundingClientRect(function (rect) {
  1505. console.log("rect.left:"+rect.left);
  1506. console.log("rect.top:"+rect.top);
  1507. console.log("rect.width:"+rect.width);
  1508. console.log("rect.height:"+rect.height);
  1509. var textTop=rect.bottom+5;
  1510. if (textTopDirection=="up")
  1511. textTop=rect.top-47;
  1512. if (!closePos)
  1513. closePos="Right";
  1514. obj.setData({
  1515. HelpTop:rect.top,
  1516. HelpWidth1:rect.left,
  1517. HelpHeight1:rect.height,
  1518. HelpLeft2:rect.right,
  1519. HelpHeight2:rect.height,
  1520. HelpBottom:rect.bottom-1,
  1521. HelpTextTop:textTop,
  1522. HelpText:helpText,
  1523. HelpClosePos:closePos,
  1524. });
  1525. }).exec();
  1526. },500);
  1527. }
  1528. function gotoTaskList(id,cardType) {
  1529. wx.showLoading({
  1530. title: '请稍候',
  1531. });
  1532. setTimeout(function () {
  1533. wx.hideLoading();
  1534. }, 5000);
  1535. var that = this;
  1536. //未练完的题卡
  1537. if (id == 1) {
  1538. getTaskTodayList(function (task) {
  1539. var list = [];
  1540. for (var i = 0; i < task.ListNew.length; i++) {
  1541. list.push(task.ListNew[i]);
  1542. }
  1543. for (var i = 0; i < task.ListHistory.length; i++) {
  1544. list.push(task.ListHistory[i]);
  1545. }
  1546. for (var i = 0; i < task.ListReview.length; i++) {
  1547. list.push(task.ListReview[i]);
  1548. }
  1549. app.globalData.CardList = list;
  1550. wx.navigateTo({
  1551. url: '../main/mainlist?type=1&Count=' + list.length,
  1552. });
  1553. });
  1554. } else {
  1555. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID + "&IsToday=2&CardType="+ cardType +"&OrderType=ac.LastTime desc";
  1556. getData(url, function (data) {
  1557. if (data) {
  1558. var list = [];
  1559. for (var i = 0; i < data.List.length; i++) {
  1560. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  1561. list.push(data.List[i]);
  1562. }
  1563. app.globalData.CardList = list;
  1564. wx.navigateTo({
  1565. url: '../main/mainlist?type=2&Count=' + data.length,
  1566. });
  1567. }
  1568. });
  1569. }
  1570. }
  1571. function resetTodayTask(){
  1572. wx.showModal({
  1573. title: '提醒',
  1574. content: '此操作无法撤销。确认重置今天的任务量吗?',
  1575. showCancel:true,
  1576. cancelText:"确定",
  1577. confirmColor:"#000000",
  1578. confirmText:"取消",
  1579. success (res) {
  1580. if (res.confirm) {
  1581. //console.log('用户点击取消');
  1582. } else if (res.cancel) {
  1583. //console.log('用户点击确定')
  1584. var url = "ResetMiaoguoCardTask?UserID=" + app.globalData.userInfo.UserID;
  1585. getData(url, function (data) {
  1586. if (data) {
  1587. wx.showModal({
  1588. title: '提醒',
  1589. content: '重置已完成。请重新开始今天的练习吧。',
  1590. showCancel:false,
  1591. confirmColor:"#000000",
  1592. confirmText:"返回首页",
  1593. success (res) {
  1594. wx.navigateBack({
  1595. delta: 2,
  1596. });
  1597. }
  1598. });
  1599. }
  1600. });
  1601. }
  1602. }
  1603. });
  1604. }
  1605. //下载图片
  1606. function downloadFile(url,isShowLoading,callback){
  1607. if (isShowLoading){
  1608. wx.showLoading({
  1609. title: '下载中',
  1610. });
  1611. setTimeout(function () {
  1612. wx.hideLoading();
  1613. }, 5000);
  1614. }
  1615. wx.downloadFile({
  1616. url: url,
  1617. success(resDownload) {
  1618. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  1619. if (resDownload.statusCode === 200) {
  1620. callback(resDownload.tempFilePath);
  1621. }
  1622. else if (resDownload.statusCode === 404){
  1623. wx.showToast({
  1624. title: '图片不存在',
  1625. });
  1626. }
  1627. if (isShowLoading)
  1628. wx.hideLoading();
  1629. },
  1630. fail: function (e) {
  1631. if (isShowLoading)
  1632. wx.hideLoading();
  1633. wx.showToast({
  1634. title: '下载失败',
  1635. });
  1636. }
  1637. });
  1638. }
  1639. //生成图片
  1640. function buildImage(width,height,canvas,callback){
  1641. var that=this;
  1642. wx.showLoading({
  1643. title: '生成中',
  1644. });
  1645. setTimeout(function () {
  1646. //console.log("生成后1");
  1647. wx.canvasToTempFilePath({
  1648. x: 0,
  1649. y: 0,
  1650. width: width,
  1651. height: height,
  1652. destWidth: width,
  1653. destHeight: height,
  1654. canvas: canvas,
  1655. success: function (res2) {
  1656. wx.hideLoading();
  1657. //console.log("生成后2");
  1658. wx.previewImage({
  1659. current: res2.tempFilePath, // 当前显示图片的http链接
  1660. urls: [res2.tempFilePath] // 需要预览的图片http链接列表
  1661. });
  1662. callback();
  1663. },
  1664. fail: function (e) {
  1665. wx.hideLoading();
  1666. //console.log("生成错误:"+e);
  1667. }
  1668. })
  1669. }, 500);
  1670. }
  1671. function showHelpImage() {
  1672. var arr=[];
  1673. arr.push(app.globalData.uploadImageUrl+"web/doc_xnl_36_1.png")
  1674. arr.push(app.globalData.uploadImageUrl+"web/doc_xnl_36_2.png")
  1675. wx.previewImage({
  1676. current: arr[0],
  1677. urls: arr,
  1678. });
  1679. }
  1680. module.exports = {
  1681. getData: getData,
  1682. postData: postData,
  1683. payMoney: payMoney,
  1684. getLocalHost: getLocalHost,
  1685. getTimeFormat: getTimeFormat,
  1686. getWindowHeight: getWindowHeight,
  1687. getStorageValue: getStorageValue,
  1688. getProgramList: getProgramList,
  1689. gotoFeedback: gotoFeedback,
  1690. getDetailColor: getDetailColor,
  1691. changeStringToView: changeStringToView,
  1692. changeViewToString: changeViewToString,
  1693. encryptUrl: EncryptUrl,
  1694. decryptUrl: DecryptUrl,
  1695. saveTempImage: saveTempImage,
  1696. getTempImage: getTempImage,
  1697. getTaskTodayList: getTaskTodayList,
  1698. updateSearchList: updateSearchList,
  1699. checkIsIPhoneX: checkIsIPhoneX,
  1700. getMemoryLevelAll: getMemoryLevelAll,
  1701. getMemoryLevel: getMemoryLevel,
  1702. getShareImageBackColor: getShareImageBackColor,
  1703. UpdateMiaoguoCardTodayAll: UpdateMiaoguoCardTodayAll,
  1704. setCollect: setCollect,
  1705. UploadUserConfig: UploadUserConfig,
  1706. getServerImage: getServerImage,
  1707. getBaiduToken: getBaiduToken,
  1708. getPinyinNormal: getPinyinNormal,
  1709. getHanzi: getHanzi,
  1710. getEnglish: getEnglish,
  1711. GetHanziUnitWords: GetHanziUnitWords,
  1712. GetTestReportInfo: GetTestReportInfo,
  1713. getUserConfig: getUserConfig,
  1714. getAwardData: getAwardData,
  1715. replaceCardInfoString: replaceCardInfoString,
  1716. searchInfomation: searchInfomation,
  1717. downloadBishunKaitiImage: downloadBishunKaitiImage,
  1718. GetSoundError: GetSoundError,
  1719. GetTestReportList: GetTestReportList,
  1720. ShowHelp:showHelp,
  1721. GotoTaskList:gotoTaskList,
  1722. ResetTodayTask:resetTodayTask,
  1723. DownloadFile:downloadFile,
  1724. BuildImage:buildImage,
  1725. ShowHelpImage:showHelpImage,
  1726. getServerSoundErrorArr:getServerSoundErrorArr,
  1727. }