完成登录的基本流程
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
<view class="u-margin-top-56">
|
||||
<!-- #ifdef MP -->
|
||||
<view class="u-margin-bottom-32">
|
||||
<u-button @click="fastLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false" shape="circle">快捷登录</u-button>
|
||||
<u-button @click="mpLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false" shape="circle">快捷登录</u-button>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view>
|
||||
@ -40,7 +40,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<mplogin-popup v-model="loginPopup" @close="loginPopup = false" @update="handleSubmitInfo"/>
|
||||
<mplogin v-model="mpLoginPopup" @close="mpLoginPopup = false" @update="handleSubmitInfo"/>
|
||||
<mobile-login v-model="mobilePopup" @close="mobilePopup = false" @update="handleSubmitMobile"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -49,7 +50,8 @@
|
||||
import { uploadFile } from "@/utils/tools";
|
||||
import {
|
||||
authLogin,
|
||||
updateUser
|
||||
updateUser,
|
||||
mobileLogin
|
||||
} from '@/api/app'
|
||||
import { getWxCode, getUserInfo } from '@/utils/login'
|
||||
import { isWeixinClient, currentPage, client } from '@/utils/tools'
|
||||
@ -63,7 +65,8 @@
|
||||
allow: false
|
||||
},
|
||||
loginData: {},
|
||||
loginPopup: false
|
||||
mpLoginPopup: false,
|
||||
mobilePopup: false
|
||||
}
|
||||
},
|
||||
|
||||
@ -76,7 +79,7 @@
|
||||
...mapActions(['getUser']),
|
||||
|
||||
// 小程序快捷登录
|
||||
async fastLogin() {
|
||||
async mpLogin() {
|
||||
if (!this.form.allow) {
|
||||
this.$toast({
|
||||
title: "请您先阅读并同意服务协议和隐私政策",
|
||||
@ -103,7 +106,7 @@
|
||||
if (code == 1) {
|
||||
if (data.is_new_user) {
|
||||
uni.hideLoading()
|
||||
this.loginPopup = true
|
||||
this.mpLoginPopup = true
|
||||
this.loginData = data
|
||||
} else {
|
||||
this.loginHandle(data)
|
||||
@ -123,6 +126,27 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 手机登录
|
||||
mobileLogin() {
|
||||
if (!this.form.allow) {
|
||||
return this.$toast({
|
||||
title: "请您先阅读并同意服务协议和隐私政策",
|
||||
})
|
||||
}
|
||||
this.mobilePopup = true
|
||||
},
|
||||
|
||||
// 更新新注册的用户信息
|
||||
async handleSubmitMobile(e) {
|
||||
mobileLogin({
|
||||
mobile: e.mobile
|
||||
}).then((res) => {
|
||||
if (res.code == 1) {
|
||||
this.loginHandle(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 登录结果处理
|
||||
async loginHandle(data) {
|
||||
this.LOGIN(data)
|
||||
@ -147,12 +171,6 @@
|
||||
})
|
||||
//#endif
|
||||
},
|
||||
|
||||
mobileLogin() {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/login/mobileLogin'
|
||||
// })
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['appConfig']),
|
||||
|
||||
Reference in New Issue
Block a user