Browse Source

Merge branch 'master' of http://git.lcpcp.cc/root/lcoco

py 1 year ago
parent
commit
71ddf8f72f
7 changed files with 53 additions and 30 deletions
  1. 1 0
      api/login.js
  2. 5 2
      main.js
  3. 0 1
      pages/login/localPhoneLogin.vue
  4. 22 14
      pages/perfect/cards.vue
  5. 1 1
      pages/perfect/nickname.vue
  6. 5 4
      service/ajax.js
  7. 19 8
      service/txOssSts.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 forgetPassword = (data) => request(newsUrl + 'forget_password', 'post', { ...data },false)
 export const register = (data) => request(newsUrl + 'register', 'post', { ...data },true)
 export const register = (data) => request(newsUrl + 'register', 'post', { ...data },true)
 export const filUserInfo = (data) => request(newsUrl + 'fill_user_info', '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)

+ 5 - 2
main.js

@@ -6,9 +6,12 @@ import {
 	RouterMount
 	RouterMount
 } from './service/router.js' //路径换成自己的
 } from './service/router.js' //路径换成自己的
 import cosServe from "@/service/txOssSts";
 import cosServe from "@/service/txOssSts";
-Vue.prototype.getCosPath = (urlName) => {
+Vue.prototype.getCosPath =async (urlName) => {
 	console.log('getCosPath:路径转换调用')
 	console.log('getCosPath:路径转换调用')
-	return cosServe.getSignUrl(urlName);
+	console.log(urlName)
+	let  url=await cosServe.getSignUrl(urlName);
+	console.log(url)
+	return url;
 };
 };
 Vue.use(router)
 Vue.use(router)
 // #ifndef VUE3
 // #ifndef VUE3

+ 0 - 1
pages/login/localPhoneLogin.vue

