From b359bc861ac161d1d8a37e16d0cf661bb5d9d12b Mon Sep 17 00:00:00 2001 From: linju Date: Tue, 29 Nov 2022 19:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=90=84=E7=B1=BB?= =?UTF-8?q?=E9=94=99=E8=AF=AFtoast=E6=8F=90=E7=A4=BA=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=B8=BA3=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/uni-captcha/uni-captcha.vue | 4 ++-- .../uni-forms-item/uni-forms-item.vue | 2 +- uni_modules/uni-id-pages/common/store.js | 13 +++++++------ .../uni-id-pages-email-form.vue | 15 ++++++++++----- .../uni-id-pages-fab-login.vue | 18 ++++++++++++------ .../uni-id-pages-sms-form.vue | 12 ++++++++---- .../uni-id-pages/pages/login/login-smscode.vue | 3 ++- .../pages/login/login-withoutpwd.vue | 6 ++++-- .../uni-id-pages/pages/login/login-withpwd.vue | 9 ++++++--- .../pages/register/register-admin.vue | 3 ++- .../uni-id-pages/pages/register/register.vue | 3 ++- .../pages/userinfo/bind-mobile/bind-mobile.vue | 9 ++++++--- .../cropImage/limeClipper/limeClipper.vue | 12 ++++++++---- .../pages/userinfo/deactivate/deactivate.vue | 3 ++- .../uni-id-pages/pages/userinfo/userinfo.vue | 3 ++- 15 files changed, 74 insertions(+), 41 deletions(-) diff --git a/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue b/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue index 1399e19..0dc066a 100644 --- a/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue +++ b/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue @@ -62,7 +62,7 @@ } else { uni.showToast({ title: 'scene不能为空', - icon: 'none' + icon: 'none' }); } }, @@ -88,7 +88,7 @@ .catch(e => { uni.showToast({ title: e.message, - icon: 'none' + icon: 'none' }); }).finally(e => { this.loging = false diff --git a/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue b/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue index 349ee70..e31b488 100644 --- a/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue +++ b/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue @@ -275,7 +275,7 @@ if (errShowType === 'toast') { uni.showToast({ title: result.errorMessage || '校验错误', - icon: 'none' + icon: 'none' }); } if (errShowType === 'modal') { diff --git a/uni_modules/uni-id-pages/common/store.js b/uni_modules/uni-id-pages/common/store.js index 1c1d075..b9b73ce 100644 --- a/uni_modules/uni-id-pages/common/store.js +++ b/uni_modules/uni-id-pages/common/store.js @@ -3,13 +3,11 @@ const uniIdCo = uniCloud.importObject("uni-id-co") const db = uniCloud.database(); const usersTable = db.collection('uni-id-users') - - let hostUserInfo = uni.getStorageSync('uni-id-pages-userInfo')||{} console.log( hostUserInfo); const data = { userInfo: hostUserInfo, - hasLogin: Object.keys(hostUserInfo).length != 0 + hasLogin: getUniIdTokenExpired() > Date.now() } console.log('data', data); @@ -23,13 +21,15 @@ export const mutations = { if (e.result.updated) { uni.showToast({ title: "更新成功", - icon: 'none' + icon: 'none', + duration: 3000 }); this.setUserInfo(data) } else { uni.showToast({ title: "没有改变", - icon: 'none' + icon: 'none', + duration: 3000 }); } }) @@ -80,7 +80,8 @@ export const mutations = { if (showToast) { uni.showToast({ title: toastText, - icon: 'none' + icon: 'none', + duration: 3000 }); } this.updateUserInfo() diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-email-form/uni-id-pages-email-form.vue b/uni_modules/uni-id-pages/components/uni-id-pages-email-form/uni-id-pages-email-form.vue index e95652b..3a08fe5 100644 --- a/uni_modules/uni-id-pages/components/uni-id-pages-email-form/uni-id-pages-email-form.vue +++ b/uni_modules/uni-id-pages/components/uni-id-pages-email-form/uni-id-pages-email-form.vue @@ -123,17 +123,20 @@ this.$refs.captcha.focusCaptchaInput = true return uni.showToast({ title: '请先输入图形验证码', - icon: 'none' + icon: 'none', + duration: 3000 }); } if(!this.email) return uni.showToast({ title: "请输入邮箱", - icon: 'none' + icon: 'none', + duration: 3000 }); let reg_email = /@/; if (!reg_email.test(this.email)) return uni.showToast({ title: "邮箱格式错误", - icon: 'none' + icon: 'none', + duration: 3000 }); const uniIdCo = uniCloud.importObject("uni-id-co", { customUI: true @@ -152,7 +155,8 @@ console.log(result.code); uni.showToast({ title: "邮箱验证码发送成功", - icon: 'none' + icon: 'none', + duration: 3000 }); this.reverseNumber = Number(this.count); this.getCode(); @@ -171,7 +175,8 @@ this.captcha = "" uni.showToast({ title: e.message, - icon: 'none' + icon: 'none', + duration: 3000 }); } }) diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue index 19ef876..6410fce 100644 --- a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue +++ b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue @@ -248,7 +248,8 @@ ].includes(type)) { return uni.showToast({ title: '该登录方式暂未实现,欢迎提交pr', - icon: 'none' + icon: 'none', + duration: 3000 }); } @@ -264,7 +265,8 @@ }else{ return uni.showToast({ title: '当前设备不支持此登录,请选择其他登录方式', - icon: 'none' + icon: 'none', + duration: 3000 }); } }, err => { @@ -286,7 +288,8 @@ ) { return uni.showToast({ title: '当前设备不支持此登录,请选择其他登录方式', - icon: 'none' + icon: 'none', + duration: 3000 }); } @@ -359,7 +362,8 @@ //console.log("你未同意隐私政策协议"); uni.showToast({ title: "你未同意隐私政策协议", - icon: 'none' + icon: 'none', + duration: 3000 }); } } @@ -383,7 +387,8 @@ fail(err) { uni.showToast({ title: JSON.stringify(err), - icon: 'none' + icon: 'none', + duration: 3000 }); }, complete: async e => { @@ -443,7 +448,8 @@ console.log("login-result", result); uni.showToast({ title: '登录成功', - icon: 'none' + icon: 'none', + duration: 2000 }); // #ifdef MP-WEIXIN //如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料 diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue b/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue index 81b2292..bd8ac4e 100644 --- a/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue +++ b/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue @@ -123,13 +123,15 @@ this.$refs.captcha.focusCaptchaInput = true return uni.showToast({ title: '请先输入图形验证码', - icon: 'none' + icon: 'none', + duration: 3000 }); } let reg_phone = /^1\d{10}$/; if (!reg_phone.test(this.phone)) return uni.showToast({ title: "手机号格式错误", - icon: 'none' + icon: 'none', + duration: 3000 }); const uniIdCo = uniCloud.importObject("uni-id-co", { customUI: true @@ -147,7 +149,8 @@ console.log(result.code); uni.showToast({ title: "短信验证码发送成功", - icon: 'none' + icon: 'none', + duration: 3000 }); this.reverseNumber = Number(this.count); this.getCode(); @@ -166,7 +169,8 @@ this.captcha = "" uni.showToast({ title: e.message, - icon: 'none' + icon: 'none', + duration: 3000 }); } }) diff --git a/uni_modules/uni-id-pages/pages/login/login-smscode.vue b/uni_modules/uni-id-pages/pages/login/login-smscode.vue index df67bc4..7e69e1d 100644 --- a/uni_modules/uni-id-pages/pages/login/login-smscode.vue +++ b/uni_modules/uni-id-pages/pages/login/login-smscode.vue @@ -59,7 +59,8 @@ this.$refs.smsCode.focusSmsCodeInput = true return uni.showToast({ title: '验证码不能为空', - icon: 'none' + icon: 'none', + duration: 3000 }); } uniIdCo.loginBySms({ diff --git a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue index 868776c..fefc036 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue +++ b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue @@ -116,7 +116,8 @@ this.focusPhone = true return uni.showToast({ title: "手机号码格式不正确", - icon: 'none' + icon: 'none', + duration: 3000 }); } if (this.needAgreements && !this.agree) { @@ -136,7 +137,8 @@ chooseArea() { uni.showToast({ title: '暂不支持其他国家', - icon: 'none' + icon: 'none', + duration: 3000 }); }, } diff --git a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue index 7978c1e..cd35d5b 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue +++ b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue @@ -84,21 +84,24 @@ this.focusPassword = true return uni.showToast({ title: '请输入密码', - icon: 'none' + icon: 'none', + duration: 3000 }); } if (!this.username.length) { this.focusUsername = true return uni.showToast({ title: '请输入手机号/用户名/邮箱', - icon: 'none' + icon: 'none', + duration: 3000 }); } if (this.needCaptcha && this.captcha.length != 4) { this.$refs.captcha.getImageCaptcha() return uni.showToast({ title: '请输入验证码', - icon: 'none' + icon: 'none', + duration: 3000 }); } diff --git a/uni_modules/uni-id-pages/pages/register/register-admin.vue b/uni_modules/uni-id-pages/pages/register/register-admin.vue index 71690d9..1fc81eb 100644 --- a/uni_modules/uni-id-pages/pages/register/register-admin.vue +++ b/uni_modules/uni-id-pages/pages/register/register-admin.vue @@ -89,7 +89,8 @@ this.$refs.captcha.focusCaptchaInput = true return uni.showToast({ title: '请输入验证码', - icon: 'none' + icon: 'none', + duration: 3000 }); } if (this.needAgreements && !this.agree) { diff --git a/uni_modules/uni-id-pages/pages/register/register.vue b/uni_modules/uni-id-pages/pages/register/register.vue index e769f34..04f85b7 100644 --- a/uni_modules/uni-id-pages/pages/register/register.vue +++ b/uni_modules/uni-id-pages/pages/register/register.vue @@ -96,7 +96,8 @@ this.$refs.captcha.focusCaptchaInput = true return uni.showToast({ title: '请输入验证码', - icon: 'none' + icon: 'none', + duration: 3000 }); } if (this.needAgreements && !this.agree) { diff --git a/uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile.vue b/uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile.vue index 15d68eb..264964c 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile.vue @@ -52,14 +52,16 @@ this.focusMobile = true return uni.showToast({ title: '手机号码格式不正确', - icon: 'none' + icon: 'none', + duration: 3000 }); } if(! /^\d{6}$/.test(this.formData.code)){ this.$refs.smsForm.focusSmsCodeInput = true return uni.showToast({ title: '验证码格式不正确', - icon: 'none' + icon: 'none', + duration: 3000 }); } @@ -69,7 +71,8 @@ console.log(e); uni.showToast({ title: e.errMsg, - icon: 'none' + icon: 'none', + duration: 3000 }); // #ifdef APP-NVUE const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE diff --git a/uni_modules/uni-id-pages/pages/userinfo/cropImage/limeClipper/limeClipper.vue b/uni_modules/uni-id-pages/pages/userinfo/cropImage/limeClipper/limeClipper.vue index 8ae9389..4fc62b3 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/cropImage/limeClipper/limeClipper.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/cropImage/limeClipper/limeClipper.vue @@ -506,7 +506,8 @@ export default { if (!this.image) { uni.showToast({ title: '请选择图片', - icon: 'none' + icon: 'none', + duration: 3000 }); return; } @@ -536,7 +537,8 @@ export default { if (!this.image) { uni.showToast({ title: '请选择图片', - icon: 'none' + icon: 'none', + duration: 3000 }); return; } @@ -721,7 +723,8 @@ export default { if (!this.image) { uni.showToast({ title: '请选择图片', - icon: 'none' + icon: 'none', + duration: 3000 }); return; } @@ -739,7 +742,8 @@ export default { if (!this.image) { uni.showToast({ title: '请选择图片', - icon: 'none' + icon: 'none', + duration: 3000 }); return; } diff --git a/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate.vue b/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate.vue index 160a4b6..0ae7b79 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate.vue @@ -45,7 +45,8 @@ uniIdco.closeAccount().then((e) => { console.log(e); uni.showToast({ - title: '注销成功' + title: '注销成功', + duration: 3000 }); uni.removeStorageSync('uni_id_token'); uni.setStorageSync('uni_id_token_expired', 0) diff --git a/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue b/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue index 9fb17c9..e0e8178 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue @@ -183,7 +183,8 @@ }) if (res.errCode) { uni.showToast({ - title: res.errMsg || '绑定失败' + title: res.errMsg || '绑定失败', + duration: 3000 }) } await mutations.updateUserInfo() -- GitLab