chengjie пре 7 година
родитељ
комит
729590dced

+ 1 - 0
app.json

@@ -7,6 +7,7 @@
7 7
     "pages/main/search",
8 8
     "pages/main/setcombine",
9 9
     "pages/main/review",
10
+    "pages/main/test",
10 11
     "pages/about/payfinished",
11 12
     "pages/about/paylist",
12 13
     "pages/about/newuserlist",

+ 5 - 0
pages/main/index.js

@@ -393,6 +393,11 @@ Page({
393 393
       url: '../about/orderlist',
394 394
     });
395 395
   },
396
+  gotoTest: function (e) {
397
+    wx.navigateTo({
398
+      url: '../main/test',
399
+    });
400
+  },
396 401
   switchProgram: function (e) {
397 402
     wx.navigateToMiniProgram({
398 403
       appId: e.currentTarget.dataset.appid,

+ 3 - 0
pages/main/index.wxml

@@ -122,6 +122,9 @@
122 122
           <view class="ReviewCount">{{ReviewCount}}</view>
123 123
         </view>
124 124
       </view>
125
+      <view class="btn8 btn6 btn" wx:if="{{FinishedCount>0}}" bindtap="gotoTest">
126
+        <view class="btn7 btn1">测试</view>
127
+      </view>
125 128
 
126 129
       <button class="Circle FlexColumn" open-type="share">
127 130
         <image src='../../images/02015.png' class="Share" />

+ 1 - 1
pages/main/list.wxml

@@ -61,9 +61,9 @@
61 61
     <view class="line4 line">
62 62
     </view>
63 63
   </block>
64
+  <image src='../../images/02004.gif' class="hand" wx:if="{{IsRemind}}" />
64 65
 
65 66
 </view>
66
-<image src='../../images/02004.gif' class="hand" wx:if="{{IsRemind}}" />
67 67
   
68 68
 <view class="PayInfo container FlexColumn" style='height:{{Height}}rpx;' wx:if="{{IsShowPayInfo}}">
69 69
   <view class="btn">

+ 1 - 1
pages/main/list.wxss

@@ -261,7 +261,7 @@
261 261
 .hand{
262 262
   width:60rpx;
263 263
   height:90rpx;
264
-  position: fixed;
264
+  position: absolute;
265 265
   right:158rpx;
266 266
   top:405rpx;
267 267
   z-index: 100;

+ 7 - 0
pages/main/review.js

@@ -71,4 +71,11 @@ Page({
71 71
       }
72 72
     });
73 73
   },
74
+  onShareAppMessage: function () {
75
+    return {
76
+      title: app.globalData.ShareTitle,
77
+      path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
78
+      imageUrl: '../../images/07001.png',
79
+    }
80
+  },
74 81
 });

+ 130 - 0
pages/main/test.js

