perf: 框架核心代码国际化全量覆盖(仅需处理业务代码国际化即可) (#1082)

This commit is contained in:
xiaoming 2024-04-17 15:41:37 +08:00 committed by GitHub
parent d1d2bcaa11
commit a402d33b89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 254 additions and 99 deletions

View File

@ -41,7 +41,7 @@
- 修复`windwos`下点击注册页面会出现滚动条问题 - 修复`windwos`下点击注册页面会出现滚动条问题
- 修复`windows`下页面切换,内容区会出现滚动条问题 - 修复`windows`下页面切换,内容区会出现滚动条问题
- 修复`pure-table`带状态表格在深色整体风格下状态样式消失的问题 - 修复`pure-table`带状态表格在深色整体风格下状态样式消失的问题
- 修复项目配置中开启灰色模式和深色整体风格,刷新页面整体风格异常 - 修复系统配置中开启灰色模式和深色整体风格,刷新页面整体风格异常
### 🍏 Perf ### 🍏 Perf
@ -84,7 +84,7 @@
- 所有`search`搜索图标统一替换为`@iconify-icons/ri/search-line`它比较常用将其放入全局离线图标中 - 所有`search`搜索图标统一替换为`@iconify-icons/ri/search-line`它比较常用将其放入全局离线图标中
- 移除`iframe`在暗模式下的滤镜效果 - 移除`iframe`在暗模式下的滤镜效果
- 带来更美观精致的首页 - 带来更美观精致的首页
- 更干净整洁的项目配置右侧弹出面板 - 更干净整洁的系统配置右侧弹出面板
- 重构关于页面,整体更紧致,关键信息更突出 - 重构关于页面,整体更紧致,关键信息更突出
### 🎫 Feat ### 🎫 Feat

View File

@ -2,7 +2,7 @@ buttons:
pureAccountSettings: Account pureAccountSettings: Account
pureLoginOut: LoginOut pureLoginOut: LoginOut
pureLogin: Login pureLogin: Login
pureSystemSet: Open ProjectConfig pureOpenSystemSet: Open System Configs
pureReload: Reload pureReload: Reload
pureCloseCurrentTab: Close CurrentTab pureCloseCurrentTab: Close CurrentTab
pureCloseLeftTabs: Close LeftTabs pureCloseLeftTabs: Close LeftTabs
@ -11,6 +11,54 @@ buttons:
pureCloseAllTabs: Close AllTabs pureCloseAllTabs: Close AllTabs
pureContentFullScreen: Content FullScreen pureContentFullScreen: Content FullScreen
pureContentExitFullScreen: Content ExitFullScreen pureContentExitFullScreen: Content ExitFullScreen
pureClickCollapse: Collapse
pureClickExpand: Expand
pureConfirm: Confirm
pureSwitch: Switch
pureClose: Close
pureBackTop: BackTop
pureOpenText: Open
pureCloseText: Close
search:
pureTotal: Total
pureHistory: History
pureCollect: Collect
pureDragSort: Drag Sort
pureEmpty: Empty
purePlaceholder: Search Menu
panel:
pureSystemSet: System Configs
pureCloseSystemSet: Close System Configs
pureClearCacheAndToLogin: Clear cache and return to login page
pureClearCache: Clear Cache
pureOverallStyle: Overall Style
pureOverallStyleLight: Light
pureOverallStyleLightTip: Set sail freshly and light up the comfortable work interface
pureOverallStyleDark: Dark
pureOverallStyleDarkTip: Moonlight Overture, indulge in the tranquility and elegance of the night
pureOverallStyleSystem: Auto
pureOverallStyleSystemTip: Synchronize time, the interface naturally responds to morning and dusk
pureThemeColor: Theme Color
pureLayoutModel: Layout Model
pureVerticalTip: The menu on the left is familiar and friendly
pureHorizontalTip: Top menu, concise overview
pureMixTip: Mixed menu, flexible
pureStretch: Stretch Page
pureStretchFixed: Fixed
pureStretchFixedTip: Compact pages make it easy to find the information you need
pureStretchCustom: Custom
pureStretchCustomTip: Minimum 1280, maximum 1600
pureTagsStyle: Tags Style
pureTagsStyleSmart: Smart
pureTagsStyleSmartTip: Smart tags add fun and brilliance
pureTagsStyleCard: Card
pureTagsStyleCardTip: Card tags for efficient browsing
pureInterfaceDisplay: Interface Display
pureGreyModel: Grey Model
pureWeakModel: Weak Model
pureHiddenTags: Hidden Tags
pureHiddenFooter: Hidden Footer
pureMultiTagsCache: MultiTags Cache
menus: menus:
pureHome: Home pureHome: Home
pureLogin: Login pureLogin: Login
@ -136,6 +184,7 @@ menus:
pureChildMenuOverflow: Child Menu Overflow Show Tooltip Text pureChildMenuOverflow: Child Menu Overflow Show Tooltip Text
status: status:
pureLoad: Loading... pureLoad: Loading...
pureNoMessage: No Message
login: login:
pureUsername: Username pureUsername: Username
purePassword: Password purePassword: Password
@ -160,6 +209,7 @@ login:
pureTip: After scanning the code, click "Confirm" to complete the login pureTip: After scanning the code, click "Confirm" to complete the login
pureDefinite: Definite pureDefinite: Definite
pureLoginSuccess: Login Success pureLoginSuccess: Login Success
pureLoginFail: Login Fail
pureRegisterSuccess: Regist Success pureRegisterSuccess: Regist Success
pureTickPrivacy: Please tick Privacy Policy pureTickPrivacy: Please tick Privacy Policy
pureReadAccept: I have read it carefully and accept pureReadAccept: I have read it carefully and accept

View File

@ -2,7 +2,7 @@ buttons:
pureAccountSettings: 账户设置 pureAccountSettings: 账户设置
pureLoginOut: 退出系统 pureLoginOut: 退出系统
pureLogin: 登录 pureLogin: 登录
pureSystemSet: 打开项目配置 pureOpenSystemSet: 打开系统配置
pureReload: 重新加载 pureReload: 重新加载
pureCloseCurrentTab: 关闭当前标签页 pureCloseCurrentTab: 关闭当前标签页
pureCloseLeftTabs: 关闭左侧标签页 pureCloseLeftTabs: 关闭左侧标签页
@ -11,6 +11,54 @@ buttons:
pureCloseAllTabs: 关闭全部标签页 pureCloseAllTabs: 关闭全部标签页
pureContentFullScreen: 内容区全屏 pureContentFullScreen: 内容区全屏
pureContentExitFullScreen: 内容区退出全屏 pureContentExitFullScreen: 内容区退出全屏
pureClickCollapse: 点击折叠
pureClickExpand: 点击展开
pureConfirm: 确认
pureSwitch: 切换
pureClose: 关闭
pureBackTop: 回到顶部
pureOpenText:
pureCloseText:
search:
pureTotal:
pureHistory: 搜索历史
pureCollect: 收藏
pureDragSort: (可拖拽排序)
pureEmpty: 暂无搜索结果
purePlaceholder: 搜索菜单(支持拼音搜索)
panel:
pureSystemSet: 系统配置
pureCloseSystemSet: 关闭配置
pureClearCacheAndToLogin: 清空缓存并返回登录页
pureClearCache: 清空缓存
pureOverallStyle: 整体风格
pureOverallStyleLight: 浅色
pureOverallStyleLightTip: 清新启航,点亮舒适的工作界面
pureOverallStyleDark: 深色
pureOverallStyleDarkTip: 月光序曲,沉醉于夜的静谧雅致
pureOverallStyleSystem: 自动
pureOverallStyleSystemTip: 同步时光,界面随晨昏自然呼应
pureThemeColor: 主题色
pureLayoutModel: 导航模式
pureVerticalTip: 左侧菜单,亲切熟悉
pureHorizontalTip: 顶部菜单,简洁概览
pureMixTip: 混合菜单,灵活多变
pureStretch: 页宽
pureStretchFixed: 固定
pureStretchFixedTip: 紧凑页面,轻松找到所需信息
pureStretchCustom: 自定义
pureStretchCustomTip: 最小1280、最大1600
pureTagsStyle: 页签风格
pureTagsStyleSmart: 灵动
pureTagsStyleSmartTip: 灵动标签,添趣生辉
pureTagsStyleCard: 卡片
pureTagsStyleCardTip: 卡片标签,高效浏览
pureInterfaceDisplay: 界面显示
pureGreyModel: 灰色模式
pureWeakModel: 色弱模式
pureHiddenTags: 隐藏标签页
pureHiddenFooter: 隐藏页脚
pureMultiTagsCache: 页签持久化
menus: menus:
pureHome: 首页 pureHome: 首页
pureLogin: 登录 pureLogin: 登录
@ -136,6 +184,7 @@ menus:
pureChildMenuOverflow: 菜单超出显示 Tooltip 文字提示 pureChildMenuOverflow: 菜单超出显示 Tooltip 文字提示
status: status:
pureLoad: 加载中... pureLoad: 加载中...
pureNoMessage: 暂无消息
login: login:
pureUsername: 账号 pureUsername: 账号
purePassword: 密码 purePassword: 密码
@ -160,6 +209,7 @@ login:
pureTip: 扫码后点击"确认",即可完成登录 pureTip: 扫码后点击"确认",即可完成登录
pureDefinite: 确定 pureDefinite: 确定
pureLoginSuccess: 登录成功 pureLoginSuccess: 登录成功
pureLoginFail: 登录失败
pureRegisterSuccess: 注册成功 pureRegisterSuccess: 注册成功
pureTickPrivacy: 请勾选隐私政策 pureTickPrivacy: 请勾选隐私政策
pureReadAccept: 我已仔细阅读并接受 pureReadAccept: 我已仔细阅读并接受
@ -176,4 +226,4 @@ login:
purePassWordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合 purePassWordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合
purePassWordSureReg: 请输入确认密码 purePassWordSureReg: 请输入确认密码
purePassWordDifferentReg: 两次密码不一致! purePassWordDifferentReg: 两次密码不一致!
purePassWordUpdateReg: 修改密码成功 purePassWordUpdateReg: 修改密码成功

View File

@ -5,7 +5,7 @@ export type UserResult = {
data: { data: {
/** 用户名 */ /** 用户名 */
username: string; username: string;
/** 当前登用户的角色 */ /** 当前登用户的角色 */
roles: Array<string>; roles: Array<string>;
/** `token` */ /** `token` */
accessToken: string; accessToken: string;

View File

@ -42,6 +42,11 @@ const props = {
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
},
/** 当内容发生变化时,设置 `resize` 可使其自适应容器位置 */
resize: {
type: Boolean,
default: false
} }
}; };
@ -108,7 +113,7 @@ export default defineComponent({
}); });
} }
props.block && handleResizeInit(); (props.block || props.resize) && handleResizeInit();
watch( watch(
() => curIndex.value, () => curIndex.value,

View File

@ -35,7 +35,7 @@ export const getPlatformConfig = async (app: App): Promise<undefined> => {
}) })
.then(({ data: config }) => { .then(({ data: config }) => {
let $config = app.config.globalProperties.$config; let $config = app.config.globalProperties.$config;
// 自动注入项目配置 // 自动注入系统配置
if (app && $config && typeof config === "object") { if (app && $config && typeof config === "object") {
$config = Object.assign($config, config); $config = Object.assign($config, config);
app.config.globalProperties.$config = $config; app.config.globalProperties.$config = $config;

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import Footer from "./footer/index.vue"; import Footer from "./footer/index.vue";
import { useGlobal, isNumber } from "@pureadmin/utils"; import { useGlobal, isNumber } from "@pureadmin/utils";
import KeepAliveFrame from "./keepAliveFrame/index.vue"; import KeepAliveFrame from "./keepAliveFrame/index.vue";
@ -10,6 +11,7 @@ const props = defineProps({
fixedHeader: Boolean fixedHeader: Boolean
}); });
const { t } = useI18n();
const { $storage, $config } = useGlobal<GlobalPropertiesApi>(); const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
const isKeepAlive = computed(() => { const isKeepAlive = computed(() => {
@ -121,7 +123,7 @@ const transitionMain = defineComponent({
}" }"
> >
<el-backtop <el-backtop
title="回到顶部" :title="t('buttons.pureBackTop')"
target=".app-main .el-scrollbar__wrap" target=".app-main .el-scrollbar__wrap"
> >
<backTop /> <backTop />

View File

@ -113,7 +113,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</el-dropdown> </el-dropdown>
<span <span
class="set-icon navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.pureSystemSet')" :title="t('buttons.pureOpenSystemSet')"
@click="onPanel" @click="onPanel"
> >
<IconifyIconOffline :icon="Setting" /> <IconifyIconOffline :icon="Setting" />

View File

@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { noticesData } from "./data"; import { noticesData } from "./data";
import NoticeList from "./noticeList.vue"; import NoticeList from "./noticeList.vue";
import Bell from "@iconify-icons/ep/bell"; import Bell from "@iconify-icons/ep/bell";
const { t } = useI18n();
const noticesNum = ref(0); const noticesNum = ref(0);
const notices = ref(noticesData); const notices = ref(noticesData);
const activeKey = ref(noticesData[0].key); const activeKey = ref(noticesData[0].key);
@ -30,7 +32,7 @@ notices.value.map(v => (noticesNum.value += v.list.length));
> >
<el-empty <el-empty
v-if="notices.length === 0" v-if="notices.length === 0"
description="暂无消息" :description="t('status.pureNoMessage')"
:image-size="60" :image-size="60"
/> />
<span v-else> <span v-else>

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType } from "vue"; import { PropType } from "vue";
import { ListItem } from "./data"; import { ListItem } from "./data";
import { useI18n } from "vue-i18n";
import NoticeItem from "./noticeItem.vue"; import NoticeItem from "./noticeItem.vue";
const props = defineProps({ const props = defineProps({
@ -9,6 +10,8 @@ const props = defineProps({
default: () => [] default: () => []
} }
}); });
const { t } = useI18n();
</script> </script>
<template> <template>
@ -19,5 +22,5 @@ const props = defineProps({
:noticeItem="item" :noticeItem="item"
/> />
</div> </div>
<el-empty v-else description="暂无消息" /> <el-empty v-else :description="t('status.pureNoMessage')" />
</template> </template>

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import { emitter } from "@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { onClickOutside } from "@vueuse/core"; import { onClickOutside } from "@vueuse/core";
import { ref, computed, onMounted, onBeforeUnmount } from "vue"; import { ref, computed, onMounted, onBeforeUnmount } from "vue";
@ -25,6 +26,7 @@ const iconClass = computed(() => {
]; ];
}); });
const { t } = useI18n();
const { onReset } = useDataThemeChange(); const { onReset } = useDataThemeChange();
onClickOutside(target, (event: any) => { onClickOutside(target, (event: any) => {
@ -51,10 +53,12 @@ onBeforeUnmount(() => {
<div <div
class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]" class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]"
> >
<h4 class="dark:text-white">项目配置</h4> <h4 class="dark:text-white">
{{ t("panel.pureSystemSet") }}
</h4>
<span <span
v-tippy="{ v-tippy="{
content: '关闭配置', content: t('panel.pureCloseSystemSet'),
placement: 'bottom-start', placement: 'bottom-start',
zIndex: 41000 zIndex: 41000
}" }"
@ -78,7 +82,7 @@ onBeforeUnmount(() => {
> >
<el-button <el-button
v-tippy="{ v-tippy="{
content: '清空缓存并返回登录页', content: t('panel.pureClearCacheAndToLogin'),
placement: 'left-start', placement: 'left-start',
zIndex: 41000 zIndex: 41000
}" }"
@ -87,7 +91,7 @@ onBeforeUnmount(() => {
bg bg
@click="onReset" @click="onReset"
> >
清空缓存 {{ t("panel.pureClearCache") }}
</el-button> </el-button>
</div> </div>
</div> </div>

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component"; import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
import enterOutlined from "@/assets/svg/enter_outlined.svg?component"; import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
@ -9,6 +10,7 @@ const props = withDefaults(defineProps<{ total: number }>(), {
total: 0 total: 0
}); });
const { t } = useI18n();
const { device } = useNav(); const { device } = useNav();
</script> </script>
@ -16,22 +18,22 @@ const { device } = useNav();
<div class="search-footer text-[#333] dark:text-white"> <div class="search-footer text-[#333] dark:text-white">
<span class="search-footer-item"> <span class="search-footer-item">
<enterOutlined class="icon" /> <enterOutlined class="icon" />
确认 {{ t("buttons.pureConfirm") }}
</span> </span>
<span class="search-footer-item"> <span class="search-footer-item">
<IconifyIconOffline :icon="ArrowUpLine" class="icon" /> <IconifyIconOffline :icon="ArrowUpLine" class="icon" />
<IconifyIconOffline :icon="ArrowDownLine" class="icon" /> <IconifyIconOffline :icon="ArrowDownLine" class="icon" />
切换 {{ t("buttons.pureSwitch") }}
</span> </span>
<span class="search-footer-item"> <span class="search-footer-item">
<mdiKeyboardEsc class="icon" /> <mdiKeyboardEsc class="icon" />
关闭 {{ t("buttons.pureClose") }}
</span> </span>
<p <p
v-if="device !== 'mobile' && props.total > 0" v-if="device !== 'mobile' && props.total > 0"
class="search-footer-total" class="search-footer-total"
> >
{{ props.total }} {{ `${t("search.pureTotal")} ${props.total}` }}
</p> </p>
</div> </div>
</template> </template>

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import Sortable from "sortablejs"; import Sortable from "sortablejs";
import { useI18n } from "vue-i18n";
import SearchHistoryItem from "./SearchHistoryItem.vue"; import SearchHistoryItem from "./SearchHistoryItem.vue";
import type { optionsItem, dragItem, Props } from "../types"; import type { optionsItem, dragItem, Props } from "../types";
import { useEpThemeStoreHook } from "@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
@ -19,6 +20,7 @@ const innerHeight = ref();
/** 判断是否停止鼠标移入事件处理 */ /** 判断是否停止鼠标移入事件处理 */
const stopMouseEvent = ref(false); const stopMouseEvent = ref(false);
const { t } = useI18n();
const emit = defineEmits<Emits>(); const emit = defineEmits<Emits>();
const instance = getCurrentInstance()!; const instance = getCurrentInstance()!;
const props = withDefaults(defineProps<Props>(), {}); const props = withDefaults(defineProps<Props>(), {});
@ -141,7 +143,9 @@ defineExpose({ handleScroll });
<template> <template>
<div ref="historyRef" class="history"> <div ref="historyRef" class="history">
<template v-if="historyList.length"> <template v-if="historyList.length">
<div :style="titleStyle">搜索历史</div> <div :style="titleStyle">
{{ t("search.pureHistory") }}
</div>
<div <div
v-for="(item, index) in historyList" v-for="(item, index) in historyList"
:key="item.path" :key="item.path"
@ -160,7 +164,9 @@ defineExpose({ handleScroll });
</template> </template>
<template v-if="collectList.length"> <template v-if="collectList.length">
<div :style="titleStyle"> <div :style="titleStyle">
收藏{{ collectList.length > 1 ? "(可拖拽排序)" : "" }} {{
`${t("search.pureCollect")}${collectList.length > 1 ? t("search.pureDragSort") : ""}`
}}
</div> </div>
<div class="collect-container"> <div class="collect-container">
<div <div

View File

@ -6,8 +6,8 @@ import { useRouter } from "vue-router";
import SearchResult from "./SearchResult.vue"; import SearchResult from "./SearchResult.vue";
import SearchFooter from "./SearchFooter.vue"; import SearchFooter from "./SearchFooter.vue";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import { transformI18n } from "@/plugins/i18n";
import SearchHistory from "./SearchHistory.vue"; import SearchHistory from "./SearchHistory.vue";
import { transformI18n, $t } from "@/plugins/i18n";
import type { optionsItem, dragItem } from "../types"; import type { optionsItem, dragItem } from "../types";
import { ref, computed, shallowRef, watch } from "vue"; import { ref, computed, shallowRef, watch } from "vue";
import { useDebounceFn, onKeyStroke } from "@vueuse/core"; import { useDebounceFn, onKeyStroke } from "@vueuse/core";
@ -29,7 +29,7 @@ const emit = defineEmits<Emits>();
const props = withDefaults(defineProps<Props>(), {}); const props = withDefaults(defineProps<Props>(), {});
const router = useRouter(); const router = useRouter();
const { locale } = useI18n(); const { t, locale } = useI18n();
const HISTORY_TYPE = "history"; const HISTORY_TYPE = "history";
const COLLECT_TYPE = "collect"; const COLLECT_TYPE = "collect";
@ -293,7 +293,7 @@ onKeyStroke("ArrowDown", handleDown);
v-model="keyword" v-model="keyword"
size="large" size="large"
clearable clearable
placeholder="搜索菜单(中文模式下支持拼音搜索)" :placeholder="t('search.purePlaceholder')"
@input="handleSearch" @input="handleSearch"
> >
<template #prefix> <template #prefix>
@ -305,7 +305,7 @@ onKeyStroke("ArrowDown", handleDown);
</el-input> </el-input>
<div class="search-content"> <div class="search-content">
<el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)"> <el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)">
<el-empty v-if="showEmpty" description="暂无搜索结果" /> <el-empty v-if="showEmpty" :description="t('search.pureEmpty')" />
<SearchHistory <SearchHistory
v-if="showSearchHistory" v-if="showSearchHistory"
ref="historyRef" ref="historyRef"

View File

@ -9,6 +9,7 @@ import {
onUnmounted, onUnmounted,
onBeforeMount onBeforeMount
} from "vue"; } from "vue";
import { useI18n } from "vue-i18n";
import panel from "../panel/index.vue"; import panel from "../panel/index.vue";
import { emitter } from "@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
@ -26,6 +27,7 @@ import dayIcon from "@/assets/svg/day.svg?component";
import darkIcon from "@/assets/svg/dark.svg?component"; import darkIcon from "@/assets/svg/dark.svg?component";
import systemIcon from "@/assets/svg/system.svg?component"; import systemIcon from "@/assets/svg/system.svg?component";
const { t } = useI18n();
const { device } = useNav(); const { device } = useNav();
const { isDark } = useDark(); const { isDark } = useDark();
const { $storage } = useGlobal<GlobalPropertiesApi>(); const { $storage } = useGlobal<GlobalPropertiesApi>();
@ -145,18 +147,20 @@ function setFalse(Doms): any {
} }
/** 页宽 */ /** 页宽 */
const stretchTypeOptions: Array<OptionsType> = [ const stretchTypeOptions = computed<Array<OptionsType>>(() => {
{ return [
label: "固定", {
tip: "紧凑页面,轻松找到所需信息", label: t("panel.pureStretchFixed"),
value: "fixed" tip: t("panel.pureStretchFixedTip"),
}, value: "fixed"
{ },
label: "自定义", {
tip: "最小1280、最大1600", label: t("panel.pureStretchCustom"),
value: "custom" tip: t("panel.pureStretchCustomTip"),
} value: "custom"
]; }
];
});
const setStretch = value => { const setStretch = value => {
settings.stretch = value; settings.stretch = value;
@ -194,41 +198,43 @@ const pClass = computed(() => {
const themeOptions = computed<Array<OptionsType>>(() => { const themeOptions = computed<Array<OptionsType>>(() => {
return [ return [
{ {
label: "浅色", label: t("panel.pureOverallStyleLight"),
icon: dayIcon, icon: dayIcon,
theme: "light", theme: "light",
tip: "清新启航,点亮舒适的工作界面", tip: t("panel.pureOverallStyleLightTip"),
iconAttrs: { fill: isDark.value ? "#fff" : "#000" } iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
}, },
{ {
label: "深色", label: t("panel.pureOverallStyleDark"),
icon: darkIcon, icon: darkIcon,
theme: "dark", theme: "dark",
tip: "月光序曲,沉醉于夜的静谧雅致", tip: t("panel.pureOverallStyleDarkTip"),
iconAttrs: { fill: isDark.value ? "#fff" : "#000" } iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
}, },
{ {
label: "自动", label: t("panel.pureOverallStyleSystem"),
icon: systemIcon, icon: systemIcon,
theme: "system", theme: "system",
tip: "同步时光,界面随晨昏自然呼应", tip: t("panel.pureOverallStyleSystemTip"),
iconAttrs: { fill: isDark.value ? "#fff" : "#000" } iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
} }
]; ];
}); });
const markOptions: Array<OptionsType> = [ const markOptions = computed<Array<OptionsType>>(() => {
{ return [
label: "灵动", {
tip: "灵动标签,添趣生辉", label: t("panel.pureTagsStyleSmart"),
value: "smart" tip: t("panel.pureTagsStyleSmartTip"),
}, value: "smart"
{ },
label: "卡片", {
tip: "卡片标签,高效浏览", label: t("panel.pureTagsStyleCard"),
value: "card" tip: t("panel.pureTagsStyleCardTip"),
} value: "card"
]; }
];
});
/** 设置导航模式 */ /** 设置导航模式 */
function setLayoutModel(layout: string) { function setLayoutModel(layout: string) {
@ -291,7 +297,7 @@ function watchSystemThemeChange() {
} }
onBeforeMount(() => { onBeforeMount(() => {
/* 初始化项目配置 */ /* 初始化系统配置 */
nextTick(() => { nextTick(() => {
watchSystemThemeChange(); watchSystemThemeChange();
settings.greyVal && settings.greyVal &&
@ -309,8 +315,9 @@ onUnmounted(() => removeMatchMedia);
<template> <template>
<panel> <panel>
<div class="p-5"> <div class="p-5">
<p :class="pClass">整体风格</p> <p :class="pClass">{{ t("panel.pureOverallStyle") }}</p>
<Segmented <Segmented
resize
class="select-none" class="select-none"
:modelValue="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0" :modelValue="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0"
:options="themeOptions" :options="themeOptions"
@ -326,7 +333,7 @@ onUnmounted(() => removeMatchMedia);
" "
/> />
<p :class="['mt-5', pClass]">主题色</p> <p :class="['mt-5', pClass]">{{ t("panel.pureThemeColor") }}</p>
<ul class="theme-color"> <ul class="theme-color">
<li <li
v-for="(item, index) in themeColors" v-for="(item, index) in themeColors"
@ -345,12 +352,12 @@ onUnmounted(() => removeMatchMedia);
</li> </li>
</ul> </ul>
<p :class="['mt-5', pClass]">导航模式</p> <p :class="['mt-5', pClass]">{{ t("panel.pureLayoutModel") }}</p>
<ul class="pure-theme"> <ul class="pure-theme">
<li <li
ref="verticalRef" ref="verticalRef"
v-tippy="{ v-tippy="{
content: '左侧菜单,亲切熟悉', content: t('panel.pureVerticalTip'),
zIndex: 41000 zIndex: 41000
}" }"
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''" :class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
@ -363,7 +370,7 @@ onUnmounted(() => removeMatchMedia);
v-if="device !== 'mobile'" v-if="device !== 'mobile'"
ref="horizontalRef" ref="horizontalRef"
v-tippy="{ v-tippy="{
content: '顶部菜单,简洁概览', content: t('panel.pureHorizontalTip'),
zIndex: 41000 zIndex: 41000
}" }"
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''" :class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
@ -376,7 +383,7 @@ onUnmounted(() => removeMatchMedia);
v-if="device !== 'mobile'" v-if="device !== 'mobile'"
ref="mixRef" ref="mixRef"
v-tippy="{ v-tippy="{
content: '混合菜单,灵活多变', content: t('panel.pureMixTip'),
zIndex: 41000 zIndex: 41000
}" }"
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''" :class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
@ -388,8 +395,9 @@ onUnmounted(() => removeMatchMedia);
</ul> </ul>
<span v-if="useAppStoreHook().getViewportWidth > 1280"> <span v-if="useAppStoreHook().getViewportWidth > 1280">
<p :class="['mt-5', pClass]">页宽</p> <p :class="['mt-5', pClass]">{{ t("panel.pureStretch") }}</p>
<Segmented <Segmented
resize
class="mb-2 select-none" class="mb-2 select-none"
:modelValue="isNumber(settings.stretch) ? 1 : 0" :modelValue="isNumber(settings.stretch) ? 1 : 0"
:options="stretchTypeOptions" :options="stretchTypeOptions"
@ -430,53 +438,56 @@ onUnmounted(() => removeMatchMedia);
</button> </button>
</span> </span>
<p :class="['mt-4', pClass]">页签风格</p> <p :class="['mt-4', pClass]">{{ t("panel.pureTagsStyle") }}</p>
<Segmented <Segmented
resize
class="select-none" class="select-none"
:modelValue="markValue === 'smart' ? 0 : 1" :modelValue="markValue === 'smart' ? 0 : 1"
:options="markOptions" :options="markOptions"
@change="onChange" @change="onChange"
/> />
<p class="mt-5 font-medium text-sm dark:text-white">界面显示</p> <p class="mt-5 font-medium text-sm dark:text-white">
{{ t("panel.pureInterfaceDisplay") }}
</p>
<ul class="setting"> <ul class="setting">
<li> <li>
<span class="dark:text-white">灰色模式</span> <span class="dark:text-white">{{ t("panel.pureGreyModel") }}</span>
<el-switch <el-switch
v-model="settings.greyVal" v-model="settings.greyVal"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="greyChange" @change="greyChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">色弱模式</span> <span class="dark:text-white">{{ t("panel.pureWeakModel") }}</span>
<el-switch <el-switch
v-model="settings.weakVal" v-model="settings.weakVal"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="weekChange" @change="weekChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">隐藏标签页</span> <span class="dark:text-white">{{ t("panel.pureHiddenTags") }}</span>
<el-switch <el-switch
v-model="settings.tabsVal" v-model="settings.tabsVal"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="tagsChange" @change="tagsChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">隐藏页脚</span> <span class="dark:text-white">{{ t("panel.pureHiddenFooter") }}</span>
<el-switch <el-switch
v-model="settings.hideFooter" v-model="settings.hideFooter"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="hideFooterChange" @change="hideFooterChange"
/> />
</li> </li>
@ -487,18 +498,20 @@ onUnmounted(() => removeMatchMedia);
inline-prompt inline-prompt
:active-value="true" :active-value="true"
:inactive-value="false" :inactive-value="false"
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="logoChange" @change="logoChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">页签持久化</span> <span class="dark:text-white">
{{ t("panel.pureMultiTagsCache") }}
</span>
<el-switch <el-switch
v-model="settings.multiTagsCache" v-model="settings.multiTagsCache"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="multiTagsCacheChange" @change="multiTagsCacheChange"
/> />
</li> </li>

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useGlobal } from "@pureadmin/utils"; import { useGlobal } from "@pureadmin/utils";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
@ -13,6 +14,7 @@ const props = withDefaults(defineProps<Props>(), {
isActive: false isActive: false
}); });
const { t } = useI18n();
const { tooltipEffect } = useNav(); const { tooltipEffect } = useNav();
const iconClass = computed(() => { const iconClass = computed(() => {
@ -34,7 +36,9 @@ const toggleClick = () => {
<template> <template>
<div <div
v-tippy="{ v-tippy="{
content: props.isActive ? '点击折叠' : '点击展开', content: props.isActive
? t('buttons.pureClickCollapse')
: t('buttons.pureClickExpand'),
theme: tooltipEffect, theme: tooltipEffect,
hideOnClick: 'toggle', hideOnClick: 'toggle',
placement: 'right' placement: 'right'

View File

@ -129,7 +129,7 @@ nextTick(() => {
</el-dropdown> </el-dropdown>
<span <span
class="set-icon navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.pureSystemSet')" :title="t('buttons.pureOpenSystemSet')"
@click="onPanel" @click="onPanel"
> >
<IconifyIconOffline :icon="Setting" /> <IconifyIconOffline :icon="Setting" />

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useGlobal } from "@pureadmin/utils"; import { useGlobal } from "@pureadmin/utils";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
@ -13,6 +14,7 @@ const props = withDefaults(defineProps<Props>(), {
isActive: false isActive: false
}); });
const { t } = useI18n();
const { tooltipEffect } = useNav(); const { tooltipEffect } = useNav();
const iconClass = computed(() => { const iconClass = computed(() => {
@ -44,7 +46,9 @@ const toggleClick = () => {
<div class="left-collapse"> <div class="left-collapse">
<IconifyIconOffline <IconifyIconOffline
v-tippy="{ v-tippy="{
content: props.isActive ? '点击折叠' : '点击展开', content: props.isActive
? t('buttons.pureClickCollapse')
: t('buttons.pureClickExpand'),
theme: tooltipEffect, theme: tooltipEffect,
hideOnClick: 'toggle', hideOnClick: 'toggle',
placement: 'right' placement: 'right'

View File

@ -162,7 +162,7 @@ watch(
</el-dropdown> </el-dropdown>
<span <span
class="set-icon navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.pureSystemSet')" :title="t('buttons.pureOpenSystemSet')"
@click="onPanel" @click="onPanel"
> >
<IconifyIconOffline :icon="Setting" /> <IconifyIconOffline :icon="Setting" />

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import MenuFold from "@iconify-icons/ri/menu-fold-fill"; import MenuFold from "@iconify-icons/ri/menu-fold-fill";
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill"; import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
@ -10,6 +11,8 @@ const props = withDefaults(defineProps<Props>(), {
isActive: false isActive: false
}); });
const { t } = useI18n();
const emit = defineEmits<{ const emit = defineEmits<{
(e: "toggleClick"): void; (e: "toggleClick"): void;
}>(); }>();
@ -22,7 +25,11 @@ const toggleClick = () => {
<template> <template>
<div <div
class="px-3 mr-1 navbar-bg-hover" class="px-3 mr-1 navbar-bg-hover"
:title="props.isActive ? '点击折叠' : '点击展开'" :title="
props.isActive
? t('buttons.pureClickCollapse')
: t('buttons.pureClickExpand')
"
@click="toggleClick" @click="toggleClick"
> >
<IconifyIconOffline <IconifyIconOffline

View File

@ -17,7 +17,8 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill"; import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
import Fullscreen from "@iconify-icons/ri/fullscreen-fill"; import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
const errorInfo = "当前路由配置不正确,请检查配置"; const errorInfo =
"The current routing configuration is incorrect, please check the configuration";
export function useNav() { export function useNav() {
const pureApp = useAppStoreHook(); const pureApp = useAppStoreHook();

View File

@ -3,6 +3,7 @@ import "animate.css";
// src/components/ReIcon/src/offlineIcon.ts 使addIcon // src/components/ReIcon/src/offlineIcon.ts 使addIcon
import "@/components/ReIcon/src/offlineIcon"; import "@/components/ReIcon/src/offlineIcon";
import { setType } from "./types"; import { setType } from "./types";
import { useI18n } from "vue-i18n";
import { useLayout } from "./hooks/useLayout"; import { useLayout } from "./hooks/useLayout";
import { useAppStoreHook } from "@/store/modules/app"; import { useAppStoreHook } from "@/store/modules/app";
import { useSettingStoreHook } from "@/store/modules/settings"; import { useSettingStoreHook } from "@/store/modules/settings";
@ -31,6 +32,7 @@ import Vertical from "./components/sidebar/vertical.vue";
import Horizontal from "./components/sidebar/horizontal.vue"; import Horizontal from "./components/sidebar/horizontal.vue";
import backTop from "@/assets/svg/back_top.svg?component"; import backTop from "@/assets/svg/back_top.svg?component";
const { t } = useI18n();
const appWrapperRef = ref(); const appWrapperRef = ref();
const { isDark } = useDark(); const { isDark } = useDark();
const { layout } = useLayout(); const { layout } = useLayout();
@ -185,7 +187,7 @@ const layoutHeader = defineComponent({
</div> </div>
<el-scrollbar v-else> <el-scrollbar v-else>
<el-backtop <el-backtop
title="回到顶部" :title="t('buttons.pureBackTop')"
target=".main-container .el-scrollbar__wrap" target=".main-container .el-scrollbar__wrap"
> >
<backTop /> <backTop />

View File

@ -81,7 +81,7 @@ function isOneOfArray(a: Array<string>, b: Array<string>) {
: true; : true;
} }
/** 从localStorage里取出当前登用户的角色roles过滤无权限的菜单 */ /** 从localStorage里取出当前登用户的角色roles过滤无权限的菜单 */
function filterNoPermissionTree(data: RouteComponent[]) { function filterNoPermissionTree(data: RouteComponent[]) {
const currentRoles = const currentRoles =
storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? []; storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? [];

View File

@ -117,7 +117,7 @@ html.dark {
} }
} }
/* 项目配置面板 */ /* 系统配置面板 */
.right-panel-items { .right-panel-items {
.el-divider__text { .el-divider__text {
--el-bg-color: var(--el-bg-color); --el-bg-color: var(--el-bg-color);

View File

@ -15,7 +15,7 @@ export interface DataInfo<T> {
username?: string; username?: string;
/** 昵称 */ /** 昵称 */
nickname?: string; nickname?: string;
/** 当前登用户的角色 */ /** 当前登用户的角色 */
roles?: Array<string>; roles?: Array<string>;
} }

View File

@ -19,10 +19,10 @@ export const injectResponsiveStorage = (app: App, config: PlatformConfigs) => {
darkMode: config.DarkMode ?? false, darkMode: config.DarkMode ?? false,
sidebarStatus: config.SidebarStatus ?? true, sidebarStatus: config.SidebarStatus ?? true,
epThemeColor: config.EpThemeColor ?? "#409EFF", epThemeColor: config.EpThemeColor ?? "#409EFF",
themeColor: config.Theme ?? "light", // 主题色(对应项目配置中的主题色与theme不同的是它不会受到浅色、深色整体风格切换的影响只会在手动点击主题色时改变 themeColor: config.Theme ?? "light", // 主题色(对应系统配置中的主题色与theme不同的是它不会受到浅色、深色整体风格切换的影响只会在手动点击主题色时改变
overallStyle: config.OverallStyle ?? "light" // 整体风格浅色light、深色dark、自动system overallStyle: config.OverallStyle ?? "light" // 整体风格浅色light、深色dark、自动system
}, },
// 项目配置-界面显示 // 系统配置-界面显示
configure: Storage.getData("configure", nameSpace) ?? { configure: Storage.getData("configure", nameSpace) ?? {
grey: config.Grey ?? false, grey: config.Grey ?? false,
weak: config.Weak ?? false, weak: config.Weak ?? false,

View File

@ -51,8 +51,8 @@ const GUIDE_STEPS = [
}, },
{ {
element: document.querySelector(".set-icon") as string | HTMLElement, element: document.querySelector(".set-icon") as string | HTMLElement,
title: "项目配置", title: "系统配置",
intro: "您可以在这里查看项目配置", intro: "您可以在这里查看系统配置",
position: "left" position: "left"
}, },
{ {

View File

@ -77,12 +77,12 @@ const onLogin = async (formEl: FormInstance | undefined) => {
router router
.push(getTopMenu(true).path) .push(getTopMenu(true).path)
.then(() => { .then(() => {
message("登录成功", { type: "success" }); message(t("login.pureLoginSuccess"), { type: "success" });
}) })
.finally(() => (disabled.value = false)); .finally(() => (disabled.value = false));
}); });
} else { } else {
message("登录失败", { type: "error" }); message(t("login.pureLoginFail"), { type: "error" });
} }
}) })
.finally(() => (loading.value = false)); .finally(() => (loading.value = false));