diff --git a/api/upnew/index.ts b/api/upnew/index.ts index dfc138a..6575a65 100644 --- a/api/upnew/index.ts +++ b/api/upnew/index.ts @@ -40,7 +40,7 @@ export const indexTabs = () => { * @returns */ export const keywords = (params: { type: string | number; keywords: string }) => { - return useFetchRequest.get>('/prod-api/app-api/business/app/dict/label-keywords', {query:params}) + return useFetchRequest.get>('/prod-api/app-api/business/app/dict/label-keywords', { query: params }) } /** * 获取格式类型字典信息 @@ -80,3 +80,10 @@ export const homeLabel = () => { export const getWechat = () => { return useDollarFetchRequest.get>('/prod-api/app-api/system/index-setting/kefu-wechat') } + +/** + * 查看图纸 + */ +export const view = (params: { id: string | number; projectId: string | number }) => { + return useDollarFetchRequest.get>('/prod-api/app-api/business/app/project-draw/get', { query: params }) +} diff --git a/components/kl-uploader/index.vue b/components/kl-uploader/index.vue index 7d60f2d..7111d98 100644 --- a/components/kl-uploader/index.vue +++ b/components/kl-uploader/index.vue @@ -323,7 +323,7 @@ // 判断是否是图片 const handelFileType = (fileName: string) => { - const ext = fileName.split('.').pop()?.toLowerCase() || '' + const ext = fileName?.split('.').pop()?.toLowerCase() || '' return ['png', 'jpg', 'jpeg'].includes(ext) } diff --git a/pages/personal-Center/index/components/upload-table.vue b/pages/personal-Center/index/components/upload-table.vue index 8dc90d3..a4a944b 100644 --- a/pages/personal-Center/index/components/upload-table.vue +++ b/pages/personal-Center/index/components/upload-table.vue @@ -37,9 +37,9 @@ @@ -125,11 +125,11 @@ } const handlePreview = (row: any) => { - window.open(row.url) + navigateTo(`/upnew?id=${row.id}&projectId=${row.projectId}&type=preview`) } const handleEdit = (row: any) => { - window.open(`/personal-center/edit-resource?id=${row.id}`) + navigateTo(`/upnew?id=${row.id}&projectId=${row.projectId}&type=edit`) } diff --git a/pages/upnew/index.vue b/pages/upnew/index.vue index 783e478..4e94e57 100644 --- a/pages/upnew/index.vue +++ b/pages/upnew/index.vue @@ -4,7 +4,7 @@
- +
@@ -13,7 +13,7 @@ - + 发布 @@ -32,8 +32,18 @@ import { reactive, ref, onMounted, computed } from 'vue' import type { TcreateReq } from '~/api/upnew/types' - import { create } from '~/api/upnew/index' - const router = useRouter() // 导入路由实例,用于跳转页面 + import { create, view } from '~/api/upnew/index' + const route = useRoute() // 导入路由实例,用于跳转页面 + const id = computed(() => { + return route.query.id as string + }) + const projectId = computed(() => { + return route.query.projectId as string + }) + + const type = computed(() => { + return route.query.type || 'add' + }) const form = reactive({ activeName: 1, // 标签 @@ -123,6 +133,37 @@ // previewForm.name = val.name } + /** 组装回显的数据 */ + const getDetail = () => { + view({ id: id.value, projectId: projectId.value }).then((res) => { + const { code, data } = res + if (code === 0) { + form.isDomestic = data.isDomestic + form.province = data.province + form.city = data.city + form.county = data.county + form.activeName = form.type = data.draws[0].type + form.draws = data.draws.map((c) => { + return { + ...c, + coverImages: c.coverImages.map((d) => { + return { + ...d, + name: d.title, + } + }), + otherFiles: c.otherFiles.map((d) => { + return { + ...d, + name: d.title, + } + }), + } + }) + } + }) + } + // 图纸类型 const drawTypeRef = ref>() onMounted(() => { @@ -130,6 +171,10 @@ drawTypeRef.value?.handleTypeChange(1) // 初始化图纸类型 form.type = 1 + + if (type.value !== 'add') { + getDetail() + } })