diff --git a/index.html b/index.html index dc244c48..a7adae22 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ - PicX 图床神器 + PicX diff --git a/package.json b/package.json index 77d5399e..ec2b94ea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "picx", - "version": "3.0.0", + "version": "3.0.1", "private": false, + "packageManager": "pnpm@7.33.7", "author": "XPoet ", "license": "AGPL-3.0", "bugs": { @@ -42,6 +43,7 @@ "@commitlint/cli": "17.0.3", "@commitlint/config-conventional": "^17.0.3", "@iconify-json/ep": "^1.1.10", + "@plugin-web-update-notification/vite": "1.7.1", "@types/node": "^15.0.1", "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03d552f5..ea9af870 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,7 @@ specifiers: '@commitlint/cli': 17.0.3 '@commitlint/config-conventional': ^17.0.3 '@iconify-json/ep': ^1.1.10 + '@plugin-web-update-notification/vite': 1.7.1 '@types/node': ^15.0.1 '@typescript-eslint/eslint-plugin': ^4.22.0 '@typescript-eslint/parser': ^4.22.0 @@ -53,6 +54,7 @@ devDependencies: '@commitlint/cli': 17.0.3 '@commitlint/config-conventional': 17.8.1 '@iconify-json/ep': 1.1.11 + '@plugin-web-update-notification/vite': 1.7.1_vite@2.7.13 '@types/node': 15.14.9 '@typescript-eslint/eslint-plugin': 4.33.0_s2qqtxhzmb7vugvfoyripfgp7i '@typescript-eslint/parser': 4.33.0_jofidmxrjzhj7l6vknpw5ecvfe @@ -1724,6 +1726,19 @@ packages: fastq: 1.15.0 dev: true + /@plugin-web-update-notification/core/1.7.1: + resolution: {integrity: sha512-G5xbuFE4B3TGxM9FxYwUlbGleuWNUzdbw3ZNcht1WDn85Qbhgzk7lQwuXVilxZII6LhsghJ4Zdapw0jgzuCJQw==} + dev: true + + /@plugin-web-update-notification/vite/1.7.1_vite@2.7.13: + resolution: {integrity: sha512-qIP2JBt19gZGWjagZOGc0qatoLGa2h4GnrHjF1ETzVgHUuJMgBeZpqMjzO81MwbmOUQdWbvwlF3ZZhXopeXB/w==} + peerDependencies: + vite: ^5.0.0 || >4.0.0 || ^3.0.0 + dependencies: + '@plugin-web-update-notification/core': 1.7.1 + vite: 2.7.13_stylus@0.59.0 + dev: true + /@rollup/plugin-babel/5.3.1_ruiheq7dzqj4xl2pvehe77v5xa: resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==} engines: {node: '>= 10.0.0'} diff --git a/src/plugins/vite/index.ts b/src/plugins/vite/index.ts index 013023d7..176ff5fd 100644 --- a/src/plugins/vite/index.ts +++ b/src/plugins/vite/index.ts @@ -5,13 +5,13 @@ import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import IconsResolver from 'unplugin-icons/resolver' import Icons from 'unplugin-icons/vite' +import { webUpdateNotice } from '@plugin-web-update-notification/vite' import { ViteEnv } from '@/common/model' import configPWAPlugin from './pwa' export default function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { const vitePlugins: (Plugin | Plugin[])[] = [vue()] - // 按需自动导入 Element Plus 组件 vitePlugins.push( AutoImport({ resolvers: [ @@ -24,6 +24,7 @@ export default function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { ], dts: 'src/auto-imports.d.ts' }), + Components({ resolvers: [ // 自动导入 Element Plus 组件 @@ -35,8 +36,14 @@ export default function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { ], dts: 'src/components.d.ts' }), + Icons({ autoInstall: true + }), + + // 更新通知插件 + webUpdateNotice({ + logVersion: true }) ) diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index d53ab3db..a54fa01b 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -1,3 +1,4 @@ +/// declare module '*.vue' { import { DefineComponent } from 'vue' diff --git a/src/views/app-wrap/app-wrap.vue b/src/views/app-wrap/app-wrap.vue index 0f248e6a..351270f2 100644 --- a/src/views/app-wrap/app-wrap.vue +++ b/src/views/app-wrap/app-wrap.vue @@ -48,17 +48,25 @@ const elementPlusSizeHandle = (width: number) => { const setLanguage = (language: LanguageEnum) => { if (language === LanguageEnum.zhCN) { - elementPlusLocale.value = zhCN // 设置 Element Plus 组件库语言 instance!.proxy!.$i18n.locale = 'zh-CN' // 设置 i18n 语言 + elementPlusLocale.value = zhCN // 设置 Element Plus 组件库语言 + // eslint-disable-next-line no-underscore-dangle + window.pluginWebUpdateNotice_?.setLocale('zh_CN') } else if (language === LanguageEnum.zhTW) { - elementPlusLocale.value = zhTW instance!.proxy!.$i18n.locale = 'zh-TW' + elementPlusLocale.value = zhTW + // eslint-disable-next-line no-underscore-dangle + window.pluginWebUpdateNotice_?.setLocale('zh_TW') } else if (language === LanguageEnum.en) { - elementPlusLocale.value = en instance!.proxy!.$i18n.locale = 'en' + elementPlusLocale.value = en + // eslint-disable-next-line no-underscore-dangle + window.pluginWebUpdateNotice_?.setLocale('en_US') } else { elementPlusLocale.value = zhCN instance!.proxy!.$i18n.locale = 'zh-CN' + // eslint-disable-next-line no-underscore-dangle + window.pluginWebUpdateNotice_?.setLocale('zh_CN') } setWindowTitle(router.currentRoute.value.meta.title as string) } @@ -105,6 +113,9 @@ const setLanguageByIP = () => { store.dispatch('SET_USER_SETTINGS', { language }) + store.dispatch('SET_GLOBAL_SETTINGS', { + language + }) msgInstance.close() }) }