ArvinQi před 6 roky
rodič
revize
64c4e4516b

+ 8 - 7
components/type/vip/mobile.vue

@@ -1,5 +1,5 @@
 <template>
-  <section v-if="vipDetail" class="vip">
+  <section class="vip">
     <section class="banners-box" @touchstart="touchStart" @touchend="touchEnd">
       <section class="banners" :class="{'banners-com': currentCom}">
         <section class="banner">
@@ -128,7 +128,7 @@ export default {
       // 当前是企业页
       currentCom: false,
       // 会员详情
-      vipDetail: null
+      vipDetail: {}
     }
   },
   mixins: [getDeviceType],
@@ -140,13 +140,14 @@ export default {
       return (this.currentCom ? this.com : this.dev) || {}
     },
     vipNow() {
-      return this.vipDetail.is_vip
+      return this.vipDetail.is_vip || false
     },
     vipInfo() {
-      return this.vipDetail.vip_info
+      return this.vipDetail.vip_info || {}
     },
     userInfo() {
-      return this.vipDetail.user_info
+      console.log(this.vipDetail)
+      return this.vipDetail.user_info || {}
     },
     isCom() {
       if (this.$route.query.isCom) return true
@@ -213,8 +214,8 @@ export default {
      */
     async getVipDetail() {
       let res = await this.$axios.$post('/api/vip/getVipUserDetail')
-      if (!res.data) return
-      this.vipDetail = res.data
+      // if (!res || !res.data) return
+      this.vipDetail = res && res.data ? res.data : {};
       if (this.isCom) this.currentCom = true
     }
   },

+ 8 - 3
components/ver_code.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="container">
-    <el-input class="input" placeholder="请输入验证码" @input="$emit('change', $event)"></el-input>
+    <el-input class="input" placeholder="请输入验证码" v-model="value" @input="onInput"></el-input>
     <button class="ver-btn" @click="clickBtn">{{remind}}</button>
   </div>
 </template>
@@ -17,18 +17,23 @@ export default {
       remind: remindInit,
       // 读秒中
       running: false,
+      value: '',
       max,
     }
   },
   methods: {
+    onInput(value) {
+      this.value = value
+      this.$emit('change', value)
+    },
     clickBtn() {
-      if(this.running) return
+      if (this.running) return
       this.$emit('click', () => {
         this.running = true
         this.remind = `${this.max}秒`
         interval = setInterval(() => {
           this.max -= 1
-          if(this.max < 1) {
+          if (this.max < 1) {
             clearInterval(interval)
             this.max = max
             this.remind = remindInit

+ 7 - 6
pages/setting/check/old_mobile.vue

@@ -30,7 +30,7 @@ export default {
   computed: {
     mobile() {
       let userMobile = this.userinfo.mobile
-      if(!userMobile) return
+      if (!userMobile) return
       return `${userMobile.slice(0, 3)}****${userMobile.slice(7, 11)}`
     }
   },
@@ -40,7 +40,7 @@ export default {
     }
   },
   mounted() {
-    if(!this.userinfo.nickname) {
+    if (!this.userinfo.nickname) {
       location.href = '/?loginbox=show'
     }
   },
@@ -49,7 +49,7 @@ export default {
       let res = await this.$axios.$post('/api/user/sendMobileAuthCode', {
         mobile: this.userinfo.mobile
       })
-      if(res) {
+      if (res) {
         this.$message({
           message: '发送成功,请查收',
           type: 'success'
@@ -57,10 +57,11 @@ export default {
       }
     },
     changeAuthCode(val) {
+      console.log(val, !val);
       this.authCode = val
     },
     async clickNext() {
-      if(!this.authCode.length) {
+      if (!this.authCode) {
         this.$message('请输入验证码')
         return
       }
@@ -68,7 +69,7 @@ export default {
         mobile: this.userinfo.mobile,
         auth_code: this.authCode,
       })
-      if(res) {
+      if (res) {
         // 成功则保存history
         localStorage.setItem('proginn-history', this.$route.path)
         this.$router.push('/setting/check/change_mobile')
@@ -76,7 +77,7 @@ export default {
     },
     async doCheckReal() {
       let res = await this.$axios.$post(`/api/user/check_realname`)
-      if(res.data.realname_verify_status) {
+      if (res.data.realname_verify_status) {
         // 成功则保存history
         localStorage.setItem('proginn-history', this.$route.path)
         this.$router.push('/setting/check/real_info')

+ 2 - 2
pages/user/register.vue

@@ -189,8 +189,8 @@ export default {
       let mobile = encodeURIComponent(this.ruleFormPhone.mobile)
       let register = async body => {
         let res = await this.$axios.$post('/api/passport/register', body)
-        if (res) {
-          this.$message(res.info)
+        if (res && res.data) {
+          this.$message(res.data.info)
           setTimeout(() => {
             location.href = "/user/success"
           }, 1000)

+ 4 - 2
plugins/nuxtAxios.js

@@ -1,3 +1,4 @@
+import Vue from 'vue';
 import qs from 'qs';
 
 export default function ({ $axios, redirect, req, ...args }) {
@@ -49,7 +50,7 @@ export default function ({ $axios, redirect, req, ...args }) {
             })
             return result;
         }
-        req && req.url && needLogin(req.url)
+        // req && req.url && needLogin(req.url)
         if(data.status === 1) {
             return res;
         } else if(data.status === -99) {
@@ -58,7 +59,8 @@ export default function ({ $axios, redirect, req, ...args }) {
             }
             return res;
         } else {
-            return res;
+            Vue.prototype.$message.error(data.info);
+            return data;
         }
     })
     $axios.onError(error => {