chengjie 6 年之前
父節點
當前提交
1b9f6f44b0
共有 9 個文件被更改,包括 332 次插入21 次删除
  1. 47 8
      pages/test/item.js
  2. 5 1
      pages/test/item.json
  3. 46 1
      pages/test/item.wxml
  4. 183 0
      pages/test/item.wxss
  5. 18 1
      pages/test/list.js
  6. 4 4
      pages/test/list.wxml
  7. 22 0
      pages/test/wordlist.js
  8. 5 4
      pages/test/wordlist.wxml
  9. 2 2
      project.config.json

+ 47 - 8
pages/test/item.js

@@ -5,19 +5,58 @@ const app = getApp();
5 5
 
6 6
 Page({
7 7
   data: {
8
+    IsSelect: true,
9
+
8 10
   },
9 11
   onLoad: function (options) {
10 12
     var that = this;
11 13
     that.setData({
12 14
       Containnerheight: main.getWindowHeight(),
13
-      Color: {
14
-        ID: 0,
15
-        Name: "黑白",
16
-        BackColor: "#fff",
17
-        BackColor2: "#eee",
18
-        LineColor: "#eee",
19
-        FieldColor: "#ddd",
20
-      },
15
+      IsShowAnswer: [0, 0],
16
+      Color: main.getDetailColor(1),
17
+    });
18
+
19
+    var words = [];
20
+    var unitsName = "";
21
+    var arr = wx.getStorageSync("HanziAll");
22
+    arr = JSON.parse(arr);
23
+    var unitsid = Number(options.unitsid);
24
+    var id = Number(options.id);
25
+    for (var i = 0; i < arr.length; i++) {
26
+      if (arr[i].ID == unitsid) {
27
+        var list = arr[i].Units;
28
+        for (var j = 0; j < list.length; j++) {
29
+          if (list[j].ID == id) {
30
+            unitsName = list[j].Name;
31
+            words = list[j].Words;
32
+          }
33
+        }
34
+
35
+        var tags=["怎么写"];
36
+        if (options.category=="read")
37
+          tags = ["怎么念"];
38
+
39
+
40
+        that.setData({
41
+          UnitsName: unitsName,
42
+          Words: words,
43
+          Tags:tags,
44
+        });
45
+        break;
46
+      }
47
+    }
48
+  },
49
+  onPullDownRefresh: function () {
50
+    var that = this;
51
+    that.setData({
52
+      IsShowAnswer: [0, 0],
53
+    });
54
+    wx.stopPullDownRefresh();
55
+  },
56
+  onShowAnswer: function (e) {
57
+    var that=this;
58
+    that.setData({
59
+      IsShowAnswer: [1,1],
21 60
     });
22 61
   },
23 62
   onShareAppMessage: function () {

+ 5 - 1
pages/test/item.json

@@ -1,3 +1,7 @@
1 1
 {
2
-  "usingComponents": {}
2
+  "navigationBarTitleText": "检验中",
3
+  "navigationBarBackgroundColor": "#1F3C88",
4
+  "navigationBarTextStyle": "white",
5
+  "backgroundColor": "#1F3C88",
6
+  "enablePullDownRefresh": true
3 7
 }

+ 46 - 1
pages/test/item.wxml

@@ -1,6 +1,51 @@
1 1
 <import src="../template/cardShow.wxml" />
2 2
 <view class="container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
3
+  <view class="panelTop FlexRow">
4
+    <view class="left FlexRow">
5
+      <view class="Number2 Number1 FlexColumn">
6
+        <view>1</view>
7
+        <view class="line2 line1"></view>
8
+      </view>
9
+      <view class="Number1 FlexColumn">
10
+        <view>88</view>
11
+        <view class="line1"></view>
12
+      </view>
13
+    </view>
14
+    <view class="right FlexRow">
15
+      <view class="btnTop FlexRow">
16
+        <image src="../images/universalpic_shelve_gray_26x26.png" class="universalpic_shelve_gray_26x26" />
17
+      </view>
18
+      <view class="btnTop FlexRow">
19
+        <image src="../images/universalpic_undo_gray_26x20.png" class="universalpic_undo_gray_26x20" />
20
+      </view>
21
+    </view>
22
+  </view>
23
+  <view style='width:100%;height:110rpx;'></view>
3 24
   <template is="CardShow" data="{{Color:Color,Field:Field,Tags:Tags,IsShowAnswer:IsShowAnswer,TagWidth:TagWidth,FontSize:FontSize,LimitTimeStr:LimitTimeStr,ShowType:ShowType}}" />
4
-  
5 25
   <view style='width:100%;height:100rpx;'></view>
26
+
27
+  <!-- 下方按钮 -->
28
+  <image class="footerShade" src="../images/study_learning_bgimage_tc0{{Color.ID}}.png" />
29
+  <view class='footer FlexColumn'>
30
+    <image class="footerImage" src="../images/study_learning_maskimage_tc0{{Color.ID}}.png" />
31
+    <view class="panelFooter FlexColumn" hover-class='AnswerHover' wx:if="{{!IsShowAnswer[0] && !IsShowAnswer[1] && ClickType!=1}}" catchtouchstart="onShowAnswer">
32
+      看答案
33
+    </view>
34
+    <view class="panelFooter0 panelFooter FlexColumn" wx:if="{{IsShowAnswer[1]}}">
35
+      <view class='panelBottomAnswer panelBottom FlexRow'>
36
+        <view class="AnswerLeft Answer FlexColumn" hover-class='AnswerHover' catchtap='gotoNext' data-time="{{TaskInfo.Number0}}" data-btnnumber="0">
37
+          <view class="btnTime">
38
+            答错
39
+          </view>
40
+          <view class="Answer0 btnColor"></view>
41
+        </view>
42
+        <view class="Answer FlexColumn" hover-class='AnswerHover' catchtap='gotoNext' data-time="{{TaskInfo.Number2}}" data-btnnumber="4">
43
+          <view class="btnTime">
44
+            答对
45
+          </view>
46
+          <view class="Answer2 btnColor"></view>
47
+        </view>
48
+      </view>
49
+    </view>
50
+  </view>
6 51
 </view>

+ 183 - 0
pages/test/item.wxss

@@ -1,3 +1,61 @@
1
+.container {
2
+  background-color: #1F3C88;
3
+}
4
+
5
+.panelTop{
6
+  width:100%;
7
+  height:110rpx;
8
+  justify-content: space-between;
9
+  color:#fff;
10
+  position: fixed;
11
+  top:0;
12
+  z-index: 10;
13
+}
14
+
15
+.left{
16
+  margin-left: 50rpx;
17
+}
18
+
19
+.Number1{
20
+  width:50rpx;
21
+  height:50rpx;
22
+  justify-content: flex-end;
23
+  font-size:20rpx;
24
+  font-weight: 400;
25
+  font-family: 'Roboto-Black';
26
+  margin-bottom: 10rpx;
27
+}
28
+.Number2{
29
+  color:rgba(255,255,255,0.5);
30
+}
31
+.line1{
32
+  width:26rpx;
33
+  height:6rpx;
34
+  margin-top: 5rpx;
35
+}
36
+.line2{
37
+  background-color: #F1AB1E;
38
+}
39
+
40
+.right{
41
+  margin-right: 40rpx;
42
+}
43
+.btnTop{
44
+  width:70rpx;
45
+  height:70rpx;
46
+  border-radius: 50%;
47
+  background-color: rgba(0,0,0,0.1);
48
+  margin-left: 30rpx;
49
+}
50
+
51
+.universalpic_shelve_gray_26x26{
52
+  width:26rpx;
53
+  height:26rpx;
54
+}
55
+.universalpic_undo_gray_26x20{
56
+  width:26rpx;
57
+  height:20rpx;
58
+}
1 59
 
2 60
 /* 段落显示************************ */
3 61
 
@@ -228,3 +286,128 @@
228 286
 }
229 287
 
230 288
 /* ******************************** */
289
+
290
+
291
+.footerShade{
292
+  width: 100%;
293
+  position: fixed;
294
+  height:480rpx;
295
+  bottom: 0;
296
+  z-index: 1;
297
+}
298
+/* 底部记忆选择 */
299
+
300
+.footer{
301
+  width: 710rpx;
302
+  position: fixed;
303
+  bottom: 0;
304
+  z-index: 10;
305
+  border-top-left-radius: 20rpx;
306
+  border-top-right-radius: 20rpx;
307
+}
308
+
309
+.footerImage{
310
+  width:710rpx;
311
+  position: absolute;
312
+  bottom:0;
313
+  height:80rpx;
314
+  z-index: 10;
315
+}
316
+
317
+.panelFooter {
318
+  width: 710rpx;
319
+  margin-bottom: 20rpx;
320
+  background-color: #181a21;
321
+  border-radius: 20rpx;
322
+  color: #d2d2d2;
323
+  font-size: 48rpx;
324
+  text-align: center;
325
+  line-height: 140rpx;
326
+  z-index: 15;
327
+}
328
+
329
+.panelFooter0 {
330
+  line-height: 40rpx;
331
+}
332
+
333
+.panelBottomAnswer0 {
334
+  width: 100%;
335
+  height: 20rpx;
336
+  z-index: 10;
337
+}
338
+
339
+.panelBottomAnswer {
340
+  width: 100%;
341
+  font-size: 28rpx;
342
+  justify-content: space-between;
343
+  z-index: 10;
344
+  height: 140rpx;
345
+}
346
+
347
+.iphoneX {
348
+  width: 100%;
349
+  height: 60rpx;
350
+  z-index: 10;
351
+}
352
+
353
+.Answer {
354
+  flex: 1;
355
+  font-size: 28rpx;
356
+  justify-content: flex-start;
357
+  height: 140rpx;
358
+}
359
+
360
+.AnswerLeft{
361
+  border-top-left-radius: 20rpx;
362
+  border-bottom-left-radius: 20rpx;
363
+}
364
+
365
+.AnswerRight{
366
+  border-top-right-radius: 20rpx;
367
+  border-bottom-right-radius: 20rpx;
368
+}
369
+
370
+.AnswerHover{
371
+  background-color: #262935;
372
+}
373
+
374
+.Answer .btnColor {
375
+  height: 14rpx;
376
+  width: 75%;
377
+  border-radius: 4rpx;
378
+  margin-top: 16rpx;
379
+}
380
+
381
+.Answer .btnTime {
382
+  margin-top: 34rpx;
383
+}
384
+
385
+.Answer .Answer0 {
386
+  background-color: #fe6659;
387
+}
388
+
389
+.Answer .Answer1 {
390
+  background-color: #ffbc00;
391
+}
392
+
393
+.Answer .Answer1Recommend {
394
+  height: 50rpx;
395
+  border-bottom-left-radius: 0;
396
+  border-bottom-right-radius: 0;
397
+  margin-top: 16rpx;
398
+}
399
+
400
+.Answer .Answer2 {
401
+  background-color: #329468;
402
+}
403
+
404
+.Answer .Answer3 {
405
+  background-color: #0a60be;
406
+}
407
+
408
+.footer0 {
409
+  height: 180rpx;
410
+  width: 100%;
411
+  z-index: 1;
412
+}
413
+

+ 18 - 1
pages/test/list.js

@@ -35,14 +35,25 @@ Page({
35 35
         }
36 36
         that.setData({
37 37
           List:list,
38
+          UnitsID:id,
38 39
         });
39 40
       }
40 41
     }
41 42
 
42 43
   },
