修改国际化

master
夜笙歌 2 years ago
parent e9e72e7f75
commit 15a2f90a46

@ -3,12 +3,14 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="renderer" content="webkit"> <meta content="webkit" name="renderer">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="icon" href="/favicon.ico"> <link href="/favicon.ico" rel="icon">
<title>若依管理系统</title> <title>若依管理系统</title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> <!--[if lt IE 11]>
<script>window.location.href = '/html/ie.html';</script>
<![endif]-->
<style> <style>
html, html,
body, body,
@ -209,7 +211,7 @@
<div class="load_title">正在加载系统资源,请耐心等待</div> <div class="load_title">正在加载系统资源,请耐心等待</div>
</div> </div>
</div> </div>
<script type="module" src="/src/main.js"></script> <script src="/src/main.js" type="module"></script>
</body> </body>
</html> </html>

@ -1,6 +1,14 @@
import request from '@/utils/request' import request from '@/utils/request'
import Cookies from "js-cookie"; import Cookies from "js-cookie";
// 切换语言
export function cutLang() {
return request({
url: '/system/language/change',
method: 'get',
})
}
// 登录方法 // 登录方法
export function login(username, password, code, uuid) { export function login(username, password, code, uuid) {
const data = { const data = {

@ -17,20 +17,22 @@
<script setup> <script setup>
import useAppStore from "@/store/modules/app"; import useAppStore from "@/store/modules/app";
import {useI18n} from "vue-i18n";
const {t} = useI18n();
const appStore = useAppStore(); const appStore = useAppStore();
const size = computed(() => appStore.size); const size = computed(() => appStore.size);
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const sizeOptions = ref([ const sizeOptions = ref([
{ label: "较大", value: "large" }, { label: t('sizeSelect.large'), value: "large" },
{ label: "默认", value: "default" }, { label: t('sizeSelect.default'), value: "default" },
{ label: "稍小", value: "small" }, { label: t('sizeSelect.small'), value: "small" },
]); ]);
function handleSetSize(size) { function handleSetSize(size) {
proxy.$modal.loading("正在设置布局大小,请稍候..."); proxy.$modal.loading(t('sizeSelect.wait'));
appStore.setSize(size); appStore.setSize(size);
setTimeout("window.location.reload()", 1000); setTimeout("window.location.reload()", 1000);
} }

@ -49,6 +49,31 @@ export default {
basicInformation: 'Basic Information', basicInformation: 'Basic Information',
changePassword: 'Change Password' changePassword: 'Change Password'
}, },
userInfo: {
username: 'username',
phone: 'phone',
email: 'email',
sex: 'sex',
male: 'male',
female: 'female'
},
userAvatar: {
uploadAvatar: 'Click to upload avatar',
choose: 'Choose',
submit: 'Submit',
ModifyAvatar: 'Modify Avatar'
},
resetPwd: {
oldPassword: 'Old Password',
newPassword: 'New Password',
confirmPassword: 'Confirm Password',
},
sizeSelect:{
large:'Large',
default:'Default',
small:'Small',
wait:'Please wait, setting layout size...',
},
option: { option: {
refresh: 'refresh', refresh: 'refresh',
option: 'option', option: 'option',
@ -61,12 +86,15 @@ export default {
cancel: 'cancel', cancel: 'cancel',
ok: 'ok', ok: 'ok',
hint: 'hint', hint: 'hint',
save: 'save',
close: 'close',
confirmDeletion: 'Are you sure to delete the data item whose {key} is {value}?', confirmDeletion: 'Are you sure to delete the data item whose {key} is {value}?',
modificationSuccessful: 'Modification Successful', modificationSuccessful: 'Modification Successful',
addedSuccessfully: 'Added Successfully', addedSuccessfully: 'Added Successfully',
successfullyDeleted: 'Successfully Deleted' successfullyDeleted: 'Successfully Deleted'
}, },
common: { common: {
loadTitle:'Loading system resources, please be patient',
success: 'success', success: 'success',
show: 'show', show: 'show',
hide: 'hide', hide: 'hide',

@ -49,6 +49,31 @@ export default {
basicInformation:'基本资料', basicInformation:'基本资料',
changePassword:'修改密码' changePassword:'修改密码'
}, },
userInfo:{
username:'用户昵称',
phone:'手机号码',
email:'邮箱',
sex:'性别',
male:'男',
female:'女'
},
userAvatar:{
uploadAvatar:'点击上传头像',
choose:'选择',
submit:'提 交',
ModifyAvatar:'修改头像'
},
resetPwd:{
oldPassword:'旧密码',
newPassword:'新密码',
confirmPassword:'确认密码',
},
sizeSelect:{
large:'较大',
default:'默认',
small:'稍小',
wait:'正在设置布局大小,请稍候...',
},
option: { option: {
refresh: '刷新', refresh: '刷新',
option: '操作', option: '操作',
@ -61,12 +86,15 @@ export default {
cancel: '取 消', cancel: '取 消',
ok: '确 定', ok: '确 定',
hint: '提示', hint: '提示',
save:'保存',
close:'关闭',
confirmDeletion: '是否确认删除%{key}为%{value}的数据项?', confirmDeletion: '是否确认删除%{key}为%{value}的数据项?',
modificationSuccessful: '修改成功', modificationSuccessful: '修改成功',
addedSuccessfully: '新增成功', addedSuccessfully: '新增成功',
successfullyDeleted: '删除成功' successfullyDeleted: '删除成功'
}, },
common: { common: {
loadTitle:'正在加载系统资源,请耐心等待',
success: '成功', success: '成功',
show: '显示', show: '显示',
hide: '隐藏', hide: '隐藏',

@ -72,6 +72,7 @@
<script setup> <script setup>
import {ElMessageBox} from 'element-plus' import {ElMessageBox} from 'element-plus'
import {cutLang} from "@/api/login";
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav' import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger' import Hamburger from '@/components/Hamburger'
@ -91,7 +92,9 @@ const userStore = useUserStore()
const settingsStore = useSettingsStore() const settingsStore = useSettingsStore()
const lang = (e) => { const lang = (e) => {
Cookies.set('language', e) Cookies.set('language', e)
location.reload() cutLang().finally(() => {
setTimeout( () => location.reload(),10)
})
} }
function toggleSideBar() { function toggleSideBar() {

@ -43,6 +43,7 @@ import ImagePreview from "@/components/ImagePreview"
import TreeSelect from '@/components/TreeSelect' import TreeSelect from '@/components/TreeSelect'
// 字典标签组件 // 字典标签组件
import DictTag from '@/components/DictTag' import DictTag from '@/components/DictTag'
import {useI18n} from "vue-i18n";
const app = createApp(App) const app = createApp(App)

@ -98,7 +98,7 @@
</template> </template>
<script setup> <script setup>
import {getCodeImg} from "@/api/login"; import {getCodeImg,cutLang} from "@/api/login";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import {decrypt, encrypt} from "@/utils/jsencrypt"; import {decrypt, encrypt} from "@/utils/jsencrypt";
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
@ -108,7 +108,11 @@ import {useI18n} from 'vue-i18n';
const {t} = useI18n(); const {t} = useI18n();
const lang = (e) => { const lang = (e) => {
Cookies.set('language',e) Cookies.set('language',e)
location.reload() cutLang().finally(() => {
setTimeout( () => location.reload(),10)
})
} }
const userStore = useUserStore() const userStore = useUserStore()
const router = useRouter(); const router = useRouter();

@ -1,24 +1,28 @@
<template> <template>
<el-form ref="pwdRef" :model="user" :rules="rules" label-width="80px"> <el-form ref="pwdRef" :model="user" :rules="rules" :label-width="isEN ? '160px': '80px'">
<el-form-item label="旧密码" prop="oldPassword"> <el-form-item :label="t('resetPwd.oldPassword')" prop="oldPassword">
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password /> <el-input v-model="user.oldPassword" :placeholder="t('common.pleaseEnter') + t('resetPwd.oldPassword')" type="password" show-password />
</el-form-item> </el-form-item>
<el-form-item label="新密码" prop="newPassword"> <el-form-item :label="t('resetPwd.newPassword')" prop="newPassword">
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password /> <el-input v-model="user.newPassword" :placeholder="t('common.pleaseEnter') + t('resetPwd.newPassword')" type="password" show-password />
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="confirmPassword"> <el-form-item :label="t('resetPwd.confirmPassword')" prop="confirmPassword">
<el-input v-model="user.confirmPassword" placeholder="请确认新密码" type="password" show-password/> <el-input v-model="user.confirmPassword" :placeholder="t('common.pleaseEnter') + t('resetPwd.confirmPassword')" type="password" show-password/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submit"></el-button> <el-button type="primary" @click="submit">{{ t('option.save') }}</el-button>
<el-button type="danger" @click="close"></el-button> <el-button type="danger" @click="close">{{ t('option.close') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<script setup> <script setup>
import { updateUserPwd } from "@/api/system/user"; import { updateUserPwd } from "@/api/system/user";
import {useI18n} from "vue-i18n";
import Cookies from "js-cookie";
const {t} = useI18n();
const isEN = (Cookies.get('language') || 'zhCn') === 'en'
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const user = reactive({ const user = reactive({

@ -1,6 +1,6 @@
<template> <template>
<div class="user-info-head" @click="editCropper()"> <div class="user-info-head" @click="editCropper()">
<img :src="options.img" title="点击上传头像" class="img-circle img-lg" /> <img :src="options.img" :title="t('userAvatar.uploadAvatar')" class="img-circle img-lg" />
<el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog"> <el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog">
<el-row> <el-row>
<el-col :xs="24" :md="12" :style="{ height: '350px' }"> <el-col :xs="24" :md="12" :style="{ height: '350px' }">
@ -33,7 +33,7 @@
:before-upload="beforeUpload" :before-upload="beforeUpload"
> >
<el-button> <el-button>
选择 {{ t('userAvatar.choose') }}
<el-icon class="el-icon--right"><Upload /></el-icon> <el-icon class="el-icon--right"><Upload /></el-icon>
</el-button> </el-button>
</el-upload> </el-upload>
@ -51,7 +51,7 @@
<el-button icon="RefreshRight" @click="rotateRight()"></el-button> <el-button icon="RefreshRight" @click="rotateRight()"></el-button>
</el-col> </el-col>
<el-col :lg="{ span: 2, offset: 6 }" :md="2"> <el-col :lg="{ span: 2, offset: 6 }" :md="2">
<el-button type="primary" @click="uploadImg()"> </el-button> <el-button type="primary" @click="uploadImg()">{{ t('userAvatar.submit') }}</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
@ -63,13 +63,15 @@ import "vue-cropper/dist/index.css";
import { VueCropper } from "vue-cropper"; import { VueCropper } from "vue-cropper";
import { uploadAvatar } from "@/api/system/user"; import { uploadAvatar } from "@/api/system/user";
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
import {useI18n} from "vue-i18n";
const {t} = useI18n();
const userStore = useUserStore(); const userStore = useUserStore();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const open = ref(false); const open = ref(false);
const visible = ref(false); const visible = ref(false);
const title = ref("修改头像"); const title = ref(t('userAvatar.ModifyAvatar'));
// //
const options = reactive({ const options = reactive({

@ -1,30 +1,32 @@
<template> <template>
<el-form ref="userRef" :model="user" :rules="rules" label-width="80px"> <el-form ref="userRef" :model="user" :rules="rules" label-width="80px">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item :label="t('userInfo.username')" prop="nickName">
<el-input v-model="user.nickName" maxlength="30" /> <el-input v-model="user.nickName" maxlength="30" />
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item :label="t('userInfo.phone')" prop="phonenumber">
<el-input v-model="user.phonenumber" maxlength="11" /> <el-input v-model="user.phonenumber" maxlength="11" />
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item :label="t('userInfo.email')" prop="email">
<el-input v-model="user.email" maxlength="50" /> <el-input v-model="user.email" maxlength="50" />
</el-form-item> </el-form-item>
<el-form-item label="性别"> <el-form-item :label="t('userInfo.sex')">
<el-radio-group v-model="user.sex"> <el-radio-group v-model="user.sex">
<el-radio label="0"></el-radio> <el-radio label="0">{{ t('userInfo.male') }}</el-radio>
<el-radio label="1"></el-radio> <el-radio label="1">{{ t('userInfo.female') }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submit"></el-button> <el-button type="primary" @click="submit">{{ t('option.save') }}</el-button>
<el-button type="danger" @click="close"></el-button> <el-button type="danger" @click="close">{{ t('option.close') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<script setup> <script setup>
import { updateUserProfile } from "@/api/system/user"; import { updateUserProfile } from "@/api/system/user";
import {useI18n} from "vue-i18n";
const {t} = useI18n();
const props = defineProps({ const props = defineProps({
user: { user: {
type: Object type: Object

Loading…
Cancel
Save