|
@@ -2,7 +2,7 @@
|
|
|
import { addQuestionReportData,REPORTDATA, getQuestionTypeList, pageQuestionReportData,getPerson } from '@/api/questionReqort'
|
|
import { addQuestionReportData,REPORTDATA, getQuestionTypeList, pageQuestionReportData,getPerson } from '@/api/questionReqort'
|
|
|
import { AddQuestionReportDataReq, QuestionListRes, QuestionType, QuestionTypeListRes } from '@/api/questionReqort/types'
|
|
import { AddQuestionReportDataReq, QuestionListRes, QuestionType, QuestionTypeListRes } from '@/api/questionReqort/types'
|
|
|
import { getCachedWecomVisitorProfile, getWecomInternalUser } from '@/api/wecom'
|
|
import { getCachedWecomVisitorProfile, getWecomInternalUser } from '@/api/wecom'
|
|
|
-import { onMounted, ref } from 'vue'
|
|
|
|
|
|
|
+import { onMounted, ref, watch } from 'vue'
|
|
|
import GridAddress from '@/components/address/gridAddress/index.vue'
|
|
import GridAddress from '@/components/address/gridAddress/index.vue'
|
|
|
import { showNotify } from 'vant'
|
|
import { showNotify } from 'vant'
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
@@ -216,27 +216,48 @@ const pageInfo = ref({
|
|
|
pageNumber: 1,
|
|
pageNumber: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
})
|
|
})
|
|
|
-const questList = async () => {
|
|
|
|
|
- const { data } = await pageQuestionReportData({
|
|
|
|
|
- pageNumber: pageInfo.value.pageNumber,
|
|
|
|
|
- pageSize: pageInfo.value.pageSize,
|
|
|
|
|
- token: userState.getUserTokenInfo || '',
|
|
|
|
|
- })
|
|
|
|
|
- list.value = list.value.concat(data.records)
|
|
|
|
|
- pageInfo.value.pageNumber++
|
|
|
|
|
- finished.value = data.records.length < pageInfo.value.pageSize
|
|
|
|
|
|
|
+const loading = ref(false)
|
|
|
|
|
+const finished = ref(false)
|
|
|
|
|
+const listInitialized = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+const resetQuestionList = () => {
|
|
|
|
|
+ list.value = []
|
|
|
|
|
+ pageInfo.value.pageNumber = 1
|
|
|
|
|
+ finished.value = false
|
|
|
loading.value = false
|
|
loading.value = false
|
|
|
- if (data.records.length === 0 || !data.records) {
|
|
|
|
|
- finished.value = true
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const questList = async () => {
|
|
|
|
|
+ if (loading.value || finished.value) return
|
|
|
|
|
+
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const currentPage = pageInfo.value.pageNumber
|
|
|
|
|
+ const { data } = await pageQuestionReportData({
|
|
|
|
|
+ pageNumber: currentPage,
|
|
|
|
|
+ pageSize: pageInfo.value.pageSize,
|
|
|
|
|
+ token: userState.getUserTokenInfo || '',
|
|
|
|
|
+ })
|
|
|
|
|
+ const records = data.records || []
|
|
|
|
|
+
|
|
|
|
|
+ list.value = currentPage === 1 ? records : list.value.concat(records)
|
|
|
|
|
+ pageInfo.value.pageNumber = currentPage + 1
|
|
|
|
|
+ finished.value = records.length < pageInfo.value.pageSize
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loading.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-const loading = ref(false)
|
|
|
|
|
-const finished = ref(false)
|
|
|
|
|
|
|
+
|
|
|
|
|
+const initQuestionList = async () => {
|
|
|
|
|
+ resetQuestionList()
|
|
|
|
|
+ await questList()
|
|
|
|
|
+ listInitialized.value = true
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
/** 跳转问题详情 */
|
|
/** 跳转问题详情 */
|
|
|
const handleGoDetail = (item: QuestionListRes) => {
|
|
const handleGoDetail = (item: QuestionListRes) => {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: `/subPages/pages/reportProblems/detail?id=${item.uuid}`,
|
|
|
|
|
|
|
+ url: `/subPages/pages/reportProblems/detail?id=${item.uuid}&t=${Date.now()}`,
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -277,8 +298,12 @@ onMounted(async () => {
|
|
|
} else {
|
|
} else {
|
|
|
range.value = []
|
|
range.value = []
|
|
|
}
|
|
}
|
|
|
|
|
+})
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+watch(active, async (value) => {
|
|
|
|
|
+ if (value === 1 && !listInitialized.value) {
|
|
|
|
|
+ await initQuestionList()
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|