| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 | 
							- <template>
 
- 	<layout-page>
 
- 		<uni-segmented-control :current="current" class="MiSans-Normal" :values="controlListText" @clickItem="handleChange" styleType="text" activeColor="#00B760"></uni-segmented-control>
 
- 		<scroll-view class="scrollBox defaultBgc" scroll-y="true" @scrolltolower="loadingMore" style="height: calc(100vh - 72rpx);">
 
- 		  <view v-if="items.length" class="listBox">
 
- 		    <m-list :items="items"></m-list>
 
- 		    <uni-load-more :status="more" />
 
- 		  </view>
 
- 		  <view v-else class="nodata-img-parent">
 
- 		    <image
 
- 					src="https://minio.citupro.com/dev/static/nodata.png"
 
- 					mode="widthFix"
 
- 					style="width: 100vw"
 
- 				></image>
 
- 		  </view>
 
- 		</scroll-view>
 
- 	</layout-page>
 
- </template>
 
- <script setup>
 
- import { ref, watch } from 'vue'
 
- import layoutPage from '@/layout'
 
- import MList from './list'
 
- import { getDict } from '@/hooks/useDictionaries.js'
 
- import { getRecommendationList } from '@/api/position.js'
 
- import { onLoad } from '@dcloudio/uni-app'
 
- import { userStore } from '@/store/user'
 
- const useUserStore = userStore()
 
- watch(() => useUserStore.refreshToken, (newVal, oldVal) => {
 
-   if (useUserStore.refreshToken) {
 
- 		// 监听登录状态
 
- 		console.log('重新登录了')
 
- 		handleChange({ currentIndex: current.value })
 
- 	}
 
- })
 
- const current = ref(0)
 
- // 获取参数
 
- const controlList = ref([])
 
- const controlListText = ref([])
 
- const pageInfo = ref({
 
- 	pageNo: 1,
 
- 	pageSize: 10
 
- })
 
- const total = ref(0)
 
- const items = ref([])
 
- const loading = ref(false)
 
- const more = ref('more')
 
- async function initDict () {
 
- 	try {
 
- 		const { data } = await getDict('menduner_hire_job_cv_status')
 
- 		if (!data?.data) {
 
- 			return
 
- 		}
 
- 		controlList.value = data.data
 
- 		controlListText.value = data.data.map(e => e.label)
 
- 		// current.value = +controlList.value[0].value
 
- 		init()
 
- 	} catch (error) {
 
- 		// console.log(error)
 
- 	}
 
- }
 
- function handleChange (val) {
 
- 	current.value = val.currentIndex
 
- 	pageInfo.value.pageNo = 1
 
- 	total.value = 0
 
- 	items.value = []
 
- 	init()
 
- }
 
- function loadingMore () {
 
- 	if (total.value === items.value.length) {
 
- 		return
 
- 	}
 
- 	if (loading.value) {
 
- 		return
 
- 	}
 
- 	more.value = 'loading'
 
-   pageInfo.value.pageNo++
 
- 	init()
 
- }
 
- async function init () {
 
- 	try {
 
- 		loading.value = true
 
- 		const { data } = await getRecommendationList({
 
- 			...pageInfo.value,
 
- 			status: current.value
 
- 		})
 
- 		if (!data?.list) {
 
- 			pageInfo.value.pageNo--
 
- 			return
 
- 		}
 
- 		items.value.push(...data.list)
 
- 		total.value = +data.total
 
- 		more.value = items.value.length === total.value ? 'noMore' : 'more'
 
- 	} catch (error) {
 
- 		pageInfo.value.pageNo--
 
- 	} finally {
 
- 		loading.value = false
 
- 	}
 
- }
 
- onLoad(async (options) => {
 
-   if (options?.id) {
 
-     current.value = +options.id
 
- 	}
 
- 	initDict()
 
- })
 
- </script>
 
- <style lang="scss" scoped>
 
- </style>
 
 
  |