43
-  onShowFrame: function () {
44
+  onShowFrame: function (e) {
45
+    var selectID,selectName;
46
+    var id=e.currentTarget.dataset.id;
47
+    for(var i=0;i<this.data.List.length;i++){
48
+      if (id==this.data.List[i].ID){
49
+        selectID=id;
50
+        selectName = this.data.List[i].Name;
51
+      }
52
+    }
44 53
     this.setData({
45 54
       IsSelect: true,
55
+      SelectID:selectID,
56
+      SelectName:selectName,
46 57
     });
47 58
   },
48 59
   onClose: function () {
@@ -50,6 +61,12 @@ Page({
50 61
       IsSelect: false,
51 62
     });
52 63
   },
64
+  goto: function (e) {
65
+    var url = e.currentTarget.dataset.url;
66
+    wx.navigateTo({
67
+      url: url,
68
+    });
69
+  },
53 70
   onShareAppMessage: function () {
54 71
     return {
55 72
       title: app.globalData.ShareTitle,

+ 4 - 4
pages/test/list.wxml

@@ -35,19 +35,19 @@
35 35
 <view wx:if="{{IsSelect}}" class="SelectContainer FlexColumn" style='height:{{Containnerheight}}rpx;'>
36 36
   <view class="SelectContainer1 FlexColumn">
37 37
     <image src="../images/examine_subjecticon_01.png" class="examine_subjecticon_01" />
38
-    <view class="SelectContainer1Text1">识字 1-4</view>
38
+    <view class="SelectContainer1Text1">{{SelectName}}</view>
39 39
     <view class="SelectContainer1Text2">检验哪个方面</view>
40 40
     <view class="btnPanel FlexRow">
41
-      <view class="btn FlexRow">
41
+      <view class="btn FlexRow" bindtap="goto" data-url="./item?category=read&unitsid={{UnitsID}}&id={{SelectID}}">
42 42
         <image src="../images/examine_willread_gray_30x30.png" class="examine_willread_gray_30x30" />
43 43
         <view class="SelectContainer1Text3">会念</view>
44 44
       </view>
45
-      <view class="btn FlexRow">
45
+      <view class="btn FlexRow" bindtap="goto" data-url="./item?category=write&unitsid={{UnitsID}}&id={{SelectID}}">
46 46
         <image src="../images/examine_willwrite_gray_27x27.png" class="examine_willwrite_gray_27x27" />
47 47
         <view class="SelectContainer1Text3">会写</view>
48 48
       </view>
49 49
     </view>
50
-    <view class="btnPanel FlexRow">
50
+    <view class="btnPanel FlexRow" bindtap="goto" data-url="./wordlist?unitsid={{UnitsID}}&id={{SelectID}}">
51 51
       <image src="../images/universalpic_word_blue_30x30.png" class="universalpic_word_blue_30x30" />
52 52
       <view class="SelectContainer1Text4">查看字表</view>
53 53
     </view>

+ 22 - 0
pages/test/wordlist.js

@@ -12,6 +12,28 @@ Page({
12 12
     that.setData({
13 13
       Containnerheight: main.getWindowHeight(),
14 14
     });
15
+
16
+    var words=[];
17
+    var unitsName="";
18
+    var arr = wx.getStorageSync("HanziAll");
19
+    arr = JSON.parse(arr);
20
+    var unitsid = Number(options.unitsid);
21
+    var id = Number(options.id);
22
+    for (var i = 0; i < arr.length; i++) {
23
+      if (arr[i].ID == unitsid) {
24
+        var list = arr[i].Units;
25
+        for (var j = 0; j < list.length; j++) {
26
+          if (list[j].ID==id){
27
+            unitsName = list[j].Name;
28
+            words = list[j].Words;
29
+          }
30
+        }
31
+        that.setData({
32
+          UnitsName: unitsName,
33
+          Words: words,
34
+        });
35
+      }
36
+    }
15 37
   },
16 38
   onShareAppMessage: function () {
17 39
     return {

+ 5 - 4
pages/test/wordlist.wxml

@@ -1,13 +1,14 @@
1 1
 <view class="container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
2 2
   <view class="panelTop FlexRow">
3
-    <view class="text1">识字 1-5</view>
4
-    <view class="text2">38个字</view>
3
+    <view class="text1">{{UnitsName}}</view>
4
+    <view class="text2">{{Words.length}}个字</view>
5 5
   </view>
6 6
   <view class="panelMain FlexColumn">
7 7
     <view class="panelMain1 FlexRow">
8
-      <view class="item" wx:for="{{[1,1,1,1,1,1,1,1,1,1,11,1,1,1,1,1,1,1,1,11,1,1,1,1,1,1,1,1,11,1,1,1,1,1,1,1,1,1]}}" >
9
-      
8
+      <view class="item" wx:for="{{Words}}" wx:key="index" >
9
+      {{item.Name}}
10 10
       </view>
11 11
     </view>
12 12
   </view>
13
+  <view style="height:100rpx;"></view>
13 14
 </view>

+ 2 - 2
project.config.json

@@ -53,7 +53,7 @@
53 53
 			"list": []
54 54
 		},
55 55
 		"miniprogram": {
56
-			"current": -1,
56
+			"current": 7,
57 57
 			"list": [
58 58
 				{
59 59
 					"id": 0,
@@ -108,7 +108,7 @@
108 108
 					"id": 7,
109 109
 					"name": "pages/test/index",
110 110
 					"pathName": "pages/test/index",
111
-					"query": "",
111
+					"query": "id=1",
112 112
 					"scene": null
113 113
 				},
114 114
 				{