Ver código fonte

列表加载

zhengnaiwen_citu 7 meses atrás
pai
commit
ae3905b2ab

+ 1 - 0
hooks/useIM.js

@@ -260,6 +260,7 @@ export function initConnect (callback = () => {}, mounted = () => {}) {
 
   // 消息发送状态监听
   function statusListen (packet) {
+    console.log('发送状态', packet)
     if (packet.reasonCode === 1) {
       // 发送成功
       console.log('发送成功')

+ 0 - 1
layout/index.vue

@@ -48,7 +48,6 @@ watch(() => useUserStore.accountInfo.userId, (newVal, oldVal) => {
     position: absolute;
     z-index: 1;
     width: 100%;
-    padding-bottom: 120rpx;
     min-height: 100%;
     display: flex;
     flex-direction: column;

+ 44 - 36
pages/index/communicate.vue

@@ -1,50 +1,53 @@
 <template>
   <layout-page class="ss-m-x-15">
-    <view class="box" v-for="item in items" :key="item.id" @tap="handleTo(item)">
-			<view class="box-header">
-				<template v-if="item.unread === '0'">
-					<image
-						class="enterAvatar"
-						:src="getUserAvatar(item?.userInfoVo?.userInfoResp?.avatar, item?.userInfoVo?.userInfoResp?.sex)"
-					></image>
-				</template>
-				<template v-else>
-					<uni-badge class="uni-badge-left-margin" :text="item.unread" absolute="rightTop" size="small">
-						<image
-							class="enterAvatar"
-							:src="getUserAvatar(item?.userInfoVo?.userInfoResp?.avatar, item?.userInfoVo?.userInfoResp?.sex)"
-						></image>
-					</uni-badge>
-				</template>
-				
-			</view>
-			<view class="box-content">
-				<view class="box-content-names">
-					<view class="name">
-						{{ item.thatName }}
-						<text class="nameSub">{{ item.enterpriseAnotherName }}</text>
-						<span class="line" v-if="item.postNameCn && item.enterpriseAnotherName"></span>
-						<text class="nameSub">{{ item.postNameCn }}</text>
+		<view class="height">
+			<scroll-view class="scrollBox" scroll-y="true" >
+				<view class="box" v-for="item in items" :key="item.id" @tap="handleTo(item)">
+					<view class="box-header">
+						<template v-if="item.unread === '0'">
+							<image
+								class="enterAvatar"
+								:src="getUserAvatar(item?.userInfoVo?.userInfoResp?.avatar, item?.userInfoVo?.userInfoResp?.sex)"
+							></image>
+						</template>
+						<template v-else>
+							<uni-badge class="uni-badge-left-margin" :text="item.unread" absolute="rightTop" size="small">
+								<image
+									class="enterAvatar"
+									:src="getUserAvatar(item?.userInfoVo?.userInfoResp?.avatar, item?.userInfoVo?.userInfoResp?.sex)"
+								></image>
+							</uni-badge>
+						</template>
+					</view>
+					<view class="box-content">
+						<view class="box-content-names">
+							<view class="name">
+								{{ item.thatName }}
+								<text class="nameSub">{{ item.enterpriseAnotherName }}</text>
+								<span class="line" v-if="item.postNameCn && item.enterpriseAnotherName"></span>
+								<text class="nameSub">{{ item.postNameCn }}</text>
+							</view>
+							<!-- <view class="time">{{ item.updateTime }}</view> -->
+						</view>
+						<view class="box-content-text">{{ timesTampChange(+item.timestamp.padEnd(13, '0')) }}</view>
 					</view>
-					<!-- <view class="time">{{ item.updateTime }}</view> -->
 				</view>
-				<view class="box-content-text">{{ timesTampChange(+item.timestamp.padEnd(13, '0')) }}</view>
-			</view>
+				<image
+					v-if=" items.length===0 "
+					src="https://minio.citupro.com/dev/static/nodata.png"
+					mode="widthFix"
+					style="width: 100%;">
+				</image>
+			</scroll-view>
 		</view>
-		<image
-			v-if=" items.length===0 "
-			src="https://minio.citupro.com/dev/static/nodata.png"
-			mode="widthFix"
-			style="width: 100vw;height: 100vh;">
-		</image>
   </layout-page>
 </template>
 
 <script setup>
 import { ref, watch } from 'vue'
 import layoutPage from '@/layout'
-import { getAccessToken } from '@/utils/request'
-import { showAuthModal } from '@/hooks/useModal'
+// import { getAccessToken } from '@/utils/request'
+// import { showAuthModal } from '@/hooks/useModal'
 import { getConversationSync } from '@/api/common'
 import { onShow } from '@dcloudio/uni-app'
 import { getUserAvatar } from '@/utils/avatar'
@@ -178,6 +181,11 @@ async function init () {
 		}
 	}
 }
+.height {
+	height: 100vh;
+	padding-bottom: 120rpx;
+	box-sizing: border-box;
+}
 .enterAvatar{
 	width: 80rpx;
 	height: 80rpx;

+ 37 - 26
pages/index/crowdsourcing.vue

@@ -1,45 +1,48 @@
 <template>
   <layout-page>
-    <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
-			<view class="content defaultBgc">
-				<view class="content-top">
+		<view class="content defaultBgc">
+			<view class="content-top">
 				<view class="content-top-title">
 					<view class="content-top-title-label">
 						<text class="content-top-title-label-l">全员猎聘</text>
 						<text class="content-top-title-label-s">海量岗位 | 推荐有赏</text>
 					</view>
 				</view>
-				<view class="content-top-carousel">
-					<view class="content-top-carousel-box">
-						<SwiperAd :list="swiperAdList"></SwiperAd>
+			</view>
+			<scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
+				<view class="content-top">
+					<view class="content-top-carousel">
+						<view class="content-top-carousel-box">
+							<SwiperAd :list="swiperAdList"></SwiperAd>
+						</view>
 					</view>
-				</view>
-				<view class="content-top-recommend">
-					<view class="content-top-recommend-box">
-						<resume-status>
-							<template #header>
-								<view class="content-top-recommend-box-title">
-									<text class="title">我的推荐</text>
-								</view>
-							</template>
-						</resume-status>
+					<view class="content-top-recommend">
+						<view class="content-top-recommend-box">
+							<resume-status>
+								<template #header>
+									<view class="content-top-recommend-box-title">
+										<text class="title">我的推荐</text>
+									</view>
+								</template>
+							</resume-status>
+						</view>
 					</view>
 				</view>
-				</view>
 				<view class="content-main">
-				<view class="content-main-list">
-					<PositionList class="pb-10" :list="items" :noMore="items.length === total"></PositionList>
-				</view>
+					<view class="content-main-list">
+						<PositionList :list="items" :noMore="false"></PositionList>
+						<uni-load-more :status="more" />
+					</view>
 				</view>
-			</view>
-		</scroll-view>
+			</scroll-view>
+		</view>
   </layout-page>
 </template>
 
 <script setup>
 import { ref, reactive } from 'vue'
 import SwiperAd from '@/components/SwiperAd'
-import { showAuthModal } from '@/hooks/useModal'
+// import { showAuthModal } from '@/hooks/useModal'
 import { swiperAdListTest } from '@/utils/testData'
 // import { userStore } from '@/store/user'
 import layoutPage from '@/layout'
@@ -62,13 +65,13 @@ const swiperAdList = ref(swiperAdListTest)
 const items = reactive([])
 const pageInfo = ref({
 	pageNo: 1,
-	pageSize: 10
+	pageSize: 2
 })
 
 const loading = ref(false)
 const total = ref(0)
 
-
+const more = ref('more')
 
 
 const loadingMore = (e) => {
@@ -78,6 +81,7 @@ const loadingMore = (e) => {
 	if (loading.value) {
 		return
 	}
+	more.value = 'loading'
 	pageInfo.value.pageNo++
 	getList()
 }
@@ -106,7 +110,9 @@ async function getList () {
 			}
 		}))
 		total.value = +data.total
+		more.value = items.length === total.value ? 'noMore' : 'more'
 	} catch (error) {
+		more.value = more
 		pageInfo.pageNo--
 	} finally {
 		loading.value = false
@@ -127,6 +133,9 @@ $defaultColor: #999;
 	overflow: hidden;
 }
 .content {
+	height: 100vh;
+	display: flex;
+	flex-direction: column;
 	&-top {		
 		&-title {
 			padding: 24rpx;
@@ -256,6 +265,8 @@ $defaultColor: #999;
 	}
 }
 .scrollBox {
-	height: 100vh;
+	height: 0;
+	flex: 1;
+	padding-bottom: 120rpx;
 }
 </style>

+ 4 - 1
pages/index/my.vue

@@ -1,6 +1,6 @@
 <template>
   <layout-page>
-		<view class="ss-p-b-30">
+		<view class="pb-120">
 			<view class="text-center" @tap="handleTap">
 				<img :src="getUserAvatar(baseInfo?.avatar, baseInfo?.sex)" alt="" class="img-box">
 				<view v-if="!useUserStore.isLogin" class="font-weight-bold font-size-20">点击登录</view>
@@ -126,6 +126,9 @@ const handleLogoutConfirm = () => {
 </script>
 
 <style scoped lang="scss">
+.pb-120 {
+	padding-bottom: 120rpx;
+}
 .img-box {
   width: 150rpx;
   height: 150rpx;

+ 58 - 33
pages/index/position.vue

@@ -1,24 +1,25 @@
 <template>
   <view class="box defaultBgc">
-    <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
-      <view class="white-bgc">
-        <uni-search-bar
-          v-model="query.content"
-          radius="8"
-          placeholder="请输入关键字"
-          cancelButton="none"
-          :focus="false"
-          @confirm="onSearch($event.value)"
-          @clear="query.content = ''; onSearch()"
-        />
-      </view>
-      <view class="white-bgc px-10 mb-10">
-        <SwiperAd :list="swiperAdList"></SwiperAd>
-        <view class="px-5">
-          <FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
-        </view>
+    <view class="white-bgc stick">
+      <uni-search-bar
+        v-model="query.content"
+        radius="8"
+        placeholder="请输入关键字"
+        cancelButton="none"
+        :focus="false"
+        @confirm="onSearch($event.value)"
+        @clear="query.content = ''; onSearch()"
+      />
+    </view>
+    <view class="white-bgc px-10 mb-10">
+      <SwiperAd :list="swiperAdList"></SwiperAd>
+      <view class="px-5">
+        <FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
       </view>
-      <PositionList class="pb-10" :list="positionListData" :noMore="noMore"></PositionList>
+    </view>
+    <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
+      <PositionList :list="positionListData" :noMore="false"></PositionList>
+      <uni-load-more :status="more" />
     </scroll-view>
   </view>
 </template>
@@ -41,6 +42,7 @@ onShow(() => {
     currentTabBar?.setData({ selected: 0 });
 })
 
+const more = ref('more')
 const swiperAdList = ref(swiperAdListTest)
 const filterList = ref([
   { label: '城市', dictType: 'areaTreeData', key: 'areaIds', map: { text: 'name', value: 'id' } },
@@ -52,9 +54,8 @@ const filterList = ref([
 
 // 
 const positionListData = ref([])
-const noMore = ref(false)
 const query = reactive({ 
-  pageSize: 10, 
+  pageSize: 20, 
   pageNo: 1, 
   content: '',
   areaIds: [],
@@ -65,17 +66,27 @@ const query = reactive({
 })
 //
 const getData = async () => {
-  // console.log('query', query)
-  const res = await getJobAdvertisedSearch(query)
-  const list = res?.data?.list || []
-  if (list?.length) {
-    list.forEach(e => {
-      e.job = { ...e.job, ...dealDictObjData({}, e.job) }
-      e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
-    })
-    positionListData.value = positionListData.value.concat(list)
+  try {
+    const res = await getJobAdvertisedSearch(query)
+    const list = res?.data?.list || []
+    positionListData.value.push(...list.map(e => {
+        if (!e) {
+          return e
+        }
+        e.job = { ...e.job, ...dealDictObjData({}, e.job) }
+        e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
+        return e
+    }))
+    if (positionListData.value.length === +res.data.total) {
+      more.value = 'noMore'
+      return
+    }
+  } catch (error) {
+    query.pageNo--
+    more.value = 'more'
   }
-  if (list?.length < query.pageSize) noMore.value = true
+  
+  
 }
 getData()
 
@@ -86,12 +97,12 @@ const handleSearch = (key, value) => {
 
 const onSearch = () => {
   query.pageNo = 1
-  noMore.value = false
   positionListData.value = []
   getData()
 }
 
 const loadingMore = () => { // 加载更多
+  more.value = 'loading'
   query.pageNo++
   getData()
 }
@@ -99,8 +110,13 @@ const loadingMore = () => { // 加载更多
 </script>
 
 <style scoped lang="scss">
+.stick {
+  position: sticky;
+}
 .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
-.pb-10 { padding-bottom: 10px; }
+.pb-10 {
+  padding-bottom: 10px;
+}
 .pb-20 { padding-bottom: 20px; }
 .px-5 { padding-left: 5px; padding-right: 5px; }
 .px-10 { padding-left: 10px; padding-right: 10px; }
@@ -110,8 +126,17 @@ const loadingMore = () => { // 加载更多
 .box {
   height: 100vh;
   overflow: hidden;
+  padding-bottom: 120rpx;
+  // box-sizing: border-box;
+  // padding-bottom: 160rpx;
+  box-sizing: border-box;
+  display: flex;
+  flex-direction: column;
 }
 .scrollBox{
-  height: 100%;
+  // height: 100%;
+  flex: 1;
+  height: 0 !important;
+  // padding-bottom: 160rpx;
 }
 </style>

+ 2 - 1
pagesA/interview/index.vue

@@ -61,7 +61,8 @@ const getList = async () => {
     })
     items.value = items.value.concat(list)
   }
-  more.value = list?.length < queryParams.value.pageSize ? 'noMore' : 'more'
+  // more.value = list?.length < queryParams.value.pageSize ? 'noMore' : 'more'
+  more.value = list?.length === +data.total ? 'noMore' : 'more'
 }
 getList()
 

+ 3 - 1
pagesB/positionDetail/index.vue

@@ -337,8 +337,10 @@ async function handleSend () {
   const enterpriseId = info.value.contact.enterpriseId
   const textObj = {
     text: defaultText,
-    positionInfo: positionInfo.value
+    positionInfo: positionInfo.value,
+    
   }
+  // console.log('textObj', textObj)
   const channel = await prologue({userId, enterpriseId, text: JSON.stringify(textObj)})
   console.log('channel', channel)
   // 跳转