提交 3eb8e562 编写于 作者: 雪洛's avatar 雪洛

Merge branch 'master' into dev

...@@ -6,7 +6,7 @@ node_modules/ ...@@ -6,7 +6,7 @@ node_modules/
uni_modules_tools/copy uni_modules_tools/copy
/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json /uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/custom-password.js /uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/custom-password.js
/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-uni-cloud-s2s/config.json
.idea .idea
.vscode .vscode
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/.eslintrc.js uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/.eslintrc.js
......
{ {
"name" : "uni-id-pages", "name" : "uni-id-pages",
"appid" : "", "appid" : "__UNI__ECAF623",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
}, },
/* 模块配置 */ /* 模块配置 */
"modules" : { "modules" : {
"OAuth" : {} "OAuth" : {},
"FacialRecognitionVerify": {}
}, },
/* 应用发布信息 */ /* 应用发布信息 */
"distribute" : { "distribute" : {
...@@ -57,7 +58,7 @@ ...@@ -57,7 +58,7 @@
"oauth" : { "oauth" : {
"univerify" : {}, "univerify" : {},
"weixin" : { "weixin" : {
"appid" : "", "appid" : "wxffdd8fa6ec4ef2a0",
"UniversalLinks" : "https://static-9f641af8-e860-44e5-b18f-f68dd8fe3fe4.bspapp.com/uni-universallinks/__UNI__0B1B311/" "UniversalLinks" : "https://static-9f641af8-e860-44e5-b18f-f68dd8fe3fe4.bspapp.com/uni-universallinks/__UNI__0B1B311/"
}, },
"apple" : {} "apple" : {}
......
...@@ -24,12 +24,14 @@ ...@@ -24,12 +24,14 @@
"navigationBarTitleText": "绑定手机号码" "navigationBarTitleText": "绑定手机号码"
} }
}, },
// #ifndef MP-WEIXIN
{ {
"path": "uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage", "path": "uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
// #endif
{ {
"path": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", "path": "uni_modules/uni-id-pages/pages/login/login-withoutpwd",
"style": { "style": {
...@@ -54,6 +56,7 @@ ...@@ -54,6 +56,7 @@
"navigationBarTitleText": "注册" "navigationBarTitleText": "注册"
} }
}, },
// #ifndef MP-WEIXIN
{ {
"path": "uni_modules/uni-id-pages/pages/register/register-admin", "path": "uni_modules/uni-id-pages/pages/register/register-admin",
"style": { "style": {
...@@ -61,6 +64,7 @@ ...@@ -61,6 +64,7 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
// #endif
{ {
"path": "uni_modules/uni-id-pages/pages/register/register-by-email", "path": "uni_modules/uni-id-pages/pages/register/register-by-email",
"style": { "style": {
...@@ -97,6 +101,12 @@ ...@@ -97,6 +101,12 @@
"navigationBarTitleText": "设置密码", "navigationBarTitleText": "设置密码",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},{
"path": "uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify",
"style": {
"navigationBarTitleText": "实名认证",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {
...@@ -119,6 +129,7 @@ ...@@ -119,6 +129,7 @@
"uniIdRouter": { "uniIdRouter": {
"loginPage": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", "loginPage": "uni_modules/uni-id-pages/pages/login/login-withoutpwd",
"needLogin": [ "needLogin": [
"pages/index/index",
"uni_modules/uni-id-pages/pages/userinfo/userinfo" "uni_modules/uni-id-pages/pages/userinfo/userinfo"
], ],
"resToLogin": true "resToLogin": true
......
<template> <template>
<view class="content"> <view class="content">
<button @click="toUserInfoPage">个人资料</button> <button @click="toUserInfoPage">个人资料</button>
<uni-forms-item label="登录方式"> <uni-forms-item label="登录方式" labelWidth="70">
<uni-data-checkbox :multiple="false" v-model="loginType" :localdata="loginTypeOption"></uni-data-checkbox> <uni-data-checkbox :multiple="false" v-model="loginType" :localdata="loginTypeOption"></uni-data-checkbox>
</uni-forms-item> </uni-forms-item>
<button @click="toLogin">前往登录</button> <button @click="toLogin">前往登录</button>
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
"value": "smsCode", "value": "smsCode",
"text": "手机验证码" "text": "手机验证码"
}, { }, {
"value": "apple", "value": "apple",
"text": "苹果登录" "text": "苹果登录"
}, { }, {
"value": "weixinMobile", "value": "weixinMobile",
"text": "微信手机号登录" "text": "微信手机号登录"
}] }]
} }
}, },
onLoad() {}, onLoad() {},
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=" + this.loginType url: "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=" + this.loginType,
animationType:"none",
animationDuration:0
}) })
} }
}, },
......
## 1.2.2(2023-01-28)
- 修复 运行/打包 控制台警告问题
## 1.2.1(2022-09-05) ## 1.2.1(2022-09-05)
- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473) - 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
## 1.2.0(2021-11-19) ## 1.2.0(2021-11-19)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* @value error 红色 * @value error 红色
* @property {String} inverted = [true|false] 是否无需背景颜色 * @property {String} inverted = [true|false] 是否无需背景颜色
* @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+ * @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上 * @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
* @value rightTop 右上 * @value rightTop 右上
* @value rightBottom 右下 * @value rightBottom 右下
* @value leftTop 左上 * @value leftTop 左上
...@@ -191,12 +191,13 @@ ...@@ -191,12 +191,13 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
font-feature-settings: "tnum";
min-width: 20px;
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
flex-direction: row; flex-direction: row;
height: 20px; height: 20px;
min-width: 20px;
padding: 0 4px; padding: 0 4px;
line-height: 18px; line-height: 18px;
color: #fff; color: #fff;
...@@ -206,7 +207,6 @@ ...@@ -206,7 +207,6 @@
border: 1px solid #fff; border: 1px solid #fff;
text-align: center; text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif; font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-feature-settings: "tnum";
font-size: $bage-size; font-size: $bage-size;
/* #ifdef H5 */ /* #ifdef H5 */
z-index: 999; z-index: 999;
......
{ {
"id": "uni-badge", "id": "uni-badge",
"displayName": "uni-badge 数字角标", "displayName": "uni-badge 数字角标",
"version": "1.2.1", "version": "1.2.2",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [ "keywords": [
"", "",
......
## 0.6.4(2023-01-16)
- 修复 部分情况下APP端无法获取验证码的问题
## 0.6.3(2023-01-11)
- 修复 抖音小程序无法显示的Bug
- 修复 刷新时兼容 device_uuid
## 0.6.1(2022-06-23) ## 0.6.1(2022-06-23)
- 修复:部分返回值,不符合响应体规范的问题 - 修复:部分返回值,不符合响应体规范的问题
## 0.6.0(2022-05-27) ## 0.6.0(2022-05-27)
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
} else { } else {
uni.showToast({ uni.showToast({
title: 'scene不能为空', title: 'scene不能为空',
icon: 'none' icon: 'none'
}); });
} }
}, },
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
.catch(e => { .catch(e => {
uni.showToast({ uni.showToast({
title: e.message, title: e.message,
icon: 'none' icon: 'none'
}); });
}).finally(e => { }).finally(e => {
this.loging = false this.loging = false
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
this.$refs.popup.close() this.$refs.popup.close()
}, },
confirm() { confirm() {
if(!this.val||this.val.length < 4){ if(!this.val){
return uni.showToast({ return uni.showToast({
title: '请填写验证码', title: '请填写验证码',
icon: 'none' icon: 'none'
......
{ {
"id": "uni-captcha", "id": "uni-captcha",
"displayName": "uni-captcha", "displayName": "uni-captcha",
"version": "0.6.1", "version": "0.6.4",
"description": "云端一体图形验证码组件", "description": "云端一体图形验证码组件",
"keywords": [ "keywords": [
"captcha", "captcha",
...@@ -14,11 +14,7 @@ ...@@ -14,11 +14,7 @@
"engines": { "engines": {
"HBuilderX": "^3.1.0" "HBuilderX": "^3.1.0"
}, },
"dcloudext": { "dcloudext": {
"category": [
"uniCloud",
"云函数模板"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
...@@ -35,7 +31,8 @@ ...@@ -35,7 +31,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "" "npmurl": "",
"type": "unicloud-template-function"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
......
{ {
"name": "uni-captcha", "name": "uni-captcha",
"version": "0.2.2", "version": "0.6.4",
"description": "uni-captcha", "description": "uni-captcha",
"main": "index.js", "main": "index.js",
"homepage": "https://ext.dcloud.net.cn/plugin?id=4048", "homepage": "https://ext.dcloud.net.cn/plugin?id=4048",
......
module.exports = {
"image-captcha":{
"width": 150, //图片宽度
"height": 44, //图片高度
"background": "#FFFAE8", //验证码背景色,设置空字符`''`不使用背景颜色
// "size": 4, //验证码长度,最多 6 个字符
// "noise": 4, //验证码干扰线条数
// "color": false, //字体是否使用随机颜色,当设置`background`后恒为`true`
// "fontSize": 40, //字体大小
// "ignoreChars": '', //忽略那些字符
// "mathExpr": false, //是否使用数学表达式
// "mathMin": 1, //表达式所使用的最小数字
// "mathMax": 9, //表达式所使用的最大数字
// "mathOperator": '' //表达式所使用的运算符,支持 `+`、`-`。不传随机使用
// "expiresDate":180 //验证码过期时间(s)
}
}
\ No newline at end of file
## 1.0.1(2023-03-02)
- 修复 方法名错误
{
"id": "uni-cloud-s2s",
"displayName": "服务空间与服务器安全通讯模块",
"version": "1.0.1",
"description": "用于解决服务空间与服务器通讯时互相信任问题",
"keywords": [
"安全通讯",
"服务器请求云函数",
"云函数请求服务器"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "unicloud-template-function",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file
# uni-cloud-s2s
文档见:[外部服务器如何与uniCloud安全通讯](https://uniapp.dcloud.net.cn/uniCloud/uni-cloud-s2s.html)
'use strict'; Object.defineProperty(exports, '__esModule', { value: !0 }); const e = require('crypto'); const t = require('path'); function s (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e } }require('fs'); const o = s(e); const n = s(t); const i = 'uni-cloud-s2s'; const r = { code: 5e4, message: 'Config error' }; const c = { code: 51e3, message: 'Access denied' }; class a extends Error {constructor (e) { super(e.message), this.errMsg = e.message || '', this.code = this.errCode = e.code, this.errSubject = e.subject, this.forceReturn = e.forceReturn || !1, this.cause = e.cause, Object.defineProperties(this, { message: { get () { return this.errMsg }, set (e) { this.errMsg = e } } }) }toJSON (e = 0) { if (!(e >= 10)) return e++, { errCode: this.errCode, errMsg: this.errMsg, errSubject: this.errSubject, cause: this.cause && this.cause.toJSON ? this.cause.toJSON(e) : this.cause } }} const d = Object.prototype.toString; const h = 50002; const u = Object.create(null); ['string', 'boolean', 'number', 'null'].forEach(e => { u[e] = function (t, s) { if ((function (e) { return d.call(e).slice(8, -1).toLowerCase() }(t)) !== e) return { code: h, message: `${s} is invalid` } } }); const f = 'Unicloud-S2s-Authorization'; class g {constructor (e) { const { config: t } = e || {}; this.config = t; const { connectCode: s } = t || {}; if (this.connectCode = s, !s || typeof s !== 'string') throw new a({ subject: i, code: r.code, message: 'Invalid connectCode in config' }) }getHeadersValue (e = {}, t, s) { const o = Object.keys(e || {}).find(e => e.toLowerCase() === t.toLowerCase()); return o ? e[o] : s }verifyHttpInfo (e) { const t = this.getHeadersValue(e.headers, f, ''); const [s = '', o = ''] = t.split(' '); if (s.toLowerCase() === 'CONNECTCODE'.toLowerCase() && o === this.config.connectCode) return !0; throw new a({ subject: i, code: c.code, message: `Invalid CONNECTCODE in headers['${f}']` }) }getSecureHeaders (e) { return { [f]: `CONNECTCODE ${this.config.connectCode}` } }} function l (e) { return function (t) { const { content: s, signKey: n } = t || {}; return o.default.createHash(e).update(s + '\n' + n).digest('hex') } } const p = { md5: l('md5'), sha1: l('sha1'), sha256: l('md5'), 'hmac-sha256': function (e) { const { content: t, signKey: s } = e || {}; return o.default.createHmac('sha256', s).update(t).digest('hex') } }; function m (e) { const { timestamp: t, data: s = {}, signKey: o, hashMethod: n = 'hmac-sha256' } = e || {}; const i = p[n]; const r = ['number', 'string', 'boolean']; const c = Object.keys(s).sort(); const a = []; for (let e = 0; e < c.length; e++) { const t = c[e]; const o = s[t]; const n = typeof o; r.includes(n) && a.push(`${t}=${o}`) } return i({ content: `${t}\n${a.join('&')}`, signKey: o }) } class w {constructor (e) { const { config: t } = e || {}; this.config = t; const { signKey: s, hashMethod: o = 'hmac-sha256', timeDiffTolerance: n = 60 } = t; if (!p[o]) throw new a({ subject: i, code: r.code, message: `Invalid hashMethod in config, expected "md5", "sha1", "sha256" or "hmac-sha256", got "${o}"` }); if (!s || typeof s !== 'string') throw new a({ subject: i, code: r.code, message: 'Invalid signKey in config' }); this.signKey = s, this.hashMethod = o, this.timeDiffTolerance = n }getHttpHeaders (e) { return e.headers || {} }getHeadersValue (e, t, s) { const o = Object.keys(e || {}).find(e => e.toLowerCase() === t.toLowerCase()); return o ? e[o] : s }getHttpData (e) { const t = e.httpMethod.toLowerCase(); const s = this.getHttpHeaders(e); const o = this.getHeadersValue(s, 'Content-Type', ''); if (t === 'get') return e.queryStringParameters; if (t !== 'post') throw new a({ subject: i, code: c.code, message: `Invalid http method, expected "POST" or "get", got "${t}"` }); if (o.indexOf('application/json') === 0) return JSON.parse(e.body); if (o.indexOf('application/x-www-form-urlencoded') === 0) return require('querystring').parse(e.body); throw new a({ subject: i, code: c.code, message: `Invalid content type of POST method, expected "application/json" or "application/x-www-form-urlencoded", got "${o}"` }) }verifyHttpInfo (e) { const t = e.headers || {}; const s = this.getHeadersValue(t, 'Unicloud-S2s-Timestamp', '0'); let [o, n] = this.getHeadersValue(t, 'Unicloud-S2s-Signature', '').split(' '); if (o = o.toLowerCase(), o !== this.hashMethod) throw new a({ subject: i, code: c.code, message: `Invalid hash method, expected "${this.hashMethod}", got "${o}"` }); const r = parseInt(s); const d = Date.now(); if (Math.abs(d - r) > 1e3 * this.timeDiffTolerance) throw new a({ subject: i, code: c.code, message: `Invalid timestamp, server timestamp is ${d}, ${r} exceed max timeDiffTolerance(${this.timeDiffTolerance} seconds)` }); return m({ timestamp: r, data: this.getHttpData(e), signKey: this.signKey, hashMethod: this.hashMethod }) === n }getSecureHeaders (e) { const { data: t } = e || {}; const s = Date.now(); const o = m({ timestamp: s, data: t, signKey: this.signKey, hashMethod: this.hashMethod }); return { 'Unicloud-S2s-Timestamp': s + '', 'Unicloud-S2s-Signature': this.hashMethod + ' ' + o } }} const y = require('uni-config-center')({ pluginId: i }); class b {constructor () { this.config = y.config(); const e = n.default.resolve(require.resolve('uni-config-center'), i, 'config.json'); if (!this.config) throw new a({ subject: i, code: r.code, message: `${i} config required, please check your config file: ${e}` }); if (this.config.type === 'connectCode') this.verifier = new g({ config: this.config }); else { if (!(function (e) { return e.type === 'sign' }(this.config))) throw new a({ subject: i, code: r.code, message: `Invalid ${i} config, expected policy is "code" or "sign", got ${this.config.policy}` }); this.verifier = new w({ config: this.config }) } }verifyHttpInfo (e) { if (!e) throw new a({ subject: i, code: c.code, message: 'Access denied, httpInfo required' }); return this.verifier.verifyHttpInfo(e) }getSecureHeaders (e) { return this.verifier.getSecureHeaders(e) }}exports.getSecureHeaders = function (e) { return (new b()).getSecureHeaders(e) }, exports.verifyHttpInfo = function (e) { const t = (new b()).verifyHttpInfo(e); if (!t) throw new a({ subject: i, code: c.code, message: c.message }); return t }
{
"name": "uni-cloud-s2s",
"version": "1.0.1",
"description": "",
"keywords": [],
"author": "DCloud",
"main": "index.js",
"dependencies": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
\ No newline at end of file
## 0.0.2(2021-04-16) ## 0.0.3(2022-11-11)
- 修改插件package信息 - 修复 config 方法获取根节点为数组格式配置时错误的转化为了对象的Bug
## 0.0.1(2021-03-15) ## 0.0.2(2021-04-16)
- 初始化项目 - 修改插件package信息
## 0.0.1(2021-03-15)
- 初始化项目
{ {
"id": "uni-config-center", "id": "uni-config-center",
"displayName": "uni-config-center", "displayName": "uni-config-center",
"version": "0.0.2", "version": "0.0.3",
"description": "uniCloud 配置中心", "description": "uniCloud 配置中心",
"keywords": [ "keywords": [
"配置", "配置",
...@@ -11,11 +11,7 @@ ...@@ -11,11 +11,7 @@
"engines": { "engines": {
"HBuilderX": "^3.1.0" "HBuilderX": "^3.1.0"
}, },
"dcloudext": { "dcloudext": {
"category": [
"uniCloud",
"云函数模板"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
...@@ -32,7 +28,8 @@ ...@@ -32,7 +28,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "" "npmurl": "",
"type": "unicloud-template-function"
}, },
"directories": { "directories": {
"example": "../../../scripts/dist" "example": "../../../scripts/dist"
...@@ -73,8 +70,12 @@ ...@@ -73,8 +70,12 @@
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
} }
} }
} }
} }
} }
{ {
"name": "uni-config-center", "name": "uni-config-center",
"version": "0.0.2", "version": "0.0.3",
"description": "配置中心", "description": "配置中心",
"main": "index.js", "main": "index.js",
"keywords": [], "keywords": [],
......
## 1.1.1(2022-09-19) ## 1.1.6(2023-01-28)
- 修复,输入后回车,change 事件触发两次,[详情](https://ask.dcloud.net.cn/question/152149) - 新增 keyboardheightchange 事件,可监听键盘高度变化
## 1.1.5(2022-11-29)
- 优化 主题样式
## 1.1.4(2022-10-27)
- 修复 props 中背景颜色无默认值的bug
## 1.1.0(2022-06-30) ## 1.1.0(2022-06-30)
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容 - 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
- 新增 clear 事件,点击右侧叉号图标触发 - 新增 clear 事件,点击右侧叉号图标触发
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发 - 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等 - 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
-
## 1.0.5(2022-06-07) ## 1.0.5(2022-06-07)
- 优化 clearable 显示策略 - 优化 clearable 显示策略
## 1.0.4(2022-06-07) ## 1.0.4(2022-06-07)
- 优化 clearable 显示策略 - 优化 clearable 显示策略
## 1.0.3(2022-05-20) ## 1.0.3(2022-05-20)
- 修复 关闭图标某些情况下无法取消的bug
- 修复 关闭图标某些情况下无法取消的 bug
## 1.0.2(2022-04-12) ## 1.0.2(2022-04-12)
- 修复 默认值不生效的bug
- 修复 默认值不生效的 bug
## 1.0.1(2022-04-02) ## 1.0.1(2022-04-02)
- 修复 value不能为0的bug
- 修复 value 不能为 0 的 bug
## 1.0.0(2021-11-19) ## 1.0.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput) - 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
## 0.1.4(2021-08-20) ## 0.1.4(2021-08-20)
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug - 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
## 0.1.3(2021-08-11) ## 0.1.3(2021-08-11)
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 - 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
## 0.1.2(2021-07-30) ## 0.1.2(2021-07-30)
- 优化 vue3下事件警告的问题
- 优化 vue3 下事件警告的问题
## 0.1.1 ## 0.1.1
- 优化 errorMessage 属性支持 Boolean 类型 - 优化 errorMessage 属性支持 Boolean 类型
## 0.1.0(2021-07-13) ## 0.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.0.16(2021-06-29) ## 0.0.16(2021-06-29)
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug - 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
## 0.0.15(2021-06-21) ## 0.0.15(2021-06-21)
- 修复 passwordIcon 属性拼写错误的 bug - 修复 passwordIcon 属性拼写错误的 bug
## 0.0.14(2021-06-18) ## 0.0.14(2021-06-18)
- 新增 passwordIcon 属性,当type=password时是否显示小眼睛图标
- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标
- 修复 confirmType 属性不生效的问题 - 修复 confirmType 属性不生效的问题
## 0.0.13(2021-06-04) ## 0.0.13(2021-06-04)
- 修复 disabled 状态可清出内容的 bug - 修复 disabled 状态可清出内容的 bug
## 0.0.12(2021-05-12) ## 0.0.12(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 0.0.11(2021-05-07) ## 0.0.11(2021-05-07)
- 修复 input-border 属性不生效的问题 - 修复 input-border 属性不生效的问题
## 0.0.10(2021-04-30) ## 0.0.10(2021-04-30)
- 修复 ios 遮挡文字、显示一半的问题 - 修复 ios 遮挡文字、显示一半的问题
## 0.0.9(2021-02-05) ## 0.0.9(2021-02-05)
- 调整为uni_modules目录规范
- 调整为 uni_modules 目录规范
- 优化 兼容 nvue 页面 - 优化 兼容 nvue 页面
{ {
"id": "uni-easyinput", "id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框", "displayName": "uni-easyinput 增强输入框",
"version": "1.1.1", "version": "1.1.6",
"description": "Easyinput 组件是对原生input组件的增强", "description": "Easyinput 组件是对原生input组件的增强",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.4.9(2023-02-10)
- 修复 required 参数无法动态绑定
## 1.4.8(2022-08-23) ## 1.4.8(2022-08-23)
- 优化 根据 rules 自动添加 required 的问题 - 优化 根据 rules 自动添加 required 的问题
## 1.4.7(2022-08-22) ## 1.4.7(2022-08-22)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<view class="uni-forms-item" <view class="uni-forms-item"
:class="['is-direction-' + localLabelPos ,border?'uni-forms-item--border':'' ,border && isFirstBorder?'is-first-border':'']"> :class="['is-direction-' + localLabelPos ,border?'uni-forms-item--border':'' ,border && isFirstBorder?'is-first-border':'']">
<slot name="label"> <slot name="label">
<view class="uni-forms-item__label" :class="{'no-label':!label && !isRequired}" <view class="uni-forms-item__label" :class="{'no-label':!label && !required}"
:style="{width:localLabelWidth,justifyContent: localLabelAlign}"> :style="{width:localLabelWidth,justifyContent: localLabelAlign}">
<text v-if="isRequired" class="is-required">*</text> <text v-if="required" class="is-required">*</text>
<text>{{label}}</text> <text>{{label}}</text>
</view> </view>
</slot> </slot>
...@@ -126,7 +126,6 @@ ...@@ -126,7 +126,6 @@
data() { data() {
return { return {
errMsg: '', errMsg: '',
isRequired: false,
userRules: null, userRules: null,
localLabelAlign: 'left', localLabelAlign: 'left',
localLabelWidth: '65px', localLabelWidth: '65px',
...@@ -275,7 +274,7 @@ ...@@ -275,7 +274,7 @@
if (errShowType === 'toast') { if (errShowType === 'toast') {
uni.showToast({ uni.showToast({
title: result.errorMessage || '校验错误', title: result.errorMessage || '校验错误',
icon: 'none' icon: 'none'
}); });
} }
if (errShowType === 'modal') { if (errShowType === 'modal') {
...@@ -315,7 +314,6 @@ ...@@ -315,7 +314,6 @@
this.localLabelWidth = this._labelWidthUnit(labelWidth) this.localLabelWidth = this._labelWidthUnit(labelWidth)
// 标签位置 // 标签位置
this.localLabelPos = this._labelPosition() this.localLabelPos = this._labelPosition()
this.isRequired = this.required
// 将需要校验的子组件加入form 队列 // 将需要校验的子组件加入form 队列
this.form && type && childrens.push(this) this.form && type && childrens.push(this)
...@@ -351,8 +349,6 @@ ...@@ -351,8 +349,6 @@
this.validator = validator this.validator = validator
// 默认值赋予 // 默认值赋予
this.itemSetValue(_getDataValue(this.name, localData)) this.itemSetValue(_getDataValue(this.name, localData))
this.isRequired = this._isRequired()
}, },
unInit() { unInit() {
if (this.form) { if (this.form) {
...@@ -386,7 +382,7 @@ ...@@ -386,7 +382,7 @@
}, },
// 是否显示星号 // 是否显示星号
_isRequired() { _isRequired() {
// TODO 不根据规则显示 星号,考虑后续兼容 // TODO 不根据规则显示 星号,考虑后续兼容
// if (this.form) { // if (this.form) {
// if (this.form._isRequiredField(this.itemRules.rules || []) && this.required) { // if (this.form._isRequiredField(this.itemRules.rules || []) && this.required) {
......
{ {
"id": "uni-forms", "id": "uni-forms",
"displayName": "uni-forms 表单", "displayName": "uni-forms 表单",
"version": "1.4.8", "version": "1.4.9",
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据", "description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.0.14(2023-03-07)
- 修复 admin用户包含其他角色时未包含在token的Bug
## 1.0.13(2022-07-21) ## 1.0.13(2022-07-21)
- 修复 创建token时未传角色权限信息生成的token不正确的bug - 修复 创建token时未传角色权限信息生成的token不正确的bug
## 1.0.12(2022-07-15) ## 1.0.12(2022-07-15)
......
{ {
"id": "uni-id-common", "id": "uni-id-common",
"displayName": "uni-id-common", "displayName": "uni-id-common",
"version": "1.0.13", "version": "1.0.14",
"description": "包含uni-id token生成、校验、刷新功能的云函数公共模块", "description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
"keywords": [ "keywords": [
"uni-id-common", "uni-id-common",
...@@ -13,12 +13,8 @@ ...@@ -13,12 +13,8 @@
"engines": { "engines": {
"HBuilderX": "^3.1.0" "HBuilderX": "^3.1.0"
}, },
"dcloudext": { "dcloudext": {
"category": [ "sale": {
"uniCloud",
"云函数模板"
],
"sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
...@@ -34,7 +30,8 @@ ...@@ -34,7 +30,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "" "npmurl": "",
"type": "unicloud-template-function"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-config-center"], "dependencies": ["uni-config-center"],
......
{ {
"name": "uni-id-common", "name": "uni-id-common",
"version": "1.0.13", "version": "1.0.14",
"description": "uni-id token生成、校验、刷新", "description": "uni-id token生成、校验、刷新",
"main": "index.js", "main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id-common.html", "homepage": "https://uniapp.dcloud.io/uniCloud/uni-id-common.html",
......
function checkIdCard (idCardNumber) {
if (!idCardNumber || typeof idCardNumber !== 'string' || idCardNumber.length !== 18) return false
const coefficient = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
const checkCode = [1, 0, 'x', 9, 8, 7, 6, 5, 4, 3, 2]
const code = idCardNumber.substring(17)
let sum = 0
for (let i = 0; i < 17; i++) {
sum += Number(idCardNumber.charAt(i)) * coefficient[i]
}
return checkCode[sum % 11].toString() === code.toLowerCase()
}
export default checkIdCard
import { import {
store, mutations
mutations } from '@/uni_modules/uni-id-pages/common/store.js'
} from '@/uni_modules/uni-id-pages/common/store.js'
import config from '@/uni_modules/uni-id-pages/config.js' import config from '@/uni_modules/uni-id-pages/config.js'
let mixin = { const mixin = {
data() { data() {
return { return {
config, config,
...@@ -17,7 +16,7 @@ let mixin = { ...@@ -17,7 +16,7 @@ let mixin = {
// #endif // #endif
}, },
mounted() { mounted() {
this.isMounted = true; this.isMounted = true
}, },
onLoad(e) { onLoad(e) {
if (e.is_weixin_redirect) { if (e.is_weixin_redirect) {
...@@ -25,20 +24,20 @@ let mixin = { ...@@ -25,20 +24,20 @@ let mixin = {
mask: true mask: true
}) })
if( window.location.href.includes('#') ){ if (window.location.href.includes('#')) {
// 将url通过 ? 分割获取后面的参数字符串 再通过 & 将每一个参数单独分割出来 // 将url通过 ? 分割获取后面的参数字符串 再通过 & 将每一个参数单独分割出来
let paramsArr = window.location.href.split('?')[1].split('&') const paramsArr = window.location.href.split('?')[1].split('&')
paramsArr.forEach(item=>{ paramsArr.forEach(item => {
let arr = item.split('=') const arr = item.split('=')
if(arr[0] == 'code'){ if (arr[0] == 'code') {
e.code = arr[1] e.code = arr[1]
} }
}) })
} }
this.$nextTick(n => { this.$nextTick(n => {
console.log(this.$refs.uniFabLogin); // console.log(this.$refs.uniFabLogin);
this.$refs.uniFabLogin.login({ this.$refs.uniFabLogin.login({
code:e.code code: e.code
}, 'weixin') }, 'weixin')
}) })
} }
...@@ -46,6 +45,13 @@ let mixin = { ...@@ -46,6 +45,13 @@ let mixin = {
if (e.uniIdRedirectUrl) { if (e.uniIdRedirectUrl) {
this.uniIdRedirectUrl = decodeURIComponent(e.uniIdRedirectUrl) this.uniIdRedirectUrl = decodeURIComponent(e.uniIdRedirectUrl)
} }
// #ifdef MP-WEIXIN
if (getCurrentPages().length === 1) {
uni.hideHomeButton()
console.log('已隐藏:返回首页按钮');
}
// #endif
}, },
computed: { computed: {
needAgreements() { needAgreements() {
...@@ -85,4 +91,5 @@ let mixin = { ...@@ -85,4 +91,5 @@ let mixin = {
} }
} }
} }
export default mixin
export default mixin
...@@ -115,9 +115,10 @@ ...@@ -115,9 +115,10 @@
text-align: center; text-align: center;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
margin: 15px 0 0 0; margin: 15px 0 10px 0;
color: #FFF !important; color: #FFF !important;
border-radius: 5px; border-radius: 5px;
font-size: 16px;
} }
.uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{ .uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{
......
import pagesJson from '@/pages.json' import pagesJson from '@/pages.json'
import config from '@/uni_modules/uni-id-pages/config.js' import config from '@/uni_modules/uni-id-pages/config.js'
const uniIdCo = uniCloud.importObject("uni-id-co") const uniIdCo = uniCloud.importObject("uni-id-co")
const db = uniCloud.database(); const db = uniCloud.database();
const usersTable = db.collection('uni-id-users') const usersTable = db.collection('uni-id-users')
let hostUserInfo = uni.getStorageSync('uni-id-pages-userInfo')||{} let hostUserInfo = uni.getStorageSync('uni-id-pages-userInfo')||{}
console.log( hostUserInfo); // console.log( hostUserInfo);
const data = { const data = {
userInfo: hostUserInfo, userInfo: hostUserInfo,
hasLogin: Object.keys(hostUserInfo).length != 0 hasLogin: Object.keys(hostUserInfo).length != 0
} }
console.log('data', data); // console.log('data', data);
// 定义 mutations, 修改属性 // 定义 mutations, 修改属性
export const mutations = { export const mutations = {
// data不为空,表示传递要更新的值(注意不是覆盖是合并),什么也不传时,直接查库获取更新 // data不为空,表示传递要更新的值(注意不是覆盖是合并),什么也不传时,直接查库获取更新
async updateUserInfo(data = false) { async updateUserInfo(data = false) {
if (data) { if (data) {
usersTable.where('_id==$env.uid').update(data).then(e => { usersTable.where('_id==$env.uid').update(data).then(e => {
console.log(e); // console.log(e);
if (e.result.updated) { if (e.result.updated) {
uni.showToast({ uni.showToast({
title: "更新成功", title: "更新成功",
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
this.setUserInfo(data) this.setUserInfo(data)
} else { } else {
uni.showToast({ uni.showToast({
title: "没有改变", title: "没有改变",
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
}) })
} else { } else {
try { const uniIdCo = uniCloud.importObject("uni-id-co", {
let res = await usersTable.where("'_id' == $cloudEnv_uid") customUI: true
.field('mobile,nickname,username,email,avatar_file') })
.get() try {
console.log('fromDbData',res.result.data); let res = await usersTable.where("'_id' == $cloudEnv_uid")
this.setUserInfo(res.result.data[0]) .field('mobile,nickname,username,email,avatar_file')
} catch (e) { .get()
this.setUserInfo({},{cover:true})
console.error(e.message, e.errCode); const realNameRes = await uniIdCo.getRealNameInfo()
}
} // console.log('fromDbData',res.result.data);
}, this.setUserInfo({
async setUserInfo(data, {cover}={cover:false}) { ...res.result.data[0],
console.log('set-userInfo', data); realNameAuth: realNameRes
let userInfo = cover?data:Object.assign(store.userInfo,data) })
store.userInfo = Object.assign({},userInfo) } catch (e) {
store.hasLogin = Object.keys(store.userInfo).length != 0 this.setUserInfo({},{cover:true})
console.log('store.userInfo', store.userInfo); console.error(e.message, e.errCode);
uni.setStorage({ }
key: "uni-id-pages-userInfo", }
data:store.userInfo },
}) async setUserInfo(data, {cover}={cover:false}) {
return data // console.log('set-userInfo', data);
}, let userInfo = cover?data:Object.assign(store.userInfo,data)
async logout() { store.userInfo = Object.assign({},userInfo)
await uniIdCo.logout() store.hasLogin = Object.keys(store.userInfo).length != 0
uni.removeStorageSync('uni_id_token'); // console.log('store.userInfo', store.userInfo);
uni.setStorageSync('uni_id_token_expired', 0) uni.setStorageSync('uni-id-pages-userInfo', store.userInfo)
uni.redirectTo({ return data
url: `/${pagesJson.uniIdRouter?.loginPage ?? 'uni_modules/uni-id-pages/pages/login/login-withoutpwd'}`, },
}); async logout() {
uni.$emit('uni-id-pages-logout') // 1. 已经过期就不需要调用服务端的注销接口 2.即使调用注销接口失败,不能阻塞客户端
this.setUserInfo({},{cover:true}) if(uniCloud.getCurrentUserInfo().tokenExpired > Date.now()){
}, try{
await uniIdCo.logout()
loginBack (e = {}) { }catch(e){
const {uniIdRedirectUrl = ''} = e console.error(e);
let delta = 0; //判断需要返回几层 }
let pages = getCurrentPages(); }
// console.log(pages); uni.removeStorageSync('uni_id_token');
pages.forEach((page, index) => { uni.setStorageSync('uni_id_token_expired', 0)
if (pages[pages.length - index - 1].route.split('/')[3] == 'login') { uni.redirectTo({
delta++ url: `/${pagesJson.uniIdRouter && pagesJson.uniIdRouter.loginPage ? pagesJson.uniIdRouter.loginPage: 'uni_modules/uni-id-pages/pages/login/login-withoutpwd'}`,
} });
}) uni.$emit('uni-id-pages-logout')
// console.log('判断需要返回几层:', delta); this.setUserInfo({},{cover:true})
if (uniIdRedirectUrl) { },
return uni.reLaunch({
url: uniIdRedirectUrl loginBack (e = {}) {
}) const {uniIdRedirectUrl = ''} = e
} let delta = 0; //判断需要返回几层
// #ifdef H5 let pages = getCurrentPages();
if (e.loginType == 'weixin') { // console.log(pages);
console.log('window.history', window.history); pages.forEach((page, index) => {
return window.history.go(-3) if (pages[pages.length - index - 1].route.split('/')[3] == 'login') {
} delta++
// #endif }
})
if (delta) { // console.log('判断需要返回几层:', delta);
const page = pagesJson.pages[0] if (uniIdRedirectUrl) {
return uni.reLaunch({ return uni.redirectTo({
url: `/${page.path}` url: uniIdRedirectUrl,
}) fail: (err1) => {
} uni.switchTab({
url:uniIdRedirectUrl,
uni.navigateBack({ fail: (err2) => {
delta console.log(err1,err2)
}) }
}, })
loginSuccess(e = {}){ }
const { })
showToast = true, toastText = '登录成功', autoBack = true, uniIdRedirectUrl = '', passwordConfirmed }
} = e // #ifdef H5
console.log({ if (e.loginType == 'weixin') {
toastText, // console.log('window.history', window.history);
autoBack return window.history.go(-3)
}); }
if (showToast) { // #endif
uni.showToast({
title: toastText, if (delta) {
icon: 'none', const page = pagesJson.pages[0]
duration: 3000 return uni.reLaunch({
}); url: `/${page.path}`
} })
this.updateUserInfo() }
uni.$emit('uni-id-pages-login-success') uni.navigateBack({
delta
if (config.setPasswordAfterLogin && !passwordConfirmed) { })
return uni.redirectTo({ },
url: uniIdRedirectUrl ? `/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?uniIdRedirectUrl=${uniIdRedirectUrl}&loginType=${e.loginType}`: `/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?loginType=${e.loginType}`, loginSuccess(e = {}){
fail: (err) => { const {
console.log(err) showToast = true, toastText = '登录成功', autoBack = true, uniIdRedirectUrl = '', passwordConfirmed
} } = e
}) // console.log({toastText,autoBack});
} if (showToast) {
uni.showToast({
if (autoBack) { title: toastText,
this.loginBack(uniIdRedirectUrl) icon: 'none',
} duration: 3000
} });
}
} this.updateUserInfo()
// #ifdef VUE2 uni.$emit('uni-id-pages-login-success')
import Vue from 'vue'
// 通过Vue.observable创建一个可响应的对象 if (config.setPasswordAfterLogin && !passwordConfirmed) {
export const store = Vue.observable(data) return uni.redirectTo({
// #endif url: uniIdRedirectUrl ? `/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?uniIdRedirectUrl=${uniIdRedirectUrl}&loginType=${e.loginType}`: `/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?loginType=${e.loginType}`,
fail: (err) => {
// #ifdef VUE3 console.log(err)
import { }
reactive })
} from 'vue' }
// 通过Vue.observable创建一个可响应的对象
export const store = reactive(data) if (autoBack) {
// #endif this.loginBack({uniIdRedirectUrl})
}
}
}
// #ifdef VUE2
import Vue from 'vue'
// 通过Vue.observable创建一个可响应的对象
export const store = Vue.observable(data)
// #endif
// #ifdef VUE3
import {
reactive
} from 'vue'
// 通过Vue.observable创建一个可响应的对象
export const store = reactive(data)
// #endif
<template> <template>
<view @click="onClick" :style="{width,height}"> <view @click="onClick" :style="{width,height}" style="justify-content: center;">
<image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image> <image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image>
</view> </view>
</template> </template>
...@@ -46,13 +46,10 @@ ...@@ -46,13 +46,10 @@
watch: { watch: {
src:{ src:{
handler(src) { handler(src) {
// console.log(src);
// console.log(src.substring(0, 8));
if (src&&src.substring(0, 8) == "cloud://") { if (src&&src.substring(0, 8) == "cloud://") {
uniCloud.getTempFileURL({ uniCloud.getTempFileURL({
fileList: [src] fileList: [src]
}).then(res=>{ }).then(res=>{
// console.log(res);
this.cSrc = res.fileList[0].tempFileURL this.cSrc = res.fileList[0].tempFileURL
}) })
}else{ }else{
...@@ -61,9 +58,6 @@ ...@@ -61,9 +58,6 @@
}, },
immediate: true immediate: true
} }
},
async mounted() {
}, },
methods:{ methods:{
onClick(){ onClick(){
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
}, },
methods: { methods: {
popupConfirm(){ popupConfirm(){
// console.log("popupConfirm");
this.isAgree = true this.isAgree = true
retryFun() retryFun()
// this.$emit('popupConfirm') // this.$emit('popupConfirm')
......
<template> <template>
<view @click="uploadAvatarImg" class="box" :class="{'showBorder':border}" :style="{width,height,lineHeight:height}"> <button open-type="chooseAvatar" @chooseavatar="bindchooseavatar" @click="uploadAvatarImg" class="box" :class="{'showBorder':border}" :style="{width,height,lineHeight:height}">
<cloud-image v-if="avatar_file" :src="avatar_file.url" :width="width" :height="height"></cloud-image> <cloud-image v-if="avatar_file" :src="avatar_file.url" :width="width" :height="height"></cloud-image>
<uni-icons v-else :style="{width,height,lineHeight:height}" class="chooseAvatar" type="plusempty" size="30" <uni-icons v-else :style="{width,height,lineHeight:height}" class="chooseAvatar" type="plusempty" size="30"
color="#dddddd"></uni-icons> color="#dddddd"></uni-icons>
</view> </button>
</template> </template>
<script> <script>
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
async mounted() { async mounted() {
// #ifdef H5 // #ifdef H5
this.isPC = !['ios', 'android'].includes(uni.getSystemInfoSync().platform); this.isPC = !['ios', 'android'].includes(uni.getSystemInfoSync().platform);
console.log(' this.isPC', this.isPC, uni.getSystemInfoSync().platform);
// #endif // #endif
}, },
computed: { computed: {
...@@ -66,78 +65,111 @@ ...@@ -66,78 +65,111 @@
setAvatarFile(avatar_file) { setAvatarFile(avatar_file) {
// 使用 clientDB 提交数据 // 使用 clientDB 提交数据
mutations.updateUserInfo({avatar_file}) mutations.updateUserInfo({avatar_file})
},
async bindchooseavatar(res){
let avatarUrl = res.detail.avatarUrl
let avatar_file = {
extname: avatarUrl.split('.')[avatarUrl.split('.').length - 1],
name:'',
url:''
}
//上传到服务器
let cloudPath = this.userInfo._id + '' + Date.now()
avatar_file.name = cloudPath
try{
uni.showLoading({
title: "更新中",
mask: true
});
let {
fileID
} = await uniCloud.uploadFile({
filePath:avatarUrl,
cloudPath,
fileType: "image"
});
avatar_file.url = fileID
uni.hideLoading()
}catch(e){
console.error(e);
}
console.log('avatar_file',avatar_file);
this.setAvatarFile(avatar_file)
}, },
uploadAvatarImg(res) { uploadAvatarImg(res) {
console.log(this.hasLogin); // #ifdef MP-WEIXIN
if(!this.hasLogin){ return false // 微信小程序走 bindchooseavatar方法
return uni.navigateTo({ // #endif
url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd'
}) // #ifndef MP-WEIXIN
} if(!this.hasLogin){
const crop = { return uni.navigateTo({
quality: 100, url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd'
width: 600, })
height: 600, }
resize: true const crop = {
}; quality: 100,
uni.chooseImage({ width: 600,
count: 1, height: 600,
crop, resize: true
success: async (res) => { };
console.log(res); uni.chooseImage({
let tempFile = res.tempFiles[0], count: 1,
avatar_file = { crop,
// #ifdef H5 success: async (res) => {
extname: tempFile.name.split('.')[tempFile.name.split('.').length - 1], let tempFile = res.tempFiles[0],
// #endif avatar_file = {
// #ifndef H5 // #ifdef H5
extname: tempFile.path.split('.')[tempFile.path.split('.').length - 1] extname: tempFile.name.split('.')[tempFile.name.split('.').length - 1],
// #endif // #endif
}, // #ifndef H5
filePath = res.tempFilePaths[0] extname: tempFile.path.split('.')[tempFile.path.split('.').length - 1]
// #ifndef APP-PLUS // #endif
//非app端用前端组件剪裁头像,app端用内置的原生裁剪 },
if (!this.isPC) { filePath = res.tempFilePaths[0]
filePath = await new Promise((callback) => {
uni.navigateTo({ //非app端剪裁头像,app端用内置的原生裁剪
url: '/uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage?path=' + // #ifndef APP-PLUS
filePath + `&options=${JSON.stringify(crop)}`, filePath = await new Promise((callback) => {
animationType: "fade-in", // #ifdef H5
events: { if (!this.isPC) {
success: url => { uni.navigateTo({
callback(url) url: '/uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage?path=' +
} filePath + `&options=${JSON.stringify(crop)}`,
}, animationType: "fade-in",
complete(e) { events: {
console.log(e); success: url => {
} callback(url)
}); }
}) },
} complete(e) {
// #endif // console.log(e);
console.log(this.userInfo); }
let cloudPath = this.userInfo._id + '' + Date.now() });
avatar_file.name = cloudPath }
uni.showLoading({ // #endif
title: "更新中", })
mask: true // #endif
});
let { let cloudPath = this.userInfo._id + '' + Date.now()
fileID avatar_file.name = cloudPath
} = await uniCloud.uploadFile({ uni.showLoading({
filePath, title: "更新中",
cloudPath, mask: true
fileType: "image" });
}); let {
// console.log(result) fileID
avatar_file.url = fileID } = await uniCloud.uploadFile({
console.log({ filePath,
avatar_file cloudPath,
}); fileType: "image"
uni.hideLoading() });
this.setAvatarFile(avatar_file) avatar_file.url = fileID
} uni.hideLoading()
}) this.setAvatarFile(avatar_file)
}
})
// #endif
} }
} }
} }
...@@ -149,13 +181,15 @@ ...@@ -149,13 +181,15 @@
overflow: hidden; overflow: hidden;
} }
/* #endif */ /* #endif */
.box{
padding: 0;
}
.chooseAvatar { .chooseAvatar {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
/* #endif */ /* #endif */
border: dotted 1px #ddd;
border-radius: 10px; border-radius: 10px;
text-align: center; text-align: center;
padding: 1px; padding: 1px;
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
uni.showLoading({ mask: true }) uni.showLoading({ mask: true })
wx.checkSession({ wx.checkSession({
success() { success() {
console.log('session_key 未过期'); // console.log('session_key 未过期');
resolve() resolve()
uni.hideLoading() uni.hideLoading()
}, },
fail() { fail() {
console.log('session_key 已经失效,正在执行更新'); // console.log('session_key 已经失效,正在执行更新');
wx.login({ wx.login({
success({ success({
code code
...@@ -41,13 +41,11 @@ ...@@ -41,13 +41,11 @@
uniCloud.importObject("uni-id-co",{ uniCloud.importObject("uni-id-co",{
customUI:true customUI:true
}).loginByWeixin({code}).then(e=>{ }).loginByWeixin({code}).then(e=>{
console.log(e);
resolve() resolve()
}).catch(e=>{ }).catch(e=>{
console.log(e); console.log(e);
reject() reject()
}).finally(e=>{ }).finally(e=>{
console.log(e);
uni.hideLoading() uni.hideLoading()
}) })
}, },
...@@ -61,13 +59,10 @@ ...@@ -61,13 +59,10 @@
}) })
}, },
async bindMobileByMpWeixin(e) { async bindMobileByMpWeixin(e) {
console.log(e);
if (e.detail.errMsg == "getPhoneNumber:ok") { if (e.detail.errMsg == "getPhoneNumber:ok") {
console.log(e.detail);
//检查登录信息是否过期,否则通过重新登录刷新session_key //检查登录信息是否过期,否则通过重新登录刷新session_key
await this.beforeGetphonenumber() await this.beforeGetphonenumber()
uniIdCo.bindMobileByMpWeixin(e.detail).then(e => { uniIdCo.bindMobileByMpWeixin(e.detail).then(e => {
console.log(e);
this.$emit('success') this.$emit('success')
}).finally(e => { }).finally(e => {
this.closeMe() this.closeMe()
...@@ -157,8 +152,8 @@ ...@@ -157,8 +152,8 @@
.agree::after { .agree::after {
border: none; border: none;
} }
/* #endif */ /* #endif */
.agree:active { .agree:active {
background-color: #F5F5F6; background-color: #F5F5F6;
} }
......
<template> <template>
<view> <view>
<uni-captcha :focus="focusCaptchaInput" ref="captcha" scene="send-email-code" v-model="captcha" /> <uni-captcha :focus="focusCaptchaInput" ref="captcha" scene="send-email-code" v-model="captcha" />
<view class="box"> <view class="box">
<uni-easyinput :focus="focusEmailCodeInput" @blur="focusEmailCodeInput = false" type="number" class="input-box" :inputBorder="false" v-model="modelValue" maxlength="6" <uni-easyinput :focus="focusEmailCodeInput" @blur="focusEmailCodeInput = false" type="number" class="input-box" :inputBorder="false" v-model="modelValue" maxlength="6"
placeholder="请输入邮箱验证码"> placeholder="请输入邮箱验证码">
</uni-easyinput> </uni-easyinput>
<view class="short-code-btn" hover-class="hover" @click="start"> <view class="short-code-btn" hover-class="hover" @click="start">
<text class="inner-text" :class="reverseNumber==0?'inner-text-active':''">{{innerText}}</text> <text class="inner-text" :class="reverseNumber==0?'inner-text-active':''">{{innerText}}</text>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
function debounce(func, wait) { function debounce(func, wait) {
let timer; let timer;
wait = wait || 500; wait = wait || 500;
return function() { return function() {
let context = this; let context = this;
let args = arguments; let args = arguments;
if (timer) clearTimeout(timer); if (timer) clearTimeout(timer);
let callNow = !timer; let callNow = !timer;
timer = setTimeout(() => { timer = setTimeout(() => {
timer = null; timer = null;
}, wait) }, wait)
if (callNow) func.apply(context, args); if (callNow) func.apply(context, args);
} }
} }
/** /**
* email-code-form * email-code-form
* @description 获取邮箱验证码组件 * @description 获取邮箱验证码组件
* @tutorial https://ext.dcloud.net.cn/plugin?id= * @tutorial https://ext.dcloud.net.cn/plugin?id=
* @property {Number} count 倒计时时长 s * @property {Number} count 倒计时时长 s
* @property {String} email 邮箱 * @property {String} email 邮箱
* @property {String} type = [login-by-email-code|reset-pwd-by-email-code|bind-email] 验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定邮箱、unbind解绑邮箱 * @property {String} type = [login-by-email-code|reset-pwd-by-email-code|bind-email] 验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定邮箱、unbind解绑邮箱
* @property {false} focusCaptchaInput = [true|false] 验证码输入框是否默认获取焦点 * @property {false} focusCaptchaInput = [true|false] 验证码输入框是否默认获取焦点
*/ */
export default { export default {
name: "uni-email-code-form", name: "uni-email-code-form",
model: { model: {
prop: 'modelValue', prop: 'modelValue',
event: 'update:modelValue' event: 'update:modelValue'
}, },
props: { props: {
event: ['update:modelValue'], event: ['update:modelValue'],
/** /**
* 倒计时时长 s * 倒计时时长 s
*/ */
count: { count: {
type: [String, Number], type: [String, Number],
default: 60 default: 60
}, },
/** /**
* 邮箱 * 邮箱
*/ */
email: { email: {
type: [String], type: [String],
default: '' default: ''
}, },
/* /*
验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定邮箱、unbind解绑邮箱 验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定邮箱、unbind解绑邮箱
*/ */
type: { type: {
type: String, type: String,
default () { default () {
return 'register' return 'register'
} }
}, },
/* /*
验证码输入框是否默认获取焦点 验证码输入框是否默认获取焦点
*/ */
focusCaptchaInput: { focusCaptchaInput: {
type: Boolean, type: Boolean,
default () { default () {
return false return false
} }
}, },
}, },
data() { data() {
return { return {
captcha: "", captcha: "",
reverseNumber: 0, reverseNumber: 0,
reverseTimer: null, reverseTimer: null,
modelValue: "", modelValue: "",
focusEmailCodeInput:false focusEmailCodeInput:false
}; };
}, },
watch: { watch: {
captcha(value, oldValue) { captcha(value, oldValue) {
if (value.length == 4 && oldValue.length != 4) { if (value.length == 4 && oldValue.length != 4) {
this.start() this.start()
} }
}, },
modelValue(value) { modelValue(value) {
// TODO 兼容 vue2 // TODO 兼容 vue2
this.$emit('input', value); this.$emit('input', value);
// TODO 兼容 vue3 // TODO 兼容 vue3
this.$emit('update:modelValue', value) this.$emit('update:modelValue', value)
} }
}, },
computed: { computed: {
innerText() { innerText() {
if (this.reverseNumber == 0) return "获取邮箱验证码"; if (this.reverseNumber == 0) return "获取邮箱验证码";
return "重新发送" + '(' + this.reverseNumber + 's)'; return "重新发送" + '(' + this.reverseNumber + 's)';
} }
}, },
created() { created() {
this.initClick(); this.initClick();
}, },
methods: { methods: {
getImageCaptcha(focus) { getImageCaptcha(focus) {
this.$refs.captcha.getImageCaptcha(focus) this.$refs.captcha.getImageCaptcha(focus)
}, },
initClick() { initClick() {
this.start = debounce(() => { this.start = debounce(() => {
if (this.reverseNumber != 0) return; if (this.reverseNumber != 0) return;
this.sendMsg(); this.sendMsg();
}) })
}, },
sendMsg() { sendMsg() {
if (this.captcha.length != 4) { if (this.captcha.length != 4) {
this.$refs.captcha.focusCaptchaInput = true this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({ return uni.showToast({
title: '请先输入图形验证码', title: '请先输入图形验证码',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
if(!this.email) return uni.showToast({ if(!this.email) return uni.showToast({
title: "请输入邮箱", title: "请输入邮箱",
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
let reg_email = /@/; let reg_email = /@/;
if (!reg_email.test(this.email)) return uni.showToast({ if (!reg_email.test(this.email)) return uni.showToast({
title: "邮箱格式错误", title: "邮箱格式错误",
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
const uniIdCo = uniCloud.importObject("uni-id-co", { const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true customUI: true
}) })
console.log('uniIdCo', uniIdCo) console.log('sendEmailCode',{
console.log('sendEmailCode',{ "email": this.email,
"email": this.email, "scene": this.type,
"scene": this.type, "captcha": this.captcha
"captcha": this.captcha });
}); uniIdCo.sendEmailCode({
uniIdCo.sendEmailCode({ "email": this.email,
"email": this.email, "scene": this.type,
"scene": this.type, "captcha": this.captcha
"captcha": this.captcha }).then(result => {
}).then(result => { uni.showToast({
console.log(result.code); title: "邮箱验证码发送成功",
uni.showToast({ icon: 'none',
title: "邮箱验证码发送成功", duration: 3000
icon: 'none', });
duration: 3000 this.reverseNumber = Number(this.count);
}); this.getCode();
this.reverseNumber = Number(this.count); }).catch(e => {
this.getCode(); if (e.code == "uni-id-invalid-mail-template") {
}).catch(e => { this.modelValue = "123456"
console.log(JSON.stringify(e)); uni.showToast({
if (e.code == "uni-id-invalid-mail-template") { title: '已启动测试模式,详情【控制台信息】',
this.modelValue = "123456" icon: 'none',
uni.showToast({ duration: 3000
title: '已启动测试模式,详情【控制台信息】', });
icon: 'none', console.warn(e.message);
duration: 3000 } else {
}); this.getImageCaptcha()
console.warn(e.message); this.captcha = ""
} else { uni.showToast({
this.getImageCaptcha() title: e.message,
this.captcha = "" icon: 'none',
uni.showToast({ duration: 3000
title: e.message, });
icon: 'none', }
duration: 3000 })
}); },
} getCode() {
}) if (this.reverseNumber == 0) {
}, clearTimeout(this.reverseTimer);
getCode() { this.reverseTimer = null;
if (this.reverseNumber == 0) { return;
clearTimeout(this.reverseTimer); }
this.reverseTimer = null; this.reverseNumber--;
return; this.reverseTimer = setTimeout(() => {
} this.getCode();
this.reverseNumber--; }, 1000)
this.reverseTimer = setTimeout(() => { }
this.getCode(); }
}, 1000) }
} </script>
}
} <style lang="scss" scoped>
</script> .box {
position: relative;
<style lang="scss" scoped> margin-top: 10px;
.box { }
position: relative;
margin-top: 10px; .short-code-btn {
} padding: 0;
position: absolute;
.short-code-btn { top: 0;
padding: 0; right: 8px;
position: absolute; width: 260rpx;
top: 0; max-width: 130px;
right: 8px; height: 44px;
width: 260rpx; /* #ifndef APP-NVUE */
max-width: 130px; display: flex;
height: 44px; /* #endif */
/* #ifndef APP-NVUE */ justify-content: center;
display: flex; align-items: center;
/* #endif */
justify-content: center; }
align-items: center;
.inner-text {
} font-size: 14px;
color: #AAAAAA;
.inner-text { }
font-size: 14px;
color: #AAAAAA; .inner-text-active {
} color: #04498c;
}
.inner-text-active {
color: #04498c; .captcha {
} width: 350rpx;
}
.captcha {
width: 350rpx; .input-box {
} margin: 0;
padding: 4px;
.input-box { background-color: #F8F8F8;
margin: 0; font-size: 14px;
padding: 4px; }
background-color: #F8F8F8;
font-size: 14px; .box ::v-deep .content-clear-icon {
} margin-right: 100px;
}
.box ::v-deep .content-clear-icon {
margin-right: 100px; .box {
} /* #ifndef APP-NVUE */
display: flex;
.box { /* #endif */
/* #ifndef APP-NVUE */ flex-direction: row;
display: flex; }
/* #endif */ </style>
flex-direction: row;
}
</style>
...@@ -2,28 +2,18 @@ ...@@ -2,28 +2,18 @@
<view> <view>
<view class="fab-login-box"> <view class="fab-login-box">
<view class="item" v-for="(item,index) in servicesList" :key="index" <view class="item" v-for="(item,index) in servicesList" :key="index"
@click="item.path?navigateTo(item.path):login_before(item.id,false)"> @click="item.path?toPage(item.path):login_before(item.id,false)">
<image class="logo" :src="item.logo" mode="scaleToFill"></image> <image class="logo" :src="item.logo" mode="scaleToFill"></image>
<text class="login-title">{{item.text}}</text> <text class="login-title">{{item.text}}</text>
</view> </view>
</view> </view>
<!-- #ifdef MP-WEIXIN -->
<uni-id-pages-user-profile @next="doUserProfileNext" ref="userProfile"></uni-id-pages-user-profile>
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
import config from '@/uni_modules/uni-id-pages/config.js' import config from '@/uni_modules/uni-id-pages/config.js'
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回 //前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
import { import {store,mutations} from '@/uni_modules/uni-id-pages/common/store.js'
store,
mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let allServicesList = [] let allServicesList = []
export default { export default {
computed: { computed: {
agreements() { agreements() {
...@@ -49,7 +39,6 @@ ...@@ -49,7 +39,6 @@
return this.getParentComponent().agree return this.getParentComponent().agree
}, },
set(agree) { set(agree) {
console.log('setAgree', agree);
return this.getParentComponent().agree = agree return this.getParentComponent().agree = agree
} }
} }
...@@ -59,65 +48,67 @@ ...@@ -59,65 +48,67 @@
servicesList: [{ servicesList: [{
"id": "username", "id": "username",
"text": "账号登录", "text": "账号登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/user.png", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/user.png",
"path": "/uni_modules/uni-id-pages/pages/login/login-withpwd" "path": "/uni_modules/uni-id-pages/pages/login/login-withpwd"
}, },
{ {
"id": "smsCode", "id": "smsCode",
"text": "短信验证码", "text": "短信验证码",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/sms.png", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/sms.png",
"path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode" "path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode"
}, },
{ {
"id": "weixin", "id": "weixin",
"text": "微信登录", "text": "微信登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/weixin.png", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png",
}, },
// #ifndef MP-WEIXIN
{ {
"id": "apple", "id": "apple",
"text": "苹果登录", "text": "苹果登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/apple.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/apple.png",
}, },
{ {
"id": "univerify", "id": "univerify",
"text": "一键登录", "text": "一键登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/univerify.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/univerify.png",
}, },
{ {
"id": "taobao", "id": "taobao",
"text": "淘宝登录", //暂未提供该登录方式的接口示例 "text": "淘宝登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/taobao.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/taobao.png",
}, },
{ {
"id": "facebook", "id": "facebook",
"text": "脸书登录", //暂未提供该登录方式的接口示例 "text": "脸书登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/facebook.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/facebook.png",
}, },
{ {
"id": "alipay", "id": "alipay",
"text": "支付宝登录", //暂未提供该登录方式的接口示例 "text": "支付宝登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/alipay.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/alipay.png",
}, },
{ {
"id": "qq", "id": "qq",
"text": "QQ登录", //暂未提供该登录方式的接口示例 "text": "QQ登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/qq.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/qq.png",
}, },
{ {
"id": "google", "id": "google",
"text": "谷歌登录", //暂未提供该登录方式的接口示例 "text": "谷歌登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/google.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/google.png",
}, },
{ {
"id": "douyin", "id": "douyin",
"text": "抖音登录", //暂未提供该登录方式的接口示例 "text": "抖音登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/douyin.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/douyin.png",
}, },
{ {
"id": "sinaweibo", "id": "sinaweibo",
"text": "新浪微博", //暂未提供该登录方式的接口示例 "text": "新浪微博", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/sinaweibo.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png",
} }
// #endif
], ],
univerifyStyle: { //一键登录弹出窗的样式配置参数 univerifyStyle: { //一键登录弹出窗的样式配置参数
"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。 "fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
...@@ -189,7 +180,6 @@ ...@@ -189,7 +180,6 @@
let path = item.path ? item.path.split('?')[0] : ''; let path = item.path ? item.path.split('?')[0] : '';
return path != this.getRoute(1) return path != this.getRoute(1)
}) })
//console.log('servicesList', servicesList, this.servicesList);
}, },
methods: { methods: {
getParentComponent(){ getParentComponent(){
...@@ -206,30 +196,38 @@ ...@@ -206,30 +196,38 @@
}, },
getRoute(n = 0) { getRoute(n = 0) {
let pages = getCurrentPages(); let pages = getCurrentPages();
// console.log('route-pages-length', pages.length);
if (n > pages.length) { if (n > pages.length) {
return '' return ''
} }
return '/' + pages[pages.length - n].route return '/' + pages[pages.length - n].route
}, },
navigateTo(path) { toPage(path,index = 0) {
//console.log('比较', this.getRoute(1),this.getRoute(2), path) //console.log('比较', this.getRoute(1),this.getRoute(2), path)
if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) == if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) ==
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd') { '/uni_modules/uni-id-pages/pages/login/login-withoutpwd') {
//如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他 //如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他
let type = path.split('?')[1].split('=')[1] let loginType = path.split('?')[1].split('=')[1]
uni.$emit('uni-id-pages-set-login-type', type) uni.$emit('uni-id-pages-setLoginType', loginType)
} else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启 } else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
uni.navigateBack(); uni.navigateBack();
} else if (this.getRoute(1) != path) { } else if (this.getRoute(1) != path) {
//console.log(3); if(index === 0){
uni.navigateTo({ uni.navigateTo({
url: path, url: path,
animationType: 'slide-in-left', animationType: 'slide-in-left',
complete(e) { complete(e) {
// console.log(e); // console.log(e);
} }
}) })
}else{
uni.redirectTo({
url: path,
animationType: 'slide-in-left',
complete(e) {
// console.log(e);
}
})
}
} else { } else {
console.log('出乎意料的情况,path:' + path); console.log('出乎意料的情况,path:' + path);
} }
...@@ -248,7 +246,7 @@ ...@@ -248,7 +246,7 @@
].includes(type)) { ].includes(type)) {
return uni.showToast({ return uni.showToast({
title: '该登录方式暂未实现,欢迎提交pr', title: '该登录方式暂未实现,欢迎提交pr',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
...@@ -265,7 +263,7 @@ ...@@ -265,7 +263,7 @@
}else{ }else{
return uni.showToast({ return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式', title: '当前设备不支持此登录,请选择其他登录方式',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
...@@ -288,21 +286,16 @@ ...@@ -288,21 +286,16 @@
) { ) {
return uni.showToast({ return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式', title: '当前设备不支持此登录,请选择其他登录方式',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
//判断是否需要弹出隐私协议授权框 //判断是否需要弹出隐私协议授权框
console.log(type, this.agree);
let needAgreements = (config?.agreements?.scope || []).includes('register') let needAgreements = (config?.agreements?.scope || []).includes('register')
console.log({
needAgreements
});
if (type != 'univerify' && needAgreements && !this.agree) { if (type != 'univerify' && needAgreements && !this.agree) {
let agreementsRef = this.getParentComponent().$refs.agreements let agreementsRef = this.getParentComponent().$refs.agreements
return agreementsRef.popup(() => { return agreementsRef.popup(() => {
console.log(type, navigateBack);
this.login_before(type, navigateBack, options) this.login_before(type, navigateBack, options)
}) })
} }
...@@ -310,11 +303,25 @@ ...@@ -310,11 +303,25 @@
// #ifdef H5 // #ifdef H5
if(type == 'weixin'){ if(type == 'weixin'){
// console.log('开始微信网页登录'); // console.log('开始微信网页登录');
let redirectUrl = location.protocol +'//'+ // let redirectUrl = location.protocol +'//'+
document.domain + // document.domain +
(window.location.href.includes('#')?'/#':'') + // (window.location.href.includes('#')?'/#':'') +
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin' // '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
console.log('redirectUrl----',redirectUrl); // #ifdef VUE2
const baseUrl = process.env.BASE_URL
// #endif
// #ifdef VUE3
const baseUrl = import.meta.env.BASE_URL
// #endif
let redirectUrl = location.protocol +
'//' +
location.host +
baseUrl.replace(/\/$/, '') +
(window.location.href.includes('#')?'/#':'') +
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
// console.log('redirectUrl----',redirectUrl);
let ua = window.navigator.userAgent.toLowerCase(); let ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger'){ if (ua.match(/MicroMessenger/i) == 'micromessenger'){
// console.log('在微信公众号内'); // console.log('在微信公众号内');
...@@ -337,32 +344,40 @@ ...@@ -337,32 +344,40 @@
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
if (type == 'univerify') { if (type == 'univerify') {
let univerifyManager = uni.getUniverifyManager() let univerifyManager = uni.getUniverifyManager()
let clickAnotherButtons = false
let onButtonsClickFn = async res => { let onButtonsClickFn = async res => {
console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list); console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
//同步一键登录弹出层隐私协议框是否打勾 clickAnotherButtons = true
let agree = (await uni.getCheckBoxState())[1].state let checkBoxState = await uni.getCheckBoxState();
//console.log('agree',agree); // 同步一键登录弹出层隐私协议框是否打勾
this.agree = agree // #ifdef VUE2
this.agree = checkBoxState[1].state
// #endif
// #ifdef VUE3
this.agree = checkBoxState.state
// #endif
let { let {
path path
} = this.univerifyStyle.buttons.list[res.index] } = this.univerifyStyle.buttons.list[res.index]
if (path) { if (path) {
this.navigateTo(path) if( this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd') ){
this.getParentComponent().showCurrentWebview()
}
this.toPage(path,1)
closeUniverify() closeUniverify()
} else { } else {
if (agree) { if (this.agree) {
closeUniverify() closeUniverify()
setTimeout(() => { setTimeout(() => {
//console.log('login_before');
this.login_before(res.provider) this.login_before(res.provider)
}, 500) }, 500)
} else { } else {
//console.log("你未同意隐私政策协议");
uni.showToast({ uni.showToast({
title: "你未同意隐私政策协议", title: "你未同意隐私政策协议",
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
...@@ -381,32 +396,34 @@ ...@@ -381,32 +396,34 @@
return univerifyManager.login({ return univerifyManager.login({
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
success: res => { success: res => {
console.log('login success', res)
this.login(res.authResult, 'univerify') this.login(res.authResult, 'univerify')
}, },
fail(err) { fail(err) {
uni.showToast({ console.log(err)
title: JSON.stringify(err), if(!clickAnotherButtons){
icon: 'none', uni.navigateBack()
duration: 3000 }
}); // uni.showToast({
// title: JSON.stringify(err),
// icon: 'none',
// duration: 3000
// });
}, },
complete: async e => { complete: async e => {
console.log(e);
uni.hideLoading() uni.hideLoading()
//同步一键登录弹出层隐私协议框是否打勾 //同步一键登录弹出层隐私协议框是否打勾
this.agree = (await uni.getCheckBoxState())[1].state // this.agree = (await uni.getCheckBoxState())[1].state
// 取消订阅自定义按钮点击事件 // 取消订阅自定义按钮点击事件
univerifyManager.offButtonsClick(onButtonsClickFn) univerifyManager.offButtonsClick(onButtonsClickFn)
} }
}) })
} }
if (type === 'weixinMobile') { if (type === 'weixinMobile') {
return this.login({ return this.login({
phoneCode: options.phoneNumberCode phoneCode: options.phoneNumberCode
}, type) }, type)
} }
uni.login({ uni.login({
"provider": type, "provider": type,
...@@ -415,7 +432,6 @@ ...@@ -415,7 +432,6 @@
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
// #endif // #endif
success: async e => { success: async e => {
console.log(e);
if (type == 'apple') { if (type == 'apple') {
let res = await this.getUserInfo({ let res = await this.getUserInfo({
provider: "apple" provider: "apple"
...@@ -434,41 +450,25 @@ ...@@ -434,41 +450,25 @@
}) })
}, },
login(params, type) { //联网验证登录 login(params, type) { //联网验证登录
console.log('执行登录开始----'); // console.log('执行登录开始----');
console.log({ console.log({params,type});
params,
type
});
//toLowerCase //toLowerCase
let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase()) let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase())
const uniIdCo = uniCloud.importObject("uni-id-co",{ const uniIdCo = uniCloud.importObject("uni-id-co",{
customUI:true customUI:true
}) })
uniIdCo[action](params).then(result => { uniIdCo[action](params).then(result => {
console.log("login-result", result);
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
// #ifdef MP-WEIXIN
//如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料
if (['weixin', 'weixinMobile'].includes(type) && result.type == "register") {
mutations.loginSuccess({
...result,
showToast: false,
autoBack: false
})
return this.$refs.userProfile.open(result.uid)
}
// #endif
// #ifdef H5 // #ifdef H5
result.loginType = type result.loginType = type
// #endif // #endif
mutations.loginSuccess(result) mutations.loginSuccess(result)
}) })
.catch(e=>{ .catch(e=>{
console.log(e);
uni.showModal({ uni.showModal({
content: e.message, content: e.message,
confirmText:"知道了", confirmText:"知道了",
...@@ -482,13 +482,6 @@ ...@@ -482,13 +482,6 @@
uni.hideLoading() uni.hideLoading()
}) })
}, },
doUserProfileNext() {
try {
mutations.loginSuccess()
} catch (e) {
console.log(e);
}
},
async getUserInfo(e) { async getUserInfo(e) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.getUserInfo({ uni.getUserInfo({
...@@ -518,7 +511,6 @@ ...@@ -518,7 +511,6 @@
box-sizing: border-box; box-sizing: border-box;
flex-direction: column; flex-direction: column;
} }
/* #endif */ /* #endif */
.fab-login-box { .fab-login-box {
...@@ -557,8 +549,6 @@ ...@@ -557,8 +549,6 @@
/* #endif */ /* #endif */
.logo { .logo {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
...@@ -568,7 +558,6 @@ ...@@ -568,7 +558,6 @@
border: solid 1px #F6F6F6; border: solid 1px #F6F6F6;
} }
.login-title { .login-title {
text-align: center; text-align: center;
margin-top: 6px; margin-top: 6px;
......
...@@ -146,7 +146,6 @@ ...@@ -146,7 +146,6 @@
"scene": this.type, "scene": this.type,
"captcha": this.captcha "captcha": this.captcha
}).then(result => { }).then(result => {
console.log(result.code);
uni.showToast({ uni.showToast({
title: "短信验证码发送成功", title: "短信验证码发送成功",
icon: 'none', icon: 'none',
...@@ -155,7 +154,6 @@ ...@@ -155,7 +154,6 @@
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
}).catch(e => { }).catch(e => {
console.log(JSON.stringify(e));
if (e.code == "uni-id-invalid-sms-template-id") { if (e.code == "uni-id-invalid-sms-template-id") {
this.modelValue = "123456" this.modelValue = "123456"
uni.showToast({ uni.showToast({
...@@ -209,7 +207,6 @@ ...@@ -209,7 +207,6 @@
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.inner-text { .inner-text {
......
<template>
<uni-popup ref="popup" type="bottom">
<view class="box">
<text class="headBox">绑定资料</text>
<text class="tip">获取你的微信头像和昵称,完善你的个人资料</text>
<view class="btnBox">
<text @click="closeMe" class="close">关闭</text>
<button class="agree uni-btn" type="primary" @click="getUserProfile">确定</button>
</view>
</view>
</uni-popup>
</template>
<script>
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let userId = ''
export default {
emits:['next'],
data() {
return {}
},
methods: {
async open(uid){
userId = uid
this.$refs.popup.open()
},
async getUserProfile(){
uni.showLoading();
let res = await new Promise((callBack) => {
uni.getUserProfile({
desc: "用于设置账户昵称和头像",
complete: (e) => {
console.log("getUserProfile:", e);
callBack(e)
}
})
})
// console.log("userInfo", res.userInfo);
if(res.errMsg != "getUserProfile:ok"){
return this.closeMe()
}
let {avatarUrl,nickName} = res.userInfo;
let tempFilePath = await new Promise((callBack)=>{
uni.downloadFile({
url: avatarUrl,
success: (res) => {
if (res.statusCode === 200) {
// console.log('下载成功');
callBack(res.tempFilePath)
}
callBack()
},
fail: (err) => {
console.error(err)
},
complete: (e) => {
// console.log("downloadFile",e);
}
});
})
const extName = tempFilePath.split('.').pop() || 'jpg'
const cloudPath = 'user/avatar/'+ userId+'/'+Date.now()+'-avatar.'+extName;
// console.log(tempFilePath);
const result = await uniCloud.uploadFile({
filePath: tempFilePath,
cloudPath,
fileType:'image'
});
// console.log("上传成功",{result});
let userInfo = {
"nickname":nickName,
"avatar_file":{
name:cloudPath,
extname:"jpg",
url:result.fileID
}
}
this.doUpdate(userInfo,()=>{
this.$refs.popup.close()
})
},
closeMe(e){
uni.showLoading();
this.doUpdate({nickname:"匿名微信用户"},()=>{
uni.hideLoading()
this.$refs.popup.close()
})
},
doUpdate(data,callback){
// console.log('dododo',data);
// 使用 clientDB 提交数据
usersTable.where('_id==$env.uid').update(data).then((res) => {
callback(res)
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
callback(err)
}).finally(() => {
this.$emit('next')
uni.hideLoading()
})
}
}
}
</script>
<style lang="scss" scoped>
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
view{
display: flex;
}
.box{
background-color: #FFFFFF;
height:200px;
width: 750rpx;
flex-direction: column;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.headBox{
padding:20rpx;
height:80rpx;
line-height:80rpx;
text-align: left;
font-size:16px;
color:#333333;
margin-left: 15rpx;
}
.tip{
color:#666666;
text-align: left;
justify-content: center;
margin:10rpx 30rpx;
font-size:18px;
}
.btnBox{
margin-top:45rpx;
justify-content: center;
flex-direction: row;
}
.close,.agree{
text-align: center;
width:200rpx;
height:80upx;
line-height:80upx;
border-radius:5px;
margin:0 20rpx;
font-size:14px;
}
.close{
color:#999999;
border-color: #EEEEEE;
border-style: solid;
border-width: 1px;
background-color:#FFFFFF;
}
.close:active{
color:#989898;
background-color:#E2E2E2;
}
.agree{
color:#FFFFFF;
}
/* #ifdef MP */
.agree::after {
border: none;
}
/* #endif */
.agree:active{
background-color:#F5F5F6;
}
</style>
export default { export default {
//调试模式 // 调试模式
"debug": false, debug: false,
/* /*
登录类型 未列举到的或运行环境不支持的,将被自动隐藏。 登录类型 未列举到的或运行环境不支持的,将被自动隐藏。
如果需要在不同平台有不同的配置,直接用条件编译即可 如果需要在不同平台有不同的配置,直接用条件编译即可
*/ */
"isAdmin": false, // 区分管理端与用户端 isAdmin: false, // 区分管理端与用户端
"loginTypes": [ loginTypes: [
// "qq", // "qq",
// "xiaomi", // "xiaomi",
// "sinaweibo", // "sinaweibo",
// "taobao", // "taobao",
// "facebook", // "facebook",
// "google", // "google",
// "alipay", // "alipay",
// "douyin", // "douyin",
// #ifdef APP // #ifdef APP
"univerify", 'univerify',
// #endif // #endif
"weixin", 'weixin',
"username", 'username',
// #ifdef APP // #ifdef APP
"apple", 'apple',
// #endif // #endif
"smsCode" 'smsCode'
], ],
//政策协议 // 政策协议
"agreements": { agreements: {
"serviceUrl": "https://xxx", //用户服务协议链接 serviceUrl: 'https://xxx', // 用户服务协议链接
"privacyUrl": "https://xxx", //隐私政策条款链接 privacyUrl: 'https://xxx', // 隐私政策条款链接
// 哪些场景下显示,1.注册(包括登录并注册,如:微信登录、苹果登录、短信验证码登录)、2.登录(如:用户名密码登录) // 哪些场景下显示,1.注册(包括登录并注册,如:微信登录、苹果登录、短信验证码登录)、2.登录(如:用户名密码登录)
"scope": [ scope: [
'register', 'login' 'register', 'login', 'realNameVerify'
] ]
}, },
// 提供各类服务接入(如微信登录服务)的应用id // 提供各类服务接入(如微信登录服务)的应用id
"appid": { appid: {
"weixin": { weixin: {
// 微信公众号的appid,来源:登录微信公众号(https://mp.weixin.qq.com)-> 设置与开发 -> 基本配置 -> 公众号开发信息 -> AppID // 微信公众号的appid,来源:登录微信公众号(https://mp.weixin.qq.com)-> 设置与开发 -> 基本配置 -> 公众号开发信息 -> AppID
"h5": "xxxxxx", h5: 'xxxxxx',
// 微信开放平台的appid,来源:登录微信开放平台(https://open.weixin.qq.com) -> 管理中心 -> 网站应用 -> 选择对应的应用名称,点击查看 -> AppID // 微信开放平台的appid,来源:登录微信开放平台(https://open.weixin.qq.com) -> 管理中心 -> 网站应用 -> 选择对应的应用名称,点击查看 -> AppID
"web": "xxxxxx" web: 'xxxxxx'
} }
}, },
/** /**
* 密码强度 * 密码强度
* super(超强:密码必须包含大小写字母、数字和特殊符号,长度范围:8-16位之间) * super(超强:密码必须包含大小写字母、数字和特殊符号,长度范围:8-16位之间)
* strong(强: 密密码必须包含字母、数字和特殊符号,长度范围:8-16位之间) * strong(强: 密密码必须包含字母、数字和特殊符号,长度范围:8-16位之间)
...@@ -52,8 +52,8 @@ export default { ...@@ -52,8 +52,8 @@ export default {
* weak(弱:密码必须包含字母和数字,长度范围:6-16位之间) * weak(弱:密码必须包含字母和数字,长度范围:6-16位之间)
* 为空或false则不验证密码强度 * 为空或false则不验证密码强度
*/ */
"passwordStrength":"medium", passwordStrength: 'medium',
/** /**
* 登录后允许用户设置密码(只针对未设置密码得用户) * 登录后允许用户设置密码(只针对未设置密码得用户)
* 开启此功能将 setPasswordAfterLogin 设置为 true 即可 * 开启此功能将 setPasswordAfterLogin 设置为 true 即可
* "setPasswordAfterLogin": false * "setPasswordAfterLogin": false
...@@ -63,5 +63,5 @@ export default { ...@@ -63,5 +63,5 @@ export default {
* "allowSkip": true * "allowSkip": true
* } * }
* */ * */
"setPasswordAfterLogin": false setPasswordAfterLogin: false
} }
// 导入配置 // 导入配置
import config from '@/uni_modules/uni-id-pages/config.js'; import config from '@/uni_modules/uni-id-pages/config.js'
// uni-id的云对象 // uni-id的云对象
const uniIdCo = uniCloud.importObject("uni-id-co", { const uniIdCo = uniCloud.importObject('uni-id-co', {
customUI: true customUI: true
}) })
// 用户配置的登录方式、是否打开调试模式 // 用户配置的登录方式、是否打开调试模式
const { const {
loginTypes, loginTypes,
debug debug
} = config } = config
export default async function() { export default async function () {
// 有打开调试模式的情况下
// 有打开调试模式的情况下 if (debug) {
if (debug) { // 1. 检查本地uni-id-pages中配置的登录方式,服务器端是否已经配置正确。否则提醒并引导去配置
// 1. 检查本地uni-id-pages中配置的登录方式,服务器端是否已经配置正确。否则提醒并引导去配置 // 调用云对象,获取服务端已正确配置的登录方式
//调用云对象,获取服务端已正确配置的登录方式 const {
let { supportedLoginType
supportedLoginType } = await uniIdCo.getSupportedLoginType()
} = await uniIdCo.getSupportedLoginType() console.log('supportedLoginType: ' + JSON.stringify(supportedLoginType))
console.log("supportedLoginType: " + JSON.stringify(supportedLoginType)); // 登录方式,服务端和客户端的映射关系
//登录方式,服务端和客户端的映射关系 const data = {
let data = { smsCode: 'mobile-code',
smsCode: 'mobile-code', univerify: 'univerify',
univerify: 'univerify', username: 'username-password',
username: 'username-password', weixin: 'weixin',
weixin: 'weixin', qq: 'qq',
qq: 'qq', xiaomi: 'xiaomi',
xiaomi: 'xiaomi', sinaweibo: 'sinaweibo',
sinaweibo: 'sinaweibo', taobao: 'taobao',
taobao: 'taobao', facebook: 'facebook',
facebook: 'facebook', google: 'google',
google: 'google', alipay: 'alipay',
alipay: 'alipay', apple: 'apple',
apple: "apple" weixinMobile: 'weixin'
} }
//遍历客户端配置的登录方式,与服务端比对。并在错误时抛出错误提示 // 遍历客户端配置的登录方式,与服务端比对。并在错误时抛出错误提示
let list = loginTypes.filter(type => !supportedLoginType.includes(data[type])) const list = loginTypes.filter(type => !supportedLoginType.includes(data[type]))
if (list.length) { if (list.length) {
console.error( 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"`
); )
} }
} }
// #ifdef APP-PLUS
//如果uni-id-pages配置的登录功能有一键登录,有则执行预登录(异步)
if (loginTypes.includes('univerify')) {
uni.preLogin({
provider: 'univerify',
complete: e => {
console.log(e);
}
})
}
// #endif
//3. 绑定clientDB错误事件 // #ifdef APP-PLUS
// clientDB对象 // 如果uni-id-pages配置的登录功能有一键登录,有则执行预登录(异步)
const db = uniCloud.database() if (loginTypes.includes('univerify')) {
db.on('error', onDBError) uni.preLogin({
//clientDB的错误提示 provider: 'univerify',
function onDBError({ complete: e => {
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue // console.log(e);
message }
}) { })
console.error('onDBError', { }
code, // #endif
message
});
}
// 解绑clientDB错误事件
//db.off('error', onDBError)
// 3. 绑定clientDB错误事件
// clientDB对象
const db = uniCloud.database()
db.on('error', onDBError)
// clientDB的错误提示
function onDBError ({
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message
}) {
// console.error('onDBError', {code,message});
}
// 解绑clientDB错误事件
// db.off('error', onDBError)
//4. 同步客户端push_clientid至device表 // 4. 同步客户端push_clientid至device表
if (uniCloud.onRefreshToken) { if (uniCloud.onRefreshToken) {
uniCloud.onRefreshToken(() => { uniCloud.onRefreshToken(() => {
console.log('onRefreshToken'); // console.log('onRefreshToken');
if (uni.getPushClientId) { if (uni.getPushClientId) {
uni.getPushClientId({ uni.getPushClientId({
success: async function(e) { success: async function (e) {
console.log(e) // console.log(e)
let pushClientId = e.cid const pushClientId = e.cid
console.log(pushClientId); // console.log(pushClientId);
let res = await uniIdCo.setPushCid({ const res = await uniIdCo.setPushCid({
pushClientId pushClientId
}) })
console.log('getPushClientId', res); // console.log('getPushClientId', res);
}, },
fail(e) { fail (e) {
console.log(e) // console.log(e)
} }
}) })
} }
}) })
} }
} }
{
"name": "uni-id-pages",
"version": "1.0.19",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "1.0.19",
"dependencies": {
"jweixin-module": "^1.6.0"
},
"engines": {
"HBuilderX": "^3.4.17"
}
},
"node_modules/jweixin-module": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
"integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
}
},
"dependencies": {
"jweixin-module": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
"integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
}
}
}
{ {
"id": "uni-id-pages", "id": "uni-id-pages",
"displayName": "uni-id-pages", "displayName": "uni-id-pages",
"version": "1.0.34", "version": "1.1.16",
"description": "云端一体简单、统一、可扩展的用户中心页面模版", "description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [ "keywords": [
"用户管理", "用户管理",
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
"uni-popup", "uni-popup",
"uni-scss", "uni-scss",
"uni-transition", "uni-transition",
"uni-open-bridge-common" "uni-open-bridge-common",
"uni-cloud-s2s"
], ],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
......
<!-- 网络链接内容展示页(uni-id-pages中用于展示隐私政策协议内容) --> <!-- 网络链接内容展示页(uni-id-pages中用于展示隐私政策协议内容) -->
<template> <template>
<view> <view>
<web-view v-if="url" :src="url"></web-view> <web-view v-if="url" :src="url"></web-view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
onLoad({url,title}) { onLoad({url,title}) {
if(url.substring(0, 4) != 'http'){ if(url.substring(0, 4) != 'http'){
uni.showModal({ uni.showModal({
title:"错误", title:"错误",
content: '不是一个有效的网站链接,'+'"'+url+'"', content: '不是一个有效的网站链接,'+'"'+url+'"',
showCancel: false, showCancel: false,
confirmText:"知道了", confirmText:"知道了",
complete: () => { complete: () => {
uni.navigateBack() uni.navigateBack()
} }
}); });
title = "页面路径错误" title = "页面路径错误"
}else{ }else{
console.log(url,title); this.url = url;
this.url = url; }
} if(title){
if(title){ uni.setNavigationBarTitle({title});
uni.setNavigationBarTitle({title}); }
} },
}, data() {
data() { return {
return { url:null
url:null };
}; }
} }
} </script>
</script>
<style lang="scss">
</style>
<!-- 短信验证码登录页 --> <!-- 短信验证码登录页 -->
<template> <template>
<view class="uni-content"> <view class="uni-content">
<view class="login-logo"> <view class="login-logo">
<image :src="logo"></image> <image :src="logo"></image>
</view> </view>
<!-- 顶部文字 --> <!-- 顶部文字 -->
<text class="title">请输入验证码</text> <text class="title">请输入验证码</text>
<text class="tip">先输入图形验证码,再获取短信验证码</text> <text class="tip">先输入图形验证码,再获取短信验证码</text>
<uni-forms> <uni-forms>
<uni-id-pages-sms-form focusCaptchaInput v-model="code" type="login-by-sms" ref="smsCode" :phone="phone"> <uni-id-pages-sms-form focusCaptchaInput v-model="code" type="login-by-sms" ref="smsCode" :phone="phone">
</uni-id-pages-sms-form> </uni-id-pages-sms-form>
<button class="uni-btn send-btn" type="primary" @click="submit">登录</button> <button class="uni-btn send-btn" type="primary" @click="submit">登录</button>
</uni-forms> </uni-forms>
<uni-popup-captcha @confirm="submit" v-model="captcha" scene="login-by-sms" ref="popup"></uni-popup-captcha> <uni-popup-captcha @confirm="submit" v-model="captcha" scene="login-by-sms" ref="popup"></uni-popup-captcha>
</view> </view>
</template> </template>
<script> <script>
import mixin from '@/uni_modules/uni-id-pages/common/login-page.mixin.js'; import mixin from '@/uni_modules/uni-id-pages/common/login-page.mixin.js';
export default { export default {
mixins: [mixin], mixins: [mixin],
data() { data() {
return { return {
"code": "", "code": "",
"phone": "", "phone": "",
"captcha": "", "captcha": "",
"logo": "/static/logo.png" "logo": "/static/logo.png"
} }
}, },
computed: { computed: {
tipText() { tipText() {
return '验证码已通过短信发送至' + this.phone; return '验证码已通过短信发送至' + this.phone;
}, },
}, },
onLoad({ onLoad({
phoneNumber phoneNumber
}) { }) {
this.phone = phoneNumber; this.phone = phoneNumber;
}, },
onShow() { onShow() {
console.log('onShow'); // #ifdef H5
// #ifdef H5 document.onkeydown = event => {
document.onkeydown = event => { var e = event || window.event;
var e = event || window.event; if (e && e.keyCode == 13) { //回车键的键值为13
if (e && e.keyCode == 13) { //回车键的键值为13 this.submit()
this.submit() }
} };
}; // #endif
// #endif },
}, methods: {
methods: { submit() { //完成并提交
submit() { //完成并提交 const uniIdCo = uniCloud.importObject("uni-id-co", {
const uniIdCo = uniCloud.importObject("uni-id-co", { errorOptions: {
errorOptions: { type: 'toast'
type: 'toast' }
} })
}) if (this.code.length != 6) {
if (this.code.length != 6) { this.$refs.smsCode.focusSmsCodeInput = true
this.$refs.smsCode.focusSmsCodeInput = true return uni.showToast({
return uni.showToast({ title: '验证码不能为空',
title: '验证码不能为空', icon: 'none',
icon: 'none', duration: 3000
duration: 3000 });
}); }
} uniIdCo.loginBySms({
uniIdCo.loginBySms({ "mobile": this.phone,
"mobile": this.phone, "code": this.code,
"code": this.code, "captcha": this.captcha
"captcha": this.captcha }).then(e => {
}).then(e => { this.loginSuccess(e)
console.log(e); }).catch(e => {
this.loginSuccess(e) if (e.errCode == 'uni-id-captcha-required') {
}).catch(e => { this.$refs.popup.open()
if (e.errCode == 'uni-id-captcha-required') { } else {
this.$refs.popup.open() console.log(e.errMsg);
} else { }
console.log(e.errMsg); }).finally(e => {
console.log(e.errCode); this.captcha = ''
} })
}).finally(e => { }
this.captcha = '' }
}) }
} </script>
} <style scoped lang="scss">
} @import "@/uni_modules/uni-id-pages/common/login-page.scss";
</script>
<style scoped lang="scss"> .tip {
@import "@/uni_modules/uni-id-pages/common/login-page.scss"; margin-top: -15px;
margin-bottom: 15px;
.tip { }
margin-top: -15px;
margin-bottom: 15px; .popup-captcha {
} /* #ifndef APP-NVUE */
display: flex;
.popup-captcha { /* #endif */
/* #ifndef APP-NVUE */ padding: 20rpx;
display: flex; background-color: #FFF;
/* #endif */ border-radius: 2px;
padding: 20rpx; flex-direction: column;
background-color: #FFF; position: relative;
border-radius: 2px; }
flex-direction: column;
position: relative; .popup-captcha .title {
} font-weight: normal;
padding: 0;
.popup-captcha .title { padding-bottom: 15px;
font-weight: normal; color: #666;
padding: 0; }
padding-bottom: 15px;
color: #666; .popup-captcha .close {
} position: absolute;
bottom: -40px;
.popup-captcha .close { margin-left: -13px;
position: absolute; left: 50%;
bottom: -40px; }
margin-left: -13px;
left: 50%; .popup-captcha .uni-btn {
} margin: 0;
}
.popup-captcha .uni-btn { </style>
margin: 0;
}
</style>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
this.focusPassword = true this.focusPassword = true
return uni.showToast({ return uni.showToast({
title: '请输入密码', title: '请输入密码',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
this.focusUsername = true this.focusUsername = true
return uni.showToast({ return uni.showToast({
title: '请输入手机号/用户名/邮箱', title: '请输入手机号/用户名/邮箱',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
return uni.showToast({ return uni.showToast({
title: '请输入验证码', title: '请输入验证码',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
@media screen and (min-width: 690px) { @media screen and (min-width: 690px) {
.uni-content { .uni-content {
max-height: 650px; height: auto;
} }
} }
...@@ -173,4 +173,4 @@ ...@@ -173,4 +173,4 @@
.link { .link {
font-size: 12px; font-size: 12px;
} }
</style> </style>
...@@ -109,17 +109,14 @@ ...@@ -109,17 +109,14 @@
}).catch((errors) => { }).catch((errors) => {
let key = errors[0].key let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key);
this['focus' + key] = true this['focus' + key] = true
}) })
}, },
submitForm(params) { submitForm(params) {
uniIdCo.registerUser(this.formData).then(e => { uniIdCo.registerUser(this.formData).then(e => {
console.log(e);
this.loginSuccess(e) this.loginSuccess(e)
}) })
.catch(e => { .catch(e => {
console.log(e);
console.log(e.message); console.log(e.message);
//更好的体验:登录错误,直接刷新验证码 //更好的体验:登录错误,直接刷新验证码
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
......
<!-- 绑定手机号码页 --> <!-- 绑定手机号码页 -->
<template> <template>
<view class="uni-content"> <view class="uni-content">
<match-media :min-width="690"> <match-media :min-width="690">
<view class="login-logo"> <view class="login-logo">
<image :src="logo"></image> <image :src="logo"></image>
</view> </view>
<!-- 顶部文字 --> <!-- 顶部文字 -->
<text class="title title-box">绑定手机号</text> <text class="title title-box">绑定手机号</text>
</match-media> </match-media>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) --> <!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput clearable :focus="focusMobile" @blur="focusMobile = false" type="number" class="input-box" :inputBorder="false" v-model="formData.mobile" <uni-easyinput clearable :focus="focusMobile" @blur="focusMobile = false" type="number" class="input-box" :inputBorder="false" v-model="formData.mobile"
maxlength="11" placeholder="请输入手机号"></uni-easyinput> maxlength="11" placeholder="请输入手机号"></uni-easyinput>
<uni-id-pages-sms-form ref="smsForm" type="bind-mobile-by-sms" v-model="formData.code" :phone="formData.mobile"> <uni-id-pages-sms-form ref="smsForm" type="bind-mobile-by-sms" v-model="formData.code" :phone="formData.mobile">
</uni-id-pages-sms-form> </uni-id-pages-sms-form>
<button class="uni-btn send-btn-box" type="primary" @click="submit">提交</button> <button class="uni-btn send-btn-box" type="primary" @click="submit">提交</button>
<uni-popup-captcha @confirm="submit" v-model="formData.captcha" scene="bind-mobile-by-sms" ref="popup"> <uni-popup-captcha @confirm="submit" v-model="formData.captcha" scene="bind-mobile-by-sms" ref="popup">
</uni-popup-captcha> </uni-popup-captcha>
</view> </view>
</template> </template>
<script> <script>
import { import {
store, store,
mutations mutations
} from '@/uni_modules/uni-id-pages/common/store.js' } from '@/uni_modules/uni-id-pages/common/store.js'
export default { export default {
data() { data() {
return { return {
formData: { formData: {
mobile: "", mobile: "",
code: "", code: "",
captcha: "" captcha: ""
}, },
focusMobile:true, focusMobile:true,
logo: "/static/logo.png" logo: "/static/logo.png"
} }
}, },
computed: { computed: {
tipText() { tipText() {
return `验证码已通过短信发送至 ${this.formData.mobile}。密码为6 - 20位` return `验证码已通过短信发送至 ${this.formData.mobile}。密码为6 - 20位`
} }
}, },
onLoad(event) {}, onLoad(event) {},
onReady() {}, onReady() {},
methods: { methods: {
/** /**
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
if(! /^1\d{10}$/.test(this.formData.mobile)){ if(! /^1\d{10}$/.test(this.formData.mobile)){
this.focusMobile = true this.focusMobile = true
return uni.showToast({ return uni.showToast({
title: '手机号码格式不正确', title: '手机号码格式不正确',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
if(! /^\d{6}$/.test(this.formData.code)){ if(! /^\d{6}$/.test(this.formData.code)){
this.$refs.smsForm.focusSmsCodeInput = true this.$refs.smsForm.focusSmsCodeInput = true
return uni.showToast({ return uni.showToast({
title: '验证码格式不正确', title: '验证码格式不正确',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
} }
console.log(this.formData); const uniIdCo = uniCloud.importObject("uni-id-co")
const uniIdCo = uniCloud.importObject("uni-id-co") uniIdCo.bindMobileBySms(this.formData).then(e => {
uniIdCo.bindMobileBySms(this.formData).then(e => { uni.showToast({
console.log(e); title: e.errMsg,
uni.showToast({ icon: 'none',
title: e.errMsg, duration: 3000
icon: 'none', });
duration: 3000 // #ifdef APP-NVUE
}); const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
// #ifdef APP-NVUE // #endif
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE // #ifndef APP-NVUE
// #endif const eventChannel = this.getOpenerEventChannel();
// #ifndef APP-NVUE // #endif
const eventChannel = this.getOpenerEventChannel(); mutations.setUserInfo(this.formData)
// #endif uni.navigateBack()
mutations.setUserInfo(this.formData) }).catch(e => {
uni.navigateBack() console.log(e);
}).catch(e => { if (e.errCode == 'uni-id-captcha-required') {
console.log(e); this.$refs.popup.open()
if (e.errCode == 'uni-id-captcha-required') { }
this.$refs.popup.open() }).finally(e => {
} this.formData.captcha = ""
}).finally(e => { })
this.formData.captcha = "" }
}) }
} }
} </script>
}
</script> <style lang="scss">
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
<style lang="scss">
@import "@/uni_modules/uni-id-pages/common/login-page.scss"; .uni-content {
padding: 0;
.uni-content { align-items: center;
padding: 0; justify-content: center;
align-items: center; padding: 50rpx;
justify-content: center; padding-top: 10px;
padding: 50rpx; }
padding-top: 10px;
}
@media screen and (min-width: 690px) {
.uni-content{
@media screen and (min-width: 690px) { padding: 30px 40px 40px;
.uni-content{ }
padding: 30px 40px 40px; }
}
} /* #ifndef APP-NVUE || VUE3 */
.uni-content ::v-deep .uni-easyinput__content {}
/* #ifndef APP-NVUE || VUE3 */
.uni-content ::v-deep .uni-easyinput__content {} /* #endif */
.input-box {
/* #endif */ width: 100%;
.input-box { margin-top: 16px;
width: 100%; background-color: #f9f9f9;
margin-top: 16px; border-radius: 6rpx;
background-color: #f9f9f9; flex-direction: row;
border-radius: 6rpx; flex-wrap: nowrap;
flex-direction: row; margin-bottom: 10px;
flex-wrap: nowrap; }
margin-bottom: 10px;
} .send-btn-box {
margin-top: 15px;
.send-btn-box { }
margin-top: 15px; </style>
}
</style>
...@@ -82,8 +82,6 @@ ...@@ -82,8 +82,6 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
console.log("formData", this.formData);
console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -94,7 +92,6 @@ ...@@ -94,7 +92,6 @@
oldPassword, oldPassword,
newPassword newPassword
}).then(e => { }).then(e => {
console.log(e);
uni.removeStorageSync('uni_id_token'); uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0) uni.setStorageSync('uni_id_token_expired', 0)
uni.redirectTo({ uni.redirectTo({
...@@ -109,7 +106,6 @@ ...@@ -109,7 +106,6 @@
}).catch(errors => { }).catch(errors => {
let key = errors[0].key let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key, 'focus' + key);
this['focus' + key] = true this['focus' + key] = true
}) })
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" <svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve"> viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
<style type="text/css"> <style type="text/css">
.st0{fill:#606060;} .st0{fill:#606060;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:2.4306;stroke-miterlimit:10;} .st1{fill:none;stroke:#FFFFFF;stroke-width:2.4306;stroke-miterlimit:10;}
.st2{fill:#FFFFFF;} .st2{fill:#FFFFFF;}
</style> </style>
<g> <g>
<path class="st2" d="M11.6,11c0.4,0.4,0.6,0.9,0.6,1.5c0,0.6-0.2,1.1-0.6,1.4c-0.4,0.4-0.9,0.6-1.5,0.6c-0.6,0-1.1-0.2-1.5-0.6 <path class="st2" d="M11.6,11c0.4,0.4,0.6,0.9,0.6,1.5c0,0.6-0.2,1.1-0.6,1.4c-0.4,0.4-0.9,0.6-1.5,0.6c-0.6,0-1.1-0.2-1.5-0.6
c-0.4-0.4-0.6-0.9-0.6-1.4s0.2-1.1,0.6-1.5c0.4-0.4,0.9-0.6,1.5-0.6C10.8,10.4,11.2,10.6,11.6,11z M24.6,18.4V6.7H5.4v12l1.8-1.8 c-0.4-0.4-0.6-0.9-0.6-1.4s0.2-1.1,0.6-1.5c0.4-0.4,0.9-0.6,1.5-0.6C10.8,10.4,11.2,10.6,11.6,11z M24.6,18.4V6.7H5.4v12l1.8-1.8
c0.3-0.3,0.6-0.4,1-0.4c0.4,0,0.7,0.1,1,0.4l1.8,1.8l5.8-7c0.3-0.3,0.6-0.5,1.1-0.5c0.4,0,0.8,0.2,1.1,0.5 c0.3-0.3,0.6-0.4,1-0.4c0.4,0,0.7,0.1,1,0.4l1.8,1.8l5.8-7c0.3-0.3,0.6-0.5,1.1-0.5c0.4,0,0.8,0.2,1.1,0.5
C18.8,11.6,24.6,18.4,24.6,18.4z M25.6,5.7C25.9,6,26,6.3,26,6.7v16.1c0,0.4-0.1,0.7-0.4,1c-0.3,0.3-0.6,0.4-1,0.4H5.4 C18.8,11.6,24.6,18.4,24.6,18.4z M25.6,5.7C25.9,6,26,6.3,26,6.7v16.1c0,0.4-0.1,0.7-0.4,1c-0.3,0.3-0.6,0.4-1,0.4H5.4
c-0.4,0-0.7-0.1-1-0.4c-0.3-0.3-0.4-0.6-0.4-1V6.7c0-0.4,0.1-0.7,0.4-1c0.3-0.3,0.6-0.4,1-0.4h19.3C25,5.3,25.3,5.4,25.6,5.7z"/> c-0.4,0-0.7-0.1-1-0.4c-0.3-0.3-0.4-0.6-0.4-1V6.7c0-0.4,0.1-0.7,0.4-1c0.3-0.3,0.6-0.4,1-0.4h19.3C25,5.3,25.3,5.4,25.6,5.7z"/>
<path class="st1" d="M24.3,21.5H5.7c-0.2,0-0.3-0.2-0.3-0.3V7c0-0.2,0.2-0.3,0.3-0.3h18.6c0.2,0,0.3,0.2,0.3,0.3v14.2 <path class="st1" d="M24.3,21.5H5.7c-0.2,0-0.3-0.2-0.3-0.3V7c0-0.2,0.2-0.3,0.3-0.3h18.6c0.2,0,0.3,0.2,0.3,0.3v14.2
C24.6,21.3,24.5,21.5,24.3,21.5z"/> C24.6,21.3,24.5,21.5,24.3,21.5z"/>
</g> </g>
</svg> </svg>
...@@ -39,11 +39,8 @@ ...@@ -39,11 +39,8 @@
content: '已经仔细阅读注销提示,知晓可能带来的后果,并确认要注销', content: '已经仔细阅读注销提示,知晓可能带来的后果,并确认要注销',
complete: (e) => { complete: (e) => {
if (e.confirm) { if (e.confirm) {
const db = uniCloud.database();
const uniIdco = uniCloud.importObject("uni-id-co"); const uniIdco = uniCloud.importObject("uni-id-co");
uniIdco.closeAccount().then((e) => { uniIdco.closeAccount().then((e) => {
console.log(e);
uni.showToast({ uni.showToast({
title: '注销成功', title: '注销成功',
duration: 3000 duration: 3000
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1675667510055" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4003" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M807.936 106.656h-76a24.32 24.32 0 0 0-17.92 7.936 27.744 27.744 0 0 0-7.424 19.104c0 6.944 2.464 13.792 7.424 19.104a24.32 24.32 0 0 0 17.92 7.904h76v81.088c0 6.944 2.432 13.76 7.424 19.104a24.32 24.32 0 0 0 35.808 0 27.744 27.744 0 0 0 7.424-19.104V160.704c0-29.824-22.72-54.048-50.656-54.048zM833.248 512a25.12 25.12 0 0 0-17.92 7.392 25.12 25.12 0 0 0-7.392 17.92v76h-76a25.12 25.12 0 0 0-17.92 7.424c-1.344 1.344-2.08 3.072-3.072 4.704-28.576-27.52-60.704-50.112-96.256-65.152 72.192-43.136 117.888-126.08 103.872-219.296-13.216-87.456-81.056-160.576-167.648-178.656a228.16 228.16 0 0 0-46.944-4.896 217.056 217.056 0 0 0-217.12 217.12c0 79.264 42.976 147.936 106.368 185.824-35.456 15.04-67.648 37.632-96.256 65.152-0.96-1.632-1.696-3.36-3.072-4.704a25.12 25.12 0 0 0-17.92-7.424H200v-76a25.12 25.12 0 0 0-7.424-17.92 25.12 25.12 0 0 0-17.92-7.424 25.12 25.12 0 0 0-17.92 7.424 25.12 25.12 0 0 0-7.392 17.92v76c0 27.936 22.72 50.656 50.656 50.656H262.4c-42.336 54.816-71.712 123.488-80.96 200.192-3.424 28.224 19.104 53.12 47.488 53.12h550.048c28.416 0 50.848-24.96 47.488-53.12-9.216-76.8-38.624-145.472-80.96-200.288h62.4c27.968 0 50.688-22.72 50.688-50.656V537.28a25.12 25.12 0 0 0-7.424-17.92 25.12 25.12 0 0 0-17.92-7.392zM174.72 268.8a24.32 24.32 0 0 0 17.888-7.904 27.744 27.744 0 0 0 7.424-19.104V160.704h76a24.32 24.32 0 0 0 17.92-7.904 27.744 27.744 0 0 0 7.392-19.104 27.744 27.744 0 0 0-7.424-19.104 24.32 24.32 0 0 0-17.92-7.936H200c-27.968 0-50.656 24.224-50.656 54.08v81.056c0 6.944 2.432 13.76 7.392 19.104a24.32 24.32 0 0 0 17.92 7.904z" fill="#72a7ff" p-id="4004"></path></svg>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册