Commit 1785f837 authored by xhx's avatar xhx

fix: news

parent b7170d35
......@@ -52,6 +52,9 @@ export default Vue.extend({
this.imageUrl = newV
}
},
created() {
this.imageUrl = this.path
},
data(){
return{
imageUrl: "",
......
......@@ -47,7 +47,8 @@ export default Vue.extend({
},
extensions: [StarterKit, Timage],
autofocus: "start",
});
})
this.editor.commands.setContent(this.text)
},
beforeDestroy() {
this.editor.destroy();
......
......@@ -4,7 +4,7 @@
<!-- 搜索框 -->
<a-input placeholder="标题模糊搜索" v-model="searchPageReqParams.title" style="width: 150px; margin-right:10px;"/>
<!-- timepicker -->
<span class=" font-semibold">注册时间:</span>
<span class=" font-semibold">发布时间:</span>
<timerange class=" mr-3" :startTime="searchPageReqParams.start_time" :endTime="searchPageReqParams.end_time"
@getNewTime="getNewTime"/>
<!-- 咨询分类 -->
......@@ -53,13 +53,13 @@
@click="remove(record)">
下架
</a>
<a-divider type="vertical" />
<a-divider v-show="record.article_status==1" type="vertical" />
<a v-show="record.article_status==1"
@click="release(record.uuid, searchPageReqParams.article_type)">
@click="release(record, searchPageReqParams.article_type)">
编辑
</a>
<a-divider v-show="record.article_status==1" type="vertical" />
<a @click="onDelete(record)">
<a v-show="record.article_status==1" @click="onDelete(record)">
删除
</a>
</span>
......@@ -190,9 +190,9 @@ export default Vue.extend({
this.searchPageReqParams.end_time = undefined
this. query()
},
release(key?:string, type?:string){
if (key && type) {
this.$router.push({name:'publishNews', query: {key, type}})
release(item?: any, type?:string){
if (item && type) {
this.$router.push({name:'publishNews', query: {msg: JSON.stringify(item), type}})
} else {
this.$router.push({name:'publishNews'})
}
......
......@@ -66,22 +66,26 @@ export default Vue.extend({
},
methods:{
getDetails() {
// 新增
if (Object.keys(this.$route.query).length === 0) {
this.type = undefined
return
}
const type = this.$route.query.type
const id = this.$route.query.key as string
this.type = +type
if (+type === 1) {
news.searchPolicy(id).then(res => {
this.initData(res.data)
})
} else {
news.searchNews(id).then(res => {
this.initData(res.data)
})
}
const msg = JSON.parse(this.$route.query.msg as string)
this.initData(msg)
// 编辑
// if (+type === 1) {
// news.searchPolicy(id).then(res => {
// this.initData(res.data)
// })
// } else {
// news.searchNews(id).then(res => {
// this.initData(res.data)
// })
// }
},
initData(res: any) {
this.title = res.title
......@@ -90,6 +94,8 @@ export default Vue.extend({
this.imageUrl = new FileService().getImageSrc(res.file_name)
this.summary = res.desc
this.editableContent = res.content
console.log('res', res)
console.log('imageUrl', this.imageUrl)
},
getContent(value:string){
this.content = value
......@@ -115,6 +121,7 @@ export default Vue.extend({
})
},
editForm() {
const msg = JSON.parse(this.$route.query.msg as string)
const params = {
article_type: this.type,
content: this.content,
......@@ -122,7 +129,7 @@ export default Vue.extend({
file_name: this.imgUrl,
title: this.title,
writer: this.author,
uuid: this.$route.query.key as string
uuid: msg.uuid as string
}
news.editArticle(params).then(res => {
if (res.code === 200) {
......@@ -133,7 +140,7 @@ export default Vue.extend({
},
onSubmit() {
console.log(this.content)
if (this.$route.query.key) {
if (this.$route.query.msg) {
this.editForm()
} else {
this.addForm()
......
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