|
@@ -7,7 +7,7 @@
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">模板风格</div>
|
|
|
- <el-select v-model="templateStyle" placeholder="请选择">
|
|
|
+ <el-select v-model="templateStyle" clearable placeholder="请选择">
|
|
|
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -16,7 +16,7 @@
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">模板名称</div>
|
|
|
- <el-input v-model="templateName" placeholder="请输入模板名称"></el-input>
|
|
|
+ <el-input v-model="templateName" clearable placeholder="请输入模板名称"></el-input>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8" class="right">
|
|
@@ -90,8 +90,8 @@
|
|
|
<el-form-item label="模板名称:" prop="templateName">
|
|
|
<el-input v-model="ruleForm.templateName" placeholder="请输入模板名称"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="风格图:" prop="templateImg" :label-width="formLabelWidth" :class="['custom-form-item']"
|
|
|
- class="custom-align-right">
|
|
|
+ <el-form-item label="风格图:" prop="templateImg" :label-width="formLabelWidth"
|
|
|
+ :class="['custom-form-item']" class="custom-align-right">
|
|
|
<div class="uploaderBox">
|
|
|
<!--图片上传组件 start ------------------------------------------------------------>
|
|
|
<div class="avatar-upload-container" @mouseenter="hovering = true"
|
|
@@ -189,7 +189,8 @@
|
|
|
<input type="hidden" name="logo" v-model="detailImg">
|
|
|
</el-upload>
|
|
|
<!-- 删除按钮,当鼠标悬浮时显示 -->
|
|
|
- <div v-if="hovering && logoUrl_detail" class="delete-button" @click="handleDelete_detail">
|
|
|
+ <div v-if="hovering && logoUrl_detail" class="delete-button"
|
|
|
+ @click="handleDelete_detail">
|
|
|
<i class="el-icon-delete"></i>
|
|
|
</div>
|
|
|
<h5>详情页</h5>
|
|
@@ -215,7 +216,8 @@
|
|
|
<input type="hidden" name="logo" v-model="searchImg">
|
|
|
</el-upload>
|
|
|
<!-- 删除按钮,当鼠标悬浮时显示 -->
|
|
|
- <div v-if="hovering && logoUrl_search" class="delete-button" @click="handleDelete_search">
|
|
|
+ <div v-if="hovering && logoUrl_search" class="delete-button"
|
|
|
+ @click="handleDelete_search">
|
|
|
<i class="el-icon-delete"></i>
|
|
|
</div>
|
|
|
<h5>搜索页</h5>
|
|
@@ -267,7 +269,8 @@
|
|
|
<input type="hidden" name="logo" v-model="sDetailImg">
|
|
|
</el-upload>
|
|
|
<!-- 删除按钮,当鼠标悬浮时显示 -->
|
|
|
- <div v-if="hovering && logoUrl_sDetail" class="delete-button" @click="handleDelete_sDetail">
|
|
|
+ <div v-if="hovering && logoUrl_sDetail" class="delete-button"
|
|
|
+ @click="handleDelete_sDetail">
|
|
|
<i class="el-icon-delete"></i>
|
|
|
</div>
|
|
|
<h5>特殊详情页</h5>
|
|
@@ -279,7 +282,7 @@
|
|
|
</div>
|
|
|
<div class="dialogBtn">
|
|
|
<el-button type="info" @click="cancelForm">取消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm">提交</el-button>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</el-dialog>
|
|
@@ -332,27 +335,63 @@ export default {
|
|
|
|
|
|
//首页图片
|
|
|
homeImg: '',
|
|
|
- logoUrl_home:'',
|
|
|
+ logoUrl_home: '',
|
|
|
+ home_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '首页',
|
|
|
+ value: '1',
|
|
|
+ },
|
|
|
//分类页图片
|
|
|
classifyImg: '',
|
|
|
- logoUrl_class:'',
|
|
|
+ logoUrl_class: '',
|
|
|
+ class_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '分类页',
|
|
|
+ value: '2',
|
|
|
+ },
|
|
|
//列表页图片
|
|
|
listImg: '',
|
|
|
- logoUrl_list:'',
|
|
|
+ logoUrl_list: '',
|
|
|
+ list_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '列表页',
|
|
|
+ value: '3',
|
|
|
+ },
|
|
|
//详情页图片
|
|
|
detailImg: '',
|
|
|
- logoUrl_detail:'',
|
|
|
+ logoUrl_detail: '',
|
|
|
+ detail_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '详情页',
|
|
|
+ value: '4',
|
|
|
+ },
|
|
|
//搜索页图片
|
|
|
searchImg: '',
|
|
|
- logoUrl_search:'',
|
|
|
+ logoUrl_search: '',
|
|
|
+ search_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '搜索页',
|
|
|
+ value: '5',
|
|
|
+ },
|
|
|
//特殊列表页图片
|
|
|
sListImg: '',
|
|
|
- logoUrl_sList:'',
|
|
|
+ logoUrl_sList: '',
|
|
|
+ sList_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '特殊列表页',
|
|
|
+ value: '6',
|
|
|
+ },
|
|
|
//特殊详情页图片
|
|
|
sDetailImg: '',
|
|
|
- logoUrl_sDetail:'',
|
|
|
+ logoUrl_sDetail: '',
|
|
|
+ sDetail_obj: {
|
|
|
+ url: '',
|
|
|
+ name: '特殊详情页',
|
|
|
+ value: '7',
|
|
|
+ },
|
|
|
+ //图片json
|
|
|
+ img_arr: [],
|
|
|
|
|
|
-
|
|
|
value: '',
|
|
|
options: [],
|
|
|
|
|
@@ -436,23 +475,18 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- //1.3 查看示例图
|
|
|
- // goGraph() {
|
|
|
- // this.dialogVisible = true
|
|
|
- // },
|
|
|
-
|
|
|
- //1.4 列表内容分页
|
|
|
+ //1.3 列表内容分页
|
|
|
//直接跳转
|
|
|
handleSizeChange(val) {
|
|
|
this.page = val;
|
|
|
this.getData();
|
|
|
},
|
|
|
- //1.5 点击分页
|
|
|
+ //1.4 点击分页
|
|
|
handleCurrentChange(val) {
|
|
|
this.page = val;
|
|
|
this.getData();
|
|
|
},
|
|
|
- // 1.6 搜索按钮
|
|
|
+ // 1.5 搜索按钮
|
|
|
goSearch() {
|
|
|
getTemplateList({
|
|
|
page: this.page,
|
|
@@ -465,7 +499,7 @@ export default {
|
|
|
this.total = data.data.total
|
|
|
})
|
|
|
},
|
|
|
- //1.7 重置按钮
|
|
|
+ //1.6 重置按钮
|
|
|
goReset() {
|
|
|
this.templateStyle = ""
|
|
|
this.templateName = ""
|
|
@@ -473,7 +507,7 @@ export default {
|
|
|
},
|
|
|
//列表和分页相关 end ------------------------------------------------------------>
|
|
|
|
|
|
- //1.9 编辑
|
|
|
+ //1.7 编辑
|
|
|
goEdit(id, val) {
|
|
|
this.dialogName = '编辑'
|
|
|
this.activeid = id
|
|
@@ -483,11 +517,55 @@ export default {
|
|
|
//数据回显
|
|
|
this.ruleForm.templateStyle = val.template_class_id
|
|
|
this.ruleForm.templateName = val.template_name
|
|
|
-
|
|
|
+ this.img_arr = JSON.parse(val.template_img)
|
|
|
+
|
|
|
+ this.homeImg = ''
|
|
|
+ this.logoUrl_home = ''
|
|
|
+ this.classifyImg = ''
|
|
|
+ this.logoUrl_class = ''
|
|
|
+ this.listImg = ''
|
|
|
+ this.logoUrl_list = ''
|
|
|
+ this.detailImg = ''
|
|
|
+ this.logoUrl_detail = ''
|
|
|
+ this.searchImg = ''
|
|
|
+ this.logoUrl_search = ''
|
|
|
+ this.sListImg = ''
|
|
|
+ this.logoUrl_sList = ''
|
|
|
+ this.sDetailImg = ''
|
|
|
+ this.logoUrl_sDetail = ''
|
|
|
+
|
|
|
+ for (let item of this.img_arr) {
|
|
|
+ if (item.name == '首页') {
|
|
|
+ this.logoUrl_home = item.url
|
|
|
+ this.homeImg = item.url
|
|
|
+ }
|
|
|
+ if (item.name == '分类页') {
|
|
|
+ this.logoUrl_class = item.url
|
|
|
+ this.classifyImg = item.url
|
|
|
+ }
|
|
|
+ if (item.name == '列表页') {
|
|
|
+ this.logoUrl_list = item.url
|
|
|
+ this.listImg = item.url
|
|
|
+ }
|
|
|
+ if (item.name == '详情页') {
|
|
|
+ this.logoUrl_detail = item.url
|
|
|
+ this.detailImg = item.url
|
|
|
+ }
|
|
|
+ if (item.name == '搜索页') {
|
|
|
+ this.logoUrl_search = item.url
|
|
|
+ this.searchImg = item.url
|
|
|
+ }
|
|
|
+ if (item.name == '特殊列表页') {
|
|
|
+ this.logoUrl_sList = item.url
|
|
|
+ this.sListImg = item.url
|
|
|
+ }
|
|
|
+ if (item.name == '特殊详情页') {
|
|
|
+ this.logoUrl_sDetail = item.url
|
|
|
+ this.sDetailImg = item.url
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
- //1.7 添加
|
|
|
+ //1.8 添加
|
|
|
addWebsite() {
|
|
|
this.dialogTableVisible = true
|
|
|
this.dialogName = "添加"
|
|
@@ -495,24 +573,82 @@ export default {
|
|
|
//添加时清空回显回来的数据
|
|
|
this.ruleForm.templateStyle = ''
|
|
|
this.ruleForm.templateName = ''
|
|
|
+ this.ruleForm.templateImg = []
|
|
|
+ this.img_arr = []
|
|
|
+ this.homeImg = ''
|
|
|
+ this.logoUrl_home = ''
|
|
|
+ this.classifyImg = ''
|
|
|
+ this.logoUrl_class = ''
|
|
|
+ this.listImg = ''
|
|
|
+ this.logoUrl_list = ''
|
|
|
+ this.detailImg = ''
|
|
|
+ this.logoUrl_detail = ''
|
|
|
+ this.searchImg = ''
|
|
|
+ this.logoUrl_search = ''
|
|
|
+ this.sListImg = ''
|
|
|
+ this.logoUrl_sList = ''
|
|
|
+ this.sDetailImg = ''
|
|
|
+ this.logoUrl_sDetail = ''
|
|
|
},
|
|
|
|
|
|
- // 弹出层相关方法
|
|
|
- // 提交表单
|
|
|
- submitForm(formName) {
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- console.log('submit!');
|
|
|
- } else {
|
|
|
- console.log('error submit!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
+ // 弹出层相关方法 ---------------------------------------------------->
|
|
|
+ // 1.9 提交表单
|
|
|
+ submitForm() {
|
|
|
+ this.img_arr = []
|
|
|
+ //首页
|
|
|
+ if (this.logoUrl_home) {
|
|
|
+ this.home_obj.url = this.homeImg
|
|
|
+ this.img_arr.push(this.home_obj)
|
|
|
+ }
|
|
|
+ //分类页
|
|
|
+ if (this.logoUrl_class) {
|
|
|
+ this.class_obj.url = this.classifyImg
|
|
|
+ this.img_arr.push(this.class_obj)
|
|
|
+ }
|
|
|
+ //列表页
|
|
|
+ if (this.logoUrl_list) {
|
|
|
+ this.list_obj.url = this.listImg
|
|
|
+ this.img_arr.push(this.list_obj)
|
|
|
+ }
|
|
|
+ //详情页
|
|
|
+ if (this.logoUrl_detail) {
|
|
|
+ this.detail_obj.url = this.detailImg
|
|
|
+ this.img_arr.push(this.detail_obj)
|
|
|
+ }
|
|
|
+ //搜索页
|
|
|
+ if (this.logoUrl_search) {
|
|
|
+ this.search_obj.url = this.searchImg
|
|
|
+ this.img_arr.push(this.search_obj)
|
|
|
+ }
|
|
|
+ //特殊列表页
|
|
|
+ if (this.logoUrl_sList) {
|
|
|
+ this.sList_obj.url = this.sListImg
|
|
|
+ this.img_arr.push(this.sList_obj)
|
|
|
+ }
|
|
|
+ //特殊详情页
|
|
|
+ if (this.logoUrl_sDetail) {
|
|
|
+ this.sDetail_obj.url = this.sDetailImg
|
|
|
+ this.img_arr.push(this.sDetail_obj)
|
|
|
+ }
|
|
|
+ function cleanObProp(arr) {
|
|
|
+ return arr.map(item => {
|
|
|
+ const newItem = {};
|
|
|
+ for (const key in item) {
|
|
|
+ if (key !== '__ob__') {
|
|
|
+ newItem[key] = item[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newItem;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const cleanArray = cleanObProp(this.img_arr);
|
|
|
+ this.ruleForm.templateImg = JSON.stringify(cleanArray);
|
|
|
+ console.log(this.ruleForm.templateImg);
|
|
|
+
|
|
|
if (this.dialogName == "添加") {
|
|
|
addTemplate({
|
|
|
template_name: this.ruleForm.templateName, //模板名称
|
|
|
- // template_img: this.ruleForm.templateImg, // 模板图片
|
|
|
- template_img: '1', // 模板图片
|
|
|
+ template_img: this.ruleForm.templateImg, // 模板图片
|
|
|
template_class_id: this.ruleForm.templateStyle, //模板风格id
|
|
|
}).then(data => {
|
|
|
console.log(data);
|
|
@@ -623,7 +759,7 @@ export default {
|
|
|
formData.append('file', file);
|
|
|
|
|
|
this.$store.dispatch('pool/uploadFile', formData).then(res => {
|
|
|
- this.logoUrl_class= res.data.imgUrl;//显示缩略图
|
|
|
+ this.logoUrl_class = res.data.imgUrl;//显示缩略图
|
|
|
this.classifyImg = res.data.imgUrl;//提供表单地址
|
|
|
console.log(res.data.imgUrl)
|
|
|
}).catch(() => {
|
|
@@ -819,6 +955,7 @@ export default {
|
|
|
// 删除图片
|
|
|
this.logoUrl_sDetail = ''; // 清空图片 URL
|
|
|
},
|
|
|
+ // 3.7 弹出层相关方法 end ------------------------------------------------------------>
|
|
|
|
|
|
},
|
|
|
mounted() {
|