From 5dbc93a1bcc2700e94fee97c59ae945028aa3157 Mon Sep 17 00:00:00 2001 From: Jason <5340635+wen-jason@user.noreply.gitee.com> Date: Wed, 7 Sep 2022 15:30:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/api/decoration.ts | 2 +- admin/src/components/link/custom-link.vue | 2 +- admin/src/components/link/index.vue | 60 +++++++++++++++++------ admin/src/components/link/picker.vue | 8 +-- admin/src/components/link/shop-pages.vue | 12 ++++- admin/src/views/decoration/tabbar.vue | 38 ++++++++------ 6 files changed, 88 insertions(+), 34 deletions(-) diff --git a/admin/src/api/decoration.ts b/admin/src/api/decoration.ts index 22dc4d93..1ecb0cfb 100644 --- a/admin/src/api/decoration.ts +++ b/admin/src/api/decoration.ts @@ -2,7 +2,7 @@ import request from '@/utils/request' // 页面装修详情 export function getDecoratePages(params: any) { - return request.get({ url: '/decorate/pages/detail', params }) + return request.get({ url: '/decorate/pages/detail', params }, { ignoreCancelToken: true }) } // 页面装修保存 diff --git a/admin/src/components/link/custom-link.vue b/admin/src/components/link/custom-link.vue index 6aff0e58..23f90536 100644 --- a/admin/src/components/link/custom-link.vue +++ b/admin/src/components/link/custom-link.vue @@ -1,5 +1,5 @@ @@ -24,36 +32,60 @@ import CustomLink from './custom-link.vue' const props = defineProps({ modelValue: { - type: Object as PropType + type: Object as PropType, + required: true } }) const emit = defineEmits<{ (event: 'update:modelValue', value: any): void }>() -const activeLink = computed({ - get() { - return props.modelValue - }, - set(value) { - emit('update:modelValue', value) - } -}) const menus = ref([ { name: '商城页面', - type: LinkTypeEnum.SHOP_PAGES + type: LinkTypeEnum.SHOP_PAGES, + link: {} }, { name: '自定义链接', - type: LinkTypeEnum.CUSTOM_LINK + type: LinkTypeEnum.CUSTOM_LINK, + link: {} } ]) + +const activeLink = computed({ + get() { + return menus.value.find((item) => item.type == activeMenu.value)?.link as Link + }, + set(value) { + menus.value.forEach((item) => { + if (item.type == activeMenu.value) { + item.link = value + } + }) + } +}) + const activeMenu = ref(LinkTypeEnum.SHOP_PAGES) const handleSelect = (index: string) => { activeMenu.value = index } + +const updateLink = (value: any) => { + emit('update:modelValue', value) +} + +watch( + () => props.modelValue, + (value) => { + activeMenu.value = value.type + activeLink.value = value + }, + { + immediate: true + } +)