调整 发布
This commit is contained in:
+2
-2
@@ -5,8 +5,8 @@ VITE_BASE_URL = /
|
||||
|
||||
# API 地址前缀
|
||||
# VITE_API_URL = http://219.157.255.213:36010
|
||||
# VITE_API_URL = https://userdcar-server.hnxinyouhe.com
|
||||
VITE_API_URL = https://usedcar.dev.hnxinyouhe.com
|
||||
VITE_API_URL = https://userdcar-server.hnxinyouhe.com
|
||||
# VITE_API_URL = https://usedcar.dev.hnxinyouhe.com
|
||||
# VITE_API_URL_WSS = wss://fdesk.hnxinyouhe.com
|
||||
# VITE_API_URL_WSS = wss://x-server.hnxinyouhe.com
|
||||
# Delete console
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
:headers="uploadHeaders"
|
||||
:show-file-list="false"
|
||||
:on-success="handleUpload"
|
||||
:before-upload="beforeUpload"
|
||||
multiple
|
||||
:before-upload="beforeUploadHandle"
|
||||
:multiple="maxCount !== 1"
|
||||
:accept="accept"
|
||||
>
|
||||
<div class="upload-trigger">
|
||||
<div class="upload-trigger" :class="{ 'is-disabled': isMaxCountReached }">
|
||||
<img class="upload-icon" :src="iconSrc" />
|
||||
<div class="upload-text">
|
||||
<span>{{ uploadText }}</span>
|
||||
@@ -79,6 +79,7 @@
|
||||
iconSrc?: string
|
||||
accept?: string
|
||||
maxSize?: number // MB
|
||||
maxCount?: number // 最大文件数量,默认不限制
|
||||
actionImageUplode?: string
|
||||
}
|
||||
|
||||
@@ -94,11 +95,17 @@
|
||||
iconSrc: contractIcon,
|
||||
accept: '.jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt',
|
||||
maxSize: 10,
|
||||
maxCount: 0, // 0 表示不限制
|
||||
actionImageUplode: `${import.meta.env.VITE_API_URL}/ticket/upload?scene=stock_orders`
|
||||
})
|
||||
|
||||
const actionImageUplode = computed(() => props.actionImageUplode)
|
||||
|
||||
// 是否已达到最大文件数量
|
||||
const isMaxCountReached = computed(() => {
|
||||
return props.maxCount > 0 && fileList.value.length >= props.maxCount
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
const fileList = computed({
|
||||
@@ -123,6 +130,15 @@
|
||||
return (file.file_name || '').toLowerCase().startsWith('image/')
|
||||
}
|
||||
|
||||
const beforeUploadHandle = (file: File) => {
|
||||
// 检查文件数量限制
|
||||
if (isMaxCountReached.value) {
|
||||
ElMessage.error(`最多只能上传${props.maxCount}个文件!`)
|
||||
return false
|
||||
}
|
||||
return beforeUpload(file)
|
||||
}
|
||||
|
||||
const beforeUpload = (file: File) => {
|
||||
const isValidType = new RegExp(props.accept.replace(/\./g, '\\.').replace(/,/g, '|'), 'i').test(
|
||||
file.name
|
||||
@@ -206,6 +222,12 @@
|
||||
border-color: #409eff;
|
||||
background: #f0f9ff;
|
||||
}
|
||||
|
||||
&.is-disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.upload-icon {
|
||||
|
||||
+15
-3
@@ -7,7 +7,13 @@ export enum AuditStatusEnum {
|
||||
/** 审核通过 */
|
||||
APPROVED = 1,
|
||||
/** 审核拒绝 */
|
||||
REJECTED = 2
|
||||
REJECTED = 2,
|
||||
/** 推送中 */
|
||||
PUSHING = 3,
|
||||
/** 推送成功 */
|
||||
PUSH_SUCCESS = 4,
|
||||
/** 推送失败 */
|
||||
PUSH_FAILED = 5
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -16,7 +22,10 @@ export enum AuditStatusEnum {
|
||||
export const AuditStatusMap: { [key: number]: string } = {
|
||||
0: '待审核',
|
||||
1: '审核通过',
|
||||
2: '审核拒绝'
|
||||
2: '审核拒绝',
|
||||
3: '推送中',
|
||||
4: '推送成功',
|
||||
5: '推送失败'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,5 +34,8 @@ export const AuditStatusMap: { [key: number]: string } = {
|
||||
export const AuditStatusColorMap: { [key: number]: string } = {
|
||||
0: 'warning',
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
2: 'danger',
|
||||
3: 'info',
|
||||
4: 'success',
|
||||
5: 'danger'
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
name: 'publishAdd',
|
||||
component: 'admin/publish/publish_add',
|
||||
meta: {
|
||||
title: '发布',
|
||||
title: '发布(二手车)',
|
||||
roles: ['procurement', 'admin']
|
||||
}
|
||||
},
|
||||
@@ -34,8 +34,8 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
name: 'publishAddPro',
|
||||
component: 'admin/publish/publish_addpro',
|
||||
meta: {
|
||||
title: '发布',
|
||||
roles: ['supplier', 'businesspro']
|
||||
title: '发布(smartcar)',
|
||||
roles: ['supplier', 'businesspro', 'adminpro']
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -43,7 +43,7 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
name: 'publishMyListPro',
|
||||
component: 'admin/publish/publish_my_listpro',
|
||||
meta: {
|
||||
title: '我的发布',
|
||||
title: '我的发布(smartcar)',
|
||||
roles: ['supplier', 'businesspro', 'adminpro']
|
||||
}
|
||||
},
|
||||
@@ -52,8 +52,8 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
name: 'publishMyList',
|
||||
component: 'admin/publish/publish_my_list',
|
||||
meta: {
|
||||
title: '我的发布',
|
||||
roles: ['procurement', 'admin', 'adminpro']
|
||||
title: '我的发布(二手车)',
|
||||
roles: ['procurement', 'admin']
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -81,7 +81,7 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
meta: {
|
||||
title: '用户信息',
|
||||
isHide: true,
|
||||
roles: ['procurement', 'business', 'admin', 'supplier', 'businesspro']
|
||||
roles: ['procurement', 'business', 'admin', 'supplier', 'businesspro', 'adminpro']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<el-form-item label="关键字:" label-width="70px">
|
||||
<el-input style="min-width: 120px" v-model="keyword" placeholder="请输入关键字" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态:" label-width="80px">
|
||||
<el-form-item label="状态:" label-width="80px">
|
||||
<el-select
|
||||
v-model="auditStatus"
|
||||
placeholder="请选择状态"
|
||||
@@ -16,9 +16,12 @@
|
||||
<el-option label="待审核" :value="0" />
|
||||
<el-option label="审核通过" :value="1" />
|
||||
<el-option label="审核拒绝" :value="2" />
|
||||
<el-option label="推送中" :value="3" />
|
||||
<el-option label="推送成功" :value="4" />
|
||||
<el-option label="推送失败" :value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围:" label-width="80px">
|
||||
<!-- <el-form-item label="时间范围:" label-width="80px">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
@@ -28,7 +31,7 @@
|
||||
style="min-width: 240px"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -72,7 +75,7 @@
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="提交时间" prop="created_at" />
|
||||
<ElTableColumn fixed="right" label="操作">
|
||||
<ElTableColumn fixed="right" label="操作" width="220">
|
||||
<template #default="scope">
|
||||
<el-button link @click="showDetail(scope.row)">详情</el-button>
|
||||
<el-button link type="primary" @click="showAuditRecords(scope.row)"
|
||||
@@ -341,7 +344,10 @@
|
||||
const colorMap: { [key: number]: 'success' | 'warning' | 'danger' | 'info' } = {
|
||||
0: 'warning',
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
2: 'danger',
|
||||
3: 'info',
|
||||
4: 'success',
|
||||
5: 'danger'
|
||||
}
|
||||
return colorMap[status] || 'info'
|
||||
}
|
||||
|
||||
@@ -148,18 +148,19 @@
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="24" :lg="24">
|
||||
<el-form-item label="附件">
|
||||
<el-form-item label="检测报告">
|
||||
<MultiFileUpload
|
||||
v-model="attachmentFileList"
|
||||
upload-text="点击上传附件"
|
||||
hint-text="支持多个文件上传"
|
||||
upload-text="点击上传检测报告"
|
||||
hint-text="仅支持单个文件上传"
|
||||
:max-count="1"
|
||||
:action-image-uplode="uploadActionFile"
|
||||
@change="handleAttachmentChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<!-- FAQ 问答 -->
|
||||
<ElCol :sm="24" :md="24" :lg="24">
|
||||
<!-- <ElCol :sm="24" :md="24" :lg="24">
|
||||
<el-form-item label="FAQ 问答">
|
||||
<div class="faq-container">
|
||||
<div v-for="(faq, index) in form.faqs" :key="index" class="faq-item">
|
||||
@@ -175,11 +176,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
<el-form-item :label="`问题 ${index + 1}`" :prop="`faqs.${index}.question`">
|
||||
<el-input
|
||||
v-model="faq.question"
|
||||
placeholder="请输入问题"
|
||||
clearable
|
||||
/>
|
||||
<el-input v-model="faq.question" placeholder="请输入问题" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="`答案 ${index + 1}`" :prop="`faqs.${index}.answer`">
|
||||
<el-input
|
||||
@@ -190,12 +187,10 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-button type="primary" @click="addFaq" :icon="Plus">
|
||||
添加问答
|
||||
</el-button>
|
||||
<el-button type="primary" @click="addFaq" :icon="Plus"> 添加问答 </el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
</ElCol> -->
|
||||
</ElRow>
|
||||
|
||||
<div style="text-align: center">
|
||||
@@ -260,7 +255,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, computed } from 'vue'
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import {
|
||||
ElMessage,
|
||||
ElLoading,
|
||||
@@ -626,6 +621,8 @@
|
||||
const res = await manageService.publishAddpro(payload)
|
||||
const msg = (res as any)?.message || (res as any)?.data?.message || '提交成功'
|
||||
ElMessage.success(msg)
|
||||
// 清除 sessionStorage 中的抓取数据
|
||||
sessionStorage.removeItem('fetchFormData')
|
||||
window.location.href = '/admin/publish/publish_my_listpro'
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error?.message || '提交失败,请稍后重试')
|
||||
@@ -634,6 +631,54 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 从 sessionStorage 读取抓取数据并填充表单
|
||||
onMounted(() => {
|
||||
const fetchFormData = sessionStorage.getItem('fetchFormData')
|
||||
if (fetchFormData) {
|
||||
try {
|
||||
const data = JSON.parse(fetchFormData)
|
||||
|
||||
// 填充基本字段
|
||||
form.product_name = data.product_name || ''
|
||||
form.price = data.price || ''
|
||||
form.source_place = data.source_place || ''
|
||||
form.plate_time = data.plate_time || ''
|
||||
form.displacement = data.displacement || ''
|
||||
form.power = data.power || ''
|
||||
form.body_color = data.body_color || ''
|
||||
form.condition_desc = data.condition_desc || ''
|
||||
form.mileage = data.mileage || ''
|
||||
|
||||
// 填充绑定相关字段(从抓取数据中获取)
|
||||
form.crawl_title = data.crawl_title || ''
|
||||
form.crawl_brand = data.crawl_brand || ''
|
||||
form.crawl_series = data.crawl_series || ''
|
||||
form.crawl_year = data.crawl_year || ''
|
||||
form.crawl_msrp = data.crawl_msrp || ''
|
||||
form.crawl_car_id = data.crawl_car_id || ''
|
||||
form.crawl_brand_id = data.crawl_brand_id || ''
|
||||
form.crawl_series_id = data.crawl_series_id || ''
|
||||
|
||||
// 处理图片字段(可能是 image, images, image_pull, images_pull)
|
||||
const imageList = data.images || data.image || data.images_pull || data.image_pull || []
|
||||
if (Array.isArray(imageList) && imageList.length > 0) {
|
||||
form.images = imageList
|
||||
imageFileList.value = imageList.map((url: string, idx: number) => ({
|
||||
name: `image_${idx}`,
|
||||
url,
|
||||
status: 'success' as const,
|
||||
uid: idx,
|
||||
response: { file_url: url, file_name: url }
|
||||
}))
|
||||
}
|
||||
|
||||
ElMessage.success('已加载抓取数据')
|
||||
} catch (error) {
|
||||
console.error('解析抓取数据失败:', error)
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -11,14 +11,17 @@
|
||||
<el-option label="待审核" :value="0" />
|
||||
<el-option label="审核通过" :value="1" />
|
||||
<el-option label="审核拒绝" :value="2" />
|
||||
<el-option label="抓取成功" :value="3" />
|
||||
<el-option label="推送成功" :value="4" />
|
||||
<el-option label="推送失败" :value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxshadow">
|
||||
<!-- <div style="text-align: right; padding: 12px 0">
|
||||
<el-button type="primary" @click="goToAdd"> 新增发布 </el-button>
|
||||
</div> -->
|
||||
<div style="text-align: right; padding: 12px 0">
|
||||
<el-button type="primary" @click="fetchpublishfn"> 抓取 </el-button>
|
||||
</div>
|
||||
<ArtTable
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
@@ -65,7 +68,14 @@
|
||||
<template #default="scope">
|
||||
<ElRow>
|
||||
<el-button link @click="showDialog('detail', scope.row)"> 详情 </el-button>
|
||||
<el-button link type="primary" @click="editFn(scope.row)"> 编辑 </el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="editFn(scope.row)"
|
||||
v-if="scope.row.status === 0 || scope.row.status === 2"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="success" @click="showAuditRecords(scope.row)"> 审核记录 </el-button>
|
||||
<el-button link type="danger" @click="deleteFn(scope.row)"> 删除 </el-button>
|
||||
</ElRow>
|
||||
@@ -110,7 +120,7 @@
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<!-- FAQ 展示 -->
|
||||
<el-descriptions-item label="FAQ 问答" :span="2" v-if="detailData.faqs && detailData.faqs.length">
|
||||
<!-- <el-descriptions-item label="FAQ 问答" :span="2" v-if="detailData.faqs && detailData.faqs.length">
|
||||
<div class="faq-display">
|
||||
<div v-for="(faq, index) in detailData.faqs" :key="index" class="faq-item">
|
||||
<div class="faq-question">
|
||||
@@ -123,7 +133,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions-item> -->
|
||||
<!-- 产品图 -->
|
||||
<el-descriptions-item label="产品图" :span="2">
|
||||
<div
|
||||
@@ -305,14 +315,15 @@
|
||||
<MultiFileUpload
|
||||
v-model="editAttachmentFileList"
|
||||
upload-text="点击上传附件"
|
||||
hint-text="支持多个文件上传"
|
||||
hint-text="仅支持单个文件上传"
|
||||
:max-count="1"
|
||||
:action-image-uplode="uploadActionFile"
|
||||
@change="handleEditAttachmentChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<!-- FAQ 编辑 -->
|
||||
<ElCol :sm="24" :md="24" :lg="24">
|
||||
<!-- <ElCol :sm="24" :md="24" :lg="24">
|
||||
<el-form-item label="FAQ 问答">
|
||||
<div class="faq-container">
|
||||
<div v-for="(faq, index) in editForm.faqs" :key="index" class="faq-item">
|
||||
@@ -344,7 +355,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
</ElCol> -->
|
||||
</ElRow>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
@@ -452,6 +463,97 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 抓取弹窗 -->
|
||||
<el-dialog
|
||||
v-model="fetchDialogVisible"
|
||||
title="抓取数据"
|
||||
width="800px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="fetch-dialog-content">
|
||||
<el-form :model="fetchForm" label-width="70px" style="margin-bottom: 20px; display: flex">
|
||||
<el-form-item label="抓取链接">
|
||||
<el-input
|
||||
v-model="fetchForm.url"
|
||||
placeholder="请输入要抓取的链接"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleFetch" :loading="fetchLoading">抓取</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 抓取结果显示 -->
|
||||
<div v-if="fetchLoading" class="fetch-loading">
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span style="margin-left: 8px">正在抓取中...</span>
|
||||
</div>
|
||||
|
||||
<el-form v-else-if="fetchData" :model="fetchForm" label-width="100px" class="fetch-result-form">
|
||||
<ElRow :gutter="12">
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="产品名称">
|
||||
<el-input v-model="fetchForm.product_name" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="车价(¥)">
|
||||
<el-input v-model="fetchForm.price" placeholder="请输入车价" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="车源地">
|
||||
<el-input v-model="fetchForm.source_place" placeholder="请输入车源地" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="上牌时间">
|
||||
<el-input v-model="fetchForm.plate_time" placeholder="请输入上牌时间" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="排量">
|
||||
<el-input v-model="fetchForm.displacement" placeholder="请输入排量" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="里程(Km)">
|
||||
<el-input v-model="fetchForm.mileage" placeholder="请输入里程" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="马力">
|
||||
<el-input v-model="fetchForm.power" placeholder="请输入马力" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="12" :lg="12">
|
||||
<el-form-item label="车身颜色">
|
||||
<el-input v-model="fetchForm.body_color" placeholder="请输入车身颜色" />
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
<ElCol :sm="24" :md="24" :lg="24">
|
||||
<el-form-item label="车况介绍">
|
||||
<el-input
|
||||
v-model="fetchForm.condition_desc"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入车况介绍"
|
||||
/>
|
||||
</el-form-item>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="fetchDialogVisible = false">关 闭</el-button>
|
||||
<el-button type="primary" @click="handleFetchConfirm" :disabled="!fetchData">确认添加</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 图片预览组件 -->
|
||||
<ElImageViewer
|
||||
v-if="showImageViewer1"
|
||||
@@ -475,11 +577,13 @@
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
ElLoading,
|
||||
ElRow,
|
||||
ElCol,
|
||||
type FormInstance,
|
||||
type FormRules,
|
||||
type UploadFile
|
||||
} from 'element-plus'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { Plus, Loading, User, ArrowRight } from '@element-plus/icons-vue'
|
||||
import { manageService } from '@/api/adminApi'
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
@@ -545,7 +649,8 @@
|
||||
body_color: string
|
||||
condition_desc: string
|
||||
mileage: string
|
||||
images: string[]
|
||||
images: string[] // 用于显示(images_pull)
|
||||
original_images: string[] // 用于保存提交(原始 images)
|
||||
intro_video: string[]
|
||||
attachment: { name: string; src: string }[]
|
||||
faqs: FAQItem[]
|
||||
@@ -571,6 +676,7 @@
|
||||
condition_desc: '',
|
||||
mileage: '',
|
||||
images: [],
|
||||
original_images: [],
|
||||
intro_video: [],
|
||||
attachment: [],
|
||||
faqs: [{ question: '', answer: '' }],
|
||||
@@ -647,9 +753,14 @@
|
||||
const showImageViewer1 = ref(false)
|
||||
const viewerIndex = ref(0)
|
||||
const currentPdfFiles = ref('')
|
||||
const imgList = computed(() =>
|
||||
parsePreviewList(detailData.value?.images_pull || detailData.value?.images || [])
|
||||
)
|
||||
const fetchImgList = ref<string[]>([])
|
||||
const imgList = computed(() => {
|
||||
// 如果抓取弹窗打开且有图片,显示抓取的图片
|
||||
if (fetchDialogVisible.value && fetchImgList.value.length > 0) {
|
||||
return fetchImgList.value
|
||||
}
|
||||
return parsePreviewList(detailData.value?.images_pull || detailData.value?.images || [])
|
||||
})
|
||||
|
||||
const handleAvatarClick1 = (index: string) => {
|
||||
if (index !== null && index !== undefined) {
|
||||
@@ -688,7 +799,10 @@
|
||||
const statusMap: Record<number, string> = {
|
||||
0: '待审核',
|
||||
1: '审核通过',
|
||||
2: '审核拒绝'
|
||||
2: '审核拒绝',
|
||||
3: '推送中',
|
||||
4: '推送成功',
|
||||
5: '推送失败'
|
||||
}
|
||||
return statusMap[status] || '未知'
|
||||
}
|
||||
@@ -697,7 +811,10 @@
|
||||
const colorMap: Record<number, 'success' | 'warning' | 'danger' | 'info'> = {
|
||||
0: 'warning',
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
2: 'danger',
|
||||
3: 'info',
|
||||
4: 'success',
|
||||
5: 'danger'
|
||||
}
|
||||
return colorMap[status] || 'info'
|
||||
}
|
||||
@@ -709,7 +826,10 @@
|
||||
const colorMap: Record<number, 'success' | 'warning' | 'danger' | 'info'> = {
|
||||
0: 'warning',
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
2: 'danger',
|
||||
3: 'info',
|
||||
4: 'success',
|
||||
5: 'danger'
|
||||
}
|
||||
return colorMap[status] || 'info'
|
||||
}
|
||||
@@ -792,15 +912,19 @@
|
||||
editForm.condition_desc = res.condition_desc || ''
|
||||
editForm.mileage = res.mileage || ''
|
||||
|
||||
// 处理图片
|
||||
const images = parsePreviewList(res.images_pull || res.images || [])
|
||||
editForm.images = images
|
||||
editImageFileList.value = images.map((url, idx) => ({
|
||||
// 处理图片:images_pull 用于显示,images 用于保存
|
||||
const displayImages = parsePreviewList(res.images_pull || res.images || [])
|
||||
const saveImages = parsePreviewList(res.images || [])
|
||||
|
||||
editForm.images = displayImages // 用于显示
|
||||
editForm.original_images = saveImages // 用于保存提交
|
||||
|
||||
editImageFileList.value = displayImages.map((url, idx) => ({
|
||||
name: `image_${idx}`,
|
||||
url,
|
||||
status: 'success' as const,
|
||||
uid: idx,
|
||||
response: { file_url: url, file_name: url }
|
||||
response: { file_url: url, file_name: saveImages[idx] || url }
|
||||
}))
|
||||
|
||||
// 处理视频
|
||||
@@ -965,6 +1089,7 @@
|
||||
|
||||
if (fileName && !editForm.images.includes(fileName)) {
|
||||
editForm.images.push(fileName)
|
||||
editForm.original_images.push(fileName)
|
||||
}
|
||||
editImageFileList.value = fileList as UploadFileWithResponse[]
|
||||
loadingInstance.value?.close()
|
||||
@@ -975,7 +1100,10 @@
|
||||
const fileName = resp?.file_name || resp?.data?.file_name || ''
|
||||
if (fileName) {
|
||||
const idx = editForm.images.indexOf(fileName)
|
||||
if (idx > -1) editForm.images.splice(idx, 1)
|
||||
if (idx > -1) {
|
||||
editForm.images.splice(idx, 1)
|
||||
editForm.original_images.splice(idx, 1)
|
||||
}
|
||||
}
|
||||
editImageFileList.value = fileList as UploadFileWithResponse[]
|
||||
}
|
||||
@@ -1076,7 +1204,7 @@
|
||||
body_color: editForm.body_color,
|
||||
condition_desc: editForm.condition_desc,
|
||||
mileage: editForm.mileage,
|
||||
images: editForm.images.map((s) => String(s || '').trim()).filter(Boolean).join(','),
|
||||
images: editForm.original_images.map((s) => String(s || '').trim()).filter(Boolean).join(','),
|
||||
intro_video: editForm.intro_video.map((s) => String(s || '').trim()).filter(Boolean).join(','),
|
||||
attachment: editForm.attachment,
|
||||
faqs: validFaqs.length > 0 ? validFaqs : undefined,
|
||||
@@ -1179,6 +1307,129 @@
|
||||
getWorkList()
|
||||
}
|
||||
|
||||
// 抓取相关
|
||||
const fetchDialogVisible = ref(false)
|
||||
const fetchForm = reactive({
|
||||
url: '',
|
||||
product_name: '',
|
||||
price: '',
|
||||
source_place: '',
|
||||
plate_time: '',
|
||||
displacement: '',
|
||||
power: '',
|
||||
body_color: '',
|
||||
condition_desc: '',
|
||||
mileage: ''
|
||||
})
|
||||
const fetchLoading = ref(false)
|
||||
const fetchData = ref<any>(null)
|
||||
|
||||
// 打开抓取弹窗
|
||||
const fetchpublishfn = () => {
|
||||
fetchDialogVisible.value = true
|
||||
fetchForm.url = ''
|
||||
fetchForm.product_name = ''
|
||||
fetchForm.price = ''
|
||||
fetchForm.source_place = ''
|
||||
fetchForm.plate_time = ''
|
||||
fetchForm.displacement = ''
|
||||
fetchForm.power = ''
|
||||
fetchForm.body_color = ''
|
||||
fetchForm.condition_desc = ''
|
||||
fetchForm.mileage = ''
|
||||
fetchData.value = null
|
||||
fetchImgList.value = []
|
||||
}
|
||||
|
||||
// 执行抓取
|
||||
const handleFetch = async () => {
|
||||
if (!fetchForm.url || !fetchForm.url.trim()) {
|
||||
ElMessage.warning('请输入抓取链接')
|
||||
return
|
||||
}
|
||||
|
||||
fetchLoading.value = true
|
||||
fetchData.value = null
|
||||
|
||||
try {
|
||||
const res: any = await request.post({
|
||||
url: '/common/usedcardetail/crawl',
|
||||
params: { url: fetchForm.url.trim() }
|
||||
})
|
||||
fetchData.value = res?.data || res || {}
|
||||
|
||||
// 填充表单数据
|
||||
fetchForm.product_name = fetchData.value.product_name || ''
|
||||
fetchForm.price = fetchData.value.price || ''
|
||||
fetchForm.source_place = fetchData.value.source_place || ''
|
||||
fetchForm.plate_time = fetchData.value.plate_time || ''
|
||||
fetchForm.displacement = fetchData.value.displacement || ''
|
||||
fetchForm.power = fetchData.value.power || ''
|
||||
fetchForm.body_color = fetchData.value.body_color || ''
|
||||
fetchForm.condition_desc = fetchData.value.condition_desc || ''
|
||||
fetchForm.mileage = fetchData.value.mileage || ''
|
||||
|
||||
// 处理图片列表用于预览
|
||||
fetchImgList.value = parsePreviewList(fetchData.value.image_pull || fetchData.value.image || [])
|
||||
ElMessage.success(res?.message || '抓取成功')
|
||||
console.log('抓取接口返回数据:', fetchData.value)
|
||||
} catch (error: any) {
|
||||
console.error('抓取失败:', error)
|
||||
fetchData.value = null
|
||||
ElMessage.error(error?.message || '抓取失败,请稍后重试')
|
||||
} finally {
|
||||
fetchLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 确认添加抓取的数据
|
||||
// 确认添加抓取的数据
|
||||
const handleFetchConfirm = async () => {
|
||||
// 合并抓取接口返回的原始数据和用户修改的数据
|
||||
const formData = {
|
||||
...fetchData.value, // 保存所有抓取接口返回的原始数据
|
||||
// 用表单中修改的值替换对应字段
|
||||
product_name: fetchForm.product_name,
|
||||
price: fetchForm.price,
|
||||
source_place: fetchForm.source_place,
|
||||
plate_time: fetchForm.plate_time,
|
||||
displacement: fetchForm.displacement,
|
||||
power: fetchForm.power,
|
||||
body_color: fetchForm.body_color,
|
||||
condition_desc: fetchForm.condition_desc,
|
||||
mileage: fetchForm.mileage
|
||||
}
|
||||
console.log('保存抓取数据:', formData)
|
||||
|
||||
try {
|
||||
const res: any = await request.post({
|
||||
url: '/common/usedcardetail/crawl/store',
|
||||
params: formData
|
||||
})
|
||||
ElMessage.success(res?.message)
|
||||
fetchDialogVisible.value = false
|
||||
getWorkList() // 刷新列表
|
||||
} catch (error: any) {
|
||||
console.error('保存抓取数据失败:', error)
|
||||
ElMessage.error(error?.message || '保存失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 抓取图片预览点击
|
||||
const handleFetchAvatarClick = (index: number) => {
|
||||
viewerIndex.value = index
|
||||
showImageViewer.value = true
|
||||
}
|
||||
|
||||
// 格式化年月(如:2024年01月 -> 2024-01-01)
|
||||
function formatCnYearMonth(str: string) {
|
||||
const match = str.match(/(\d{4})年(\d{1,2})月/)
|
||||
if (!match) return str
|
||||
const year = match[1]
|
||||
const month = match[2].padStart(2, '0')
|
||||
return `${year}-${month}-01`
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getWorkList()
|
||||
})
|
||||
@@ -1470,4 +1721,35 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 抓取弹窗样式
|
||||
.fetch-dialog-content {
|
||||
.fetch-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 0;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.fetch-result {
|
||||
.thumb-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.avatarimg {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
&:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
|
||||
// 角色设置辅助函数
|
||||
const getRoles = (role: number, role_wp: number | null) => {
|
||||
const roles: string[] = []
|
||||
|
||||
// 基础角色
|
||||
const baseRole = role == 1 ? 'business' : role == 2 ? 'procurement' : 'alls'
|
||||
const roles = [baseRole]
|
||||
if (role == 1) {
|
||||
roles.push('business')
|
||||
} else if (role == 2) {
|
||||
roles.push('procurement')
|
||||
}
|
||||
|
||||
// 根据 role_wp 添加额外角色
|
||||
if (role_wp == 1) {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<!-- 左侧展示区域 -->
|
||||
<div class="login-left">
|
||||
<div class="logo-section">
|
||||
<h1 style="color: #fff;">USED CAR</h1>
|
||||
<!-- <p>二手车管理系统</p> -->
|
||||
<h1 style="color: #fff">USED CAR</h1>
|
||||
<p>smartcar</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -160,9 +160,14 @@
|
||||
|
||||
// 角色设置辅助函数
|
||||
const getRoles = (role: number, role_wp: number | null) => {
|
||||
const roles: string[] = []
|
||||
|
||||
// 基础角色
|
||||
const baseRole = role == 1 ? 'business' : role == 2 ? 'procurement' : 'alls'
|
||||
const roles = [baseRole]
|
||||
if (role == 1) {
|
||||
roles.push('business')
|
||||
} else if (role == 2) {
|
||||
roles.push('procurement')
|
||||
}
|
||||
|
||||
// 根据 role_wp 添加额外角色
|
||||
if (role_wp == 1) {
|
||||
|
||||
Reference in New Issue
Block a user