main.js 59 KB

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