f6de22e8 by 华明祺

语言切换

1 parent 8f61ec56
......@@ -4,15 +4,17 @@
</template>
<script setup>
import { nextTick, onMounted, watch } from 'vue'
import { nextTick, onMounted, watch} from 'vue'
import { handleThemeStyle } from '@/utils/theme'
import useSettingsStore from '@/store/modules/settings'
import ResetPwd from '@/views/system/user/profile/components/resetPwd'
import useUserStore from '@/store/modules/user'
import { getCurrentInstance } from '@vue/runtime-core'
import {useStorage} from "@vueuse/core";
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
const language= useStorage('language',0)
onMounted(() => {
document.body.style.setProperty('--el-color-primary', '#453DEA')
......@@ -24,6 +26,10 @@ onMounted(() => {
})
})
watch(language,(val)=>{
location.reload()
})
// watch(() => userStore.user?.changePassFlag, (val) => {
// if (val === '1') {
// proxy.$modal.confirm('密码长期未更新,请及时更新').then(() => {
......
......@@ -124,6 +124,8 @@ import Captcha from './captcha'
import CaptchaSms from './captchaSms'
import cache from '@/plugins/cache'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import {useStorage} from "@vueuse/core";
const router = useRouter()
const route = useRoute()
const { proxy } = getCurrentInstance()
......@@ -134,6 +136,9 @@ const loginForm = ref({})
const drawer = ref(false)
const mode = ref('horizontal')
const language = ref(cache.local.get('language') || 0)
const language2 = useStorage('language', 0)
onMounted(() => {
console.log(window.location.href)
if (useUserStore().user) {
......@@ -159,9 +164,9 @@ onMounted(() => {
// console.log(activeIndex.value)
})
function changeLanguage(n) {
// language.value = n
cache.local.set('language', n)
location.reload()
proxy.$modal.loading()
language2.value = n
// cache.local.set('language', n)
}
function showDrawer() {
drawer.value = true
......
......@@ -95,6 +95,8 @@ import Captcha from './captcha'
import CaptchaSms from './captchaSms'
import cache from '@/plugins/cache'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import {useStorage} from "@vueuse/core/index";
const router = useRouter()
const route = useRoute()
const { proxy } = getCurrentInstance()
......@@ -105,6 +107,8 @@ const loginForm = ref({})
const drawer = ref(false)
const mode = ref('horizontal')
const language = ref(cache.local.get('language') || 0)
const language2 = useStorage('language', 0)
onMounted(() => {
console.log(window.location.href)
if (useUserStore().user) {
......@@ -130,9 +134,9 @@ onMounted(() => {
// console.log(activeIndex.value)
})
function changeLanguage(n) {
// language.value = n
cache.local.set('language', n)
location.reload()
proxy.$modal.loading()
language2.value = n
// cache.local.set('language', n)
}
function showDrawer() {
drawer.value = true
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!