BF-202210271038\Administrator 2 vuotta sitten
vanhempi
commit
af5ba07f7b

+ 1 - 0
api/login.js

@@ -4,3 +4,4 @@ const newsUrl = '/utility/'
 // 登陆
 export const login = (data) => request(newsUrl + 'one_click_login', 'post', { ...data },false)
 export const forgetPassword = (data) => request(newsUrl + 'forget_password', 'post', { ...data },false)
+export const register = (data) => request(newsUrl + 'register', 'post', { ...data },true)

+ 22 - 27
pages/login/localPhoneLogin.vue

@@ -1,7 +1,7 @@
 <template>
   <view>
     <en-nav @navHeight="setNavHeight" ></en-nav>
-    <view class="login-box" v-show="false" :style="{'height':'calc(100vh - '+navHeight+'px)'}">
+    <view class="login-box" v-show="isWap" :style="{'height':'calc(100vh - '+navHeight+'px)'}">
       <view class="login-top">
         <view class="login-title">
           <text class="title-item sys-color-black sys-weight-600">登录/注册</text>
@@ -9,7 +9,7 @@
         </view>
         <view class="local-txt sys-color-gray-9">本机号码登录</view>
         <view class="local-phone sys-color-black sys-weight-400">188****4188</view>
-        <view class="login-but sys-color-white sys-background-black" >一键登录</view>
+        <view class="login-but sys-color-white sys-background-black" @click="oneClickLogin('13900139001')">一键登录</view>
         <view @click="goToOther" class="other-phone sys-color-gray-6">其他手机号登录</view>
       </view>
       <view class="login-bottom">
@@ -31,14 +31,24 @@ export default {
   components: {OtherLogin, LoginAgreement, EnNav},
   data() {
     return {
-      navHeight:40
+      navHeight:40,
+      isWap:false
     }
   },
   onLoad(query) {
-    this.getPhoneNum()
+    //#ifdef APP-NVUE
+      this.getPhoneNum()
+    //#endif
+
+    //#ifndef APP-NVUE
+      this.isWap=true
+    //#endif
+
+
   },
   methods: {
     getPhoneNum(){
+      //#ifdef APP-NVUE
       let that=this
       uni.login({
         provider: 'univerify',
@@ -104,29 +114,11 @@ export default {
           that.goToOther()
         }
       })
-
+      //#endif
     },
     cloudGetPhoneNum(authResult){
       console.log('-------------')
-      tools.showLoading()
-      // uniCloud.getPhoneNumber({
-      //   provider: 'univerify',
-      //   appid: '__UNI__1B420CB', // 客户端callFunction时携带的AppId信息
-      //   apiKey: 'f904a759f52a6981744ed39813894cfc', // 在开发者中心开通服务并获取apiKey
-      //   apiSecret: 'ae475f1ed69608e527047f83c380303a', // 在开发者中心开通服务并获取apiSecret
-      //   access_token: authResult.access_token,
-      //   openid: authResult.openid
-      // }).then(res => {
-      //   tools.hideLoading()
-      //   console.log(res)
-      // }).catch(err=>{
-      //   tools.hideLoading()
-      //   tools.error('手机号码获取失败')
-      //   console.log(err)
-      //   setTimeout(()=>{
-      //     // this.goToOther()
-      //   },1500)
-      // })
+      //#ifdef APP-NVUE
       uniCloud.callFunction({
         name: 'getPhoneNumber', // 你的云函数名称
         data: {
@@ -134,7 +126,6 @@ export default {
           'openid': authResult.openid
         }
       }).then(res => {
-        tools.hideLoading()
         console.log(res)
         if(res.result.data.phoneNumber!==undefined){
           uni.setStorageSync('mobile', res.result.data.phoneNumber)
@@ -153,6 +144,7 @@ export default {
             this.goToOther()
         },1500)
       })
+      //#endif
     },
     oneClickLogin(mobile){
       login({'mobile':mobile}).then((res)=>{
@@ -160,8 +152,11 @@ export default {
         if(res.code===0){
             tools.setLoginData(res.data)
             setTimeout(()=>{
-              uni.switchTab({
-                'url':'/pages/index/index'
+              // uni.switchTab({
+              //   'url':'/pages/index/index'
+              // })
+              uni.navigateTo({
+                'url':'/pages/perfect/sexAndAge'
               })
             },1500)
         }else{

+ 1 - 1
pages/login/model/loginContent.nvue

@@ -34,7 +34,7 @@ export default {
     return {
       windowWidth:750,
       isCheck:false,
-      isPreLogin:false
+      isPreLogin:true
     }
   },
   watch: {},

+ 2 - 0
pages/perfect/cards.vue

@@ -70,6 +70,7 @@ 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";
 export default {
   components: {EnPopup, LoginAgreement, EnNav},
   data() {
@@ -108,6 +109,7 @@ export default {
     },
     setNextStep(){
       if(this.isOK){
+       
         uni.switchTab({
           'url':'/pages/index/index'
         })

+ 2 - 0
pages/perfect/nickname.vue

@@ -47,9 +47,11 @@ export default {
   },
   watch:{
     'nickname':function (){
+      uni.setStorageSync('nickname', this.nickname)
       this.verifyIsOK()
     },
     'password':function (){
+      uni.setStorageSync('password', this.password)
       this.verifyIsOK()
     },
   },

+ 3 - 0
pages/perfect/sexAndAge.vue

@@ -136,6 +136,7 @@ export default {
     },
     setNextStep(){
       if(this.isOK){
+        uni.setStorageSync('dateOfBirth', this.ageObj.year+'-'+this.ageObj.month+'-'+this.ageObj.day)
         uni.navigateTo({
           'url':'/pages/perfect/nickname'
         })
@@ -189,6 +190,8 @@ export default {
       },500)
     },
     setSex(sex){
+      console.log(sex)
+      uni.setStorageSync('sex', sex+'')
       this.sex=sex
     },
     verifyIsOK(){

+ 4 - 1
service/ajax.js

@@ -1,6 +1,9 @@
 import tools from "@/service/tools";
 import store from '@/store'
-let BASE_URL ='https://' + process.uniEnv.baseUrl;
+let BASE_URL =''
+//#ifdef APP-NVUE
+BASE_URL ='https://' + process.uniEnv.baseUrl;
+//#endif
 
 
 /**