|
@@ -7,14 +7,14 @@
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">通栏名称</div>
|
|
|
- <el-input v-model="plateName" clearable placeholder="请输入通栏名称"></el-input>
|
|
|
+ <el-input v-model="apiData.sector_name" clearable placeholder="请输入通栏名称"></el-input>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">模板风格</div>
|
|
|
- <el-select v-model="templateStyle" clearable placeholder="请选择模板风格">
|
|
|
- <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
|
|
|
+ <el-select v-model="apiData.template_class_id" clearable placeholder="请选择模板风格" @change="getSkinList">
|
|
|
+ <el-option v-for="item in class_options" :key="item.class_id" :label="item.name" :value="item.class_id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
@@ -22,7 +22,11 @@
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">所属皮肤</div>
|
|
|
- <el-input v-model="plateName" clearable placeholder="请输入皮肤名称"></el-input>
|
|
|
+ <el-select v-model="apiData.template_id" clearable placeholder="请选择所属皮肤">
|
|
|
+ <el-option v-for="item in template_options" :key="item.template_id" :label="item.template_name" :value="item.template_id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="6" class="right">
|
|
@@ -37,9 +41,9 @@
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">尺寸</div>
|
|
|
<div class="sizeBox">
|
|
|
- <div class="sizeInput"><el-input v-model="plateName" clearable placeholder="宽"></el-input> </div>
|
|
|
+ <div class="sizeInput"><el-input v-model="apiData.width" clearable placeholder="宽"></el-input> </div>
|
|
|
<div class="sizeInputSymbol">*</div>
|
|
|
- <div class="sizeInput"><el-input v-model="plateName" clearable placeholder="高"></el-input></div>
|
|
|
+ <div class="sizeInput"><el-input v-model="apiData.height" clearable placeholder="高"></el-input></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -48,17 +52,16 @@
|
|
|
<!--表格内容 start------------------------------------------------------------>
|
|
|
<div class="layerBox">
|
|
|
<tableTitle :name="tableDivTitle" />
|
|
|
- <button class="btn" @click="addWebsite">添加通栏</button>
|
|
|
+ <button class="btn" @click="addPlate">添加通栏</button>
|
|
|
<el-row>
|
|
|
<template>
|
|
|
- <el-table class="my-table" :data="tableData" style="width: 100%" v-loading="plateLoading">
|
|
|
- <el-table-column fixed prop="id" label="编号" width="90"></el-table-column>
|
|
|
+ <el-table class="my-table" :data="tableData" style="width: 100%" >
|
|
|
+ <el-table-column fixed prop="sector_id" label="编号" width="90"></el-table-column>
|
|
|
<el-table-column prop="sector_name" label="通栏名称" width=""></el-table-column>
|
|
|
<el-table-column prop="sector_size" label="尺寸" width=""></el-table-column>
|
|
|
<el-table-column prop="template_name" label="所属皮肤" width=""></el-table-column>
|
|
|
- <el-table-column prop="template_class_name" label="所属风格" width=""></el-table-column>
|
|
|
- <el-table-column prop="type_page" label="所属页面" width="">
|
|
|
-
|
|
|
+ <el-table-column prop="class_name" label="所属风格" width=""></el-table-column>
|
|
|
+ <el-table-column prop="pagetype" label="所属页面" width="230">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="created_at" label="添加时间" width=""></el-table-column>
|
|
|
<el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
|
|
@@ -95,56 +98,74 @@
|
|
|
<!--表格内容 end------------------------------------------------------------>
|
|
|
|
|
|
<!-- 弹出框 编辑 start----------------------------------------------------------->
|
|
|
- <el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="50%" top="8vh"
|
|
|
- :close-on-click-modal="false">
|
|
|
+ <el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="50%" top="8vh" :close-on-click-modal="false">
|
|
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
|
|
|
<div class="dialogText">
|
|
|
- <el-form-item label="通栏名称:" prop="plateName">
|
|
|
- <el-input v-model="ruleForm.plateName" placeholder="输入通栏名称" disabled></el-input>
|
|
|
+ <el-form-item label="通栏名称:" prop="sectorName">
|
|
|
+ <el-input v-model="ruleForm.sectorName" placeholder="输入通栏名称"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属页面:" prop="plateName">
|
|
|
- <el-select v-model="ruleForm.templateStyle" placeholder="请选择所属页面" :disabled="this.dialogName === '编辑'" @change="changeTemplateStyle">
|
|
|
- <el-option>首页</el-option>
|
|
|
- <el-option>列表</el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属风格:" prop="templateStyle">
|
|
|
- <el-select v-model="ruleForm.templateStyle" placeholder="请选择关联风格名称"
|
|
|
- :disabled="this.dialogName === '编辑'" @change="changeTemplateStyle">
|
|
|
- <el-option v-for="item in options" :key="item.class_id" :label="item.name" :value="item.class_id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="通栏编号:" prop="sectorId">
|
|
|
+ <el-input v-model.number="ruleForm.sectorId" placeholder="输入通栏编号" type="number" min="1"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="风格id:" prop="plateName">
|
|
|
- <el-input v-model="ruleForm.plateName" placeholder="所属风格id" disabled></el-input>
|
|
|
+ <el-form-item label="组件数量:" prop="component_num">
|
|
|
+ <el-input v-model.number="ruleForm.component_num" placeholder="输入组件数量" type="number" min="1" @change="getPlaceList(ruleForm.component_num)">
|
|
|
+
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属皮肤:" prop="templateStyle">
|
|
|
<el-select v-model="ruleForm.templateStyle" placeholder="请选择所属皮肤"
|
|
|
:disabled="this.dialogName === '编辑'" @change="changeTemplateStyle">
|
|
|
- <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
|
|
|
+ <el-option v-for="item in template_options" :key="item.template_id"
|
|
|
+ :label="item.template_name" :value="item.template_id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="皮肤id:" prop="plateName">
|
|
|
- <el-input v-model="ruleForm.plateName" placeholder="所属皮肤id" disabled></el-input>
|
|
|
+ <el-form-item label="皮肤id:" prop="templateStyle">
|
|
|
+ <el-input v-model="ruleForm.templateStyle" placeholder="所属皮肤id"
|
|
|
+ disabled></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="尺寸:" prop="templateStyle">
|
|
|
- <el-select v-model="ruleForm.templateStyle" placeholder="请选择尺寸"
|
|
|
- :disabled="this.dialogName === '编辑'" @change="changeTemplateStyle">
|
|
|
- <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
|
|
|
+ <el-form-item label="尺寸:" prop="sizeList">
|
|
|
+ <el-select v-model="ruleForm.sizeList" placeholder="请选择尺寸" @change="changeTemplateStyle">
|
|
|
+ <el-option v-for="item in size_options" :key="item.id" :label="item.label" :value="item.id">{{item.label}}
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="通栏关键词:" prop="plateName">
|
|
|
- <el-input v-model="ruleForm.plateName" placeholder="输入关键词" disabled></el-input>
|
|
|
+
|
|
|
+ <el-form-item label="通栏类别:" prop="sectorType">
|
|
|
+ <el-select v-model="ruleForm.sectorType" placeholder="请选择所属页面" :disabled="this.dialogName === '编辑'">
|
|
|
+ <!-- 通栏分类:1:资讯类:2:通栏广告类;3:混合类;4:搜索框类;5:导航类;6:头条类;7:轮播图类; -->
|
|
|
+ <el-option :value="1" label="资讯类">资讯类</el-option>
|
|
|
+ <el-option :value="2" label="广告类">广告类</el-option>
|
|
|
+ <el-option :value="3" label="混合类">混合类</el-option>
|
|
|
+ <el-option :value="4" label="搜索框类">搜索框类</el-option>
|
|
|
+ <el-option :value="5" label="导航类">导航类</el-option>
|
|
|
+ <el-option :value="6" label="通栏类">头条类</el-option>
|
|
|
+ <el-option :value="7" label="通栏类">轮播图类</el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="页面类型:" prop="pageType">
|
|
|
<el-checkbox-group v-model="ruleForm.pageType" @change="changeCheckbox"
|
|
|
:disabled="this.dialogName === '编辑'">
|
|
|
- <el-checkbox v-for="(item, index) in checkList" :key="index" :label="item.value">{{
|
|
|
- item.label
|
|
|
- }}</el-checkbox>
|
|
|
+ <el-checkbox v-for="(item, index) in checkList" :key="index" :label="item.value">{{item.label}}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="通栏模版类型:" prop="sectorPlace">
|
|
|
+ <el-select v-model="ruleForm.sectorPlace" placeholder="请选择通栏模版类型" @change="changeTemplateStyle">
|
|
|
+ <el-option v-for="item in sectorPlace_options" :key="item.type" :label="item.component_img" :value="item.type">{{item.component_img}}
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="通栏关键词:" prop="sectorKeyword" class="custom-align-right">
|
|
|
+ <template #label>
|
|
|
+ <span class="askBox">
|
|
|
+ 通栏关键词:
|
|
|
+ <el-tooltip class="item" effect="dark" content="皮肤关键词,如:黑色、卡通、英雄。" placement="top">
|
|
|
+ <i class="el-icon-question"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <tagInput :initialTags="tags" @tags-updated="updateTags"></tagInput>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="通栏缩略图:" prop="image" :label-width="formLabelWidth"
|
|
|
:class="['custom-form-item']" class="custom-align-right">
|
|
@@ -154,9 +175,9 @@
|
|
|
@mouseleave="hovering = false">
|
|
|
<!-- 上传组件 -->
|
|
|
<el-upload class="avatar-uploader" action="#" :show-file-list="false"
|
|
|
- :before-upload="beforeAvatarUpload" :disabled="this.dialogName === '编辑'">
|
|
|
+ :before-upload="beforeAvatarUpload">
|
|
|
<!-- 预览图片 -->
|
|
|
- <img v-if="logoUrl" :src="logoUrl" class="avatar">
|
|
|
+ <img v-if="this.logoUrl" :src="this.logoUrl" class="avatar">
|
|
|
<!-- 上传图标 -->
|
|
|
<div v-else class="chooseImgDiv">
|
|
|
<div>
|
|
@@ -167,8 +188,7 @@
|
|
|
<input type="hidden" name="logo" v-model="ruleForm.image">
|
|
|
</el-upload>
|
|
|
<!-- 删除按钮,当鼠标悬浮时显示 -->
|
|
|
- <div v-if="hovering && logoUrl && dialogName == '添加'" class="delete-button"
|
|
|
- @click="handleDelete">
|
|
|
+ <div v-if="hovering && logoUrl" class="delete-button" @click="handleDelete">
|
|
|
<i class="el-icon-delete"></i>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -189,14 +209,15 @@
|
|
|
<script>
|
|
|
//表格标题
|
|
|
import tableTitle from './components/tableTitle.vue';
|
|
|
-
|
|
|
+import tagInput from '../../components/InputTag/index.vue';
|
|
|
//引入公用样式
|
|
|
import '@/styles/global.less';
|
|
|
-import { getSectorList, addSector, delSector, updateSector, getSectorInfo } from '@/api/plate'
|
|
|
-import { getTemplateClass } from '@/api/style'
|
|
|
+// import { getSectorList, addSector, delSector, updateSector, getSectorInfo } from '@/api/plate'
|
|
|
+// import { getTemplateClass } from '@/api/style'
|
|
|
export default {
|
|
|
components: {
|
|
|
tableTitle,//表格标题-
|
|
|
+ tagInput
|
|
|
},
|
|
|
data() {
|
|
|
const validateEmpty = (rule, value, callback) => {
|
|
@@ -206,6 +227,13 @@ export default {
|
|
|
callback()
|
|
|
}
|
|
|
}
|
|
|
+ const validateArray = (rule, value, callback) => {
|
|
|
+ if (value.length == 0) {
|
|
|
+ callback(new Error('该项不能为空!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
//1.1 初始化信息
|
|
|
tableDivTitle: "通栏列表", //列表标题
|
|
@@ -214,9 +242,22 @@ export default {
|
|
|
plateLoading: true, //表格内容加载中
|
|
|
|
|
|
tableData: [],//表格数据
|
|
|
- options: [],//模板风格下拉列表
|
|
|
-
|
|
|
+ class_options: [],//风格下拉列表
|
|
|
+ template_options: [],//皮肤下拉列表
|
|
|
+ size_options: [],//尺寸下拉列表
|
|
|
+ sectorPlace_options: [],//通栏模版类型下拉列表
|
|
|
+ tags: [],//标签数据
|
|
|
// 1.2搜索框相关
|
|
|
+ apiData:{
|
|
|
+ pagetype: '',//页面类型
|
|
|
+ template_class_id: '',//模板风格
|
|
|
+ tempalte_id: '',//皮肤名称
|
|
|
+ sector_name: '',//通栏名称
|
|
|
+
|
|
|
+ width: '',//通栏宽度
|
|
|
+ height: '',//通栏高度
|
|
|
+ keyword: '',//通栏关键词
|
|
|
+ },
|
|
|
templateStyle: '',//风格
|
|
|
plateName: '',
|
|
|
|
|
@@ -224,31 +265,31 @@ export default {
|
|
|
value: '',
|
|
|
checkList: [
|
|
|
{
|
|
|
- value: '1',
|
|
|
+ value: 1,
|
|
|
label: '首页',
|
|
|
},
|
|
|
{
|
|
|
- value: '2',
|
|
|
+ value: 2,
|
|
|
label: '分类页',
|
|
|
},
|
|
|
{
|
|
|
- value: '3',
|
|
|
+ value: 3,
|
|
|
label: '列表页',
|
|
|
},
|
|
|
{
|
|
|
- value: '4',
|
|
|
+ value: 4,
|
|
|
label: '详情页',
|
|
|
},
|
|
|
{
|
|
|
- value: '5',
|
|
|
+ value: 5,
|
|
|
label: '搜索页',
|
|
|
},
|
|
|
{
|
|
|
- value: '6',
|
|
|
+ value: 6,
|
|
|
label: '特殊列表页',
|
|
|
},
|
|
|
{
|
|
|
- value: '7',
|
|
|
+ value: 7,
|
|
|
label: '特殊详情页',
|
|
|
},
|
|
|
],
|
|
@@ -268,17 +309,29 @@ export default {
|
|
|
|
|
|
//1.4 弹框相关数据
|
|
|
ruleForm: {
|
|
|
- templateStyle: '', //关联风格名称
|
|
|
- plateName: '', //版块名称
|
|
|
- plateCode: '',//版块代码
|
|
|
- pageType: [], //页面类型
|
|
|
- image: '',//组件展示图
|
|
|
+ sectorName: '', //通栏名称
|
|
|
+ sectorPlace: null, //通栏模版类型
|
|
|
+ component_num: null, //组件数量
|
|
|
+ sectorId: null, //通栏编号id
|
|
|
+ templateStyle: '', //所属皮肤
|
|
|
+ pageType: '', //页面类型
|
|
|
+ sizeList: '', //尺寸
|
|
|
+ sectorType: null, //通栏名称
|
|
|
+ plateCode: '', //通栏代码
|
|
|
+ pageType: [], //页面类型
|
|
|
+ sectorKeyword: '', //通栏关键词
|
|
|
+ image: '', //组件展示图
|
|
|
},
|
|
|
rules: {
|
|
|
- templateStyle: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- plateName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- plateCode: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- pageType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ sectorName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ component_num: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ sectorId: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ templateStyle: [{ required: true, trigger: 'blur', validator: validateEmpty }], //关联皮肤名称
|
|
|
+ sizeList: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ // plateCode: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ sectorType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ pageType: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
|
+ sectorKeyword: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
image: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
},
|
|
|
|
|
@@ -292,44 +345,103 @@ export default {
|
|
|
//1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
//1.1 开始请求列表信息方法
|
|
|
getData() {
|
|
|
- if (this.templateStyle != '' || this.plateName != '') {
|
|
|
- getSectorList({
|
|
|
- page: this.page,
|
|
|
- page_size: this.pageSize,
|
|
|
- template_class_id: this.templateStyle,
|
|
|
- sector_name: this.plateName,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- this.tableData = data.data.data
|
|
|
- this.total = data.data.total
|
|
|
- })
|
|
|
- } else {
|
|
|
- getSectorList({
|
|
|
- page: this.page,
|
|
|
- page_size: this.pageSize
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- if (data.code == 200) {
|
|
|
- this.plateLoading = false
|
|
|
+ this.$store.dispatch('plate/getSectorList', { page: this.page, page_size: this.pageSize }).then(data => {
|
|
|
+ this.tableData = data.data.data
|
|
|
+ this.total = data.data.total
|
|
|
+ console.log(typeof(data.data.data));
|
|
|
+ for (let i = 0; i < data.data.data.length; i++) {
|
|
|
+ const item = data.data.data[i];
|
|
|
+ this.tableData[i].sector_size = item.width + ' * ' + item.height;
|
|
|
+ let pageArray = JSON.parse(item.page_type);
|
|
|
+ if (Array.isArray(pageArray)) {
|
|
|
+ // item.tags = keywordArray;
|
|
|
+ item.pagetype = pageArray.map(type => {
|
|
|
+ const pageTypeMap = {
|
|
|
+ 1: '首页',
|
|
|
+ 2: '分类页',
|
|
|
+ 3: '列表页',
|
|
|
+ 4: '详情页',
|
|
|
+ 5: '搜索页',
|
|
|
+ 6: '特殊列表页',
|
|
|
+ 7: '特殊详情页'
|
|
|
+ };
|
|
|
+ return pageTypeMap[type] || type;
|
|
|
+ }).join(' | ');
|
|
|
+ } else {
|
|
|
+ item.pagetype = '';
|
|
|
}
|
|
|
- this.tableData = data.data.data
|
|
|
- this.total = data.data.total
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
|
|
|
//获取风格列表
|
|
|
getStyleList() {
|
|
|
- getTemplateClass({
|
|
|
- page: this.page,
|
|
|
- page_size: this.pageSize
|
|
|
- }).then(data => {
|
|
|
- console.log('模板风格列表', data);
|
|
|
- this.options = data.data
|
|
|
+ this.$store.dispatch('genre/getTemplateClass').then(res => {
|
|
|
+ this.class_options = res.data
|
|
|
+ // console.log(res.data);
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '网络错误,请重试!'
|
|
|
+ });
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+ //获取皮肤列表
|
|
|
+ getSkinList() {
|
|
|
+ let data = [];
|
|
|
+ // console.log("5588888",this.apiData.template_class_id);
|
|
|
+ if(this.apiData.template_class_id){
|
|
|
+ let data = {
|
|
|
+ templte_class_id: this.apiData.template_class_id,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$store.dispatch('plate/getAllTemplate', data).then(res => {
|
|
|
+ this.template_options = res.data
|
|
|
+ console.log(res.data);
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '网络错误,请重试!'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取尺寸列表
|
|
|
+ getSizeList() {
|
|
|
+ this.$store.dispatch('plate/getAllSize').then(res => {
|
|
|
+ this.size_options = res.data
|
|
|
+ if(res.data){
|
|
|
+ this.size_options.forEach(item => {
|
|
|
+ item.label = item.width + ' * ' + item.height;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(res.data);
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '网络错误,请重试!'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取位置列表
|
|
|
+ getPlaceList(sectorType) {
|
|
|
+ // if( this.dialogName == '编辑' || this.dialogName == '添加'){
|
|
|
+ let data = {
|
|
|
+ sector_num : sectorType,
|
|
|
+ }
|
|
|
+ console.log("888888888888888888",data);
|
|
|
+ this.$store.dispatch('plate/getSectorPlace',data).then(res => {
|
|
|
+ this.sectorPlace_options = res.data
|
|
|
+ console.log(res.data);
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '网络错误,请重试!'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ // }
|
|
|
+
|
|
|
+ },
|
|
|
//1.2 删除内容
|
|
|
deleteRow(id) {
|
|
|
console.log(id);
|
|
@@ -340,20 +452,17 @@ export default {
|
|
|
cancelButtonText: '取消',
|
|
|
}).then(() => {
|
|
|
console.log("当前删除:" + id)
|
|
|
-
|
|
|
- delSector({
|
|
|
- id: id
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- if (data.code = 200) {
|
|
|
+ this.$store.dispatch('plate/delSector', {id:id}).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.code = 200) {
|
|
|
this.$message({
|
|
|
message: '删除成功',
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.getData()
|
|
|
- } else if (data.code == 0) {
|
|
|
+ } else if (res.code == 0) {
|
|
|
this.$message({
|
|
|
- message: data.message,
|
|
|
+ message: res.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
}
|
|
@@ -397,22 +506,56 @@ export default {
|
|
|
},
|
|
|
// 1.6 搜索按钮
|
|
|
goSearch() {
|
|
|
- getSectorList({
|
|
|
+ const data = {
|
|
|
page: this.page,
|
|
|
page_size: this.pageSize,
|
|
|
- template_class_id: this.templateStyle,
|
|
|
- sector_name: this.plateName,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
+ sector_name: this.apiData.sector_name ?? '', //通栏名称
|
|
|
+ template_class_id: this.apiData.template_class_id ?? null, //风格id
|
|
|
+ template_id: this.apiData.template_id ?? null, //通栏id
|
|
|
+ width: this.apiData.width ?? null, //通栏宽度
|
|
|
+ height: this.apiData.height ?? null, //通栏高度
|
|
|
+ keyword: this.apiData.keyword ?? '', //通栏关键词
|
|
|
+ }
|
|
|
+ this.$store.dispatch('plate/getSectorList',data ).then(data => {
|
|
|
this.tableData = data.data.data
|
|
|
this.total = data.data.total
|
|
|
+ for (let i = 0; i < data.data.data.length; i++) {
|
|
|
+ const item = data.data.data[i];
|
|
|
+ this.tableData[i].sector_size = item.width + ' * ' + item.height;
|
|
|
+ try {
|
|
|
+ let pageArray = JSON.parse(item.pagetype);
|
|
|
+ if (Array.isArray(pageArray)) {
|
|
|
+ // item.tags = keywordArray;
|
|
|
+ item.pagetype = pageArray.map(type => {
|
|
|
+ const pageTypeMap = {
|
|
|
+ '1': '首页',
|
|
|
+ '2': '分类页',
|
|
|
+ '3': '列表页',
|
|
|
+ '4': '详情页',
|
|
|
+ '5': '搜索页',
|
|
|
+ '6': '特殊列表页',
|
|
|
+ '7': '特殊详情页'
|
|
|
+ };
|
|
|
+ return pageTypeMap[type] || type;
|
|
|
+ }).join(' | ');
|
|
|
+ } else {
|
|
|
+ item.pagetype = '';
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('解析 keyword 失败:', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
-
|
|
|
},
|
|
|
//1.7 重置按钮
|
|
|
goReset() {
|
|
|
- this.templateStyle = ""
|
|
|
- this.plateName = ""
|
|
|
+ this.apiData.pagetype = '',//页面类型
|
|
|
+ this.apiData.template_class_id= '',//模板风格
|
|
|
+ this.apiData.template_id = '',//皮肤名称
|
|
|
+ this.apiData.sector_name= '',//通栏名称
|
|
|
+ this.apiData.width= '',//通栏宽度
|
|
|
+ this.apiData.height= '',//通栏高度
|
|
|
+ this.apiData.keyword= '',//通栏关键词
|
|
|
this.page=1
|
|
|
this.pageSize=10
|
|
|
this.getData()
|
|
@@ -430,49 +573,60 @@ export default {
|
|
|
this.hovering = false
|
|
|
|
|
|
//数据回显
|
|
|
- this.ruleForm.templateStyle = val.template_class_id //关联风格名称
|
|
|
- this.ruleForm.plateName = val.sector_name //版块名称
|
|
|
- this.ruleForm.plateCode = val.sector_code //版块代码
|
|
|
- this.ruleForm.pageType = JSON.parse(JSON.parse(val.page_type))//页面类型
|
|
|
- this.ruleForm.image = val.sector_img //组件展示图
|
|
|
- this.logoUrl = val.sector_img
|
|
|
+ console.log("valbianji ",val);
|
|
|
+ this.ruleForm.sectorName = val.sector_name; //通栏名称
|
|
|
+ this.ruleForm.sectorId = val.sector_id; //通栏编号id
|
|
|
+ this.ruleForm.templateStyle = val.template_id; //关联皮肤名称
|
|
|
+ this.ruleForm.component_num = val.component_num; //组件数量
|
|
|
+ this.ruleForm.sizeList = val.size_id; //通栏尺寸
|
|
|
+ this.ruleForm.sectorType = val.place_type; //通栏类别
|
|
|
+ this.ruleForm.pageType = JSON.parse(val.page_type); // 通栏页面类型,根据符号|划分字符串为数组
|
|
|
+ this.ruleForm.sectorPlace = val.sector_place; //通栏模版类型
|
|
|
+ this.tags = val.pagetype ? val.pagetype.split(' | ') : [];
|
|
|
+ this.ruleForm.plateCode = val.sector_code; //通栏代码
|
|
|
+ this.ruleForm.sectorKeyword = JSON.parse(val.sector_keyword); //通栏关键词
|
|
|
+ this.ruleForm.image = val.sector_img; //通栏展示图
|
|
|
+ this.logoUrl = val.sector_img;
|
|
|
+ console.log("valruleForm ",this.ruleForm);
|
|
|
},
|
|
|
|
|
|
|
|
|
//1.7 添加
|
|
|
- addWebsite() {
|
|
|
+ addPlate() {
|
|
|
this.dialogTableVisible = true
|
|
|
this.dialogName = "添加"
|
|
|
-
|
|
|
//添加时清空回显回来的数据
|
|
|
- this.ruleForm.templateStyle = '' //关联风格名称
|
|
|
- this.ruleForm.plateName = '' //版块名称
|
|
|
- this.ruleForm.plateCode = '' //版块代码
|
|
|
- this.ruleForm.pageType = [] //页面类型
|
|
|
- this.ruleForm.image = '' //组件展示图
|
|
|
- this.logoUrl = ''
|
|
|
+ this.ruleForm.sectorName = ''; //通栏名称
|
|
|
+ this.ruleForm.sectorId = null; //通栏编号id
|
|
|
+ this.ruleForm.templateStyle = ''; //关联皮肤名称
|
|
|
+ this.ruleForm.sizeList = ''; //通栏尺寸
|
|
|
+ this.ruleForm.sectorType = null; //通栏类别
|
|
|
+ this.ruleForm.pageType = []; //通栏页面类型
|
|
|
+ this.ruleForm.plateCode = ''; //通栏代码
|
|
|
+ this.ruleForm.sectorKeyword = ''; //通栏关键词
|
|
|
+ this.ruleForm.component_num = null; //组件数量
|
|
|
+ this.ruleForm.image = ''; //通栏展示图
|
|
|
+ // this.getPlaceList();
|
|
|
},
|
|
|
|
|
|
// 弹出层相关方法
|
|
|
// 提交表单
|
|
|
submitForm(formName) {
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- console.log('submit!');
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
if (this.dialogName == "添加") {
|
|
|
- addSector({
|
|
|
- template_id: this.ruleForm.templateStyle,
|
|
|
- sector_name: this.ruleForm.plateName,
|
|
|
- sector_code: this.ruleForm.plateCode,
|
|
|
- page_type: this.pageType,
|
|
|
- sector_img: this.ruleForm.image,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
+ const data = {
|
|
|
+ sector_name: this.ruleForm.sectorName, //通栏名称
|
|
|
+ sector_id: this.ruleForm.sectorId, //通栏编号
|
|
|
+ template_id: this.ruleForm.templateStyle, //所属皮肤
|
|
|
+ size_id: this.ruleForm.sizeList, //通栏尺寸
|
|
|
+ sector_type: this.ruleForm.sectorType, //通栏类别
|
|
|
+ sector_code: this.ruleForm.plateCode, //通栏代码
|
|
|
+ page_type: this.ruleForm.pageType, //页面类型
|
|
|
+ component_num: this.ruleForm.component_num, //组件数量
|
|
|
+ sector_keyword: JSON.stringify(this.ruleForm.sectorKeyword), //通栏关键词
|
|
|
+ sector_img: this.ruleForm.image, //通栏展示图
|
|
|
+ }
|
|
|
+ console.log("5555555555555",data);
|
|
|
+ this.$store.dispatch('plate/addSector',data).then(data => {
|
|
|
if (data.code == 200) {
|
|
|
this.$message({
|
|
|
message: '添加成功',
|
|
@@ -480,52 +634,45 @@ export default {
|
|
|
})
|
|
|
this.dialogTableVisible = false
|
|
|
this.getData()
|
|
|
- } else if (data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: data.message,
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- this.dialogTableVisible = true
|
|
|
- return
|
|
|
- } else {
|
|
|
+ }else{
|
|
|
this.$message({
|
|
|
message: data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
- this.dialogTableVisible = true
|
|
|
- return
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
-
|
|
|
- if (this.website_id == '') {
|
|
|
- this.$message({
|
|
|
- message: '请输入并选择网站名称',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- this.dialogVisible = true
|
|
|
+
|
|
|
}
|
|
|
if (this.dialogName == "编辑") {
|
|
|
- updateSector({
|
|
|
+ const data = {
|
|
|
id: this.activeid,
|
|
|
- sector_name: this.ruleForm.plateName,
|
|
|
- }).then(data => {
|
|
|
+ sector_name: this.ruleForm.sectorName, //通栏名称
|
|
|
+ sector_id: this.ruleForm.sectorId, //通栏编号
|
|
|
+ template_id: this.ruleForm.templateStyle, //所属皮肤
|
|
|
+ size_id: this.ruleForm.sizeList, //通栏尺寸
|
|
|
+ sector_type: this.ruleForm.sectorType, //通栏类别
|
|
|
+ sector_code: this.ruleForm.plateCode, //通栏代码
|
|
|
+ page_type: this.ruleForm.pageType, //页面类型
|
|
|
+ component_num: this.ruleForm.component_num, //组件数量
|
|
|
+ sector_keyword: JSON.stringify(this.ruleForm.sectorKeyword), //通栏关键词
|
|
|
+ sector_img: this.ruleForm.image, //通栏展示图
|
|
|
+ }
|
|
|
+ console.log("data",data);
|
|
|
+ this.$store.dispatch('plate/updateSector', data).then(data => {
|
|
|
console.log(data);
|
|
|
if (data.code == 200) {
|
|
|
this.$message({
|
|
|
message: '编辑成功',
|
|
|
type: 'success'
|
|
|
- })
|
|
|
+ })
|
|
|
this.dialogTableVisible = false
|
|
|
- }
|
|
|
- if (data.code == 0) {
|
|
|
+ this.getData()
|
|
|
+ }else{
|
|
|
this.$message({
|
|
|
message: data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
- this.dialogTableVisible = true
|
|
|
}
|
|
|
- this.getData()
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -570,20 +717,6 @@ export default {
|
|
|
this.logoUrl = ''; // 清空图片 URL
|
|
|
},
|
|
|
|
|
|
- //搜索部分的输入关键词下拉框
|
|
|
- selectWebSite(value) {
|
|
|
- this.webSiteName_id = value
|
|
|
- },
|
|
|
-
|
|
|
- //添加 / 编辑弹窗中输入关键词下拉框
|
|
|
- // 判断是否已经关联了网站
|
|
|
- detectionWebSite(value) {
|
|
|
- console.log(value);
|
|
|
- this.website_id = value
|
|
|
- console.log(this.website_id);
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
//
|
|
|
getWebNavList(query) {
|
|
|
if (query !== '') {
|
|
@@ -611,10 +744,20 @@ export default {
|
|
|
this.navList = [];
|
|
|
}
|
|
|
},
|
|
|
+ // 关键词标签
|
|
|
+ updateTags(newTags) {
|
|
|
+ // this.foem.seo_keywords = newTags;
|
|
|
+
|
|
|
+ this.tags = newTags;
|
|
|
+ this.ruleForm.sectorKeyword = newTags;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData()
|
|
|
this.getStyleList()
|
|
|
+ this.getSkinList()
|
|
|
+ this.getSizeList()
|
|
|
+ // this.getPlaceList()
|
|
|
},
|
|
|
}
|
|
|
</script>
|