返回评价数据处理错误修复

This commit is contained in:
aixianling
2023-03-31 15:00:25 +08:00
parent 0eaa844afd
commit de6e2c5841
5 changed files with 45 additions and 107 deletions

View File

@@ -47,10 +47,8 @@ export default {
data() { data() {
return { return {
list: [], list: [],
pageShow: false,
current: 1, current: 1,
total: 0, total: 0,
isMore: false,
itemOptions: [ itemOptions: [
{text: '删除', style: {backgroundColor: '#f46'}} {text: '删除', style: {backgroundColor: '#f46'}}
] ]
@@ -63,59 +61,34 @@ export default {
onShow() { onShow() {
this.current = 1 this.current = 1
this.isMore = false
this.getList() this.getList()
}, },
onLoad() { onLoad() {
this.$loading()
this.$dict.load(['clapEventStatus']) this.$dict.load(['clapEventStatus'])
}, },
methods: { methods: {
toReport() { toReport() {
this.$linkTo('./PhotoForm') this.$linkTo('./PhotoForm')
}, },
getList() { getList() {
if (this.isMore) return if (this.current == 1) {
//当current=1时,意味着重新刷新数据
} else if (this.list.length >= this.total && this.total > 0) {
return //当数据总量和列表总量一样时,不用再加载数据
}
this.$loading()
this.$instance.post(`/app/appclapeventinfo/listByWxApplet`, null, { this.$instance.post(`/app/appclapeventinfo/listByWxApplet`, null, {
params: { params: {
current: this.current, current: this.current, size: 15
size: 15
} }
}).then(res => { }).then(res => {
if (res.code == 0) { if (res?.data) {
const list = res.data.records.map(v => ({...v, statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)}))
this.list = this.current == 1 ? list : [this.list, list].flat()
this.total = res.data.total this.total = res.data.total
if (this.current > 1) { this.current++
this.list = [...this.list, ...res.data.records].map(v => {
return {
...v,
statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)
} }
}) }).finally(() => uni.hideLoading())
} else {
this.list = res.data.records.map(v => {
return {
...v,
statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)
}
})
}
uni.hideLoading()
this.pageShow = true
if (res.data.records.length < 15) {
this.isMore = true
return false
}
this.current += 1
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
}, },
handleDelete(ids) { handleDelete(ids) {
this.$dialog.confirm({content: "是否要进行删除?"}).then(() => { this.$dialog.confirm({content: "是否要进行删除?"}).then(() => {
@@ -125,7 +98,6 @@ export default {
if (res?.code == 0) { if (res?.code == 0) {
this.$u.toast("删除成功!") this.$u.toast("删除成功!")
this.current = 1 this.current = 1
this.isMore = false
this.getList() this.getList()
} }
}) })

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="photo-detail" v-if="pageShow"> <div class="photo-detail">
<AiGroup noBorder> <AiGroup noBorder>
<h2>{{ info.content }}</h2> <h2>{{ info.content }}</h2>
<div class="status-name" :class="detailStatus.cls" v-text="detailStatus.label"/> <div class="status-name" :class="detailStatus.cls" v-text="detailStatus.label"/>
@@ -50,7 +50,6 @@ export default {
appName: "随手拍详情", appName: "随手拍详情",
data() { data() {
return { return {
pageShow: false,
info: {}, info: {},
result: {}, result: {},
currentTab: 0, currentTab: 0,
@@ -77,27 +76,25 @@ export default {
return list return list
} }
}, },
onShow() {
this.getInfo()
},
onLoad(query) { onLoad(query) {
this.$loading()
this.$dict.load(['clapEventStatus']).then(() => {
this.getInfo(query.id) this.getInfo(query.id)
}) this.$dict.load(['clapEventStatus'])
}, },
methods: { methods: {
getInfo(id) { getInfo(id = this.info.id) {
this.$loading()
this.$instance.post(`/app/appclapeventinfo/queryDetailById?id=${id}`).then(res => { this.$instance.post(`/app/appclapeventinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) { if (res?.data) {
this.info = res.data this.info = res.data
if (res.data.eventStatus > 1) { if (res.data.eventStatus > 1) {
this.result = res.data.processList[0] this.result = res.data.processList[0]
} }
this.$nextTick(() => {
this.pageShow = true
})
} }
}).finally(() => this.$hideLoading()) }).finally(() => this.$hideLoading())
}, },
previewResult(url) { previewResult(url) {
uni.previewImage({ uni.previewImage({
urls: this.result.files.map(v => v.url), urls: this.result.files.map(v => v.url),

View File

@@ -43,7 +43,7 @@ export default {
computed: { computed: {
...mapState(['global']) ...mapState(['global'])
}, },
onShow () { onShow() {
this.getList() this.getList()
}, },
methods: { methods: {

View File

@@ -47,10 +47,8 @@ export default {
data() { data() {
return { return {
list: [], list: [],
pageShow: false,
current: 1, current: 1,
total: 0, total: 0,
isMore: false,
itemOptions: [ itemOptions: [
{text: '删除', style: {backgroundColor: '#f46'}} {text: '删除', style: {backgroundColor: '#f46'}}
] ]
@@ -63,59 +61,34 @@ export default {
onShow() { onShow() {
this.current = 1 this.current = 1
this.isMore = false
this.getList() this.getList()
}, },
onLoad() { onLoad() {
this.$loading()
this.$dict.load(['clapEventStatus']) this.$dict.load(['clapEventStatus'])
}, },
methods: { methods: {
toReport() { toReport() {
this.$linkTo('./PhotoForm') this.$linkTo('./PhotoForm')
}, },
getList() { getList() {
if (this.isMore) return if (this.current == 1) {
//当current=1时,意味着重新刷新数据
} else if (this.list.length >= this.total && this.total > 0) {
return //当数据总量和列表总量一样时,不用再加载数据
}
this.$loading()
this.$instance.post(`/app/appclapeventinfo/listByWxApplet`, null, { this.$instance.post(`/app/appclapeventinfo/listByWxApplet`, null, {
params: { params: {
current: this.current, current: this.current, size: 15
size: 15
} }
}).then(res => { }).then(res => {
if (res.code == 0) { if (res?.data) {
const list = res.data.records.map(v => ({...v, statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)}))
this.list = this.current == 1 ? list : [this.list, list].flat()
this.total = res.data.total this.total = res.data.total
if (this.current > 1) { this.current++
this.list = [...this.list, ...res.data.records].map(v => {
return {
...v,
statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)
} }
}) }).finally(() => uni.hideLoading())
} else {
this.list = res.data.records.map(v => {
return {
...v,
statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)
}
})
}
uni.hideLoading()
this.pageShow = true
if (res.data.records.length < 15) {
this.isMore = true
return false
}
this.current += 1
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
}, },
handleDelete(ids) { handleDelete(ids) {
this.$dialog.confirm({content: "是否要进行删除?"}).then(() => { this.$dialog.confirm({content: "是否要进行删除?"}).then(() => {
@@ -125,7 +98,6 @@ export default {
if (res?.code == 0) { if (res?.code == 0) {
this.$u.toast("删除成功!") this.$u.toast("删除成功!")
this.current = 1 this.current = 1
this.isMore = false
this.getList() this.getList()
} }
}) })

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="photo-detail" v-if="pageShow"> <div class="photo-detail">
<AiGroup noBorder> <AiGroup noBorder>
<h2>{{ info.content }}</h2> <h2>{{ info.content }}</h2>
<div class="status-name" :class="detailStatus.cls" v-text="detailStatus.label"/> <div class="status-name" :class="detailStatus.cls" v-text="detailStatus.label"/>
@@ -50,7 +50,6 @@ export default {
appName: "微心愿详情", appName: "微心愿详情",
data() { data() {
return { return {
pageShow: false,
info: {}, info: {},
result: {}, result: {},
currentTab: 0, currentTab: 0,
@@ -77,27 +76,25 @@ export default {
return list return list
} }
}, },
onShow() {
this.getInfo()
},
onLoad(query) { onLoad(query) {
this.$loading()
this.$dict.load(['clapEventStatus']).then(() => {
this.getInfo(query.id) this.getInfo(query.id)
}) this.$dict.load(['clapEventStatus'])
}, },
methods: { methods: {
getInfo(id) { getInfo(id = this.info.id) {
this.$loading()
this.$instance.post(`/app/appclapeventinfo/queryDetailById?id=${id}`).then(res => { this.$instance.post(`/app/appclapeventinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) { if (res?.data) {
this.info = res.data this.info = res.data
if (res.data.eventStatus > 1) { if (res.data.eventStatus > 1) {
this.result = res.data.processList[0] this.result = res.data.processList[0]
} }
this.$nextTick(() => {
this.pageShow = true
})
} }
}).finally(() => this.$hideLoading()) }).finally(() => this.$hideLoading())
}, },
previewResult(url) { previewResult(url) {
uni.previewImage({ uni.previewImage({
urls: this.result.files.map(v => v.url), urls: this.result.files.map(v => v.url),