You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
177 lines
4.5 KiB
177 lines
4.5 KiB
<template>
|
|
<view>
|
|
<view class="bureau">
|
|
<view style="display: flex;justify-content:center;align-items: center;margin-bottom: 43px;">
|
|
<img src="/static/index/logo.png" alt="">
|
|
<p class="bureaup">小关软测宝</p>
|
|
</view>
|
|
<button v-if="!isselect" class="button-g" type='primary' @click="logindl">一键快捷登录</button>
|
|
<button v-else class="button-g" type='primary' open-type="getPhoneNumber" withCredentials="true"
|
|
lang="zh_CN" @getphonenumber="onGetPhoneNumber">一键快捷登录</button>
|
|
<button v-if="!isselect" class="button-g"
|
|
style="border: 1px solid #197BEF;color:#197BEF;background-color: transparent!important;margin-bottom: 10px;"
|
|
@click="logindl">手机验证码登录</button>
|
|
<button v-else class="button-g" @click="phonelog"
|
|
style="border: 1px solid #197BEF;color:#197BEF;background-color: transparent!important;margin-bottom: 10px;">手机验证码登录</button>
|
|
<view style="display: flex;align-items: center;">
|
|
<u-checkbox-group>
|
|
<u-checkbox v-model="isselect" shape="circle" active-color="#197BEF;">
|
|
<span style="color: #808080;font-size: .8rem;">我已阅读并同意</span>
|
|
</u-checkbox>
|
|
</u-checkbox-group>
|
|
<!-- <P> -->
|
|
<span @click="openfile(1)" style="color: #197BEF;">《用户协议》</span>和
|
|
<span @click="openfile(2)" style="color: #197BEF;">《隐私政策》</span>
|
|
<!-- </P> -->
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
uproute: '',
|
|
value: '',
|
|
isselect: false
|
|
}
|
|
},
|
|
onLoad() {
|
|
let pages = getCurrentPages()
|
|
let prevPage = pages[pages.length - 2];
|
|
if (prevPage) {
|
|
this.uproute = prevPage.route
|
|
}
|
|
console.log('prevPage----', pages, prevPage.route)
|
|
},
|
|
methods: {
|
|
logindl() {
|
|
if (!this.isselect) {
|
|
uni.showToast({
|
|
title: '请勾选协议',
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
return;
|
|
}
|
|
},
|
|
phonelog() {
|
|
uni.navigateTo({
|
|
url: '/pages/personal/phonelogin'
|
|
})
|
|
},
|
|
//打开文件
|
|
openfile(type) {
|
|
if (type == 1) {
|
|
uni.navigateTo({
|
|
url: '/pages/personal/userAgreemen'
|
|
})
|
|
} else {
|
|
uni.navigateTo({
|
|
url: '/pages/personal/privacy'
|
|
})
|
|
}
|
|
// uni.downloadFile({
|
|
// url: url,
|
|
// success: function (res) {
|
|
// var filePath = res.tempFilePath;
|
|
// uni.openDocument({
|
|
// filePath: filePath,
|
|
// success: function (res) {
|
|
// console.log('打开文档成功');
|
|
// }
|
|
// });
|
|
// }
|
|
// });
|
|
},
|
|
//获取手机号
|
|
onGetPhoneNumber(event) {
|
|
// console.log('调用手机号1---',event)
|
|
const _this = this
|
|
uni.login({
|
|
success(logininfo) {
|
|
let data = {
|
|
code: event.detail.code,
|
|
openidCode: logininfo.code
|
|
}
|
|
let wxloginurl = '/wx/auth/getPhoneNumber';
|
|
_this.http.quickPost(`${wxloginurl}`, data).then(res => {
|
|
if (!res.data.StatusCode) {
|
|
// console.log('快捷登录成 功',res.data)
|
|
uni.setStorageSync('register', res.data.isRegister)
|
|
uni.setStorageSync('testerStatus', res.data.userInfo?.testerStatus)
|
|
uni.setStorageSync('accessToken', res.data.token)
|
|
uni.setStorageSync('wxUserInfo', res.data.userInfo)
|
|
uni.setStorageSync('email', res.data.userInfo?.email)
|
|
uni.setStorageSync('avatar', res.data.userInfo?.avatar)
|
|
uni.setStorageSync('nickName', res.data.userInfo?.nickName)
|
|
uni.setStorageSync('sex', res.data.userInfo?.sex)
|
|
uni.showToast({
|
|
title: '登录成功',
|
|
icon: 'success',
|
|
duration: 1000
|
|
});
|
|
if (_this.uproute == 'pages/personal/personal' || _this.uproute ==
|
|
'pages/personal/login') {
|
|
uni.switchTab({
|
|
url: '/pages/personal/personal'
|
|
})
|
|
|
|
} else {
|
|
setTimeout(() => {
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
}, 1000)
|
|
}
|
|
}
|
|
})
|
|
|
|
}
|
|
})
|
|
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.bureau {
|
|
width: 80%;
|
|
border-radius: 10rpx;
|
|
text-align: center;
|
|
margin: 23vh auto;
|
|
}
|
|
|
|
.bureau img {
|
|
width: 70px;
|
|
height: 58px;
|
|
margin-right: 5px;
|
|
}
|
|
|
|
.bureaup {
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
color: #197BEF;
|
|
margin-left: 5px;
|
|
}
|
|
|
|
.button-g {
|
|
height: 80rpx;
|
|
background-color: #197BEF !important;
|
|
border-radius: 10rpx;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
color: #FFFFFF;
|
|
font-size: 33rpx;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.u-checkbox__label {
|
|
margin-right: 0 !important;
|
|
margin-left: 5px !important;
|
|
}
|
|
</style> |