mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
updata:智控台页面添加语言切换,支持中英繁
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose">{{ $t('button.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSave">{{ $t('button.confirm') }}</el-button>
|
||||
<el-button type="primary" @click="handleSave">{{ $t('button.save') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -107,16 +107,9 @@ export default {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saving = true; // 开始加载
|
||||
this.$emit('submit', {
|
||||
form: this.form,
|
||||
done: () => {
|
||||
this.saving = false; // 加载完成
|
||||
}
|
||||
});
|
||||
this.$emit('submit', this.form);
|
||||
|
||||
setTimeout(() => {
|
||||
this.saving = false;
|
||||
}, 3000);
|
||||
// 在父组件处理完成后,通过watch visible的变化来重置saving状态
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -198,6 +198,21 @@ export default {
|
||||
'register.mobileRequired': 'Mobile number cannot be empty',
|
||||
'register.passwordRequired': 'Password cannot be empty',
|
||||
'register.confirmPasswordRequired': 'Confirm password cannot be empty',
|
||||
'register.goToLogin': 'Already have an account, go to login',
|
||||
'register.agreeTo': 'Registering means you agree to the',
|
||||
'register.userAgreement': 'User Agreement',
|
||||
'register.and': 'and',
|
||||
'register.privacyPolicy': 'Privacy Policy',
|
||||
'register.sendCaptcha': 'Get Verification Code',
|
||||
'register.notAllowRegister': 'User registration is not allowed currently',
|
||||
'register.captchaLoadFailed': 'Verification code loading failed, click to refresh',
|
||||
'register.inputCorrectMobile': 'Please enter correct mobile number',
|
||||
'register.inputCaptcha': 'Please enter captcha',
|
||||
'register.captchaSendSuccess': 'Verification code sent successfully',
|
||||
'register.captchaSendFailed': 'Failed to send verification code',
|
||||
'register.registerSuccess': 'Registration successful!',
|
||||
'register.registerFailed': 'Registration failed',
|
||||
'register.passwordsNotMatch': 'The two passwords do not match',
|
||||
|
||||
// Retrieve password page text
|
||||
'retrievePassword.title': 'Reset Password',
|
||||
|
||||
@@ -198,6 +198,21 @@ export default {
|
||||
'register.mobileRequired': '手机号不能为空',
|
||||
'register.passwordRequired': '密码不能为空',
|
||||
'register.confirmPasswordRequired': '确认密码不能为空',
|
||||
'register.goToLogin': '已有账号,去登录',
|
||||
'register.agreeTo': '注册即同意',
|
||||
'register.userAgreement': '《用户协议》',
|
||||
'register.and': '和',
|
||||
'register.privacyPolicy': '《隐私政策》',
|
||||
'register.sendCaptcha': '获取验证码',
|
||||
'register.notAllowRegister': '当前不允许普通用户注册',
|
||||
'register.captchaLoadFailed': '验证码加载失败,点击刷新',
|
||||
'register.inputCorrectMobile': '请输入正确的手机号码',
|
||||
'register.inputCaptcha': '请输入图形验证码',
|
||||
'register.captchaSendSuccess': '验证码发送成功',
|
||||
'register.captchaSendFailed': '验证码发送失败',
|
||||
'register.registerSuccess': '注册成功!',
|
||||
'register.registerFailed': '注册失败',
|
||||
'register.passwordsNotMatch': '两次输入的密码不一致',
|
||||
|
||||
// 忘记密码页面文本
|
||||
'retrievePassword.title': '重置密码',
|
||||
|
||||
@@ -198,6 +198,21 @@ export default {
|
||||
'register.mobileRequired': '手機號不能為空',
|
||||
'register.passwordRequired': '密碼不能為空',
|
||||
'register.confirmPasswordRequired': '確認密碼不能為空',
|
||||
'register.goToLogin': '已有賬號,去登錄',
|
||||
'register.agreeTo': '註冊即同意',
|
||||
'register.userAgreement': '《用戶協議》',
|
||||
'register.and': '和',
|
||||
'register.privacyPolicy': '《隱私政策》',
|
||||
'register.sendCaptcha': '獲取驗證碼',
|
||||
'register.notAllowRegister': '當前不允許普通用戶註冊',
|
||||
'register.captchaLoadFailed': '驗證碼加載失敗,點擊刷新',
|
||||
'register.inputCorrectMobile': '請輸入正確的手機號碼',
|
||||
'register.inputCaptcha': '請輸入圖形驗證碼',
|
||||
'register.captchaSendSuccess': '驗證碼發送成功',
|
||||
'register.captchaSendFailed': '驗證碼發送失敗',
|
||||
'register.registerSuccess': '註冊成功!',
|
||||
'register.registerFailed': '註冊失敗',
|
||||
'register.passwordsNotMatch': '兩次輸入的密碼不一致',
|
||||
|
||||
// 忘记密码页面文本
|
||||
'retrievePassword.title': '重置密碼',
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<div class="table_bottom">
|
||||
<div class="ctrl_btn">
|
||||
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
||||
{{ isCurrentPageAllSelected ? $t('device.deselectAll') : $t('device.selectAll') }}
|
||||
{{ isCurrentPageAllSelected ? $t('common.deselectAll') : $t('common.selectAll') }}
|
||||
</el-button>
|
||||
<el-button type="success" size="mini" class="add-device-btn" @click="handleAddDevice">
|
||||
{{ $t('device.bindWithCode') }}
|
||||
|
||||
@@ -116,8 +116,9 @@ export default {
|
||||
paramForm: {
|
||||
id: null,
|
||||
paramCode: "",
|
||||
paramValue: "",
|
||||
remark: ""
|
||||
paramValue: "",
|
||||
valueType: "string",
|
||||
remark: ""
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -165,6 +166,7 @@ export default {
|
||||
if (data.code === 0) {
|
||||
this.paramsList = data.data.list.map(item => ({
|
||||
...item,
|
||||
valueType: item.valueType || "string",
|
||||
selected: false,
|
||||
showValue: false
|
||||
}));
|
||||
@@ -191,21 +193,23 @@ export default {
|
||||
showAddDialog() {
|
||||
this.dialogTitle = this.$t('paramManagement.addParam');
|
||||
this.paramForm = {
|
||||
id: null,
|
||||
paramCode: "",
|
||||
paramValue: "",
|
||||
remark: ""
|
||||
};
|
||||
id: null,
|
||||
paramCode: "",
|
||||
paramValue: "",
|
||||
valueType: "string", // 默认值
|
||||
remark: ""
|
||||
};
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
editParam(row) {
|
||||
this.dialogTitle = this.$t('paramManagement.editParam');
|
||||
this.paramForm = {
|
||||
id: row.id,
|
||||
paramCode: row.paramCode,
|
||||
paramValue: row.paramValue,
|
||||
remark: row.remark
|
||||
};
|
||||
id: row.id,
|
||||
paramCode: row.paramCode,
|
||||
paramValue: row.paramValue,
|
||||
valueType: row.valueType || "string", // 确保有值
|
||||
remark: row.remark
|
||||
};
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleSubmit(form) {
|
||||
|
||||
@@ -162,7 +162,7 @@ export default {
|
||||
mounted() {
|
||||
this.$store.dispatch('fetchPubConfig').then(() => {
|
||||
if (!this.allowUserRegister) {
|
||||
showDanger('当前不允许普通用户注册');
|
||||
showDanger(this.$t('register.notAllowRegister'));
|
||||
setTimeout(() => {
|
||||
goToPage('/login');
|
||||
}, 1500);
|
||||
@@ -181,7 +181,7 @@ export default {
|
||||
|
||||
} else {
|
||||
console.error('验证码加载异常:', error);
|
||||
showDanger('验证码加载失败,点击刷新');
|
||||
showDanger(this.$t('register.captchaLoadFailed'));
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -198,12 +198,12 @@ export default {
|
||||
// 发送手机验证码
|
||||
sendMobileCaptcha() {
|
||||
if (!validateMobile(this.form.mobile, this.form.areaCode)) {
|
||||
showDanger('请输入正确的手机号码');
|
||||
showDanger(this.$t('register.inputCorrectMobile'));
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证图形验证码
|
||||
if (!this.validateInput(this.form.captcha, '请输入图形验证码')) {
|
||||
if (!this.validateInput(this.form.captcha, this.$t('register.inputCaptcha'))) {
|
||||
this.fetchCaptcha();
|
||||
return;
|
||||
}
|
||||
@@ -231,9 +231,9 @@ export default {
|
||||
captcha: this.form.captcha,
|
||||
captchaId: this.form.captchaId
|
||||
}, (res) => {
|
||||
showSuccess('验证码发送成功');
|
||||
showSuccess(this.$t('register.captchaSendSuccess'));
|
||||
}, (err) => {
|
||||
showDanger(err.data.msg || '验证码发送失败');
|
||||
showDanger(err.data.msg || this.$t('register.captchaSendFailed'));
|
||||
this.countdown = 0;
|
||||
this.fetchCaptcha();
|
||||
});
|
||||
@@ -244,7 +244,7 @@ export default {
|
||||
if (this.enableMobileRegister) {
|
||||
// 手机号注册验证
|
||||
if (!validateMobile(this.form.mobile, this.form.areaCode)) {
|
||||
showDanger('请输入正确的手机号码');
|
||||
showDanger(this.$t('register.inputCorrectMobile'));
|
||||
return;
|
||||
}
|
||||
if (!this.form.mobileCaptcha) {
|
||||
@@ -263,7 +263,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
if (this.form.password !== this.form.confirmPassword) {
|
||||
showDanger('两次输入的密码不一致')
|
||||
showDanger(this.$t('register.passwordsNotMatch'))
|
||||
return
|
||||
}
|
||||
// 验证验证码
|
||||
@@ -276,10 +276,10 @@ export default {
|
||||
}
|
||||
|
||||
Api.user.register(this.form, ({ data }) => {
|
||||
showSuccess('注册成功!')
|
||||
showSuccess(this.$t('register.registerSuccess'))
|
||||
goToPage('/login')
|
||||
}, (err) => {
|
||||
showDanger(err.data.msg || '注册失败')
|
||||
showDanger(err.data.msg || this.$t('register.registerFailed'))
|
||||
if (err.data != null && err.data.msg != null && err.data.msg.indexOf('图形验证码') > -1) {
|
||||
this.fetchCaptcha()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user