提交 3d4c85b7 编写于 作者: study夏羽's avatar study夏羽

更新uni-id-pages

上级 2ca6b93e
......@@ -9,3 +9,4 @@ package-lock.json
/manifest.json
/env.js
/vue.config.js
/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/captcha-config/
......@@ -191,13 +191,12 @@
/* #ifndef APP-NVUE */
display: flex;
overflow: hidden;
box-sizing: border-box;
min-width: 20px;
font-feature-settings: "tnum";
box-sizing: border-box;
/* #endif */
justify-content: center;
flex-direction: row;
height: 20px;
min-width: 20px;
padding: 0 4px;
line-height: 18px;
color: #fff;
......@@ -207,6 +206,7 @@
border: 1px solid #fff;
text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-feature-settings: "tnum";
font-size: $bage-size;
/* #ifdef H5 */
z-index: 999;
......
## 1.0.40(2023-01-16)
- 更新依赖的 验证码插件`uni-captcha`版本的版本为 0.6.4 修复 部分情况下APP端无法获取验证码的问题 [详情参考](https://ext.dcloud.net.cn/plugin?id=4048)
- 修复 客户端token过期后,点击退出登录按钮报错的问题
- uni-id-co 修复 updateUser 接口`手机号``邮箱`参数值为空字符串时,修改无效的问题
## 1.0.39(2022-12-28)
- uni-id-co 修复 URL化时第三方登录无法获取 uniPlatform 参数
- uni-id-co 修复 validator error
......
......@@ -62,7 +62,14 @@ export const mutations = {
return data
},
async logout() {
await uniIdCo.logout()
// 1. 已经过期就不需要调用服务端的注销接口 2.即使调用注销接口失败,不能阻塞客户端
if(uniCloud.getCurrentUserInfo().tokenExpired > Date.now()){
try{
await uniIdCo.logout()
}catch(e){
console.error(e);
}
}
uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0)
uni.redirectTo({
......
{
"id": "uni-id-pages",
"displayName": "uni-id-pages",
"version": "1.0.39",
"version": "1.0.40",
"description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [
"用户管理",
......
......@@ -96,7 +96,6 @@
duration: 3000
});
}
console.log("this.needCaptcha: ",this.needCaptcha);
if (this.needCaptcha && this.captcha.length != 4) {
this.$refs.captcha.getImageCaptcha()
return uni.showToast({
......
<!-- 绑定手机号码页 -->
<template>
<view class="uni-content">
<match-media :min-width="690">
<view class="login-logo">
<image :src="logo"></image>
</view>
<!-- 顶部文字 -->
<text class="title title-box">绑定手机号</text>
</match-media>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput clearable :focus="focusMobile" @blur="focusMobile = false" type="number" class="input-box" :inputBorder="false" v-model="formData.mobile"
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>
<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>
</view>
</template>
<script>
import {
store,
mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
export default {
data() {
return {
formData: {
mobile: "",
code: "",
captcha: ""
},
focusMobile:true,
logo: "/static/logo.png"
}
},
computed: {
tipText() {
return `验证码已通过短信发送至 ${this.formData.mobile}。密码为6 - 20位`
}
},
onLoad(event) {},
onReady() {},
methods: {
/**
* 完成并提交
*/
async submit() {
if(! /^1\d{10}$/.test(this.formData.mobile)){
this.focusMobile = true
return uni.showToast({
title: '手机号码格式不正确',
icon: 'none',
duration: 3000
});
}
console.log("this.formData.code: ",this.formData.code);
if(! /^\d{6}$/.test(this.formData.code)){
this.$refs.smsForm.focusSmsCodeInput = true
return uni.showToast({
title: '验证码格式不正确',
icon: 'none',
duration: 3000
});
}
// console.log(this.formData);
const uniIdCo = uniCloud.importObject("uni-id-co")
return await uniIdCo.bindMobileBySms(this.formData).then(e => {
// console.log(e);
uni.showToast({
title: e.errMsg,
icon: 'none',
duration: 3000
});
// #ifdef APP-NVUE
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
// #endif
// #ifndef APP-NVUE
const eventChannel = this.getOpenerEventChannel();
// #endif
mutations.setUserInfo(this.formData)
<!-- 绑定手机号码页 -->
<template>
<view class="uni-content">
<match-media :min-width="690">
<view class="login-logo">
<image :src="logo"></image>
</view>
<!-- 顶部文字 -->
<text class="title title-box">绑定手机号</text>
</match-media>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput clearable :focus="focusMobile" @blur="focusMobile = false" type="number" class="input-box" :inputBorder="false" v-model="formData.mobile"
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>
<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>
</view>
</template>
<script>
import {
store,
mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
export default {
data() {
return {
formData: {
mobile: "",
code: "",
captcha: ""
},
focusMobile:true,
logo: "/static/logo.png"
}
},
computed: {
tipText() {
return `验证码已通过短信发送至 ${this.formData.mobile}。密码为6 - 20位`
}
},
onLoad(event) {},
onReady() {},
methods: {
/**
* 完成并提交
*/
async submit() {
if(! /^1\d{10}$/.test(this.formData.mobile)){
this.focusMobile = true
return uni.showToast({
title: '手机号码格式不正确',
icon: 'none',
duration: 3000
});
}
if(! /^\d{6}$/.test(this.formData.code)){
this.$refs.smsForm.focusSmsCodeInput = true
return uni.showToast({
title: '验证码格式不正确',
icon: 'none',
duration: 3000
});
}
// console.log(this.formData);
const uniIdCo = uniCloud.importObject("uni-id-co")
return await uniIdCo.bindMobileBySms(this.formData).then(e => {
// console.log(e);
uni.showToast({
title: e.errMsg,
icon: 'none',
duration: 3000
});
// #ifdef APP-NVUE
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
// #endif
// #ifndef APP-NVUE
const eventChannel = this.getOpenerEventChannel();
// #endif
mutations.setUserInfo(this.formData)
uni.navigateBack()
return e
}).catch(e => {
console.log(e);
if (e.errCode == 'uni-id-captcha-required') {
this.$refs.popup.open()
return e
}).catch(e => {
console.log(e,"bindMobileBySms++++++++++");
if (e.errCode == 'uni-id-captcha-required') {
this.$refs.popup.open()
}
return e
}).finally(e => {
return e
}).finally(e => {
this.formData.captcha = ""
return e
})
}
}
}
</script>
<style lang="scss">
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
.uni-content {
padding: 0;
align-items: center;
justify-content: center;
padding: 50rpx;
padding-top: 10px;
}
@media screen and (min-width: 690px) {
.uni-content{
padding: 30px 40px 40px;
}
}
/* #ifndef APP-NVUE || VUE3 */
.uni-content ::v-deep .uni-easyinput__content {}
/* #endif */
.input-box {
width: 100%;
margin-top: 16px;
background-color: #f9f9f9;
border-radius: 6rpx;
flex-direction: row;
flex-wrap: nowrap;
margin-bottom: 10px;
}
.send-btn-box {
margin-top: 15px;
}
</style>
return e
})
}
}
}
</script>
<style lang="scss">
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
.uni-content {
padding: 0;
align-items: center;
justify-content: center;
padding: 50rpx;
padding-top: 10px;
}
@media screen and (min-width: 690px) {
.uni-content{
padding: 30px 40px 40px;
}
}
/* #ifndef APP-NVUE || VUE3 */
.uni-content ::v-deep .uni-easyinput__content {}
/* #endif */
.input-box {
width: 100%;
margin-top: 16px;
background-color: #f9f9f9;
border-radius: 6rpx;
flex-direction: row;
flex-wrap: nowrap;
margin-bottom: 10px;
}
.send-btn-box {
margin-top: 15px;
}
</style>
......@@ -94,7 +94,7 @@
oldPassword,
newPassword
}).then(e => {
// console.log(e);
console.log("e:------------- ",e);
uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0)
uni.redirectTo({
......@@ -102,16 +102,14 @@
})
return e
}).catch(e => {
console.log("e:------------ ",e);
// uni.showModal({
// content: e.message,
// showCancel: false
// });
uni.showModal({
content: e.message,
showCancel: false
});
return e
})
}).catch(errors => {
console.log("errors: ------------",errors);
console.log("errors: ",errors);
let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase())
// console.log(key, 'focus' + key);
......
......@@ -33,16 +33,16 @@
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
const uniIdCo = uniCloud.importObject("uni-id-co")
import {
store,
mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
import {
store,
mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
export default {
computed: {
userInfo() {
return store.userInfo
}
},
computed: {
userInfo() {
return store.userInfo
}
},
data() {
return {
univerifyStyle: {
......@@ -57,8 +57,8 @@
// mobile:'',
// nickname:''
// },
hasPwd: false,
showLoginManage: false //通过页面传参隐藏登录&退出登录按钮
hasPwd:false,
showLoginManage:false//通过页面传参隐藏登录&退出登录按钮
}
},
async onShow() {
......@@ -66,9 +66,8 @@
this.univerifyStyle.otherLoginButton.title = "其他号码绑定"
},
async onLoad(e) {
console.log("store.userInfo:---- ",store.userInfo);
if (e.showLoginManage) {
this.showLoginManage = true //通过页面传参隐藏登录&退出登录按钮
if(e.showLoginManage){
this.showLoginManage = true//通过页面传参隐藏登录&退出登录按钮
}
//判断当前用户是否有密码,否则就不显示密码修改功能
let res = await uniIdCo.getAccountInfo()
......@@ -83,13 +82,13 @@
}
})
},
logout() {
mutations.logout()
},
bindMobileSuccess() {
mutations.updateUserInfo()
},
changePassword() {
logout(){
mutations.logout()
},
bindMobileSuccess(){
mutations.updateUserInfo()
},
changePassword(){
uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd',
complete: (e) => {
......@@ -157,9 +156,9 @@
this.$refs.dialog.open()
}
},
deactivate() {
deactivate(){
uni.navigateTo({
url: "/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate"
url:"/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate"
})
},
async bindThirdAccount(provider) {
......@@ -199,6 +198,7 @@
}
</script>
<style lang="scss" scoped>
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
.uni-content {
......@@ -211,7 +211,6 @@
box-sizing: border-box;
flex-direction: column;
}
@media screen and (min-width: 690px) {
.uni-content {
padding: 0;
......@@ -223,7 +222,6 @@
box-shadow: none;
}
}
/* #endif */
.avatar {
align-items: center;
......@@ -247,7 +245,7 @@
width: 80%;
}
.mt10 {
.mt10{
margin-top: 10px;
}
</style>
......@@ -23,10 +23,10 @@
</view>
<view class="uni-list-chat__content">
<view class="uni-list-chat__content-main">
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
<view style="flex-direction: row;">
<text class="draft" v-if="isDraft">[草稿]</text>
<text class="uni-list-chat__content-note uni-ellipsis">{{isDraft?note.slice(14):note}}</text>
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
<view style="flex-direction: row;">
<text class="draft" v-if="isDraft">[草稿]</text>
<text class="uni-list-chat__content-note uni-ellipsis">{{isDraft?note.slice(14):note}}</text>
</view>
</view>
<view class="uni-list-chat__content-extra">
......@@ -123,9 +123,9 @@
}
},
// inject: ['list'],
computed: {
isDraft(){
return this.note.slice(0,14) == '[uni-im-draft]'
computed: {
isDraft(){
return this.note.slice(0,14) == '[uni-im-draft]'
},
isSingle() {
if (this.badgeText === 'dot') {
......@@ -151,32 +151,32 @@
return 'avatarItem--1';
}
}
},
watch: {
avatar:{
handler(avatar) {
if(avatar.substr(0,8) == 'cloud://'){
uniCloud.getTempFileURL({
fileList: [avatar]
}).then(res=>{
// console.log(res);
// 兼容uniCloud私有化部署
let fileList = res.fileList || res.result.fileList
this.avatarUrl = fileList[0].tempFileURL
})
}else{
this.avatarUrl = avatar
}
},
immediate: true
}
},
watch: {
avatar:{
handler(avatar) {
if(avatar.substr(0,8) == 'cloud://'){
uniCloud.getTempFileURL({
fileList: [avatar]
}).then(res=>{
// console.log(res);
// 兼容uniCloud私有化部署
let fileList = res.fileList || res.result.fileList
this.avatarUrl = fileList[0].tempFileURL
})
}else{
this.avatarUrl = avatar
}
},
immediate: true
}
},
data() {
return {
isFirstChild: false,
border: true,
// avatarList: 3,
imageWidth: 50,
imageWidth: 50,
avatarUrl:''
};
},
......@@ -477,13 +477,13 @@
font-size: $note-size;
font-weight: $title-weight;
overflow: hidden;
}
.draft{
color: #eb3a41;
/* #ifndef APP-NVUE */
flex-shrink: 0;
/* #endif */
padding-right: 3px;
}
.draft{
color: #eb3a41;
/* #ifndef APP-NVUE */
flex-shrink: 0;
/* #endif */
padding-right: 3px;
}
.uni-list-chat__content-extra {
......
......@@ -527,4 +527,4 @@
text-overflow: ellipsis;
/* #endif */
}
</style>
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册