瀏覽代碼

fix(message,index): 登录后处理流程,无法刷新列表问题(放弃刷新)

wangpx 1 年之前
父節點
當前提交
2189b1f5cc
共有 2 個文件被更改,包括 16 次插入13 次删除
  1. 6 4
      pages/message/index.vue
  2. 10 9
      pages/process/index.vue

+ 6 - 4
pages/message/index.vue

@@ -29,7 +29,7 @@
 		<!-- 消息列表 -->
 		<!-- 消息列表 -->
 		<message-list ref="msgListRef" @readMsg="setAllMsgRead" :unReadNum="unReadMsgNum" @clickSegment="getMessageData"
 		<message-list ref="msgListRef" @readMsg="setAllMsgRead" :unReadNum="unReadMsgNum" @clickSegment="getMessageData"
 			@clickItem="handleToMessageDetail" @scrollToBottom="getMessagePage" :defaultCurrent="1" :pSize="5"
 			@clickItem="handleToMessageDetail" @scrollToBottom="getMessagePage" :defaultCurrent="1" :pSize="5"
-			:pageNo="1" :anime="true" :open="true" :segments="{ '全部': '', '未读': '0', '已读': '1' }"
+			:pageNo="1" :anime="true" :open="false" :segments="{ '全部': '', '未读': '0', '已读': '1' }"
 			title="消息"></message-list>
 			title="消息"></message-list>
 
 
 		<!-- 跳转打卡页按钮 -->
 		<!-- 跳转打卡页按钮 -->
@@ -62,10 +62,12 @@ const userStore = useUserStore()
 
 
 const processListRef = ref(null)
 const processListRef = ref(null)
 onMounted(() => {
 onMounted(() => {
-	uni.$on('ReloadProcessData', (res) => {
-		processListRef.value.onClickItem()
-	})
 	uni.$on('showTabBarBadge', showTabBarBadge)
 	uni.$on('showTabBarBadge', showTabBarBadge)
+	uni.$on('ReloadProcessData', () => {
+		new Promise((resolve, reject) =>{
+			processListRef.value.onClickItem()
+		})
+	})
 })
 })
 onLoad((options) => {
 onLoad((options) => {
 	// 是否跳转打卡页
 	// 是否跳转打卡页

+ 10 - 9
pages/process/index.vue

@@ -27,8 +27,7 @@
 				activeColor="#409eff"></uni-segmented-control>
 				activeColor="#409eff"></uni-segmented-control>
 		</view>
 		</view>
 		<view class="process_list">
 		<view class="process_list">
-			<process-list ref="processListRef" :list="processes" @clickSegment="getProcessData"
-				@clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="current" :pSize="5"
+			<process-list ref="processListRef" @clickSegment="getProcessData" @clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="current" :pSize="5"
 				:pageNo="1"></process-list>
 				:pageNo="1"></process-list>
 		</view>
 		</view>
 		<view class="popup_container">
 		<view class="popup_container">
@@ -46,15 +45,17 @@
 <script setup lang="ts">
 <script setup lang="ts">
 import processList from '@/components/ygoa/processList.vue'
 import processList from '@/components/ygoa/processList.vue'
 import { onShow } from '@dcloudio/uni-app'
 import { onShow } from '@dcloudio/uni-app'
-import { reactive, ref, onMounted, onUpdated } from 'vue';
+import { reactive, ref, onMounted } from 'vue';
 import $tab from '@/plugins/tab.js'
 import $tab from '@/plugins/tab.js'
 import { getUserProcess, getUserProcessed, getUserProcessing, getUserAllProcess } from '@/api/process';
 import { getUserProcess, getUserProcessed, getUserProcessing, getUserAllProcess } from '@/api/process';
 import { useUserStore } from '@/store/user';
 import { useUserStore } from '@/store/user';
 
 
 
 
 onMounted(() => {
 onMounted(() => {
-	uni.$on('ReloadProcessData', (res) => {
-		processListRef.value.onClickItem()
+	uni.$on('ReloadProcessData', () => {
+		new Promise((resolve, reject) =>{
+			processListRef.value.onClickItem()
+		})
 	})
 	})
 })
 })
 onShow(() => {
 onShow(() => {
@@ -69,10 +70,10 @@ const current = ref(0)
 const processListRef = ref(null)
 const processListRef = ref(null)
 
 
 // 待办列表
 // 待办列表
-const processes = ref([])
+// const processes = ref([])
 // 分段器点击事件 调用子组件刷新数据
 // 分段器点击事件 调用子组件刷新数据
 function clickSegmentItem({ currentIndex }) {
 function clickSegmentItem({ currentIndex }) {
-	processes.value = [] // 清空列表数据
+	// processes.value = [] // 清空列表数据
 	current.value = currentIndex // 更新分段器状态
 	current.value = currentIndex // 更新分段器状态
 	processListRef.value.onClickItem() // 调用子组件刷新数据
 	processListRef.value.onClickItem() // 调用子组件刷新数据
 }
 }
@@ -125,7 +126,7 @@ function getProcessData({ pageNo, pSize }, callback) {
 		getUserProcessed // 办结
 		getUserProcessed // 办结
 	]
 	]
 	requestMap[current.value](params).then(({ returnParams }) => {
 	requestMap[current.value](params).then(({ returnParams }) => {
-		processes.value = returnParams.list
+		// processes.value = returnParams.list
 		callback(returnParams.list, returnParams.total, pageNo)
 		callback(returnParams.list, returnParams.total, pageNo)
 	})
 	})
 }
 }
@@ -145,7 +146,7 @@ function getProcessPage({ pageNo, pSize }, callback) {
 		getUserProcessed // 办结
 		getUserProcessed // 办结
 	]
 	]
 	requestMap[current.value](params).then(({ returnParams }) => {
 	requestMap[current.value](params).then(({ returnParams }) => {
-		processes.value.push(...returnParams.list)
+		// processes.value.push(...returnParams.list)
 		callback(returnParams.list, returnParams.total, pageNo)
 		callback(returnParams.list, returnParams.total, pageNo)
 	})
 	})
 }
 }