Commit d13b10f0 by wangzhihui

```

refactor(recruitManage): 移除冗余代码和注释

移除了组件中的多余空行、注释掉的代码以及无用的换行符,
优化了代码结构并激活了之前被注释的调试日志功能
```
1 parent a8199569
......@@ -9,13 +9,15 @@
</van-tabs>
</div>
</div>
<!-- 列表模块 -->
<div class="content">
<van-pull-refresh v-model="triggered" @refresh="search" style="min-height: 100%; padding-top: 12px; box-sizing: border-box">
<van-list class="list" v-model="loading" :finished="nothing" finished-text="没有更多了" @load="onBottomRefresh" :offset="100">
<van-pull-refresh v-model="triggered" @refresh="search"
style="min-height: 100%; padding-top: 12px; box-sizing: border-box">
<van-list class="list" v-model="loading" :finished="nothing" finished-text="没有更多了" @load="onBottomRefresh"
:offset="100">
<template v-if="list.length">
<div v-for="(item, index) in list" :key="index" class="item" :class="{ super_item: userInfo.isSuper }" @click="handleDetail(item)">
<div v-for="(item, index) in list" :key="index" class="item" :class="{ super_item: userInfo.isSuper }"
@click="handleDetail(item)">
<div class="item_header">
<!-- <van-tag v-if="item.urgent == 1" type="danger" style="margin-right: 5px">急</van-tag> -->
<img v-if="item.urgent == 1" class="ji" :src="`${IMG_URL}miniProgram/ji.png`" />
......@@ -31,7 +33,8 @@
</div>
</div>
<!-- 提示消息 -->
<div class="item_footer" v-if="tabIndex == 0 && item.showTip && item.confirmFlag == 'N' && item.status !== 0">
<div class="item_footer"
v-if="tabIndex == 0 && item.showTip && item.confirmFlag == 'N' && item.status !== 0">
<div class="msg_tips">
<span>{{ item.tipText }}</span>
<van-icon name="arrow" color="#999" size="12" />
......@@ -46,7 +49,6 @@
</van-list>
</van-pull-refresh>
</div>
<!-- 添加招聘按钮 -->
<!-- <div class="insert_btn" :class="btnVisible ? 'btn-visible' : 'btn-hidden'" @click="handleInsertRecruit">
<van-icon name="add-o" class="insert_icon" size="27" color="#347bff" />
......@@ -55,21 +57,17 @@
<div>需求</div>
</div>
</div> -->
<!-- 箭头图标 - 与按钮互斥显示 -->
<div class="arrowIcon" :class="btnVisible ? 'arrow-hidden' : 'arrow-visible'">
<van-icon name="arrow-left" class="image" size="16" color="#999" />
</div>
</div>
</template>
<script>
import { mentorshipFormData, getStatusName, getStatusTipText } from './constantData'
import api from '../api'
// Use a placeholder for IMG_URL if not defined globally
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
export default {
name: 'RecruitManage',
data() {
......@@ -108,8 +106,8 @@ export default {
},
methods: {
onBottomRefresh() {
// console.log('onBottomRefresh')
// this.getList()
console.log('onBottomRefresh')
this.getList()
},
// 获取招聘任务统计数据
getWaitstaffstate() {
......@@ -124,7 +122,6 @@ export default {
console.error(error)
})
},
// 标签切换
tabClick(name, title) {
this.tabIndex = name
......@@ -135,7 +132,6 @@ export default {
this.getList() // Load new list
this.getWaitstaffstate()
},
// 搜索
search() {
this.nothing = false
......@@ -145,7 +141,6 @@ export default {
this.getList()
this.getWaitstaffstate()
},
// 获取列表数据
getList() {
let { tabIndex, pageSize, currentPage, nothing } = this
......@@ -154,10 +149,8 @@ export default {
this.triggered = false
return
}
// 重置错误状态
this.error = false
// 映射 tabIndex 到 dataType
// tabIndex: 0->待审核, 1->待处理, 2->全部
// dataType: 1->待审核, 2->待处理, 0->全部
......@@ -165,7 +158,6 @@ export default {
if (tabIndex === 0) dataType = 1
else if (tabIndex === 1) dataType = 2
else dataType = 0
api
.getRecruitList({
pageSize,
......@@ -189,13 +181,11 @@ export default {
tipText: tipText || '' // 提示文本
}
})
if (currentPage === 1) {
this.list = list
} else {
this.list = [...this.list, ...list]
}
this.currentPage = currentPage + 1
this.nothing = currentPage > pages || list.length < pageSize
// } else {
......@@ -214,14 +204,12 @@ export default {
if (currentPage === 1) this.list = []
})
},
// 跳转详情
handleDetail(item) {
console.log(item, 'item')
// 节流控制:2秒内只能触发一次
const now = Date.now()
const throttleTime = 2000 // 节流时间:2秒
if (this.lastDetailTime && now - this.lastDetailTime < throttleTime) {
return
}
......@@ -229,7 +217,6 @@ export default {
// return
// 0-待审核 跳转审核页,其他跳转详情页
const routeName = item.status === 4 ? 'recruitmentReview/recruitmentReview' : 'recruitDetail/recruitDetail'
this.$router.push({
name: routeName,
query: {
......@@ -237,21 +224,18 @@ export default {
}
})
},
// 跳转添加招聘页面
handleInsertRecruit() {
this.$router.push({
name: 'recruitInsert/recruitInsert'
})
},
handleScroll(e) {
// Implement if needed using window scroll event or getting scroll element
}
}
}
</script>
<style lang="scss" scoped>
.recruit-manage {
background: #f7f8fa;
......@@ -280,6 +264,7 @@ export default {
// padding-top: 12px;
// height: 200px;
overflow: scroll;
.list {
height: 100%;
overflow: scroll;
......@@ -482,5 +467,4 @@ export default {
width: 16px;
height: 16px;
}
}
</style>
}</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!