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