小程序扫码登录

master
gongfuxiang 2023-11-03 15:48:05 +08:00
parent 15bdf66c26
commit 0c0aaede94
7 changed files with 209 additions and 37 deletions

10
App.vue
View File

@ -2031,6 +2031,16 @@
});
return;
}
//
var thirdpartylogin_arr = ['/thirdpartylogin-scan-index-', 'plugins/index/pluginsname/thirdpartylogin/pluginscontrol/scan/pluginsaction/index'];
var thirdpartylogin_ret = self.web_url_value_mate(value, thirdpartylogin_arr);
if(thirdpartylogin_ret.status == 1 && thirdpartylogin_ret.value != null) {
uni.navigateTo({
url: '/pages/plugins/thirdpartylogin/index/index?id='+thirdpartylogin_ret.value,
});
return;
}
// url
self.open_web_view(value);

View File

@ -1057,6 +1057,18 @@
}
}
]
},
{
"root": "pages/plugins/thirdpartylogin",
"pages": [{
"path": "index/index",
"style": {
"disableScroll": true,
"enablePullDownRefresh": false,
"navigationBarTitleText": "授权登录"
}
}
]
}
],
"globalStyle": {

View File

@ -1,55 +1,55 @@
page {
page {
background: #fff;
}
/**
*
*/
/**
*
*/
.content {
padding-top: 8%;
padding-top: 8%;
}
.content .icon {
width: 150rpx;
height: 150rpx !important;
.content .icon {
width: 150rpx;
height: 150rpx !important;
}
/**
*
*/
.form-content {
padding: 2% 40rpx 0 40rpx;
*/
.form-content {
padding: 2% 40rpx 0 40rpx;
}
.form-content .form-item,
.form-content .code,
.form-content .verify {
border-bottom: solid 1px #f7f7f7;
}
}
.form-content .form-item,
.form-content .code input,
.form-content .verify input {
font-size: 28rpx;
color: #4e4e4e;
height: 40px;
.form-content .verify input {
font-size: 28rpx;
color: #4e4e4e;
height: 40px;
line-height: 40px;
border-radius: 0;
border-radius: 0;
}
.form-content .code input,
.form-content .verify input {
width: 63%;
}
.form-content .code .verify-submit {
width: 35%;
height: 35px;
line-height: 35px;
top: 0;
right: 0;
}
.form-content .verify .verify-image {
width: 35%;
height: 35px;
line-height: 35px;
top: 0;
right: 0;
.form-content .code .verify-submit {
width: 35%;
height: 35px;
line-height: 35px;
top: 0;
right: 0;
}
.form-content .verify .verify-image {
width: 35%;
height: 35px;
line-height: 35px;
top: 0;
right: 0;
}
.opt-type-list text:not(:last-child) {
margin-right: 50rpx;

View File

@ -1,4 +1,4 @@
.img-user {
.scanpay-logo {
width: 92rpx;
height: 92rpx !important;
}

View File

@ -4,7 +4,7 @@
<view class="padding-main">
<block v-if="(data.scanpay_info || null) !== null">
<view class="flex-row align-c margin-top-main margin-bottom-xl">
<image v-if="data.scanpay_info.logo" :src="data.scanpay_info.logo" mode="widthFix" class="circle img-user br margin-right-main" />
<image v-if="data.scanpay_info.logo" :src="data.scanpay_info.logo" mode="widthFix" class="circle scanpay-logo br margin-right-main" />
<div class="flex-1 flex-width flex-row align-c">
<text class="text-size fw-b single-text">{{ data.scanpay_info.name }}</text>
<text v-if="(data.scanpay_info.alias || null) !== null" class="cr-white badge tc margin-left-sm">{{ data.scanpay_info.alias }}</text>
@ -175,14 +175,15 @@
this.setData({
params: params || {},
});
},
onShow() {
this.init();
},
onShow() {},
//
onPullDownRefresh() {
this.get_data();
this.init();;
},
methods: {
@ -430,4 +431,4 @@
<style scoped>
@import './index.css';
</style>
</style>

View File

@ -0,0 +1,7 @@
page {
background: #fff;
}
.user-avatar {
width: 180rpx;
height: 180rpx !important;
}

View File

@ -0,0 +1,142 @@
<template>
<view>
<view v-if="(data || null) !== null && (user || null) !== null" class="tc padding-main padding-top-xxxl">
<image :src="user.avatar" mode="widthFix" class="circle br user-avatar" />
<view class="margin-top-xs">{{user.user_name_view}}</view>
<block v-if="data.status == 1">
<view class="margin-top-xxl">
<view class="fw-b">授权登录{{application_title}}</view>
<view class="cr-grey margin-top-sm">若非本人操作请忽略申请</view>
</view>
<view class="margin-top-xxxl padding-top-xl">
<button type="default" class="bg-main br-main cr-white round text-size" @tap="status_record(2)"></button>
<button type="default" class="bg-yellow br-yellow cr-white round text-size margin-top-lg" @tap="exit_event"></button>
</view>
</block>
<block v-else>
<view class="margin-top-xxl">
<iconfont name="icon-qiandao-dqxz" size="28rpx" class="cr-green circle"></iconfont>
<text class="margin-left-xs">已登录成功</text>
</view>
<view class="margin-top-xxxl padding-top-xl">
<button type="default" class="bg-yellow br-yellow cr-white round text-size margin-top-lg" @tap="exit_event"></button>
</view>
</block>
</view>
<view v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</view>
</view>
</template>
<script>
const app = getApp();
import componentNoData from '../../../../components/no-data/no-data';
export default {
data() {
return {
//
data_list_loding_status: 1,
data_list_loding_msg: '',
params: {},
application_title: app.globalData.get_application_title(),
user : null,
data: null
};
},
components: {
componentNoData,
},
onLoad(params) {
params['id'] = 200;
this.setData({
params: params || {},
});
},
onShow() {
this.init();
},
methods: {
init() {
//
this.status_record(0);
//
var user = app.globalData.get_user_info(this, 'init');
if (user != false) {
//
if (app.globalData.user_is_need_login(user)) {
uni.navigateTo({
url: '/pages/login/login?event_callback=init',
});
} else {
this.setData({
user: user
});
//
this.status_record(1);
}
}
},
//
status_record(status) {
// loding
uni.showLoading({
title: '加载中...',
});
//
var post_data = {
...this.params,
status: status
};
uni.request({
url: app.globalData.get_request_url('statusrecord', 'scan', 'thirdpartylogin'),
method: 'POST',
data: post_data,
dataType: 'json',
success: (res) => {
uni.hideLoading();
if (res.data.code == 0) {
this.setData({
data: res.data.data,
data_list_loding_msg: '',
data_list_loding_status: 0,
});
} else {
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.globalData.is_login_check(res.data, this, 'status_record', status)) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
uni.hideLoading();
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: '服务器请求出错',
});
app.globalData.showToast('服务器请求出错');
},
});
},
// 退
exit_event(e) {
uni.exitMiniProgram();
}
},
};
</script>
<style>
@import './index.css';
</style>