Commit 187ca533 authored by zhanglw's avatar zhanglw

资讯

parent 4bf9f221
...@@ -335,6 +335,30 @@ export const HttpReq = { ...@@ -335,6 +335,30 @@ export const HttpReq = {
return res return res
}) })
}, },
// 内容管理-查询资讯页内容
queryNewsPage: function(params) {
return request({
url: '/api/bsw/newsPage/queryNewsPage?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-查询单个资讯页内容
queryNewsPageById: function(params) {
return request({
url: '/api/bsw/newsPage/queryNewsPageById?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-资讯发布
releaseNewsPage: function(data) {
return request({
url: '/api/bsw/newsPage/releaseNewsPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
xxx: null xxx: null
} }
} }
......
...@@ -23,24 +23,41 @@ ...@@ -23,24 +23,41 @@
</el-form-item> </el-form-item>
<el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic"> <el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic">
<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+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+dialogImgUrl">
</el-dialog>
<el-upload <el-upload
ref="uploadCom" ref="uploadCom"
action="/api/bsw/product/uploadProductPic" action="/api/bsw/common/uploadPicture"
name="productPic" name="multipartFile"
:data="{mark:'logo'}"
list-type="picture-card" list-type="picture-card"
:headers="uploadHeaders" :headers="uploadHeaders"
:limit="5" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="handleImported" :on-success="handleImported"
:on-preview="handlePictureCardPreview" :on-preview="handlePictureCardPreview"
:on-remove="handleRemove" :on-remove="handleRemove"
> >
<i class="el-icon-plus" /> <div slot="trigger" @click="handlePushClick($event)">
<i class="el-icon-plus" />
</div>
</el-upload> </el-upload>
<el-dialog append-to-body :visible.sync="dialogImageVisible"> <el-dialog append-to-body :visible.sync="dialogImageVisible">
<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 v-show="formData.type<4" label="来源:" class="form-cell" prop="productName"> <el-form-item v-show="formData.type<4" label="来源:" class="form-cell" prop="productName">
<div class="cell-box"> <div class="cell-box">
...@@ -75,8 +92,11 @@ export default { ...@@ -75,8 +92,11 @@ export default {
editor: false, // 富文本对象 editor: false, // 富文本对象
dialogImageUrl: '', dialogImageUrl: '',
dialogImageVisible: false, dialogImageVisible: false,
imgList: [],
dialogImgUrl: '',
dialogImgVisible: false,
visible: false, visible: false,
title: '添加资讯信息', title: '资讯信息内容设置',
formData: { formData: {
productId: null, productId: null,
customerId: null, // 供应商id customerId: null, // 供应商id
...@@ -125,6 +145,15 @@ export default { ...@@ -125,6 +145,15 @@ export default {
type: 'info' type: 'info'
}) })
}, },
handlePushClick(event) {
if (this.formData.partnerLogo !== '') {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
}
},
handleRemove(file, fileList) { handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({ HttpReq.backstageApi.deleteProductPic({
productPic: file.response.productPic productPic: file.response.productPic
...@@ -161,28 +190,65 @@ export default { ...@@ -161,28 +190,65 @@ export default {
this.visible = true this.visible = true
}, },
hideView() { hideView() {
this.$refs.uploadCom.clearFiles() if (this.$refs.uploadCom) {
this.$refs.uploadCom.clearFiles()
}
if (this.editor) {
this.editor.txt.clear()
}
this.$refs.formViewRef.resetFields() this.$refs.formViewRef.resetFields()
this.editor.txt.clear()
this.visible = false this.visible = false
}, },
cancelView() { cancelView() {
this.hideView() this.hideView()
}, },
submitForm() { release() {
this.$refs.formViewRef.validate(valid => { HttpReq.backstageApi.releaseHomePage({ ids: [this.formData.homePageId] }).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) { if (valid) {
HttpReq.backstageApi.addProduct(this.formData).then((res) => { if (this.formData.homePageId) {
this.$notify({ HttpReq.backstageApi.updateHomePage(this.formData).then((res) => {
title: res.msg, this.$notify({
type: 'success', title: res.msg,
duration: 2500 type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
}) })
if (res.code === 200) { } else {
this.cancelView() HttpReq.backstageApi.addHomePage(this.formData).then((res) => {
this.$parent.loadData() this.$notify({
} title: res.msg,
}) type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
}
} else { } else {
this.$message({ this.$message({
message: '表单信息有误,请核对无误后提交!', message: '表单信息有误,请核对无误后提交!',
...@@ -191,16 +257,9 @@ export default { ...@@ -191,16 +257,9 @@ export default {
} }
}) })
}, },
changeProductType() { loadData(newsPageId) {
this.formData.productSubType = null
this.productSubTypeOpts = this.dict['product_type_' + this.formData.productType]
},
loadData() {
this.showView() this.showView()
if (this.editor) { if (!this.editor) {
return
}
this.$nextTick(() => {
const _this = this const _this = this
const editor = new E(this.$refs.editor) const editor = new E(this.$refs.editor)
editor.config.zIndex = 5 editor.config.zIndex = 5
...@@ -217,10 +276,23 @@ export default { ...@@ -217,10 +276,23 @@ export default {
this.formData.productDescribe = html this.formData.productDescribe = html
} }
editor.create() editor.create()
// 初始化数据
editor.txt.html(this.formData.productDescribe)
this.editor = editor this.editor = editor
}) }
if (newsPageId) {
HttpReq.backstageApi.queryHomePageById({ newsPageId }).then((res) => {
if (res.code === 200) {
this.formData = Object.assign(this.formData, res.data)
if (this.formData.partnerLogo) {
this.imgList = this.formData.partnerLogo.split(';')
}
} else {
this.$message({
message: res.msg,
type: 'error'
})
}
})
}
} }
} }
} }
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
<div class="app-container"> <div class="app-container">
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<el-select v-model="query.area" clearable placeholder="请选择资讯分类" style="width: 150px"> <el-select v-model="query.type" clearable placeholder="请选择资讯分类" style="width: 150px">
<el-option v-for="item in dict.information_type" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.information_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<el-input v-model="query.username" clearable placeholder="请输入标题名称" style="width:280px;" /> <el-input v-model="query.title" clearable placeholder="请输入标题名称" style="width:280px;" />
<el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 120px"> <el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 120px">
<el-option v-for="item in dict.issue_status" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.issue_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<date-range-picker v-model="query.createTime" start-placeholder="维护开始日期" style="width: 280px" /> <date-range-picker v-model="query.updateTime" start-placeholder="维护开始日期" style="width: 280px" />
<el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button> <el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button> <el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div> </div>
...@@ -26,19 +26,19 @@ ...@@ -26,19 +26,19 @@
<el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh" @selection-change="handleSelectionChange"> <el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" /> <el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="area" label="资讯分类" width="200" /> <el-table-column prop="type" label="资讯分类" width="200" :formatter="(row, col, val)=>{return dict.label.information_type[val]}" />
<el-table-column prop="xxx" label="标题" /> <el-table-column prop="title" label="标题" />
<el-table-column label="状态" width="100"> <el-table-column label="状态" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.issue_status[scope.row.status] }}</div> <div :style="'color:'+textColors[scope.row.status]">{{ dict.label.issue_status[scope.row.status] }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="xxx" label="最后维护日期" align="center" width="200" /> <el-table-column prop="updateTime" label="最后维护日期" align="center" width="200" />
<el-table-column prop="xxx" 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="toEdit(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 type="primary" icon="el-icon-edit-outline" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip content="编辑"><el-button round plain type="primary" icon="el-icon-edit-outline" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip content="查看"><el-button round plain icon="el-icon-view" @click="toEdit(scope.row)" /></el-tooltip> <el-tooltip content="查看"><el-button round plain icon="el-icon-view" @click="toView(scope.row)" /></el-tooltip>
<el-tooltip content="删除"><el-button round plain type="danger" icon="el-icon-delete" @click="toDelete(scope.row)" /></el-tooltip> <el-tooltip content="删除"><el-button round plain type="danger" icon="el-icon-delete" @click="toDelete(scope.row)" /></el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
...@@ -84,50 +84,56 @@ export default { ...@@ -84,50 +84,56 @@ export default {
this.multipleSelection = val this.multipleSelection = val
}, },
loadData() { loadData() {
var sort = 'id,desc' Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
var param = { ...this.query } if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
param.page = this.page })
param.pageSize = this.pageSize HttpReq.backstageApi.queryNewsPage({
param.sort = sort page: this.page - 1,
this.tableData = [ pageSize: this.pageSize,
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' }, ...this.query
{ username: '张三', area: '火星', status: '2', enabled: false, xxx: '2023-05-09' }, }).then((res) => {
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' } this.tableData = res.data.data
] this.total = res.data.total
this.total = 2 })
}, },
batchOperate(opt) { batchOperate(type, row) {
if (!this.multipleSelection.length) { if (!row && !this.multipleSelection.length) {
return this.$message({ return this.$message({
message: '未选取数据', message: '未选取数据',
type: 'info' type: 'info'
}) })
} }
if (opt) { HttpReq.backstageApi.releaseNewsPage({
console.log('启用', this.multipleSelection) ids: row ? [row.newsPageId] : this.multipleSelection.map(item => { return item.newsPageId })
} else { }).then((res) => {
console.log('启用', this.multipleSelection) this.$notify({
} title: res.msg,
}, type: res.code === 200 ? 'success' : 'error',
changeEnabled(data, val) { duration: 2500
this.$confirm('此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?', '提示', { })
confirmButtonText: '确定', this.loadData()
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
data.enabled = !data.enabled
}) })
}, },
toAdd() { toAdd() {
this.$refs.addPage.loadData() this.$refs.addPage.loadData()
}, },
toEdit(item) { toEdit(item) {
this.$refs.addPage.loadData(item.newsPageId)
},
toView(item) {
// this.$refs.viewPage.loadData(item.homePageId)
}, },
toDelete(item) { toDelete(item) {
HttpReq.backstageApi.hpBatchDelete({
ids: [item.newsPageId]
}).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
......
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