From d43ae50abc9461a9b20b3f015ba3679ba699dfa2 Mon Sep 17 00:00:00 2001 From: LiuHao Date: Tue, 6 Jun 2023 22:52:24 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=20=E5=8E=BB=E9=99=A4=E6=97=A0=E7=94=A8=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=92=8C=E4=BB=A3=E7=A0=81=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Breadcrumb/index.vue | 38 ++--- src/components/BuildCode/index.vue | 2 - src/components/DictTag/index.vue | 7 +- src/components/Editor/index.vue | 202 +++++++++++++------------- src/components/FileUpload/index.vue | 60 ++++---- src/components/Hamburger/index.vue | 11 +- src/components/HeaderSearch/index.vue | 63 ++++---- src/components/IconSelect/index.vue | 12 +- src/components/ImagePreview/index.vue | 58 ++++---- src/components/ImageUpload/index.vue | 33 ++--- src/components/RightToolbar/index.vue | 18 +-- src/components/SvgIcon/index.vue | 17 +-- src/components/TreeSelect/index.vue | 76 +++++----- src/components/iFrame/index.vue | 7 +- 14 files changed, 278 insertions(+), 326 deletions(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 435d0cc..b96829a 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -18,34 +18,34 @@ const router = useRouter(); const levelList = ref([]) const getBreadcrumb = () => { - // only show routes with meta.title - let matched = route.matched.filter(item => item.meta && item.meta.title); - const first = matched[0] - // 判断是否为首页 - if (!isDashboard(first)) { - matched = ([{ path: '/index', meta: { title: '首页' } }] as any).concat(matched) - } - levelList.value = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) + // only show routes with meta.title + let matched = route.matched.filter(item => item.meta && item.meta.title); + const first = matched[0] + // 判断是否为首页 + if (!isDashboard(first)) { + matched = ([{ path: '/index', meta: { title: '首页' } }] as any).concat(matched) + } + levelList.value = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) } const isDashboard = (route: RouteLocationMatched) => { - const name = route && route.name as string - if (!name) { - return false - } - return name.trim() === 'Index' + const name = route && route.name as string + if (!name) { + return false + } + return name.trim() === 'Index' } const handleLink = (item: RouteLocationMatched) => { - const { redirect, path } = item - redirect ? router.push(redirect as string) : router.push(path) + const { redirect, path } = item + redirect ? router.push(redirect as string) : router.push(path) } watchEffect(() => { - // if you go to the redirect page, do not update the breadcrumbs - if (route.path.startsWith('/redirect/')) return - getBreadcrumb() + // if you go to the redirect page, do not update the breadcrumbs + if (route.path.startsWith('/redirect/')) return + getBreadcrumb() }) onMounted(() => { - getBreadcrumb(); + getBreadcrumb(); }) diff --git a/src/components/BuildCode/index.vue b/src/components/BuildCode/index.vue index 9315732..b23665c 100644 --- a/src/components/BuildCode/index.vue +++ b/src/components/BuildCode/index.vue @@ -1,8 +1,6 @@ diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index fffcedf..489ac43 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -1,6 +1,6 @@ diff --git a/src/components/HeaderSearch/index.vue b/src/components/HeaderSearch/index.vue index b87a585..9b0f2c6 100644 --- a/src/components/HeaderSearch/index.vue +++ b/src/components/HeaderSearch/index.vue @@ -23,7 +23,6 @@ import { getNormalPath } from '@/utils/ruoyi'; import { isHttp } from '@/utils/validate'; import usePermissionStore from '@/store/modules/permission'; import { RouteOption } from 'vue-router'; -import { ElSelect } from 'element-plus'; type Router = Array<{ path: string; @@ -35,7 +34,7 @@ const options = ref([]); const searchPool = ref([]); const show = ref(false); const fuse = ref(); -const headerSearchSelectRef = ref(ElSelect); +const headerSearchSelectRef = ref(); const router = useRouter(); const routes = computed(() => usePermissionStore().routes); @@ -143,40 +142,40 @@ watch(searchPool, (list) => { diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 22b9484..c53b437 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -31,17 +31,11 @@ @@ -58,13 +57,16 @@ const realHeight = computed(() => border-radius: 5px; background-color: #ebeef5; box-shadow: 0 0 5px 1px #ccc; + :deep(.el-image__inner) { transition: all 0.3s; cursor: pointer; + &:hover { transform: scale(1.2); } } + :deep(.image-slot) { display: flex; justify-content: center; diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 0791f3e..01edc4f 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -17,7 +17,9 @@ :on-preview="handlePictureCardPreview" :class="{ hide: fileList.length >= limit }" > - + + +
@@ -42,25 +44,16 @@ import { getToken } from "@/utils/auth"; import { listByIds, delOss } from "@/api/system/oss"; import { ComponentInternalInstance, PropType } from "vue"; import { OssVO } from "@/api/system/oss/types"; -import { ElUpload, UploadFile } from "element-plus"; +import { propTypes } from '@/utils/propTypes'; const props = defineProps({ modelValue: [String, Object, Array], // 图片数量限制 - limit: { - type: Number, - default: 5, - }, + limit: propTypes.number.def(5), // 大小限制(MB) - fileSize: { - type: Number, - default: 5, - }, + fileSize: propTypes.number.def(5), // 文件类型, 例如['png', 'jpg', 'jpeg'] - fileType: { - type: Array as PropType, - default: () => ["png", "jpg", "jpeg"], - }, + fileType: propTypes.array.def(["png", "jpg", "jpeg"]), // 是否显示提示 isShowTip: { type: Boolean, @@ -84,12 +77,12 @@ const showTip = computed( () => props.isShowTip && (props.fileType || props.fileSize) ); -const imageUploadRef = ref(ElUpload); +const imageUploadRef = ref(); watch(() => props.modelValue, async val => { if (val) { // 首先将值转为数组 - let list:OssVO[] = []; + let list: OssVO[] = []; if (Array.isArray(val)) { list = val as OssVO[]; } else { @@ -112,7 +105,7 @@ watch(() => props.modelValue, async val => { fileList.value = []; return []; } -},{ deep: true, immediate: true }); +}, { deep: true, immediate: true }); /** 上传前loading加载 */ const handleBeforeUpload = (file: any) => { @@ -122,7 +115,7 @@ const handleBeforeUpload = (file: any) => { if (file.name.lastIndexOf(".") > -1) { fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); } - isImg = props.fileType.some((type) => { + isImg = props.fileType.some((type: any) => { if (file.type.indexOf(type) > -1) return true; if (fileExtension && fileExtension.indexOf(type) > -1) return true; return false; @@ -161,7 +154,7 @@ const handleUploadSuccess = (res: any, file: UploadFile) => { number.value--; proxy?.$modal.closeLoading(); proxy?.$modal.msgError(res.msg); - imageUploadRef.value.handleRemove(file); + imageUploadRef.value?.handleRemove(file); uploadedSuccessfully(); } } @@ -207,7 +200,7 @@ const listToString = (list: any[], separator?: string) => { let strs = ""; separator = separator || ","; for (let i in list) { - if(undefined !== list[i].ossId && list[i].url.indexOf("blob:") !== 0) { + if (undefined !== list[i].ossId && list[i].url.indexOf("blob:") !== 0) { strs += list[i].ossId + separator; } } diff --git a/src/components/RightToolbar/index.vue b/src/components/RightToolbar/index.vue index 20226d8..09036b7 100644 --- a/src/components/RightToolbar/index.vue +++ b/src/components/RightToolbar/index.vue @@ -18,25 +18,15 @@