From 6e730d49ada749407307e4d0df07e60a3b94acbe Mon Sep 17 00:00:00 2001
From: Anne_LXM <54163582+anne-lxm@users.noreply.github.com>
Date: Sat, 27 Jan 2024 16:50:20 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9uni-app-x=20web?=
=?UTF-8?q?=E7=AB=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/index/index.uvue | 248 +++++++++---------
uni_modules/uni-id-pages-x/init.uts | 41 ++-
.../userinfo/realnameAuth/realnameAuth.uvue | 5 +-
.../pages/userinfo/userinfo.uvue | 17 +-
4 files changed, 156 insertions(+), 155 deletions(-)
diff --git a/pages/index/index.uvue b/pages/index/index.uvue
index cf03100..5c8344f 100644
--- a/pages/index/index.uvue
+++ b/pages/index/index.uvue
@@ -1,141 +1,131 @@
-
-
-
-
- {{openName}}
-
+
+
+
+
+ {{openName}}
+
-
-
-
- 手机验证码登录
-
-
-
- 账号密码登录
-
-
-
-
- 一键登录
-
-
+
+
+
+ 手机验证码登录
+
+
+
+ 账号密码登录
+
+
+
+
+ 一键登录
+
+
-
-
+
+
diff --git a/uni_modules/uni-id-pages-x/init.uts b/uni_modules/uni-id-pages-x/init.uts
index 1011fea..727309c 100644
--- a/uni_modules/uni-id-pages-x/init.uts
+++ b/uni_modules/uni-id-pages-x/init.uts
@@ -3,7 +3,6 @@
// 导入配置
import config from '@/uni_modules/uni-id-pages-x/config.uts'
-
import {state} from '@/uni_modules/uni-id-pages-x/store.uts';
// uni-id的云对象
@@ -11,7 +10,9 @@ const uniIdCo = uniCloud.importObject('uni-id-co', {
customUI: true
})
// 用户配置的登录方式、是否打开调试模式
-const loginTypes = config.getArray('loginTypes');
+const configLoginTypes = config.getArray('loginTypes');
+const loginTypes = configLoginTypes == null ? [] as string[] : configLoginTypes;
+
const debug = config.getBoolean('debug') as boolean;
// #ifdef APP && ( uniVersion > 3.99 || uniVersion == 3.99)
@@ -27,7 +28,7 @@ export default async function () {
uniIdCo.getSupportedLoginType().then((res:UTSJSONObject)=>{
// console.log('7777res',res)
let supportedLoginType = res.getArray('supportedLoginType')
- console.log('supportedLoginType: ',supportedLoginType);
+ // console.log('supportedLoginType: ',supportedLoginType);
if(supportedLoginType == null){
supportedLoginType = []
}
@@ -47,17 +48,31 @@ export default async function () {
"weixinMobile": 'weixin'
};
// 遍历客户端配置的登录方式,与服务端比对。并在错误时抛出错误提示
- const list = loginTypes?.filter((type:string):boolean =>type != 'smsCode')
- ?.filter((type:string):boolean =>{
- let currentType = data.getString(type);
- if(currentType == null){
- currentType = ""
+ // const list = loginTypes?.filter((type:string):boolean =>type != 'smsCode')
+ // ?.filter((type:string):boolean =>{
+ // let currentType = data.getString(type);
+ // if(currentType == null){
+ // currentType = ""
+ // }
+ // return supportedLoginType?.includes(currentType) != true
+ // })
+ const list:Array = [];
+ console.log('loginTypes: ',loginTypes);
+ for (let i = 0; i < loginTypes.length; i++) {
+ const type = loginTypes[i];
+ if (type != 'smsCode') {
+ let currentType = data.getString(type);
+ if (currentType === null) {
+ currentType = '';
+ }
+ if (!supportedLoginType.includes(currentType)) {
+ list.push(type);
+ }
}
- return supportedLoginType?.includes(currentType) != true
- })
- if (list?.length != 0) {
+ }
+ if (list.length != 0) {
console.error(
- `错误:前端启用的登录方式:${list?.join(',')};没有在服务端完成配置。配置文件路径:"/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json"`
+ `错误:前端启用的登录方式:${list.join(',')};没有在服务端完成配置。配置文件路径:"/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json"`
)
}
})
@@ -65,7 +80,7 @@ export default async function () {
// #ifdef APP
// 如果uni-id-pages配置的登录功能有一键登录,有则执行预登录(异步)
- if (loginTypes != null && loginTypes.includes('univerify')) {
+ if (loginTypes.includes('univerify')) {
const myUniverify = new Univerify()
const univerifyManager = uni.getUniverifyManager();
univerifyManager.preLogin({
diff --git a/uni_modules/uni-id-pages-x/pages/userinfo/realnameAuth/realnameAuth.uvue b/uni_modules/uni-id-pages-x/pages/userinfo/realnameAuth/realnameAuth.uvue
index 08d3975..c2363a8 100644
--- a/uni_modules/uni-id-pages-x/pages/userinfo/realnameAuth/realnameAuth.uvue
+++ b/uni_modules/uni-id-pages-x/pages/userinfo/realnameAuth/realnameAuth.uvue
@@ -222,9 +222,10 @@
uni.removeStorage({
key: tempFrvInfoKey
})
- } catch (e: UniCloudError) {
+ } catch (e: Error) {
+ const error = e as UniCloudError
this.verifyFail = true
- this.verifyFailTitle = e.errMsg
+ this.verifyFailTitle = error.errMsg
console.error(JSON.stringify(e))
}
uni.hideLoading()
diff --git a/uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue b/uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue
index 0bbc03e..b7d6cbe 100644
--- a/uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue
+++ b/uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue
@@ -58,12 +58,13 @@
-