Commit c8eb95b95e49f426ce334bd75ca7972147a07d42
1 parent
f8ab651a
feat: 添加水印
Showing
3 changed files
with
29 additions
and
20 deletions
yudao-ui-admin-vue3/src/components/Setting/src/Setting.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { ElDrawer, ElDivider, ElMessage } from 'element-plus' |
| 3 | 3 | import { ref, unref, computed, watch } from 'vue' |
| 4 | +import { useCssVar, useClipboard } from '@vueuse/core' | |
| 4 | 5 | import { useI18n } from '@/hooks/web/useI18n' |
| 5 | -import { ThemeSwitch } from '@/components/ThemeSwitch' | |
| 6 | +import { useCache } from '@/hooks/web/useCache' | |
| 7 | +import { useDesign } from '@/hooks/web/useDesign' | |
| 8 | + | |
| 9 | +import { trim, setCssVar } from '@/utils' | |
| 6 | 10 | import { colorIsDark, lighten, hexToRGB } from '@/utils/color' |
| 7 | -import { useCssVar } from '@vueuse/core' | |
| 8 | 11 | import { useAppStore } from '@/store/modules/app' |
| 9 | -import { trim, setCssVar } from '@/utils' | |
| 12 | +import { ThemeSwitch } from '@/components/ThemeSwitch' | |
| 10 | 13 | import ColorRadioPicker from './components/ColorRadioPicker.vue' |
| 11 | 14 | import InterfaceDisplay from './components/InterfaceDisplay.vue' |
| 12 | 15 | import LayoutRadioPicker from './components/LayoutRadioPicker.vue' |
| 13 | -import { useCache } from '@/hooks/web/useCache' | |
| 14 | -import { useClipboard } from '@vueuse/core' | |
| 15 | -import { useDesign } from '@/hooks/web/useDesign' | |
| 16 | - | |
| 17 | -const { getPrefixCls } = useDesign() | |
| 18 | - | |
| 19 | -const prefixCls = getPrefixCls('setting') | |
| 20 | - | |
| 21 | -const appStore = useAppStore() | |
| 22 | 16 | |
| 23 | 17 | const { t } = useI18n() |
| 18 | +const appStore = useAppStore() | |
| 24 | 19 | |
| 20 | +const { getPrefixCls } = useDesign() | |
| 21 | +const prefixCls = getPrefixCls('setting') | |
| 25 | 22 | const layout = computed(() => appStore.getLayout) |
| 26 | - | |
| 27 | 23 | const drawer = ref(false) |
| 28 | 24 | |
| 29 | 25 | // 主题色相关 | ... | ... |
yudao-ui-admin-vue3/src/components/Setting/src/components/InterfaceDisplay.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { ElSwitch, ElMessage } from 'element-plus' | |
| 3 | -import { useI18n } from '@/hooks/web/useI18n' | |
| 4 | -import { useAppStore } from '@/store/modules/app' | |
| 5 | 2 | import { computed, ref, watch } from 'vue' |
| 3 | +import { ElSwitch, ElInput, ElMessage } from 'element-plus' | |
| 6 | 4 | import { setCssVar } from '@/utils' |
| 5 | +import { useI18n } from '@/hooks/web/useI18n' | |
| 7 | 6 | import { useDesign } from '@/hooks/web/useDesign' |
| 7 | +import { useWatermark } from '@/hooks/web/useWatermark' | |
| 8 | +import { useAppStore } from '@/store/modules/app' | |
| 8 | 9 | |
| 10 | +const { t } = useI18n() | |
| 9 | 11 | const { getPrefixCls } = useDesign() |
| 10 | - | |
| 12 | +const { setWatermark } = useWatermark() | |
| 11 | 13 | const prefixCls = getPrefixCls('interface-display') |
| 12 | - | |
| 13 | 14 | const appStore = useAppStore() |
| 14 | 15 | |
| 15 | -const { t } = useI18n() | |
| 16 | +const water = ref() | |
| 16 | 17 | |
| 17 | 18 | // 面包屑 |
| 18 | 19 | const breadcrumb = ref(appStore.getBreadcrumb) |
| ... | ... | @@ -122,6 +123,11 @@ const fixedMenuChange = (show: boolean) => { |
| 122 | 123 | appStore.setFixedMenu(show) |
| 123 | 124 | } |
| 124 | 125 | |
| 126 | +// 设置水印 | |
| 127 | +const setWater = () => { | |
| 128 | + setWatermark(water.value) | |
| 129 | +} | |
| 130 | + | |
| 125 | 131 | const layout = computed(() => appStore.getLayout) |
| 126 | 132 | |
| 127 | 133 | watch( |
| ... | ... | @@ -210,5 +216,10 @@ watch( |
| 210 | 216 | <span class="text-14px">{{ t('setting.fixedMenu') }}</span> |
| 211 | 217 | <ElSwitch v-model="fixedMenu" @change="fixedMenuChange" /> |
| 212 | 218 | </div> |
| 219 | + | |
| 220 | + <div class="flex justify-between items-center"> | |
| 221 | + <span class="text-14px">{{ t('watermark.watermark') }}</span> | |
| 222 | + <ElInput v-model="water" class="w-20 right-1" @change="setWater()" /> | |
| 223 | + </div> | |
| 213 | 224 | </div> |
| 214 | 225 | </template> | ... | ... |
yudao-ui-admin-vue3/src/views/Home/Index.vue
| ... | ... | @@ -123,7 +123,7 @@ |
| 123 | 123 | <el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-10px"> |
| 124 | 124 | <div class="flex items-center"> |
| 125 | 125 | <Icon :icon="item.icon" class="mr-10px" /> |
| 126 | - <el-link type="default" :underline="false" :href="item.url"> | |
| 126 | + <el-link type="default" :underline="false" @click="setWatermark(item.name)"> | |
| 127 | 127 | {{ item.name }} |
| 128 | 128 | </el-link> |
| 129 | 129 | </div> |
| ... | ... | @@ -168,6 +168,7 @@ import { ElRow, ElCol, ElSkeleton, ElCard, ElDivider, ElLink } from 'element-plu |
| 168 | 168 | import { formatTime } from '@/utils' |
| 169 | 169 | import { useI18n } from '@/hooks/web/useI18n' |
| 170 | 170 | import { useCache } from '@/hooks/web/useCache' |
| 171 | +import { useWatermark } from '@/hooks/web/useWatermark' | |
| 171 | 172 | import { Echart } from '@/components/Echart' |
| 172 | 173 | import { CountTo } from '@/components/CountTo' |
| 173 | 174 | import { Highlight } from '@/components/Highlight' |
| ... | ... | @@ -176,6 +177,7 @@ import { pieOptions, barOptions } from './echarts-data' |
| 176 | 177 | |
| 177 | 178 | const { t } = useI18n() |
| 178 | 179 | const { wsCache } = useCache() |
| 180 | +const { setWatermark } = useWatermark() | |
| 179 | 181 | const loading = ref(true) |
| 180 | 182 | const avatar = wsCache.get('user').user.avatar |
| 181 | 183 | const username = wsCache.get('user').user.nickname | ... | ... |