updata
This commit is contained in:
parent
aed78e2989
commit
9914bb723d
@ -103,6 +103,15 @@ export const constantRoutes = [
|
||||
title: "用", fullPath: "/h5HomePage/use",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "details",
|
||||
title: '产品详情',
|
||||
component: () => import('@/views/H5/details/index.vue'),
|
||||
meta: {
|
||||
title: "产品详情", fullPath: "/h5HomePage/details",
|
||||
},
|
||||
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -61,10 +61,14 @@
|
||||
<div class="item-desc">
|
||||
智算
|
||||
</div>
|
||||
<!-- 立即咨询 -->
|
||||
<!-- 立即咨询和查看详情 -->
|
||||
<div class="item-btn">
|
||||
<div class="btn" @click="openConsultDialog(product, thrMenu)">
|
||||
<!-- <div class="btn" @click="openConsultDialog(product, thrMenu)">
|
||||
立即咨询
|
||||
</div> -->
|
||||
<!-- 查看详情 带着id跳转/h5HomePage/details -->
|
||||
<div class="btn" @click="goToDetail(product.id)">
|
||||
查看详情
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -159,6 +163,17 @@ export default {
|
||||
this.activeSupplierIndex = index
|
||||
},
|
||||
|
||||
// 跳转到详情页
|
||||
goToDetail(productId) {
|
||||
// 使用路由跳转到详情页,携带productId作为参数
|
||||
this.$router.push({
|
||||
path: '/h5HomePage/details',
|
||||
query: {
|
||||
id: productId
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 打开咨询弹窗
|
||||
openConsultDialog(product, category) {
|
||||
this.currentProduct = product
|
||||
|
||||
16
f/web-kboss/src/views/H5/details/index.vue
Normal file
16
f/web-kboss/src/views/H5/details/index.vue
Normal file
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
详情页
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
@ -279,7 +279,6 @@
|
||||
max-width: 12.8rem;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
/* 顶部信息区域 */
|
||||
.footer-top {
|
||||
@ -352,7 +351,7 @@
|
||||
gap: 0.16rem;
|
||||
}
|
||||
}
|
||||
.footer-center .contact-item .phone-link {
|
||||
.footer-center .contact-item 下 .phone-link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s;
|
||||
@ -360,7 +359,7 @@
|
||||
font-size: 0.208rem;
|
||||
/* 增大30%: 0.16rem * 1.3 = 0.208rem */
|
||||
}
|
||||
.footer-center .contact-item .phone-link:hover {
|
||||
.footer-center .contact-item 下 .phone-link:hover {
|
||||
color: #275AFF;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@
|
||||
max-width: 12.8rem;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
// z-index: 1;
|
||||
}
|
||||
|
||||
/* 顶部信息区域 */
|
||||
@ -368,10 +368,7 @@
|
||||
align-items: center;
|
||||
gap: 0.16rem;
|
||||
}
|
||||
}
|
||||
.center{
|
||||
// display: flex;
|
||||
}
|
||||
}下
|
||||
.phone-link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
|
||||
@ -140,13 +140,14 @@
|
||||
<div class="footer">
|
||||
<div class="footer-content">
|
||||
<!-- 顶部信息 -->
|
||||
|
||||
<div class="footer-center">
|
||||
<div class="footer-top">
|
||||
<div class="logo-footer">
|
||||
<img :src="logoImg" alt="公司logo" v-if="logoImg">
|
||||
<!-- <img src="@/assets/kyy/LOGO.png" alt="公司logo" class="img"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-center">
|
||||
<div class="center">
|
||||
<div class="contact-item">
|
||||
<i class="iconfont icon-dizhi"></i>
|
||||
@ -461,3 +462,5 @@ body {
|
||||
<style lang="less" scoped>
|
||||
@import url('../less/official/index.less');
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
<!-- 产品列表表格 -->
|
||||
<div class="product-table">
|
||||
<el-table :data="tableData" style="width: 100%" empty-text="暂无数据" @row-click="handleRowClick">
|
||||
<el-table :data="sortedTableData" style="width: 100%" empty-text="暂无数据" @row-click="handleRowClick">
|
||||
<el-table-column label="产品服务名称" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<div class="product-info">
|
||||
@ -88,7 +88,7 @@
|
||||
{{ scope.row.product_group || '--' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort_order" label="排序" min-width="80">
|
||||
<el-table-column prop="sort_order" label="排序" min-width="80" sortable>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="180">
|
||||
<template slot-scope="scope">
|
||||
@ -155,8 +155,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 已保存的优势列表 -->
|
||||
<div class="saved-list" v-if="advantageList.length > 0">
|
||||
<div class="list-item" v-for="(item, index) in advantageList" :key="item.id">
|
||||
<div class="saved-list" v-if="sortedAdvantageList.length > 0">
|
||||
<div class="list-item" v-for="(item, index) in sortedAdvantageList" :key="item.id">
|
||||
<div class="item-header">
|
||||
<div class="item-title">已保存优势 #{{ index + 1 }}</div>
|
||||
<div class="item-actions">
|
||||
@ -169,6 +169,7 @@
|
||||
<img :src="item.img" alt="优势图片" style="max-width: 100px; max-height: 100px;">
|
||||
</div>
|
||||
<div class="item-details">
|
||||
<div><strong>排序:</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }}位)</div>
|
||||
<div><strong>标题:</strong>{{ item.title }}</div>
|
||||
<div><strong>描述:</strong>{{ item.description }}</div>
|
||||
</div>
|
||||
@ -180,10 +181,18 @@
|
||||
<div class="form-list">
|
||||
<div class="form-item" v-for="(form, index) in advantageForms" :key="'advantage_form_' + index">
|
||||
<div class="form-title">
|
||||
产品优势 #{{ advantageList.length + index + 1 }}
|
||||
产品优势 #{{ sortedAdvantageList.length + index + 1 }}
|
||||
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
|
||||
</div>
|
||||
<el-form :model="form" :rules="contentRules" :ref="'advantageForm' + index" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
|
||||
@change="validateSortOrder('advantage')">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ form.sort_order }}将排在第{{ form.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="img">
|
||||
<el-input v-model="form.img" placeholder="请输入图片链接"></el-input>
|
||||
</el-form-item>
|
||||
@ -210,8 +219,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 已保存的功能列表 -->
|
||||
<div class="saved-list" v-if="featureList.length > 0">
|
||||
<div class="list-item" v-for="(item, index) in featureList" :key="item.id">
|
||||
<div class="saved-list" v-if="sortedFeatureList.length > 0">
|
||||
<div class="list-item" v-for="(item, index) in sortedFeatureList" :key="item.id">
|
||||
<div class="item-header">
|
||||
<div class="item-title">已保存功能 #{{ index + 1 }}</div>
|
||||
<div class="item-actions">
|
||||
@ -221,6 +230,7 @@
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<div class="item-details">
|
||||
<div><strong>排序:</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }}位)</div>
|
||||
<div><strong>标题:</strong>{{ item.title }}</div>
|
||||
<div><strong>描述:</strong>{{ item.description }}</div>
|
||||
</div>
|
||||
@ -232,10 +242,18 @@
|
||||
<div class="form-list">
|
||||
<div class="form-item" v-for="(form, index) in featureForms" :key="'feature_form_' + index">
|
||||
<div class="form-title">
|
||||
产品功能 #{{ featureList.length + index + 1 }}
|
||||
产品功能 #{{ sortedFeatureList.length + index + 1 }}
|
||||
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
|
||||
</div>
|
||||
<el-form :model="form" :rules="contentRules" :ref="'featureForm' + index" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
|
||||
@change="validateSortOrder('feature')">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ form.sort_order }}将排在第{{ form.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
|
||||
</el-form-item>
|
||||
@ -259,8 +277,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 已保存的应用列表 -->
|
||||
<div class="saved-list" v-if="applicationMainList.length > 0">
|
||||
<div class="list-item main-item" v-for="(item, index) in applicationMainList" :key="item.id">
|
||||
<div class="saved-list" v-if="sortedApplicationMainList.length > 0">
|
||||
<div class="list-item main-item" v-for="(item, index) in sortedApplicationMainList" :key="item.id">
|
||||
<div class="item-header">
|
||||
<div class="item-title">已保存应用主项 #{{ index + 1 }}</div>
|
||||
<div class="item-actions">
|
||||
@ -270,6 +288,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<div><strong>排序:</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }}位)</div>
|
||||
<div v-if="item.img" class="item-image">
|
||||
<img :src="item.img" alt="应用图片" style="max-width: 100px; max-height: 100px;">
|
||||
</div>
|
||||
@ -281,9 +300,10 @@
|
||||
<!-- 详情项列表 -->
|
||||
<div class="detail-section" v-if="item.subItems && item.subItems.length > 0">
|
||||
<div class="detail-list">
|
||||
<div class="detail-item" v-for="(detail, detailIndex) in item.subItems" :key="detail.id">
|
||||
<div class="detail-item" v-for="(detail, detailIndex) in sortedApplicationDetails(item.subItems)" :key="detail.id">
|
||||
<div class="detail-title">详情项 #{{ detailIndex + 1 }}</div>
|
||||
<div class="detail-content">
|
||||
<div><strong>排序:</strong>{{ detail.sort_order || 1 }} (排在第{{ detail.sort_order || 1 }}位)</div>
|
||||
<div><strong>标题:</strong>{{ detail.title }}</div>
|
||||
<div><strong>描述:</strong>{{ detail.description }}</div>
|
||||
</div>
|
||||
@ -303,6 +323,13 @@
|
||||
<span v-if="detailForm.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
|
||||
</div>
|
||||
<el-form :model="detailForm" :rules="contentRules" :ref="'appDetailForm_' + item.id + '_' + detailIndex" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="detailForm.sort_order" :min="1" :max="100" :step="1">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ detailForm.sort_order }}将排在第{{ detailForm.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="detailForm.title" placeholder="请输入详情标题"></el-input>
|
||||
</el-form-item>
|
||||
@ -325,10 +352,18 @@
|
||||
<div class="form-list">
|
||||
<div class="form-item main-form-item" v-for="(form, index) in applicationForms" :key="'application_form_' + index">
|
||||
<div class="form-title">
|
||||
应用主项 #{{ applicationMainList.length + index + 1 }}
|
||||
应用主项 #{{ sortedApplicationMainList.length + index + 1 }}
|
||||
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
|
||||
</div>
|
||||
<el-form :model="form" :rules="contentRules" :ref="'applicationForm' + index" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
|
||||
@change="validateSortOrder('application')">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ form.sort_order }}将排在第{{ form.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
|
||||
</el-form-item>
|
||||
@ -349,6 +384,13 @@
|
||||
<span v-if="detailForm.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
|
||||
</div>
|
||||
<el-form :model="detailForm" :rules="contentRules" :ref="'newDetailForm_' + index + '_' + detailIndex" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="detailForm.sort_order" :min="1" :max="100" :step="1">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ detailForm.sort_order }}将排在第{{ detailForm.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="detailForm.title" placeholder="请输入详情标题"></el-input>
|
||||
</el-form-item>
|
||||
@ -379,6 +421,13 @@
|
||||
<div class="main-product-form">
|
||||
<div class="form-title">产品主信息</div>
|
||||
<el-form :model="productIntroForm" :rules="contentRules" ref="productIntroForm" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="productIntroForm.sort_order" :min="1" :max="100" :step="1">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ productIntroForm.sort_order }}将排在第{{ productIntroForm.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="productIntroForm.title" placeholder="请输入标题"></el-input>
|
||||
</el-form-item>
|
||||
@ -405,8 +454,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 已保存的规格列表 -->
|
||||
<div class="saved-list" v-if="productSpecList.length > 0">
|
||||
<div class="list-item" v-for="(item, index) in productSpecList" :key="item.id">
|
||||
<div class="saved-list" v-if="sortedProductSpecList.length > 0">
|
||||
<div class="list-item" v-for="(item, index) in sortedProductSpecList" :key="item.id">
|
||||
<div class="item-header">
|
||||
<div class="item-title">已保存规格 #{{ index + 1 }}</div>
|
||||
<div class="item-actions">
|
||||
@ -415,6 +464,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<div><strong>排序:</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }}位)</div>
|
||||
<div v-if="item.icon" class="item-image">
|
||||
<img :src="item.icon" alt="规格图标" style="max-width: 30px; max-height: 30px;">
|
||||
</div>
|
||||
@ -430,10 +480,18 @@
|
||||
<div class="form-list">
|
||||
<div class="form-item" v-for="(form, index) in productSpecForms" :key="'spec_form_' + index">
|
||||
<div class="form-title">
|
||||
产品规格 #{{ productSpecList.length + index + 1 }}
|
||||
产品规格 #{{ sortedProductSpecList.length + index + 1 }}
|
||||
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
|
||||
</div>
|
||||
<el-form :model="form" :rules="contentRules" :ref="'specForm' + index" label-width="120px">
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
|
||||
@change="validateSortOrder('product_spec')">
|
||||
</el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ form.sort_order }}将排在第{{ form.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
@ -470,7 +528,10 @@
|
||||
<el-input v-model="menuDialog.form.title" placeholder="请输入菜单标题"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="menuDialog.form.sort_order" :min="1" :max="100"></el-input-number>
|
||||
<el-input-number v-model="menuDialog.form.sort_order" :min="0" :max="100"></el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ menuDialog.form.sort_order }}将排在第{{ menuDialog.form.sort_order+1 }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@ -505,6 +566,9 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort_order">
|
||||
<el-input-number v-model="productDialog.form.sort_order" :min="1" :max="100"></el-input-number>
|
||||
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
|
||||
(值为{{ productDialog.form.sort_order }}将排在第{{ productDialog.form.sort_order }}位)
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@ -555,7 +619,8 @@ export default {
|
||||
pre_price: '',
|
||||
price_unit: '',
|
||||
discount: 0,
|
||||
bg_img_url: ''
|
||||
bg_img_url: '',
|
||||
sort_order: 1
|
||||
},
|
||||
|
||||
// 详情:内容列表数据
|
||||
@ -643,6 +708,9 @@ export default {
|
||||
],
|
||||
bg_img_url: [
|
||||
{ required: true, message: '请输入背景图链接', trigger: 'blur' }
|
||||
],
|
||||
sort_order: [
|
||||
{ required: true, message: '请输入排序值', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
|
||||
@ -680,6 +748,38 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 按sort_order排序后的表格数据
|
||||
sortedTableData() {
|
||||
return [...this.tableData].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
},
|
||||
// 按sort_order排序后的优势列表
|
||||
sortedAdvantageList() {
|
||||
return [...this.advantageList].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
},
|
||||
// 按sort_order排序后的功能列表
|
||||
sortedFeatureList() {
|
||||
return [...this.featureList].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
},
|
||||
// 按sort_order排序后的应用主项列表
|
||||
sortedApplicationMainList() {
|
||||
return [...this.applicationMainList].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
},
|
||||
// 按sort_order排序后的规格列表
|
||||
sortedProductSpecList() {
|
||||
return [...this.productSpecList].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadMenuTree()
|
||||
},
|
||||
@ -738,7 +838,8 @@ export default {
|
||||
img: item.img,
|
||||
icon: item.icon,
|
||||
menu_product_id: this.selectedProduct.id,
|
||||
content_type: 'advantage'
|
||||
content_type: 'advantage',
|
||||
sort_order: item.sort_order || 1
|
||||
}))
|
||||
console.log('优势数据回显成功:', this.advantageList)
|
||||
} else {
|
||||
@ -754,7 +855,8 @@ export default {
|
||||
img: item.img,
|
||||
icon: item.icon,
|
||||
menu_product_id: this.selectedProduct.id,
|
||||
content_type: 'feature'
|
||||
content_type: 'feature',
|
||||
sort_order: item.sort_order || 1
|
||||
}))
|
||||
console.log('功能数据回显成功:', this.featureList)
|
||||
} else {
|
||||
@ -776,7 +878,8 @@ export default {
|
||||
icon: app.icon,
|
||||
menu_product_id: this.selectedProduct.id,
|
||||
content_type: 'application',
|
||||
description: app.description || ''
|
||||
description: app.description || '',
|
||||
sort_order: app.sort_order || 1
|
||||
}
|
||||
|
||||
// 如果有provide字段,转换为subItems
|
||||
@ -788,7 +891,8 @@ export default {
|
||||
description: provideItem.description,
|
||||
parent_id: app.id,
|
||||
menu_product_id: this.selectedProduct.id,
|
||||
content_type: 'application'
|
||||
content_type: 'application',
|
||||
sort_order: provideItem.sort_order || 1
|
||||
}))
|
||||
} else {
|
||||
mainItem.subItems = []
|
||||
@ -818,7 +922,8 @@ export default {
|
||||
pre_price: productData.pre_price || '',
|
||||
price_unit: productData.price_unit || '',
|
||||
discount: productData.discount || 0,
|
||||
bg_img_url: productData.bg_img_url || ''
|
||||
bg_img_url: productData.bg_img_url || '',
|
||||
sort_order: productData.sort_order || 1
|
||||
}
|
||||
|
||||
console.log('产品主信息回显成功:', this.productIntroForm)
|
||||
@ -832,7 +937,8 @@ export default {
|
||||
icon: item.icon,
|
||||
menu_product_id: this.selectedProduct.id,
|
||||
content_type: 'product',
|
||||
parent_id: productData.id
|
||||
parent_id: productData.id,
|
||||
sort_order: item.sort_order || 1
|
||||
}))
|
||||
console.log('规格数据回显成功:', this.productSpecList)
|
||||
} else {
|
||||
@ -843,7 +949,8 @@ export default {
|
||||
this.productIntroForm = {
|
||||
...this.productIntroForm,
|
||||
title: data.title || '',
|
||||
description: data.description || ''
|
||||
description: data.description || '',
|
||||
sort_order: 1
|
||||
}
|
||||
this.productSpecList = []
|
||||
}
|
||||
@ -870,7 +977,8 @@ export default {
|
||||
const baseForm = {
|
||||
menu_product_id: this.selectedProduct ? this.selectedProduct.id : '',
|
||||
content_type: this.getContentTypeForAPI(type),
|
||||
id: ''
|
||||
id: '',
|
||||
sort_order: 1 // 默认排序值为1
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
@ -964,7 +1072,8 @@ export default {
|
||||
content_type: 'application',
|
||||
parent_id: parentId.toString().startsWith('new_') ? '' : parentId,
|
||||
title: '',
|
||||
description: ''
|
||||
description: '',
|
||||
sort_order: 1 // 默认排序值为1
|
||||
}
|
||||
|
||||
this.applicationDetailForms[parentId].push(newDetailForm)
|
||||
@ -995,6 +1104,33 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 验证排序值
|
||||
validateSortOrder(type) {
|
||||
let forms = []
|
||||
switch (type) {
|
||||
case 'advantage':
|
||||
forms = this.advantageForms
|
||||
break
|
||||
case 'feature':
|
||||
forms = this.featureForms
|
||||
break
|
||||
case 'application':
|
||||
forms = this.applicationForms
|
||||
break
|
||||
case 'product_spec':
|
||||
forms = this.productSpecForms
|
||||
break
|
||||
}
|
||||
|
||||
// 检查是否有重复的排序值
|
||||
const sortOrders = forms.map(form => form.sort_order)
|
||||
const duplicates = sortOrders.filter((item, index) => sortOrders.indexOf(item) !== index)
|
||||
|
||||
if (duplicates.length > 0) {
|
||||
this.$message.warning('排序值不能重复,相同的排序值将按照保存顺序排列')
|
||||
}
|
||||
},
|
||||
|
||||
// 编辑已保存的项
|
||||
editSavedItem(item, type) {
|
||||
console.log('编辑已保存项:', item, type);
|
||||
@ -1035,7 +1171,8 @@ export default {
|
||||
content_type: 'advantage',
|
||||
img: item.img || '',
|
||||
title: item.title || '',
|
||||
description: item.description || ''
|
||||
description: item.description || '',
|
||||
sort_order: item.sort_order || 1
|
||||
});
|
||||
this.advantageList = this.advantageList.filter(i => i.id !== item.id);
|
||||
break;
|
||||
@ -1046,7 +1183,8 @@ export default {
|
||||
menu_product_id: item.menu_product_id,
|
||||
content_type: 'feature',
|
||||
title: item.title || '',
|
||||
description: item.description || ''
|
||||
description: item.description || '',
|
||||
sort_order: item.sort_order || 1
|
||||
});
|
||||
this.featureList = this.featureList.filter(i => i.id !== item.id);
|
||||
break;
|
||||
@ -1057,7 +1195,8 @@ export default {
|
||||
menu_product_id: item.menu_product_id,
|
||||
content_type: 'application',
|
||||
title: item.title || '',
|
||||
img: item.img || ''
|
||||
img: item.img || '',
|
||||
sort_order: item.sort_order || 1
|
||||
});
|
||||
this.applicationMainList = this.applicationMainList.filter(i => i.id !== item.id);
|
||||
|
||||
@ -1081,7 +1220,8 @@ export default {
|
||||
content_type: 'application',
|
||||
parent_id: detail.parent_id || item.id,
|
||||
title: detail.title || '',
|
||||
description: detail.description || ''
|
||||
description: detail.description || '',
|
||||
sort_order: detail.sort_order || 1
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -1105,7 +1245,8 @@ export default {
|
||||
content_type: 'application',
|
||||
parent_id: item.parent_id || parentItem.id,
|
||||
title: item.title || '',
|
||||
description: item.description || ''
|
||||
description: item.description || '',
|
||||
sort_order: item.sort_order || 1
|
||||
});
|
||||
|
||||
// 从父项的subItems中移除
|
||||
@ -1121,7 +1262,8 @@ export default {
|
||||
parent_id: item.parent_id || '',
|
||||
name: item.name || '',
|
||||
description: item.description || '',
|
||||
icon: item.icon || ''
|
||||
icon: item.icon || '',
|
||||
sort_order: item.sort_order || 1
|
||||
});
|
||||
this.productSpecList = this.productSpecList.filter(i => i.id !== item.id);
|
||||
break;
|
||||
@ -1130,6 +1272,14 @@ export default {
|
||||
this.$message.success('已移动到编辑区域,请修改后点击保存');
|
||||
},
|
||||
|
||||
// 对应用详情进行排序
|
||||
sortedApplicationDetails(subItems) {
|
||||
if (!subItems || !Array.isArray(subItems)) return []
|
||||
return [...subItems].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
},
|
||||
|
||||
// 详情:删除内容项
|
||||
deleteContentItem(id, type) {
|
||||
this.$confirm('确定删除该项吗?', '提示', {
|
||||
@ -1260,6 +1410,11 @@ export default {
|
||||
formData.menu_product_id = this.selectedProduct.id
|
||||
}
|
||||
|
||||
// 确保sort_order有值
|
||||
if (!formData.sort_order) {
|
||||
formData.sort_order = 1
|
||||
}
|
||||
|
||||
formsToSave.push(formData)
|
||||
}
|
||||
|
||||
@ -1314,6 +1469,11 @@ export default {
|
||||
formData.menu_product_id = this.selectedProduct.id
|
||||
}
|
||||
|
||||
// 确保sort_order有值
|
||||
if (!formData.sort_order) {
|
||||
formData.sort_order = 1
|
||||
}
|
||||
|
||||
formsToSave.push(formData)
|
||||
}
|
||||
|
||||
@ -1366,6 +1526,11 @@ export default {
|
||||
formData.menu_product_id = this.selectedProduct.id
|
||||
}
|
||||
|
||||
// 确保sort_order有值
|
||||
if (!formData.sort_order) {
|
||||
formData.sort_order = 1
|
||||
}
|
||||
|
||||
if (formData.id) {
|
||||
// 更新主项
|
||||
const res = await updateProductIntroAPI(formData)
|
||||
@ -1422,6 +1587,11 @@ export default {
|
||||
detailData.menu_product_id = this.selectedProduct.id
|
||||
}
|
||||
|
||||
// 确保sort_order有值
|
||||
if (!detailData.sort_order) {
|
||||
detailData.sort_order = 1
|
||||
}
|
||||
|
||||
if (detailData.id) {
|
||||
const res = await updateProductIntroAPI(detailData)
|
||||
if (res.status !== true) {
|
||||
@ -1461,6 +1631,11 @@ export default {
|
||||
mainData.menu_product_id = this.selectedProduct.id
|
||||
}
|
||||
|
||||
// 确保sort_order有值
|
||||
if (!mainData.sort_order) {
|
||||
mainData.sort_order = 1
|
||||
}
|
||||
|
||||
let mainId = mainData.id
|
||||
|
||||
if (mainData.id) {
|
||||
@ -1492,6 +1667,11 @@ export default {
|
||||
formData.menu_product_id = this.selectedProduct.id
|
||||
}
|
||||
|
||||
// 确保sort_order有值
|
||||
if (!formData.sort_order) {
|
||||
formData.sort_order = 1
|
||||
}
|
||||
|
||||
if (formData.id) {
|
||||
const res = await updateProductIntroAPI(formData)
|
||||
if (res.status !== true) {
|
||||
@ -1524,28 +1704,47 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 构建菜单树 - 适配新的数据结构
|
||||
// 构建菜单树 - 适配新的数据结构,并按照sort_order排序
|
||||
buildMenuTree(menus) {
|
||||
const transformedData = menus.map(level1 => ({
|
||||
// 首先对一级菜单排序
|
||||
const sortedLevel1 = [...menus].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
|
||||
const transformedData = sortedLevel1.map(level1 => {
|
||||
// 对二级菜单排序
|
||||
const sortedLevel2 = [...(level1.secMenu || [])].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
|
||||
return {
|
||||
id: level1.id,
|
||||
title: level1.firTitle,
|
||||
menu_level: 1,
|
||||
sort_order: level1.sort_order || 1,
|
||||
children: (level1.secMenu || []).map(level2 => ({
|
||||
children: sortedLevel2.map(level2 => {
|
||||
// 对三级菜单排序
|
||||
const sortedLevel3 = [...(level2.thrMenu || [])].sort((a, b) => {
|
||||
return (a.sort_order || 999) - (b.sort_order || 999)
|
||||
})
|
||||
|
||||
return {
|
||||
id: level2.id,
|
||||
title: level2.secTitle,
|
||||
menu_level: 2,
|
||||
parent_id: level1.id,
|
||||
sort_order: level2.sort_order || 1,
|
||||
children: (level2.thrMenu || []).map(level3 => ({
|
||||
children: sortedLevel3.map(level3 => ({
|
||||
id: level3.id,
|
||||
title: level3.thrTitle,
|
||||
menu_level: 3,
|
||||
parent_id: level2.id,
|
||||
sort_order: level3.sort_order || 1
|
||||
}))
|
||||
}))
|
||||
}))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return transformedData
|
||||
},
|
||||
@ -1707,7 +1906,7 @@ export default {
|
||||
this.menuDialog.form = {
|
||||
id: '',
|
||||
title: '',
|
||||
sort_order: 1,
|
||||
sort_order: 0,
|
||||
menu_level: data.menu_level + 1,
|
||||
parent_id: data.id
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user