Przeglądaj źródła

处方列表,新增返回刷新列表

刘拾玖 4 miesięcy temu
rodzic
commit
e15fc43091
1 zmienionych plików z 11 dodań i 8 usunięć
  1. 11 8
      pages/cfList/index.vue

+ 11 - 8
pages/cfList/index.vue

@@ -2,7 +2,7 @@
 	<view class="cf-list-page">
 		<TopCard :data="queryParams" />
 		<view class="cf-list-section">
-			<pub-list-scroll @next="onScrollTolower" :loaded="loaded" :text="loadText" :status="status">
+			<pub-list-scroll ref="pubListScrollRef" @next="onScrollTolower" :loaded="loaded" :text="loadText" :status="status">
 				<view class="no-data" v-if="!list || list.length == 0">
 					<image mode="heightFix" src="/static/image/no-data.png" />
 					暂无数据
@@ -33,7 +33,7 @@
 </template>
 
 <script lang="ts" setup>
-	import { ref, onMounted } from 'vue'
+	import { ref } from 'vue'
 	import { onLoad, onShow } from "@dcloudio/uni-app";
 	import { aesEncrypt, aesDecrypt } from "@/lib/encryption";
 	import dlg from '@/lib/dlg'
@@ -45,6 +45,7 @@
 	import { DictLabelCFZT } from '@/lib/util'
 	import * as link from '@/lib/link'
 
+	const pubListScrollRef = ref(null)
 	const loaded = ref(false)
 	const loadText = ref('数据加载中...')
 	const status = ref('loading')
@@ -53,7 +54,7 @@
 		pageNo: 1,
 		pageSize: 10,
 		zjhm: '',
-		hzxm: '',
+		hzxm:'',
 	})
 	const total = ref(0)
 
@@ -75,6 +76,10 @@
 			if (res.total && queryParams.value.pageNo >= total.value / queryParams.value.pageSize) {
 				status.value = "noMore"
 			}
+			// 重置滚动位置
+			if (queryParams.value.pageNo === 1) { 
+				pubListScrollRef.value.goTop()
+			}
 		} catch (e) {
 			dlg.error(e)
 		} finally {
@@ -99,7 +104,7 @@
 	}
 
 	const cardClick = (item) => {
-		link.goCFDetails(aesEncrypt(item.ptwybm), aesEncrypt(queryParams.value.zjhm), aesEncrypt(queryParams.value.hzxm))
+		link.goCFDetails(aesEncrypt(item.ptwybm),aesEncrypt(queryParams.value.zjhm),aesEncrypt(queryParams.value.hzxm))
 	}
 	const isShowTag = (item) => {
 		if (['3', '5'].includes(item.fyfslx) && ['00', '001', '01', '02', '05', '06', '07', '08'].includes(item.cfzt)) {
@@ -113,13 +118,11 @@
 		link.goAddressList(aesEncrypt(queryParams.value.zjhm), aesEncrypt(item.ptwybm))
 	}
 	onLoad((data) => {
-		console.log("onLoad", data)
 		queryParams.value.zjhm = aesDecrypt(data.hzsfzh)
 		queryParams.value.hzxm = aesDecrypt(data.hzxm)
-		getList()
 	})
-	onShow(() => {
-		console.log("onShow", queryParams.value)
+	
+	onShow(() => { 
 		queryParams.value.pageNo = 1;
 		getList()
 	})