@@ -0,0 +1,130 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+import pinyin from '../../utils/pinyin';
4
+
5
+const app = getApp();
6
+var currentIndex=0;
7
+var isRight=false;
8
+
9
+Page({
10
+  data: {
11
+    List:[
12
+      {
13
+        Name:"程",
14
+        Pinyin:"cheng2",
15
+        AnswerList: [
16
+          {
17
+            pinyin: "cen2",
18
+          }, {
19
+            pinyin: "chen2",
20
+          }, {
21
+            pinyin: "ceng2",
22
+          }, {
23
+            pinyin: "cheng2",
24
+          },
25
+        ]
26
+      },
27
+      {
28
+        Name: "杰",
29
+        Pinyin: "jie2",
30
+        AnswerList: [
31
+          {
32
+            pinyin: "ji2",
33
+          }, {
34
+            pinyin: "jie2",
35
+          }, {
36
+            pinyin: "xie2",
37
+          }, {
38
+            pinyin: "qie2",
39
+          },
40
+        ]
41
+      }
42
+    ]
43
+    
44
+  },
45
+  onLoad: function (options) {
46
+    this.setData({
47
+      Height: common.getSystemHeight(),
48
+    });
49
+    this.getList();
50
+    this.audioCtx = wx.createAudioContext('myAudio');
51
+
52
+  },
53
+  getList: function () {
54
+    isRight=false;
55
+    var pinyinList = pinyin.getPinyinArray();
56
+    var item = this.data.List[currentIndex];
57
+    var list = item.AnswerList;
58
+    for (var i = 0; i < list.length; i++) {
59
+      for (var j = 0; j < pinyinList.length; j++) {
60
+        if (list[i].pinyin == pinyinList[j][0]) {
61
+          list[i].Pinyin = pinyinList[j][1];
62
+          list[i].Name = pinyinList[j][2][0];
63
+          break;
64
+        }
65
+      }
66
+      if (item.Pinyin==list[i].pinyin)
67
+        list[i].IsResult=true;
68
+      else
69
+        list[i].IsResult=false;
70
+    }
71
+    this.setData({
72
+      CurrentItem: item,
73
+    });
74
+  },
75
+  selectedHanzi: function (e) {
76
+    var id = e.currentTarget.dataset.id;
77
+    var list = this.data.CurrentItem.AnswerList;
78
+    for (var i = 0; i < list.length; i++) {
79
+      list[i].IsSelected = false;
80
+    }
81
+    list[id].IsSelected = true;
82
+    if (list[id].IsResult)
83
+      isRight=true;
84
+    this.data.CurrentItem.AnswerList=list;
85
+    this.playAudio(list[id].Pinyin, list[id].Name);
86
+
87
+    this.setData({
88
+      CurrentItem: this.data.CurrentItem,
89
+    });
90
+  },
91
+  playAudio: function (pinyin,name) {
92
+
93
+    var url = app.globalData.audioUrlBaidu;
94
+    url = url.replace("[token]", app.globalData.BaiduToken);
95
+    url = url.replace("[word]", name+"("+pinyin+")");
96
+
97
+    url = encodeURI(url);
98
+    this.audioCtx.setSrc(url);
99
+    this.audioCtx.play();
100
+  },
101
+  gotoOK:function(){
102
+    var that=this;
103
+
104
+    var title="错误";
105
+    var icon="none";
106
+    if (isRight){
107
+      title="正确";
108
+      icon ="success";
109
+    }
110
+    wx.showToast({
111
+      title: title,
112
+      icon: icon,
113
+      duration:1000,
114
+      complete:function(){
115
+        currentIndex++;
116
+        if (currentIndex >= that.data.List.length)
117
+          currentIndex = 0;
118
+        that.getList();
119
+      }
120
+    })
121
+    
122
+  },
123
+  onShareAppMessage: function () {
124
+    return {
125
+      title: app.globalData.ShareTitle,
126
+      path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
127
+      imageUrl: '../../images/07001.png',
128
+    }
129
+  },
130
+});

+ 6 - 0
pages/main/test.json

@@ -0,0 +1,6 @@
1
+{
2
+  "navigationBarBackgroundColor": "#F5E2BE",
3
+  "navigationBarTitleText": "测试",
4
+  "backgroundColor": "#f0f0f0",
5
+  "enablePullDownRefresh": false
6
+}

+ 17 - 0
pages/main/test.wxml

@@ -0,0 +1,17 @@
1
+<view class="container FlexColumn" style='min-height:{{Height}}rpx;'>
2
+  <image src='https://hanzi-1253256735.file.myqcloud.com/images/hanzi{{CurrentItem.Name}}.jpg' class="wordImage" />
3
+
4
+  <view class="panelTop FlexRow">
5
+    <view class="title">选择正确的汉字发音</view>
6
+  </view>
7
+  <view class="panel FlexRow" wx:for="{{CurrentItem.AnswerList}}" wx:key="index" bindtap='selectedHanzi' data-id="{{index}}">
8
+    <view wx:if="{{!item.IsSelected}}" class="universalpic_select_on_black"></view>
9
+    <image src='../../images/SelectYes.png' wx:if="{{item.IsSelected}}" class="universalpic_select_on_black" />
10
+    <view class="Number">{{index+1}}.</view>
11
+    
12
+    <view class="Name">{{item.Pinyin}}</view>
13
+  </view>
14
+  <view class="bottom" bindtap='gotoOK' data-id="0">确认</view>
15
+
16
+</view>
17
+<audio hidden='true' id="myAudio"></audio>

