<template>
<view class="page-bg">
<view class="main-container">
<view class="tl-mt-388">
我们将通过<text class="tl-blue">《隐私政策》</text>和<text class="tl-blue">《用户协议》</text>帮助你了解我们收集、使用、存储和共享个人信息的情况,特别是我们所采集的个人信息类型与用途的对应关系。此外,你还能了解到你所享有的权利及实现途径,以及我们为保护你的个人信息所采用的安全技术。你需充分阅读并理解本政策的内容,若你同意,请点击下方按钮开始接受我们的服务。
</view>
{{jsCode}}
{{iv}}
{{encryptedData}}
<view class="mt-640">
<button class="tl-btn-630" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信账号快捷登录</button>
<button class="tl-btn-630-border" @tap="goMy">不同意并退出</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
jsCode: '',
iv: '',
encryptedData: '',
}
},
onLoad(){
let self = this;
self.login();
},
methods: {
login() {
uni.login({
success: (res) => {
console.log("login", JSON.stringify(res));
this.jsCode = res.code;
//console.log('res.code',res.code)
}
})
},
//获取手机号授权——@zxyuns2021-02-26
getPhoneNumber(e) {
uni.showLoading({})
console.log(e.detail.errMsg);
console.log('iv',e.detail.iv);
console.log('encryptedData',e.detail.encryptedData);
this.iv = e.detail.iv
this.encryptedData = e.detail.encryptedData
let self = this;
//后台解密获取用户的手机号码
let params = {
jsCode: self.jsCode,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
}
this.$http.post('getPhoneNumber', {}).then(([error, res]) => {
uni.hideLoading();
if(res.data.code == 200) {
self.phone = res.RESULT.phoneNumber;
self.login();//重新去调一次登录,更新jsCode
} else {
this.$common.toast(res.data.msg)
}
})
/*request({
url: inter.getPhoneNumber,
data: {
jsCode: self.jsCode,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
},
callback: (res) => {
console.log('res', res)
uni.hideLoading();
if (res.CODE == 0) {
self.phone = res.RESULT.phoneNumber;
self.login();//重新去调一次登录,更新jsCode
} else {
uni.showToast({
title: res.MESSAGE,
mask: true,
icon: 'none'
});
}
}
})*/
},
goToPublish() {
uni.navigateTo({
url: '/pages/publish/publish'
})
},
// 去个人中心
goMy(){
uni.switchTab({ url:"/pages/my/my" })
},
}
}
</script>
<style>
.page-bg {
width: 100vw;
height: auto;
overflow: hidden;
background-size: 750rpx auto;
background-color: #fff;
}
.main-container {
margin: 0 auto;
display: flex;
flex-direction: column;
}
.tl-mt-388{
padding: 62rpx 40rpx;
}
.tl-blue{
font-size: 28rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #2B75AB;
}
.tl-btn-630{
width: 630rpx;
height: 88rpx;
line-height: 88rpx;
background: #F2C827;
border-radius: 44rpx;
font-size: 28rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #464646;
}
.tl-btn-630-border{
width: 630rpx;
height: 88rpx;
line-height: 88rpx;
border: 2rpx solid #979797;
border-radius: 44rpx;
font-size: 28rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #464646;
margin-top: 20rpx;
}
.mt-640{
margin-top: 340rpx;
}
</style>
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END