feat: 新增多语言文案、优化导航及工具函数,修复部分业务逻辑
1. 新增多语言资源文件,覆盖文章、预约日期、会员信息、优惠券、表单、购物车、积分商城、分销、AI聊天等多个模块 2. 优化底部导航组件,使用多语言配置替代硬编码文案 3. 重构工具函数,新增从后端数据提取多语言文案的工具方法 4. 修复邀请好友页面的保存提示文案,替换为多语言版本 5. 修复商品SKU组件的提示文案,使用多语言配置 6. 重构AI聊天页面的帮助文档和回复模板,使用多语言配置 7. 优化空状态组件,支持多语言默认文案 8. 修复跳转逻辑,补全参数传递 9. 新增本地开发环境配置
This commit is contained in:
@@ -53,20 +53,7 @@ export default {
|
||||
img: ''
|
||||
},
|
||||
isIphoneX: false,
|
||||
items: [{
|
||||
value: '0',
|
||||
name: '未知'
|
||||
},
|
||||
{
|
||||
value: '1',
|
||||
name: '男',
|
||||
checked: 'true'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
name: '女'
|
||||
}
|
||||
],
|
||||
items: [],
|
||||
current: 0,
|
||||
memberConfig: {
|
||||
is_audit: 0,
|
||||
@@ -95,6 +82,7 @@ export default {
|
||||
}
|
||||
|
||||
this.getRegisterConfig();
|
||||
this.initSexItems();
|
||||
this.initLang();
|
||||
this.getMemberConfig();
|
||||
},
|
||||
@@ -109,7 +97,7 @@ export default {
|
||||
},
|
||||
onHide() {
|
||||
this.seconds = 120;
|
||||
this.formData.mobileCodeText = '获取动态码';
|
||||
this.formData.mobileCodeText = this.$lang('findanimateCode');
|
||||
this.isSend = false;
|
||||
clearInterval(this.timer);
|
||||
},
|
||||
@@ -117,7 +105,7 @@ export default {
|
||||
seconds(value) {
|
||||
if (value == 0) {
|
||||
this.seconds = 120;
|
||||
this.formData.mobileCodeText = '获取动态码';
|
||||
this.formData.mobileCodeText = this.$lang('findanimateCode');
|
||||
this.isSend = false;
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
@@ -138,6 +126,23 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...memberPublic.methods,
|
||||
// 初始化性别选项
|
||||
initSexItems() {
|
||||
this.items = [{
|
||||
value: '0',
|
||||
name: this.$lang('sexUnknown')
|
||||
},
|
||||
{
|
||||
value: '1',
|
||||
name: this.$lang('sexMale'),
|
||||
checked: 'true'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
name: this.$lang('sexFemale')
|
||||
}
|
||||
];
|
||||
},
|
||||
// 初始化语言
|
||||
initLang() {
|
||||
//获取语言列表
|
||||
@@ -182,9 +187,9 @@ export default {
|
||||
this.memberInfoformData.userHeadImg = this.memberInfo.headimg;
|
||||
this.memberInfoformData.number = this.memberInfo.username; //账号
|
||||
this.memberInfoformData.nickName = this.memberInfo.nickname; //昵称
|
||||
this.memberInfoformData.realName = this.memberInfo.realname ? this.memberInfo.realname : '请输入真实姓名'; //真实姓名
|
||||
this.memberInfoformData.sex = this.memberInfo.sex == 0 ? '未知' : this.memberInfo.sex == 1 ? '男' : '女'; //性别
|
||||
this.memberInfoformData.birthday = this.memberInfo.birthday ? this.$util.timeStampTurnTime(this.memberInfo.birthday, 'YYYY-MM-DD') : '请选择生日'; //生日
|
||||
this.memberInfoformData.realName = this.memberInfo.realname ? this.memberInfo.realname : this.$lang('pleaseRealName'); //真实姓名
|
||||
this.memberInfoformData.sex = this.memberInfo.sex == 0 ? this.$lang('sexUnknown') : this.memberInfo.sex == 1 ? this.$lang('sexMale') : this.$lang('sexFemale'); //性别
|
||||
this.memberInfoformData.birthday = this.memberInfo.birthday ? this.$util.timeStampTurnTime(this.memberInfo.birthday, 'YYYY-MM-DD') : this.$lang('pleaseSelectBirthday'); //生日
|
||||
this.memberInfoformData.mobile = this.memberInfo.mobile; //手机号
|
||||
|
||||
this.formData.username = this.memberInfo.username; //用户名
|
||||
@@ -399,14 +404,14 @@ export default {
|
||||
modifyRealName() {
|
||||
if (this.formData.realName == this.memberInfo.realname && this.memberInfo.realname) {
|
||||
this.$util.showToast({
|
||||
title: '与原真实姓名一致,无需修改'
|
||||
title: this.$lang('alikeRealName')
|
||||
});
|
||||
return;
|
||||
}
|
||||
var rule = [{
|
||||
name: 'realName',
|
||||
checkType: 'required',
|
||||
errorMsg: '真实姓名不能为空'
|
||||
errorMsg: this.$lang('noEmptyRealName')
|
||||
}];
|
||||
if (!rule.length) return;
|
||||
var checkRes = validate.check(this.formData, rule);
|
||||
@@ -496,7 +501,7 @@ export default {
|
||||
modifyBirthday() {
|
||||
if (this.formData.birthday.length == 0) {
|
||||
this.$util.showToast({
|
||||
title: '请选择生日'
|
||||
title: this.$lang('pleaseSelectBirthday')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -574,27 +579,32 @@ export default {
|
||||
name: 'newPassword',
|
||||
checkType: 'lengthMin',
|
||||
checkRule: regConfig.pwd_len,
|
||||
errorMsg: '新密码长度不能小于' + regConfig.pwd_len + '位'
|
||||
errorMsg: this.$lang('passwordMinLength', { num: regConfig.pwd_len })
|
||||
});
|
||||
}
|
||||
if (regConfig.pwd_complexity) {
|
||||
let passwordErrorMsg = '密码需包含',
|
||||
let passwordErrorMsg = this.$lang('passwordComplexityPrefix'),
|
||||
reg = '';
|
||||
let firstItem = true;
|
||||
if (regConfig.pwd_complexity.indexOf('number') != -1) {
|
||||
reg += '(?=.*?[0-9])';
|
||||
passwordErrorMsg += '数字';
|
||||
passwordErrorMsg += (firstItem ? '' : this.$lang('passwordSeparator')) + this.$lang('passwordNumber');
|
||||
firstItem = false;
|
||||
}
|
||||
if (regConfig.pwd_complexity.indexOf('letter') != -1) {
|
||||
reg += '(?=.*?[a-z])';
|
||||
passwordErrorMsg += '、小写字母';
|
||||
passwordErrorMsg += (firstItem ? '' : this.$lang('passwordSeparator')) + this.$lang('passwordLowercase');
|
||||
firstItem = false;
|
||||
}
|
||||
if (regConfig.pwd_complexity.indexOf('upper_case') != -1) {
|
||||
reg += '(?=.*?[A-Z])';
|
||||
passwordErrorMsg += '、大写字母';
|
||||
passwordErrorMsg += (firstItem ? '' : this.$lang('passwordSeparator')) + this.$lang('passwordUppercase');
|
||||
firstItem = false;
|
||||
}
|
||||
if (regConfig.pwd_complexity.indexOf('symbol') != -1) {
|
||||
reg += '(?=.*?[#?!@$%^&*-])';
|
||||
passwordErrorMsg += '、特殊字符';
|
||||
passwordErrorMsg += (firstItem ? '' : this.$lang('passwordSeparator')) + this.$lang('passwordSymbol');
|
||||
firstItem = false;
|
||||
}
|
||||
rule.push({
|
||||
name: 'newPassword',
|
||||
@@ -607,13 +617,13 @@ export default {
|
||||
if (checkRes) {
|
||||
if (this.formData.currentPassword == this.formData.newPassword) {
|
||||
this.$util.showToast({
|
||||
title: '新密码不能与原密码相同'
|
||||
title: this.$lang('samePassword')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.formData.newPassword != this.formData.confirmPassword) {
|
||||
this.$util.showToast({
|
||||
title: '两次密码不一致'
|
||||
title: this.$lang('alikePassword')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -655,11 +665,11 @@ export default {
|
||||
var rule = [{
|
||||
name: 'mobile',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入手机号'
|
||||
errorMsg: this.$lang('pleaseInputMobile')
|
||||
}, {
|
||||
name: 'mobile',
|
||||
checkType: 'phoneno',
|
||||
errorMsg: '请输入正确的手机号'
|
||||
errorMsg: this.$lang('surePhoneNumber')
|
||||
}];
|
||||
var checkRes = validate.check(this.formData, rule);
|
||||
if (!checkRes) {
|
||||
@@ -721,7 +731,7 @@ export default {
|
||||
if (this.seconds == 120 && this.timer == null) {
|
||||
this.timer = setInterval(() => {
|
||||
this.seconds--;
|
||||
this.formData.mobileCodeText = '已发送(' + this.seconds + 's)';
|
||||
this.formData.mobileCodeText = this.$lang('codeSent', { seconds: this.seconds });
|
||||
}, 1000);
|
||||
}
|
||||
uni.setStorageSync('mobile_key', data.key);
|
||||
@@ -739,7 +749,7 @@ export default {
|
||||
});
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: validate.error ? validate.error : '请勿重复点击'
|
||||
title: validate.error ? validate.error : this.$lang('doNotRepeatedlyClick')
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -838,7 +848,7 @@ export default {
|
||||
if (this.seconds == 120 && this.timer == null) {
|
||||
this.timer = setInterval(() => {
|
||||
this.seconds--;
|
||||
this.formData.mobileCodeText = '已发送(' + this.seconds + 's)';
|
||||
this.formData.mobileCodeText = this.$lang('codeSent', { seconds: this.seconds });
|
||||
}, 1000);
|
||||
}
|
||||
uni.setStorageSync('password_mobile_key', data.key);
|
||||
@@ -856,7 +866,7 @@ export default {
|
||||
});
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: '请勿重复点击'
|
||||
title: this.$lang('doNotRepeatedlyClick')
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -864,12 +874,12 @@ export default {
|
||||
var rule = [{
|
||||
name: 'fullAddress',
|
||||
checkType: 'required',
|
||||
errorMsg: '请选择所在地区'
|
||||
errorMsg: this.$lang('pleaseSelectRegion')
|
||||
},
|
||||
{
|
||||
name: 'address',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入详细地址'
|
||||
errorMsg: this.$lang('pleaseInputDetailAddress')
|
||||
}
|
||||
];
|
||||
if (!rule.length) return;
|
||||
|
||||
@@ -98,12 +98,12 @@ export default {
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
this.$util.showToast({
|
||||
title: "保存成功"
|
||||
title: this.$lang('saveSuccess')
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
this.$util.showToast({
|
||||
title: "保存失败,请稍后重试"
|
||||
title: this.$lang('saveFailed')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user