detail.js 22 KB

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