|
|
@ -14,6 +14,14 @@ |
|
|
|
</router-link> |
|
|
|
</router-link> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-tabs v-model="articleCatetoryId"> |
|
|
|
|
|
|
|
<el-tab-pane |
|
|
|
|
|
|
|
:label="item.name" |
|
|
|
|
|
|
|
:name="item.id+''" |
|
|
|
|
|
|
|
v-for="item in articleCatetoryList" |
|
|
|
|
|
|
|
:key="item.id"> |
|
|
|
|
|
|
|
</el-tab-pane> |
|
|
|
|
|
|
|
</el-tabs> |
|
|
|
<!--表单组件--> |
|
|
|
<!--表单组件--> |
|
|
|
<!--<eForm ref="form" :is-add="isAdd" />--> |
|
|
|
<!--<eForm ref="form" :is-add="isAdd" />--> |
|
|
|
<!--表格渲染--> |
|
|
|
<!--表格渲染--> |
|
|
@ -23,35 +31,70 @@ |
|
|
|
<el-table-column prop="author" label="作者" /> |
|
|
|
<el-table-column prop="author" label="作者" /> |
|
|
|
<el-table-column ref="table" prop="imageInput" label="封面"> |
|
|
|
<el-table-column ref="table" prop="imageInput" label="封面"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a :href="scope.row.imageInput" style="color: #42b983" target="_blank"><img :src="scope.row.imageInput" alt="点击打开" class="el-avatar"></a> |
|
|
|
<a :href="scope.row.imageInput" style="color: #42b983" target="_blank"> |
|
|
|
|
|
|
|
<el-image style="width: 60px; height: 60px" :src="scope.row.imageInput" alt="点击打开" fit="cover"></el-image> |
|
|
|
|
|
|
|
</a> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="是否热门"> |
|
|
|
<el-table-column :show-overflow-tooltip="true" label="是否热门"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-tag type="info" v-if="scope.row.isHot == 0">否</el-tag> |
|
|
|
<el-popover |
|
|
|
<el-tag type="success" v-if="scope.row.isHot == 1">是</el-tag> |
|
|
|
:ref="'hot'+scope.row.id" |
|
|
|
|
|
|
|
placement="top" |
|
|
|
|
|
|
|
width="180" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<p>{{scope.row.isHot == 0 ? '是否确认设置为热门?' : '是否确认取消热门?'}}</p> |
|
|
|
|
|
|
|
<div style="text-align: right; margin: 0"> |
|
|
|
|
|
|
|
<el-button size="mini" type="text" @click="$refs['hot'+scope.row.id].doClose()">取消</el-button> |
|
|
|
|
|
|
|
<el-button :loading="setLoading" type="primary" size="mini" @click="recommendClick(scope.row,'hot')">确定</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<el-tag |
|
|
|
|
|
|
|
:type="scope.row.isHot == 0 ? 'danger' : 'success'" |
|
|
|
|
|
|
|
slot="reference" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{{scope.row.isHot == 0 ? '否' : '是'}} |
|
|
|
|
|
|
|
</el-tag> |
|
|
|
|
|
|
|
</el-popover> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="是否推荐"> |
|
|
|
<el-table-column :show-overflow-tooltip="true" label="是否推荐"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-tag type="info" v-if="scope.row.isRecommend == 0">否</el-tag> |
|
|
|
<el-popover |
|
|
|
<el-tag type="success" v-if="scope.row.isRecommend == 1">是</el-tag> |
|
|
|
:ref="'popover'+scope.row.id" |
|
|
|
|
|
|
|
placement="top" |
|
|
|
|
|
|
|
width="180" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<p>{{scope.row.isRecommend == 0 ? '是否确认设置为推荐?' : '是否确认取消推荐?'}}</p> |
|
|
|
|
|
|
|
<div style="text-align: right; margin: 0"> |
|
|
|
|
|
|
|
<el-button size="mini" type="text" @click="$refs['popover'+scope.row.id].doClose()">取消</el-button> |
|
|
|
|
|
|
|
<el-button :loading="setLoading" type="primary" size="mini" @click="recommendClick(scope.row,'recommend')">确定</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<el-tag |
|
|
|
|
|
|
|
:type="scope.row.isRecommend == 0 ? 'danger' : 'success'" |
|
|
|
|
|
|
|
style="cursor:pointer;" |
|
|
|
|
|
|
|
slot="reference" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{{scope.row.isRecommend == 0 ? '否' : '是'}} |
|
|
|
|
|
|
|
</el-tag> |
|
|
|
|
|
|
|
</el-popover> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建日期"> |
|
|
|
<el-table-column :show-overflow-tooltip="true" label="创建日期"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.createTime }}</span> |
|
|
|
<span>{{ scope.row.createTime }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="checkPermission(['admin','YXARTICLE_ALL','YXARTICLE_EDIT','YXARTICLE_DELETE'])" label="操作" width="220px" align="center"> |
|
|
|
<el-table-column v-if="checkPermission(['admin','YXARTICLE_ALL','YXARTICLE_EDIT','YXARTICLE_DELETE'])" label="操作" width="220px" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button v-permission="['admin','YXARTICLE_ALL','YXARTICLE_EDIT']" size="mini" |
|
|
|
|
|
|
|
type="primary" icon="el-icon-edit" |
|
|
|
<router-link :to="'/information/form/'+scope.row.id"> |
|
|
|
> |
|
|
|
<el-button |
|
|
|
<router-link :to="'/information/form/'+scope.row.id"> |
|
|
|
v-permission="['admin','YXARTICLE_ALL','YXARTICLE_EDIT']" |
|
|
|
编辑 |
|
|
|
size="mini" |
|
|
|
</router-link> |
|
|
|
type="primary" icon="el-icon-edit" |
|
|
|
|
|
|
|
> 编辑 |
|
|
|
</el-button> |
|
|
|
</el-button> |
|
|
|
|
|
|
|
</router-link> |
|
|
|
<el-popover |
|
|
|
<el-popover |
|
|
|
:ref="scope.row.id" |
|
|
|
:ref="scope.row.id" |
|
|
|
v-permission="['admin','YXARTICLE_ALL','YXARTICLE_DELETE']" |
|
|
|
v-permission="['admin','YXARTICLE_ALL','YXARTICLE_DELETE']" |
|
|
@ -96,7 +139,7 @@ |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import checkPermission from '@/utils/permission' |
|
|
|
import checkPermission from '@/utils/permission' |
|
|
|
import initData from '@/mixins/crud' |
|
|
|
import initData from '@/mixins/crud' |
|
|
|
import { del, publish } from '@/api/yxArticle' |
|
|
|
import { del, publish, edit } from '@/api/yxArticle' |
|
|
|
import eForm from './form' |
|
|
|
import eForm from './form' |
|
|
|
import { formatTime } from '@/utils/index' |
|
|
|
import { formatTime } from '@/utils/index' |
|
|
|
export default { |
|
|
|
export default { |
|
|
@ -104,7 +147,10 @@ export default { |
|
|
|
mixins: [initData], |
|
|
|
mixins: [initData], |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
delLoading: false |
|
|
|
delLoading: false, |
|
|
|
|
|
|
|
articleCatetoryId: null, |
|
|
|
|
|
|
|
articleCatetoryList: [], |
|
|
|
|
|
|
|
setLoading: false |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
created() { |
|
|
@ -112,13 +158,47 @@ export default { |
|
|
|
this.init() |
|
|
|
this.init() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
mounted(){ |
|
|
|
|
|
|
|
this.getArticleCatetory() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
|
|
|
|
articleCatetoryId(newVal,oldVal){ |
|
|
|
|
|
|
|
this.init() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
//获取分类 |
|
|
|
|
|
|
|
getArticleCatetory(){ |
|
|
|
|
|
|
|
this.$http('api/articleCatetory').then((res)=>{ |
|
|
|
|
|
|
|
this.articleCatetoryList = res.content.reverse() |
|
|
|
|
|
|
|
this.articleCatetoryId = res.content[0].id + '' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//热门,推荐设置 |
|
|
|
|
|
|
|
recommendClick(row, type){ |
|
|
|
|
|
|
|
this.setLoading = true |
|
|
|
|
|
|
|
type == 'hot' ? row.isHot = row.isHot == 0 ? 1 : 0 : row.isRecommend = row.isRecommend == 0 ? 1 : 0 |
|
|
|
|
|
|
|
edit(row).then((res)=>{ |
|
|
|
|
|
|
|
type == 'hot' ? this.$refs['hot'+row.id].doClose() : this.$refs['popover'+row.id].doClose() |
|
|
|
|
|
|
|
this.setLoading = false |
|
|
|
|
|
|
|
this.$notify({ |
|
|
|
|
|
|
|
title: '修改成功', |
|
|
|
|
|
|
|
type: 'success', |
|
|
|
|
|
|
|
duration: 2500 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
formatTime, |
|
|
|
formatTime, |
|
|
|
checkPermission, |
|
|
|
checkPermission, |
|
|
|
beforeInit() { |
|
|
|
beforeInit() { |
|
|
|
this.url = 'api/yxArticle' |
|
|
|
this.url = 'api/yxArticle' |
|
|
|
const sort = 'id,desc' |
|
|
|
const sort = 'id,desc' |
|
|
|
this.params = { page: this.page, size: this.size, sort: sort } |
|
|
|
this.params = { |
|
|
|
|
|
|
|
page: this.page, |
|
|
|
|
|
|
|
size: this.size, |
|
|
|
|
|
|
|
sort: sort, |
|
|
|
|
|
|
|
cid: this.articleCatetoryId |
|
|
|
|
|
|
|
} |
|
|
|
return true |
|
|
|
return true |
|
|
|
}, |
|
|
|
}, |
|
|
|
subDelete(id) { |
|
|
|
subDelete(id) { |
|
|
@ -196,6 +276,8 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
<style> |
|
|
|
|
|
|
|
.cell .el-tag{ |
|
|
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|