提交 b359bc86 编写于 作者: DCloud_JSON's avatar DCloud_JSON

修改 各类错误toast提示时间为3秒

上级 26a60d45
...@@ -3,13 +3,11 @@ const uniIdCo = uniCloud.importObject("uni-id-co") ...@@ -3,13 +3,11 @@ 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: getUniIdTokenExpired() > Date.now()
} }
console.log('data', data); console.log('data', data);
...@@ -23,13 +21,15 @@ export const mutations = { ...@@ -23,13 +21,15 @@ export const mutations = {
if (e.result.updated) { if (e.result.updated) {
uni.showToast({ uni.showToast({
title: "更新成功", title: "更新成功",
icon: 'none' icon: 'none',
duration: 3000
}); });
this.setUserInfo(data) this.setUserInfo(data)
} else { } else {
uni.showToast({ uni.showToast({
title: "没有改变", title: "没有改变",
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
}) })
...@@ -80,7 +80,8 @@ export const mutations = { ...@@ -80,7 +80,8 @@ export const mutations = {
if (showToast) { if (showToast) {
uni.showToast({ uni.showToast({
title: toastText, title: toastText,
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
this.updateUserInfo() this.updateUserInfo()
......
...@@ -123,17 +123,20 @@ ...@@ -123,17 +123,20 @@
this.$refs.captcha.focusCaptchaInput = true this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({ return uni.showToast({
title: '请先输入图形验证码', title: '请先输入图形验证码',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
if(!this.email) return uni.showToast({ if(!this.email) return uni.showToast({
title: "请输入邮箱", title: "请输入邮箱",
icon: 'none' icon: 'none',
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
}); });
const uniIdCo = uniCloud.importObject("uni-id-co", { const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true customUI: true
...@@ -152,7 +155,8 @@ ...@@ -152,7 +155,8 @@
console.log(result.code); console.log(result.code);
uni.showToast({ uni.showToast({
title: "邮箱验证码发送成功", title: "邮箱验证码发送成功",
icon: 'none' icon: 'none',
duration: 3000
}); });
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
...@@ -171,7 +175,8 @@ ...@@ -171,7 +175,8 @@
this.captcha = "" this.captcha = ""
uni.showToast({ uni.showToast({
title: e.message, title: e.message,
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
}) })
......
...@@ -248,7 +248,8 @@ ...@@ -248,7 +248,8 @@
].includes(type)) { ].includes(type)) {
return uni.showToast({ return uni.showToast({
title: '该登录方式暂未实现,欢迎提交pr', title: '该登录方式暂未实现,欢迎提交pr',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
...@@ -264,7 +265,8 @@ ...@@ -264,7 +265,8 @@
}else{ }else{
return uni.showToast({ return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式', title: '当前设备不支持此登录,请选择其他登录方式',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
}, err => { }, err => {
...@@ -286,7 +288,8 @@ ...@@ -286,7 +288,8 @@
) { ) {
return uni.showToast({ return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式', title: '当前设备不支持此登录,请选择其他登录方式',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
...@@ -359,7 +362,8 @@ ...@@ -359,7 +362,8 @@
//console.log("你未同意隐私政策协议"); //console.log("你未同意隐私政策协议");
uni.showToast({ uni.showToast({
title: "你未同意隐私政策协议", title: "你未同意隐私政策协议",
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
} }
...@@ -383,7 +387,8 @@ ...@@ -383,7 +387,8 @@
fail(err) { fail(err) {
uni.showToast({ uni.showToast({
title: JSON.stringify(err), title: JSON.stringify(err),
icon: 'none' icon: 'none',
duration: 3000
}); });
}, },
complete: async e => { complete: async e => {
...@@ -443,7 +448,8 @@ ...@@ -443,7 +448,8 @@
console.log("login-result", result); console.log("login-result", result);
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'none' icon: 'none',
duration: 2000
}); });
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
//如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料 //如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料
......
...@@ -123,13 +123,15 @@ ...@@ -123,13 +123,15 @@
this.$refs.captcha.focusCaptchaInput = true this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({ return uni.showToast({
title: '请先输入图形验证码', title: '请先输入图形验证码',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
let reg_phone = /^1\d{10}$/; let reg_phone = /^1\d{10}$/;
if (!reg_phone.test(this.phone)) return uni.showToast({ if (!reg_phone.test(this.phone)) return uni.showToast({
title: "手机号格式错误", title: "手机号格式错误",
icon: 'none' icon: 'none',
duration: 3000
}); });
const uniIdCo = uniCloud.importObject("uni-id-co", { const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true customUI: true
...@@ -147,7 +149,8 @@ ...@@ -147,7 +149,8 @@
console.log(result.code); console.log(result.code);
uni.showToast({ uni.showToast({
title: "短信验证码发送成功", title: "短信验证码发送成功",
icon: 'none' icon: 'none',
duration: 3000
}); });
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
...@@ -166,7 +169,8 @@ ...@@ -166,7 +169,8 @@
this.captcha = "" this.captcha = ""
uni.showToast({ uni.showToast({
title: e.message, title: e.message,
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
}) })
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
this.$refs.smsCode.focusSmsCodeInput = true this.$refs.smsCode.focusSmsCodeInput = true
return uni.showToast({ return uni.showToast({
title: '验证码不能为空', title: '验证码不能为空',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
uniIdCo.loginBySms({ uniIdCo.loginBySms({
......
...@@ -116,7 +116,8 @@ ...@@ -116,7 +116,8 @@
this.focusPhone = true this.focusPhone = true
return uni.showToast({ return uni.showToast({
title: "手机号码格式不正确", title: "手机号码格式不正确",
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
if (this.needAgreements && !this.agree) { if (this.needAgreements && !this.agree) {
...@@ -136,7 +137,8 @@ ...@@ -136,7 +137,8 @@
chooseArea() { chooseArea() {
uni.showToast({ uni.showToast({
title: '暂不支持其他国家', title: '暂不支持其他国家',
icon: 'none' icon: 'none',
duration: 3000
}); });
}, },
} }
......
...@@ -84,21 +84,24 @@ ...@@ -84,21 +84,24 @@
this.focusPassword = true this.focusPassword = true
return uni.showToast({ return uni.showToast({
title: '请输入密码', title: '请输入密码',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
if (!this.username.length) { if (!this.username.length) {
this.focusUsername = true this.focusUsername = true
return uni.showToast({ return uni.showToast({
title: '请输入手机号/用户名/邮箱', title: '请输入手机号/用户名/邮箱',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
if (this.needCaptcha && this.captcha.length != 4) { if (this.needCaptcha && this.captcha.length != 4) {
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
return uni.showToast({ return uni.showToast({
title: '请输入验证码', title: '请输入验证码',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
......
...@@ -89,7 +89,8 @@ ...@@ -89,7 +89,8 @@
this.$refs.captcha.focusCaptchaInput = true this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({ return uni.showToast({
title: '请输入验证码', title: '请输入验证码',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
if (this.needAgreements && !this.agree) { if (this.needAgreements && !this.agree) {
......
...@@ -96,7 +96,8 @@ ...@@ -96,7 +96,8 @@
this.$refs.captcha.focusCaptchaInput = true this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({ return uni.showToast({
title: '请输入验证码', title: '请输入验证码',
icon: 'none' icon: 'none',
duration: 3000
}); });
} }
if (this.needAgreements && !this.agree) { if (this.needAgreements && !this.agree) {
......
...@@ -52,14 +52,16 @@ ...@@ -52,14 +52,16 @@
this.focusMobile = true this.focusMobile = true
return uni.showToast({ return uni.showToast({
title: '手机号码格式不正确', title: '手机号码格式不正确',
icon: 'none' icon: 'none',
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
}); });
} }
...@@ -69,7 +71,8 @@ ...@@ -69,7 +71,8 @@
console.log(e); console.log(e);
uni.showToast({ uni.showToast({
title: e.errMsg, title: e.errMsg,
icon: 'none' icon: 'none',
duration: 3000
}); });
// #ifdef APP-NVUE // #ifdef APP-NVUE
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
......
...@@ -506,7 +506,8 @@ export default { ...@@ -506,7 +506,8 @@ export default {
if (!this.image) { if (!this.image) {
uni.showToast({ uni.showToast({
title: '请选择图片', title: '请选择图片',
icon: 'none' icon: 'none',
duration: 3000
}); });
return; return;
} }
...@@ -536,7 +537,8 @@ export default { ...@@ -536,7 +537,8 @@ export default {
if (!this.image) { if (!this.image) {
uni.showToast({ uni.showToast({
title: '请选择图片', title: '请选择图片',
icon: 'none' icon: 'none',
duration: 3000
}); });
return; return;
} }
...@@ -721,7 +723,8 @@ export default { ...@@ -721,7 +723,8 @@ export default {
if (!this.image) { if (!this.image) {
uni.showToast({ uni.showToast({
title: '请选择图片', title: '请选择图片',
icon: 'none' icon: 'none',
duration: 3000
}); });
return; return;
} }
...@@ -739,7 +742,8 @@ export default { ...@@ -739,7 +742,8 @@ export default {
if (!this.image) { if (!this.image) {
uni.showToast({ uni.showToast({
title: '请选择图片', title: '请选择图片',
icon: 'none' icon: 'none',
duration: 3000
}); });
return; return;
} }
......
...@@ -45,7 +45,8 @@ ...@@ -45,7 +45,8 @@
uniIdco.closeAccount().then((e) => { uniIdco.closeAccount().then((e) => {
console.log(e); console.log(e);
uni.showToast({ uni.showToast({
title: '注销成功' title: '注销成功',
duration: 3000
}); });
uni.removeStorageSync('uni_id_token'); uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0) uni.setStorageSync('uni_id_token_expired', 0)
......
...@@ -183,7 +183,8 @@ ...@@ -183,7 +183,8 @@
}) })
if (res.errCode) { if (res.errCode) {
uni.showToast({ uni.showToast({
title: res.errMsg || '绑定失败' title: res.errMsg || '绑定失败',
duration: 3000
}) })
} }
await mutations.updateUserInfo() await mutations.updateUserInfo()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册