Merge remote-tracking branch 'origin/lei_dev' into leng_dev

This commit is contained in:
lbw 2023-03-08 12:49:43 +08:00
commit f0b0347769
5 changed files with 34 additions and 19 deletions

View File

@ -46,15 +46,6 @@ function mergeArrObj<T>(list: T, key: string) {
return obj; return obj;
} }
// 远程获取i18n
try {
const infoI18n = await info();
itemize['zh-cn'].push(...infoI18n.data['zh-cn']);
itemize.en.push(...infoI18n.data.en);
} catch (e) {
// 考虑请求不过去没有后台的情况下导致的i18n失效
}
for (const key in itemize) { for (const key in itemize) {
messages[key] = { messages[key] = {
name: key, name: key,
@ -79,3 +70,27 @@ export const i18n = createI18n({
fallbackLocale: zhcnLocale.name, fallbackLocale: zhcnLocale.name,
messages, messages,
}); });
const messageLocal = {};
const itemizeLocal = { en: [] as any[], 'zh-cn': [] as any[] };
// 远程获取i18n
try {
setTimeout(async () => {
const infoI18n = await info();
itemizeLocal['zh-cn'].push(...infoI18n.data['zh-cn']);
itemizeLocal.en.push(...infoI18n.data.en);
for (const key in itemizeLocal) {
messageLocal[key] = {
name: key,
...mergeArrObj(itemizeLocal, key),
};
}
i18n.global.mergeLocaleMessage('zh-cn', messageLocal['zh-cn']);
i18n.global.mergeLocaleMessage('en', messageLocal['en']);
i18n.global.locale.value = themeConfig.value.globalI18n;
}, 50);
} catch (e) {
// 考虑请求不过去没有后台的情况下导致的i18n失效
}

View File

@ -1,5 +1,4 @@
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios'; import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
import { ElMessageBox } from 'element-plus';
import { Session, Local } from '/@/utils/storage'; import { Session, Local } from '/@/utils/storage';
import qs from 'qs'; import qs from 'qs';
import { useMessageBox } from '../hooks/message'; import { useMessageBox } from '../hooks/message';

View File

@ -61,12 +61,7 @@
</el-col> </el-col>
<el-col :span="24" class="mb20"> <el-col :span="24" class="mb20">
<el-form-item label="新密码" prop="newpassword1"> <el-form-item label="新密码" prop="newpassword1">
<strength-meter <strength-meter v-model="passwordFormData.newpassword1" :minlength="6" :maxlength="16" placeholder="请输入新密码"></strength-meter>
v-model="passwordFormData.newpassword1"
:minlength="6"
:maxlength="16"
placeholder="请输入新密码"
></strength-meter>
<!-- <el-input v-model="passwordFormData.newpassword1" clearable type="password"></el-input>--> <!-- <el-input v-model="passwordFormData.newpassword1" clearable type="password"></el-input>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -213,7 +208,7 @@ const handleSaveUser = () => {
if (!valid) { if (!valid) {
return false; return false;
} }
editInfo(formData) editInfo(formData.value)
.then(() => { .then(() => {
useMessage().success('修改成功'); useMessage().success('修改成功');
// user // user
@ -260,6 +255,9 @@ const initUserInfo = (userId: any) => {
console.log(formData.value, 'formData'); console.log(formData.value, 'formData');
initSocialList(); initSocialList();
}) })
.catch((err) => {
useMessage().error(err.msg);
})
.finally(() => { .finally(() => {
loading.value = false; loading.value = false;
}); });
@ -296,6 +294,9 @@ const Unbinding = (type) => {
.then((res) => { .then((res) => {
useMessage().success('解绑成功'); useMessage().success('解绑成功');
}) })
.catch((err) => {
useMessage().error(err.msg);
})
.finally(() => { .finally(() => {
initUserInfo(formData.value.userId); initUserInfo(formData.value.userId);
}); });

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form size="large" class="login-content-form" ref="loginFormRef" :rules="loginRules" :model="loginForm"> <el-form size="large" class="login-content-form" ref="loginFormRef" :rules="loginRules" :model="loginForm" @keyup.enter="handleLogin">
<el-form-item class="login-animation1" prop="mobile"> <el-form-item class="login-animation1" prop="mobile">
<el-input text :placeholder="$t('mobile.placeholder1')" v-model="loginForm.mobile" clearable autocomplete="off"> <el-input text :placeholder="$t('mobile.placeholder1')" v-model="loginForm.mobile" clearable autocomplete="off">
<template #prefix> <template #prefix>

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form size="large" class="login-content-form" ref="loginFormRef" :rules="loginRules" :model="state.ruleForm"> <el-form size="large" class="login-content-form" ref="loginFormRef" :rules="loginRules" :model="state.ruleForm" @keyup.enter="handleVerify">
<el-form-item class="login-animation1"> <el-form-item class="login-animation1">
<el-input text :placeholder="$t('password.accountPlaceholder1')" v-model="state.ruleForm.username" clearable autocomplete="off"> <el-input text :placeholder="$t('password.accountPlaceholder1')" v-model="state.ruleForm.username" clearable autocomplete="off">
<template #prefix> <template #prefix>