|
@ -3,7 +3,7 @@ |
|
|
<el-card class="box-card"> |
|
|
<el-card class="box-card"> |
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<!--部门数据--> |
|
|
<!--部门数据--> |
|
|
<el-col :span="4" :xs="24"> |
|
|
|
|
|
|
|
|
<el-col :span="3" :xs="24"> |
|
|
<div class="head-container"> |
|
|
<div class="head-container"> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="deptName" |
|
|
v-model="deptName" |
|
@ -125,6 +125,22 @@ |
|
|
<span>{{ row.url }}</span> |
|
|
<span>{{ row.url }}</span> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="文章状态" align="center"> |
|
|
|
|
|
<template slot-scope="{ row }"> |
|
|
|
|
|
<div> |
|
|
|
|
|
<el-switch |
|
|
|
|
|
style="display: block" |
|
|
|
|
|
v-model="row.is_offline" |
|
|
|
|
|
active-color="#409EFF" |
|
|
|
|
|
inactive-color="#ff4949" |
|
|
|
|
|
:active-value="2" |
|
|
|
|
|
:inactive-value="1" |
|
|
|
|
|
@change="changeSwitch($event, row)" |
|
|
|
|
|
> |
|
|
|
|
|
</el-switch> |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
<el-table-column label="标签详情"> |
|
|
<el-table-column label="标签详情"> |
|
|
<template slot-scope="{ row }"> |
|
|
<template slot-scope="{ row }"> |
|
|
<span>{{ row.label_name | getTagDetail }}</span> |
|
|
<span>{{ row.label_name | getTagDetail }}</span> |
|
@ -233,6 +249,12 @@ |
|
|
<el-form-item label="描述" prop="description"> |
|
|
<el-form-item label="描述" prop="description"> |
|
|
<el-input type="textarea" v-model="temp.description" /> |
|
|
<el-input type="textarea" v-model="temp.description" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="状态"> |
|
|
|
|
|
<el-radio-group v-model="temp.is_offline" @change="changeRadio"> |
|
|
|
|
|
<el-radio :label="2">上线</el-radio> |
|
|
|
|
|
<el-radio :label="1">下线</el-radio> |
|
|
|
|
|
</el-radio-group> |
|
|
|
|
|
</el-form-item> |
|
|
<el-form-item label="封面" prop="img" required> |
|
|
<el-form-item label="封面" prop="img" required> |
|
|
<img |
|
|
<img |
|
|
v-if="temp.img" |
|
|
v-if="temp.img" |
|
@ -308,6 +330,7 @@ import VueUeditorWrap from "vue-ueditor-wrap"; |
|
|
import { listCategory } from "@/api/category"; |
|
|
import { listCategory } from "@/api/category"; |
|
|
import Treeselect from "@riophae/vue-treeselect"; |
|
|
import Treeselect from "@riophae/vue-treeselect"; |
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
|
|
|
|
|
import { log } from "console"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: "articleIndex", |
|
|
name: "articleIndex", |
|
@ -321,6 +344,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 状态数据字典 |
|
|
// 状态数据字典 |
|
|
statusOptions: [ |
|
|
statusOptions: [ |
|
|
|
|
|
{ value: "", label: "全部" }, |
|
|
{ value: 2, label: "上线" }, |
|
|
{ value: 2, label: "上线" }, |
|
|
{ value: 1, label: "下线" }, |
|
|
{ value: 1, label: "下线" }, |
|
|
], |
|
|
], |
|
@ -332,7 +356,7 @@ export default { |
|
|
listQuery: { |
|
|
listQuery: { |
|
|
page: 1, |
|
|
page: 1, |
|
|
limit: 20, |
|
|
limit: 20, |
|
|
is_offline: 2, |
|
|
|
|
|
|
|
|
is_offline: "", |
|
|
title: "", |
|
|
title: "", |
|
|
label_name: "", |
|
|
label_name: "", |
|
|
category_id: undefined, |
|
|
category_id: undefined, |
|
@ -358,6 +382,7 @@ export default { |
|
|
content: "", |
|
|
content: "", |
|
|
description: "", |
|
|
description: "", |
|
|
video_time: "", |
|
|
video_time: "", |
|
|
|
|
|
is_offline: 2, |
|
|
}, |
|
|
}, |
|
|
dialogFullscreen: true, |
|
|
dialogFullscreen: true, |
|
|
dialogFormVisible: false, |
|
|
dialogFormVisible: false, |
|
@ -439,34 +464,22 @@ export default { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
changeRadio(e) { |
|
|
|
|
|
this.temp.is_offline = Number(e); |
|
|
|
|
|
}, |
|
|
|
|
|
// 文章开关发生变化 |
|
|
|
|
|
changeSwitch(e, item) { |
|
|
|
|
|
item.is_offline = Number(e); |
|
|
|
|
|
updateArticle(item).then((r) => { |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: "success", |
|
|
|
|
|
message: `${e == 2 ? "通知:文章上线成功" : "通知:文章下线成功"}`, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
// 验证图片宽高 |
|
|
// 验证图片宽高 |
|
|
async validationImages(file) { |
|
|
async validationImages(file) { |
|
|
let width = 0; |
|
|
|
|
|
let height = 0; |
|
|
|
|
|
console.log(this.temp); |
|
|
|
|
|
switch (this.temp.category_id) { |
|
|
|
|
|
case 23: //深度解说 |
|
|
|
|
|
width = 650; |
|
|
|
|
|
height = 350; |
|
|
|
|
|
break; |
|
|
|
|
|
case 25: //行情分析 |
|
|
|
|
|
width = 130; |
|
|
|
|
|
height = 130; |
|
|
|
|
|
break; |
|
|
|
|
|
case 24: //热点追踪 |
|
|
|
|
|
width = 130; |
|
|
|
|
|
height = 130; |
|
|
|
|
|
break; |
|
|
|
|
|
case 7: //基础教程 |
|
|
|
|
|
width = 380; |
|
|
|
|
|
height = 220; |
|
|
|
|
|
break; |
|
|
|
|
|
case 6: //图文教程 |
|
|
|
|
|
width = 380; |
|
|
|
|
|
height = 220; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
let res = await this.$getImgWidth(file, width, height); |
|
|
|
|
|
|
|
|
let res = await this.$getImgWidth(file, this.temp.category_id); |
|
|
this.validation = res; |
|
|
this.validation = res; |
|
|
return res; |
|
|
return res; |
|
|
}, |
|
|
}, |
|
@ -497,7 +510,11 @@ export default { |
|
|
getList() { |
|
|
getList() { |
|
|
this.listLoading = true; |
|
|
this.listLoading = true; |
|
|
fetchList(this.listQuery).then((response) => { |
|
|
fetchList(this.listQuery).then((response) => { |
|
|
console.log(response); |
|
|
|
|
|
|
|
|
response.data.list.forEach((item) => { |
|
|
|
|
|
// if (!item.is_offline) { |
|
|
|
|
|
// item.is_offline = 2; |
|
|
|
|
|
// } |
|
|
|
|
|
}); |
|
|
this.list = response.data.list; |
|
|
this.list = response.data.list; |
|
|
this.total = response.data.count; |
|
|
this.total = response.data.count; |
|
|
// Just to simulate the time of the request |
|
|
// Just to simulate the time of the request |
|
@ -524,6 +541,7 @@ export default { |
|
|
title: "", |
|
|
title: "", |
|
|
time: "", |
|
|
time: "", |
|
|
img: "", |
|
|
img: "", |
|
|
|
|
|
is_offline: 2, |
|
|
script_url: "", |
|
|
script_url: "", |
|
|
content: "", |
|
|
content: "", |
|
|
description: "", |
|
|
description: "", |
|
@ -572,6 +590,9 @@ export default { |
|
|
this.resetTemp(); |
|
|
this.resetTemp(); |
|
|
this.dialogFormVisible = true; |
|
|
this.dialogFormVisible = true; |
|
|
fetchArticleDetails({ article_id }).then((res) => { |
|
|
fetchArticleDetails({ article_id }).then((res) => { |
|
|
|
|
|
if (!res.data.is_offline) { |
|
|
|
|
|
res.data.is_offline = 2; |
|
|
|
|
|
} |
|
|
this.temp = res.data; |
|
|
this.temp = res.data; |
|
|
if (this.temp.label_name) { |
|
|
if (this.temp.label_name) { |
|
|
let data = JSON.parse(this.temp.label_name); |
|
|
let data = JSON.parse(this.temp.label_name); |
|
@ -631,7 +652,6 @@ export default { |
|
|
.catch(function () {}); |
|
|
.catch(function () {}); |
|
|
}, |
|
|
}, |
|
|
uploadSuccess(response, file) { |
|
|
uploadSuccess(response, file) { |
|
|
console.log(response); |
|
|
|
|
|
if (response.state == "SUCCESS" && this.validation) { |
|
|
if (response.state == "SUCCESS" && this.validation) { |
|
|
this.temp.img = response.url; |
|
|
this.temp.img = response.url; |
|
|
} |
|
|
} |
|
|