chengjie hace 6 años
padre
commit
92104622c0

+ 3 - 1
app.js

@@ -11,12 +11,13 @@ App({
11 11
     this.globalData.systemInfo = wx.getSystemInfoSync();
12 12
   },
13 13
   globalData: {
14
-    Version: "1.2.0",
14
+    Version: "1.2.1",
15 15
     IsProduction: true,
16 16
     ProgramID: 106,
17 17
     AppID: "wx313a8f2c0741efe1",
18 18
     ProgramName: "语文识字",
19 19
     ShareTitle:"赢在阅读起跑线",
20
+    SharePath: "pages/index/index",
20 21
     ShareImage: "../../pages/images/07001.png",
21 22
     userInfo: null,
22 23
     fileUrl: "https://www.kylx365.com/",
@@ -39,5 +40,6 @@ App({
39 40
     NewUserNumberMax:6,//邀请新用户最大值
40 41
     IsSaveCustom:false,//是否保存了定制
41 42
     goto:"",//用于服务直达的跳转
43
+    IsRefresh: false,
42 44
   }
43 45
 })

+ 39 - 16
package4/main/activate.js

@@ -2,7 +2,7 @@ import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5
-var productList=[];
5
+var productList = [];
6 6
 
7 7
 Page({
8 8
   data: {
@@ -16,6 +16,9 @@ Page({
16 16
 
17 17
     this.init();
18 18
   },
19
+  onUnload:function(){
20
+    productList=[];
21
+  },
19 22
   init: function (e, isRemind) {
20 23
     var that = this;
21 24
     wx.showLoading({
@@ -31,21 +34,25 @@ Page({
31 34
               data[j].ImageUrl = programList[i].ImageUrl;
32 35
               data[j].appId = programList[i].appId;
33 36
               data[j].path = programList[i].path;
37
+              //不是当前小程序不解锁
38
+              if (app.globalData.ProgramID == data[j].ProductID)
39
+                app.globalData.userInfo.IsMember = 1;
34 40
             }
35 41
           }
36 42
         }
37 43
 
38
-        if (productList.length>0){
39
-          for(var i=0;i<productList.length;i++){
40
-            var b=false;
41
-            for(var j=0;j<data.length;j++){
42
-              if (productList[i].ProductID == data[j].ProductID){
43
-                b=true;
44
+        if (productList.length > 0) {
45
+          for (var i = 0; i < productList.length; i++) {
46
+            var b = false;
47
+            for (var j = 0; j < data.length; j++) {
48
+              if (productList[i].ProductID == data[j].ProductID) {
49
+                b = true;
50
+                
44 51
                 break;
45 52
               }
46 53
             }
47
-            if (!b){
48
-              productList[i].IsActivate=1;
54
+            if (!b) {
55
+              productList[i].IsActivate = 1;
49 56
               data.push(productList[i]);
50 57
             }
51 58
           }
@@ -55,9 +62,7 @@ Page({
55 62
           List: data,
56 63
         });
57 64
 
58
-        productList=data;
59
-
60
-        wx.hideLoading();
65
+        productList = data;
61 66
 
62 67
         if (isRemind) {
63 68
           wx.showModal({
@@ -69,13 +74,31 @@ Page({
69 74
         }
70 75
 
71 76
         wx.setStorageSync("HasActivate", 1);
77
+        wx.hideLoading();
72 78
       }
73 79
       else {
74
-        wx.redirectTo({
75
-          url: "./activateFinish",
76
-        });
77
-        wx.removeStorageSync("HasActivate");
80
+        if (isRemind) {
81
+          var arr = [];
82
+          for (var i = 0; i < productList.length; i++) {
83
+            arr.push(productList[i].ProductID);
84
+          }
85
+          wx.redirectTo({
86
+            url: "./activateFinish?idarr="+arr.join(","),
87
+          });
88
+          productList = [];
89
+          wx.removeStorageSync("HasActivate");
90
+        }
91
+        else{
92
+          for (var i = 0; i < productList.length; i++) {
93
+            productList[i].IsActivate = 1;
94
+          }
95
+          that.setData({
96
+            List: productList,
97
+          });
98
+        }
78 99
       }
100
+      wx.hideLoading();
101
+
79 102
     });
80 103
   },
81 104
   gotoFeedback: function () {

+ 16 - 1
package4/main/activateFinish.js

@@ -7,10 +7,20 @@ Page({
7 7
   data: {
8 8
   },
9 9
   onLoad: function (options) {
10
+    var idarr=options.idarr.split(",");
11
+    var list = server.getProgramList();
12
+    var arr=[];
13
+    for(var i=0;i<list.length;i++){
14
+      for(var j=0;j<idarr.length;j++){
15
+        if (idarr[j]==list[i].ID){
16
+          arr.push(list[i]);
17
+        }
18
+      }
19
+    }
10 20
 
11 21
     this.setData({
12 22
       Containnerheight: common.getSystemHeight(),
13
-      ProgramList: server.getProgramList(),
23
+      ProgramList: arr,
14 24
       ProgramID:app.globalData.ProgramID,
15 25
     });
16 26
   },
@@ -25,6 +35,11 @@ Page({
25 35
       }
26 36
     });
27 37
   },
38
+  gotoFinish: function () {
39
+    wx.reLaunch({
40
+      url: '../../pages/index/index',
41
+    });
42
+  },
28 43
   onShareAppMessage: function () {
29 44
     return {
30 45
       title: app.globalData.ShareTitle,

+ 4 - 2
package4/main/activateFinish.wxml

@@ -23,6 +23,8 @@
23 23
       <view class='btnRefresh' wx:if="{{ProgramID!=item.ID}}">去使用</view>
24 24
     </view>
25 25
   </view>
26
-<view class='lineFooter'></view>
27
-
26
+  <view class='lineFooter'></view>
27
+  <view class='footer FlexRow' bindtap="gotoFinish">
28
+    前往首页
29
+  </view>
28 30
 </view>

+ 13 - 1
package4/main/activateFinish.wxss

@@ -63,4 +63,16 @@
63 63
   font-size:24rpx;
64 64
   text-align: center;
65 65
   line-height: 50rpx;
66
-}
66
+}
67
+
68
+.footer{
69
+  width: 100%;
70
+  height: 140rpx;
71
+  position: fixed;
72
+  bottom: 0;
73
+  line-height: 140rpx;
74
+  font-size:48rpx;
75
+  color:#fff;
76
+  text-align: center;
77
+  background-color: #03AF69;
78
+}

+ 6 - 0
package4/main/activateOK.js

@@ -5,6 +5,7 @@ const app = getApp();
5 5
 
6 6
 Page({
7 7
   data: {
8
+    ShowNumber:0,
8 9
   },
9 10
   onLoad: function (options) {
10 11
 
@@ -13,6 +14,11 @@ Page({
13 14
     });
14 15
     this.updateData(options);
15 16
   },
17
+  onShow: function(){
18
+    this.setData({
19
+      ShowNumber:this.data.ShowNumber,
20
+    })
21
+  },
16 22
   updateData: function (param) {
17 23
     var that = this;
18 24
     server.getData('UpdateWXUsersAll500?ProductID=' + param.ProductID

+ 4 - 4
package4/main/buyad.js

@@ -24,17 +24,17 @@ Page({
24 24
     }
25 25
   },
26 26
   gotoOrder: function () {
27
-    wx.navigateTo({
28
-      url: "./order?id="+app.globalData.ProgramID+"&paytype=3",
27
+    wx.redirectTo({
28
+      url: "./order?id=" + app.globalData.ProgramID + "&paytype=3",
29 29
     });
30 30
   },
31 31
   gotoPackList: function () {
32
-    wx.navigateTo({
32
+    wx.redirectTo({
33 33
       url: "./list?IsGift=0",
34 34
     });
35 35
   },
36 36
   gotoGiftList: function () {
37
-    wx.navigateTo({
37
+    wx.redirectTo({
38 38
       url: "./list?IsGift=1",
39 39
     });
40 40
   },

+ 1 - 1
package4/main/giftinfo.js

@@ -36,7 +36,7 @@ Page({
36 36
       success(res) {
37 37
         if (!res.authSetting['scope.userInfo']) {
38 38
           wx.navigateTo({
39
-            url: '../../pages/index/userlogin?url=giftinfo'
39
+            url: '../../pages/main/accredit?url=giftinfo'
40 40
           });
41 41
         }
42 42
         else {

+ 13 - 1
package4/main/limited.js

@@ -6,14 +6,21 @@ const app = getApp();
6 6
 Page({
7 7
   data: {
8 8
     FileUrl: app.globalData.imageUrl,
9
+    IsShowButton:0,
9 10
   },
10 11
   onLoad: function (options) {
11
-
12
+    var IsShowButton = 0;
13
+    if (options.IsShowButton)
14
+      IsShowButton=options.IsShowButton;
12 15
     this.setData({
13 16
       Containnerheight: common.getSystemHeight(),
17
+      IsShowButton: IsShowButton
14 18
     });
15 19
     this.init();
16 20
   },
21
+  onUnload: function () {
22
+    app.globalData.IsRefresh=true;
23
+  },
17 24
   init: function () {
18 25
     var that = this;
19 26
     server.getData('GetWXUsersAllTime?ProductID=' + app.globalData.ProgramID + '&UserID=' + app.globalData.userInfo.UserID, function (data) {
@@ -34,6 +41,11 @@ Page({
34 41
   gotoFeedback: function () {
35 42
     server.gotoFeedback();
36 43
   },
44
+  gotoFinish:function(){
45
+    wx.reLaunch({
46
+      url: '../../pages/index/index',
47
+    });
48
+  },
37 49
   onShareAppMessage: function () {
38 50
     return {
39 51
       title: app.globalData.ShareTitle,

+ 3 - 1
package4/main/limited.wxml

@@ -15,7 +15,9 @@
15 15
     </view>
16 16
   </view>
17 17
   <view class='lineFooter'></view>
18
-
18
+  <view class='footer FlexRow' bindtap="gotoFinish" wx:if="{{IsShowButton==1}}">
19
+    前往首页
20
+  </view>
19 21
 
20 22
   <view class='panelFooter FlexRow' bindtap='gotoFeedback'>
21 23
     <view>如遇问题,请切换到“唱意教育家长助手”中</view>

+ 14 - 1
package4/main/limited.wxss

@@ -72,4 +72,17 @@
72 72
   color:#B3443B;
73 73
   text-decoration: underline;
74 74
   font-weight: 500;
75
-}
75
+}
76
+
77
+
78
+.footer{
79
+  width: 100%;
80
+  height: 140rpx;
81
+  position: fixed;
82
+  bottom: 0;
83
+  line-height: 140rpx;
84
+  font-size:48rpx;
85
+  color:#fff;
86
+  text-align: center;
87
+  background-color: #03AF69;
88
+}

+ 5 - 6
package4/main/order.js

@@ -50,9 +50,9 @@ Page({
50 50
         if (this.data.Coupon){
51 51
           price=price-Number(this.data.Coupon.Price);
52 52
         }
53
-        if (price.toString().indexOf(".") < 0) {
54
-          price = price + ".00";
55
-        }
53
+        
54
+        price = common.FormatMoney(price*100);
55
+
56 56
         detail = list[i].Detail;
57 57
         if (i==0)
58 58
           buytype=110;
@@ -104,9 +104,8 @@ Page({
104 104
         if (this.data.Coupon)
105 105
           price+=Number(this.data.Coupon.Price);
106 106
 
107
-        if (price.toString().indexOf(".")<0){
108
-          price=price+".00";
109
-        }
107
+        price = common.FormatMoney(price * 100);
108
+
110 109
         this.setData({
111 110
           IsDiscount: false,
112 111
           Coupon: list[i],

+ 5 - 4
package4/main/payfinish.js

@@ -22,14 +22,15 @@ Page({
22 22
 
23 23
     if (paytype == "4") {
24 24
       wx.setStorageSync("HasActivate", 1);
25
-      app.globalData.userInfo.IsMember = 1;
26
-      app.globalData.IsLocked = 0;
27 25
     }
28 26
     else if (paytype=="3"){
29 27
       app.globalData.userInfo.IsMember = 1;
30
-      app.globalData.IsLocked = 0;
31 28
     }
32 29
   }, 
30
+  onUnload: function () {
31
+    if (this.data.Paytype == "4") 
32
+      app.globalData.IsRefresh = true;
33
+  },
33 34
   gotoDefault: function() {
34 35
     wx.redirectTo({
35 36
       url: "../../pages/main/default",
@@ -38,7 +39,7 @@ Page({
38 39
   goto: function () {
39 40
     if (this.data.Paytype == "3") {
40 41
       wx.redirectTo({
41
-        url: "./limited",
42
+        url: "./limited?IsShowButton=1",
42 43
       });
43 44
     }
44 45
     if (this.data.Paytype == "4") {

+ 12 - 1
pages/index/index.js

@@ -42,6 +42,11 @@ Page({
42 42
           ProductUserID: options.ProductUserID,
43 43
         });
44 44
       }
45
+      if (options.GiftID) {
46
+        this.setData({
47
+          GiftID: options.GiftID,
48
+        });
49
+      }
45 50
     }
46 51
     this.setData({
47 52
       Height: common.getSystemHeight(),
@@ -170,7 +175,13 @@ Page({
170 175
 
171 176
           app.globalData.IsLocked = data.IsLocked;
172 177
           
173
-          if (that.data.ProductID) {
178
+          if (that.data.GiftID) {
179
+            var url = "../../package4/main/giftcard?GiftID=" + that.data.GiftID + "&UserID=" + app.globalData.introducer
180
+            wx.redirectTo({
181
+              url: url
182
+            });
183
+          }
184
+          else if (that.data.ProductID) {
174 185
             var url = "../../package4/main/activateOK?ProductID=" + that.data.ProductID
175 186
               + "&ProductUserID=" + that.data.ProductUserID
176 187
               + "&CurrentUserID=" + app.globalData.userInfo.UserID

+ 17 - 41
pages/main/accredit.js

@@ -33,16 +33,6 @@ Page({
33 33
       }
34 34
     }
35 35
   },
36
-  onUnload: function () {
37
-    wx.reLaunch({
38
-      url: '../main/index'
39
-    });
40
-  },
41
-  deblocking: function () {
42
-    wx.reLaunch({
43
-      url: '../index/index'
44
-    });
45
-  },
46 36
   goto: function (e) {
47 37
     var that = this;
48 38
     wx.getSetting({
@@ -78,40 +68,26 @@ Page({
78 68
         wx.getUserInfo({
79 69
           withCredentials: true,
80 70
           success: function (res) {
81
-            var userID = app.globalData.userInfo.UserID;
82
-            app.globalData.userInfo = res.userInfo;
83
-            app.globalData.userInfo.UserID = userID;
84
-
85
-            app.globalData.userInfo.NickName = app.globalData.userInfo.nickName;
86
-            app.globalData.userInfo.AvatarUrl = app.globalData.userInfo.avatarUrl;
87
-
88
-            // that.hasGetShareInfo(app.globalData.userInfo);
89
-            that.setData({
90
-              IsAccredit: true,
91
-              NickName: app.globalData.userInfo.NickName,
92
-              AvatarUrl: app.globalData.userInfo.AvatarUrl
93
-            });
94
-
95 71
             app.globalData.userInfo.Code = res0.code;
96 72
             app.globalData.userInfo.iv = res.iv;
97 73
             app.globalData.userInfo.encryptedData = res.encryptedData;
98
-            that.login(app.globalData.userInfo);
74
+
75
+            app.globalData.userInfo.NickName = res.userInfo.nickName;
76
+            app.globalData.userInfo.AvatarUrl = res.userInfo.avatarUrl;
77
+
78
+            that.login(app.globalData.userInfo, res.userInfo);
99 79
           },
100 80
           fail: function (res) {
101
-            wx.reLaunch({
102
-              url: '../index/index'
103
-            });
81
+
104 82
           }
105 83
         });
106 84
       },
107 85
       fail: function () {
108
-        wx.reLaunch({
109
-          url: '../index/index'
110
-        });
86
+
111 87
       }
112 88
     });
113 89
   },
114
-  login: function (param) {
90
+  login: function (param, param2) {
115 91
     var that = this;
116 92
     var url = "Login";
117 93
     switch (app.globalData.ProgramID) {
@@ -133,13 +109,13 @@ Page({
133 109
     }
134 110
     server.postData(url, {
135 111
       Code: param.Code,
136
-      NickName: param.nickName,
137
-      Language: param.language,
138
-      Gender: param.gender,
139
-      City: param.city,
140
-      Province: param.province,
141
-      Country: param.country,
142
-      AvatarUrl: param.avatarUrl,
112
+      NickName: param2.nickName,
113
+      AvatarUrl: param2.avatarUrl,
114
+      Language: param2.language,
115
+      Gender: param2.gender,
116
+      City: param2.city,
117
+      Province: param2.province,
118
+      Country: param2.country,
143 119
       ProgramVersion: app.globalData.Version,
144 120
       Introducer: app.globalData.introducer,
145 121
       UserSource: app.globalData.userSource,
@@ -148,8 +124,8 @@ Page({
148 124
       iv: param.iv,
149 125
       encryptedData: param.encryptedData,
150 126
     }, function (data) {
151
-      wx.reLaunch({
152
-        url: '../main/index'
127
+      wx.navigateBack({
128
+        delta: 1
153 129
       });
154 130
     });
155 131
   },

+ 1 - 1
pages/main/detail.js

@@ -368,7 +368,7 @@ Page({
368 368
           else {
369 369
             var CombineWords = this.data.List[this.data.CurrentIndex].CombineWords;
370 370
             if (CombineWords)
371
-              CombineWords = "," + CombineWords.replace(Name, Name + pinyinStr) + "的" + Name;
371
+              CombineWords = "," + CombineWords.replace(Name, Name + pinyinStr) + "的(de5)" + Name;
372 372
 
373 373
             url = url.replace("[word]", Name + pinyinStr + CombineWords + pinyinStr);
374 374
           }

+ 7 - 4
pages/main/index.js

@@ -11,7 +11,7 @@ Page({
11 11
     Version: app.globalData.Version,
12 12
     ListProgram: server.getProgramListOld(),
13 13
     NickName: "陌生用户",
14
-    IsMember: 0,
14
+    IsMember: 1,
15 15
     NewUserNumber: 2,
16 16
     AvatarUrl: "",
17 17
     DayNumber: "0",
@@ -31,9 +31,6 @@ Page({
31 31
       Height: common.getSystemHeight(),
32 32
       NickName: app.globalData.userInfo.NickName,
33 33
       AvatarUrl: app.globalData.userInfo.AvatarUrl,
34
-      IsLocked: app.globalData.IsLocked,
35
-      IsShow: app.globalData.IsShow,
36
-      IsMember: app.globalData.userInfo.IsMember
37 34
     });
38 35
 
39 36
     var that = this;
@@ -55,6 +52,12 @@ Page({
55 52
     common.getStorageValue(this, "IsRemind", true, function () { });
56 53
   },
57 54
   onShow: function () {
55
+    this.setData({
56
+      IsLocked: app.globalData.IsLocked,
57
+      IsShow: app.globalData.IsShow,
58
+      IsMember: app.globalData.userInfo.IsMember
59
+    });
60
+
58 61
     if (wx.getStorageSync("HasActivate") == 1) {
59 62
       wx.navigateTo({
60 63
         url: '../../package4/main/activate',

+ 11 - 7
pages/main/list.js

@@ -17,11 +17,19 @@ Page({
17 17
       BookID: bookID,
18 18
       IsShow: app.globalData.IsShow,
19 19
     });
20
-
21 20
     common.getStorageValue(this, "IsRemind", true, function () { });
22
-
23 21
   },
24 22
   onShow: function () {
23
+    if (app.globalData.IsRefresh) {
24
+      wx.showLoading({
25
+        title: '请稍候',
26
+        mask: true,
27
+      });
28
+      setTimeout(function () {
29
+        wx.hideLoading();
30
+      }, 3000);
31
+      app.globalData.IsRefresh = false;
32
+    }
25 33
     this.init();
26 34
   },
27 35
   init: function () {
@@ -37,11 +45,7 @@ Page({
37 45
           var item = result.Units[j];
38 46
           if (app.globalData.userInfo.IsMember == 1)
39 47
             item.IsLocked = 0;
40
-          // var rnd = common.random(2, 5);
41
-          // item.Example = "";
42
-          // for (var k = 0; k < rnd; k++)
43
-          //   item.Example += item.Words[k].Name;
44
-
48
+          
45 49
           item.IsFinished = false;
46 50
           for (var k = 0; k < arrFinished.length; k++) {
47 51
             if (item.ID == arrFinished[k].UnitID) {

+ 1 - 1
project.config.json

@@ -1,7 +1,7 @@
1 1
 {
2 2
 	"description": "项目配置文件。",
3 3
 	"setting": {
4
-		"urlCheck": true,
4
+		"urlCheck": false,
5 5
 		"es6": true,
6 6
 		"postcss": true,
7 7
 		"minified": true,

+ 0 - 2
utils/main.js

@@ -87,8 +87,6 @@ function payMoney(payType, buyType, money, detail, callback) {
87 87
               'signType': 'MD5',
88 88
               'paySign': data.paySign,
89 89
               'success': function (res3) {
90
-                app.globalData.userInfo.IsMember = 1;
91
-                app.globalData.userInfo.IsPay = 1;
92 90
                 console.log("success:" + res3);
93 91
                 callback(data);
94 92
               },

+ 21 - 1
utils/util.js

@@ -375,6 +375,25 @@ function isChinese(temp) {
375 375
     return reg.test(temp);     /*进行验证*/
376 376
 }
377 377
 
378
+function FormatMoney(money) {
379
+  var result;
380
+  if (money == 0)
381
+    result = "0.00";
382
+  else {
383
+    result = (Math.round(money) / 100).toString();
384
+    //console.log("1:"+result);
385
+    if (result.indexOf(".") >= 0) {
386
+      if (result.substr(result.indexOf(".")).length < 3)
387
+        result += "0";
388
+    }
389
+    else {
390
+      result += ".00";
391
+    }
392
+  }
393
+
394
+  return result;
395
+}
396
+
378 397
 module.exports = {
379 398
   formatTime: formatTime,
380 399
   formatDateCHS: formatDateCHS,
@@ -396,5 +415,6 @@ module.exports = {
396 415
   getWordArray: getWordArray,
397 416
   sortArrayByStringLength: sortArrayByStringLength,
398 417
   ReplaceAllString: ReplaceAllString,
399
-  IsChinese: isChinese
418
+  IsChinese: isChinese,
419
+  FormatMoney: FormatMoney,
400 420
 }