chengjie 6 年之前
父节点
当前提交
f5ae695f3b

+ 2 - 1
app.js

@@ -23,7 +23,7 @@ App({
23
     }
23
     }
24
   },
24
   },
25
   globalData: {
25
   globalData: {
26
-    Version: "1.2.8",
26
+    Version: "1.2.9",
27
     IsProduction: true,
27
     IsProduction: true,
28
     ProgramID: 106,
28
     ProgramID: 106,
29
     AppID: "wx313a8f2c0741efe1",
29
     AppID: "wx313a8f2c0741efe1",
@@ -39,6 +39,7 @@ App({
39
     imageUrl: "https://hanzi-1253256735.file.myqcloud.com",
39
     imageUrl: "https://hanzi-1253256735.file.myqcloud.com",
40
     audioUrl: "https://pinyin.kylx365.com",
40
     audioUrl: "https://pinyin.kylx365.com",
41
     audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
41
     audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
42
+    uploadImageUrl: "https://miaguo-1253256735.file.myqcloud.com/",
42
     Key: "kylx365_chengjie",
43
     Key: "kylx365_chengjie",
43
     IV: "kylx365hongliren",
44
     IV: "kylx365hongliren",
44
     systemInfo: null,
45
     systemInfo: null,

+ 2 - 0
app.json

@@ -16,6 +16,7 @@
16
     "navigationBarBackgroundColor": "#F5E2BE",
16
     "navigationBarBackgroundColor": "#F5E2BE",
17
     "navigationBarTitleText": "语文识字",
17
     "navigationBarTitleText": "语文识字",
18
     "navigationBarTextStyle": "black",
18
     "navigationBarTextStyle": "black",
19
+    "resizable": false,
19
     "backgroundColor": "#F5E2BE"
20
     "backgroundColor": "#F5E2BE"
20
   },
21
   },
21
   "navigateToMiniProgramAppIdList": [
22
   "navigateToMiniProgramAppIdList": [
@@ -48,6 +49,7 @@
48
         "main/limited",
49
         "main/limited",
49
         "main/invite",
50
         "main/invite",
50
         "main/share",
51
         "main/share",
52
+        "main/newuser",
51
         "main/list"
53
         "main/list"
52
       ]
54
       ]
53
     }
55
     }

+ 59 - 0
package4/main/newuser.js

@@ -0,0 +1,59 @@
1
+import common from '../../utils/util';
2
+import main from '../../utils/main';
3
+
4
+var app = getApp();
5
+
6
+Page({
7
+  data: {
8
+    PanelShow: 0,
9
+    ImagePath: app.globalData.uploadImageUrl,
10
+  },
11
+  onLoad: function (options) {
12
+    var that = this;
13
+    that.setData({
14
+      Containnerheight: common.getSystemHeight(),
15
+    });
16
+    that.init();
17
+
18
+    wx.setNavigationBarColor({
19
+      frontColor: "#ffffff",
20
+      backgroundColor: "#9BD41C",
21
+    });
22
+
23
+  },
24
+  init: function () {
25
+    var that = this;
26
+    main.getData("GetClassList?Flag=0", function (data) {
27
+      if (data && data.length>0) {
28
+        that.setData({
29
+          StartDate: common.formatDateCHS(data[0].StartDate),
30
+        })
31
+      }
32
+    });
33
+  },
34
+  gotoPanel2:function(){
35
+      this.setData({
36
+        PanelShow:1,
37
+      })
38
+  },
39
+  copyManager: function () {
40
+    wx.setClipboardData({
41
+      data: "秒过学习法",
42
+      success(res) {
43
+        wx.showModal({
44
+          title: '已复制',
45
+          showCancel: false,
46
+          content: "请在微信添加公众号中长按粘贴。",
47
+          confirmText: "知道了",
48
+        });
49
+      }
50
+    });
51
+  },
52
+  onShareAppMessage: function () {
53
+    return {
54
+      title: app.globalData.ShareTitle,
55
+      path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
56
+      imageUrl: app.globalData.ShareImage,
57
+    }
58
+  },
59
+})

