detail.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. var times = 1;
  5. var pageIndex = 0;
  6. var QuestionItem = [];
  7. var tempAnswerList = [];
  8. var arrAnswerID = [];
  9. var isAndroid = false;
  10. const waitTime = ["", "10秒钟", "15秒钟", "20秒钟", "25秒钟"];
  11. Page({
  12. data: {
  13. version: app.globalData.version,
  14. IsShowMenu: false,
  15. filter: 'horizontal',
  16. //filter: 'vertical',
  17. PageNumber: 1,
  18. PageCount: 60,
  19. IsFinished: false,
  20. arrPage: [],
  21. ShowLoading: false,
  22. IsDistabled: "",
  23. NameClass: "",
  24. AddDisabled: "",
  25. SubDisabled: "btnAddSubDisabled",
  26. HelpHidden7: true,
  27. HelpHidden3: true,
  28. HelpHidden8: true,
  29. ShowAndroidNotice: false,
  30. },
  31. onLoad: function(options) {
  32. var that = this;
  33. var id = options.id;
  34. isAndroid = false;
  35. if (app.globalData.systemInfo.system && app.globalData.systemInfo.system.indexOf("Android") >= 0)
  36. isAndroid = true;
  37. this.setData({
  38. Containnerheight: server.getWindowHeight(),
  39. ID: id,
  40. ShowAndroidNotice: isAndroid,
  41. });
  42. var systemInfo = wx.getSystemInfoSync();
  43. if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
  44. times = 2;
  45. }
  46. this.getDetail(id);
  47. if (id > 0) {
  48. common.getStorageValue(this, "HelpHidden3", false, function() {
  49. that.showHelp();
  50. });
  51. } else {
  52. common.getStorageValue(this, "HelpHidden8", false, function() {
  53. that.showHelp8();
  54. });
  55. }
  56. },
  57. onShow: function() {
  58. if (this.data.ID == -1)
  59. this.getDetail(this.data.ID);
  60. },
  61. onUnload: function() {
  62. wx.hideLoading();
  63. this.closeHelp();
  64. },
  65. getDetail: function(id) {
  66. var item = {};
  67. if (id > 0) {
  68. var data = wx.getStorageSync('QuestionTypeList');
  69. for (var i = 0; i < data.length; i++) {
  70. for (var k = 0; k < data[i].List.length; k++) {
  71. if (id == data[i].List[k].ID) {
  72. item = data[i].List[k];
  73. item.Example[0] = item.Example[0].replace("+", " + ").replace("-", " - ").replace("×", " × ").replace("÷", " ÷ ");
  74. item.Example[1] = item.Example[1].replace("+", " + ").replace("-", " - ").replace("×", " × ").replace("÷", " ÷ ");
  75. item.IconName = app.globalData.fileUrl + item.IconName;
  76. if (item.Name.length > 12)
  77. item.NameClass = "text2";
  78. break;
  79. }
  80. }
  81. }
  82. } else {
  83. item.Name = "我的错题集";
  84. var list = wx.getStorageSync('ErrorList');
  85. item.ErrorList = list;
  86. }
  87. this.setData({
  88. QuestionTypeItem: item,
  89. });
  90. //有竖式则缺省竖式
  91. if (item.QuestionNumber3 > 0) {
  92. this.menuClick({
  93. currentTarget: {
  94. dataset: {
  95. id: "vertical"
  96. }
  97. }
  98. })
  99. }
  100. },
  101. gotoError: function(e) {
  102. wx.navigateTo({
  103. url: '../main/errorlist',
  104. });
  105. },
  106. gotoAnswer: function(e) {
  107. wx.navigateTo({
  108. url: '../main/answer',
  109. });
  110. this.closeHelp2();
  111. },
  112. getFinish: function() {
  113. server.playSound("/sounds/click.mp3");
  114. this.setData({
  115. ShowLoading: true,
  116. BtnText: "全部保存到相册",
  117. });
  118. wx.hideLoading();
  119. arrAnswerID = [];
  120. tempAnswerList = [];
  121. this.getAnswerID();
  122. if (this.data.ID > 0) {
  123. this.getList(this.data.ID);
  124. } else {
  125. this.getErrorList();
  126. }
  127. this.closeHelp();
  128. },
  129. //重新生成试卷
  130. ResetFinish: function() {
  131. var that = this;
  132. wx.showLoading({
  133. title: "正在重置",
  134. complete: function() {
  135. var list = that.data.arrPage;
  136. for (var i = 0; i < list.length; i++) {
  137. wx.removeSavedFile({
  138. filePath: list[i].TempImagePath
  139. });
  140. }
  141. that.setData({
  142. arrPage: [],
  143. PageNumber: 1,
  144. });
  145. var tempList = wx.getStorageSync("AnswerList");
  146. for (var i = 0; i < list.length; i++) {
  147. tempList.shift();
  148. }
  149. wx.setStorageSync("AnswerList", tempList);
  150. wx.hideLoading();
  151. that.getFinish();
  152. }
  153. });
  154. },
  155. //题卡数据列表
  156. getList: function(id) {
  157. var that = this;
  158. var pageNum = that.data.PageNumber;
  159. var QuestionTypeCategory = 3;
  160. if (that.data.filter == "horizontal")
  161. QuestionTypeCategory = 2;
  162. pageIndex = 0;
  163. server.getData('GetQuestionTypesPrint?ID=' + id + '&QuestionTypeCategory=' + QuestionTypeCategory + '&PageNum=' + pageNum, function(data) {
  164. //console.log("UserInfo:" + data);
  165. if (data) {
  166. that.setData({
  167. IsFinished: true,
  168. arrPage: [],
  169. IsDistabled: "",
  170. WaitTime: waitTime[that.data.PageNumber],
  171. });
  172. QuestionItem = data;
  173. QuestionItem.IconName = that.data.QuestionTypeItem.IconName;
  174. if (isAndroid) {
  175. console.log("android");
  176. var ctx = wx.createCanvasContext("Canvas", that);
  177. ctx.fillRect(0, 0, 1050, 1485);
  178. ctx.draw(true, function(n) {
  179. wx.canvasToTempFilePath({
  180. x: 0,
  181. y: 0,
  182. width: 2100,
  183. height: 2970,
  184. canvasId: 'Canvas',
  185. success: function(res2) {
  186. that.saveImage();
  187. }
  188. })
  189. });
  190. } else {
  191. that.saveImage();
  192. }
  193. }
  194. });
  195. },
  196. //错题列表
  197. getErrorList: function() {
  198. var that = this;
  199. QuestionItem = that.data.QuestionTypeItem;
  200. if (QuestionItem.ErrorList.length > 0) {
  201. QuestionItem.Category = -1; //错题集类别
  202. QuestionItem.QuestionTypeCategory = 2;
  203. QuestionItem.CategoryName = "";
  204. QuestionItem.Name = "我的错题集";
  205. QuestionItem.QuestionTypeLevel = "";
  206. QuestionItem.PageCount = QuestionItem.ErrorList.length > 60 ? 60 : QuestionItem.ErrorList.length;
  207. QuestionItem.QuestionList = QuestionItem.ErrorList;
  208. QuestionItem.CreateTime = common.formatDateCHS(new Date());
  209. QuestionItem.IconName = app.globalData.fileUrl + "questioncard_icon_grade0102_size01.png";
  210. QuestionItem.QuestionList = common.randomArray(QuestionItem.QuestionList);
  211. delete QuestionItem.ErrorList;
  212. pageIndex = 0;
  213. that.setData({
  214. IsFinished: true,
  215. arrPage: [],
  216. IsDistabled: "",
  217. WaitTime: waitTime[that.data.PageNumber],
  218. });
  219. if (isAndroid) {
  220. console.log("android");
  221. var ctx = wx.createCanvasContext("Canvas", that);
  222. ctx.fillRect(0, 0, 1050, 1485);
  223. ctx.draw(true, function(n) {
  224. wx.canvasToTempFilePath({
  225. x: 0,
  226. y: 0,
  227. width: 2100,
  228. height: 2970,
  229. canvasId: 'Canvas',
  230. success: function(res2) {
  231. that.saveImage();
  232. }
  233. })
  234. });
  235. } else {
  236. that.saveImage();
  237. }
  238. } else {
  239. this.setData({
  240. ShowLoading: false,
  241. });
  242. wx.showModal({
  243. title: "没有错题",
  244. showCancel: false,
  245. content: "先到“对答案”中给做错的题目打记号(点击题目序号)",
  246. });
  247. }
  248. },
  249. getAnswerID: function() {
  250. var list = wx.getStorageSync("AnswerList");
  251. var id = 1;
  252. if (list && list.length > 0) {
  253. list.sort(function(a, b) {
  254. return b.AnswerID - a.AnswerID;
  255. });
  256. id = list[0].AnswerID + 1;
  257. }
  258. for (var i = 0; i < this.data.PageNumber; i++)
  259. arrAnswerID.push(id + i);
  260. },
  261. saveImage: function() {
  262. var that = this;
  263. var item = QuestionItem;
  264. item.AnswerID = arrAnswerID.shift();
  265. var ctx = wx.createCanvasContext("Canvas", that);
  266. ctx.setTextAlign('left');
  267. ctx.setTextBaseline('top');
  268. ctx.setFontSize(12);
  269. ctx.setFillStyle('white');
  270. ctx.fillRect(0, 0, 2100, 2970);
  271. ctx.fillStyle = "#000000";
  272. var xStart = 60;
  273. var yStart = 247;
  274. var height = 150;
  275. if (item.QuestionTypeCategory == 2)
  276. height = 59;
  277. if (item.Category > 0) {
  278. if (item.PageCount == 18)
  279. height = 210;
  280. else if (item.PageCount == 15)
  281. height = 250;
  282. }
  283. //括号
  284. var index = 0;
  285. for (var i = 0; i < 3; i++) {
  286. for (var j = 0; j < item.PageCount / 3; j++) {
  287. index++;
  288. if (index <= item.QuestionList.length) {
  289. ctx.fillText("(", xStart + i * 310, yStart + j * height);
  290. ctx.fillText(")", xStart + i * 310 + 22, yStart + j * height);
  291. }
  292. }
  293. }
  294. //编号
  295. index = 0;
  296. ctx.setTextAlign('center');
  297. var numberLeft = 12;
  298. if (isAndroid)
  299. numberLeft = 14;
  300. for (var i = 0; i < 3; i++) {
  301. for (var j = 0; j < item.PageCount / 3; j++) {
  302. index++;
  303. if (index <= item.QuestionList.length) {
  304. ctx.fillText(index, xStart + i * 310 + numberLeft, yStart + j * height);
  305. }
  306. }
  307. }
  308. //算式
  309. index = that.data.arrPage.length * item.PageCount;
  310. ctx.setFontSize(24);
  311. for (var i = 0; i < 3; i++) {
  312. for (var j = 0; j < item.PageCount / 3; j++) {
  313. index++;
  314. if (index <= item.QuestionList.length) {
  315. //横式
  316. if (item.QuestionTypeCategory == 2) {
  317. var A = item.QuestionList[index - 1].A.toString();
  318. if (item.QuestionList[index - 1].HiddenColumn == "A")
  319. A = "____";
  320. var OperateAB = item.QuestionList[index - 1].OperateAB.toString();
  321. //console.log(OperateAB);
  322. var B = item.QuestionList[index - 1].B.toString();
  323. if (item.QuestionList[index - 1].HiddenColumn == "B")
  324. B = "____";
  325. var equation = A + " " + OperateAB + " " + B;
  326. if (item.QuestionList[index - 1].C) {
  327. var OperateBC = item.QuestionList[index - 1].OperateBC.toString();
  328. var C = item.QuestionList[index - 1].C.toString();
  329. equation += " " + OperateBC + " " + C;
  330. if (item.QuestionList[index - 1].D) {
  331. var OperateCD = item.QuestionList[index - 1].OperateCD.toString();
  332. var D = item.QuestionList[index - 1].D.toString();
  333. equation += " " + OperateCD + " " + D;
  334. }
  335. }
  336. equation += " = ";
  337. var R = item.QuestionList[index - 1].R.toString();
  338. if (item.QuestionList[index - 1].HiddenColumn == "R")
  339. R = "";
  340. equation += R;
  341. var num = xStart + i * 310 + 31;
  342. for (var n = 0; n < equation.length; n++) {
  343. var len = getLength(equation[n]);
  344. num += len;
  345. if (equation[n] == ".") {
  346. ctx.fillText(equation[n], num + 3, yStart + j * 59 - 5);
  347. } else {
  348. var h = -8;
  349. if (equation[n] == "_")
  350. h = 0;
  351. ctx.fillText(equation[n], num, yStart + j * 59 + h);
  352. }
  353. }
  354. }
  355. //竖式
  356. else if (item.QuestionTypeCategory == 3) {
  357. var num1 = item.QuestionList[index - 1];
  358. var isAnswer = false;
  359. var width = 250;
  360. if (num1.OperateAB == "÷")
  361. width = 240;
  362. for (var n = 0; n < num1.Vertical.length; n++) {
  363. var num = xStart + i * 310 + width;
  364. var num2 = 0;
  365. for (var m = num1.Vertical[n].Array.length - 1; m >= 0; m--) {
  366. var str = "";
  367. if (num1.Vertical[n].Type == "line") {
  368. if (num1.OperateAB != "÷") {
  369. //var lineLength = num1.Vertical[n].Array.length * 30 + 20;
  370. var lineLength = 6 * 30 + 20;
  371. var lineTop = 4;
  372. //console.log(yStart + j * height + n * 30 + lineTop);
  373. ctx.moveTo(num, yStart + j * height + n * 30 + lineTop);
  374. ctx.lineTo(num - lineLength, yStart + j * height + n * 30 + lineTop);
  375. ctx.stroke();
  376. isAnswer = true;
  377. break;
  378. }
  379. } else {
  380. str = num1.Vertical[n].Array[m];
  381. if (num1.OperateAB == "÷" && str == "√") {
  382. isAnswer = true;
  383. var lineLength = num1.A.toString().length;
  384. var lineWidth = Math.floor(57 * (1 + num1.A.toString().length) / 2);
  385. ctx.drawImage("../../images/formula_division_size0" + lineLength + ".png", num - (num1.Vertical[n].Array.length - m) * 30 - 8, yStart + j * height + n * 30 - 10, lineWidth, 39);
  386. //break;
  387. } else if (num1.OperateAB == "÷" && n == 0) {} else if (num1.OperateAB == "÷" && n == 1) {
  388. ctx.fillText(str, num - (num1.Vertical[n].Array.length - m) * 10, yStart + j * height + n * 30);
  389. } else {
  390. if (str == ".") {
  391. ctx.fillText(str, num - (num1.Vertical[n].Array.length - m) * 30 + 15, yStart + j * height + n * 30);
  392. num2 = 30;
  393. }
  394. else if (str == "+" || str == "-" || str == "−" || str == "×" || str == "÷") {
  395. var lineLength = 6 * 30;
  396. ctx.fillText(str, num - lineLength, yStart + j * height + n * 30);
  397. num2 = 30;
  398. }
  399. else
  400. ctx.fillText(str, num - (num1.Vertical[n].Array.length - m) * 30 + num2, yStart + j * height + n * 30);
  401. }
  402. }
  403. }
  404. if (isAnswer)
  405. break;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. ctx.setTextAlign('left');
  412. ctx.setFontSize(32);
  413. ctx.fillText(item.Name, 60, 45);
  414. ctx.setFontSize(12);
  415. ctx.fillText(item.CategoryName, 60, 90);
  416. ctx.fillText("共" + item.PageCount + "道题", 60, 125);
  417. ctx.fillText("第 1 / 1 页", 60, 147);
  418. ctx.fillText("答案检索号", 768, 60);
  419. ctx.setTextAlign('right');
  420. ctx.fillText("出题时间 " + item.CreateTime, 875, 94);
  421. ctx.fillText("微信扫一扫 计时看答案", 875, 111);
  422. ctx.fillText("《数学计算题》选题 打印 扫码 批改", 875, 137);
  423. ctx.setFontSize(32);
  424. ctx.fillText(item.AnswerID, 872, 50);
  425. ctx.drawImage("../../images/answer.png", 890, 54, 100, 100);
  426. ctx.draw(true, function(n) {
  427. var w = 1050,
  428. h = 1485;
  429. wx.canvasToTempFilePath({
  430. x: 0,
  431. y: 0,
  432. width: w * times,
  433. height: h * times,
  434. destWidth: w * times,
  435. destHeight: h * times,
  436. canvasId: 'Canvas',
  437. success: function(res2) {
  438. //console.log(res2.tempFilePath);
  439. that.data.arrPage.push(res2.tempFilePath);
  440. item.TempImagePath = res2.tempFilePath;
  441. tempAnswerList.push(JSON.parse(JSON.stringify(item)));
  442. that.setData({
  443. arrPage: that.data.arrPage,
  444. });
  445. if (that.data.arrPage.length < that.data.PageNumber) {
  446. pageIndex++;
  447. that.saveImage();
  448. } else {
  449. //生成图片完成
  450. setTimeout(function() {
  451. that.setData({
  452. ShowLoading: false,
  453. });
  454. wx.pageScrollTo({
  455. scrollTop: 0,
  456. duration: 300
  457. });
  458. // wx.previewImage({
  459. // current: that.data.arrPage[0], // 当前显示图片的http链接
  460. // urls: that.data.arrPage // 需要预览的图片http链接列表
  461. // });
  462. //存列表
  463. var tempList = wx.getStorageSync("AnswerList");
  464. if (!tempList)
  465. tempList = [];
  466. for (var x = 0; x < tempList.length; x++) {
  467. tempList[x].IsNew = 0;
  468. }
  469. for (var x = 0; x < tempAnswerList.length; x++) {
  470. var tempItem = tempAnswerList[x];
  471. var id = x * tempItem.PageCount;
  472. var arr = [];
  473. for (var y = 0; y < tempItem.QuestionList.length; y++) {
  474. if (y >= id && y < id + tempItem.PageCount) {
  475. arr.push(tempItem.QuestionList[y]);
  476. }
  477. }
  478. tempItem.QuestionList = arr;
  479. tempItem.IsNew = 1;
  480. tempList.unshift(tempItem);
  481. }
  482. wx.setStorageSync("AnswerList", tempList);
  483. common.getStorageValue(that, "HelpHidden7", false, function() {
  484. that.showHelp2();
  485. });
  486. }, 3000);
  487. }
  488. }
  489. })
  490. });
  491. function getLength(str) {
  492. switch (str) {
  493. case "0":
  494. case "1":
  495. case "2":
  496. case "3":
  497. case "4":
  498. case "5":
  499. case "6":
  500. case "7":
  501. case "8":
  502. case "9":
  503. return 15;
  504. case ".":
  505. return 8;
  506. default:
  507. return 12;
  508. }
  509. }
  510. },
  511. //保存图片文件
  512. saveImageFile: function() {
  513. if (this.data.IsDistabled == "") {
  514. wx.showLoading({
  515. title: "保存中..."
  516. });
  517. var that = this;
  518. var count = 0;
  519. for (var i = 0; i < that.data.arrPage.length; i++) {
  520. wx.saveImageToPhotosAlbum({
  521. filePath: that.data.arrPage[i],
  522. success(res3) {
  523. console.log("save:" + res3.savedFilePath);
  524. count++
  525. if (count == that.data.arrPage.length) {
  526. wx.hideLoading();
  527. wx.showModal({
  528. title: "保存完成",
  529. showCancel: false,
  530. content: "请打开手机相册查看图片!",
  531. });
  532. that.setData({
  533. IsDistabled: "Distabled",
  534. BtnText: "已保存",
  535. });
  536. wx.pageScrollTo({
  537. scrollTop: 400,
  538. duration: 300
  539. });
  540. }
  541. },
  542. fail(err3) {
  543. console.log(err3);
  544. wx.openSetting();
  545. },
  546. complete() {
  547. wx.hideLoading();
  548. }
  549. })
  550. }
  551. }
  552. },
  553. changePageNumber: function(e) {
  554. var id = Number(e.currentTarget.dataset.id);
  555. this.data.PageNumber += id;
  556. var addDisabled = "",
  557. subDisabled = "";
  558. if (this.data.PageNumber <= 1) {
  559. this.data.PageNumber = 1;
  560. subDisabled = "btnAddSubDisabled";
  561. } else if (this.data.PageNumber >= 4) {
  562. this.data.PageNumber = 4;
  563. addDisabled = "btnAddSubDisabled";
  564. }
  565. this.setData({
  566. PageNumber: this.data.PageNumber,
  567. AddDisabled: addDisabled,
  568. SubDisabled: subDisabled,
  569. });
  570. },
  571. showImage: function(e) {
  572. var that = this;
  573. var id = e.currentTarget.dataset.id;
  574. wx.previewImage({
  575. current: that.data.arrPage[id], // 当前显示图片的http链接
  576. urls: that.data.arrPage // 需要预览的图片http链接列表
  577. });
  578. },
  579. closeLoading: function() {
  580. var that = this;
  581. that.setData({
  582. ShowLoading: false,
  583. IsFinished: false,
  584. });
  585. },
  586. menuClick: function(e) {
  587. this.data.filter = e.currentTarget.dataset.id;
  588. if (this.data.filter == "horizontal") {
  589. this.data.PageCount = this.data.QuestionTypeItem.QuestionNumber2;
  590. } else if (this.data.filter == "vertical") {
  591. this.data.PageCount = this.data.QuestionTypeItem.QuestionNumber3;
  592. }
  593. this.setData({
  594. filter: this.data.filter,
  595. IsShowMenu: false,
  596. PageCount: this.data.PageCount,
  597. });
  598. },
  599. closeMenu: function() {
  600. this.setData({
  601. IsShowMenu: false,
  602. });
  603. },
  604. openMenu: function() {
  605. this.setData({
  606. IsShowMenu: true,
  607. });
  608. },
  609. showHelp: function() {
  610. if (!this.data.HelpHidden3) {
  611. this.audioCtx = wx.createAudioContext('myAudio');
  612. var str = "嘿嘿,找到我了吗?我在车间的窗户里制作例题呢。如果这是你要的题型,去点“出题”按钮就对了。还要告诉你,一张卷子就是一张图片,题目数量请看提示。";
  613. server.playAudio(this.audioCtx, str);
  614. }
  615. },
  616. closeHelp: function() {
  617. this.setData({
  618. HelpHidden3: true,
  619. });
  620. wx.setStorageSync("HelpHidden3", true);
  621. this.audioCtx = wx.createAudioContext('myAudio');
  622. this.audioCtx.pause();
  623. },
  624. showHelp2: function() {
  625. if (!this.data.HelpHidden7) {
  626. this.audioCtx = wx.createAudioContext('myAudio');
  627. var str = "卷子出炉咯,棒棒哒!快去手机相册打印吧。我会等在首页上的答案资料室为你继续带路的。";
  628. server.playAudio(this.audioCtx, str);
  629. }
  630. },
  631. closeHelp2: function() {
  632. this.setData({
  633. HelpHidden7: true,
  634. });
  635. wx.setStorageSync("HelpHidden7", true);
  636. this.audioCtx = wx.createAudioContext('myAudio');
  637. this.audioCtx.pause();
  638. },
  639. showHelp8: function() {
  640. if (!this.data.HelpHidden8) {
  641. this.audioCtx = wx.createAudioContext('myAudio');
  642. var str = "发现错误是提高成绩的第一步。点一下题目数量右侧的图标,当有错题后,能查看和整理错题清单。";
  643. server.playAudio(this.audioCtx, str);
  644. }
  645. },
  646. closeHelp8: function() {
  647. this.setData({
  648. HelpHidden8: true,
  649. });
  650. wx.setStorageSync("HelpHidden8", true);
  651. this.audioCtx = wx.createAudioContext('myAudio');
  652. this.audioCtx.pause();
  653. },
  654. onShareAppMessage: function() {
  655. return {
  656. title: app.globalData.ShareTitle,
  657. path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
  658. imageUrl: app.globalData.ShareImageUrl,
  659. }
  660. },
  661. })