Commit 187ca533 authored by zhanglw's avatar zhanglw

资讯

parent 4bf9f221
......@@ -335,6 +335,30 @@ export const HttpReq = {
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
}
}
......
......@@ -23,24 +23,41 @@
</el-form-item>
<el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic">
<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
ref="uploadCom"
action="/api/bsw/product/uploadProductPic"
name="productPic"
action="/api/bsw/common/uploadPicture"
name="multipartFile"
:data="{mark:'logo'}"
list-type="picture-card"
:headers="uploadHeaders"
:limit="5"
:limit="1"
:on-exceed="handleExceed"
:on-success="handleImported"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i class="el-icon-plus" />
<div slot="trigger" @click="handlePushClick($event)">
<i class="el-icon-plus" />
</div>
</el-upload>
<el-dialog append-to-body :visible.sync="dialogImageVisible">
<img width="100%" :src="dialogImageUrl">
</el-dialog>
</div>
<div style="display: block;clear: both">{{ formData.partnerLogo }}</div>
</el-form-item>
<el-form-item v-show="formData.type<4" label="来源:" class="form-cell" prop="productName">
<div class="cell-box">
......@@ -75,8 +92,11 @@ export default {
editor: false, // 富文本对象
dialogImageUrl: '',
dialogImageVisible: false,
imgList: [],
dialogImgUrl: '',
dialogImgVisible: false,
visible: false,
title: '添加资讯信息',
title: '资讯信息内容设置',
formData: {
productId: null,
customerId: null, // 供应商id
......@@ -125,6 +145,15 @@ export default {
type: 'info'
})
},
handlePushClick(event) {
if (this.formData.partnerLogo !== '') {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
}
},
handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({
productPic: file.response.productPic
......@@ -161,28 +190,65 @@ export default {
this.visible = true
},
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.editor.txt.clear()
this.visible = false
},
cancelView() {
this.hideView()
},
submitForm() {
this.$refs.formViewRef.validate(valid => {
release() {
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) {
HttpReq.backstageApi.addProduct(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: 'success',
duration: 2500
if (this.formData.homePageId) {
HttpReq.backstageApi.updateHomePage(this.formData).then((res) => {
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()
}
}
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
} else {
HttpReq.backstageApi.addHomePage(this.formData).then((res) => {
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 {
this.$message({
message: '表单信息有误,请核对无误后提交!',
......@@ -191,16 +257,9 @@ export default {
}
})
},
changeProductType() {
this.formData.productSubType = null
this.productSubTypeOpts = this.dict['product_type_' + this.formData.productType]
},
loadData() {
loadData(newsPageId) {
this.showView()
if (this.editor) {
return
}
this.$nextTick(() => {
if (!this.editor) {
const _this = this
const editor = new E(this.$refs.editor)
editor.config.zIndex = 5
......@@ -217,10 +276,23 @@ export default {
this.formData.productDescribe = html
}
editor.create()
// 初始化数据
editor.txt.html(this.formData.productDescribe)
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 @@
<div class="app-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-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-option v-for="item in dict.issue_status" :key="item.value" :label="item.label" :value="item.value" />
</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="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div>
......@@ -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-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="area" label="资讯分类" width="200" />
<el-table-column prop="xxx" label="标题" />
<el-table-column prop="type" label="资讯分类" width="200" :formatter="(row, col, val)=>{return dict.label.information_type[val]}" />
<el-table-column prop="title" label="标题" />
<el-table-column label="状态" width="100">
<template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.issue_status[scope.row.status] }}</div>
</template>
</el-table-column>
<el-table-column prop="xxx" label="最后维护日期" align="center" width="200" />
<el-table-column prop="xxx" label="操作" align="right" width="240">
<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="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 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>
</template>
</el-table-column>
......@@ -84,50 +84,56 @@ export default {
this.multipleSelection = val
},
loadData() {
var sort = 'id,desc'
var param = { ...this.query }
param.page = this.page
param.pageSize = this.pageSize
param.sort = sort
this.tableData = [
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' },
{ username: '张三', area: '火星', status: '2', enabled: false, xxx: '2023-05-09' },
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' }
]
this.total = 2
Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
})
HttpReq.backstageApi.queryNewsPage({
page: this.page - 1,
pageSize: this.pageSize,
...this.query
}).then((res) => {
this.tableData = res.data.data
this.total = res.data.total
})
},
batchOperate(opt) {
if (!this.multipleSelection.length) {
batchOperate(type, row) {
if (!row && !this.multipleSelection.length) {
return this.$message({
message: '未选取数据',
type: 'info'
})
}
if (opt) {
console.log('启用', this.multipleSelection)
} else {
console.log('启用', this.multipleSelection)
}
},
changeEnabled(data, val) {
this.$confirm('此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
data.enabled = !data.enabled
HttpReq.backstageApi.releaseNewsPage({
ids: row ? [row.newsPageId] : this.multipleSelection.map(item => { return item.newsPageId })
}).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
this.loadData()
})
},
toAdd() {
this.$refs.addPage.loadData()
},
toEdit(item) {
this.$refs.addPage.loadData(item.newsPageId)
},
toView(item) {
// this.$refs.viewPage.loadData(item.homePageId)
},
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() {
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