Commit fad1579b authored by zhanglw's avatar zhanglw

资讯

parent 187ca533
...@@ -359,6 +359,36 @@ export const HttpReq = { ...@@ -359,6 +359,36 @@ export const HttpReq = {
return res return res
}) })
}, },
// 内容管理-修改资讯
updateNewsPage: function(data) {
return request({
url: '/api/bsw/newsPage/updateNewsPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-新增资讯
addNewsPage: function(data) {
return request({
url: '/api/bsw/newsPage/addNewsPage',
method: 'post',
data: data
}).then((res) => {
return res
})
},
// 内容管理-删除资讯
newsBatchDelete: function(data) {
return request({
url: '/api/bsw/newsPage/batchDelete',
method: 'delete',
data: data
}).then((res) => {
return res
})
},
xxx: null xxx: null
} }
} }
......
...@@ -203,7 +203,6 @@ ...@@ -203,7 +203,6 @@
<label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label> <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-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-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> </span>
</li> </li>
</ul> </ul>
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
</el-form-item> </el-form-item>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="标题:" class="form-cell" prop="productName"> <el-form-item label="标题:" class="form-cell" prop="title">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.title" placeholder="单行输入" class="cell-input" />
</div> </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="url">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.url" placeholder="单行输入" class="cell-input" />
</div> </div>
</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">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
ref="uploadCom" ref="uploadCom"
action="/api/bsw/common/uploadPicture" action="/api/bsw/common/uploadPicture"
name="multipartFile" name="multipartFile"
:data="{mark:'logo'}" :data="{mark:'news'}"
list-type="picture-card" list-type="picture-card"
:headers="uploadHeaders" :headers="uploadHeaders"
:limit="1" :limit="1"
...@@ -57,22 +57,24 @@ ...@@ -57,22 +57,24 @@
<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> <div style="display: block;clear: both">{{ formData.picture }}</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="source">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.source" placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-show="formData.type<4" label="内容:" class="form-cell" prop="productDescribe"> <el-form-item v-show="formData.type<4" label="内容:" class="form-cell" prop="content">
<div class="cell-box"> <div class="cell-box">
<div ref="editor" class="editor" /> <div ref="editor" class="editor" />
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="text" @click="cancelView">取消</el-button> <el-button @click="cancelView">关闭</el-button>
<!-- <el-button type="danger" @click="submitForm()">预览</el-button>-->
<el-button type="primary" @click="submitForm()">保存</el-button> <el-button type="primary" @click="submitForm()">保存</el-button>
<el-button v-if="formData.newsPageId" type="success" @click="submitForm(true)">发布</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
...@@ -98,34 +100,13 @@ export default { ...@@ -98,34 +100,13 @@ export default {
visible: false, visible: false,
title: '资讯信息内容设置', title: '资讯信息内容设置',
formData: { formData: {
productId: null, newsPageId: null,
customerId: null, // 供应商id title: '', // 标题
enterpriseName: '', // 供应商名称 type: '', // 类型
productName: '', // 产品名称 source: '', // 来源
productType: '1', // 产品大类 content: '', // 内容
productSubType: null, // 产品小类 picture: '', // 图片
minPrice: null, // 价格区间-小 url: '' // 链接
maxPrice: null, // 价格区间-大
productFeature: null, // 产品特点
productPic: '', // 产品图片
productDescribe: '', // 产品描述(富文本)
notes: null, // 其他说明
letterOfCommitment: false, // 交易保障承诺
attributeBrand: '', // 属性-品牌
attributeConsumptionCurrent: '', // 属性-消耗电流
attributeProductName: '', // 属性-产品名称
attributeRatedPower: '', // 属性-额定功率
attributeModel: '', // 属性-型号
attributeReactionTime: '', // 属性-反应时间
attributeWorkingVoltage: '', // 属性-工作电压
attributeEncapsulation: '', // 属性-封装
attributeQualityAssurance: '', // 属性-质量保证
attributeProducingArea: '', // 属性-产地
attributeNumber: '', // 属性-数量
attributeColor: '', // 属性-颜色
attributeApplicableScenarios: '', // 属性-品牌
attributeBatchNumber: '', // 属性-批号
rank: '1' // 产品品级
}, },
rules: {} rules: {}
} }
...@@ -146,7 +127,7 @@ export default { ...@@ -146,7 +127,7 @@ export default {
}) })
}, },
handlePushClick(event) { handlePushClick(event) {
if (this.formData.partnerLogo !== '') { if (this.formData.picture !== '') {
event.stopPropagation() event.stopPropagation()
this.$message({ this.$message({
message: '超出最大上传数量限制', message: '超出最大上传数量限制',
...@@ -154,9 +135,15 @@ export default { ...@@ -154,9 +135,15 @@ export default {
}) })
} }
}, },
handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.picture.split(';')
arr.splice(arr.indexOf(item), 1)
this.formData.picture = arr.join(';')
},
handleRemove(file, fileList) { handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({ HttpReq.backstageApi.deletePicture({
productPic: file.response.productPic multipartFile: file.response.pictures
}).then((res) => { }).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
...@@ -165,9 +152,9 @@ export default { ...@@ -165,9 +152,9 @@ export default {
}) })
const arr = [] const arr = []
fileList.forEach(item => { fileList.forEach(item => {
arr.push(item.response.productPic) arr.push(item.response.pictures)
}) })
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
}) })
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
...@@ -176,9 +163,9 @@ export default { ...@@ -176,9 +163,9 @@ export default {
}, },
handleImported(response, file, fileList) { handleImported(response, file, fileList) {
this.$nextTick(() => { this.$nextTick(() => {
const arr = this.formData.productPic ? this.formData.productPic.split(';') : [] const arr = this.formData.picture ? this.formData.picture.split(';') : []
arr.push(response.productPic) arr.push(response.pictures)
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
this.$notify({ this.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -198,12 +185,22 @@ export default { ...@@ -198,12 +185,22 @@ export default {
} }
this.$refs.formViewRef.resetFields() this.$refs.formViewRef.resetFields()
this.visible = false this.visible = false
this.imgList = []
this.formData = {
newsPageId: null,
title: '', // 标题
type: '', // 类型
source: '', // 来源
content: '', // 内容
picture: '', // 图片
url: '' // 链接
}
}, },
cancelView() { cancelView() {
this.hideView() this.hideView()
}, },
release() { release() {
HttpReq.backstageApi.releaseHomePage({ ids: [this.formData.homePageId] }).then((res) => { HttpReq.backstageApi.releaseNewsPage({ ids: [this.formData.newsPageId] }).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: res.code === 200 ? 'success' : 'error', type: res.code === 200 ? 'success' : 'error',
...@@ -218,8 +215,8 @@ export default { ...@@ -218,8 +215,8 @@ export default {
submitForm(isRelease) { submitForm(isRelease) {
this.$refs.formViewRef.validate((valid, obj) => { this.$refs.formViewRef.validate((valid, obj) => {
if (valid) { if (valid) {
if (this.formData.homePageId) { if (this.formData.newsPageId) {
HttpReq.backstageApi.updateHomePage(this.formData).then((res) => { HttpReq.backstageApi.updateNewsPage(this.formData).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: res.code === 200 ? 'success' : 'error' type: res.code === 200 ? 'success' : 'error'
...@@ -234,7 +231,7 @@ export default { ...@@ -234,7 +231,7 @@ export default {
} }
}) })
} else { } else {
HttpReq.backstageApi.addHomePage(this.formData).then((res) => { HttpReq.backstageApi.addNewsPage(this.formData).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: res.code === 200 ? 'success' : 'error' type: res.code === 200 ? 'success' : 'error'
...@@ -259,6 +256,7 @@ export default { ...@@ -259,6 +256,7 @@ export default {
}, },
loadData(newsPageId) { loadData(newsPageId) {
this.showView() this.showView()
this.$nextTick(() => {
if (!this.editor) { if (!this.editor) {
const _this = this const _this = this
const editor = new E(this.$refs.editor) const editor = new E(this.$refs.editor)
...@@ -273,18 +271,19 @@ export default { ...@@ -273,18 +271,19 @@ export default {
}) })
} }
editor.config.onchange = (html) => { editor.config.onchange = (html) => {
this.formData.productDescribe = html this.formData.content = html
} }
editor.create() editor.create()
this.editor = editor this.editor = editor
} }
if (newsPageId) { if (newsPageId) {
HttpReq.backstageApi.queryHomePageById({ newsPageId }).then((res) => { HttpReq.backstageApi.queryNewsPageById({ newsPageId }).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.partnerLogo) { if (this.formData.picture) {
this.imgList = this.formData.partnerLogo.split(';') this.imgList = this.formData.picture.split(';')
} }
this.editor.txt.html(this.formData.content)
} else { } else {
this.$message({ this.$message({
message: res.msg, message: res.msg,
...@@ -293,6 +292,7 @@ export default { ...@@ -293,6 +292,7 @@ export default {
} }
}) })
} }
})
} }
} }
} }
......
...@@ -47,15 +47,17 @@ ...@@ -47,15 +47,17 @@
<el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" /> <el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" />
</div> </div>
<add-page ref="addPage" /> <add-page ref="addPage" />
<view-page ref="viewPage" />
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common' import { HttpReq } from '@/api/common'
import DateRangePicker from '@/components/DateRangePicker' import DateRangePicker from '@/components/DateRangePicker'
import addPage from './add' import addPage from './add'
import viewPage from './view'
export default { export default {
components: { DateRangePicker, addPage }, components: { DateRangePicker, addPage, viewPage },
dicts: ['issue_status', 'information_type'], dicts: ['issue_status', 'information_type'],
data() { data() {
return { return {
...@@ -121,10 +123,10 @@ export default { ...@@ -121,10 +123,10 @@ export default {
this.$refs.addPage.loadData(item.newsPageId) this.$refs.addPage.loadData(item.newsPageId)
}, },
toView(item) { toView(item) {
// this.$refs.viewPage.loadData(item.homePageId) this.$refs.viewPage.loadData(item.newsPageId)
}, },
toDelete(item) { toDelete(item) {
HttpReq.backstageApi.hpBatchDelete({ HttpReq.backstageApi.newsBatchDelete({
ids: [item.newsPageId] ids: [item.newsPageId]
}).then((res) => { }).then((res) => {
this.$notify({ this.$notify({
......
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