Browse Source

功能完善11.17-16:32

rong air 4 years ago
parent
commit
0c3fadc15f
2 changed files with 22 additions and 4 deletions
  1. 9 3
      src/pages/user_center/recharge/index.vue
  2. 13 1
      src/utils/user.js

+ 9 - 3
src/pages/user_center/recharge/index.vue

@@ -314,6 +314,7 @@ export default {
         goods_id: $this.selection_card.goods_id,
         buy_num: 1
       }
+
       createOrder($params).then((res) => {
           let $data = res.data
           let $payment = $data.data
@@ -355,6 +356,11 @@ export default {
     },
     // 获取充值卡列表
     get_card_list() {
+      wx.login({
+        success(res) {
+          console.log("微信登陆",res.code);
+        }
+      })
       goodsCardList().then((res) => {
         let $data = res.data.data
         $this.time_cards = $data.time_card
@@ -378,9 +384,9 @@ export default {
     //  切换显示
     changeCardShow($id) {
       console.log($id)
-      if ($this.card_action_show == $id){
+      if ($this.card_action_show == $id) {
         $this.card_action_show = 0
-      }else{
+      } else {
         $this.card_action_show = $id
       }
     }
@@ -433,7 +439,7 @@ export default {
   height: 103px;
   background-position: center;
   background-size: 100% 100%;
-  margin:0px auto;
+  margin: 0px auto;
 }
 
 .gold {

+ 13 - 1
src/utils/user.js

@@ -5,10 +5,22 @@ import user_store from '../store/index'
 
 
 //刷新用户信息
-
 export function reload_userinfo($this) {
   userDetail().then((res) => {
     let $data = res.data;
+    if ($data.code != 0) {
+      wx.clearStorageSync()
+      wx.showToast({
+        title: "用户信息过期,请重新登录",
+        icon: 'none',
+        mask: true,
+        success() {
+          mpvue.navigateTo({
+            url: "/pages/index/main"
+          })
+        }
+      })
+    }
     $this.userinfo = $data.data;
     $this.userinfo.birthday = formatBirthday($this.userinfo.birthday)
     $this.userinfo['validity_time'] = formatTime($this.userinfo['validity_time'])