修改上传图片分类, 优化接口报错处理

This commit is contained in:
mengxiaolong
2020-08-07 18:08:32 +08:00
parent 7b9915c12f
commit e90dc72a15
2 changed files with 68 additions and 30 deletions

View File

@@ -119,7 +119,7 @@ export default {
data() {
return {
active: 0,
pendingListLoading: false,
pendingListLoading: true,
processedListLoading: false,
pendingListFinished: false,
processedListFinished: false,
@@ -149,33 +149,46 @@ export default {
this.searchValue = ''
},
async loadMore() {
const rs = await getQuestionList({
type: this.active,
pageInfo: {
pageNum: this.currentPage,
pageSize: this.pageSize,
keyword: this.searchValue ? this.searchValue : ''
}
})
if (rs && rs.result === '0') {
this.currentPage++
if (this.active === 0) {
this.pendingListLoading = false
this.pendingList.push(...rs.content.list)
try {
const rs = await getQuestionList({
type: this.active,
pageInfo: {
pageNum: this.currentPage,
pageSize: this.pageSize,
keyword: this.searchValue ? this.searchValue : ''
}
})
if (rs && rs.result === '0') {
this.currentPage++
if (this.active === 0) {
this.pendingListLoading = false
this.pendingList.push(...rs.content.list)
this.pendingList.sort((prev, next) => {
return -(new Date(prev.createdTime).getTime() - new Date(next.createdTime).getTime())
})
} else {
this.processedListLoading = false
this.processedList.push(...rs.content.list)
this.processedList.sort((prev, next) => {
return -(new Date(prev.createdTime).getTime() - new Date(next.createdTime).getTime())
})
}
if (rs.content.pageNum >= rs.content.pages && this.active === 0) {
this.pendingListFinished = true
} else if (rs.content.pageNum >= rs.content.pages && this.active === 1) {
this.processedListFinished = true
}
} else {
this.processedListLoading = false
this.processedList.push(...rs.content.list)
}
if (rs.content.pageNum >= rs.content.pages && this.active === 0) {
this.pendingListFinished = true
} else if (rs.content.pageNum >= rs.content.pages && this.active === 1) {
this.processedListFinished = true
this.pendingListLoading = false
this.processedListLoading = false
}
} else {
this.pendingListFinished = true
this.processedListFinished = true
} catch (reson) {
this.pendingListLoading = false
this.pendingListFinished = true
this.processedListLoading = false
this.processedListFinished = true
}
},
changeProblemList() {