houwei 4 роки тому
батько
коміт
24ed0df93a

+ 3 - 2
pages/activeDetail/activeDetail.js

@@ -6,7 +6,7 @@ Page({
   },
   isOk() {
     tool.isLogin().then(result => {
-      console.log(result)
+      console.log(result,'22222222222')
       this.setData({
         loginStatus: true
       })
@@ -29,7 +29,7 @@ Page({
         })
       })
     }).catch(err => {
-      console.log(err)
+      console.log(err,'没登录')
       this.setData({
         loginStatus: false
       })
@@ -80,6 +80,7 @@ Page({
     }
     wx.requestSubscribeMessage({
       tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
+      // tmplIds: ['OfeVQOfrOQyOEb-ipTiw6MRJiXs9vlvhv3SVRtrTgKc'],
       success: (res) => {
         wx.request({
           url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',

+ 1 - 1
pages/index/index.js

@@ -181,7 +181,7 @@ Page({
     this.getInfos()
     tool.isLogin().then(res => {
       this.setData({
-        userInfo: JSON.parse(res.rawData)
+        userInfo:JSON.parse(res.rawData)
       })
       console.log(this.data.userInfo)
     }).catch(err => {

+ 1 - 0
pages/myActive/myActive.js

@@ -10,6 +10,7 @@ Page({
   },
   goActive(e) {
     console.log(e.currentTarget.dataset.id)
+
     wx.redirectTo({
       url: '/pages/onSiteActivity/onSiteActivity?id=' + e.currentTarget.dataset.id,
     })

+ 12 - 0
pages/onSiteActivity/onSiteActivity.js

@@ -14,6 +14,9 @@ Page({
     })
   },
   love(e) {
+    wx.showLoading({
+      title: '加载中',
+    })
     console.log(e)
     let status = this.data.member[e.currentTarget.dataset.index].hearted
     let status1 = 'member[' + e.currentTarget.dataset.index + '].hearted'
@@ -34,7 +37,11 @@ Page({
             })
             console.log(this.data.member)
             this.getMyheartNowTimes();
+            wx.hideLoading();
           }
+        },
+        fail:(err)=>{
+          wx.hideLoading();
         }
       })
     } else {
@@ -54,10 +61,15 @@ Page({
               })
               console.log(this.data.member)
               this.getMyheartNowTimes();
+              wx.hideLoading();
             }
+          },
+          fail:(err)=>{
+            wx.hideLoading();
           }
         })
       } else {
+        wx.hideLoading();
         wx.showToast({
           title: '您已经达到心动上限了呦',
           icon: 'none',

+ 2 - 2
pages/onSiteActivity/onSiteActivity.wxss

@@ -10,7 +10,7 @@
 }
 
 .heartbox {
-  width: 1100rpx;
+  width: 638rpx;
   height: 100rpx;
   /* border: 1px solid red; */
   position: relative;
@@ -20,7 +20,7 @@
 }
 
 .line {
-  width: 1100rpx;
+  width: 638rpx;
   height: 4rpx;
   background: #d8d8d8;
   position: absolute;

+ 18 - 4
pages/personInfo/personInfo.js

@@ -357,6 +357,9 @@ Page({
       photoUrl: {
         required: '请上传本人照片哟',
       },
+      tel: {
+        required: '请上传手机号'
+      },
       name: {
         required: '请填写姓名哟',
         minlength: '请输入正确的名称哟',
@@ -615,18 +618,29 @@ Page({
         openid: result[0],
         sessionkey: result[1]
       })
-      this.getInfos();
+      // this.getInfos();
     })
   },
   onShow() {
-    this.getInfos()
     tool.isLogin().then(res => {
+      console.log(res,'7777777777777')
       this.setData({
         userInfo: JSON.parse(res.rawData)
       })
-      console.log(this.data.userInfo,'11111111')
+      this.getInfos()
     }).catch(err => {
-      console.log(err,'0000000000')
+      wx.showModal({
+        title: '您还未登录',
+        showCancel: false,
+        success(res) {
+          if (res.confirm) {
+            wx.redirectTo({
+              url: '/pages/personal/personal',
+            })
+          }
+        }
+      });
+      // console.log(err,'0000000000')
     })
   }
 })

+ 1 - 1
pages/personal/personal.js

@@ -141,6 +141,7 @@ Page({
       url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
       method: "get",
       success: (res) => {
+        console.log(res,'00000000000000')
         if (res.data.code == 0) {
           let config='ysf.config';
           let sex1 = '';
@@ -181,7 +182,6 @@ Page({
               ])
             })
           })
-          console.log(this.data.ysf.config)
           if(res.data.info.avatar&&res.data.info.nickName){
             this.setData({
               avatarUrl: res.data.info.avatar,

+ 24 - 9
pages/sign/sign.js

@@ -7,7 +7,7 @@ Page({
   go() {
     // + this.data.activeId,
     wx.navigateTo({
-      url: '/pages/onSiteActivity/onSiteActivity?id='+ this.data.activeId
+      url: '/pages/onSiteActivity/onSiteActivity?id=' + this.data.activeId
     })
   },
   // getNum() {
@@ -28,29 +28,44 @@ Page({
   //     }
   //   })
   // },
-  sign(){
+  sign() {
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/sign',
       method: "get",
       success: (res) => {
-        console.log(res,'我签到的结果')
+        console.log(res, '我签到的结果')
         if (res.data.code == 0) {
-          this.setData({
-            myNum: res.data.activeNumber
-          })
+          if (res.data.activeNumber == 0) {
+            wx.showModal({
+              title: '您未报名此活动',
+              content: '请联系客服呦',
+              showCancel: false,
+              success(res) {
+                if (res.confirm) {
+                  wx.redirectTo({
+                    url: '/pages/index/index',
+                  })
+                }
+              }
+            })
+          } else {
+            this.setData({
+              myNum: res.data.activeNumber
+            })
+          }
         }
       }
     })
   },
   onLoad: function (options) {
-    console.log(decodeURIComponent(options.q),'我是签到页带过来的参数');
-    let url=decodeURIComponent(options.q);
+    console.log(decodeURIComponent(options.q), '我是签到页带过来的参数');
+    let url = decodeURIComponent(options.q);
     let after = url.split('id=')[1];
     tool.openidStatus().then(result => {
       this.setData({
         openid: result[0],
         sessionkey: result[1],
-        activeId:after
+        activeId: after
       })
       this.sign();
     })

+ 0 - 4
utils/tool.js

@@ -1,9 +1,6 @@
 const util = require('../utils/util.js');
 const openidStatus = () => {
   return new Promise((resolve, reject) => {
-    // if (wx.getStorageSync('openId')) {
-    //   resolve([wx.getStorageSync('openId'), wx.getStorageSync('sessionKey')]);
-    // } else {
       wx.login({
         success: (res) => {
           if (res.code) {
@@ -28,7 +25,6 @@ const openidStatus = () => {
           }
         }
       })
-    // }
   })
 };