Commit 700e23b0 authored by zhanglw's avatar zhanglw

首页管理

parent 82e8cb59
......@@ -245,6 +245,33 @@ export const HttpReq = {
method: 'get'
})
},
// 内容管理-查询单个产品列表页
queryProductListPageById: function(params) {
return request({
url: '/api/bsw/productListPage/queryProductListPageById?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-修改产品列表
updateProductListPage: function(data) {
return request({
url: '/api/bsw/productListPage/updateProductListPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-产品列表批量发布
releaseProductListPage: function(data) {
return request({
url: '/api/bsw/productListPage/releaseProductListPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-查询首页内容列表页
queryHomePage: function(params) {
return request({
......@@ -289,6 +316,16 @@ export const HttpReq = {
return res
})
},
// 内容管理-首页管理批量删除
batchDelete: function(data) {
return request({
url: '/api/bsw/homePage/batchDelete',
method: 'delete',
data: data
}).then((res) => {
return res
})
},
xxx: null
}
}
......
......@@ -190,13 +190,26 @@
</el-form-item>
<el-form-item label="合作伙伴LOGO:" class="form-cell" prop="partnerLogo">
<div class="cell-box">
<ul class="el-upload-list el-upload-list--picture-card" style="float: left">
<li v-for="(item, index) in imgList" :key="index" tabindex="0" class="el-upload-list__item is-success">
<img :src="imgSrcStart+'/productPic/'+item" class="el-upload-list__item-thumbnail">
<label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label>
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="dialogImgUrl=item;dialogImgVisible=true"><i class="el-icon-zoom-in" /></span>
<span class="el-upload-list__item-delete" @click="handleRemoveImg(item)"><i class="el-icon-delete" /></span>
</span>
</li>
</ul>
<el-dialog append-to-body :visible.sync="dialogImgVisible">
<img width="100%" :src="imgSrcStart+'/productPic/'+dialogImgUrl">
</el-dialog>
<el-upload
ref="uploadCom"
action="/api/bsw/product/uploadProductPic"
name="productPic"
list-type="picture-card"
:headers="uploadHeaders"
:limit="1"
:limit="5"
:on-exceed="handleExceed"
:on-success="handleImported"
:on-preview="handlePictureCardPreview"
......@@ -208,6 +221,7 @@
<img width="100%" :src="dialogImageUrl">
</el-dialog>
</div>
<div style="display: block;clear: both">{{ formData.partnerLogo }}</div>
</el-form-item>
<el-form-item label="链接:" class="form-cell" prop="url">
<div class="cell-box">
......@@ -261,8 +275,12 @@ export default {
return {
uploadHeaders: { 'Authorization': getToken() },
imgSrcStart: process.env.VUE_APP_BASE_API,
editor: false, // 富文本对象
dialogImageUrl: '',
dialogImageVisible: false,
imgList: [],
dialogImgUrl: '',
dialogImgVisible: false,
visible: false,
title: '添加首页内容',
formData: {
......@@ -406,6 +424,12 @@ export default {
type: 'info'
})
},
handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.productPic.split(';')
arr.splice(arr.indexOf(item), 1)
this.formData.productPic = arr.join(';')
},
handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({
productPic: file.response.productPic
......
......@@ -124,7 +124,16 @@ export default {
this.$refs.addPage.loadData(item.homePageId)
},
toDelete(item) {
HttpReq.backstageApi.batchDelete({
ids: [item.homePageId]
}).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
this.loadData()
})
},
toSearch() {
this.page = 1
......
......@@ -10,17 +10,18 @@
</div>
</el-form-item>
<el-form-item label="产品ID:" class="form-cell" prop="xxx">
<div v-for="(item, index) in formData.dataList" :key="index" class="cell-box">
<el-input v-model="item.id" placeholder="产品id" class="cell-input" style="width: 150px" />
<div v-for="(item, index) in formData.productList" :key="index" class="cell-box" style="margin-bottom: 2px">
<el-input v-model="item.productId" placeholder="产品id" class="cell-input" style="width: 150px" />
<el-input v-model.number="item.index" type="number" placeholder="顺序" class="cell-input" style="width: 150px" />
<el-button v-if="index+1>=formData.dataList.length" icon="el-icon-plus" @click="addDataRow">添加行</el-button>
<el-button circle icon="el-icon-delete" @click="delDataRow(index)" />
<el-button v-if="index+1>=formData.productList.length" icon="el-icon-plus" @click="addDataRow">添加行</el-button>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelView">关闭</el-button>
<el-button type="primary" @click="submitForm()">保存</el-button>
<el-button type="success" @click="submitForm()">发布</el-button>
<el-button type="success" @click="submitForm(true)">发布</el-button>
</div>
</el-dialog>
</template>
......@@ -36,14 +37,8 @@ export default {
title: '内容管理供应商设置',
formData: {
productType: '',
dataList: [
{ id: '123', index: '1' },
{ id: '222', index: '2' },
{ id: '333', index: '3' },
{ id: '444', index: '4' },
{ id: '', index: '' }
],
id: null
productList: [],
productListPageId: null
},
rules: {}
}
......@@ -51,8 +46,13 @@ export default {
mounted() {
},
methods: {
delDataRow(index) {
if (this.formData.productList.length > 1) {
this.formData.productList.splice(index, 1)
}
},
addDataRow() {
this.formData.dataList.push({ id: '', index: '' })
this.formData.productList.push({ index: '', productId: '' })
},
showView() {
this.visible = true
......@@ -60,48 +60,67 @@ export default {
hideView() {
this.$refs.formViewRef.resetFields()
this.visible = false
this.formData = {
productType: '',
productList: [],
productListPageId: null
}
},
cancelView() {
this.hideView()
},
submitForm() {
release() {
HttpReq.backstageApi.releaseProductListPage({ ids: [this.formData.productListPageId] }).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
},
submitForm(isRelease) {
this.$refs.formViewRef.validate((valid, obj) => {
if (valid) {
// HttpReq.backstageApi.updateCustomerDetail(this.formData).then((res) => {
// this.$notify({
// title: res.msg,
// type: 'success',
// duration: 2500
// })
// if (res.code === 200) {
// this.cancelView()
// this.$parent.loadData()
// }
// })
// } else {
// this.$message({
// message: '表单信息有误,请核对无误后提交!',
// type: 'error'
// })
HttpReq.backstageApi.updateProductListPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
} else {
this.$message({
message: '表单信息有误,请核对无误后提交!',
type: 'error'
})
}
})
},
loadData(productListPageId) {
// if (productListPageId) {
// HttpReq.backstageApi.querySupplierListPageById({ productListPageId }).then((res) => {
// if (res.code === 200) {
// this.formData = Object.assign(this.formData, res.data)
// if (this.formData.productIdList) {
// const arr = this.formData.productIdList.split(';')
// }
// } else {
// this.$message({
// message: res.msg,
// type: 'error'
// })
// }
// })
// }
if (productListPageId) {
HttpReq.backstageApi.queryProductListPageById({ productListPageId }).then((res) => {
if (res.code === 200) {
this.formData = Object.assign(this.formData, res.data)
} else {
this.$message({
message: res.msg,
type: 'error'
})
}
})
}
this.showView()
}
}
......
......@@ -39,7 +39,7 @@
<el-table-column prop="updateTime" label="最后维护日期" align="center" width="200" />
<el-table-column label="操作" align="right" width="240">
<template slot-scope="scope">
<el-tooltip v-if="scope.row.status==='1'" content="发布"><el-button round plain type="success" icon="el-icon-finished" @click="batchOperate(1, scope.row)"/></el-tooltip>
<el-tooltip v-if="scope.row.status==='1'" content="发布"><el-button round plain type="success" icon="el-icon-finished" @click="batchOperate(1, scope.row)" /></el-tooltip>
<el-tooltip content="设置"><el-button round plain icon="el-icon-s-tools" @click="toEdit(scope.row)" /></el-tooltip>
</template>
</el-table-column>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment