学习园地
This commit is contained in:
@@ -8,9 +8,9 @@
|
|||||||
<template slot="content">
|
<template slot="content">
|
||||||
<ai-search-bar>
|
<ai-search-bar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<el-radio-group v-model="search.categoryId">
|
<el-radio-group v-model="search.categoryId" @change="onChange">
|
||||||
<el-radio-button label="">全部</el-radio-button>
|
<el-radio-button label="">全部</el-radio-button>
|
||||||
<el-radio-button label="学院">我的收藏</el-radio-button>
|
<el-radio-button label="isFavorite">我的收藏</el-radio-button>
|
||||||
<el-radio-button :label="item.id" :key="item.id" v-for="item in cateList">{{ item.name }}</el-radio-button>
|
<el-radio-button :label="item.id" :key="item.id" v-for="item in cateList">{{ item.name }}</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</template>
|
</template>
|
||||||
@@ -25,10 +25,10 @@
|
|||||||
:size.sync="search.size"
|
:size.sync="search.size"
|
||||||
style="margin-top: 8px;"
|
style="margin-top: 8px;"
|
||||||
@getList="getList">
|
@getList="getList">
|
||||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="90px">
|
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
|
||||||
<template v-slot="{row}">
|
<template v-slot="{ row }">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
<el-button type="text">收藏</el-button>
|
<el-button type="text" @click="collection(row.id, row.isFavorite)">{{ row.isFavorite === '0' ? '收藏' : '已收藏' }}</el-button>
|
||||||
<el-button type="text" @click="toDetail(row.url)">详情</el-button>
|
<el-button type="text" @click="toDetail(row.url)">详情</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -46,13 +46,14 @@
|
|||||||
return {
|
return {
|
||||||
colConfigs: [
|
colConfigs: [
|
||||||
{ prop: 'title', label: '标题', align: 'left' },
|
{ prop: 'title', label: '标题', align: 'left' },
|
||||||
{ prop: 'subPurchaseOrderSn', label: '是否收藏', align: 'center' },
|
{ prop: 'isFavorite', label: '是否收藏', align: 'center', format: v => v === '0' ? '否' : '是' },
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
search: {
|
search: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
|
isFavorite: 0,
|
||||||
categoryId: ''
|
categoryId: ''
|
||||||
},
|
},
|
||||||
cateList: []
|
cateList: []
|
||||||
@@ -69,6 +70,33 @@
|
|||||||
window.open(url)
|
window.open(url)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChange (e) {
|
||||||
|
if (e === 'isFavorite') {
|
||||||
|
this.search.isFavorite = 1
|
||||||
|
} else {
|
||||||
|
this.search.isFavorite = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
this.search.current = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
|
||||||
|
collection (id, isFavorite) {
|
||||||
|
this.$confirm(isFavorite === '1' ? '确定收藏该文章?' : '确定取消收藏?', '温馨提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
callback: action => {
|
||||||
|
if (action === 'confirm') {
|
||||||
|
this.$http.post(isFavorite === '0' ? `/api/learning/addFavorite?id=${id}` : `/api/learning/delFavorite?id=${id}`).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(isFavorite === '1' ? '取消成功' : '收藏成功')
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
getCateList () {
|
getCateList () {
|
||||||
this.$http.post('/api/learningCategory/page?size=50').then(res => {
|
this.$http.post('/api/learningCategory/page?size=50').then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
@@ -80,7 +108,8 @@
|
|||||||
getList () {
|
getList () {
|
||||||
this.$http.post('/api/learning/pluginPage', null, {
|
this.$http.post('/api/learning/pluginPage', null, {
|
||||||
params: {
|
params: {
|
||||||
...this.search
|
...this.search,
|
||||||
|
categoryId: this.search.isFavorite === 1 ? '' : this.search.categoryId
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user