chengjie 7 anni fa
parent
commit
4f37f5201b

+ 1 - 1
app.js

@@ -14,7 +14,7 @@ App({
14 14
     this.globalData.systemInfo = wx.getSystemInfoSync();
15 15
   },
16 16
   globalData: {
17
-    version: "1.0.6",
17
+    version: "1.0.7",
18 18
     IsProduction: true,
19 19
     ProgramID: 105,
20 20
     AppID: "wx1fef080f74481cbd",

+ 1 - 0
app.json

@@ -7,6 +7,7 @@
7 7
     "pages/main/detail",
8 8
     "pages/main/list",
9 9
     "pages/main/errorlist",
10
+    "pages/about/share",
10 11
     "pages/about/payfinished",
11 12
     "pages/main/default"
12 13
   ],

BIN
images/universalpic_mask_face_size01.png


+ 76 - 0
pages/about/share.js

@@ -0,0 +1,76 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+
4
+const app = getApp();
5
+var imageIndex = 0;
6
+var arrBuildImageSource = [];
7
+var arrBuildImageTarget = [];
8
+
9
+Page({
10
+  data: {
11
+  },
12
+  onLoad: function (options) {
13
+    this.setData({
14
+      Height: common.getSystemHeight(),
15
+    });
16
+  },
17
+  onUnload: function () {
18
+    wx.setStorageSync("IsShare", true);
19
+  },
20
+  buildShareImage: function () {
21
+    imageIndex = 0;
22
+    arrBuildImageSource = [];
23
+    for (var i = 2; i < 6; i++)
24
+      arrBuildImageSource.push("../../images/programsystem_screenshot_pic0" + i + ".png");
25
+    arrBuildImageTarget = [];
26
+
27
+    this.buildImage();
28
+  },
29
+  buildImage: function () {
30
+    var that = this;
31
+    var ctx = wx.createCanvasContext("MyCanvas", this);
32
+    ctx.drawImage(arrBuildImageSource[imageIndex], 0, 0, 400, 300);
33
+    var avatar = wx.getStorageSync("Avatar");
34
+    if (avatar) {
35
+      ctx.drawImage(avatar, 15, 250, 40, 40);
36
+      ctx.drawImage("../../images/universalpic_mask_face_size01.png", 13, 248, 44, 44);
37
+
38
+      ctx.fillStyle = "#ffffff";
39
+      ctx.setFontSize(14);
40
+      ctx.fillText(app.globalData.userInfo.NickName, 65, 264);
41
+    }
42
+    ctx.draw(true, function (n) {
43
+      wx.canvasToTempFilePath({
44
+        x: 0,
45
+        y: 0,
46
+        width: 400,
47
+        height: 300,
48
+        canvasId: 'MyCanvas',
49
+        success: function (res2) {
50
+          console.log(res2.tempFilePath);
51
+
52
+          arrBuildImageTarget.push(res2.tempFilePath);
53
+
54
+          if (arrBuildImageTarget.length < arrBuildImageSource.length) {
55
+            imageIndex++;
56
+            that.buildImage();
57
+          }
58
+          else {
59
+            wx.previewImage({
60
+              current: arrBuildImageTarget[0], // 当前显示图片的http链接
61
+              urls: arrBuildImageTarget // 需要预览的图片http链接列表
62
+            });
63
+          }
64
+        }
65
+      })
66
+    });
67
+
68
+  },
69
+  onShareAppMessage: function () {
70
+    return {
71
+      title: app.globalData.ShareTitle,
72
+      path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
73
+      imageUrl: app.globalData.ShareImageUrl,
74
+    }
75
+  },
76
+});

+ 6 - 0
pages/about/share.json

@@ -0,0 +1,6 @@
1
+{
2
+  "navigationBarBackgroundColor": "#99607C",
3
+  "navigationBarTextStyle": "white",
4
+  "navigationBarTitleText": "分享",
5
+  "backgroundColor": "#99607C"
6
+}

+ 36 - 0
pages/about/share.wxml

@@ -0,0 +1,36 @@
1
+<view class="container FlexColumn" style='height:{{Height}}rpx;'>
2
+  <view class="btn">
3
+    <view class="btn1 FlexColumn">
4
+      <view class="panel1 FlexRow">
5
+        <view class="line"></view>
6
+        <view class="panel11 FlexColumn">
7
+          <view class="panel111 FlexColumn">
8
+            把我
9
+          </view>
10
+          <view class="panel112 FlexColumn">
11
+            分享给您的朋友吧
12
+          </view>
13
+        </view>
14
+      </view>
15
+      <view class="panel2 FlexRow">
16
+        <button class="panel2_1 FlexColumn" open-type="share">
17
+          <view class="textTitle">
18
+            <view class="textTitle1">转发给朋友</view>
19
+            <view class="textTitle2">转发给朋友</view>
20
+          </view>
21
+          <view class="panel212">直接转发</view>
22
+        </button>
23
+        <view class="line2"></view>
24
+        <view class="panel2_2 FlexColumn" bindtap='buildShareImage'>
25
+          <view class="textTitle textTitle3">
26
+            <view class="textTitle1">存图发朋友圈</view>
27
+            <view class="textTitle2">存图发朋友圈</view>
28
+          </view>
29
+          <view class="panel2121 panel212">生成图片 长按存图</view>
30
+        </view>
31
+      </view>
32
+    </view>
33
+  </view>
34
+  <image src="../../images/universalpic_share_guide_bg.png" class="universalpic_share_guide_bg" />
35
+</view>
36
+<canvas class='Canvas' canvas-id="MyCanvas"></canvas>

+ 132 - 0
pages/about/share.wxss

@@ -0,0 +1,132 @@
1
+.container {
2
+  background-color: #99607c;
3
+  justify-content: flex-start;
4
+}
5
+
6
+.btn {
7
+  width: 610rpx;
8
+  height: 422rpx;
9
+  background-color: #67453c;
10
+  margin-top: 212rpx;
11
+  border-radius: 14rpx;
12
+  z-index: 10;
13
+}
14
+
15
+.btn1 {
16
+  width: 100%;
17
+  height: 402rpx;
18
+  background-color: #ffd48b;
19
+  position: relative;
20
+  border-radius: 14rpx;
21
+  top: 0;
22
+}
23
+
24
+.panel1 {
25
+  width: 100%;
26
+  height: 260rpx;
27
+  border-bottom: 2rpx solid #e4b06c;
28
+  justify-content: flex-start;
29
+}
30
+
31
+.line {
32
+  width: 16rpx;
33
+  height:140rpx;
34
+  background-color: #EC4C56;
35
+  margin-left: 50rpx;
36
+}
37
+
38
+.panel11{
39
+  align-items: flex-start;
40
+  margin-left: 30rpx;
41
+}
42
+.panel111{
43
+  font-size:64rpx;
44
+  font-weight: 500;
45
+}
46
+.panel112{
47
+  font-size:48rpx;
48
+  font-weight: 500;
49
+}
50
+
51
+.panel2 {
52
+  width: 100%;
53
+  height: 140rpx;
54
+  background-color: #fec579;
55
+  border-bottom-left-radius: 14rpx;
56
+  border-bottom-right-radius: 14rpx;
57
+}
58
+
59
+.line2 {
60
+  width: 2rpx;
61
+  height: 90rpx;
62
+  background-color: #e4b06c;
63
+}
64
+
65
+.panel2_1 {
66
+  width: 305rpx;
67
+  height: 140rpx;
68
+  background-color: #fec579;
69
+  border-bottom-left-radius: 14rpx;
70
+  justify-content: flex-start;
71
+  padding-left: 0;
72
+  padding-right: 0;
73
+}
74
+
75
+.panel2_1::after {
76
+  border: 0px;
77
+}
78
+
79
+.panel2_2 {
80
+  width: 305rpx;
81
+  height: 140rpx;
82
+  background-color: #fec579;
83
+  border-bottom-right-radius: 14rpx;
84
+  justify-content: flex-start;
85
+}
86
+
87
+.textTitle {
88
+  font-size: 36rpx;
89
+  font-weight: 500;
90
+  width: 180rpx;
91
+  height:50rpx;
92
+  margin-top: 30rpx;
93
+}
94
+.textTitle3 {
95
+  width: 216rpx;
96
+}
97
+.textTitle1 {
98
+  -webkit-text-stroke:8rpx #8B4C28;
99
+  position: absolute;
100
+  text-align: center;
101
+  line-height: 50rpx;
102
+}
103
+.textTitle2 {
104
+  color: #FFFFFF;
105
+  position: absolute;
106
+  text-align: center;
107
+  line-height: 50rpx;
108
+}
109
+.panel212{
110
+  font-size: 22rpx;
111
+  font-weight: 500;
112
+  color:#8B4C28;
113
+  margin-top: -2rpx;
114
+}
115
+.panel2121{
116
+  margin-top: 8rpx;
117
+}
118
+
119
+.universalpic_share_guide_bg {
120
+  width: 100%;
121
+  height: 440rpx;
122
+  position: fixed;
123
+  bottom: 0;
124
+}
125
+
126
+.Canvas{
127
+  width: 400px; 
128
+  height: 300px;
129
+  position: fixed;
130
+  left:760rpx;
131
+  top:0rpx;
132
+}

+ 0 - 1
pages/index/guide.wxml

@@ -1,5 +1,4 @@
1 1
 <view class="container FlexColumn" style="height:{{Containnerheight}}rpx;">
2
-  <image class="welcomeguide_bg" src="../../images/welcomeguide_bg.png" />
3 2
   <view class="panel FlexColumn">
4 3
     <image class="welcomeguide_info" src="../../images/welcomeguide_info.png" />
5 4
     <image class="welcomeguide_dialogue" src="../../images/welcomeguide_dialogue.png" />

+ 0 - 7
pages/index/guide.wxss

@@ -3,13 +3,6 @@
3 3
   justify-content: flex-start;
4 4
 }
