This commit is contained in:
yanran200730
2023-08-07 22:28:21 +08:00
parent 51b2b8c97f
commit 19f9f70f73
3 changed files with 22 additions and 12 deletions

View File

@@ -28,7 +28,7 @@
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="collection(row.id, row.isFavorite)">{{ row.isFavorite === '0' ? '收藏' : '收藏' }}</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>
</div>
</template>
@@ -53,10 +53,10 @@
search: {
current: 1,
size: 10,
isFavorite: 0,
categoryId: ''
},
cateList: []
cateList: [],
isFavorite: 0
}
},
@@ -72,13 +72,20 @@
onChange (e) {
if (e === 'isFavorite') {
this.search.isFavorite = 1
this.$http.post('/api/learning/favoritePage', null, {
params: {
...this.search
}
}).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
} else {
this.search.isFavorite = 0
this.search.current = 1
this.getList()
}
this.search.current = 1
this.getList()
},
collection (id, isFavorite) {
@@ -108,8 +115,7 @@
getList () {
this.$http.post('/api/learning/pluginPage', null, {
params: {
...this.search,
categoryId: this.search.isFavorite === 1 ? '' : this.search.categoryId
...this.search
}
}).then(res => {
if (res.code === 0) {

View File

@@ -167,7 +167,7 @@
margin-bottom: 14px;
color: #333;
font-size: 15px;
text-indent: 2em;
white-space: pre-line;
}
}

View File

@@ -65,9 +65,13 @@
this.$refs.form.validate((valid) => {
if (valid) {
this.btnLoading = true
const devVersion = require('../../manifest.development.json').version
const prodVersion = require('../../manifest.production.json').version
const version = process.env.NODE_ENV === 'production' ? prodVersion : devVersion
this.$http.post(`/api/mobile/token`, this.form, {
params: {
...this.form
...this.form,
version
},
headers: {
Authorization: 'Basic YXBwOmFwcA=='