12.12 页面风格改版,增加事件详情相关概念网页跳转,增加绑定手机号功能
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
<navBar leftText="登录" :hideNavBg="true" :backBlack="true"></navBar>
|
||||
<image class="logo" :style="'margin-top:'+contentTop+'px;'" src="/static/image/login/logo.png" mode="widthFix"></image>
|
||||
<view class="loginTitle">欢迎登录价值前沿平台</view>
|
||||
<view class="btn oneClickLogin" @click="clickOneClickLogin()">授权手机号一键登录</view>
|
||||
<view class="btn oneClickLogin relative" @click="isBindPhone?clickOneClickLogin():''">
|
||||
授权手机号一键登录
|
||||
<button v-if="!isBindPhone" class="absolute" open-type="getPhoneNumber" @getphonenumber="getPhoneNumData"></button>
|
||||
</view>
|
||||
<view class="btn codeLogin" @click="clickCodeLogin()">使用短信验证登录</view>
|
||||
<view class="agreeProtocolC fixed flexCenter">
|
||||
<view class="agreeC" @click="clickAgree()">
|
||||
@@ -17,19 +20,73 @@
|
||||
|
||||
<script>
|
||||
import { inject } from 'vue';
|
||||
import { loginByWx } from '@/request/api';
|
||||
import { loginByWx, wxBindPhone } from '@/request/api';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
contentTop:'',
|
||||
isAgree:false
|
||||
isAgree:false,
|
||||
isBindPhone:true, //是否绑定过手机号
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.contentTop = inject('navHeight')+230/750*inject('windowWidth')
|
||||
this.getIsBindPhoneData()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取手机号
|
||||
* @param {Object} e
|
||||
*/
|
||||
getPhoneNumData(e)
|
||||
{
|
||||
console.log(e)
|
||||
if (e.detail.errMsg == 'getPhoneNumber:ok') {
|
||||
uni.login({
|
||||
provider:'weixin',
|
||||
success(res) {
|
||||
console.log(res.code)
|
||||
let param = {code:res.code,isJson:1}
|
||||
loginByWx(param).then(res=>{
|
||||
if(res.code==200)
|
||||
{
|
||||
let token = res.data.token
|
||||
uni.setStorageSync('token',token)
|
||||
let param = {code:e.detail.code}
|
||||
wxBindPhone(param).then(res=>{
|
||||
if (res.code==200) {
|
||||
uni.showToast({
|
||||
title:res.message,
|
||||
})
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}, 1000);
|
||||
}else
|
||||
uni.showToast({
|
||||
title:res.message,
|
||||
icon:'none'
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
}else
|
||||
uni.showToast({
|
||||
title:res.message,
|
||||
icon:"none"
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 点击一键登录
|
||||
*/
|
||||
@@ -51,10 +108,8 @@
|
||||
loginByWx(param).then(res=>{
|
||||
if(res.code==200)
|
||||
{
|
||||
uni.showToast({
|
||||
title:res.message,
|
||||
})
|
||||
uni.setStorageSync('token',res.data.token)
|
||||
let token = res.data.token
|
||||
uni.setStorageSync('token',token)
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
@@ -73,7 +128,6 @@
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
/**
|
||||
* 点击验证码登录
|
||||
@@ -99,6 +153,35 @@
|
||||
uni.navigateTo({
|
||||
url:'/pages/mine/web/web?type='+type
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取是否绑定过手机号
|
||||
*/
|
||||
getIsBindPhoneData()
|
||||
{
|
||||
let that = this
|
||||
uni.login({
|
||||
provider:'weixin',
|
||||
success(res) {
|
||||
console.log(res.code)
|
||||
let param = {code:res.code,isJson:1}
|
||||
loginByWx(param).then(res=>{
|
||||
if(res.code==200)
|
||||
{
|
||||
that.isBindPhone = res.data.user.phone?true:false
|
||||
}else
|
||||
uni.showToast({
|
||||
title:res.message,
|
||||
icon:"none"
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +215,13 @@
|
||||
background-color: #F97316;
|
||||
margin-top: 60rpx;
|
||||
color: white;
|
||||
button
|
||||
{
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.btn.codeLogin
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user