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