sys 1 rok temu
rodzic
commit
7d24122c3d
3 zmienionych plików z 25 dodań i 13 usunięć
  1. 1 0
      api/login.js
  2. 19 9
      pages/perfect/cards.vue
  3. 5 4
      service/ajax.js

+ 1 - 0
api/login.js

@@ -7,3 +7,4 @@ export const login = (data) => request('/auth/oauth2/token', 'post', { ...data }
 export const forgetPassword = (data) => request(newsUrl + 'forget_password', 'post', { ...data },false)
 export const register = (data) => request(newsUrl + 'register', 'post', { ...data },true)
 export const filUserInfo = (data) => request(newsUrl + 'fill_user_info', 'post', { ...data },true)
+export const setCard = (data) => request(newsUrl + 'card', 'post', { ...data },true)

+ 19 - 9
pages/perfect/cards.vue

@@ -18,7 +18,7 @@
 
         </view>
         <view class="card-agreement">
-          <login-agreement :type="2"></login-agreement>
+          <login-agreement :type="2" v-model="isCheck"></login-agreement>
         </view>
       </view>
       <view class="login-bottom">
@@ -70,8 +70,8 @@ import EnNav from "@/components/en-utils/en-nav/en-nav";
 import tools from "@/service/tools";
 import LoginAgreement from "@/pages/login/model/loginAgreement";
 import EnPopup from "@/components/en-utils/en-popup/en-popup";
-import {register} from "@/api/login";
 import cosServe from "@/service/txOssSts";
+import {setCard} from "@/api/login";
 export default {
   components: {EnPopup, LoginAgreement, EnNav},
   data() {
@@ -82,11 +82,14 @@ export default {
       nickname:'',
       password:'',
       imgList:[],
-      imgBg:''
+      imgBg:'',
+      isCheck:false
     }
   },
   watch:{
-
+    'isCheck':function (){
+      this.verifyIsOK()
+    }
   },
   methods: {
     openChooseImage(){
@@ -108,7 +111,7 @@ export default {
               })
             })
             console.log( this.imgList)
-            this.isOK=true
+            this.verifyIsOK()
           }
           this.$refs.cardPopup.close()
         }
@@ -119,10 +122,17 @@ export default {
     },
     setNextStep(){
       if(this.isOK){
-
-        uni.switchTab({
-          'url':'/pages/index/index'
+        let mobile=uni.getStorageSync('mobile')
+        setCard({'mobile':mobile,'cards':this.imgList}).then((res)=>{
+          if(res.code===0){
+            uni.switchTab({
+              'url':'/pages/index/index'
+            })
+          }else {
+            tools.error(res.msg)
+          }
         })
+
       }else {
         tools.error('请完善信息')
         this.isShakeBut=true
@@ -132,7 +142,7 @@ export default {
       }
     },
     verifyIsOK(){
-      this.isOK = this.nickname!=='' && this.password.length>=6;
+      this.isOK = this.isCheck && this.imgList.length>=0;
     },
     setNavHeight(navHeight){
       this.navHeight=navHeight+41

+ 5 - 4
service/ajax.js

@@ -57,10 +57,11 @@ export const request = (url, method, data, show = false) => {
             resolve(res.data)
           }
         }else if(res.statusCode === 401){
-          uni.clearStorageSync()
-          uni.reLaunch({
-            url: '/pages/login/index'
-          });
+          // uni.clearStorageSync()
+          // uni.reLaunch({
+          //   url: '/pages/login/index'
+          // });
+          tools.error(res.data.data)
         } else{
           tools.error('网络错误!!')
         }