提交 9a6056d7 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

调整一键登录自定义授权页以及隐私协议页面

上级 9473b8a0
<template> <template>
<view class="background"> <view class="background">
<view class="container"> <view class="container">
<view class="nav"> <view class="nav">
<text class="left_icon" @click="onBack()">{{backIcon}}</text> <view class="left_content">
</view> <text class="left_icon" @click="onBack()">{{backIcon}}</text>
<web-view class="web_container" :src="url"></web-view> </view>
</view>
</view> <view class="title_content">
<text class="title">{{title}}</text>
</view>
</view>
<web-view class="web_container" :src="url"></web-view>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
url: '', url: '',
backIcon:'\ue601' title: '',
} animationType: 'slide-out-bottom',
}, backIcon: '\ue601'
onLoad(options : OnLoadOptions) { }
this.url = options["url"] as string; },
}, onLoad(options : OnLoadOptions) {
methods: { this.url = options["url"] as string;
onBack(){ this.title = options["title"] as string;
console.log('click onback'); this.animationType = options["animationType"] as string;
uni.closeDialogPage({ },
dialogPage: this.$page, methods: {
animationType:'slide-out-right', onBack() {
success(res) { uni.closeDialogPage({
console.log('closeThisDialog success', res) dialogPage: this.$page,
}, animationType: this.animationType,
fail(err) { success(res) {
console.log('closeThisDialog fail', err) console.log('closeThisDialog success', res)
} },
}) fail(err) {
} console.log('closeThisDialog fail', err)
} }
} })
}
}
}
</script> </script>
<style> <style>
.background { .background {
background-color: #007aff; background-color: #007aff;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.nav{
height: 45px; .nav {
width: 100%; height: 45px;
position: relative; width: 100%;
flex-direction: row; position: relative;
justify-content: space-between; flex-direction: row;
height: 45px; justify-content: space-between;
} height: 45px;
.left_icon{ }
.left_content {
justify-content: center;
align-items: center;
width: 40px;
height: 100%;
}
.left_icon {
color: white;
top: 5px;
height: 100%;
font-family: uni-icon;
font-size: 26px;
}
.title_content {
position: absolute;
height: 100%;
top: 0;
bottom: 0;
left: 45px;
right: 45px;
flex-direction: row;
justify-content: center;
align-items: center;
}
.title {
color: white; color: white;
top: 5px; font-size: 17px;
left: 15px; }
justify-content: center;
align-items: center; .container {
width: 40px; padding-top: var(--status-bar-height);
height: 100%; width: 100%;
font-family: uni-icon; position: absolute;
font-size: 26px; height: 100%;
} }
.container{
padding-top: var(--status-bar-height);
width: 100%;
position: absolute;
height: 100%;
}
.web_container{
background-color: #f1f1f1;
padding-top: 10px;
flex: 1;
width: 100%;
}
.web_container {
background-color: #f1f1f1;
padding-top: 10px;
flex: 1;
width: 100%;
}
</style> </style>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</view> </view>
<button id="login-button" class="login-button" @click="loginIn">本机号码一键登录</button> <button id="login-button" class="login-button" @click="loginIn">本机号码一键登录</button>
<view class="privacy"> <view class="privacy">
<checkbox id="privacy-checkbox" class="privacy-checkbox" ref="privacy-checkbox" :checked="true"></checkbox> <checkbox id="privacy-checkbox" class="privacy-checkbox" ref="privacy-checkbox" :checked="false"></checkbox>
<text class="privacy-normal-text">登录即同意</text> <text class="privacy-normal-text">登录即同意</text>
<text id="privacy-text" class="privacy-text" @click="openLink">{{privacyName}}</text> <text id="privacy-text" class="privacy-text" @click="openLink">{{privacyName}}</text>
</view> </view>
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
}) })
}, },
openLink() { openLink() {
let url = '/pages/API/get-univerify-manager/full-webview-page?url=' + this.privacyUrl; let url = '/pages/API/get-univerify-manager/full-webview-page?url=' + this.privacyUrl + '&title=' + this.privacyName + '&animationType=slide-out-bottom';
uni.openDialogPage({ uni.openDialogPage({
url: url, url: url,
animationType: 'slide-in-right', animationType: 'slide-in-bottom',
success(res) { success(res) {
console.log("打开隐私协议"); console.log("打开隐私协议");
}, },
...@@ -81,14 +81,19 @@ ...@@ -81,14 +81,19 @@
console.log(res); console.log(res);
this.takePhoneNumber(res.accessToken, res.openId); this.takePhoneNumber(res.accessToken, res.openId);
}, },
fail: (error : LoginFail) => { fail: (error : LoginFail) => {
console.error("login fail => " + error);
if (error.errCode == 40001){ if (error.errCode == 40001){
uni.showToast({ uni.showToast({
title:"请同意服务条款", title:"请同意服务条款",
icon:'none', icon:'none',
duration:2000 duration:2000
}) })
}else if(error.errCode == 40002){
uni.showToast({
title:"授权页不符合规范",
icon:'none',
duration:2000
})
}else{ }else{
const errorMsg = JSON.parseObject(error.cause?.cause?.message ?? "")?.getString("errorDesc") ?? error.errMsg; const errorMsg = JSON.parseObject(error.cause?.cause?.message ?? "")?.getString("errorDesc") ?? error.errMsg;
uni.showToast({ uni.showToast({
...@@ -96,11 +101,7 @@ ...@@ -96,11 +101,7 @@
icon:'none', icon:'none',
duration:2000 duration:2000
}) })
// uni.showModal({
// title: '登录失败',
// content: errorMsg,
// showCancel: false
// });
} }
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册