+ 5 - 0
package4/main/newuser.json

@@ -0,0 +1,5 @@
1
+{
2
+  "navigationBarTitleText": "秒过学习法",
3
+  "navigationBarBackgroundColor": "#9BD41C",
4
+  "navigationBarTextStyle": "white"
5
+}

+ 31 - 0
package4/main/newuser.wxml

@@ -0,0 +1,31 @@
1
+<view class="container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
2
+
3
+  <block wx:if="{{PanelShow==0}}">
4
+    <image class="img" lazy-load="true" mode="widthFix" src='{{ImagePath}}web/promotion_leaflet_c01.png' />
5
+    <image class="img" lazy-load="true" mode="widthFix" src='{{ImagePath}}web/promotion_leaflet_c02.png' />
6
+    <image class="img" lazy-load="true" mode="widthFix" src='{{ImagePath}}web/promotion_leaflet_c03.png' />
7
+    <view class="panelBottom FlexRow">
8
+      <view class="panelBottom1 FlexColumn" wx:if="{{!StartDate}}">
9
+        <view class='text7'>16天手把手</view>
10
+        <view class='text8'>还您上手新方法</view>
11
+      </view>
12
+      <view class="panelBottom1 FlexColumn" wx:if="{{StartDate}}">
13
+        <view class='text7'>近期开班时间</view>
14
+        <view class='text8'>{{StartDate}}</view>
15
+      </view>
16
+      <view class="btn2 FlexColumn" bindtap="gotoPanel2">
17
+        去报名
18
+      </view>
19
+    </view>
20
+    <view style="height:140rpx;"></view>
21
+  </block>
22
+  <block wx:if="{{PanelShow==1}}">
23
+    <view class='text1'>报名步骤</view>
24
+    <view class='text2'>第一步</view>
25
+    <text class='text3'>手动关注公众号《秒过学习法》</text>
26
+
27
+    <view class="btn" bindtap='copyManager'>复制公众号名称</view>
28
+    <view class='text4'>第二步</view>
29
+    <view class='text3'>关注后点击“开通新手包”</view>
30
+  </block>
31
+</view>

+ 78 - 0
package4/main/newuser.wxss

@@ -0,0 +1,78 @@
1
+.container{
2
+  background-color: #ffffff;
3
+  color:#1E1E1E;
4
+}
5
+
6
+.img{
7
+  width:100%;
8
+}
9
+
10
+
11
+.panelBottom{
12
+  width:100%;
13
+  height:140rpx;
14
+  position: fixed;
15
+  bottom: 0;
16
+  background-color: #329468;
17
+  z-index: 10;
18
+  justify-content: space-between;
19
+}
20
+
21
+.panelBottom1{
22
+  margin-left: 30rpx;
23
+  color:#fff;
24
+  align-items: flex-start;
25
+}
26
+
27
+.text7{
28
+  font-size:24rpx;
29
+}
30
+
31
+.text8{
32
+  font-size:36rpx;
33
+}
34
+
35
+
36
+.text1{
37
+  margin: 200rpx 0 0 0;
38
+  font-size:64rpx;
39
+  color:#329468;
40
+}
41
+.text2{
42
+  margin: 10rpx 0 0 0;
43
+  font-size:36rpx;
44
+}
45
+.text3{
46
+  font-size:28rpx;
47
+  font-weight: 400;
48
+}
49
+
50
+.btn{
51
+  font-size:36rpx;
52
+  width:520rpx;
53
+  height:90rpx;
54
+  border-radius: 10rpx;
55
+  text-align: center;
56
+  line-height: 90rpx;
57
+  color:#fff;
58
+  background-color: #329468;
59
+  margin-top: 30rpx;
60
+}
61
+
62
+.btn2{
63
+  font-size:48rpx;
64
+  width:380rpx;
65
+  height:100rpx;
66
+  border-radius: 10rpx;
67
+  text-align: center;
68
+  line-height: 100rpx;
69
+  color:#1E1E1E;
70
+  background-color: #FFDD0C;
71
+  margin-right: 30rpx;
72
+}
73
+
74
+.text4{
75
+  margin: 60rpx 0 0 0;
76
+  font-size:36rpx;
77
+}
78
+

