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

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() {
return {
list: [],
pageShow: false,
current: 1,
total: 0,
isMore: false,
itemOptions: [
{text: '删除', style: {backgroundColor: '#f46'}}
]
@@ -63,59 +61,34 @@ export default {
onShow() {
this.current = 1
this.isMore = false
this.getList()
},
onLoad() {
this.$loading()
this.$dict.load(['clapEventStatus'])
},
methods: {
toReport() {
this.$linkTo('./PhotoForm')
},
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, {
params: {
current: this.current,
size: 15
current: this.current, size: 15
}
}).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
if (this.current > 1) {
this.list = [...this.list, ...res.data.records].map(v => {
return {
...v,
statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)
}
})
} 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()
this.current++
}
}).catch(() => {
uni.hideLoading()
})
}).finally(() => uni.hideLoading())
},
handleDelete(ids) {
this.$dialog.confirm({content: "是否要进行删除?"}).then(() => {
@@ -125,7 +98,6 @@ export default {
if (res?.code == 0) {
this.$u.toast("删除成功!")
this.current = 1
this.isMore = false
this.getList()
}
})

View File

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

View File

@@ -43,7 +43,7 @@ export default {
computed: {
...mapState(['global'])
},
onShow () {
onShow() {
this.getList()
},
methods: {
@@ -131,7 +131,7 @@ export default {
width: 160px;
height: 160px;
margin-right: 20px;
img {
img {
width: 100%;
height: 100%;
}
@@ -167,4 +167,4 @@ export default {
margin-top: 120px;
}
}
</style>
</style>

View File

@@ -47,10 +47,8 @@ export default {
data() {
return {
list: [],
pageShow: false,
current: 1,
total: 0,
isMore: false,
itemOptions: [
{text: '删除', style: {backgroundColor: '#f46'}}
]
@@ -63,59 +61,34 @@ export default {
onShow() {
this.current = 1
this.isMore = false
this.getList()
},
onLoad() {
this.$loading()
this.$dict.load(['clapEventStatus'])
},
methods: {
toReport() {
this.$linkTo('./PhotoForm')
},
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, {
params: {
current: this.current,
size: 15
current: this.current, size: 15
}
}).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
if (this.current > 1) {
this.list = [...this.list, ...res.data.records].map(v => {
return {
...v,
statusName: this.$dict.getLabel('clapEventStatus', v.eventStatus)
}
})
} 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()
this.current++
}
}).catch(() => {
uni.hideLoading()
})
}).finally(() => uni.hideLoading())
},
handleDelete(ids) {
this.$dialog.confirm({content: "是否要进行删除?"}).then(() => {
@@ -125,7 +98,6 @@ export default {
if (res?.code == 0) {
this.$u.toast("删除成功!")
this.current = 1
this.isMore = false
this.getList()
}
})

View File

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