@@ -155,7 +155,6 @@ export default {
             'url':'/pages/perfect/sexAndAge'
             'url':'/pages/perfect/sexAndAge'
           })
           })
         }else {
         }else {
-          tools.setLoginData(res.data)
           setTimeout(()=>{
           setTimeout(()=>{
             uni.navigateTo({
             uni.navigateTo({
               'url':'/pages/perfect/sexAndAge'
               'url':'/pages/perfect/sexAndAge'

+ 22 - 14
pages/perfect/cards.vue

@@ -11,14 +11,14 @@
           <text class="sys-color-green">真实照片</text>
           <text class="sys-color-green">真实照片</text>
           <text class="sys-color-gray-9">,否则部分功能可能会受限</text>
           <text class="sys-color-gray-9">,否则部分功能可能会受限</text>
         </view>
         </view>
-        <view class="card-img" :class="{'open-img':imgBg}" @click="openPopup" :style="{'height':'calc(100vh - '+navHeight+'px  - 278rpx - 270rpx - env(safe-area-inset-bottom)','background-image':'url('+getCosPath(imgBg)+')'}">
+        <view class="card-img" :class="{'open-img':imgBg}" @click="openPopup" :style="{'height':'calc(100vh - '+navHeight+'px  - 278rpx - 270rpx - env(safe-area-inset-bottom)','background-image':'url('+imgBg+')'}">
           <view class="add-box" v-if="!imgBg">
           <view class="add-box" v-if="!imgBg">
             <image class="add-img" src="/static/img/common/add.png" mode="aspectFill"></image>
             <image class="add-img" src="/static/img/common/add.png" mode="aspectFill"></image>
           </view>
           </view>
 
 
         </view>
         </view>
         <view class="card-agreement">
         <view class="card-agreement">
-          <login-agreement :type="2"></login-agreement>
+          <login-agreement :type="2" v-model="isCheck"></login-agreement>
         </view>
         </view>
       </view>
       </view>
       <view class="login-bottom">
       <view class="login-bottom">
@@ -70,8 +70,8 @@ import EnNav from "@/components/en-utils/en-nav/en-nav";
 import tools from "@/service/tools";
 import tools from "@/service/tools";
 import LoginAgreement from "@/pages/login/model/loginAgreement";
 import LoginAgreement from "@/pages/login/model/loginAgreement";
 import EnPopup from "@/components/en-utils/en-popup/en-popup";
 import EnPopup from "@/components/en-utils/en-popup/en-popup";
-import {register} from "@/api/login";
 import cosServe from "@/service/txOssSts";
 import cosServe from "@/service/txOssSts";
+import {setCard} from "@/api/login";
 export default {
 export default {
   components: {EnPopup, LoginAgreement, EnNav},
   components: {EnPopup, LoginAgreement, EnNav},
   data() {
   data() {
@@ -82,11 +82,14 @@ export default {
       nickname:'',
       nickname:'',
       password:'',
       password:'',
       imgList:[],
       imgList:[],
-      imgBg:''
+      imgBg:'',
+      isCheck:false
     }
     }
   },
   },
   watch:{
   watch:{
-
+    'isCheck':function (){
+      this.verifyIsOK()
+    }
   },
   },
   methods: {
   methods: {
     openChooseImage(){
     openChooseImage(){
@@ -99,18 +102,16 @@ export default {
           if(res.tempFiles.length>0){
           if(res.tempFiles.length>0){
             console.log(res.tempFiles)
             console.log(res.tempFiles)
             res.tempFiles.forEach((item,key)=>{
             res.tempFiles.forEach((item,key)=>{
-              cosServe.txUploadFile(item,'gallery').then((res)=>{
+              cosServe.txUploadFile(item,'gallery').then(async (res)=>{
                 if(key===0){
                 if(key===0){
                   this.imgBg=res.Location
                   this.imgBg=res.Location
-                  console.log('this.imgBg:'+this.imgBg)
-                  this.imgBg=cosServe.getSignUrl(this.imgBg)
-                  console.log(this.imgBg)
+                  this.imgBg=await cosServe.getSignUrl(this.imgBg)
                 }
                 }
                 this.imgList.push(res.Location)
                 this.imgList.push(res.Location)
               })
               })
             })
             })
             console.log( this.imgList)
             console.log( this.imgList)
-            this.isOK=true
+            this.verifyIsOK()
           }
           }
           this.$refs.cardPopup.close()
           this.$refs.cardPopup.close()
         }
         }
@@ -121,10 +122,17 @@ export default {
     },
     },
     setNextStep(){
     setNextStep(){
       if(this.isOK){
       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 {
       }else {
         tools.error('请完善信息')
         tools.error('请完善信息')
         this.isShakeBut=true
         this.isShakeBut=true
@@ -134,7 +142,7 @@ export default {
       }
       }
     },
     },
     verifyIsOK(){
     verifyIsOK(){
-      this.isOK = this.nickname!=='' && this.password.length>=6;
+      this.isOK = this.isCheck && this.imgList.length>=0;
     },
     },
     setNavHeight(navHeight){
     setNavHeight(navHeight){
       this.navHeight=navHeight+41
       this.navHeight=navHeight+41

+ 1 - 1
pages/perfect/nickname.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-  <view class="pass-box">
+  <view class="pass-box" >
     <en-nav  ></en-nav>
     <en-nav  ></en-nav>
     <view class="login-box" :style="{'height':'calc(100vh - '+navHeight+'px)'}" >
     <view class="login-box" :style="{'height':'calc(100vh - '+navHeight+'px)'}" >
       <view class="login-top">
       <view class="login-top">

+ 5 - 4
service/ajax.js

@@ -57,10 +57,11 @@ export const request = (url, method, data, show = false) => {
             resolve(res.data)
             resolve(res.data)
           }
           }
         }else if(res.statusCode === 401){
         }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{
         } else{
           tools.error('网络错误!!')
           tools.error('网络错误!!')
         }
         }

+ 19 - 8
service/txOssSts.js

@@ -113,7 +113,10 @@ cosServe.txUploadFile=function (file,folder){
 }
 }
 
 
 
 
-cosServe.getSignUrl=function (url){
+cosServe.getSignUrl=  function (url){
+    if(!url){
+        return  ''
+    }
     if(cos===null){
     if(cos===null){
         startCos();
         startCos();
     }
     }
@@ -128,14 +131,22 @@ cosServe.getSignUrl=function (url){
         Region: Region,
         Region: Region,
         Key: url, /* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),支持中文,必须字段 */
         Key: url, /* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),支持中文,必须字段 */
     })
     })
-    let newUrl= cos.getObjectUrl({
-        Bucket: Bucket,
-        Region: Region,
-        Key: url, /* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),支持中文,必须字段 */
+    return new Promise((resolve, reject) => {
+        cos.getObjectUrl({
+                Bucket: Bucket,
+                Region: Region,
+                Key: url, /* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),支持中文,必须字段 */
+            },
+            function (err, data) {
+                console.log(err || data.Url);
+                if(err){
+                    resolve('')
+                }else {
+                    resolve(data.Url)
+                }
+            })
     })
     })
-    console.log('签名完成----------------------------'+newUrl)
-    console.log(newUrl)
-    return newUrl
+
 }
 }