+ 57 - 0
pages/main/test.wxss

@@ -0,0 +1,57 @@
1
+.container {
2
+  background-color: #f0f0f0;
3
+  justify-content: flex-start;
4
+  font-weight: 400;
5
+}
6
+
7
+.wordImage{
8
+  width:366rpx;
9
+  height:370rpx;
10
+  margin-top: 100rpx;
11
+}
12
+
13
+
14
+.panelTop{
15
+  width:100%;
16
+  justify-content: flex-start;
17
+  height:100rpx;
18
+}
19
+
20
+.title{
21
+  margin: 50rpx 0 30rpx 30rpx;
22
+  font-size:24rpx;
23
+}
24
+
25
+.panel{
26
+  width:100%;
27
+  justify-content: flex-start;
28
+  background-color: #fff;
29
+  margin-bottom: 1rpx;
30
+  height:100rpx;
31
+}
32
+
33
+.Number{
34
+  margin-left: 30rpx;
35
+  font-size:24rpx;
36
+}
37
+.Name{
38
+  margin-left: 30rpx;
39
+  font-size:28rpx;
40
+}
41
+
42
+.universalpic_select_on_black{
43
+  width:30rpx;
44
+  height:30rpx;
45
+  margin-left: 30rpx;
46
+}
47
+
48
+.bottom{
49
+  position: fixed;
50
+  bottom:0;
51
+  font-size:48rpx;
52
+  color:#fff;
53
+  background-color: #FF7245;
54
+  text-align: center;
55
+  line-height: 120rpx;
56
+  width: 100%;
57
+}

+ 3 - 44
project.config.json

@@ -30,7 +30,7 @@
30 30
 			"list": []
31 31
 		},
32 32
 		"miniprogram": {
33
-			"current": 12,
33
+			"current": 5,
34 34
 			"list": [
35 35
 				{
36 36
 					"id": -1,
@@ -56,42 +56,6 @@
56 56
 					"pathName": "pages/main/search",
57 57
 					"query": ""
58 58
 				},
59
-				{
60
-					"id": 4,
61
-					"name": "\b订单",
62
-					"pathName": "pages/about/orderlist",
63
-					"query": ""
64
-				},
65
-				{
66
-					"id": 5,
67
-					"name": "\b支付完成",
68
-					"pathName": "pages/about/payfinished",
69
-					"query": "type=all"
70
-				},
71
-				{
72
-					"id": -1,
73
-					"name": "会员中心",
74
-					"pathName": "pages/about/membercenter",
75
-					"query": ""
76
-				},
77
-				{
78
-					"id": -1,
79
-					"name": "购买列表",
80
-					"pathName": "pages/about/paylist",
81
-					"query": ""
82
-				},
83
-				{
84
-					"id": 8,
85
-					"name": "\b激活",
86
-					"pathName": "pages/index/index",
87
-					"query": "SourceID=106&ProductBuyInfoID=3306&ProductID=106&ProductUserID=1&BuyType=109"
88
-				},
89
-				{
90
-					"id": -1,
91
-					"name": "新用户",
92
-					"pathName": "pages/about/newuserlist",
93
-					"query": ""
94
-				},
95 59
 				{
96 60
 					"id": -1,
97 61
 					"name": "复习",
@@ -100,14 +64,9 @@
100 64
 				},
101 65
 				{
102 66
 					"id": -1,
103
-					"name": "复习",
104
-					"pathName": "pages/main/index",
67
+					"name": "\b测试",
68
+					"pathName": "pages/main/test",
105 69
 					"query": ""
106
-				},
107
-				{
108
-					"id": -1,
109
-					"name": "复习",
110
-					"pathName": "pages/main/review"
111 70
 				}
112 71
 			]
113 72
 		}