Commit fad1579b authored by zhanglw's avatar zhanglw

资讯

parent 187ca533
......@@ -359,6 +359,36 @@ export const HttpReq = {
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
}
}
......
......@@ -203,7 +203,6 @@
<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>
......
......@@ -11,14 +11,14 @@
</el-form-item>
</div>
</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">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.title" placeholder="单行输入" class="cell-input" />
</div>
</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">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.url" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic">
......@@ -40,7 +40,7 @@
ref="uploadCom"
action="/api/bsw/common/uploadPicture"
name="multipartFile"
:data="{mark:'logo'}"
:data="{mark:'news'}"
list-type="picture-card"
:headers="uploadHeaders"
:limit="1"
......@@ -57,22 +57,24 @@
<img width="100%" :src="dialogImageUrl">
</el-dialog>
</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 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">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.source" placeholder="单行输入" class="cell-input" />
</div>
</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 ref="editor" class="editor" />
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancelView">取消</el-button>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelView">关闭</el-button>
<!-- <el-button type="danger" @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>
</el-dialog>
</template>
......@@ -98,34 +100,13 @@ export default {
visible: false,
title: '资讯信息内容设置',
formData: {
productId: null,
customerId: null, // 供应商id
enterpriseName: '', // 供应商名称
productName: '', // 产品名称
productType: '1', // 产品大类
productSubType: null, // 产品小类
minPrice: null, // 价格区间-小
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' // 产品品级
newsPageId: null,
title: '', // 标题
type: '', // 类型
source: '', // 来源
content: '', // 内容
picture: '', // 图片
url: '' // 链接
},
rules: {}
}
......@@ -146,7 +127,7 @@ export default {
})
},
handlePushClick(event) {
if (this.formData.partnerLogo !== '') {
if (this.formData.picture !== '') {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
......@@ -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) {
HttpReq.backstageApi.deleteProductPic({
productPic: file.response.productPic
HttpReq.backstageApi.deletePicture({
multipartFile: file.response.pictures
}).then((res) => {
this.$notify({
title: res.msg,
......@@ -165,9 +152,9 @@ export default {
})
const arr = []
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) {
......@@ -176,9 +163,9 @@ export default {
},
handleImported(response, file, fileList) {
this.$nextTick(() => {
const arr = this.formData.productPic ? this.formData.productPic.split(';') : []
arr.push(response.productPic)
this.formData.productPic = arr.join(';')
const arr = this.formData.picture ? this.formData.picture.split(';') : []
arr.push(response.pictures)
this.formData.picture = arr.join(';')
this.$notify({
title: '上传成功!',
type: 'success',
......@@ -198,12 +185,22 @@ export default {
}
this.$refs.formViewRef.resetFields()
this.visible = false
this.imgList = []
this.formData = {
newsPageId: null,
title: '', // 标题
type: '', // 类型
source: '', // 来源
content: '', // 内容
picture: '', // 图片
url: '' // 链接
}
},
cancelView() {
this.hideView()
},
release() {
HttpReq.backstageApi.releaseHomePage({ ids: [this.formData.homePageId] }).then((res) => {
HttpReq.backstageApi.releaseNewsPage({ ids: [this.formData.newsPageId] }).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
......@@ -218,8 +215,8 @@ export default {
submitForm(isRelease) {
this.$refs.formViewRef.validate((valid, obj) => {
if (valid) {
if (this.formData.homePageId) {
HttpReq.backstageApi.updateHomePage(this.formData).then((res) => {
if (this.formData.newsPageId) {
HttpReq.backstageApi.updateNewsPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error'
......@@ -234,7 +231,7 @@ export default {
}
})
} else {
HttpReq.backstageApi.addHomePage(this.formData).then((res) => {
HttpReq.backstageApi.addNewsPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error'
......@@ -259,6 +256,7 @@ export default {
},
loadData(newsPageId) {
this.showView()
this.$nextTick(() => {
if (!this.editor) {
const _this = this
const editor = new E(this.$refs.editor)
......@@ -273,18 +271,19 @@ export default {
})
}
editor.config.onchange = (html) => {
this.formData.productDescribe = html
this.formData.content = html
}
editor.create()
this.editor = editor
}
if (newsPageId) {
HttpReq.backstageApi.queryHomePageById({ newsPageId }).then((res) => {
HttpReq.backstageApi.queryNewsPageById({ 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(';')
if (this.formData.picture) {
this.imgList = this.formData.picture.split(';')
}
this.editor.txt.html(this.formData.content)
} else {
this.$message({
message: res.msg,
......@@ -293,6 +292,7 @@ export default {
}
})
}
})
}
}
}
......
......@@ -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" />
</div>
<add-page ref="addPage" />
<view-page ref="viewPage" />
</div>
</template>
<script>
import { HttpReq } from '@/api/common'
import DateRangePicker from '@/components/DateRangePicker'
import addPage from './add'
import viewPage from './view'
export default {
components: { DateRangePicker, addPage },
components: { DateRangePicker, addPage, viewPage },
dicts: ['issue_status', 'information_type'],
data() {
return {
......@@ -121,10 +123,10 @@ export default {
this.$refs.addPage.loadData(item.newsPageId)
},
toView(item) {
// this.$refs.viewPage.loadData(item.homePageId)
this.$refs.viewPage.loadData(item.newsPageId)
},
toDelete(item) {
HttpReq.backstageApi.hpBatchDelete({
HttpReq.backstageApi.newsBatchDelete({
ids: [item.newsPageId]
}).then((res) => {
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