fix: comment
This commit is contained in:
@@ -6,6 +6,19 @@
|
|||||||
</vab-query-form-left-panel>
|
</vab-query-form-left-panel>
|
||||||
<vab-query-form-left-panel>
|
<vab-query-form-left-panel>
|
||||||
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.categoryId"
|
||||||
|
v-loadmore="loadMoreCategories"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择分类"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="queryData"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in categoryList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="queryForm.status" clearable placeholder="请选择状态" @change="queryData">
|
<el-select v-model="queryForm.status" clearable placeholder="请选择状态" @change="queryData">
|
||||||
<el-option label="审核中" :value="1" />
|
<el-option label="审核中" :value="1" />
|
||||||
@@ -121,6 +134,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from '@/api/rating/topic'
|
import { getList } from '@/api/rating/topic'
|
||||||
|
import { getList as getCategoryList } from '@/api/rating/topicCategory'
|
||||||
import { reviewTopic } from '@/api/rating/topicOperate'
|
import { reviewTopic } from '@/api/rating/topicOperate'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
@@ -130,6 +144,23 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicIndex',
|
name: 'RatingTopicIndex',
|
||||||
components: { TopicEdit, UserInfo },
|
components: { TopicEdit, UserInfo },
|
||||||
|
directives: {
|
||||||
|
loadmore: {
|
||||||
|
bind(el, binding) {
|
||||||
|
setTimeout(() => {
|
||||||
|
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
|
||||||
|
if (SELECTWRAP_DOM) {
|
||||||
|
SELECTWRAP_DOM.addEventListener('scroll', function () {
|
||||||
|
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight + 2
|
||||||
|
if (condition) {
|
||||||
|
binding.value()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -142,18 +173,42 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
keyword: '',
|
keyword: '',
|
||||||
status: '',
|
status: '',
|
||||||
|
categoryId: '',
|
||||||
},
|
},
|
||||||
|
categoryList: [],
|
||||||
|
categoryQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
categoryTotal: 0,
|
||||||
|
fetchingCategories: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (this.$route.query.topicId) {
|
if (this.$route.query.topicId) {
|
||||||
this.queryForm.keyword = this.$route.query.topicId
|
this.queryForm.keyword = this.$route.query.topicId
|
||||||
}
|
}
|
||||||
|
this.fetchCategoryList()
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatTime,
|
formatTime,
|
||||||
getThumbUrl,
|
getThumbUrl,
|
||||||
|
async fetchCategoryList() {
|
||||||
|
if (this.fetchingCategories) return
|
||||||
|
this.fetchingCategories = true
|
||||||
|
try {
|
||||||
|
const { data } = await getCategoryList(this.categoryQuery)
|
||||||
|
this.categoryList = this.categoryList.concat(data.list || [])
|
||||||
|
this.categoryTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingCategories = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreCategories() {
|
||||||
|
if (this.categoryList.length >= this.categoryTotal || this.fetchingCategories) return
|
||||||
|
this.categoryQuery.pageNo += 1
|
||||||
|
this.fetchCategoryList()
|
||||||
|
},
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.$refs['edit'].showEdit()
|
this.$refs['edit'].showEdit()
|
||||||
},
|
},
|
||||||
@@ -172,7 +227,9 @@
|
|||||||
async fetchData() {
|
async fetchData() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
try {
|
try {
|
||||||
const { data } = await getList(this.queryForm)
|
const params = { ...this.queryForm }
|
||||||
|
if (!params.categoryId) delete params.categoryId
|
||||||
|
const { data } = await getList(params)
|
||||||
this.list = data.list
|
this.list = data.list
|
||||||
this.total = data.totalCount
|
this.total = data.totalCount
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user