detail.js 21 KB

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