Przeglądaj źródła

Merge branch 'main' of https://gitlab.com/tea28/client

DaMowang 3 lat temu
rodzic
commit
6cb8bb0108
2 zmienionych plików z 42 dodań i 38 usunięć
  1. 2 5
      src/pages/my/index.vue
  2. 40 33
      src/pages/sign/index.vue

+ 2 - 5
src/pages/my/index.vue

@@ -398,12 +398,12 @@ export default {
     return {
       showAuth: false,
       shopInfo: {}, // 商铺信息
-      userInfo: "", // 用户信息
       userInfoAccount: {}, // 账户数据
       customerServiceWeiXin: "", // 客服微信
       isShiMing: true,
       agentName: "", // 缘起
       user_id: undefined,
+      userinfo:undefined, // 获取用户信息
     };
   },
   onLoad: function (options) {
@@ -421,7 +421,7 @@ export default {
     }
   },
   onShow: function () {
-    
+    this.userinfo = uni.getStorageSync("userinfo")
     let token = uni.getStorageSync('token');
     if (!token) {
       this.login();
@@ -446,9 +446,6 @@ export default {
       // #endif
     },
 
-
-
-
     // 获取用户信息
     loadData() {
       u_post("ShuZiTeaYW/my/index", {

+ 40 - 33
src/pages/sign/index.vue

@@ -5,12 +5,12 @@
         <!-- 页面标题-end -->
         <!-- 用户信息 -->
         <view class="userinfo flex_r flex_ac">
-            <span v-if="!userInof.headimgurl" class="iconfont">&#xe630;</span>
-            <image v-else class="user_img" :src="userInof.headimgurl" mode=""></image>
+            <span v-if="!userinfo.headimgurl" class="iconfont">&#xe630;</span>
+            <image v-else class="user_img" :src="userinfo.headimgurl" mode=""></image>
             <view class="user_info flex_c flex_jc">
                 <view class="user_name">{{userinfo.headimgurl}}</view>
                 <view class="level_con flex_r flex_ac">
-                    <view class="level">{{userInof.level}}</view>
+                    <view class="level">{{userinfo.level_name}}</view>
                 </view>
             </view>
             <!-- <view class="record flex_r flex_ac flex_jc" @tap="NavToSignList">积分记录</view> -->
@@ -20,16 +20,16 @@
         <view class="sign_info flex_c">
             <view class="info flex_r flex_ac flex_jb">
                 <view class="info_today flex_c flex_ac">
-                    <view class="today_text g_color">{{integerInfo.todaySignIn || 0}}</view>
+                    <view class="today_text g_color">{{todaySign}}</view>
                     <view class="info_text">今日签到</view>
                 </view>
                 <view class="info_today flex_c flex_ac">
-                    <view class="today_text">{{integerInfo.continueCount || 0}}</view>
-                    <view class="info_text">累计签到({{integerInfo.continueCount || 0}}次)</view>
+                    <view class="today_text">{{todaySign}}</view>
+                    <view class="info_text">累计签到({{todaySign || 0}}次)</view>
                 </view>
                 <view class="info_con">
-                    <image class="info_img" :src="integerInfo.time > 0 ? '/static/sgin/p_back2.png' : '/static/sgin/p_back.png'" mode=""></image>
-                    <view class="info_texts flex_r flex_ac flex_jc" @tap="setSignIn">{{integerInfo.time > 0 ? timer : ''}}<text v-if="integerInfo.time <= 0">立即签到</text></view>
+                    <image class="info_img" :src="nextSign> 0 ? '/static/sgin/p_back2.png' : '/static/sgin/p_back.png'" mode=""></image>
+                    <view class="info_texts flex_r flex_ac flex_jc" @tap="setSignIn">{{nextSign > 0 ? timer : ''}}<text v-if="nextSign <= 0">立即签到</text></view>
                 </view>
             </view>
             <view class="sign_time flex_r flex_ac flex_je mar_t20">
@@ -147,29 +147,34 @@ export default {
             pay_way: 0, //选中的支付方式
             isShow: false, // 是否显示现金支付
             goodsId: '', // 选中的商品Id
-            showAuth: true, //是否显示授权弹窗
-            shopInfo: {} // 商户信息
+            showAuth: false, //是否显示授权弹窗
+            shopInfo: {}, // 商户信息
+            userinfo:undefined, //用户信息
+            todaySign:0, //今日签到数
+            totalSign:0, //累计签到数
+            nextSign:0, //剩余签到时间 秒
         };
     },
     onShow: function() {
         this.timer = '00:00:00'
+        this.userinfo = uni.getStorageSync("userinfo")
+        console.log( this.userinfo,' this.userinfo');
         this.loadData()
         // this.goodsDay()
         // this.getInteGoods()
         // this.integralMethodChange()
-        let that = this;
-        let userId = app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId ? app.globalData.systemUserInfo.userId : '';
-        if (!userId || userId == '' || userId == undefined) {
-            that.showAuth = true
+        // let userId = app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId ? app.globalData.systemUserInfo.userId : '';
+        if (!this.userinfo || this.userinfo == '' || this.userinfo == undefined) {
+            this.showAuth = true
             appEv.authorizeUserInfo(res => {
                 if (res) {
-                    that.showAuth = false
-                    that.shopInfo = app.globalData.shopInfo
+                    this.showAuth = false
+                    this.shopInfo = app.globalData.shopInfo
                 }
             }, true)
         } else {
-            that.showAuth = false
-            that.shopInfo = app.globalData.shopInfo
+            this.showAuth = false
+            this.shopInfo = app.globalData.shopInfo
         }
     },
     onHide: function() {
@@ -178,11 +183,13 @@ export default {
     methods: {
         loadData() {
             post("/user/sign").then(res => {
-                console.log(res,"aaaaaaaaaa");
-                if (res.status == 200) {
-                    that.integerInfo = res.integerInfo
-                    that.userInof = res.userInof
-                    that.setTime()
+                if (res.code == 0) {
+                    // that.integerInfo = res.integerInfo
+                    // that.userInof = res.userInof
+                    this.todaySign = res.data.today_sign
+                    this.totalSign = res.data.total_sign
+                    this.nextSign = res.data.next_sign
+                    this.setTime()
                 }
             })
         },
@@ -197,10 +204,10 @@ export default {
             });
         },
         // 距可以签到倒计时
-        setTime: function() {
+        setTime() {
             var date;
-            let that = this;
-            let timer = that.integerInfo.time / 1000
+            let timer = this.nextSign
+            console.log(timer,'timer');
             tim = setInterval(() => {
                 if (timer >= 1) {
                     timer--
@@ -211,19 +218,19 @@ export default {
                 let hour = parseInt(timer / 3600) > 9 ? parseInt(timer / 3600) : '0' + parseInt(timer / 3600)
                 let min = parseInt(timer / 60 % 60) > 9 ? parseInt(timer / 60 % 60) : '0' + parseInt(timer / 60 % 60)
                 let sec = parseInt(timer % 60) > 9 ? parseInt(timer % 60) : '0' + parseInt(timer % 60)
-
+                
                 date = hour + ':' + min + ':' + sec;
+                console.log(date);
                 this.timer = date
             }, 999)
         },
         // 签到
-        setSignIn: function() {
-            let that = this;
-            u_post("ShuZiTeaIntegral/integral/reportNew").then(res => {
+        setSignIn() {
+            console.log("走了这里");
+            post("user/doSign").then(res => {
                 if (res.status == 200) {
-                    console.log(res)
                     appEv.errTips(res.msg)
-                    that.loadData()
+                    this.loadData()
                 } else {
                     appEv.errTips(res.msg)
                 }
@@ -383,7 +390,7 @@ export default {
     }
 }
 </script>
-<style lang="scss">
+<style lang="scss" scoped>
 // 页面配置
 page {
     background: #f5f5f5;