Commit 700e23b0 authored by zhanglw's avatar zhanglw

首页管理

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