5 5
 
6
-.welcomeguide_bg {
7
-  width: 100%;
8
-  height: 1206rpx;
9
-  position: fixed;
10
-  top:0;
11
-}
12
-
13 6
 .panel{
14 7
   width:100%;
15 8
   position: fixed;

+ 3 - 0
pages/main/answer.js

@@ -20,6 +20,9 @@ Page({
20 20
     });
21 21
 
22 22
   },
23
+  onUnload: function () {
24
+    this.closeHelp();
25
+  },
23 26
   getList: function () {
24 27
     //console.log(new Date().getTime());
25 28
     var that = this;

+ 1 - 1
pages/main/answer.wxml

@@ -37,7 +37,7 @@
37 37
 
38 38
     <view class="textFooter FlexRow">
39 39
       <image class="universalpic_attention_blue_size01" src="../../images/universalpic_attention_blue_size01.png" />
40
-      <view class="textFooter1">删除小程序时,答案也会被删除。</view>
40
+      <view class="textFooter1">小程序被删除后,出题记录和答案也会被删除。</view>
41 41
     </view>
42 42
 
43 43
     <view class="panel01 panel00 FlexRow" bindtap='selectItem'>

+ 122 - 26
pages/main/default.js

@@ -3,6 +3,9 @@ import server from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5 5
 var code;
6
+var imageIndex = 0;
7
+var arrBuildImageSource = [];
8
+var arrBuildImageTarget = [];
6 9
 
7 10
 Page({
8 11
   data: {
@@ -13,41 +16,41 @@ Page({
13 16
     AvatarUrl: "",
14 17
     IsAccredit: false,
15 18
   },
16
-  onLoad: function() {
17
-    var that=this;
19
+  onLoad: function () {
20
+    var that = this;
18 21
     this.setData({
19 22
       Containnerheight: server.getWindowHeight(),
20 23
       ProgramList: server.getProgramList(),
21 24
       NickName: app.globalData.userInfo.NickName,
22 25
       AvatarUrl: app.globalData.userInfo.AvatarUrl,
23 26
     });
24
-    common.getStorageValue(this, "HelpHidden1", false, function () { 
27
+    common.getStorageValue(this, "HelpHidden1", false, function () {
25 28
       that.showHelp();
26 29
     });
27
-
28 30
     wx.login({
29 31
       success: function (res0) {
30 32
         code = res0.code;
31 33
       }
32 34
     });
33
-    
35
+    this.downloadUserAvatar();
34 36
     this.updateProgram();
35
-
36
-    
37 37
   },
38
-  onShow:function(){
38
+  onUnload:function(){
39
+    this.closeHelp();
40
+  },
41
+  onShow: function () {
39 42
     var list = wx.getStorageSync("AnswerList");
40 43
     var answerLength = 0;
41 44
     if (list && list.length > 0) {
42 45
       answerLength = list.length;
43 46
     }
44
-    
47
+
45 48
     var errorCount = 0;
46 49
     var listError = wx.getStorageSync("ErrorList");
47 50
     if (listError && listError.length > 0) {
48 51
       errorCount = listError.length;
49 52
     }
50
-    
53
+
51 54
     this.setData({
52 55
       AnswerLength: answerLength,
53 56
       ErrorCount: errorCount,
@@ -73,12 +76,36 @@ Page({
73 76
         }
74 77
       }
75 78
     });
79
+
80
+    if (list && list.length >= 2) {
81
+      common.getStorageValue(that, "IsShare", false, function () {
82
+        if (!that.data.IsShare) {
83
+          wx.navigateTo({
84
+            url: '../about/share',
85
+          });
86
+        }
87
+      });
88
+    }
89
+  },
90
+  downloadUserAvatar: function () {
91
+    var avatar = wx.getStorageSync("Avatar");
92
+    if (!avatar) {
93
+      var that = this;
94
+      wx.downloadFile({
95
+        url: app.globalData.userInfo.AvatarUrl,
96
+        success(res) {
97
+          if (res.statusCode === 200) {
98
+            wx.setStorageSync("Avatar", res.tempFilePath);
99
+          }
100
+        }
101
+      });
102
+    }
76 103
   },
77
-  gotoList:function(e){
104
+  gotoList: function (e) {
78 105
     server.playSound("/sounds/click.mp3");
79 106
 
80
-    var id=e.currentTarget.dataset.id;
81
-    var categoryArray = [{}, { Num: 1, Name: "一年级", Array: [1, 2] }, { Num: 2, Name: "二年级", Array: [3, 4] }, { Num: 3, Name: "三年级", Array: [5, 6] }, { Num: 4,Name: "四年级及以上", Array: [7] }];
107
+    var id = e.currentTarget.dataset.id;
108
+    var categoryArray = [{}, { Num: 1, Name: "一年级", Array: [1, 2] }, { Num: 2, Name: "二年级", Array: [3, 4] }, { Num: 3, Name: "三年级", Array: [5, 6] }, { Num: 4, Name: "四年级及以上", Array: [7] }];
82 109
 
83 110
     wx.navigateTo({
84 111
       url: '../main/list?id=' + categoryArray[id].Array.join(",") + "&name=" + categoryArray[id].Name + "&num=" + categoryArray[id].Num,
@@ -86,7 +113,24 @@ Page({
86 113
 
87 114
     this.closeHelp();
88 115
   },
89
-  gotoAnswer:function(){
116
+  closeMenu: function () {
117
+    this.setData({
118
+      IsShowMenu: false,
119
+    });
120
+  },
121
+  openMenu: function () {
122
+    this.setData({
123
+      IsShowMenu: true,
124
+    });
125
+  },
126
+  gotoHelp: function () {
127
+    for (var i = 0; i < 9; i++)
128
+      wx.removeStorageSync("HelpHidden" + i);
129
+    wx.redirectTo({
130
+      url: '../index/guide',
131
+    });
132
+  },
133
+  gotoAnswer: function () {
90 134
     wx.navigateTo({
91 135
       url: '../main/answer',
92 136
     });
@@ -101,7 +145,7 @@ Page({
101 145
       url: '../main/detail?id=-1',
102 146
     });
103 147
   },
104
-  switchProgram: function(e) {
148
+  switchProgram: function (e) {
105 149
     wx.navigateToMiniProgram({
106 150
       appId: e.currentTarget.dataset.appid,
107 151
       path: e.currentTarget.dataset.path,
@@ -111,37 +155,89 @@ Page({
111 155
       }
112 156
     });
113 157
   },
114
-  gotoFeedback: function() {
158
+  gotoFeedback: function () {
115 159
     server.gotoFeedback();
116 160
   },
117
-  showHelp:function(){
118
-    if (!this.data.HelpHidden1){
161
+  showHelp: function () {
162
+    if (!this.data.HelpHidden1) {
119 163
       this.audioCtx = wx.createAudioContext('myAudio');
120
-      var str ="那么,就从选题目开始吧。在计算题工厂里包括了小学数学全年级最重要的知识点。其中“四年级及以上”,这个栏目囊括了四到六年级的题型。请选一个年级继续。";
164
+      var str = "那么,就从选题目开始吧。在计算题工厂里包括了小学数学全年级最重要的知识点。其中“四年级及以上”,这个栏目囊括了四到六年级的题型。请选一个年级继续。";
121 165
       server.playAudio(this.audioCtx, str);
122 166
     }
123 167
   },
124
-  closeHelp:function(){
168
+  closeHelp: function () {
125 169
     this.setData({
126
-      HelpHidden1:true,
170
+      HelpHidden1: true,
127 171
     });
128 172
     wx.setStorageSync("HelpHidden1", true);
129 173
     this.audioCtx = wx.createAudioContext('myAudio');
130 174
     this.audioCtx.pause();
131 175
   },
132
-  updateProgram: function() {
176
+  buildShareImage: function () {
177
+    this.closeMenu();
178
+    imageIndex = 0;
179
+    arrBuildImageSource = [];
180
+    for (var i = 2; i < 6; i++)
181
+      arrBuildImageSource.push("../../images/programsystem_screenshot_pic0" + i + ".png");
182
+    arrBuildImageTarget = [];
183
+
184
+    this.buildImage();
185
+  },
186
+  buildImage: function () {
187
+    var that = this;
188
+    var ctx = wx.createCanvasContext("MyCanvas", this);
189
+    ctx.drawImage(arrBuildImageSource[imageIndex], 0, 0, 400, 300);
190
+
191
+    var avatar = wx.getStorageSync("Avatar");
192
+    if (avatar) {
193
+      ctx.drawImage(avatar, 15, 250, 40, 40);
194
+      ctx.drawImage("../../images/universalpic_mask_face_size01.png", 13, 248, 44, 44);
195
+
196
+      ctx.fillStyle = "#ffffff";
197
+      ctx.setFontSize(14);
198
+      ctx.fillText(app.globalData.userInfo.NickName, 65, 264);
199
+    }
200
+
201
+    ctx.draw(true, function (n) {
202
+      wx.canvasToTempFilePath({
203
+        x: 0,
204
+        y: 0,
205
+        width: 400,
206
+        height: 300,
207
+        canvasId: 'MyCanvas',
208
+        success: function (res2) {
209
+          console.log(res2.tempFilePath);
210
+
211
+          arrBuildImageTarget.push(res2.tempFilePath);
212
+
213
+          if (arrBuildImageTarget.length < arrBuildImageSource.length) {
214
+            imageIndex++;
215
+            that.buildImage();
216
+          }
217
+          else {
218
+            wx.previewImage({
219
+              current: arrBuildImageTarget[0], // 当前显示图片的http链接
220
+              urls: arrBuildImageTarget // 需要预览的图片http链接列表
221
+            });
222
+          }
223
+        }
224
+      })
225
+    });
226
+
227
+  },
228
+  updateProgram: function () {
133 229
     const updateManager = wx.getUpdateManager();
134 230
 
135
-    updateManager.onCheckForUpdate(function(res) {
231
+    updateManager.onCheckForUpdate(function (res) {
136 232
       // 请求完新版本信息的回调
137 233
       //console.log(res.hasUpdate)
138 234
     });
139 235
 
140
-    updateManager.onUpdateReady(function() {
236
+    updateManager.onUpdateReady(function () {
141 237
       wx.showModal({
142 238
         title: '更新提示',
143 239
         content: '新版本已经准备好,是否重启应用?',
144
-        success: function(res) {
240
+        success: function (res) {
145 241
           if (res.confirm) {
146 242
             // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
147 243
             updateManager.applyUpdate()
@@ -151,7 +247,7 @@ Page({
151 247
 
152 248
     });
153 249
   },
154
-  onShareAppMessage: function() {
250
+  onShareAppMessage: function () {
155 251
     return {
156 252
       title: app.globalData.ShareTitle,
157 253
       path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,

+ 32 - 9
pages/main/default.wxml

@@ -44,12 +44,12 @@
44 44
                 <view class="text">{{ErrorCount}}</view>
45 45
               </view>
46 46
               <view class="line4 line3"></view>
47
-              <view class="panel002000 FlexRow" bindtap='gotoErrorList'>
48
-                <button class="btn">
47
+              <view class="panel002000 FlexRow" >
48
+                <view class="btn" bindtap='gotoErrorList'>
49 49
                   <view class="btn1">
50 50
                     错题集
51 51
                   </view>
52
-                </button>
52
+                </view>
53 53
 
54 54
                 <view class="btn2 btn" bindtap='gotoAnswer'>
55 55
                   <view class="btn3 btn1">
@@ -74,19 +74,19 @@
74 74
             <view class="panel00300 FlexColumn">
75 75
               <text class="text">©2018 唱意教育 - 数学计算题\n微信小程序 版本 {{version}}</text>
76 76
               <view class="panel003000 FlexRow">
77
-                <view>帮助</view>
77
+                <view bindtap='gotoHelp'>帮助</view>
78 78
                 <view class="line"></view>
79 79
                 <view bindtap='gotoFeedback'>反馈</view>
80 80
                 <view class="line"></view>
81
-                <view>合作</view>
81
+                <view bindtap='gotoFeedback'>合作</view>
82 82
               </view>
83 83
             </view>
84
-            <button class="btn4 btn" open-type="share">
84
+            <view class="btn4 btn" bindtap='openMenu'>
85 85
               <view class="btn5 btn1 FlexColumn">
86 86
                 <image class="universalpic_share_size01" src="../../images/universalpic_share_size01.png" />
87
-                <view>转发分享</view>
87
+                <view>分享朋友</view>
88 88
               </view>
89
-            </button>
89
+            </view>
90 90
 
91 91
           </view>
92 92
 
@@ -110,6 +110,29 @@
110 110
       </view>
111 111
     </view>
112 112
   </view>
113
+
114
+  <view class="menuPanel" style="min-height:{{Containnerheight}}rpx;" wx:if="{{IsShowMenu}}">
115
+    <view class="menu FlexColumn">
116
+      <view class="text1">选择分享方式</view>
117
+      <button class="panel FlexRow" open-type="share">
118
+        <view>转发给朋友</view>
119
+      </button>
120
+      <view class="line"></view>
121
+      <view class="panel2 panel FlexColumn" bindtap='buildShareImage' >
122
+        <view>存图发到朋友圈</view>
123
+        <view class="text3">点击后生成图片,长按图片选择保存到相册</view>
124
+      </view>
125
+      <view class="line"></view>
126
+      <view class="line2"></view>
127
+      <view class="line"></view>
128
+      <view class="panel FlexRow" bindtap='closeMenu'>
129
+        <view>取消</view>
130
+      </view>
131
+
132
+    </view>
133
+  </view>
113 134
 </view>
114 135
 <image hidden="{{HelpHidden1}}" bindtap='closeHelp' class="Help_aside_homepage" src="../../images/Help_aside_homepage.png" />
115
-<audio hidden='true' id="myAudio"></audio>
136
+
137
+<audio hidden='true' id="myAudio"></audio>
138
+<canvas class='Canvas' canvas-id="MyCanvas"></canvas>

+ 62 - 0
pages/main/default.wxss

@@ -371,4 +371,66 @@
371 371
   position: fixed;
372 372
   bottom: 0rpx;
373 373
   z-index: 100;
374
+}
375
+
376
+
377
+.menuPanel{
378
+  position: fixed;
379
+  top: 0;
380
+  width: 100%;
381
+  background-color:rgba(185, 220, 93, 0.9);
382
+  z-index: 30;
383
+}
384
+
385
+.menu {
386
+  position: fixed;
387
+  bottom: 0;
388
+  width: 100%;
389
+  background-color: #d2d2d2;
390
+  z-index: 30;
391
+  font-weight: 400;
392
+}
393
+
394
+.menu .text1 {
395
+  font-size: 24rpx;
396
+  margin: 30rpx;
397
+}
398
+
399
+.menu .panel {
400
+  font-size: 36rpx;
401
+  height: 111rpx;
402
+  width: 100%;
403
+  background-color: #fff;
404
+  position: relative;
405
+  justify-content: center;
406
+}
407
+
408
+.menu .panel2 {
409
+  height: 143rpx;
410
+}
411
+
412
+.menu .text3 {
413
+  font-size:24rpx;
414
+  font-weight: 400;
415
+}
416
+
417
+.menu .line {
418
+  height: 2rpx;
419
+  width: 100%;
420
+  background-color: #e3e3e3;
421
+}
422
+
423
+.menu .line2 {
424
+  height: 20rpx;
425
+  width: 100%;
426
+  background-color: #d2d2d2;
427
+}
428
+
429
+
430
+.Canvas{
431
+  width: 400px; 
432
+  height: 300px;
433
+  position: fixed;
434
+  left:760rpx;
435
+  top:0rpx;
374 436
 }

+ 221 - 190
pages/main/detail.js

@@ -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,

+ 35 - 24
pages/main/item.js

@@ -5,7 +5,7 @@ const app = getApp();
5 5
 
6 6
 var currentIndex = 0, tempCurrentIndex = -1;
7 7
 var audioArray = [];
8
-var AnswerID=0;
8
+var AnswerID = 0;
9 9
 
10 10
 Page({
11 11
   data: {
@@ -98,10 +98,11 @@ Page({
98 98
 
99 99
       var list = item.QuestionList;
100 100
       for (var i = 0; i < list.length; i++) {
101
-        if (i == 0 && list[i].Vertical) {
101
+        if (i == 0 && list[i].Vertical && item.Category > 0) {
102 102
           list[i].IsShowVertical = true;
103 103
         }
104
-        //list[i].ErrorClass = "";
104
+        if (item.Category == -1)
105
+          list[i].ErrorClass = "";
105 106
       }
106 107
 
107 108
       var list = item.QuestionList;
@@ -112,7 +113,7 @@ Page({
112 113
             list[i].Vertical[1].Array[k] = "";
113 114
           }
114 115
           for (var k = 0; k < list[i].Vertical[2].Array.length; k++) {
115
-            if (list[i].Vertical[2].Array[k] == "√") {
116
+            if (list[i].Vertical[2].Array[k] == "√" && list[i].Vertical[2].Array[list[i].Vertical[2].Array.length - 1] != "√") {
116 117
               list[i].Vertical[2].Array[k] = "";
117 118
               list[i].Vertical[2].Array.push("√");
118 119
               break;
@@ -121,8 +122,17 @@ Page({
121 122
         }
122 123
       }
123 124
 
125
+      var pageNum = 0;
126
+      if (item.QuestionList.length % 3 == 0)
127
+        pageNum = item.QuestionList.length / 3;
128
+      else if (item.QuestionList.length % 3 == 1)
129
+        pageNum = (item.QuestionList.length + 2) / 3;
130
+      else if (item.QuestionList.length % 3 == 2)
131
+        pageNum = (item.QuestionList.length + 1) / 3;
132
+
124 133
       that.setData({
125 134
         AnswerItem: item,
135
+        PageColumnNum: pageNum,
126 136
       });
127 137
     }
128 138
   },
@@ -143,6 +153,7 @@ Page({
143 153
 
144 154
   },
145 155
   setErrorItem: function (e) {
156
+
146 157
     var id = e.currentTarget.dataset.id;
147 158
     var list = this.data.AnswerItem.QuestionList;
148 159
     for (var i = 0; i < list.length; i++) {
@@ -150,7 +161,7 @@ Page({
150 161
         if (!list[i].ErrorClass || list[i].ErrorClass == "") {
151 162
           list[i].ErrorClass = "ErrorClass";
152 163
           wx.showToast({ title: "记号已保存", duration: 1000 });
153
-          this.saveErrorList(list[i],"add");
164
+          this.saveErrorList(list[i], "add");
154 165
         }
155 166
         else {
156 167
           list[i].ErrorClass = "";
@@ -164,36 +175,36 @@ Page({
164 175
     this.setData({
165 176
       AnswerItem: this.data.AnswerItem,
166 177
     });
167
-    
178
+
168 179
   },
169
-  saveErrorList:function(item,action){
180
+  saveErrorList: function (item, action) {
170 181
     var list = wx.getStorageSync("ErrorList");
171 182
     if (!list)
172
-      list=[];
173
-    var b=false;
174
-    for(var i=0;i<list.length;i++){
175
-      if (item.A == list[i].A && item.B == list[i].B && item.R == list[i].R && item.OperateAB == list[i].OperateAB){
176
-        if (item.C){
177
-          if (item.C == list[i].C && item.OperateBC == list[i].OperateBC){
178
-            if (item.D){
179
-              if (item.D == list[i].D && item.OperateCD == list[i].OperateCD){
180
-                b=true;
183
+      list = [];
184
+    var b = false;
185
+    for (var i = 0; i < list.length; i++) {
186
+      if (item.A == list[i].A && item.B == list[i].B && item.R == list[i].R && item.OperateAB == list[i].OperateAB) {
187
+        if (item.C) {
188
+          if (item.C == list[i].C && item.OperateBC == list[i].OperateBC) {
189
+            if (item.D) {
190
+              if (item.D == list[i].D && item.OperateCD == list[i].OperateCD) {
191
+                b = true;
181 192
               }
182 193
             }
183 194
             else
184
-              b=true;
195
+              b = true;
185 196
           }
186 197
         }
187 198
         else
188
-          b=true;
189
-      } 
190
-      if (b){
199
+          b = true;
200
+      }
201
+      if (b) {
191 202
         list.splice(i, 1);
192 203
         break;
193 204
       }
194 205
     }
195
-    if (action=="add"){
196
-      item.ID=new Date().getTime();
206
+    if (action == "add") {
207
+      item.ID = new Date().getTime();
197 208
       list.unshift(item);
198 209
     }
199 210
     wx.setStorageSync("ErrorList", list);
@@ -219,13 +230,13 @@ Page({
219 230
       var item = this.data.AnswerItem;
220 231
       var list = item.QuestionList;
221 232
       for (var i = 0; i < list.length; i++) {
222
-        if ((i % (list.length / 3)) == 0) {
233
+        if (i % this.data.PageColumnNum == 0) {
223 234
           if (i > 0) {
224 235
             arr.push("");
225 236
             audioArray.push(arr);
226 237
             arr = [];
227 238
           }
228
-          arr.push("第" + (1 + i / (list.length / 3)) + "列");
239
+          arr.push("第" + (1 + Math.floor(i / this.data.PageColumnNum)) + "列");
229 240
 
230 241
         }
231 242
         var str = list[i].Result;

+ 7 - 7
pages/main/item.wxml

@@ -40,18 +40,18 @@
40 40
     <view class="panelLeft">题号快翻</view>
41 41
     <view class="panelRight FlexRow">
42 42
       <view class="{{selectTab0}} btn" bindtap="scrollTop" data-id="0">1</view>
43
-      <view class="{{selectTab1}} btn" bindtap="scrollTop" data-id="1">{{AnswerItem.QuestionList.length/3+1}}</view>
44
-      <view class="{{selectTab2}} btn" bindtap="scrollTop" data-id="2">{{AnswerItem.QuestionList.length*2/3+1}}</view>
43
+      <view class="{{selectTab1}} btn" bindtap="scrollTop" data-id="1">{{PageColumnNum+1}}</view>
44
+      <view class="{{selectTab2}} btn" bindtap="scrollTop" data-id="2">{{PageColumnNum*2+1}}</view>
45 45
     </view>
46 46
   </view>
47 47
 
48 48
   <block wx:for="{{AnswerItem.QuestionList}}" wx:key="index">
49
-    <block wx:if="{{(index % (AnswerItem.QuestionList.length/3))==0 }}">
50
-      <view id="panelRowTop{{index / (AnswerItem.QuestionList.length/3)}}" class="panelRowTop FlexRow">
49
+    <block wx:if="{{(index % (PageColumnNum))==0 }}">
50
+      <view id="panelRowTop{{index / (PageColumnNum)}}" class="panelRowTop FlexRow">
51 51
         <view class="panelLeft1 panelLeft">第
52
-          <block wx:if="{{index / (AnswerItem.QuestionList.length/3)==0}}">一</block>
53
-          <block wx:if="{{index / (AnswerItem.QuestionList.length/3)==1}}">二</block>
54
-          <block wx:if="{{index / (AnswerItem.QuestionList.length/3)==2}}">三</block>
52
+          <block wx:if="{{index==0}}">一</block>
53
+          <block wx:if="{{index==PageColumnNum}}">二</block>
54
+          <block wx:if="{{index==PageColumnNum*2}}">三</block>
55 55
           列</view>
56 56
         <view>
57 57
         </view>

+ 0 - 3
pages/main/item.wxss

@@ -195,9 +195,6 @@
195 195
 .formula_division_size04{
196 196
   width:285rpx;
197 197
 }
198
-.formula_division_size04{
199
-  width:285rpx;
200
-}
201 198
 .formula_division_size05{
202 199
   width:342rpx;
203 200
 }

+ 3 - 0
pages/main/list.js

@@ -32,6 +32,9 @@ Page({
32 32
     this.getList();
33 33
     
34 34
   },
35
+  onUnload: function () {
36
+    this.closeHelp();
37
+  },
35 38
   getList: function () {
36 39
     this.buildList();
37 40
   },

+ 10 - 3
project.config.json

@@ -30,7 +30,7 @@
30 30
 			"list": []
31 31
 		},
32 32
 		"miniprogram": {
33
-			"current": 7,
33
+			"current": 1,
34 34
 			"list": [
35 35
 				{
36 36
 					"id": 0,
@@ -42,7 +42,7 @@
42 42
 					"id": 1,
43 43
 					"name": "detail",
44 44
 					"pathName": "pages/main/detail",
45
-					"query": "id=24"
45
+					"query": "id=187"
46 46
 				},
47 47
 				{
48 48
 					"id": 2,
@@ -77,7 +77,14 @@
77 77
 				{
78 78
 					"id": -1,
79 79
 					"name": "errorlist",
80
-					"pathName": "pages/main/errorlist"
80
+					"pathName": "pages/main/errorlist",
81
+					"query": ""
82
+				},
83
+				{
84
+					"id": -1,
85
+					"name": "share",
86
+					"pathName": "pages/about/share",
87
+					"query": ""
81 88
 				}
82 89
 			]
83 90
 		}

+ 1 - 1
utils/main.js

@@ -297,7 +297,7 @@ function playSound(file){
297 297
   innerAudioContext.autoplay = true
298 298
   innerAudioContext.src = file
299 299
   innerAudioContext.onPlay(() => {
300
-    console.log('开始播放')
300
+    //console.log('开始播放')
301 301
   })
302 302
 }
303 303