提交 05a2bca1 编写于 作者: L linju

213

上级 32203119
......@@ -20,28 +20,26 @@
}, {
"path": "uni_modules/uni-login-page/pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationStyle": "custom",
// "backgroundColor": "transparent",
"backgroundColor": "transparent",
"app-plus": {
"animationType": "fade-in",
"background": "transparent",
"popGesture": "none",
"titleNView":false
// "navigationBarTitleText": "",
// "navigationBarBackgroundColor": "#FFFFFF",
// "app-plus": {
// "titleNView": {
// "buttons": [{
// "text": "帮助",
// "type": "none",
// "fontSize": "16px",
// "width": "60px"
// }]
// }
"background": "transparent",
"popGesture": "none"
}
}
// "navigationBarTitleText": "",
// "navigationBarBackgroundColor": "#FFFFFF",
// "app-plus": {
// "titleNView": {
// "buttons": [{
// "text": "帮助",
// "type": "none",
// "fontSize": "16px",
// "width": "60px"
// }]
// }
}, {
"path": "pages/search/search",
"style": {
......
<template>
<view class="content">
<view class="quick-login-box">
<view class="item" v-for="({text,logo,name},index) in providerList" :key="index" @click="login(name)">
<image class="logo" :src="logo" mode="widthFix"></image>
<text class="login-title">{{text}}</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
config: {
"weixin": {
"text": "微信登陆",
"logo": "../../static/login/img/weixin.png"
},
"qq": {
"text": "QQ登陆",
"logo": "../../static/login/img/qq.png"
},
"apple": {
"text": "苹果登陆",
"logo": "../../static/login/img/apple.png"
},
"sinaweibo": {
"text": "微博登录",
"logo": "../../static/login/img/sinaweibo.png"
},
"univerify": {
"text": "一键登陆",
"logo": "../../static/login/img/univerify.png"
}
},
providerList: [],
univerifyStyle: {
"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
"backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
}
}
},
onLoad() {
uni.getProvider({
"service": "oauth",
success: res => {
this.providerList = res.provider.map((name) => {
return {...this.config[name],name}
})
},
fail: (err) => {
console.error('获取服务供应商失败:' + JSON.stringify(err));
}
})
},
methods: {
login(type) {
uni.login({
"provider": type,
"univerifyStyle":this.univerifyStyle,
success: e => {
console.log(e);
this.quickLogin(e.authResult,type)
},
fail: (err) => {
console.log(err);
if(err.errCode===30002){
}
}
});
},
quickLogin(authResult,type){
//请勿直接使用authResult中的unionid或openid直接用于登陆,前端的数据都是不可靠的
console.log({...authResult,type});
uniCloud.callFunction({//联网验证登陆
"name": "user",
"data": {
"action": "quickLogin",
"params": {...authResult,type}
},
success: (e) => {
console.log(e.result);
uni.showModal({
content: JSON.stringify(e.result),
showCancel: false
});
if(type=='univerify'){
uni.closeAuthView()
}
},
fail: (err) => {
console.log(err);
if(err.errCode===30002){
}
}
})
}
}
}
</script>
<style scoped>
.quick-login-box {
flex-direction: row;
width: 750rpx;
justify-content: space-around;
}
.item {
flex-direction: column;
justify-content: center;
align-items: center;
height: 200rpx;
}
.logo {
width: 60rpx;
height: 60rpx;
}
.login-title {
font-size: 26rpx;
}
</style>
\ No newline at end of file
<template>
<view class="wrap" :class="{'hidden':!isShow}">
<uni-nav-bar left-icon="back" right-text="帮助" :statusBar="true" :border="false"></uni-nav-bar>
<view v-if="isShow" class="wrap-content">
<view class="wrap" v-show="isShow">
<uni-nav-bar @clickLeft="back" left-icon="back" right-text="帮助" :statusBar="true" :border="false"></uni-nav-bar>
<view class="wrap-content">
<view class="content">
<!-- 顶部文字 -->
<text class="content-top-title">登陆后即可展示自己</text>
......@@ -34,7 +34,7 @@
</view>
<!-- 登录按钮弹窗 -->
<login-action-sheet ref="loginActionSheet"></login-action-sheet>
<uni-quick-login @univerifyEnd="isShow = 1"></uni-quick-login>
<uni-quick-login></uni-quick-login>
</view>
</template>
......@@ -42,7 +42,7 @@
export default {
data() {
return {
isShow:true,
isShow:false,
link: [{
text: '用户协议',
to: '/baidu.com'
......@@ -54,6 +54,11 @@
currenPhoneArea: '+86',
phoneNumber: ''
}
},
onReady() {
setTimeout(()=>{
this.isShow = true
},1500);
},
computed: {
canGetShortMsg() {
......@@ -81,12 +86,18 @@
},
openLoginList() {
this.$refs.loginActionSheet.open();
},
back(){
uni.navigateBack()
}
}
}
</script>
<style>
page {
background: transparent;
}
/* #ifndef APP-NVUE */
page{
display: flex;
......@@ -125,9 +136,6 @@
font-weight: 600;
padding-top: 50rpx;
}
.hidden,page{
background-color: transparent;
}
@import url("../../common/myStyle.css");
.lgnin-iknow {
......
<template>
<view class="quick-login-box" v-if="isShow">
<view class="quick-login-box">
<view class="item" v-for="({text,logo,name},index) in providerList" :key="index" @click="login(name)">
<image class="logo" :src="logo" mode="widthFix"></image>
<text class="login-title">{{text}}</text>
......@@ -11,7 +11,6 @@
export default {
data() {
return {
isShow:false,
config: {
"weixin": {
"text": "微信登陆",
......@@ -78,8 +77,6 @@
console.log(err);
if(err.errCode===30002){
console.log('你手动关闭了,一键登陆');
this.isShow = 1
this.$emit('univerifyEnd')
}
}
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册