Просмотр исходного кода

职位:查看已投递简历招聘会无数据时不添加其参数

Xiao_123 1 месяц назад
Родитель
Сommit
21832a9e14

+ 19 - 3
components/FilterList/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="labelColor itemBox" style="height: 45px;">
+  <view class="labelColor itemBox" style="height: 45px; z-index: 1; position: relative;">
     <view class="item" v-for="(item) in filterList" :key="item[props.idValue]">
       <m-filter
         :items="item.array"
@@ -9,6 +9,7 @@
         :item-label="item.itemLabel"
         :item-value="item.itemValue"
 		    :style="{ 'width': labelWidth }"
+        class="itemFilter default-text-color default-border"
         :popupStyle="{ 'padding-bottom': paddingBottom + 'px' }"
         @change="($event, $name) => handleClick($event, $name, item)"
       >
@@ -72,10 +73,11 @@ const getData = (e) => {
       e.value = e.multiple ? [] : null
     })
   }
+  if (e?.items) e.array = e.items
   if (e?.api) {
     e.api({ exTime: 1 }).then(({ data }) => {
       e.array = data.map(k => {
-        const label = e.isRichText ? k[e.dataLabel].replace(/<\/?p[^>]*>/gi, '') : e.isFormatText ? formatName(k[e.dataLabel]) : k[e.dataLabel]
+        const label = e.isFormatText ? formatName(k[e.dataLabel]) : k[e.dataLabel]
         return { label, value: k[e.dataValue] }
       })
     })
@@ -119,7 +121,21 @@ watch(() => props.list,
     flex: 1;
     width: 0;
     font-size: 14px;
-	  z-index: 1;
+    margin-right: 10rpx;
+    &:last-child {
+      margin-right: 0 !important;
+    }
+    .itemFilter {
+      width: 100%;
+      border-radius: 15rpx;
+      height: 60rpx;
+      line-height: 60rpx;
+      
+      font-weight: 500;
+      font-size: 22rpx;
+      font-style: normal;
+      text-transform: none;
+    }
     .name {
       width: 100%;
       display: flex;

+ 11 - 1
components/FilterList/mFilter.vue

@@ -191,6 +191,16 @@ const findItem = (value, lists) => {
 }
 
 const handleOpen = () => {
+  // 无数据时不弹出
+  if (!props.items || !props.items.length) {
+    uni.showToast({
+      title: `${props.label}暂无数据`,
+      icon: 'none',
+      duration: 2000
+    })
+    return
+  }
+  
   handleData(props.value)
   popup.value.open('bottom')
 }
@@ -336,7 +346,7 @@ const submit = () => {
 .dFlex {
   display: flex;
   justify-content: space-between;
-  height: 20px;
+  // height: 20px;
 }
 .py-1 {
   padding: 10px 0;

+ 3 - 1
pages/index/components/condition.vue

@@ -11,7 +11,9 @@
 				@clear="handleSearch('content', null)"
         @confirm="handleSearch('content', params.content)"
       ></uni-search-bar>
-			<FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
+			<view style="padding: 0 10px;">
+				<FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
+			</view>
 		</view>
 		
 		<scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">

+ 18 - 6
pagesA/resume/index.vue

@@ -20,8 +20,8 @@
         @confirm="handleSearch('name', query.name)"
       ></uni-search-bar>
       <view style="padding: 0 10px;">
-		<FilterList :list="filterList" idValue="label" labelWidth="93%" :paddingBottom="10" @change="handleSearch"></FilterList>
-	  </view>
+        <FilterList :list="filterList" idValue="label" labelWidth="93%" :paddingBottom="10" @change="handleSearch" />
+      </view>
     </view>
 
     <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
@@ -45,7 +45,7 @@ import { onLoad } from '@dcloudio/uni-app'
 
 const filterList = ref([
   { label: '投递职位',key: 'jobId', dataLabel: 'name', dataValue: 'id', api: getJobAdvertised, isFormatText: true },
-  { label: '招聘会', key: 'jobFairId', dataLabel: 'title', dataValue: 'id', isRichText: true, api: getJobFairList },
+  { label: '招聘会', key: 'jobFairId' },
   { label: '最高学历', dictType: 'menduner_education_type', key: 'eduType' },
   { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
   // { label: '求职状态', dictType: 'menduner_job_seek_status', key: 'jobStatus' }
@@ -110,7 +110,14 @@ const getList = async () => {
   }
 }
 
-onLoad((options) => {
+onLoad(async (options) => {
+  const jobFairList = []
+  // 招聘会列表
+  try {
+    const { data } = await getJobFairList()
+    jobFairList = data.map(e => ({ label: e.title.replace(/<\/?p[^>]*>/gi, ''), value: e.id }))
+  } catch {}
+
   if (options?.jobId) {
     query.value.jobId = options.jobId
     const item = filterList.value.find(e => e.key === 'jobId')
@@ -120,8 +127,13 @@ onLoad((options) => {
   if (options?.jobFairId) {
     query.value.jobFairId = options.jobFairId
     const item = filterList.value.find(e => e.key === 'jobFairId')
-    item.value = options.jobFairId
-    item.name = decodeURIComponent(options.jobFairName)
+    item.items = jobFairList
+    // 招聘会存在才添加其参数
+    if (jobFairList.find(k => k.id === options.jobFairId)) {
+      item.value = options.jobFairId
+      item.name = decodeURIComponent(options.jobFairName)
+    }
+    
   }
   query.value.pageNo = 1
   getList()

+ 3 - 0
static/style/index.scss

@@ -78,6 +78,9 @@
   cursor:pointer;
   // text-decoration: underline;
 }
+.default-radius { border-radius: 10rpx; }
+.list-item-bgc { background-color: #fbfbfb; }
+.default-border { border: 1rpx solid #E1E4E9; }
 
 .defaultBgc {
   // height: 100vh;