二进制
pages/images/home_banner_footer.png


二进制
pages/images/home_banner_header_sz.png


二进制
pages/images/home_banner_window.png


二进制
pages/images/product_icon_mg_70x70.png


+ 39 - 4
pages/main/index.js

@@ -5,6 +5,7 @@ const app = getApp();
5
 var interval = 0;
5
 var interval = 0;
6
 var isPaying = false;
6
 var isPaying = false;
7
 var hanziNumber = 0;
7
 var hanziNumber = 0;
8
+var isMiaoguoADShow=false;
8
 
9
 
9
 Page({
10
 Page({
10
   data: {
11
   data: {
@@ -21,8 +22,10 @@ Page({
21
     NavClass1: "",
22
     NavClass1: "",
22
     NavClass2: "nav2",
23
     NavClass2: "nav2",
23
     IsRemind: false,
24
     IsRemind: false,
25
+    IsMiaoguoAD: false,
24
     IsMemberForeverRemind: 0,
26
     IsMemberForeverRemind: 0,
25
     IsExit: false,
27
     IsExit: false,
28
+    IsMiaoguoAD2:0,
26
   },
29
   },
27
   onLoad: function (options) {
30
   onLoad: function (options) {
28
     //app.globalData.userInfo.UserID=5;
31
     //app.globalData.userInfo.UserID=5;
@@ -35,7 +38,7 @@ Page({
35
     var that = this;
38
     var that = this;
36
     wx.getSetting({
39
     wx.getSetting({
37
       success(res) {
40
       success(res) {
38
-        if (res.authSetting['scope.userInfo'] || app.globalData.userInfo.IsShow<=0) {
41
+        if (res.authSetting['scope.userInfo'] || app.globalData.userInfo.IsShow <= 0) {
39
           that.setData({
42
           that.setData({
40
             IsAccredit: true,
43
             IsAccredit: true,
41
           });
44
           });
@@ -49,7 +52,7 @@ Page({
49
     })
52
     })
50
 
53
 
51
     common.getStorageValue(this, "IsRemind", true, function () { });
54
     common.getStorageValue(this, "IsRemind", true, function () { });
52
-    
55
+
53
     if (app.globalData.IsIPad) {
56
     if (app.globalData.IsIPad) {
54
       if (app.globalData.systemInfo.windowHeight < app.globalData.systemInfo.windowWidth) {
57
       if (app.globalData.systemInfo.windowHeight < app.globalData.systemInfo.windowWidth) {
55
         this.setData({
58
         this.setData({
@@ -57,6 +60,7 @@ Page({
57
         });
60
         });
58
       }
61
       }
59
     }
62
     }
63
+    isMiaoguoADShow = false;
60
   },
64
   },
61
   onShow: function () {
65
   onShow: function () {
62
     this.setData({
66
     this.setData({
@@ -106,6 +110,21 @@ Page({
106
       }
110
       }
107
     }
111
     }
108
 
112
 
113
+    common.getStorageValue(this, "IsMiaoguoAD", true, function () { });
114
+
115
+    var miaoguoADTime = wx.getStorageSync("miaoguoADTime");
116
+    if (miaoguoADTime) {
117
+      if (isMiaoguoADShow && common.formatTime(new Date()) >= miaoguoADTime) {
118
+        this.setData({
119
+          IsMiaoguoAD2: 1,
120
+        });
121
+      }
122
+    }
123
+    else {
124
+      wx.setStorageSync("miaoguoADTime", common.formatTime(common.addDate("d", 1, new Date())));
125
+    }
126
+
127
+    isMiaoguoADShow=true;
109
   },
128
   },
110
   getData: function () {
129
   getData: function () {
111
     var that = this;
130
     var that = this;
@@ -207,10 +226,18 @@ Page({
207
     }
226
     }
208
   },
227
   },
209
   goto: function (e) {
228
   goto: function (e) {
210
-    var id = e.currentTarget.dataset.id;
229
+    var url = e.currentTarget.dataset.url;
211
     wx.navigateTo({
230
     wx.navigateTo({
212
-      url: "../main/list?id=" + id,
231
+      url: url
213
     });
232
     });
233
+
234
+    if (e.currentTarget.dataset.id == "topAD") {
235
+      this.setData({
236
+        IsMiaoguoAD2: 0,
237
+      });
238
+      wx.setStorageSync('IsMiaoguoAD', false); 
239
+      wx.setStorageSync("miaoguoADTime", common.formatTime(common.addDate("d", 15, new Date())));
240
+    }
214
   },
241
   },
215
   gotoSearch: function (e) {
242
   gotoSearch: function (e) {
216
     wx.navigateTo({
243
     wx.navigateTo({
@@ -267,6 +294,14 @@ Page({
267
 
294
 
268
     }
295
     }
269
   },
296
   },
297
+  close: function (e) {
298
+    this.setData({
299
+      IsMiaoguoAD2: 0,
300
+    });
301
+    var num=e.currentTarget.dataset.num;
302
+    if (num>0)
303
+      wx.setStorageSync("miaoguoADTime", common.formatTime(common.addDate("d", num, new Date())));
304
+  },
270
   onShareAppMessage: function () {
305
   onShareAppMessage: function () {
271
     return {
306
     return {
272
       title: app.globalData.ShareTitle,
307
       title: app.globalData.ShareTitle,

+ 35 - 17
pages/main/index.wxml

@@ -1,18 +1,21 @@
1
 <view class="container FlexColumn" style='min-height:{{Height}}rpx;'>
1
 <view class="container FlexColumn" style='min-height:{{Height}}rpx;'>
2
-  <view class="index1 FlexRow">
3
-    <view class="{{NavClass1}} nav FlexColumn" bindtap='selectNav' data-id="1">
4
-      <image src='../images/02003.png' class="img3" />
5
-    </view>
6
-    <image src='../images/02001.png' class="img" />
7
-    <view class="{{NavClass2}} nav FlexColumn" bindtap='selectNav' data-id="2">
8
-      <image src='../images/02002.png' class="img2" />
2
+  <view class="index0 FlexColumn">
3
+    <image src='../images/home_banner_header_sz.png' class="home_banner_header_sz" bindtap='goto' data-id="topAD" data-url='../../package4/main/newuser' wx:if="{{IsMiaoguoAD && IsMember==1 && IsShow==1}}" />
4
+    <view class="index1 FlexRow">
5
+      <view class="{{NavClass1}} nav FlexColumn" bindtap='selectNav' data-id="1">
6
+        <image src='../images/02003.png' class="img3" />
7
+      </view>
8
+      <image src='../images/02001.png' class="img" />
9
+      <view class="{{NavClass2}} nav FlexColumn" bindtap='selectNav' data-id="2">
10
+        <image src='../images/02002.png' class="img2" />
11
+      </view>
12
+      <image src='../images/02004.gif' class="hand" wx:if="{{IsRemind}}" bindtap='selectNav' data-id="2" />
9
     </view>
13
     </view>
10
-    <image src='../images/02004.gif' class="hand" wx:if="{{IsRemind}}" bindtap='selectNav' data-id="2" />
11
   </view>
14
   </view>
12
   <block wx:if="{{NavClass2=='nav2'}}">
15
   <block wx:if="{{NavClass2=='nav2'}}">
13
     <view class="index2 FlexRow">
16
     <view class="index2 FlexRow">
14
       <view class="index2_1 FlexRow">
17
       <view class="index2_1 FlexRow">
15
-        <view class="btn" bindtap="goto" data-id="1">
18
+        <view class="btn" bindtap="goto" data-url="../main/list?id=1">
16
           <view class="btn1">
19
           <view class="btn1">
17
             <view class="panel1 FlexRow">
20
             <view class="panel1 FlexRow">
18
               <image src='../images/02005.png' class="img" />
21
               <image src='../images/02005.png' class="img" />
@@ -22,7 +25,7 @@
22
             </view>
25
             </view>
23
           </view>
26
           </view>
24
         </view>
27
         </view>
25
-        <view class="btn" bindtap="goto" data-id="2">
28
+        <view class="btn" bindtap="goto" data-url="../main/list?id=2">
26
           <view class="btn1">
29
           <view class="btn1">
27
             <view class="panel1 FlexRow">
30
             <view class="panel1 FlexRow">
28
               <image src='../images/02006.png' class="img" />
31
               <image src='../images/02006.png' class="img" />
@@ -32,7 +35,7 @@
32
             </view>
35
             </view>
33
           </view>
36
           </view>
34
         </view>
37
         </view>
35
-        <view class="btn" bindtap="goto" data-id="3">
38
+        <view class="btn" bindtap="goto" data-url="../main/list?id=3">
36
           <view class="btn1">
39
           <view class="btn1">
37
             <view class="panel1 FlexRow">
40
             <view class="panel1 FlexRow">
38
               <image src='../images/02007.png' class="img" />
41
               <image src='../images/02007.png' class="img" />
@@ -42,7 +45,7 @@
42
             </view>
45
             </view>
43
           </view>
46
           </view>
44
         </view>
47
         </view>
45
-        <view class="btn" bindtap="goto" data-id="4">
48
+        <view class="btn" bindtap="goto" data-url="../main/list?id=4">
46
           <view class="btn1">
49
           <view class="btn1">
47
             <view class="panel1 FlexRow">
50
             <view class="panel1 FlexRow">
48
               <image src='../images/02008.png' class="img" />
51
               <image src='../images/02008.png' class="img" />
@@ -52,7 +55,7 @@
52
             </view>
55
             </view>
53
           </view>
56
           </view>
54
         </view>
57
         </view>
55
-        <view class="btn" bindtap="goto" data-id="5">
58
+        <view class="btn" bindtap="goto" data-url="../main/list?id=5">
56
           <view class="btn1">
59
           <view class="btn1">
57
             <view class="panel1 FlexRow">
60
             <view class="panel1 FlexRow">
58
               <image src='../images/02031.png' class="img" />
61
               <image src='../images/02031.png' class="img" />
@@ -62,7 +65,7 @@
62
             </view>
65
             </view>
63
           </view>
66
           </view>
64
         </view>
67
         </view>
65
-        <view class="btn" bindtap="goto" data-id="6">
68
+        <view class="btn" bindtap="goto" data-url="../main/list?id=6">
66
           <view class="btn1">
69
           <view class="btn1">
67
             <view class="panel1 FlexRow">
70
             <view class="panel1 FlexRow">
68
               <image src='../images/02035.png' class="img" />
71
               <image src='../images/02035.png' class="img" />
@@ -145,10 +148,25 @@
145
     </view>
148
     </view>
146
     <view style="height:100rpx;"></view>
149
     <view style="height:100rpx;"></view>
147
   </block>
150
   </block>
148
-  <view class="index5 FlexColumn" wx:if="{{NavClass1!='nav2'}}">
149
-    <image mode="widthFix" src='../images/home_banner.png' class="home_banner" bindtap='switchProgram' data-appid='{{ListProgram[0].appId}}' data-path='{{ListProgram[0].path}}' />
151
+  <view class="index5 FlexColumn" wx:if="{{NavClass1!='nav2' && IsShow==1}}">
152
+    <image mode="widthFix" src='../images/home_banner_footer.png' class="home_banner" bindtap='goto' data-url='../../package4/main/newuser' />
153
+  </view>
154
+
155
+</view>
156
+
157
+<view class="HelpInfo2 FlexColumn" style='height:{{Height}}rpx;' wx:if="{{IsMiaoguoAD2==1}}">
158
+  <view class="btn" bindtap='goto' data-url='../../package4/main/newuser' data-id="topAD">
159
+    <view class="btn1 FlexColumn">
160
+      <image src='../images/home_banner_window.png' class="home_banner_window" />
161
+      <view class="btn2">了解一下</view>
162
+    </view>
163
+  </view>
164
+  <view class="close2 FlexColumn" bindtap='close' data-num="1">
165
+    以后再看
166
+  </view>
167
+  <view class="close FlexColumn" bindtap='close' data-num="0">
168
+    <image src='../images/02024.png' class="closeImage" />
150
   </view>
169
   </view>
151
-  
152
 </view>
170
 </view>
153
 
171
 
154
 
172
 

+ 82 - 1
pages/main/index.wxss

@@ -6,6 +6,13 @@
6
   overflow-x:hidden;
6
   overflow-x:hidden;
7
 }
7
 }
8
 
8
 
9
+.index0{
10
+  width:100%;
11
+}
12
+.home_banner_header_sz{
13
+  width:100%;
14
+  height:150rpx;
15
+}
9
 .index1{
16
 .index1{
10
   width:100%;
17
   width:100%;
11
   height:190rpx;
18
   height:190rpx;
@@ -378,4 +385,78 @@
378
   width:100rpx;
385
   width:100rpx;
379
   font-size:36rpx;
386
   font-size:36rpx;
380
   text-align: center;
387
   text-align: center;
381
-}
388
+}
389
+
390
+
391
+.HelpInfo2 {
392
+  position: fixed;
393
+  left: 0;
394
+  top: 0;
395
+  width: 100%;
396
+  background-color: rgba(245, 226, 190, 0.95);
397
+  justify-content: flex-start;
398
+  z-index: 100;
399
+}
400
+
401
+.HelpInfo2 .btn {
402
+  width: 600rpx;
403
+  height: 640rpx;
404
+  background-color: #D2D2D2;
405
+  border-radius: 40rpx;
406
+  margin: 15rpx;
407
+  position: relative;
408
+  margin-top: 222rpx;
409
+  box-shadow: 0 0 30rpx rgba(0, 0, 0, 0.5);
410
+}
411
+
412
+.HelpInfo2 .btn1 {
413
+  width: 100%;
414
+  height: 640rpx;
415
+  border-radius: 40rpx;
416
+  color: #1e1e1e;
417
+  text-align: center;
418
+  font-size: 36rpx;
419
+  justify-content: flex-start;
420
+}
421
+
422
+.HelpInfo2 .home_banner_window {
423
+  width: 600rpx;
424
+  height: 500rpx;
425
+  border-top-left-radius: 40rpx;
426
+  border-top-right-radius: 40rpx;
427
+}
428
+
429
+.HelpInfo2 .btn2 {
430
+  width: 100%;
431
+  height: 120rpx;
432
+  line-height: 120rpx;
433
+  background-color: #F0F0F0;
434
+  color: #1e1e1e;
435
+  text-align: center;
436
+  font-size: 48rpx;
437
+  font-weight: 500;
438
+  border-bottom-left-radius: 40rpx;
439
+  border-bottom-right-radius: 40rpx;
440
+}
441
+.HelpInfo2 .close2 {
442
+  position: fixed;
443
+  bottom:207rpx;
444
+  font-size:26rpx;
445
+  color: #1e1e1e;
446
+  text-decoration: underline;
447
+  font-weight: 500;
448
+  z-index: 100;
449
+  width:100%;
450
+  height:50rpx;
451
+}
452
+.HelpInfo2 .close {
453
+  width: 100%;
454
+  height: 235rpx;
455
+  position: fixed;
456
+  bottom:0;
457
+}
458
+
459
+.HelpInfo2 .closeImage{
460
+  width:33rpx;
461
+  height:33rpx;
462
+}

+ 11 - 0
utils/main.js

@@ -119,6 +119,17 @@ function payMoney(payType, buyType, money, detail, callback) {
119
 
119
 
120
 function getProgramList() {
120
 function getProgramList() {
121
   return [
121
   return [
122
+    {
123
+      ID: 166,
124
+      Name: "秒过学习",
125
+      Name2: "家长帮助孩子快速提高学习成绩",
126
+      ImageUrl: "product_icon_mg_70x70.png",
127
+      appId: 'wx84b3feac6069eec3',
128
+      path: 'pages/index/index?SourceID=' + app.globalData.ProgramID,
129
+      IsShow: true,
130
+      IsShow2: true,
131
+      Category: "",
132
+    },
122
     {
133
     {
123
       ID: 164,
134
       ID: 164,
124
       Name: "口算",
135
       Name: "口算",

+ 48 - 0
utils/util.js

@@ -394,6 +394,52 @@ function FormatMoney(money) {
394
   return result;
394
   return result;
395
 }
395
 }
396
 
396
 
397
+
398
+function addDate(interval, number, date) {
399
+  switch (interval.toLowerCase()) {
400
+    case "y":
401
+      return new Date(date.setFullYear(date.getFullYear() + number));
402
+    case "m":
403
+      return new Date(date.setMonth(date.getMonth() + number));
404
+    case "d":
405
+      return new Date(date.setDate(date.getDate() + number));
406
+    case "w":
407
+      return new Date(date.setDate(date.getDate() + 7 * number));
408
+    case "h":
409
+      return new Date(date.setHours(date.getHours() + number));
410
+    case "n":
411
+      return new Date(date.setMinutes(date.getMinutes() + number));
412
+    case "s":
413
+      return new Date(date.setSeconds(date.getSeconds() + number));
414
+    case "l":
415
+      return new Date(date.setMilliseconds(date.getMilliseconds() + number));
416
+  }
417
+}
418
+
419
+function diffDate(interval, date1, date2) {
420
+  var long = date2.getTime() - date1.getTime(); //相差毫秒
421
+  switch (interval.toLowerCase()) {
422
+    case "y":
423
+      return parseInt(date2.getFullYear() - date1.getFullYear());
424
+    case "m":
425
+      return parseInt((date2.getFullYear() - date1.getFullYear()) * 12 + (date2.getMonth() - date1.getMonth()));
426
+    case "d":
427
+      return parseInt(long / 1000 / 60 / 60 / 24);
428
+    case "w":
429
+      return parseInt(long / 1000 / 60 / 60 / 24 / 7);
430
+    case "h":
431
+      return parseInt(long / 1000 / 60 / 60);
432
+    case "n":
433
+      return parseInt(long / 1000 / 60);
434
+    case "s":
435
+      return parseInt(long / 1000);
436
+    case "l":
437
+      return parseInt(long);
438
+  }
439
+}
440
+
441
+
442
+
397
 module.exports = {
443
 module.exports = {
398
   formatTime: formatTime,
444
   formatTime: formatTime,
399
   formatDateCHS: formatDateCHS,
445
   formatDateCHS: formatDateCHS,
@@ -417,4 +463,6 @@ module.exports = {
417
   ReplaceAllString: ReplaceAllString,
463
   ReplaceAllString: ReplaceAllString,
418
   IsChinese: isChinese,
464
   IsChinese: isChinese,
419
   FormatMoney: FormatMoney,
465
   FormatMoney: FormatMoney,
466
+  addDate: addDate,
467
+  diffDate: diffDate,
420
 }
468
 }