Commit e146ca7d by 张立顺

feat 招聘管理代码

1 parent e718eab4
Showing 58 changed files with 6771 additions and 116 deletions
<template>
<div id="app">
<template v-if="showWindow">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
</template>
<!-- <template v-if="showWindow"> -->
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<!-- </template> -->
</div>
</template>
<script>
export default {
name: 'App',
data () {
data() {
return {
showWindow: false
}
......@@ -23,7 +23,7 @@ export default {
watch: {
watchFlag: {
immediate: true,
handler (newval) {
handler(newval) {
console.log(newval, '===')
this.showWindow = newval
this.hideLoading()
......@@ -31,12 +31,11 @@ export default {
}
},
computed: {
watchFlag () {
watchFlag() {
return this.$store.state.app.showWindow
}
},
mounted () {
},
mounted() {},
methods: {}
}
......
// 需要那个,引入那个
import {
ImagePreview,
Checkbox,
Collapse,
CollapseItem,
Swipe,
SwipeItem,
Dialog,
Toast,
Field,
Popup,
Picker,
Form,
Button,
Icon,
Tab,
Tabs,
PullRefresh,
List,
Tag,
Empty,
DatetimePicker,
Search,
Switch,
Cell,
CellGroup,
Loading
} from 'vant'
// 导出一个函数,接收一个app参数,在函数中注册组件
export function vant(app) {
// 别忘了注册
app.use(Swipe)
app.use(SwipeItem)
app.use(Dialog)
app.use(Toast)
app.use(Popup)
app.use(Picker)
app.use(Form)
app.use(Field)
app.use(Button)
app.use(Icon)
app.use(Collapse)
app.use(CollapseItem)
app.use(Checkbox)
app.use(ImagePreview)
app.use(Tab)
app.use(Tabs)
app.use(PullRefresh)
app.use(List)
app.use(Tag)
app.use(Empty)
app.use(DatetimePicker)
app.use(Search)
app.use(Switch)
app.use(Cell)
app.use(CellGroup)
app.use(Loading)
}
......@@ -16,6 +16,9 @@ import router from './router'
import store from './store'
import api from './api'
import { fetchConfig, cfg } from '@/config'
import { vant } from '@/config/vant.config.js'
// import mixin from './mixins/index'
vant(Vue)
import '@/assets/css/index.scss'
import { bus, tools, store as local, util } from './utils'
import './utils/util'
......@@ -36,18 +39,18 @@ Vue.prototype.to = function (name, params) {
Vue.config.productionTip = false
import VConsole from 'vconsole'
const isMock = ['prod','production'].includes(process.env.NODE_ENV)
const isMock = ['prod', 'production'].includes(process.env.NODE_ENV)
fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
Vue.use(cfg)
window.$fetchConfig = res
if (res.vconsole) new VConsole()
// if (res.vconsole) new VConsole()
/**登录过期 重新登录 */
window.reLogin = () => {
util.removeLocalStorage('ww_userInfo')
util.clearSessionId()
store.dispatch('navigation')
store.dispatch('navigation') // 暂时不管登录过期
}
window.vm = new Vue({
el: '#app',
......
......@@ -3,5 +3,42 @@ export const mobilePages = {
{
name: 'index'
}
],
recruitManage: [
{
name: 'recruitManage/recruitManage',
path: '/recruitManage/recruitManage',
meta: {
title: '招聘管理'
}
},
{
name: 'recruitInsert/recruitInsert',
path: '/recruitManage/recruitInsert',
meta: {
title: '添加招聘需求'
}
},
{
name: 'recruitDetail/recruitDetail',
path: '/recruitManage/recruitDetail',
meta: {
title: '招聘详情'
}
},
{
name: 'recruitResult/recruitResult',
path: '/recruitManage/recruitResult',
meta: {
title: '提交成功'
}
},
{
name: 'recruitmentReview/recruitmentReview',
path: '/recruitManage/recruitmentReview',
meta: {
title: '招聘审核'
}
}
]
}
\ No newline at end of file
}
......@@ -12,16 +12,15 @@ import routes from './routes'
import store from '@/store'
// hack router push callback
const originalPush = Router.prototype.push
Router.prototype.push = function push (location, onResolve, onReject) {
Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)
const Adaptive = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|WebOS|Symbian|Windows Phone)/i,
isMobile = (Adaptive.exec(navigator.userAgent))
const router = createRouter()
function createRouter () {
function createRouter() {
return new Router({
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base: process.env.BASE_URL,
......@@ -33,12 +32,6 @@ function createRouter () {
}
// http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/
router.beforeEach((to, from, next) => {
if (!isMobile && to.name !== 'pc') next({
path: '/pc'
})
if (isMobile && to.name !== 'mobile') next({
path: '/mobile'
})
store.commit('SET_LAST_PATH', to.name)
/* 路由发生变化修改页面title */
store.dispatch('setPageMeta', to.meta)
......@@ -47,14 +40,14 @@ router.beforeEach((to, from, next) => {
if (to.matched.some(recode => recode.meta.noAuth)) {
store.state.app.showWindow = true
} else {
store.dispatch('navigation', to)
store.dispatch('navigation', to) // 暂时不管登录过期
}
next()
})
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter () {
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router
\ No newline at end of file
export default router
import { mobilePages } from './mobile'
import { pcPages } from './pc'
const keepAlives = []
const Adaptive = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|WebOS|Symbian|Windows Phone)/i,
isMobile = (Adaptive.exec(navigator.userAgent)),
pages = isMobile ? mobilePages : pcPages; // 动态选择routes对象
// const getPages = _ => {
// let router = {
// path: '/',
// // name: 'index',
// redirect: `${isMobile ? '/mobile' : '/pc'}`,
// // component: resolve => require([`views/index.vue`], resolve)
// }
// router.children = routes.map(e => {
// let name = `${e.name}`
// let route = {
// path: e.path,
// name,
// meta: e.meta || {},
// component: resolve => require([`views/${name}/index.vue`], resolve)
// }
// // if (e.children) route.children = setChildren(e, name)
// if (e.meta && e.meta.keepAlive) keepAlives.push(name)
// return route
// })
// return [router]
// }
// 合并所有页面配置
const pages = { ...mobilePages, ...pcPages }
let routes = [
{
path:'/',
redirect: `${isMobile ? '/mobile' : '/pc'}`
path: '/',
redirect: '/mobile' // 默认重定向到 mobile,或者根据需求改为其他
}
]
Object.keys(pages).map(parent => {
pages[parent].map(val => {
let childrenPath = `${parent}/${val.name}`
let { meta } = val
const path = `/${val.name == 'index' ? parent : childrenPath}`
const name = val.name == 'index' ? parent : childrenPath.replace('/', '.')
const path = val.path || `/${val.name == 'index' ? parent : childrenPath}`
const name = val.name == 'index' ? parent : val.name
if (meta && meta.keepAlive) keepAlives.push(name)
let route = {
component: resolve => require([`views/${childrenPath}.vue`], resolve),
......@@ -47,6 +29,7 @@ Object.keys(pages).map(parent => {
routes.push(route)
})
})
export const keeps = keepAlives
export default routes
\ No newline at end of file
export default routes
......@@ -10,27 +10,29 @@ const state = {
import router from '@/router'
const mutations = {
SET_PAGE_META (state, meta) {
SET_PAGE_META(state, meta) {
state.pageMeta = meta
},
SET_LAST_PATH (state, path) {
SET_LAST_PATH(state, path) {
state.lastPath = path
}
}
const actions = {
setPageMeta ({ commit }, meta) {
setPageMeta({ commit }, meta) {
document.title = meta.title || '企微招聘'
commit('SET_PAGE_META', meta)
},
registerHttp ({ }, sessionId = '') {
registerHttp({}, sessionId = '') {
let { scrmRequest, djRequest } = window.$fetchConfig
window.$SCRM_HTTP = new Http({ ...scrmRequest, alert: Notify })
window.$DJ_HTTP = new Http({ ...djRequest, alert: Notify, headers: { token: sessionId } })
},
async login ({ dispatch }) {
async login({ dispatch }) {
console.log('login')
return
try {
const wwCode = getParams('code'),
{ corpId, agentId } = util.getLocalStorage('ww_storage_info'),
{ corpId, agentId } = util.getLocalStorage('ww_storage_info') || {},
paramsPhone = util.getLocalStorage('ww_params_phone'),
{ loginUrl } = window.$fetchConfig
if (wwCode) {
......@@ -64,14 +66,13 @@ const actions = {
} else throw ''
} else throw ''
} else throw message
}
else window.location.href = `${loginUrl}?redirect_uri=${encodeURIComponent(window.location.href)}&corpId=${corpId}&agentId=${agentId}&backLoginCode=BACKCODE`
} else window.location.href = `${loginUrl}?redirect_uri=${encodeURIComponent(window.location.href)}&corpId=${corpId}&agentId=${agentId}&backLoginCode=BACKCODE`
} catch (error) {
if (!error) error = '登录失败或无权限'
if (error) Notify(typeof error === 'string' ? error : error.toString())
}
},
navigation ({ dispatch }, to) {
navigation({ dispatch }, to) {
let { corpId, agentId, phone } = getParams(),
userInfo = util.getLocalStorage('ww_userInfo')
if (phone) util.setLocalStorage('ww_params_phone', phone)
......@@ -88,7 +89,7 @@ const actions = {
util.showLoading()
dispatch('login')
}
},
}
}
const getParams = name => {
let [url, paramsList] = window.location.href.split('?')
......
No preview for this file type
No preview for this file type
<template>
<div class="pc-layout">
PC端首页
</div>
<div class="pc-layout">PC端首页2222</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
data() {
return {}
},
methods: {
}
mounted() {},
methods: {}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file
const djStaffUrl = '/rop-dj-staff-miniprogram/router'
const djBusinessUrl = '/rop-dj-business-school-miniprogram/router'
const djSmartCarlifeUrl = '/dj.api.smartcarlife' // Just a guess, checking previous api.js usage
// Helper function to simulate api.post from the original file using window.$DJ_HTTP
// Original: api.post(method, data, [], url)
function post(method, data = {}, url, options = {}) {
// Merge method into data as per ssoApi.js pattern for $DJ_HTTP
const payload = {
method,
technicalSupervisorName: '梁老湿', // 技术督导姓名
technicalSupervisorPhone: '15814019200', // 技术督导手机号
sessionId: '8bcad25d-8bfa-41a8-a5e8-ef06ace89ee8',
...data
}
return window.$DJ_HTTP({
url,
data: payload,
...options
})
}
export default {
// 获取招聘管理列表数据
getRecruitList(data) {
// return post('dj.api.staff.h5.recruitment.page', data, djStaffUrl)
return post('dj.api.staff.h5.recruitment.demand.technicalSupervisor.page', data, djStaffUrl)
},
// 获取招聘管理详情
getRecruitDetailAPI(data) {
// http://192.168.1.86:8594/rop-dj-staff-miniprogram/router/dj.api.staff.h5.recruitment.demand.technicalSupervisor.demand.detail/1.0.0
return post('dj.api.staff.h5.recruitment.demand.technicalSupervisor.demand.detail', data, djStaffUrl, { hideloading: true })
},
// 处理简历
processResumeAPI(data) {
return post('dj.api.staff.h5.recruitment.resume.technicalSupervisor.process', data, djStaffUrl)
// return post('dj.api.staff.h5.recruitment.resume.process', data, djStaffUrl)
},
// 招聘需求-确认/驳回
// http://192.168.1.86:8594/rop-dj-staff-miniprogram/router/dj.api.staff.h5.recruitment.demand.technicalSupervisor.status.update/1.0.0
updateDemandStatusAPI(data) {
return post('dj.api.staff.h5.recruitment.demand.technicalSupervisor.status.update', data, djStaffUrl)
},
// 招聘需求-统计
// http://192.168.1.86:8594/rop-dj-staff-miniprogram/router/dj.api.staff.h5.recruitment.demand.technicalSupervisor.stat/1.0.0
getDemandStatAPI(data) {
return post('dj.api.staff.h5.recruitment.demand.technicalSupervisor.stat', data, djStaffUrl)
},
// 招聘管理门店列表
// getDemandStoreListAPI(data) {
// return post('dj.api.staff.h5.recruitment.demand.store.list', data, djStaffUrl)
// },
// // 招聘管理字典查询
// getStaffDictListAPI(data) {
// return post('dj.api.staff.h5.dict.list', data, djStaffUrl)
// },
// /** 待处理招聘统计 */
// waitstaffstateAPI(data) {
// return post('dj.api.staff.h5.recruitment.demand.stat', data, djStaffUrl)
// },
// /** 添加招聘需求 */
// addStaffDictListAPI(data) {
// return post('dj.api.staff.h5.recruitment.demand.add', data, djStaffUrl)
// },
// /** 确认招聘需求 flag? */
// confiremStaffFlagAPI(data) {
// return post('dj.api.staff.h5.recruitment.confirm', data, djStaffUrl)
// },
// // 获取带教任务数量
// getMentorShipTaskNum(data) {
// return post('dj.api.businessSchool.miniProgram.teachTask.count', data, djBusinessUrl)
// },
// The following APIs didn't have a specific URL in the original file,
// they just had 2 args: api.post(method, data).
// I'll assume they might use a default URL or I need to check where they point.
// Original: return api.post('dj.api.smartcarlife.selectOrderGoods.list', data)
// ssoApi.js uses window.$DJ_HTTP for 'dj.api.*'.
// I will use a default URL or the biUrl from ssoApi if appropriate, but ssoApi used '/rop-dj-pe-analysis/router'.
// Let's assume they go to the default DJ gateway if no URL provided?
// But wait, the original api.post signature was (method, data, [], url).
// When url is missing, what does it default to?
// In `ssoApi.js`, `loginByPhone` uses `/rop-dj-pe-analysis/router`.
// I will leave the URL blank or use a default if I can find one.
// For now, I'll map them to `window.$DJ_HTTP` without a specific URL if not known,
// or maybe they are not used in this module?
// The module is `recruitManage`. `selectOrderGoods` seems unrelated?
// I will comment them out or keep them as is with a TODO if they seem unrelated.
// They seem like copy-paste leftovers (smartcarlife, updateCustomerphotos).
// I'll include them but using a generic post wrapper.
// 根据商户号获取可选商品列表
getSelectOrderGoodsList(data) {
// Assuming default gateway if no URL specified
return post('dj.api.smartcarlife.selectOrderGoods.list', data, '')
},
// 更新施图
updateCustomerphotos(data) {
return post('dj.api.smartcarlife.updateCustomerphotos', data, '')
},
// 技师施工图片审批
technicianApprove(data) {
return post('dj.api.smartcarlife.technician.approve', data, '')
},
// 退款审批列表查询
getRefundReviewListAPI(data) {
return post('dj.api.smartcarlife.refundApplyRecord.waitForAudit.list', data, '')
},
// 日报填报前参数校验
dailyReportCheck(data) {
return post('dj.api.smartcarlife.staff.daily.report.data.check', data, '')
}
}
No preview for this file type
// packageEquity/pages/recruitManage/pages/recruitDetail/recruitDetail.js
import { unix } from 'dayjs'
import { getRecruitDetailAPI, processResumeAPI } from '../api'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
// 统计列表配置映射
const STATISTICS_CONFIG = [
{ title: '需求数量', field: 'recruitmentQuantity' },
{ title: '投递简历数', field: 'resumeCount' },
{ title: '处理简历数', field: 'processResumeCount' },
{ title: '试岗人数', field: 'trialOnboardingCount' },
{ title: '入职人数', field: 'entryCount' }
]
// 入职计划卡片字段配置
const ONBOARDING_FIELDS_CONFIG = [
{ label: '性格', field: 'personalityName' },
{ label: '能力表现', field: 'abilityPerformanceName' },
{ label: '学历', field: 'educationLevelName' },
{ label: '形象', field: 'appearanceName' },
{ label: '岗位匹配度', field: 'positionMatchDegreeName' }
]
// 招聘信息字段配置
const RECRUITMENT_INFO_CONFIG = [
{ label: '门店名称', field: 'merchantName' },
{ label: '业务类型', field: 'businessTypeName' },
{ label: '招聘类型', field: 'recruitmentTypeName' },
{ label: '需求描述', field: 'requirementDescription' },
{ label: '招聘负责人', field: 'recruiterName' },
{ label: '技术督导', field: 'technicalSupervisorName' },
{ label: '申请时间', field: 'createdDate' },
{ label: '拒绝理由', field: 'recallReason' }
]
// 招聘状态映射配置
const RECRUIT_STATUS_CONFIG = {
// mixResult状态映射
0: { text: '待处理', class: 'pending', canProcess: true },
1: { text: '人员不匹配', class: 'mismatch', canProcess: false },
2: { text: '面试通过', class: 'pass', canProcess: false },
3: { text: '面试不通过', class: 'fail', canProcess: false }
}
Page({
/**
* 格式化时间戳为 YYYY-MM-DD 格式
*/
formatDate(timestamp) {
if (!timestamp) return ''
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
/**
* 获取招聘状态信息
*/
getRecruitStatus(mixResult) {
return RECRUIT_STATUS_CONFIG[mixResult] || RECRUIT_STATUS_CONFIG[0]
},
/**
* 页面的初始数据
*/
data: {
IMG_URL,
reasonMaxLen: 37,
item: {},
recruitment: [],
statisticsList: [],
onboardingPlans: [],
recruitmentPlans: [],
trialOnboardingPlans: [],
recruitmentInfoConfig: RECRUITMENT_INFO_CONFIG,
onboardingFieldsConfig: ONBOARDING_FIELDS_CONFIG,
handleShowMessagePop: false, // 控制弹窗显示
timeShow: false, // 控制时间选择器显示
currentDate: new Date().getTime(),
today: new Date().getTime(), // 当前日期,用于限制日期选择器的最大值
formData: {}, // 弹窗表单数据
detailLoaded: false, // 标识是否已加载详情
curDataId: '',
isProcessing: false, // 是否正在处理中,防止重复提交
pageScrollTop: 0, // 保存页面滚动位置
// 时间选择器列表子项展示-格式化处理
formatter(type, value) {
if (type === 'year') {
return `${value}年`
}
if (type === 'month') {
return `${value}月`
}
if (type === 'day') {
return `${value}日`
}
return value
}
},
/**
* 显示时间选择器
*/
showTimePicker(e) {
if (e) {
e.stopPropagation && e.stopPropagation()
}
// 保存当前页面滚动位置(如果还没保存的话)
if (!this.data.pageScrollTop) {
const query = wx.createSelectorQuery()
query.selectViewport().scrollOffset()
query.exec(res => {
if (res && res[0]) {
this.setData({
pageScrollTop: res[0].scrollTop
})
}
})
}
// 重置为当前日期
this.setData({
timeShow: true,
currentDate: new Date().getTime()
})
},
/**
* 确认选择时间
*/
bindDateChange(event) {
const timestamp = event.detail
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const formattedDate = `${year}年${month}月${day}日`
const formattedFull = new Date(timestamp)
const { formData, pageScrollTop } = this.data
formData.interviewTime = `${year}-${month}-${day} 00:00:00`
formData.dipalyTime = formattedDate
this.setData(
{
formData,
timeShow: false,
currentDate: timestamp
},
() => {
// 恢复页面滚动位置(时间选择器关闭但主弹窗还开着的情况)
if (this.data.showPopup && pageScrollTop > 0) {
wx.pageScrollTo({
scrollTop: pageScrollTop,
duration: 0 // 立即恢复,无动画
})
}
}
)
},
/**
* 电话拨打
*/
phoneCall(e) {
let { phone } = e.currentTarget.dataset
wx.makePhoneCall({
phoneNumber: phone
})
},
/**
* 推荐理由
*/
handleShowReason(e) {
let { index } = e.currentTarget.dataset
const obj = this.data.recruitmentPlans[index]
const { reasonMaxLen } = this.data
this.setData({
[`recruitmentPlans[${index}].recommendedReasonTxt`]: obj.isShowReasonAll
? obj.recommendedReason.slice(0, reasonMaxLen) + '...'
: obj.recommendedReason,
[`recruitmentPlans[${index}].isShowReasonAll`]: !obj.isShowReasonAll
})
},
/**
* 取消选择时间
*/
calcelDate() {
const { pageScrollTop } = this.data
this.setData(
{
timeShow: false
},
() => {
// 恢复页面滚动位置
if (pageScrollTop > 0) {
wx.pageScrollTo({
scrollTop: pageScrollTop,
duration: 0 // 立即恢复,无动画
})
}
// 如果主弹窗也关闭了,重置保存的滚动位置
if (!this.data.showPopup) {
this.setData({
pageScrollTop: 0
})
}
}
)
},
/**
* 查看简历
*/
handleViewResume(e) {
// 节流控制:1秒内只能触发一次
const now = Date.now()
const throttleTime = 1000 // 节流时间:1秒
if (
this.lastViewResumeTime &&
now - this.lastViewResumeTime < throttleTime
) {
return
}
this.lastViewResumeTime = now
wx.showLoading({
title: '加载中',
mask: true
})
let { url } = e.currentTarget.dataset
let _this = this
if (!url) {
wx.$util.showToast('暂无简历信息')
return
}
const resumeType = url.split('.')[url.split('.').length - 1]
if (resumeType == 'png') {
wx.previewImage({
urls: [url], // 图片地址数组
current: url // 当前显示图片的链接
})
wx.hideLoading()
return true
}
wx.downloadFile({
// 示例 url,并非真实存在
url: url,
success: function (res) {
const manage = wx.getFileSystemManager()
let file = url.split('/')
let fileName = file[file.length - 1]
console.log('fileName', fileName)
console.log('manage', manage)
manage.saveFile({
tempFilePath: res.tempFilePath,
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
success: function (res) {
console.log('保存成功')
wx.openDocument({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
fileType: 'pdf',
showMenu: true,
success: function (res) {
console.log('打开文档成功')
}
})
},
fail: function (err) {
console.log('异常', err)
},
complete: function () {
wx.hideLoading()
}
})
// console.log(wx.env.USER_DATA_PATH + "/" + fileName,'wx.env.USER_DATA_PATH + "/" + fileName');
}
})
},
// 获取简历详情
getDetail(id) {
// 标记为已加载,避免重复调用
this.setData({
detailLoaded: true
})
getRecruitDetailAPI({
id: id
})
.then(res => {
let {
stat,
onboardingPlans,
recruitmentPlans,
recruitment,
trialOnboardingPlans
} = res.data
const { reasonMaxLen } = this.data
// 格式化 recruitmentPlans 中的 createdDate
if (recruitmentPlans && recruitmentPlans.length > 0) {
recruitmentPlans = recruitmentPlans.map(item => ({
...item,
createdDate: this.formatDate(item.createdDate),
recommendedReasonTxt: item.recommendedReason
? item.recommendedReason.length > reasonMaxLen
? item.recommendedReason.slice(0, reasonMaxLen) + '...'
: item.recommendedReason
: '-',
isShowReasonAll: false
}))
}
// 格式化 onboardingPlans 中的 onboardingDate
if (onboardingPlans && onboardingPlans.length > 0) {
onboardingPlans = onboardingPlans.map(item => ({
...item,
onboardingDate: this.formatDate(item.onboardingDate)
}))
}
// 格式化 trialOnboardingPlans 中的 onboardingDate
if (trialOnboardingPlans && trialOnboardingPlans?.length > 0) {
trialOnboardingPlans = trialOnboardingPlans.map(item => ({
...item,
onboardingDate: this.formatDate(item.onboardingDate)
}))
}
// 格式化 recruitment 中的 createdDate
if (recruitment && recruitment.createdDate) {
recruitment.createdDate = this.formatDate(recruitment.createdDate)
}
// 根据 businessType 动态过滤招聘信息配置
// 当 businessType == 1 时,显示拒绝理由;否则过滤掉拒绝理由项
const filteredRecruitmentInfoConfig = RECRUITMENT_INFO_CONFIG.filter(
item => {
// 特殊处理:拒绝理由字段仅在招聘状态为被驳回status:3时显示
if (item.field === 'recallReason') {
return recruitment.status == 3
}
return true
}
)
// 将stat数据更新到statisticsList(使用配置映射,代码更简洁)
this.setData({
statisticsList: STATISTICS_CONFIG.map(item => ({
title: item.title,
count: stat[item.field] || 0
})),
onboardingPlans: onboardingPlans,
recruitmentPlans: recruitmentPlans,
item: recruitment,
recruitment: recruitment,
recruitmentInfoConfig: filteredRecruitmentInfoConfig
})
})
.catch(err => {})
},
/**
* 处理按钮点击
*/
handleProcess(e) {
let { id } = e.currentTarget.dataset
// 保存当前页面滚动位置
const query = wx.createSelectorQuery()
query.selectViewport().scrollOffset()
query.exec(res => {
if (res && res[0]) {
this.setData({
pageScrollTop: res[0].scrollTop
})
}
})
this.setData({
showPopup: true,
currentDate: new Date().getTime(), // 重置当前时间为今天
formData: {
id: id,
processResult: '', // 处理结果
interviewTime: '', // 面试时间
description: '', // 说明
descriptionLength: 0 // 说明字数
}
})
},
/**
* 选择标签
*/
selectTag(e) {
const { field, value } = e.currentTarget.dataset
const { formData } = this.data
// 如果点击已选中的标签,则取消选中;否则选中
if (formData[field] === value) {
formData[field] = ''
} else {
formData[field] = value
}
// 当切换"处理结果"标签时,初始化相关表单数据
if (field === 'processResult') {
// 切换到"人员不匹配"时,清空面试相关字段
if (value == 1) {
formData.interviewTime = ''
formData.dipalyTime = ''
formData.interviewResult = ''
}
// 切换到"已完成面试"时,初始化面试相关字段为空
if (value == 2) {
formData.interviewTime = ''
formData.dipalyTime = ''
formData.interviewResult = ''
}
}
this.setData({
formData
})
},
/**
* 输入框输入
*/
handleInput(e) {
const { field } = e.currentTarget.dataset
const { value } = e.detail
const { formData } = this.data
formData[field] = value
this.setData({
formData
})
},
/**
* Textarea 输入处理(带字数统计)- 禁止空格和换行
*/
handleTextareaInput(e) {
const { field } = e.currentTarget.dataset
let value = e.detail.value
const { formData } = this.data
// 过滤掉空格
value = value.replace(/ /g, '')
// 限制最多200个字符
if (value.length > 200) {
value = value.substring(0, 200)
}
formData[field] = value
formData[field + 'Length'] = value.length // 统计字数
this.setData({
formData
})
},
/**
* 隐藏弹窗
*/
hidePopup() {
const { pageScrollTop } = this.data
this.setData(
{
showPopup: false,
timeShow: false,
isProcessing: false // 重置处理状态
},
() => {
// 恢复页面滚动位置
if (pageScrollTop > 0) {
wx.pageScrollTo({
scrollTop: pageScrollTop,
duration: 0 // 立即恢复,无动画
})
}
// 重置保存的滚动位置,供下次使用
this.setData({
pageScrollTop: 0
})
}
)
},
/**
* 阻止触摸移动事件(防止弹窗背景滚动)
*/
preventTouchMove(e) {
return false
},
/**
* 阻止事件冒泡
*/
stopPropagation() {
// 空方法,仅用于阻止事件冒泡
},
/**
* 确认处理
*/
confirmProcess() {
const { formData, isProcessing } = this.data
// 防止重复提交
if (isProcessing) return
// 验证必填项
if (!formData.processResult) {
wx.showToast({
title: '请选择处理结果',
icon: 'none'
})
return
}
// 对于面试通过和面试不通过,都需要选择面试时间
if (
(formData.processResult == 2 || formData.processResult == 3) &&
!formData.interviewTime
) {
wx.showToast({
title: '请选择面试时间',
icon: 'none'
})
return
}
// 对于面试通过和面试不通过,都需要选择面试时间
if (
(formData.processResult == 2 || formData.processResult == 3) &&
!formData.interviewResult
) {
wx.showToast({
title: '请选择面试结果',
icon: 'none'
})
return
}
// 设置处理状态为true,防止重复提交
this.setData({
isProcessing: true
})
let requestParams = {
id: formData.id,
processResult: formData?.processResult,
interviewTime: formData?.interviewTime,
interviewResult: formData?.interviewResult,
description: formData?.description
}
processResumeAPI(requestParams)
.then(result => {
let { code, message, data } = result
if (code == 0) {
// 处理成功刷新页面数据
this.getDetail(this.curDataId)
wx.showToast({
title: '处理成功',
icon: 'success'
})
// 处理完成后关闭弹窗
this.hidePopup()
} else {
// 处理失败,重置处理状态
this.setData({
isProcessing: false
})
wx.showToast({
title: message || '处理失败',
icon: 'error'
})
}
})
.catch(error => {
// 处理失败,重置处理状态
this.setData({
isProcessing: false
})
wx.showToast({
title: '处理失败',
icon: 'error'
})
})
},
// 更新数据(弹窗确认回调)
updateMentorShip(e) {
this.hidePopup()
},
// 生命周期函数--监听页面加载
onLoad(options) {
if (options?.id) {
const recruitId = options?.id
this.curDataId = options.id
this.getDetail(recruitId)
} else {
// 通过 eventChannel 接收参数(使用完整路径 / 开头时)
wx.$router.getData(res => {
const recruitId = res.id
this.curDataId = res.id || options.id
this.getDetail(recruitId)
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
})
{
"navigationBarTitleText": "招聘详情",
"disableScroll": false,
"usingComponents": {
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-popup": "@vant/weapp/popup/index",
"empty-card": "../components/emptyCard/emptyCard"
}
}
\ No newline at end of file
/* packageEquity/pages/recruitManage/pages/recruitDetail/recruitDetail.wxss */
page {
background-color: #F7F8FA;
}
.container_page {
&.page-locked {
position: fixed;
width: 100%;
overflow: hidden;
}
.content_top {
height: var(--fontSize138);
opacity: 1;
background: #ffffff;
.statistics {
display: flex;
align-items: center;
justify-content: center;
gap: var(--fontSize20);
height: 100%;
padding: 0 var(--fontSize23);
.statistic_item {
width: var(--fontSize150);
height: var(--fontSize90);
opacity: 1;
position: relative;
text-align: center;
.title {
color: #5a5e66;
font-size: var(--fontSize24);
}
.count {
color: #347bff;
font-size: var(--fontSize36);
font-weight: Bold;
line-height: var(--fontSize44);
margin-top: var(--fontSize12);
}
&:not(:last-child)::after {
content: '';
position: absolute;
right: calc(var(--fontSize20) / -2);
top: 50%;
transform: translateY(-50%);
width: 1px;
height: var(--fontSize60);
background-color: #f1f1f1e1;
}
}
}
}
.content_main {
padding: 0 var(--fontSize36);
.block_title {
box-sizing: border-box;
color: #292d33;
font-weight: 600;
font-size: var(--fontSize28);
padding: var(--fontSize20) 0;
min-height: var(--fontSize80);
}
.sub_title {
color: #999ea8;
text-align: left;
font-size: var(--fontSize24);
line-height: var(--fontSize34);
padding-top: var(--fontSize4);
}
// 卡片公共样式
.card,
.card-empty {
padding: var(--fontSize24) var(--fontSize20);
background: #ffffff;
box-sizing: border-box;
border-radius: var(--fontSize16);
box-shadow: 0 var(--fontSize4) var(--fontSize20) 0 #0000001a;
margin-bottom: var(--fontSize20);
}
.card-empty {
height: var(--fontSize224);
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
color: #999999;
font-size: var(--fontSize24);
.icon {
width: var(--fontSize128);
height: var(--fontSize80);
margin-bottom: var(--fontSize16);
}
}
// 卡片顶部
.card_top {
display: flex;
align-items: flex-end; // 所有子元素底部对齐
margin-bottom: var(--fontSize20);
.user_info {
display: flex;
flex-direction: column;
justify-content: space-between;
flex: 1;
min-height: var(--fontSize96); // 与头像高度保持一致
margin-left: var(--fontSize16);
.user_top {
display: flex;
justify-content: space-between;
align-items: flex-start;
.name {
line-height: 1.2;
color: #292d33;
font-size: var(--fontSize30);
flex: 1;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: var(--fontSize460);
}
.tag {
display: inline-block;
padding: var(--fontSize4) var(--fontSize12);
font-size: var(--fontSize20);
border-radius: var(--fontSize4);
margin-left: var(--fontSize8);
// 待处理状态
&.tag-pending {
color: #ff9d0a;
background: #fff5e6;
}
// 已完成状态
&.tag-completed {
color: #52c41a;
background: #52c41a1a;
}
// 人员不匹配状态
&.tag-mismatch {
color: #ff4d4f;
background: #ff4d4f1a;
}
// 面试通过状态
&.tag-pass {
color: #52c41a;
background: #52c41a1a;
}
// 面试不通过状态
&.tag-fail {
color: #ff4d4f;
background: #ff4d4f1a;
}
}
}
.user_bottom {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-top: auto; // 推到底部
.phone {
color: #333333;
font-size: var(--fontSize26);
margin-top: auto;
font-weight: 550;
.phone_text {
line-height: var(--fontSize50);
}
.phone_icon {
width: var(--fontSize48);
height: var(--fontSize48);
}
}
.date {
color: #5A5E66;
font-size: var(--fontSize25);
text-align: right;
flex-shrink: 0;
margin-left: var(--fontSize16);
padding-bottom: var(--fontSize10);
}
}
}
.user_icon {
width: var(--fontSize96);
height: var(--fontSize96);
border-radius: var(--fontSize8);
}
}
.card_middle {
margin-bottom: var(--fontSize20);
font-size: var(--fontSize24);
.label,
.tips {
color: #999ea8;
}
.label {
width: var(--fontSize120);
flex-shrink: 0;
}
.value {
position: relative;
width: 100%;
color: #292d33;
word-wrap: break-word;
word-break: break-all;
}
.show {
display: inline-block;
}
.btn-reason-all {
position: absolute;
bottom: 0;
right: 0;
text-align: right;
width: var(--fontSize144);
background-color: #FFFFFF;
background: linear-gradient(90deg, #ffffff80 0%, #ffffff 100%);
}
.reason-box {
display: flex;
}
}
// 入职计划模块
.entry_plan {
.card_content {
display: flex;
flex-wrap: wrap;
gap: var(--fontSize16) 0;
.item {
width: 50%;
display: flex;
line-height: 1.5;
.label {
color: #999ea8;
font-size: var(--fontSize24);
flex-shrink: 0;
}
.value {
color: #292d33;
font-size: var(--fontSize24);
word-wrap: break-word;
word-break: break-all;
flex: 1;
}
}
}
}
// 招聘计划模块
.recruit_plan {
.card {
min-height: var(--fontSize282);
}
.btn_group {
display: flex;
justify-content: space-between;
align-items: center;
gap: var(--fontSize20);
.btn {
width: var(--fontSize327);
height: var(--fontSize60);
border-radius: var(--fontSize532);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize26);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
// 当只有一个按钮时,自动扩展宽度
&:only-child {
width: var(--fontSize670);
}
}
.btn_outline {
background: #347bff1a;
color: #347bff;
}
.btn_primary {
background: #347bff;
color: #ffffff;
}
}
}
// 招聘信息模块
.recruit_info {
.info_item {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: var(--fontSize16) 0;
// align-items: center;
&:last-child {
border-bottom: none;
}
.label {
color: #999ea8;
font-size: var(--fontSize28);
flex-shrink: 0;
line-height: 1.5;
}
.value {
color: #292d33;
font-size: var(--fontSize28);
text-align: right;
word-wrap: break-word;
word-break: break-all;
margin-left: var(--fontSize20);
line-height: 1.5;
}
.ji {
display: inline-block;
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
}
.phone_icon {
display: inline-block;
width: 32rpx;
height: 32rpx;
margin-left: 10rpx;
vertical-align: middle;
}
}
}
}
}
.popup_content {
.title {
height: var(--fontSize110);
opacity: 1;
background: #ffffff;
box-shadow: inset 0 -0.5px 0 0 #e8e8ea;
line-height: var(--fontSize110);
color: #292d33;
font-size: var(--fontSize32);
text-align: center;
font-weight: 600;
}
.form {
padding: var(--fontSize20);
.form_item {
display: flex;
justify-content: space-between;
align-items: center;
min-height: var(--fontSize104);
padding: var(--fontSize20) 0;
box-sizing: border-box;
border-bottom: 1px solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.label {
display: flex;
align-items: center;
color: #292d33;
font-size: var(--fontSize28);
flex-shrink: 0;
line-height: 1;
.required {
color: #ff4d4f;
margin-left: var(--fontSize4);
line-height: var(--fontSize24);
}
}
.value {
flex: 1;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
gap: var(--fontSize16);
margin-left: var(--fontSize20);
.arrow_right {
width: var(--fontSize14);
height: var(--fontSize28);
padding-top: var(--fontSize2);
}
.tag {
padding: var(--fontSize8) var(--fontSize20);
background: #f7f8fa;
color: #5a5e66;
font-size: var(--fontSize26);
border-radius: var(--fontSize8);
border: 1px solid transparent;
transition: all 0.3s;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
&.active {
background: #e8f4ff;
color: #347bff;
border-color: #347bff;
}
}
input {
flex: 1;
text-align: right;
color: #292d33;
font-size: var(--fontSize28);
&::placeholder {
color: #999ea8;
}
}
.time_text {
color: #292d33;
font-size: var(--fontSize28);
}
.placeholder_text {
color: #999ea8;
font-size: var(--fontSize28);
}
}
}
// textarea 特殊样式
.form_item_textarea {
align-items: flex-start;
flex-direction: column;
.label {
margin-bottom: var(--fontSize16);
}
.value {
width: 100%;
margin-left: 0;
.textarea_wrapper {
position: relative;
width: var(--fontSize710);
height: var(--fontSize440);
textarea {
width: 100%;
height: 100%;
padding: var(--fontSize20);
box-sizing: border-box;
border-radius: var(--fontSize16);
border: 1px solid #eff0f2;
color: #292d33;
font-size: var(--fontSize28);
line-height: 1.5;
&::placeholder {
color: #999ea8;
}
}
.char_count {
position: absolute;
right: var(--fontSize20);
bottom: var(--fontSize20);
color: #999ea8;
font-size: var(--fontSize24);
}
}
}
}
}
.popup_footer {
display: flex;
padding: 0 var(--fontSize20);
gap: var(--fontSize20);
background: #ffffff;
.btn {
flex: 1;
height: var(--fontSize80);
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--fontSize8);
font-size: var(--fontSize30);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.btn_cancel {
background: #f7f8fa;
color: #5a5e66;
}
.btn_confirm {
background: #347bff;
color: #ffffff;
&.btn_disabled {
background: #cccccc;
color: #ffffff;
opacity: 0.8;
pointer-events: none;
}
}
}
}
// 时间选择器弹窗优化
.van-popup {
z-index: 10000 !important;
}
// 时间选择器工具栏样式优化
page {
padding-bottom: var(--fontSize96);
// 确认按钮样式
.van-picker__confirm {
color: #347BFF !important;
font-size: var(--fontSize28) !important; // 14px
padding-top: var(--fontSize36) !important; // 18px
height: auto !important;
line-height: normal !important;
}
// 工具栏内的确认按钮
.van-picker__toolbar {
.van-picker__confirm {
color: #347BFF !important;
font-size: var(--fontSize28) !important;
padding-top: var(--fontSize36) !important;
}
}
}
\ No newline at end of file
<template>
<div class="recruit-detail-page">
<!-- 顶部数据统计 -->
<div class="content_top">
<div class="statistics">
<div class="statistic_item" v-for="(item, index) in statisticsList" :key="index">
<div class="title">{{ item.title }}</div>
<div class="count">{{ item.count }}</div>
</div>
</div>
</div>
<!-- 主模块 -->
<div class="content_main">
<!-- 入职计划模块 -->
<div class="entry_plan">
<div class="block_title">入职计划</div>
<div v-if="onboardingPlans.length">
<div class="card" v-for="(item, index) in onboardingPlans" :key="index">
<div class="card_top">
<van-icon name="manager" class="user_icon_font" color="#3975C6" size="48" />
<div class="user_info">
<div class="user_top">
<div class="name">{{ item.personName }}</div>
</div>
<div class="user_bottom">
<div class="phone">
<span class="phone_text">{{ item.phoneNumber }}</span>
<a v-if="item.phoneNumber" :href="'tel:' + item.phoneNumber" class="phone-icon-wrapper">
<img class="phone_icon" src="../image/call-icon.png" />
</a>
</div>
<div class="date">入职时间:{{ item.onboardingDate }}</div>
</div>
</div>
</div>
<div class="card_content">
<div class="item" v-for="fieldItem in onboardingFieldsConfig" :key="fieldItem.field">
<span class="label">{{ fieldItem.label }}:</span>
<span class="value">{{ item[fieldItem.field] }}</span>
</div>
</div>
</div>
</div>
<div v-else>
<van-empty description="暂无内容" />
</div>
</div>
<!-- 试岗计划 -->
<div class="entry_plan">
<div class="block_title">试岗计划</div>
<div v-if="trialOnboardingPlans.length">
<div class="card" v-for="(item, index) in trialOnboardingPlans" :key="index">
<div class="card_top">
<van-icon name="manager" class="user_icon_font" color="#3975C6" size="48" />
<div class="user_info">
<div class="user_top">
<div class="name">{{ item.personName }}</div>
</div>
<div class="user_bottom">
<div class="phone">
<span class="phone_text">{{ item.phoneNumber }}</span>
<a v-if="item.phoneNumber" :href="'tel:' + item.phoneNumber" class="phone-icon-wrapper">
<img class="phone_icon" src="../image/call-icon.png" />
</a>
</div>
<div class="date">试岗时间:{{ item.trialTime }}</div>
</div>
</div>
</div>
</div>
</div>
<div v-else>
<van-empty description="暂无内容" />
</div>
</div>
<!-- 招聘计划模块 -->
<div class="recruit_plan">
<div class="block_title">
招聘计划
<div class="sub_title">请及时跟进简历处理结果:获取简历后,若人员初评不匹配可及时退回;若简历合适,可在面试完成后完善面试结果。</div>
</div>
<div v-if="recruitmentPlans.length">
<div class="card" v-for="(item, index) in recruitmentPlans" :key="index">
<div class="card_top">
<van-icon name="manager" class="user_icon_font" color="#3975C6" size="48" />
<div class="user_info">
<div class="user_top">
<div class="name">{{ item.personName }}</div>
<div class="tag" :class="getRecruitStatusClass(item)">
{{ getRecruitStatusText(item) }}
</div>
</div>
<div class="user_bottom">
<div class="phone">
<span class="phone_text">{{ item.phoneNumber }}</span>
<a v-if="item.phoneNumber" :href="'tel:' + item.phoneNumber" class="phone-icon-wrapper">
<img class="phone_icon" src="../image/call-icon.png" />
</a>
</div>
<div class="date">投递时间:{{ item.createdDate }}</div>
</div>
</div>
</div>
<div class="card_middle">
<div class="reason-box">
<div class="label">推荐理由:</div>
<div class="value">
{{ item.recommendedReasonTxt }}
<div v-if="item.recommendedReason && item.recommendedReason.length > reasonMaxLen" class="tips" :class="{ show: item.isShowReasonAll }" @click="handleShowReason(index)">
<span v-if="item.isShowReasonAll">收起</span>
<div v-else class="btn-reason-all">查看全部</div>
</div>
</div>
</div>
</div>
<div class="card_content">
<div class="btn_group">
<div class="btn btn_outline" @click="handleViewResume(item.resumeUrl)">查看简历</div>
<div v-if="item.processResult == null" class="btn btn_primary" @click="handleProcess(item.id)">处理</div>
</div>
</div>
</div>
</div>
<div v-else>
<van-empty description="暂无内容" />
</div>
</div>
<!-- 招聘信息模块 -->
<div class="recruit_info">
<div class="block_title">招聘信息</div>
<div v-if="recruitmentInfoConfig && recruitmentInfoConfig.length">
<div class="card">
<div class="info_item" v-for="infoItem in recruitmentInfoConfig" :key="infoItem.field">
<span class="label">{{ infoItem.label }}</span>
<div class="value value_box" v-if="infoItem.label === '门店名称'">
<span>{{ recruitment[infoItem.field] || '--' }}</span>
<!-- <van-tag v-if="recruitment.urgent == 1" type="danger" style="margin-right: 5px">急</van-tag> -->
<img v-if="item.urgent == 1" class="ji" :src="`${IMG_URL}miniProgram/ji.png`" />
</div>
<div class="value value_box" v-else-if="infoItem.label === '招聘负责人' || infoItem.label === '技术督导'">
<span>{{ recruitment[infoItem.field] || '--' }}</span>
<a
v-if="(infoItem.label === '招聘负责人' && recruitment.recruiterPhone) || (infoItem.label === '技术督导' && recruitment.technicalSupervisorPhone)"
:href="'tel:' + (infoItem.label === '招聘负责人' ? recruitment.recruiterPhone : recruitment.technicalSupervisorPhone)"
class="phone-icon-wrapper"
>
<img class="phone_icon" src="../image/call-icon.png" />
</a>
</div>
<span class="value" v-else>{{ recruitment[infoItem.field] || '--' }}</span>
</div>
</div>
</div>
<div v-else>
<van-empty description="暂无内容" />
</div>
</div>
</div>
<!-- 简历处理弹窗 -->
<van-popup v-model="showPopup" position="bottom" round :lock-scroll="true" @touchmove.prevent class="process-popup">
<div class="popup_content">
<div class="title">简历处理</div>
<div class="scroll-view" style="overflow-y: auto; max-height: 443px">
<div class="form">
<div class="form_item">
<div class="label">
处理结果
<span class="required">*</span>
</div>
<div class="value">
<span class="tag" :class="{ active: formData.processResult == 1 }" @click="selectTag('processResult', 1)">人员不匹配</span>
<span class="tag" :class="{ active: formData.processResult == 2 }" @click="selectTag('processResult', 2)">已完成面试</span>
</div>
</div>
<div class="form_item" v-if="formData.processResult == 2">
<div class="label">
面试时间
<span class="required">*</span>
</div>
<div class="value" @click.stop="showTimePicker">
<div :class="formData.dipalyTime ? 'time_text' : 'placeholder_text'">{{ formData.dipalyTime || '请选择面试时间' }}</div>
<van-icon name="arrow" color="#999" />
</div>
</div>
<div class="form_item" v-if="formData.processResult == 2">
<div class="label">
面试结果
<span class="required">*</span>
</div>
<div class="value">
<span class="tag" :class="{ active: formData.interviewResult == '1' }" @click="selectTag('interviewResult', '1')">通过</span>
<span class="tag" :class="{ active: formData.interviewResult == '0' }" @click="selectTag('interviewResult', '0')">不通过</span>
</div>
</div>
<div class="form_item form_item_textarea">
<div class="label">说明</div>
<div class="value">
<div class="textarea_wrapper">
<textarea placeholder="请输入说明" v-model="formData.description" @input="handleTextareaInput" maxlength="200"></textarea>
<div class="char_count">{{ formData.descriptionLength || 0 }}/200</div>
</div>
</div>
</div>
</div>
</div>
<div class="popup_footer">
<div class="btn btn_cancel" @click="hidePopup">取消</div>
<div class="btn btn_confirm" :class="{ btn_disabled: isProcessing }" @click="confirmProcess">{{ isProcessing ? '处理中...' : '确认' }}</div>
</div>
</div>
</van-popup>
<!-- 时间选择器 -->
<van-popup v-model="timeShow" position="bottom" round z-index="10000" @touchmove.prevent>
<van-datetime-picker v-model="currentDate" type="date" :formatter="formatter" :max-date="today" @confirm="bindDateChange" @cancel="calcelDate" />
</van-popup>
</div>
</template>
<script>
import api from '../api'
// import EmptyCard from '../components/emptyCard/emptyCard'
import { ImagePreview } from 'vant'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
// 统计列表配置映射
const STATISTICS_CONFIG = [
{ title: '需求数量', field: 'recruitmentQuantity' },
{ title: '投递简历数', field: 'resumeCount' },
{ title: '处理简历数', field: 'processResumeCount' },
{ title: '试岗人数', field: 'trialOnboardingCount' },
{ title: '入职人数', field: 'entryCount' }
]
// 入职计划卡片字段配置
const ONBOARDING_FIELDS_CONFIG = [
{ label: '性格', field: 'personalityName' },
{ label: '能力表现', field: 'abilityPerformanceName' },
{ label: '学历', field: 'educationLevelName' },
{ label: '形象', field: 'appearanceName' },
{ label: '岗位匹配度', field: 'positionMatchDegreeName' }
]
// 招聘信息字段配置
const RECRUITMENT_INFO_CONFIG = [
{ label: '门店名称', field: 'merchantName' },
{ label: '业务类型', field: 'businessTypeName' },
{ label: '招聘类型', field: 'recruitmentTypeName' },
{ label: '需求描述', field: 'requirementDescription' },
{ label: '招聘负责人', field: 'recruiterName' },
{ label: '技术督导', field: 'technicalSupervisorName' },
{ label: '申请时间', field: 'createdDate' },
{ label: '拒绝理由', field: 'recallReason' }
]
export default {
name: 'RecruitDetail',
components: {
// EmptyCard
},
data() {
return {
IMG_URL,
reasonMaxLen: 37,
item: {},
recruitment: {},
statisticsList: [],
onboardingPlans: [],
recruitmentPlans: [],
trialOnboardingPlans: [],
recruitmentInfoConfig: RECRUITMENT_INFO_CONFIG,
onboardingFieldsConfig: ONBOARDING_FIELDS_CONFIG,
showPopup: false,
timeShow: false,
currentDate: new Date(),
today: new Date(),
formData: {},
detailLoaded: false,
curDataId: '',
isProcessing: false
}
},
created() {
const { id } = this.$route.query
console.log(id, this.$route.query)
if (id) {
this.curDataId = id
this.getDetail(id)
}
},
methods: {
formatter(type, value) {
if (type === 'year') {
return `${value}年`
}
if (type === 'month') {
return `${value}月`
}
if (type === 'day') {
return `${value}日`
}
return value
},
formatDate(timestamp) {
if (!timestamp) return ''
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
getRecruitStatusClass(item) {
const processResult = item.processResult
const interviewResult = item.interviewResult
if (processResult == null) return 'tag-pending'
if (processResult == 1) return 'tag-mismatch'
if (processResult == 2 && interviewResult == null) return 'tag-pending'
if (interviewResult == 0) return 'tag-fail'
if (interviewResult == 1) return 'tag-pass'
return ''
},
getRecruitStatusText(item) {
const processResult = item.processResult
const interviewResult = item.interviewResult
if (processResult == null) return '待处理'
if (processResult == 1) return '人员不符合'
if (processResult == 2 && interviewResult == null) return '待面试'
if (interviewResult == 0) return '面试不通过'
if (interviewResult == 1) return '面试通过'
return ''
},
showTimePicker() {
this.timeShow = true
// Don't reset to today, keep selected if any, or today
if (!this.formData.interviewTime) {
this.currentDate = new Date()
}
},
bindDateChange(value) {
const date = new Date(value)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const formattedDate = `${year}年${month}月${day}日`
this.formData.interviewTime = `${year}-${month}-${day} 00:00:00`
this.formData.dipalyTime = formattedDate
this.timeShow = false
// Force update if needed
this.formData = { ...this.formData }
},
calcelDate() {
this.timeShow = false
},
handleShowReason(index) {
const obj = this.recruitmentPlans[index]
obj.isShowReasonAll = !obj.isShowReasonAll
// Update text
if (!obj.isShowReasonAll) {
obj.recommendedReasonTxt = obj.recommendedReason.length > this.reasonMaxLen ? obj.recommendedReason.slice(0, this.reasonMaxLen) + '...' : obj.recommendedReason
} else {
obj.recommendedReasonTxt = obj.recommendedReason
}
this.$set(this.recruitmentPlans, index, obj)
},
handleViewResume(url) {
if (!url) {
this.$toast('暂无简历信息')
return
}
const resumeType = url.split('.').pop().toLowerCase()
if (['png', 'jpg', 'jpeg', 'gif'].includes(resumeType)) {
ImagePreview([url])
} else {
window.open(url)
}
},
getDetail(id) {
this.detailLoaded = true
api
.getRecruitDetailAPI({ id: id })
.then(res => {
const data = res.data || res
let { stat, onboardingPlans, recruitmentPlans, recruitment, trialOnboardingPlans } = data
// Format recruitmentPlans
if (recruitmentPlans && recruitmentPlans.length > 0) {
recruitmentPlans = recruitmentPlans.map(item => ({
...item,
createdDate: this.formatDate(item.createdDate),
recommendedReasonTxt: item.recommendedReason
? item.recommendedReason.length > this.reasonMaxLen
? item.recommendedReason.slice(0, this.reasonMaxLen) + '...'
: item.recommendedReason
: '-',
isShowReasonAll: false
}))
}
// Format onboardingPlans
if (onboardingPlans && onboardingPlans.length > 0) {
onboardingPlans = onboardingPlans.map(item => ({
...item,
onboardingDate: this.formatDate(item.onboardingDate)
}))
}
// Format trialOnboardingPlans
if (trialOnboardingPlans && trialOnboardingPlans.length > 0) {
trialOnboardingPlans = trialOnboardingPlans.map(item => ({
...item,
trialTime: this.formatDate(item.trialTime)
}))
}
// Format recruitment
if (recruitment && recruitment.createdDate) {
recruitment.createdDate = this.formatDate(recruitment.createdDate)
}
// Filter config
const filteredRecruitmentInfoConfig = RECRUITMENT_INFO_CONFIG.filter(item => {
if (item.field === 'recallReason') {
return recruitment.status == 3
}
return true
})
this.statisticsList = STATISTICS_CONFIG.map(item => ({
title: item.title,
count: stat[item.field] || 0
}))
this.onboardingPlans = onboardingPlans
this.recruitmentPlans = recruitmentPlans
this.trialOnboardingPlans = trialOnboardingPlans || []
this.item = recruitment
this.recruitment = recruitment
this.recruitmentInfoConfig = filteredRecruitmentInfoConfig
})
.catch(err => {
console.error(err)
})
},
handleProcess(id) {
this.showPopup = true
this.currentDate = new Date()
this.formData = {
id: id,
processResult: '',
interviewTime: '',
description: '',
descriptionLength: 0,
interviewResult: ''
}
},
selectTag(field, value) {
if (this.formData[field] === value) {
this.formData[field] = ''
} else {
this.formData[field] = value
}
if (field === 'processResult') {
if (value == 1 || value == 2) {
this.formData.interviewTime = ''
this.formData.dipalyTime = ''
this.formData.interviewResult = ''
}
}
this.formData = { ...this.formData }
},
handleTextareaInput() {
let value = this.formData.description || ''
value = value.replace(/ /g, '')
if (value.length > 200) {
value = value.substring(0, 200)
}
this.formData.description = value
this.formData.descriptionLength = value.length
},
hidePopup() {
this.showPopup = false
this.timeShow = false
this.isProcessing = false
},
confirmProcess() {
if (this.isProcessing) return
const { formData } = this
if (!formData.processResult) {
this.$toast('请选择处理结果')
return
}
if (formData.processResult == 2 && !formData.interviewTime) {
this.$toast('请选择面试时间')
return
}
if (formData.processResult == 2 && !formData.interviewResult) {
this.$toast('请选择面试结果')
return
}
this.isProcessing = true
let requestParams = {
id: formData.id,
processResult: formData.processResult
}
if (formData.processResult == 1) {
requestParams.description = formData.description
} else if (formData.processResult == 2) {
requestParams.interviewTime = formData.interviewTime
requestParams.interviewResult = formData.interviewResult
requestParams.interviewExplanation = formData.description
}
api
.processResumeAPI(requestParams)
.then(() => {
this.getDetail(this.curDataId)
this.$toast.success('处理成功')
this.hidePopup()
})
.catch(error => {
this.isProcessing = false
console.error(error)
})
}
}
}
</script>
<style lang="scss" scoped>
.recruit-detail-page {
background-color: #f7f8fa;
min-height: 100vh;
padding-bottom: 48px;
.content_top {
height: 69px; // fontSize138
opacity: 1;
background: #ffffff;
.statistics {
display: flex;
align-items: center;
justify-content: center;
gap: 10px; // fontSize20
height: 100%;
padding: 0 11.5px; // fontSize23
.statistic_item {
width: 75px; // fontSize150
height: 45px; // fontSize90
opacity: 1;
position: relative;
text-align: center;
.title {
color: #5a5e66;
font-size: 12px; // fontSize24
}
.count {
color: #347bff;
font-size: 18px; // fontSize36
font-weight: Bold;
line-height: 22px; // fontSize44
margin-top: 6px; // fontSize12
}
&:not(:last-child)::after {
content: '';
position: absolute;
right: -5px; // calc(var(--fontSize20) / -2) -> -10px / 2 = -5px
top: 50%;
transform: translateY(-50%);
width: 1px;
height: 30px; // fontSize60
background-color: #f1f1f1e1;
}
}
}
}
.content_main {
padding: 0 18px; // fontSize36
.block_title {
box-sizing: border-box;
color: #292d33;
font-weight: 600;
font-size: 14px; // fontSize28
padding: 10px 0; // fontSize20
min-height: 40px; // fontSize80
}
.sub_title {
color: #999ea8;
text-align: left;
font-size: 12px; // fontSize24
line-height: 17px; // fontSize34
padding-top: 2px; // fontSize4
}
.card,
.card-empty {
padding: 12px 10px; // fontSize24 fontSize20
background: #ffffff;
box-sizing: border-box;
border-radius: 8px; // fontSize16
box-shadow: 0 2px 10px 0 #0000001a; // fontSize4 fontSize20
margin-bottom: 10px; // fontSize20
}
.card-empty {
height: 112px; // fontSize224
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
color: #999999;
font-size: 12px; // fontSize24
.icon {
width: 64px; // fontSize128
height: 40px; // fontSize80
margin-bottom: 8px; // fontSize16
}
}
.card_top {
display: flex;
align-items: flex-end;
margin-bottom: 10px; // fontSize20
.user_info {
display: flex;
flex-direction: column;
justify-content: space-between;
flex: 1;
min-height: 48px; // fontSize96
margin-left: 8px; // fontSize16
.user_top {
display: flex;
justify-content: space-between;
align-items: flex-start;
.name {
line-height: 1.2;
color: #292d33;
font-size: 15px; // fontSize30
flex: 1;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 230px; // fontSize460
}
.tag {
display: inline-block;
padding: 2px 6px; // fontSize4 fontSize12
font-size: 10px; // fontSize20
border-radius: 2px; // fontSize4
margin-left: 4px; // fontSize8
&.tag-pending {
color: #ff9d0a;
background: #fff5e6;
}
&.tag-completed {
color: #52c41a;
background: #52c41a1a;
}
&.tag-mismatch {
color: #ff4d4f;
background: #ff4d4f1a;
}
&.tag-pass {
color: #52c41a;
background: #52c41a1a;
}
&.tag-fail {
color: #ff4d4f;
background: #ff4d4f1a;
}
}
}
.user_bottom {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-top: auto;
.phone {
color: #333333;
font-size: 13px; // fontSize26
margin-top: auto;
font-weight: 550;
display: flex;
align-items: center;
.phone_text {
line-height: 25px; // fontSize50
}
.phone-icon-wrapper {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-radius: 4px;
color: #333;
margin-left: 5px;
}
.phone_icon {
width: 20px;
height: 20px;
vertical-align: middle;
}
}
.date {
color: #5a5e66;
font-size: 12.5px; // fontSize25
text-align: right;
flex-shrink: 0;
margin-left: 8px; // fontSize16
padding-bottom: 5px; // fontSize10
}
}
}
.user_icon {
width: 48px; // fontSize96
height: 48px; // fontSize96
border-radius: 4px; // fontSize8
}
}
.card_middle {
margin-bottom: 10px; // fontSize20
font-size: 12px; // fontSize24
.label,
.tips {
color: #999ea8;
}
.label {
width: 60px; // fontSize120
flex-shrink: 0;
}
.value {
position: relative;
width: 100%;
color: #292d33;
word-wrap: break-word;
word-break: break-all;
}
.show {
display: inline-block;
}
.btn-reason-all {
position: absolute;
bottom: 0;
right: 0;
text-align: right;
width: 72px; // fontSize144
background-color: #ffffff;
background: linear-gradient(90deg, #ffffff80 0%, #ffffff 100%);
}
.reason-box {
display: flex;
}
}
// 入职计划模块
.entry_plan {
.card_content {
display: flex;
flex-wrap: wrap;
gap: 8px 0; // fontSize16
.item {
width: 50%;
display: flex;
line-height: 1.5;
.label {
color: #999ea8;
font-size: 12px; // fontSize24
flex-shrink: 0;
}
.value {
color: #292d33;
font-size: 12px; // fontSize24
word-wrap: break-word;
word-break: break-all;
flex: 1;
}
}
}
}
// 招聘计划模块
.recruit_plan {
.card {
min-height: 141px; // fontSize282
}
.btn_group {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px; // fontSize20
.btn {
width: 163.5px; // fontSize327
height: 30px; // fontSize60
border-radius: 266px; // fontSize532
display: flex;
align-items: center;
justify-content: center;
font-size: 13px; // fontSize26
cursor: pointer;
-webkit-tap-highlight-color: transparent;
// 当只有一个按钮时,自动扩展宽度
&:only-child {
width: 335px; // fontSize670
}
}
.btn_outline {
background: #347bff1a;
color: #347bff;
}
.btn_primary {
background: #347bff;
color: #ffffff;
}
}
}
// 招聘信息模块
.recruit_info {
.info_item {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 8px 0; // fontSize16
// align-items: center;
&:last-child {
border-bottom: none;
}
.label {
color: #999ea8;
font-size: 14px; // fontSize28
flex-shrink: 0;
line-height: 1.5;
}
.value {
color: #292d33;
font-size: 14px; // fontSize28
text-align: right;
word-wrap: break-word;
word-break: break-all;
margin-left: 10px; // fontSize20
line-height: 1.5;
}
.ji {
display: inline-block;
width: 16px; // 32rpx
height: 16px; // 32rpx
margin-right: 5px; // 10rpx
}
.phone-icon-wrapper {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-radius: 4px;
color: #333;
margin-left: 5px;
}
.phone_icon {
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
}
}
}
}
.popup_content {
.title {
height: 55px; // fontSize110
opacity: 1;
background: #ffffff;
box-shadow: inset 0 -0.5px 0 0 #e8e8ea;
line-height: 55px; // fontSize110
color: #292d33;
font-size: 16px; // fontSize32
text-align: center;
font-weight: 600;
}
.form {
padding: 10px; // fontSize20
.form_item {
display: flex;
justify-content: space-between;
align-items: center;
min-height: 52px; // fontSize104
padding: 10px 0; // fontSize20
box-sizing: border-box;
border-bottom: 1px solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.label {
display: flex;
align-items: center;
color: #292d33;
font-size: 14px; // fontSize28
flex-shrink: 0;
line-height: 1;
.required {
color: #ff4d4f;
margin-left: 2px; // fontSize4
line-height: 12px; // fontSize24
}
}
.value {
flex: 1;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
gap: 8px; // fontSize16
margin-left: 10px; // fontSize20
.arrow_right {
width: 7px; // fontSize14
height: 14px; // fontSize28
padding-top: 1px; // fontSize2
}
.tag {
padding: 4px 10px; // fontSize8 fontSize20
background: #f7f8fa;
color: #5a5e66;
font-size: 13px; // fontSize26
border-radius: 4px; // fontSize8
border: 1px solid transparent;
transition: all 0.3s;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
&.active {
background: #e8f4ff;
color: #347bff;
border-color: #347bff;
}
}
input {
flex: 1;
text-align: right;
color: #292d33;
font-size: 14px; // fontSize28
&::placeholder {
color: #999ea8;
}
}
.time_text {
color: #292d33;
font-size: 14px; // fontSize28
}
.placeholder_text {
color: #999ea8;
font-size: 14px; // fontSize28
}
}
}
// textarea 特殊样式
.form_item_textarea {
align-items: flex-start;
flex-direction: column;
.label {
margin-bottom: 8px; // fontSize16
}
.value {
width: 100%;
margin-left: 0;
.textarea_wrapper {
position: relative;
width: 355px; // fontSize710
height: 220px; // fontSize440
textarea {
width: 100%;
height: 100%;
padding: 10px; // fontSize20
box-sizing: border-box;
border-radius: 8px; // fontSize16
border: 1px solid #eff0f2;
color: #292d33;
font-size: 14px; // fontSize28
line-height: 1.5;
resize: none;
&::placeholder {
color: #999ea8;
}
}
.char_count {
position: absolute;
right: 10px; // fontSize20
bottom: 10px; // fontSize20
color: #999ea8;
font-size: 12px; // fontSize24
}
}
}
}
}
.popup_footer {
display: flex;
padding: 0 10px; // fontSize20
gap: 10px; // fontSize20
background: #ffffff;
padding-bottom: 10px; // safe area or margin
.btn {
flex: 1;
height: 40px; // fontSize80
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px; // fontSize8
font-size: 15px; // fontSize30
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.btn_cancel {
background: #f7f8fa;
color: #5a5e66;
}
.btn_confirm {
background: #347bff;
color: #ffffff;
&.btn_disabled {
background: #cccccc;
color: #ffffff;
opacity: 0.8;
pointer-events: none;
}
}
}
}
}
</style>
<!--packageEquity/pages/recruitManage/recruitDetail/recruitDetail.wxml-->
<!-- 招聘详情 -->
<glsx-privacy appletName="招聘详情" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view
class="container_page {{ showPopup || timeShow ? 'page-locked' : '' }}"
style="{{ showPopup || timeShow ? 'top: -' + pageScrollTop + 'px;' : '' }}"
>
<!-- 顶部数据统计 -->
<view class="content_top">
<view class="statistics">
<view class="statistic_item" wx:for="{{ statisticsList }}" wx:key="index">
<view class="title">{{ item.title }}</view>
<view class="count">{{ item.count }}</view>
</view>
</view>
</view>
<!-- 主模块 -->
<view class="content_main">
<!-- 入职计划模块 -->
<view class="entry_plan">
<view class="block_title">入职计划</view>
<block wx:if="{{ onboardingPlans.length }}">
<block wx:for="{{ onboardingPlans }}" wx:key="index">
<view class="card">
<view class="card_top">
<image class="user_icon" src="/packageEquity/pages/image/staff-icon.png" mode="aspectFill" />
<view class="user_info">
<view class="user_top">
<view class="name">{{item.personName }}</view>
</view>
<view class="user_bottom">
<view class="phone" data-phone="{{ item.phoneNumber }}" bind:tap="phoneCall">
<text class="phone_text"> {{ item.phoneNumber}}</text>
<image class="phone_icon" src="/packageEquity/pages/image/call-icon.png" mode="widthFix" />
</view>
<view class="date">入职时间: {{ item.onboardingDate}}</view>
</view>
</view>
</view>
<view class="card_content">
<view class="item" wx:for="{{ onboardingFieldsConfig }}" wx:key="field" wx:for-item="fieldItem">
<text class="label"> {{ fieldItem.label }}:</text>
<text class="value"> {{ item[fieldItem.field]}}</text>
</view>
</view>
</view>
</block>
</block>
<block wx:else>
<view class="card-empty">
<image class="icon" src="/packageEquity/pages/image/card_empty_icon.png" mode="aspectFill" />
<text>暂无内容</text>
</view>
</block>
</view>
<!-- 试岗计划 -->
<view class="entry_plan">
<view class="block_title">试岗计划</view>
<block wx:if="{{ trialOnboardingPlans.length }}">
<block wx:for="{{ trialOnboardingPlans }}" wx:key="index">
<view class="card">
<view class="card_top">
<image class="user_icon" src="/packageEquity/pages/image/staff-icon.png" mode="aspectFill" />
<view class="user_info">
<view class="user_top">
<view class="name">{{item.personName }}</view>
</view>
<view class="user_bottom">
<view class="phone" data-phone="{{ item.phoneNumber }}" bind:tap="phoneCall">
<text class="phone_text"> {{ item.phoneNumber}}</text>
<image class="phone_icon" src="/packageEquity/pages/image/call-icon.png" mode="widthFix" />
</view>
<view class="date">入职时间: {{ item.onboardingDate}}</view>
</view>
</view>
</view>
<!-- <view class="card_content">
<view class="item" wx:for="{{ onboardingFieldsConfig }}" wx:key="field" wx:for-item="fieldItem">
<text class="label"> {{ fieldItem.label }}:</text>
<text class="value"> {{ item[fieldItem.field]}}</text>
</view>
</view> -->
</view>
</block>
</block>
<block wx:else>
<view class="card-empty">
<image class="icon" src="/packageEquity/pages/image/card_empty_icon.png" mode="aspectFill" />
<text>暂无内容</text>
</view>
</block>
</view>
<!-- 招聘计划模块 -->
<view class="recruit_plan">
<view class="block_title">
招聘计划
<view class="sub_title">请及时跟进简历处理结果:获取简历后,若人员初评不匹配可及时退回;若简历合适,可在面试完成后完善面试结果。</view>
</view>
<block wx:if="{{ recruitmentPlans.length }}">
<block wx:for="{{ recruitmentPlans }}" wx:key="index">
<view class="card">
<view class="card_top">
<image class="user_icon" src="/packageEquity/pages/image/staff-icon.png" mode="aspectFill" />
<view class="user_info">
<view class="user_top">
<view class="name">{{ item.personName }}</view>
<view
class="tag tag-{{ item.processResult == null ? 'pending' : (item.processResult == 1 ? 'mismatch' : (item.processResult == 2 && item.interviewResult == null ? 'pending' : (item.interviewResult == 0 ? 'fail' : (item.interviewResult == 1 ? 'pass' : '')))) }}"
>
{{ item.processResult == null ? '待处理' : (item.processResult == 1 ? '人员不符合' : (item.processResult == 2 && item.interviewResult == null ? '待面试' : (item.interviewResult == 0 ? '面试不通过' : (item.interviewResult == 1 ? '面试通过' : '')))) }}
</view>
</view>
<view class="user_bottom">
<view class="phone" data-phone="{{ item.phoneNumber }}" bind:tap="phoneCall">
<text class="phone_text"> {{ item.phoneNumber }}</text>
<image class="phone_icon" src="/packageEquity/pages/image/call-icon.png" mode="widthFix" />
</view>
<view class="date">投递时间: {{ item.createdDate }}</view>
</view>
</view>
</view>
<view class="card_middle">
<view class="reason-box">
<view class="label">推荐理由:</view>
<view class="value">
{{item.recommendedReasonTxt}}
<view
wx:if="{{ item.recommendedReason && item.recommendedReason.length > reasonMaxLen }}"
class="{{ ['tips', item.isShowReasonAll ? 'show' : ''] }}"
bind:tap="handleShowReason"
data-index="{{ index }}"
>
<text wx:if="{{ item.isShowReasonAll }}">收起</text>
<view wx:else class="btn-reason-all">查看全部</view>
</view>
</view>
</view>
</view>
<view class="card_content">
<view class="btn_group">
<view class="btn btn_outline" bindtap="handleViewResume" data-url="{{ item.resumeUrl }}">查看简历</view>
<view wx:if="{{ item.processResult == null }}" class="btn btn_primary" bindtap="handleProcess" data-id="{{ item.id }}">处理</view>
<!-- <van-button wx:if="{{item.status === 0}}"class="btn btn_primary"bindtap="handleProcess"data-id="{{item.id}}"plain type="primary">处理</van-button>-->
</view>
</view>
</view>
</block>
</block>
<block wx:else>
<view class="card-empty">
<image class="icon" src="/packageEquity/pages/image/card_empty_icon.png" mode="aspectFill" />
<text>暂无内容</text>
</view>
</block>
</view>
<view class="recruit_info">
<view class="block_title">招聘信息</view>
<block wx:if="{{ recruitmentInfoConfig }}">
<view class="card">
<view class="info_item" wx:for="{{ recruitmentInfoConfig }}" wx:key="field" wx:for-item="infoItem">
<text class="label"> {{ infoItem.label }}</text>
<view class="value value_box" wx:if="{{ infoItem.label === '门店名称' }}">
<text> {{recruitment[infoItem.field] || '--'}}</text>
<image class="ji" wx:if="{{ recruitment.urgent == 1 }}" src="{{ IMG_URL }}miniProgram/ji.png" mode="aspectFill" />
</view>
<view class="value value_box" wx:elif="{{ infoItem.label === '招聘负责人' || infoItem.label === '技术督导' }}">
<text> {{recruitment[infoItem.field] || '--'}}</text>
<image
class="phone_icon"
wx:if="{{ (infoItem.label === '招聘负责人' && recruitment.recruiterPhone) || (infoItem.label === '技术督导' && recruitment.technicalSupervisorPhone) }}"
src="/packageEquity/pages/image/call-icon.png"
mode="widthFix"
catchtap="phoneCall"
data-phone="{{ infoItem.label === '招聘负责人' ? recruitment.recruiterPhone : recruitment.technicalSupervisorPhone }}"
/>
</view>
<text class="value" wx:else> {{ recruitment[infoItem.field] || '--' }}</text>
</view>
</view>
</block>
<block wx:else>
<view class="card-empty">
<image class="icon" src="/packageEquity/pages/image/card_empty_icon.png" mode="aspectFill" />
<text>暂无内容</text>
</view>
</block>
</view>
</view>
</view>
<edit-popup wx:if="{{ handleShowMessagePop }}" formData="{{ formData }}" bindconfirm="updateMentorShip" bindcancel="hidePopup"></edit-popup>
<van-popup
show="{{ showPopup }}"
position="bottom"
bind:close="hidePopup"
lock-scroll="{{ true }}"
round
catchtouchmove="preventTouchMove"
>
<view class="popup_content">
<view class="title">简历处理</view>
<scroll-view scroll-y style="height: var(--fontSize887);" bindtouchmove="stopPropagation">
<view class="form">
<view class="form_item">
<view class="label">
处理结果
<text class="required">*</text>
</view>
<view class="value">
<text class="tag {{ formData.processResult == 1 ? 'active' : '' }}" bindtap="selectTag" data-field="processResult" data-value="1">人员不匹配</text>
<text class="tag {{ formData.processResult == 2 ? 'active' : '' }}" bindtap="selectTag" data-field="processResult" data-value="2">已完成面试</text>
</view>
</view>
<view class="form_item" wx:if="{{ formData.processResult == 2 }}">
<view class="label">
面试时间
<text class="required">*</text>
</view>
<view class="value" catchtap="showTimePicker">
<view class="{{ formData.dipalyTime ? 'time_text' : 'placeholder_text' }}">{{ formData.dipalyTime || '请选择面试时间'}}</view>
<image class="arrow_right" src="/packageEquity/pages/image/arrow-right.png" mode="aspectFill" />
</view>
</view>
<view class="form_item" wx:if="{{ formData.processResult == 2 }}">
<view class="label">
面试结果
<text class="required">*</text>
</view>
<view class="value">
<text class="tag {{ formData.interviewResult == '1' ? 'active' : '' }}" bindtap="selectTag" data-field="interviewResult" data-value="1">通过</text>
<text class="tag {{ formData.interviewResult == '0' ? 'active' : '' }}" bindtap="selectTag" data-field="interviewResult" data-value="0">不通过</text>
</view>
</view>
<view class="form_item form_item_textarea">
<view class="label">说明</view>
<view class="value">
<view class="textarea_wrapper">
<textarea
placeholder="请输入说明"
value="{{ formData.description }}"
bindinput="handleTextareaInput"
maxlength="200"
data-field="description"
/>
<view class="char_count">{{ formData.descriptionLength || 0 }}/200</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="popup_footer">
<view class="btn btn_cancel" bindtap="hidePopup">取消</view>
<view class="btn btn_confirm {{ isProcessing ? 'btn_disabled' : '' }}" bindtap="confirmProcess">{{ isProcessing ? '处理中...': '确认'}}</view>
</view>
</view>
</van-popup>
<!-- 时间选择器 -->
<van-popup
show="{{ timeShow }}"
position="bottom"
bind:close="calcelDate"
close-on-click-overlay="{{ true }}"
z-index="10000"
round
catchtouchmove="preventTouchMove"
>
<van-datetime-picker
bind:input="onInput"
bind:cancel="calcelDate"
value="{{ currentDate }}"
formatter="{{ formatter }}"
max-date="{{ today }}"
bind:confirm="bindDateChange"
/>
</van-popup>
\ No newline at end of file
import Dialog from '@vant/weapp/dialog/dialog'
import {
getDemandStoreListAPI,
getStaffDictListAPI,
addStaffDictListAPI
} from '../api'
// 表单字段配置
const FORM_FIELDS = {
MERCHANT: 0, // 门店
BUSINESS_TYPE: 1, // 业务类型
QUANTITY: 2, // 招聘数量
RECRUIT_TYPE: 3, // 招聘类型
URGENT: 4, // 是否急招
DESCRIPTION: 5 // 需求描述
}
// 表单验证配置
const VALIDATION_CONFIG = {
[FORM_FIELDS.MERCHANT]: { tip: '请选择招聘门店', required: true },
[FORM_FIELDS.BUSINESS_TYPE]: { tip: '请选择业务类型', required: true },
[FORM_FIELDS.QUANTITY]: { tip: '请输入招聘数量', required: true },
[FORM_FIELDS.RECRUIT_TYPE]: { tip: '请选择招聘类型', required: true },
[FORM_FIELDS.DESCRIPTION]: {
tip: '请简单描述用人要求等信息',
required: false
}
}
Page({
data: {
formList: [
{ id: 0, label: '门店名称', placeholder: '请选择招聘门店', options: [] },
{ id: 1, label: '业务类型', placeholder: '请选择业务类型', options: [] },
{ id: 2, label: '招聘数量', placeholder: '请输入招聘数量' },
{ id: 3, label: '招聘类型', placeholder: '请选择招聘类型', options: [] },
{ id: 4, label: '是否急招', value: 0 },
{
id: 5,
label: '需求描述',
placeholder: '请简单描述用人要求等信息',
textCount: 0
}
],
switch1Checked: false,
showPopup: false,
currentItem: {},
currentIndex: -1,
options: [],
filteredOptions: [],
selectedOptions: [],
inputValue: '',
keyWord: '', // 搜索关键词
searchTimer: null, // 防抖定时器
isDialogShowing: false // Dialog显示状态
},
onFormItemTap(e) {
const index = e.currentTarget.dataset.index
const item = this.data.formList && this.data.formList[index]
const label = item && item.label
if (label === '需求描述' || label === '招聘数量' || label === '是否急招')
return
return this.showPopup(e)
},
// 显示popup
async showPopup(e) {
const index = e.currentTarget.dataset.index
let item = this.data.formList[index]
// 如果当前项的 options 为空,先加载数据
if (!item.options || item.options.length === 0) {
// 显示加载提示
wx.showLoading({ title: '加载中...', mask: true })
try {
if (index === 0) {
// 获取全部门店列表(不传关键词)
await this.getDemandStoreList()
} else {
await this.getDictList(index)
}
// 数据加载完成后,重新获取 item
item = this.data.formList[index]
} catch (err) {
wx.showToast({ title: '加载失败', icon: 'none' })
return
} finally {
wx.hideLoading()
}
}
let options = []
let selectedOptions = []
if (item.options && item.options.length > 0) {
// 处理选项格式
options = item.options.map(option => {
if (typeof option === 'string') {
return { text: option, value: option, checked: false }
} else {
return { ...option, checked: false }
}
})
// 如果已有选中值,标记为选中(单选模式)
if (item.value && item.displayValue) {
const selectedValue = Array.isArray(item.value)
? item.value[0]
: item.value
options = options.map(option => {
if (option.value === selectedValue) {
option.checked = true
selectedOptions.push(option.value)
}
return option
})
}
}
this.setData({
showPopup: true,
currentItem: item,
currentIndex: index,
options: options,
filteredOptions: options,
selectedOptions: selectedOptions,
searchText: '',
inputValue: item.value || ''
})
},
// 关闭popup
onClose() {
this.setData({
showPopup: false,
searchText: '',
keyWord: '' // 重置搜索关键词
})
// 清除防抖定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer)
}
},
/**
* 搜索门店(带防抖)
* @param {Object} e 事件对象,包含搜索关键词
*/
search(e) {
const keyword = e.detail.value || ''
// 更新搜索关键词
this.setData({
keyWord: keyword
})
// 清除之前的定时器
if (this.data?.searchTimer) {
clearTimeout(this.data.searchTimer)
}
// 设置防抖:500ms 后执行搜索
const timer = setTimeout(() => {
this.performSearch(keyword)
}, 500)
this.setData({
searchTimer: timer
})
},
/**
* 执行搜索
* @param {String} keyword 搜索关键词
*/
async performSearch(keyword) {
const { currentIndex } = this.data
// 只有在门店选择时才进行远程搜索
if (currentIndex !== 0) {
return
}
try {
// 显示搜索中提示
wx.showLoading({ title: '搜索中...', mask: true })
// 调用门店列表 API,传入搜索关键词
const options = await this.getDemandStoreList(keyword)
// 处理搜索结果,添加 checked 状态
const processedOptions = options.map(option => ({
...option,
checked: false
}))
// 如果有已选中的值,标记为选中
const { selectedOptions } = this.data
if (selectedOptions.length > 0) {
const selectedValue = selectedOptions[0]
processedOptions.forEach(option => {
if (option.value === selectedValue) {
option.checked = true
}
})
}
// 更新选项列表
this.setData({
options: processedOptions,
filteredOptions: processedOptions
})
wx.hideLoading()
} catch (err) {
wx.hideLoading()
wx.showToast({
title: '搜索失败',
icon: 'none'
})
}
},
// 切换选项选中状态(单选模式)
toggleOption(e) {
const value = e.currentTarget.dataset.value
const index = e.currentTarget.dataset.index
const options = this.data.options
const filteredOptions = this.data?.filteredOptions
// 先取消所有选中状态
options.forEach(option => {
option.checked = false
})
filteredOptions.forEach(option => {
option.checked = false
})
// 找到点击的选项在原始options中的索引
const originalIndex = options.findIndex(option => option.value === value)
// 设置当前选中状态
if (originalIndex >= 0) {
options[originalIndex].checked = true
// 同步更新filteredOptions中对应选项的状态
const filteredIndex = filteredOptions.findIndex(
option => option.value === value
)
if (filteredIndex >= 0) {
filteredOptions[filteredIndex].checked = true
}
}
// 更新selectedOptions,只保留当前选中项
const selectedOptions = [value]
this.setData({
options,
filteredOptions,
selectedOptions
})
},
// 输入值变化
inputValue(e) {
this.setData({
inputValue: e.detail.value
})
},
// 数字输入变化 - 仅允许输入整数并自动限制在1-100范围内
onNumberInput(e) {
const index = e.currentTarget.dataset.index
let value = e.detail.value
const formList = this.data?.formList
// 过滤非整数输入(去除小数点和非数字字符)
value = value.replace(/\D/g, '')
// 移除前导零
if (value.length > 1 && value.startsWith('0')) {
value = value.replace(/^0+/, '')
}
// 将空值处理为有效值
if (value === '') {
// 允许空值输入,不做处理
} else {
// 将数值转换为整数
let numValue = parseInt(value, 10)
// 自动将值限制在1-100范围内
if (numValue > 100) {
numValue = 100
value = '100'
} else if (numValue < 1) {
numValue = 1
value = '1'
}
}
// 更新对应项的值
formList[index].value = value
formList[index].displayValue = value
this.setData({
formList
})
},
input(e) {
let { value } = e.detail
this.setData({
keyWord: value
})
},
handleReset() {
this.setData({
keyWord: ''
})
this.performSearch('')
},
// textarea输入变化,允许换行但禁止空格
onTextareaInput(e) {
const index = e.currentTarget.dataset.index
let value = e.detail.value
const formList = this.data.formList
// 只过滤掉空格,保留换行符
value = value.replace(/ /g, '')
// 限制最多200个字符
if (value.length > 200) {
value = value.substring(0, 200)
}
// 更新对应项的值
formList[index].value = value
formList[index].displayValue = value
formList[index].textCount = value.length
this.setData({
formList
})
},
// 确认选择(单选模式)
confirmSelect() {
const { currentIndex, selectedOptions, inputValue } = this.data
const formList = this.data.formList
const item = formList[currentIndex]
const hasOptionList = Array.isArray(item.options) && item.options.length > 0
let value = ''
let displayValue = ''
if (hasOptionList) {
const selectedValue = selectedOptions[0] || ''
if (selectedValue) {
const selectedOption = this.data.options.find(
option => option.value === selectedValue
)
if (selectedOption) {
value = selectedValue
displayValue = selectedOption.text || ''
}
}
} else {
value = inputValue
displayValue = inputValue
}
if (currentIndex === FORM_FIELDS.MERCHANT && !displayValue) {
value = ''
}
formList[currentIndex].value = value
formList[currentIndex].displayValue = displayValue
this.setData({
formList,
showPopup: false,
keyWord: ''
})
},
// 表单验证
validateForm() {
const { formList } = this.data
for (let [index, config] of Object.entries(VALIDATION_CONFIG)) {
if (config.required && !formList[index].value) {
wx.showToast({ title: config.tip, icon: 'none', duration: 2000 })
return false
}
}
return true
},
// 构建提交数据
buildSubmitData() {
const { formList } = this.data
return {
merchantId: formList[FORM_FIELDS.MERCHANT].value,
merchantName: formList[FORM_FIELDS.MERCHANT].displayValue,
businessType: formList[FORM_FIELDS.BUSINESS_TYPE].value,
businessTypeName: formList[FORM_FIELDS.BUSINESS_TYPE].displayValue,
recruitmentQuantity: formList[FORM_FIELDS.QUANTITY].value,
recruitmentType: formList[FORM_FIELDS.RECRUIT_TYPE].value,
recruitmentTypeName: formList[FORM_FIELDS.RECRUIT_TYPE].displayValue,
requirementDescription: formList[FORM_FIELDS.DESCRIPTION].value || '',
urgent: formList[FORM_FIELDS.URGENT].value
}
},
switch1Change(e) {
const checked = !!(e && e.detail && e.detail.value)
const urgent = checked ? 1 : 0
const { formList } = this.data
if (Array.isArray(formList) && formList[FORM_FIELDS.URGENT]) {
formList[FORM_FIELDS.URGENT].value = urgent
}
this.setData({
formList,
switch1Checked: checked
})
},
// 提交表单
submit() {
// 验证表单
if (!this.validateForm()) return
const { formList } = this.data
const isUrgent =
Array.isArray(formList) &&
formList[FORM_FIELDS.URGENT] &&
Number(formList[FORM_FIELDS.URGENT].value) === 1
// 设置Dialog显示状态为true
this.setData({
isDialogShowing: true
})
// 显示确认对话框
Dialog.confirm({
title: '提示',
message: isUrgent
? '申请急招,在招聘负责人推送简历后,需在24小时内完成简历跟进处理,否则将自动上报总部,请知悉!'
: '是否确定提交招聘需求?',
className: 'custom-dialog',
confirmButtonText: '确定'
})
.then(() => {
const submitData = this.buildSubmitData()
addStaffDictListAPI(submitData)
.then(res => {
if (res.code == 0) {
this.navigateToResult()
}
})
.catch(err => {
console.error('提交失败:', err)
wx.showToast({
title: '提交失败,请重试',
icon: 'none'
})
})
.finally(() => {
// 无论成功或失败,都关闭Dialog状态
this.setData({
isDialogShowing: false
})
})
})
.catch(err => {
console.log('用户取消提交')
// 用户取消时,关闭Dialog状态
this.setData({
isDialogShowing: false
})
})
},
// 跳转到结果页面
navigateToResult() {
wx.$router.redirectTo(`recruitResult`)
},
/**
* 动态获取门店列表
* @param {String} keyword 搜索关键词(可选)
* @returns {Promise} 返回门店选项列表
*/
getDemandStoreList(keyword = '') {
return new Promise((resolve, reject) => {
// 构建请求参数
const params = {}
if (keyword) {
params.merchantName = keyword // 传入门店名称关键词
}
getDemandStoreListAPI(params)
.then(res => {
let { code, data } = res
if (code == 0) {
const options = data.map(item => ({
text: item.merchantName || '--',
value: item.merchantId
}))
// 只在非搜索模式下更新 formList(搜索时只更新临时列表)
if (!keyword) {
this.setData({
'formList[0].options': options
})
}
resolve(options)
} else {
reject(new Error('获取门店列表失败'))
}
})
.catch(err => {
console.error('获取门店列表失败', err)
reject(err)
})
})
},
// 动态获取字典列表
getDictList(index) {
return new Promise((resolve, reject) => {
try {
let requestParam = {
businessCode: 'recruitment', // 招聘模块相关字典固定穿recruitment
typeCode: index == 1 ? 'business_type' : 'recruitment_type' // 招聘模块内相关业务字典传对应值 ○business_type-业务类型○recruitment_type-招聘类型
}
getStaffDictListAPI(requestParam)
.then(res => {
let { code, data } = res
if (code == 0) {
// 根据 index 选择对应的数据
let sourceData = data
const options = sourceData.map(item => ({
text: item.itemName,
value: item.itemValue
}))
// 使用路径语法更新数据
this.setData({
[`formList[${index}].options`]: options
})
resolve(options)
}
})
.catch(err => {})
} catch (err) {
console.error('获取字典列表失败', err)
reject(err)
}
})
}
})
{
"disableScroll": true,
"navigationBarTitleText": "添加招聘需求",
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"van-dialog": "@vant/weapp/dialog/index"
}
}
/**index.wxss**/
page {
height: 100vh;
display: flex;
background: #f7f8fa;
}
.scrollarea {
flex: 1;
overflow-y: auto;
}
.container {
padding: 0 var(--fontSize20);
.title {
color: #292d33;
height: var(--fontSize80);
font-size: var(--fontSize28);
text-align: left;
padding: var(--fontSize10);
font-weight: 600;
line-height: var(--fontSize80);
}
.form {
box-sizing: border-box;
min-height: var(--fontSize976);
border-radius: var(--fontSize18);
opacity: 1;
background: #ffffff;
box-shadow: 0 var(--fontSize4) var(--fontSize20) 0 #0000001a;
padding: 0 var(--fontSize44);
.form-item {
display: flex;
justify-content: space-between;
height: var(--fontSize104);
align-items: center;
font-size: var(--fontSize28);
.required {
color: #f24724;
text-align: left;
padding-left: var(--fontSize8);
line-height: var(--fontSize40);
position: relative;
top: var(--fontSize4);
box-sizing: border-box;
}
.placeholder {
width: var(--fontSize280);
height: var(--fontSize36);
opacity: 1;
color: #dee0e3;
font-size: var(--fontSize28);
text-align: right;
line-height: var(--fontSize36);
}
.display_value {
width: var(--fontSize320);
height: var(--fontSize36);
color: #323233;
font-size: var(--fontSize28);
text-align: right;
line-height: var(--fontSize36);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
display: flex;
align-items: center;
switch {
transform: scale(0.67);
transform-origin: 100% 50%;
}
.wx-switch-input {
width: 140rpx !important;
height: 60rpx !important;
background: #dcdfe6 !important;
border-color: #dcdfe6 !important;
border-radius: 30rpx !important;
}
.wx-switch-input::before {
width: 136rpx !important;
height: 56rpx !important;
background: #dcdfe6 !important;
border-radius: 28rpx !important;
}
.wx-switch-input::after {
width: 56rpx !important;
height: 56rpx !important;
border-radius: 28rpx !important;
top: 2rpx !important;
left: 2rpx !important;
}
.wx-switch-input-checked {
background: #347BFF !important;
border-color: #347BFF !important;
}
.wx-switch-input-checked::before {
background: #347BFF !important;
}
.wx-switch-input-checked::after {
transform: translateX(80rpx) !important;
}
}
.arrow_right {
width: var(--fontSize12);
height: var(--fontSize21);
margin-left: var(--fontSize8);
}
.unit {
color: #646566;
font-size: var(--fontSize24);
margin-left: var(--fontSize8);
}
.number-input {
flex: 1;
height: var(--fontSize36);
font-size: var(--fontSize24);
color: #323233;
text-align: right;
border: none;
background: transparent;
}
}
.form-item-textarea {
height: auto;
min-height: var(--fontSize104);
flex-direction: column;
align-items: flex-start;
padding: var(--fontSize24) 0;
.label {
margin-bottom: var(--fontSize20);
}
.textarea-wrapper {
width: 100%;
position: relative;
}
.textarea-input {
width: 100%;
height: var(--fontSize440);
padding: var(--fontSize18) var(--fontSize24);
padding-bottom: var(--fontSize60);
background: #ffffff;
border-radius: var(--fontSize8);
font-size: var(--fontSize28);
color: #323233;
line-height: var(--fontSize36);
box-sizing: border-box;
border: var(--fontSize2) solid #ececec;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
&::-webkit-scrollbar {
width: 0;
height: 0;
display: none;
}
}
.textarea-count {
position: absolute;
right: var(--fontSize16);
bottom: var(--fontSize16);
font-size: var(--fontSize28);
color: #969799;
}
}
}
.footer {
margin-top: var(--fontSize150);
.btn {
margin: 0 auto;
width: var(--fontSize622);
height: var(--fontSize88);
border-radius: var(--fontSize12);
opacity: 1;
background: #347bff;
color: #ffffff;
font-size: var(--fontSize32);
text-align: center;
line-height: var(--fontSize88);
}
}
}
/* popup样式 */
.popup-content {
height: 100%;
display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
}
/* 设置popup顶部圆角 */
.van-popup--bottom {
border-radius: var(--fontSize20) var(--fontSize20) 0 0 !important;
overflow: hidden;
}
.popup-fixed-top {
flex: 0 0 auto;
}
.popup-fixed-bottom {
flex: 0 0 auto;
padding: 0 var(--fontSize40);
background: #fff;
padding-top: var(--fontSize20);
}
.popup-scroll-area {
flex: 1;
overflow-y: auto;
padding: 0 var(--fontSize40);
}
.popup-title {
height: var(--fontSize110);
line-height: var(--fontSize110);
font-size: var(--fontSize32);
font-weight: bold;
text-align: center;
border-bottom: var(--fontSize2) solid #E8E8EA;
}
.search-box {
width: var(--fontSize686);
padding: var(--fontSize16) 0;
border-bottom: var(--fontSize2) solid #eff0f2;
margin: 0 var(--fontSize40);
.search-input {
width: 100%;
display: flex;
align-items: center;
height: var(--fontSize72);
background-color: #f5f5f5;
border-radius: var(--fontSize36);
padding: 0 var(--fontSize30);
font-size: var(--fontSize28);
box-sizing: border-box;
position: relative;
.search-icon {
width: var(--fontSize28);
height: var(--fontSize28);
position: absolute;
left: 45%;
top: 50%;
transform: translate(-100%, -50%);
z-index: 1;
margin-left: calc(var(--fontSize-14) - var(--fontSize28));
}
.input {
flex: 1;
height: 100%;
text-align: center;
background-color: transparent;
color: #333;
font-size: var(--fontSize28);
}
.input-placeholder {
color: #999;
text-align: center;
}
.search-clear {
width: var(--fontSize36);
height: var(--fontSize36);
position: absolute;
right: var(--fontSize30);
top: 50%;
z-index: 999;
transform: translateY(-50%);
}
}
}
.popup-options {
padding: var(--fontSize10) 0;
}
.option-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--fontSize24);
border-bottom: var(--fontSize2) solid #eee;
font-size: var(--fontSize28);
}
.option-item:active {
background-color: #f2f3f5;
}
.option-name {
flex: 1;
}
.option-item.checked .option-name {
color: #1989fa;
}
.option-check {
width: var(--fontSize40);
height: var(--fontSize40);
display: flex;
align-items: center;
justify-content: center;
}
.option-check.checked {
color: #1989fa;
}
.check-icon {
font-size: var(--fontSize32);
}
.empty-tip {
padding: var(--fontSize60) 0;
text-align: center;
color: #999;
font-size: var(--fontSize28);
}
.popup-input {
padding: var(--fontSize20) 0;
}
.popup-input input {
width: 100%;
height: var(--fontSize80);
border: var(--fontSize2) solid #eee;
border-radius: var(--fontSize8);
padding: 0 var(--fontSize20);
box-sizing: border-box;
background-color: chartreuse;
}
.popup-buttons {
display: flex;
justify-content: space-between;
padding-top: var(--fontSize20);
}
.isFullSucreen-btn {
padding-bottom: 34px !important;
}
.cancel-btn,
.confirm-btn {
width: var(--fontSize331);
height: var(--fontSize80);
border-radius: var(--fontSize12);
font-size: var(--fontSize28);
line-height: var(--fontSize80);
display: flex;
align-items: center;
justify-content: center;
}
.cancel-btn {
background-color: #f7f8fa;
color: #323233;
margin-right: var(--fontSize24);
}
.confirm-btn {
background-color: #1989fa;
color: #fff;
}
\ No newline at end of file
<template>
<div class="recruit-insert">
<div class="title">请完善您的用人需求</div>
<div class="form">
<div
class="form-item"
:class="{ 'form-item-textarea': item.label === '需求描述' }"
v-for="(item, index) in formList"
:key="index"
@click="onFormItemTap(index)"
>
<div class="label">
{{ item.label }}
<span v-if="item.label !== '需求描述'" class="required">*</span>
</div>
<!-- Switch for Urgent -->
<div class="value" v-if="item.label === '是否急招'">
<van-switch v-model="switch1Checked" size="24px" active-color="#347BFF" @change="switch1Change" />
</div>
<!-- Input for Quantity -->
<div class="value" v-else-if="item.label === '招聘数量'">
<input
class="number-input"
type="tel"
:placeholder="item.placeholder"
v-model="item.displayValue"
@input="onNumberInput($event, index)"
/>
<span class="unit">人</span>
</div>
<!-- Textarea for Description -->
<div class="textarea-wrapper" v-else-if="item.label === '需求描述'">
<textarea
class="textarea-input"
:placeholder="item.placeholder"
v-model="item.displayValue"
@input="onTextareaInput($event, index)"
maxlength="200"
></textarea>
<div class="textarea-count">{{ item.textCount || 0 }}/200</div>
</div>
<!-- Default Selector (Store, Business Type, Recruit Type) -->
<div class="value" v-else>
<span class="display_value" v-if="item.displayValue">{{ item.displayValue }}</span>
<span class="placeholder" v-else>{{ item.placeholder }}</span>
<van-icon name="arrow" class="arrow_right" color="#999" />
</div>
</div>
</div>
<div class="footer">
<div class="btn" @click="submit">提交</div>
</div>
<!-- Popup for Selection -->
<van-popup v-model="showPopup" position="bottom" :style="{ height: '70%' }" round safe-area-inset-bottom>
<div class="popup-content">
<div class="popup-fixed-top">
<div class="popup-title">选择{{ currentItem.label }}</div>
<!-- Search Box for Store (Index 0) -->
<div class="search-box" v-if="currentIndex === 0">
<van-search
v-model="keyWord"
placeholder="搜索"
shape="round"
@search="search"
@input="onSearchInput"
@clear="handleReset"
/>
</div>
</div>
<div class="popup-scroll-area">
<div class="popup-options" v-if="filteredOptions.length > 0">
<div
class="option-item"
:class="{ checked: item.checked }"
v-for="(item, idx) in filteredOptions"
:key="idx"
@click="toggleOption(item.value)"
>
<div class="option-name">{{ item.text }}</div>
<div class="option-check" :class="{ checked: item.checked }">
<van-icon name="success" v-if="item.checked" />
</div>
</div>
</div>
<div class="empty-tip" v-else>
<span>无匹配结果</span>
</div>
</div>
<div class="popup-fixed-bottom">
<div class="popup-buttons">
<div class="cancel-btn" @click="onClose">取消</div>
<div class="confirm-btn" @click="confirmSelect">确定</div>
</div>
</div>
</div>
</van-popup>
</div>
</template>
<script>
import api from '../api'
// 表单字段配置
const FORM_FIELDS = {
MERCHANT: 0, // 门店
BUSINESS_TYPE: 1, // 业务类型
QUANTITY: 2, // 招聘数量
RECRUIT_TYPE: 3, // 招聘类型
URGENT: 4, // 是否急招
DESCRIPTION: 5 // 需求描述
}
// 表单验证配置
const VALIDATION_CONFIG = {
[FORM_FIELDS.MERCHANT]: { tip: '请选择招聘门店', required: true },
[FORM_FIELDS.BUSINESS_TYPE]: { tip: '请选择业务类型', required: true },
[FORM_FIELDS.QUANTITY]: { tip: '请输入招聘数量', required: true },
[FORM_FIELDS.RECRUIT_TYPE]: { tip: '请选择招聘类型', required: true },
[FORM_FIELDS.DESCRIPTION]: {
tip: '请简单描述用人要求等信息',
required: false
}
}
export default {
name: 'RecruitInsert',
data() {
return {
formList: [
{ id: 0, label: '门店名称', placeholder: '请选择招聘门店', options: [] },
{ id: 1, label: '业务类型', placeholder: '请选择业务类型', options: [] },
{ id: 2, label: '招聘数量', placeholder: '请输入招聘数量' },
{ id: 3, label: '招聘类型', placeholder: '请选择招聘类型', options: [] },
{ id: 4, label: '是否急招', value: 0 },
{
id: 5,
label: '需求描述',
placeholder: '请简单描述用人要求等信息',
textCount: 0,
value: '',
displayValue: ''
}
],
switch1Checked: false,
showPopup: false,
currentItem: {},
currentIndex: -1,
options: [],
filteredOptions: [],
selectedOptions: [],
inputValue: '',
keyWord: '', // 搜索关键词
searchTimer: null, // 防抖定时器
isDialogShowing: false // Dialog显示状态
}
},
methods: {
onFormItemTap(index) {
const item = this.formList[index]
const label = item && item.label
if (label === '需求描述' || label === '招聘数量' || label === '是否急招') return
this.showPopupMethod(index)
},
// 显示popup
async showPopupMethod(index) {
let item = this.formList[index]
// 如果当前项的 options 为空,先加载数据
if (!item.options || item.options.length === 0) {
this.$toast.loading({
message: '加载中...',
forbidClick: true,
duration: 0
})
try {
if (index === 0) {
// 获取全部门店列表(不传关键词)
await this.getDemandStoreList()
} else {
await this.getDictList(index)
}
// 数据加载完成后,重新获取 item
item = this.formList[index]
} catch (err) {
this.$toast.fail('加载失败')
return
} finally {
this.$toast.clear()
}
}
let options = []
let selectedOptions = []
if (item.options && item.options.length > 0) {
// 处理选项格式
options = item.options.map(option => {
if (typeof option === 'string') {
return { text: option, value: option, checked: false }
} else {
return { ...option, checked: false }
}
})
// 如果已有选中值,标记为选中(单选模式)
if (item.value && item.displayValue) {
const selectedValue = Array.isArray(item.value) ? item.value[0] : item.value
options = options.map(option => {
if (option.value === selectedValue) {
option.checked = true
selectedOptions.push(option.value)
}
return option
})
}
}
this.currentItem = item
this.currentIndex = index
this.options = options
this.filteredOptions = options
this.selectedOptions = selectedOptions
this.inputValue = item.value || ''
this.keyWord = '' // Reset search keyword
this.showPopup = true
},
// 关闭popup
onClose() {
this.showPopup = false
this.keyWord = ''
if (this.searchTimer) {
clearTimeout(this.searchTimer)
}
},
// 搜索输入
onSearchInput(value) {
this.keyWord = value
if (this.searchTimer) {
clearTimeout(this.searchTimer)
}
this.searchTimer = setTimeout(() => {
this.performSearch(value)
}, 500)
},
// 搜索触发
search(value) {
this.performSearch(value)
},
handleReset() {
this.keyWord = ''
this.performSearch('')
},
/**
* 执行搜索
* @param {String} keyword 搜索关键词
*/
async performSearch(keyword) {
const { currentIndex } = this
// 只有在门店选择时才进行远程搜索
if (currentIndex !== 0) {
return
}
try {
this.$toast.loading({
message: '搜索中...',
forbidClick: true,
duration: 0
})
// 调用门店列表 API,传入搜索关键词
const options = await this.getDemandStoreList(keyword)
// 处理搜索结果,添加 checked 状态
const processedOptions = options.map(option => ({
...option,
checked: false
}))
// 如果有已选中的值,标记为选中
const { selectedOptions } = this
if (selectedOptions.length > 0) {
const selectedValue = selectedOptions[0]
processedOptions.forEach(option => {
if (option.value === selectedValue) {
option.checked = true
}
})
}
this.options = processedOptions
this.filteredOptions = processedOptions
this.$toast.clear()
} catch (err) {
this.$toast.clear()
this.$toast.fail('搜索失败')
}
},
// 切换选项选中状态(单选模式)
toggleOption(value) {
const options = this.options
const filteredOptions = this.filteredOptions
// 先取消所有选中状态
options.forEach(option => {
option.checked = false
})
filteredOptions.forEach(option => {
option.checked = false
})
// 找到点击的选项在原始options中的索引
const originalIndex = options.findIndex(option => option.value === value)
// 设置当前选中状态
if (originalIndex >= 0) {
options[originalIndex].checked = true
// 同步更新filteredOptions中对应选项的状态
const filteredIndex = filteredOptions.findIndex(option => option.value === value)
if (filteredIndex >= 0) {
filteredOptions[filteredIndex].checked = true
}
}
// 更新selectedOptions,只保留当前选中项
this.selectedOptions = [value]
this.options = [...options]
this.filteredOptions = [...filteredOptions]
},
// 数字输入变化
onNumberInput(event, index) {
let value = event.target.value
// 过滤非整数输入(去除小数点和非数字字符)
value = value.replace(/\D/g, '')
// 移除前导零
if (value.length > 1 && value.startsWith('0')) {
value = value.replace(/^0+/, '')
}
// 将空值处理为有效值
if (value !== '') {
let numValue = parseInt(value, 10)
// 自动将值限制在1-100范围内
if (numValue > 100) {
numValue = 100
value = '100'
} else if (numValue < 1) {
numValue = 1
value = '1'
}
}
// 更新对应项的值
this.$set(this.formList[index], 'value', value)
this.$set(this.formList[index], 'displayValue', value)
// Force update input value if modified
event.target.value = value
},
// textarea输入变化
onTextareaInput(event, index) {
let value = event.target.value
// 只过滤掉空格,保留换行符
value = value.replace(/ /g, '')
// 限制最多200个字符
if (value.length > 200) {
value = value.substring(0, 200)
}
this.$set(this.formList[index], 'value', value)
this.$set(this.formList[index], 'displayValue', value)
this.$set(this.formList[index], 'textCount', value.length)
event.target.value = value
},
// 确认选择(单选模式)
confirmSelect() {
const { currentIndex, selectedOptions, inputValue } = this
const item = this.formList[currentIndex]
const hasOptionList = Array.isArray(item.options) && item.options.length > 0
let value = ''
let displayValue = ''
if (hasOptionList) {
const selectedValue = selectedOptions[0] || ''
if (selectedValue) {
const selectedOption = this.options.find(option => option.value === selectedValue)
if (selectedOption) {
value = selectedValue
displayValue = selectedOption.text || ''
}
}
} else {
value = inputValue
displayValue = inputValue
}
if (currentIndex === FORM_FIELDS.MERCHANT && !displayValue) {
value = ''
}
this.$set(this.formList[currentIndex], 'value', value)
this.$set(this.formList[currentIndex], 'displayValue', displayValue)
this.showPopup = false
this.keyWord = ''
},
// 表单验证
validateForm() {
const { formList } = this
for (let [index, config] of Object.entries(VALIDATION_CONFIG)) {
if (config.required && !formList[index].value) {
this.$toast(config.tip)
return false
}
}
return true
},
// 构建提交数据
buildSubmitData() {
const { formList } = this
return {
merchantId: formList[FORM_FIELDS.MERCHANT].value,
merchantName: formList[FORM_FIELDS.MERCHANT].displayValue,
businessType: formList[FORM_FIELDS.BUSINESS_TYPE].value,
businessTypeName: formList[FORM_FIELDS.BUSINESS_TYPE].displayValue,
recruitmentQuantity: formList[FORM_FIELDS.QUANTITY].value,
recruitmentType: formList[FORM_FIELDS.RECRUIT_TYPE].value,
recruitmentTypeName: formList[FORM_FIELDS.RECRUIT_TYPE].displayValue,
requirementDescription: formList[FORM_FIELDS.DESCRIPTION].value || '',
urgent: formList[FORM_FIELDS.URGENT].value
}
},
switch1Change(checked) {
const urgent = checked ? 1 : 0
if (this.formList[FORM_FIELDS.URGENT]) {
this.formList[FORM_FIELDS.URGENT].value = urgent
}
this.switch1Checked = checked
},
// 提交表单
submit() {
if (!this.validateForm()) return
const { formList } = this
const isUrgent =
Array.isArray(formList) &&
formList[FORM_FIELDS.URGENT] &&
Number(formList[FORM_FIELDS.URGENT].value) === 1
this.$dialog.confirm({
title: '提示',
message: isUrgent
? '申请急招,在招聘负责人推送简历后,需在24小时内完成简历跟进处理,否则将自动上报总部,请知悉!'
: '是否确定提交招聘需求?',
confirmButtonText: '确定'
})
.then(() => {
const submitData = this.buildSubmitData()
api.addStaffDictListAPI(submitData)
.then(res => {
if (res.code == 0) {
this.navigateToResult()
} else {
this.$toast(res.message || '提交失败')
}
})
.catch(err => {
console.error('提交失败:', err)
this.$toast('提交失败,请重试')
})
})
.catch(() => {
console.log('用户取消提交')
})
},
navigateToResult() {
this.$router.replace({ name: 'recruitResult/recruitResult' })
},
/**
* 动态获取门店列表
*/
getDemandStoreList(keyword = '') {
return new Promise((resolve, reject) => {
const params = {}
if (keyword) {
params.merchantName = keyword
}
api.getDemandStoreListAPI(params)
.then(res => {
let { code, data } = res
if (code == 0) {
const options = data.map(item => ({
text: item.merchantName || '--',
value: item.merchantId
}))
if (!keyword) {
this.$set(this.formList[0], 'options', options)
}
resolve(options)
} else {
reject(new Error('获取门店列表失败'))
}
})
.catch(err => {
console.error('获取门店列表失败', err)
reject(err)
})
})
},
// 动态获取字典列表
getDictList(index) {
return new Promise((resolve, reject) => {
try {
let requestParam = {
businessCode: 'recruitment',
typeCode: index == 1 ? 'business_type' : 'recruitment_type'
}
api.getStaffDictListAPI(requestParam)
.then(res => {
let { code, data } = res
if (code == 0) {
const options = data.map(item => ({
text: item.itemName,
value: item.itemValue
}))
this.$set(this.formList[index], 'options', options)
resolve(options)
} else {
reject(new Error(res.message))
}
})
.catch(err => {
reject(err)
})
} catch (err) {
console.error('获取字典列表失败', err)
reject(err)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.recruit-insert {
background: #f7f8fa;
min-height: 100vh;
padding: 0 10px;
display: flex;
flex-direction: column;
}
.title {
color: #292d33;
height: 40px;
font-size: 14px;
text-align: left;
padding: 5px;
font-weight: 600;
line-height: 40px;
}
.form {
box-sizing: border-box;
min-height: 488px;
border-radius: 9px;
background: #ffffff;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
padding: 0 22px;
}
.form-item {
display: flex;
justify-content: space-between;
min-height: 52px;
align-items: center;
font-size: 14px;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: none;
}
.label {
flex-shrink: 0;
}
.required {
color: #f24724;
padding-left: 4px;
vertical-align: middle;
}
.placeholder {
color: #dee0e3;
font-size: 14px;
text-align: right;
}
.display_value {
color: #323233;
font-size: 14px;
text-align: right;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 200px;
display: inline-block;
}
.value {
display: flex;
align-items: center;
flex: 1;
justify-content: flex-end;
}
.arrow_right {
margin-left: 4px;
font-size: 12px;
}
.unit {
color: #646566;
font-size: 12px;
margin-left: 4px;
}
.number-input {
width: 100px;
height: 18px;
font-size: 14px;
color: #323233;
text-align: right;
border: none;
background: transparent;
outline: none;
&::placeholder {
color: #dee0e3;
}
}
}
.form-item-textarea {
height: auto;
min-height: 52px;
flex-direction: column;
align-items: flex-start;
padding: 12px 0;
.label {
margin-bottom: 10px;
}
.textarea-wrapper {
width: 100%;
position: relative;
}
.textarea-input {
width: 100%;
height: 220px;
padding: 9px 12px;
padding-bottom: 30px;
background: #ffffff;
border-radius: 4px;
font-size: 14px;
color: #323233;
line-height: 18px;
box-sizing: border-box;
border: 1px solid #ececec;
resize: none;
outline: none;
&::placeholder {
color: #dee0e3;
}
}
.textarea-count {
position: absolute;
right: 8px;
bottom: 8px;
font-size: 14px;
color: #969799;
}
}
.footer {
margin-top: 75px;
padding-bottom: 30px;
.btn {
margin: 0 auto;
width: 311px;
height: 44px;
border-radius: 6px;
background: #347bff;
color: #ffffff;
font-size: 16px;
text-align: center;
line-height: 44px;
}
}
/* Popup Styles */
.popup-content {
height: 100%;
display: flex;
flex-direction: column;
}
.popup-fixed-top {
flex: 0 0 auto;
}
.popup-fixed-bottom {
flex: 0 0 auto;
padding: 10px 20px;
background: #fff;
}
.popup-scroll-area {
flex: 1;
overflow-y: auto;
padding: 0 20px;
}
.popup-title {
height: 55px;
line-height: 55px;
font-size: 16px;
font-weight: bold;
text-align: center;
border-bottom: 1px solid #e8e8ea;
}
.search-box {
padding: 8px 0;
margin: 0 20px;
border-bottom: 1px solid #eff0f2;
}
.popup-options {
padding: 5px 0;
}
.option-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px;
border-bottom: 1px solid #eee;
font-size: 14px;
color: #323233;
&.checked {
.option-name {
color: #1989fa;
}
}
&:active {
background-color: #f2f3f5;
}
}
.option-name {
flex: 1;
}
.option-check {
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
color: #1989fa;
font-size: 16px;
}
.empty-tip {
padding: 30px 0;
text-align: center;
color: #999;
font-size: 14px;
}
.popup-buttons {
display: flex;
justify-content: space-between;
}
.cancel-btn,
.confirm-btn {
width: 165px;
height: 40px;
border-radius: 6px;
font-size: 14px;
line-height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.cancel-btn {
background-color: #f7f8fa;
color: #323233;
margin-right: 12px;
}
.confirm-btn {
background-color: #1989fa;
color: #fff;
}
</style>
<!--index.wxml-->
<view class="scrollarea">
<view class="container">
<view class="title">请完善您的用人需求</view>
<view class="form">
<block wx:for="{{ formList }}" wx:key="index">
<view class="form-item {{ item.label === '需求描述' ? 'form-item-textarea' : '' }}" bindtap="onFormItemTap" data-index="{{ index }}">
<view class="label">
{{item.label}}
<text wx:if="{{ item.label !== '需求描述' }}" class="required">*</text>
</view>
<view class="value" wx:if="{{ item.label === '是否急招' }}">
<switch checked="{{ switch1Checked }}" bindchange="switch1Change" />
</view>
<view class="value" wx:if="{{ item.label !== '需求描述' && item.label !== '招聘数量' && item.label !== '是否急招' }}">
<text class="display_value" wx:if="{{ item.displayValue }}">{{item.displayValue}}</text>
<text class="placeholder" wx:else>{{item.placeholder}}</text>
<image class="arrow_right" src="/packageEquity/pages/image/arrow-right.png" mode="aspectFill" />
</view>
<view class="value" wx:if="{{ item.label === '招聘数量' }}">
<input class="number-input" type="number" placeholder="{{ item.placeholder }}" placeholder-style="color: #DEE0E3;font-size:var(--fontSize28)" value="{{ item.displayValue }}" bindinput="onNumberInput" data-index="{{ index }}" />
<text class="unit">人</text>
</view>
<block wx:if="{{ !showPopup }}">
<view class="textarea-wrapper" wx:if="{{ item.label === '需求描述' }}">
<textarea class="textarea-input" placeholder="{{ item.placeholder }}" placeholder-style="color: #DEE0E3;" value="{{ item.displayValue }}" bindinput="onTextareaInput" data-index="{{ index }}" maxlength="200" disabled="{{ isDialogShowing }}" />
<view class="textarea-count">{{item.textCount || 0}}/200</view>
</view>
</block>
</view>
</block>
</view>
<view class="footer">
<view class="btn" bind:tap="submit">提交</view>
</view>
</view>
</view>
<!-- Vant Popup 组件 -->
<van-popup show="{{ showPopup }}" position="bottom" custom-style="height: 70%" bind:close="onClose">
<view class="popup-content">
<!-- 固定顶部区域 -->
<view class="popup-fixed-top">
<view class="popup-title">选择{{currentItem.label}}</view>
<!-- 搜索框 -->
<view class="search-box" wx:if="{{ currentIndex === 0 }}">
<view class="search-input">
<block wx:if="{{ !keyWord }}">
<image src="/images/search.png" class="search-icon" />
</block>
<input type="text" placeholder="搜索" class="input" confirm-type="search" value="{{ keyWord }}" placeholder-class="input-placeholder" bindinput="input" bindconfirm="search" />
<block wx:if="{{ keyWord }}">
<image src="/images/clear.png" class="search-clear" bindtap="handleReset" />
</block>
</view>
</view>
</view>
<!-- 可滚动的中间区域 -->
<view class="popup-scroll-area">
<!-- 选项列表 -->
<view class="popup-options" wx:if="{{ options.length > 0 }}">
<view class="option-item {{ item.checked ? 'checked' : '' }}" wx:for="{{ filteredOptions }}" wx:key="index" bindtap="toggleOption" data-index="{{ index }}" data-value="{{ item.value }}">
<view class="option-name">{{item.text}}</view>
<view class="option-check {{ item.checked ? 'checked' : '' }}">
<text class="check-icon" wx:if="{{ item.checked }}">✓</text>
</view>
</view>
<view class="empty-tip" wx:if="{{ filteredOptions.length === 0 }}">
<text>无匹配结果</text>
</view>
</view>
</view>
<!-- 固定底部区域 -->
<view class="popup-fixed-bottom ">
<view class="popup-buttons">
<view class="cancel-btn" bindtap="onClose">取消</view>
<view class="confirm-btn" bindtap="confirmSelect">确定</view>
</view>
</view>
</view>
</van-popup>
<van-dialog id="van-dialog" width="var(--fontSize622)" custom-style="height: 364px;" confirm-button-color="#347BFF" />
\ No newline at end of file
export const supportTypeList = [
{
confId: 0,
confName: '新店启动'
},
{
confId: 1,
confName: '老店业绩提升-渗透率过低'
},
{
confId: 2,
confName: '老店业绩提升-客单价过低'
}
]
export const statusList = [
{
confId: 0,
confName: '待人事确认'
},
{
confId: 1,
confName: '招聘中'
},
{
confId: 2,
confName: '已完成'
},
{
confId: 3,
confName: '已驳回'
}
]
export const mentorshipFormData = [
{
label: '招聘数量',
name: 'recruitmentQuantity',
labelName: 'recruitmentQuantity',
disabled: true
},
{
label: '业务类型',
name: 'businessTypeName',
labelName: 'businessTypeName',
disabled: true
},
{
label: '招聘类型',
name: 'recruitmentTypeName',
labelName: 'recruitmentTypeName',
disabled: true
}
]
export const formRule = {
supportWay: [{ required: true, message: '支援方式不能为空' }],
storeType: [{ required: true, message: '门店类型不能为空' }],
businessType: [{ required: true, message: '业务类型1不能为空' }],
saleType: [{ required: true, message: '业务类型2不能为空' }],
teachStartTime: [{ required: true, message: '开始带教时间不能为空' }],
problemDescription: [{ required: true, message: '门店现存问题不能为空' }],
solutionDescription: [{ required: true, message: '预估解决方案不能为空' }]
}
export const checkRequired = function (obj, formRule) {
let target = Object.keys(formRule)
console.log(target)
for (let i = 0; i < target.length; i++) {
let attr = target[i]
let item = formRule[attr]
let requirObj = item.find(k => k.required == true)
let validFn = item.find(k => k.validator)
if (requirObj && (obj[attr] ?? '') === '') {
return {
...requirObj,
attr
}
}
if (validFn) {
let validObj = validFn.validator({}, obj[attr])
if (validObj) {
return {
...validObj,
attr
}
}
}
}
return false
}
// export const getConfName = function (dataList, confId) {
// const confIdStr = `${confId}`?.split(',')
// let result = confIdStr?.map(v => {
// const found = dataList?.find(item => item.confId == v)
// return found?.confName
// })
// return result?.length ? result.join(',') : '-'
// }
export const getStatusName = function (status) {
const found = statusList?.find(item => item.confId == status)
return found?.confName || '-'
}
// 获取状态提示文本
export const getStatusTipText = function (item) {
const { status, waitProcessResumeCount, confirmFlag, trialWaitConfirmCount, onboardingWaitConfirmCount } = item
// 待处理提示文案显示逻辑
if (status == 1 && waitProcessResumeCount > 0) {
return `您有${waitProcessResumeCount}份简历待处理,请及时跟进`
} else if (status == 1 && confirmFlag == 'Y' && trialWaitConfirmCount > 0) {
return '您有新的试岗记录,请及时查看'
} else if (status == 1 && confirmFlag == 'Y' && onboardingWaitConfirmCount > 0) {
return '您有新的入职记录,请及时查看'
} else if (status == 2 && confirmFlag == 'Y') {
return '您的招聘需求已完成,请及时查看'
} else if (status == 3 && confirmFlag == 'Y') {
return '您的招聘需求已拒绝,请及时查看'
}
return null
}
import {
mentorshipFormData,
getStatusName,
getStatusTipText
} from './constantData'
import { getRecruitList, waitstaffstateAPI, confiremStaffFlagAPI } from '../api'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
list: [],
tabList: [],
pageSize: 10,
currentPage: 1,
mentorshipFormData,
triggered: false,
nothing: false,
userInfo: {},
tabIndex: 0,
btnVisible: true, // 按钮是否显示
lastScrollTop: 0, // 上次滚动位置
scrollThreshold: 50, // 滚动阈值(px)
scrollTimer: null // 滚动停止定时器
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let { mentorshipFormData } = this.data
let userInfo = wx.$util.getUserInfo()
this.getWaitstaffstate()
this.search()
// 非区域运营登录,打回到首页
//ll if (userInfo?.loginRole != 3) wx.reLaunch({ url: "/pages/loading/loading" })
if (userInfo?.isSuper) {
let index = mentorshipFormData?.findIndex(
v => v.name == 'flightSupervisorName'
)
this.setData({
mentorshipFormData
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getWaitstaffstate()
this.search()
},
onBottomRefresh() {
this.getList()
},
// 获取招聘任务统计数据
getWaitstaffstate() {
waitstaffstateAPI({}).then(res => {
let { code, data, message } = res
if (code == 0) {
this.setData({
tabList: [
`待我处理(${data.waitProcessCount})`,
`全部(${data.totalCount})`
]
})
} else {
// wx.$util.showToast(message)
}
})
},
// 标签切换
tabClick(e) {
this.setData(
{
tabIndex: e.detail,
list: []
},
() => {
this.search()
this.getWaitstaffstate()
}
)
},
// 搜索
search() {
this.setData({
nothing: false,
currentPage: 1
})
this.getList()
},
// 获取列表数据
getList() {
let { tabIndex, pageSize, currentPage, nothing } = this.data
if (nothing) return
wx.showLoading({
title: '加载中'
})
getRecruitList({
pageSize,
pageNum: currentPage,
onlyWaiting: !!!tabIndex // boolean类型转换
}).then(res => {
wx.hideLoading()
if (res.code == '0') {
let { list, pages } = res.data
// 为列表数据添加状态名称和提示文本
list = list.map(item => {
const tipText = getStatusTipText(item)
return {
...item,
statusName: getStatusName(item.status),
showTip: !!tipText, // 是否显示提示
tipText: tipText || '' // 提示文本
}
})
this.setData({
[`list[${currentPage - 1}]`]: list,
currentPage: currentPage + 1,
nothing: currentPage == pages,
triggered: false
})
} else {
this.setData({
list: [],
nothing: false
})
wx.$util.showToast(res.message || '接口异常')
}
})
},
// 跳转详情
handleDetail(e) {
// 节流控制:2秒内只能触发一次
const now = Date.now()
const throttleTime = 2000 // 节流时间:2秒
if (this.lastDetailTime && now - this.lastDetailTime < throttleTime) {
return
}
this.lastDetailTime = now
const { item } = e.currentTarget.dataset
wx.$router.go(
'/packageEquity/pages/recruitManage/recruitDetail/recruitDetail',
{
id: item.id
}
)
//仅已完成/以驳回可以调用flag接口
if (item.status == 0 || item.status == 1) return
confiremStaffFlagAPI({ id: item.id }).then(res => {
let { code } = res
if (code == 0) {
this.getWaitstaffstate()
this.search()
}
})
},
// 跳转添加招聘页面
handleInsertRecruit() {
wx.$router.go(
'/packageEquity/pages/recruitManage/recruitInsert/recruitInsert'
)
},
/**
* 处理滚动事件
* 监听向上滚动时隐藏按钮,滚动停止1秒后重新显示按钮
*/
handleScroll(e) {
const { scrollTop } = e.detail
const { lastScrollTop, scrollThreshold, btnVisible, scrollTimer } =
this.data
// 清除之前的定时器
if (scrollTimer) {
clearTimeout(scrollTimer)
}
// 计算滚动方向和距离
const scrollDistance = Math.abs(scrollTop - lastScrollTop)
// 只有滚动距离超过阈值才触发显隐逻辑,避免频繁切换
if (scrollDistance > scrollThreshold) {
// 向上滑动(scrollTop 增大)- 隐藏按钮
if (scrollTop > lastScrollTop && btnVisible) {
this.setData({
btnVisible: false
})
}
// 向下滑动(scrollTop 减小)- 隐藏按钮
else if (scrollTop < lastScrollTop && btnVisible) {
this.setData({
btnVisible: false
})
}
// 更新上次滚动位置
this.setData({
lastScrollTop: scrollTop
})
}
// 在顶部时始终显示按钮
if (scrollTop <= 0) {
if (!btnVisible) {
this.setData({
btnVisible: true,
lastScrollTop: 0
})
}
return
}
// 设置定时器:滚动停止2秒后显示按钮
const timer = setTimeout(() => {
this.setData({
btnVisible: true
})
}, 1000)
this.setData({
scrollTimer: timer
})
},
// 生命周期函数--监听页面隐藏
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
// 清理定时器
if (this.data.scrollTimer) {
clearTimeout(this.data.scrollTimer)
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
})
{
"navigationBarTitleText": "招聘管理",
"enablePullDownRefresh": false,
"onReachBottomDistance": 50,
"usingComponents": {}
}
\ No newline at end of file
/* tabWorkOrder/pages/mentorshipManage/mentorshipManage.wxss */
page {
background: #F7F8FA;
height: 100%;
overflow: hidden;
}
.container_page {
height: 100%;
overflow: hidden;
// 顶部Tab模块
.top_content {
background: #FFFFFF;
padding-top: var(--fontSize24);
box-sizing: border-box;
.user_box {
display: flex;
align-items: center;
margin-bottom: var(--fontSize28);
padding: 0 var(--fontSize32);
.user_avatar {
width: var(--fontSize48);
height: var(--fontSize48);
border-radius: 50%;
overflow: hidden;
}
.user_name {
margin-left: var(--fontSize12);
font-weight: 600;
font-size: var(--fontSize32);
color: #292D33;
}
.user_tips {
margin-left: var(--fontSize4);
padding: 0 var(--fontSize8);
height: var(--fontSize36);
font-size: var(--fontSize20);
color: #347BFF;
background: #EAF1FF;
border-radius: var(--fontSize4);
text-align: center;
line-height: var(--fontSize36);
}
}
.tips_box {
height: var(--fontSize56);
background: #FFF5E6;
border-radius: var(--fontSize8);
display: flex;
align-items: center;
padding: 0 var(--fontSize28);
margin: 0 var(--fontSize32) var(--fontSize20) var(--fontSize32);
.tipsIcon {
width: var(--fontSize28);
height: var(--fontSize28);
margin-right: var(--fontSize8);
}
.contentText {
font-size: var(--fontSize24);
color: #FF9D0A;
}
}
.tab_box {
margin: 0 var(--fontSize-32);
position: relative;
}
}
// 列表模块
.content {
padding-top: var(--fontSize24);
height: calc(100vh - var(--fontSize120));
box-sizing: border-box;
.list {
height: 100%;
.item {
margin: 0 var(--fontSize20) var(--fontSize24) var(--fontSize20);
border-radius: var(--fontSize16);
background: #ffffff;
box-shadow: 0 var(--fontSize4) var(--fontSize16) 0 #cdcdd180;
padding: var(--fontSize24);
.item_header {
display: flex;
align-items: center;
margin-bottom: var(--fontSize4);
justify-content: space-between;
.ji {
display: inline-block;
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
}
.merchant-name {
flex: 1;
min-width: 0;
font-size: var(--fontSize30);
color: #292D33;
font-weight: 600;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: var(--fontSize16);
}
.status-tag {
font-size: var(--fontSize24);
border-radius: var(--fontSize4);
padding: var(--fontSize4) var(--fontSize8);
font-weight: 400;
// 待人事确认 status = 0
&.status-0 {
color: #347bff;
background: #eaf1ff;
}
// 招聘中 status = 1
&.status-1 {
color: #ff9d0a;
background: #fff5e6;
}
// 已完成 status = 2
&.status-2 {
color: #35c376;
background: #eaf9f1;
}
// 已驳回 status = 3
&.status-3 {
color: #f24724;
background: #fdece9;
}
}
.icon {
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: var(--fontSize12);
}
}
.item_content {
box-sizing: border-box;
display: flex;
color: #292D33;
padding-top: var(--fontSize17);
.label {
flex-shrink: 0;
width: var(--fontSize144);
margin-right: var(--fontSize16);
font-size: var(--fontSize28);
color: #999EA8;
}
.value {
word-break: break-all;
font-size: var(--fontSize28);
}
}
.item_footer {
display: flex;
justify-content: flex-end;
align-items: center;
font-size: var(--fontSize24);
color: #9B9B9E;
padding-top: var(--fontSize20);
.msg_tips {
width: var(--fontSize662);
height: var(--fontSize72);
border-radius: var(--fontSize16);
background: #f7f7f7;
color: #292d33;
font-size: var(--fontSize28);
text-align: left;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 var(--fontSize32);
.arrow_right {
width: var(--fontSize12);
height: var(--fontSize21);
}
}
}
}
.super_item {
padding-bottom: var(--fontSize32);
}
}
// 空数据占位
.no_data {
height: 100%;
}
}
// 新增需求按钮
.insert_btn {
display: grid;
place-items: center;
color: #347bff;
width: var(--fontSize136);
height: var(--fontSize136);
font-size: var(--fontSize24);
border-radius: var(--fontSize15);
position: fixed;
-webkit-tap-highlight-color: transparent; //元素默认高亮背景设置
right: var(--fontSize40);
bottom: var(--fontSize468);
background: #ffffffcc;
text-align: center;
box-shadow: 0 var(--fontSize4) var(--fontSize18) 0 #0000001a;
transition: all 0.3s ease-in-out;
.label {
width: var(--fontSize114);
margin-top: -8px;
line-height: var(--fontSize34);
}
.insert_icon {
width: var(--fontSize54);
height: var(--fontSize54);
}
// 显示状态
&.btn-visible {
transform: translateX(0);
opacity: 1;
}
// 隐藏状态 - 向右滑出并淡出
&.btn-hidden {
transform: translateX(calc(100% + var(--fontSize40)));
opacity: 0;
}
}
// 触底提示
.list-nothing {
color: #999ea8;
font-size: var(--fontSize20);
text-align: center;
padding: 0 0 var(--fontSize60) 0;
}
}
.arrowIcon {
position: fixed;
right: 0;
bottom: var(--fontSize468);
width: var(--fontSize36);
height: var(--fontSize136);
background: #FFFFFF;
border: var(--fontSize2) solid #EFF0F2;
box-shadow: 0 var(--fontSize4) var(--fontSize20) 0 #0000001a;
border-radius: var(--fontSize16) 0 0 var(--fontSize16);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease-in-out;
// 显示状态 - 从右侧滑入
&.arrow-visible {
transform: translateX(0);
opacity: 1;
}
// 隐藏状态 - 向右滑出
&.arrow-hidden {
transform: translateX(100%);
opacity: 0;
pointer-events: none; // 隐藏时禁止点击
}
.image {
width: var(--fontSize32);
height: var(--fontSize32);
}
}
<template>
<div class="recruit-manage">
<!-- 列表页面 -->
<!-- 顶部Tab模块 -->
<div class="top_content" v-if="tabList.length">
<div class="tab_box">
<van-tabs v-model="tabIndex" @click="tabClick" color="#347BFF" title-active-color="#347BFF">
<van-tab v-for="(item, index) in tabList" :key="index" :title="item"></van-tab>
</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">
<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 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`" />
<!-- <img :src="item.merchantLogo || IMG_URL" alt="" style="width: 24px; height: 24px; border-radius: 50%; margin-right: 5px;"> -->
<span class="merchant-name">{{ item.merchantName }}</span>
<!-- <span class="status-tag" :class="`status-${item.status}`">{{ item.statusName }}</span> -->
</div>
<div class="item_content" v-for="(it, subInd) in mentorshipFormData" :key="subInd">
<div class="label">{{ it.label }}</div>
<div class="value">
{{ item[it.labelName] || '-' }}
<span v-if="it.label == '招聘数量'">人</span>
</div>
</div>
<!-- 提示消息 -->
<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" />
</div>
</div>
</div>
</template>
<!-- 空数据占位 -->
<div class="no_data" v-else-if="!loading && nothing">
<van-empty description="暂无数据" />
</div>
</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" />
<div class="label">
<div>添加招聘</div>
<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() {
return {
IMG_URL,
list: [],
tabList: [],
pageSize: 10,
currentPage: 1,
mentorshipFormData,
triggered: false, // pull refresh loading state
loading: false, // list loading state
nothing: false, // finished state
error: false,
userInfo: {},
tabIndex: 0,
btnVisible: true, // 按钮是否显示
lastScrollTop: 0, // 上次滚动位置
scrollThreshold: 50, // 滚动阈值(px)
scrollTimer: null, // 滚动停止定时器
lastDetailTime: 0
}
},
created() {
this.search()
},
mounted() {
// window.addEventListener('scroll', this.handleScroll, true)
// Scroll handling might need to be on the scroll element or window depending on layout
},
destroyed() {
if (this.scrollTimer) {
clearTimeout(this.scrollTimer)
}
// window.removeEventListener('scroll', this.handleScroll, true)
},
methods: {
onBottomRefresh() {
console.log('onBottomRefresh')
this.getList()
},
// 获取招聘任务统计数据
getWaitstaffstate() {
// 模拟接口数据
const mockData = {
code: 0,
data: {
waitAuditCount: 5,
waitProcessCount: 12,
totalCount: 30
},
message: 'success'
}
// 模拟异步请求
Promise.resolve(mockData).then(res => {
let { code, data, message } = res
if (code == 0) {
// 0:全部,1:待审核,2:待处理
this.tabList = [`待审核(${data.waitAuditCount || 0})`, `待处理(${data.waitProcessCount || 0})`, `全部(${data.totalCount || 0})`]
} else {
this.$toast(message)
}
})
/* 暂时注释掉真实接口调用
// return
api.getDemandStatAPI({}).then(res => {
let { code, data, message } = res
if (code == 0) {
// 0:全部,1:待审核,2:待处理
// 假设接口返回字段为 waitAuditCount, waitProcessCount, totalCount
// 如果接口字段不同,请根据实际情况调整
this.tabList = [`待审核(${data.waitAuditCount || 0})`, `待处理(${data.waitProcessCount || 0})`, `全部(${data.totalCount || 0})`]
} else {
this.$toast(message)
}
})
*/
},
// 标签切换
tabClick(name, title) {
this.tabIndex = name
this.list = []
this.nothing = false
this.currentPage = 1
this.loading = true // Prevent immediate load trigger
this.getList() // Load new list
this.getWaitstaffstate()
},
// 搜索
search() {
this.nothing = false
this.currentPage = 1
this.list = [] // Clear list for refresh
this.loading = true
this.getList()
this.getWaitstaffstate()
},
// 获取列表数据
getList() {
let { tabIndex, pageSize, currentPage, nothing } = this
if (nothing) {
this.loading = false
this.triggered = false
return
}
// 重置错误状态
this.error = false
// 映射 tabIndex 到 dataType
// tabIndex: 0->待审核, 1->待处理, 2->全部
// dataType: 1->待审核, 2->待处理, 0->全部
let dataType = 0
if (tabIndex === 0) dataType = 1
else if (tabIndex === 1) dataType = 2
else dataType = 0
api
.getRecruitList({
pageSize,
pageNum: currentPage,
dataType
})
.then(res => {
this.$toast.clear()
this.loading = false
this.triggered = false
console.log(res, '2222')
// if (res.code == '0') {
let { list, pages } = res
// 为列表数据添加状态名称和提示文本
list = list.map(item => {
const tipText = getStatusTipText(item)
return {
...item,
statusName: getStatusName(item.status),
showTip: !!tipText, // 是否显示提示
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 {
// // 接口返回错误码,视为加载失败,允许点击重试
// this.error = true
// if (currentPage === 1) this.list = []
// this.$toast(res.message || '接口异常')
// }
})
.catch(() => {
this.$toast.clear()
this.loading = false
this.triggered = false
// 网络异常等,设置为错误状态,避免无限循环
this.error = true
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
}
this.lastDetailTime = now
// return
// 0-待审核 跳转审核页,其他跳转详情页
const routeName = item.status === 4 ? 'recruitmentReview/recruitmentReview' : 'recruitDetail/recruitDetail'
this.$router.push({
name: routeName,
query: {
id: item.id
}
})
},
// 跳转添加招聘页面
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;
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
.top_content {
background: #ffffff;
box-sizing: border-box;
flex-shrink: 0;
z-index: 10;
.tab_box {
// margin: 0 16px;
}
}
.content {
// flex: 1;
height: calc(100vh);
// overflow-y: auto;
box-sizing: border-box;
// padding-top: 12px;
// height: 200px;
overflow: scroll;
.list {
height: 100%;
overflow: scroll;
// padding-bottom: 80px;
// height: calc(100vh - 120px);
// height: 200px;
}
.item {
margin: 0 10px 12px 10px;
border-radius: 8px;
background: #ffffff;
box-shadow: 0 2px 8px 0 rgba(205, 205, 209, 0.5);
padding: 12px;
.item_header {
display: flex;
align-items: center;
margin-bottom: 2px;
justify-content: space-between;
.ji {
display: inline-block;
width: 16px;
height: 16px;
margin-right: 5px;
}
.merchant-name {
flex: 1;
min-width: 0;
font-size: 15px;
color: #292d33;
font-weight: 600;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 8px;
}
.status-tag {
font-size: 12px;
border-radius: 2px;
padding: 2px 4px;
font-weight: 400;
// 待人事确认 status = 0
&.status-0 {
color: #347bff;
background: #eaf1ff;
}
// 招聘中 status = 1
&.status-1 {
color: #ff9d0a;
background: #fff5e6;
}
// 已完成 status = 2
&.status-2 {
color: #35c376;
background: #eaf9f1;
}
// 已驳回 status = 3
&.status-3 {
color: #f24724;
background: #fdece9;
}
}
}
.item_content {
box-sizing: border-box;
display: flex;
color: #292d33;
padding-top: 8px;
.label {
flex-shrink: 0;
width: 72px;
margin-right: 8px;
font-size: 14px;
color: #999ea8;
}
.value {
word-break: break-all;
font-size: 14px;
}
}
.item_footer {
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 12px;
color: #9b9b9e;
padding-top: 10px;
.msg_tips {
width: 100%;
height: 36px;
border-radius: 8px;
background: #f7f7f7;
color: #292d33;
font-size: 14px;
text-align: left;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
.arrow_right {
width: 6px;
height: 10px;
}
}
}
}
.super_item {
padding-bottom: 16px;
}
}
.no_data {
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
.insert_btn {
display: grid;
place-items: center;
color: #347bff;
width: 68px;
height: 68px;
font-size: 12px;
border-radius: 8px;
position: fixed;
right: 20px;
bottom: 234px;
background: rgba(255, 255, 255, 0.8);
text-align: center;
box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.1);
transition: all 0.3s ease-in-out;
z-index: 20;
.label {
margin-top: -4px;
line-height: 17px;
}
.insert_icon {
width: 27px;
height: 27px;
}
&.btn-visible {
transform: translateX(0);
opacity: 1;
}
&.btn-hidden {
transform: translateX(120%);
opacity: 0;
}
}
.arrowIcon {
position: fixed;
right: 0;
bottom: 234px;
width: 18px;
height: 68px;
background: #ffffff;
border: 1px solid #eff0f2;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
border-radius: 8px 0 0 8px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease-in-out;
z-index: 20;
&.arrow-visible {
transform: translateX(0);
opacity: 1;
}
&.arrow-hidden {
transform: translateX(100%);
opacity: 0;
pointer-events: none;
}
.image {
width: 16px;
height: 16px;
}
}
</style>
<!-- 招聘管理 -->
<glsx-privacy appletName="招聘管理" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view class="container_page">
<!-- 顶部Tab模块 -->
<view class="top_content" wx:if="{{ tabList.length }}">
<view class="tab_box">
<tab-bar tabList="{{ tabList }}" bindclick="tabClick" activeIndex="{{ tabIndex }}" />
</view>
</view>
<!-- 列表模块 -->
<view class="content">
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{ true }}"
bindrefresherrefresh="search"
bindscrolltolower="onBottomRefresh"
bindscroll="handleScroll"
class="list"
scroll-top="{{ scrollTop }}"
lower-threshold="400"
refresher-threshold="104"
refresher-triggered="{{ triggered }}"
>
<!-- 需求列表 -->
<block wx:if="{{ list.length && list[0].length }}">
<block wx:for="{{ list }}" wx:key="ind" wx:for-item="i" wx:for-index="ind">
<view
wx:for="{{ i }}"
wx:key="index"
class="item {{ userInfo.isSuper ? 'super_item' : '' }}"
bind:tap="handleDetail"
data-item="{{ item }}"
>
<view class="item_header">
<image wx:if="{{ item.urgent == 1 }}" class="ji" src="{{ IMG_URL }}miniProgram/ji.png" mode="aspectFill"></image>
<text class="merchant-name">{{item.merchantName}}</text>
<text class="status-tag status-{{ item.status }}">{{item.statusName}}</text>
</view>
<view class="item_content" wx:for="{{ mentorshipFormData }}" wx:for-item="it" wx:for-index="subInd" wx:key="subInd">
<block>
<view class="label">{{it.label}}</view>
<view class="value">
{{item[it.labelName] || '-'}}
<text wx:if="{{ it.label == '招聘数量' }}">人</text>
</view>
</block>
</view>
<!-- 提示消息 -->
<view class="item_footer" wx:if="{{ tabIndex == 0 && item.showTip && item.confirmFlag == 'N' && item.status !== 0 }}">
<view class="msg_tips">
<text>{{item.tipText}}</text>
<image class="arrow_right" src="/packageEquity/pages/image/arrow-right.png" mode="aspectFill" />
</view>
</view>
</view>
</block>
<block wx:if="{{ nothing }}">
<view class="list-nothing">没有更多了</view>
</block>
</block>
<!-- 空数据占位 -->
<view class="no_data" wx:else>
<empty-data />
</view>
</scroll-view>
</view>
<!-- 添加招聘按钮 -->
<view class="insert_btn {{ btnVisible ? 'btn-visible' : 'btn-hidden' }}" bindtap="handleInsertRecruit">
<image class="insert_icon" src="/packageEquity/pages/image/recruit-insert.png" mode="widthFix" />
<view class="label">
<text>添加招聘</text>
<text>需求</text>
</view>
</view>
<!-- 箭头图标 - 与按钮互斥显示 -->
<view class="arrowIcon {{ btnVisible ? 'arrow-hidden' : 'arrow-visible' }}">
<image class="image" src="{{ IMG_URL }}upgrade/arrow-left.png" />
</view>
</view>
\ No newline at end of file
// packageEquity/pages/recruitManage/recruitResult/recruitResult.js
import constantData from '~/pages/constant/data'
Page({
/**
* 页面的初始数据
*/
data: {
sceneType: null, // 当前场景类型
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 获取当前用户的场景类型
const userInfo = wx.$util.getUserInfo()
this.setData({
sceneType: userInfo?.sceneType
})
},
// 继续添加需求
continueAdd() {
wx.$router.reLaunch(`recruitInsert`);
},
// 返回招聘列表
backToList() {
wx.$router.reLaunch(`recruitManage`);
},
// 返回首页
backToHome() {
const { sceneType } = this.data
// 根据场景类型跳转到对应的首页
// 场景类型:0-会员权益/升级,1-精品升级,2-次新车转化,3-售后众筹
const scenePageMap = constantData.pageUrl
const targetPage = scenePageMap[sceneType] || 'tabIndex.index'
wx.$router.reLaunch(targetPage, {});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"navigationBarTitleText": "提交成功",
"usingComponents": {}
}
\ No newline at end of file
/* pages/statePage/state.wxss */
.container {
display: flex;
justify-content: center;
height: 100vh;
width: 100%;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
}
.icon {
width: 200px;
height: 200px;
opacity: 1;
background: #ffffff;
margin-bottom: 30px;
margin-top: var(--fontSize64);
}
.text {
width: 80px;
height: 28px;
opacity: 1;
color: #292d33;
font-size: 20px;
font-weight: 600;
font-family: "PingFang SC", sans-serif;
text-align: center;
margin-bottom: 15px;
}
.sub_text {
font-size: var(--fontSize28);
text-align: center;
margin-bottom: 40px;
width: 90%;
line-height: 1.5;
color: #7a8299;
}
.btn,
.btn-secondary {
width: 261px;
height: 40px;
border-radius: 6px;
opacity: 1;
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 15px;
}
.btn {
border: 1px solid #347bff;
background: #347bff;
color: #ffffff;
}
.btn-secondary {
border: 1px solid #f4f5f7;
background: #f4f5f7;
color: #292d33;
}
.back_btn {
color: #347BFF;
font-size: 14px;
padding: 10px;
margin-top: 10px;
}
\ No newline at end of file
<template>
<div class="recruit-result">
<div class="content">
<van-icon name="checked" color="#07c160" size="100" class="icon" />
<div class="text">提交成功</div>
<div class="sub_text">人事同事正在加急处理您的用人需求,请耐心等待,进度可及时关注企微提醒。</div>
<div class="btn" @click="continueAdd">继续添加需求</div>
<div class="btn btn-secondary" @click="backToList">返回招聘列表</div>
<div class="back_btn" @click="backToHome">返回首页</div>
</div>
</div>
</template>
<script>
export default {
name: 'RecruitResult',
data() {
return {
sceneType: null
}
},
created() {
// Mock user info or get from store
// const userInfo = this.$store.getters.userInfo
// this.sceneType = userInfo?.sceneType
},
methods: {
continueAdd() {
this.$router.replace({ name: 'recruitInsert/recruitInsert' })
},
backToList() {
this.$router.replace({ name: 'recruitManage/recruitManage' })
},
backToHome() {
// Logic from original file:
// const scenePageMap = constantData.pageUrl
// const targetPage = scenePageMap[this.sceneType] || 'tabIndex.index'
// For now, just go to root or a default home
this.$router.push('/')
}
}
}
</script>
<style lang="scss" scoped>
.recruit-result {
display: flex;
justify-content: center;
height: 100vh;
width: 100%;
background: #ffffff;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
padding-top: 64px;
}
.icon {
margin-bottom: 30px;
}
.text {
height: 28px;
color: #292d33;
font-size: 20px;
font-weight: 600;
text-align: center;
margin-bottom: 15px;
}
.sub_text {
font-size: 14px;
text-align: center;
margin-bottom: 40px;
width: 90%;
line-height: 1.5;
color: #7a8299;
}
.btn,
.btn-secondary {
width: 261px;
height: 40px;
border-radius: 6px;
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 15px;
cursor: pointer;
}
.btn {
border: 1px solid #347bff;
background: #347bff;
color: #ffffff;
}
.btn-secondary {
border: 1px solid #f4f5f7;
background: #f4f5f7;
color: #292d33;
}
.back_btn {
color: #347bff;
font-size: 14px;
padding: 10px;
margin-top: 10px;
cursor: pointer;
}
</style>
<!--index.wxml-->
<view class="container">
<view class="content">
<image class="icon" src="/packageEquity/pages/image/success-icon.png" mode="aspectFill"/>
<view class="text">提交成功</view>
<view class="sub_text">人事同事正在加急处理您的用人需求,请耐心等待,进度可及时关注企微提醒。</view>
<view class="btn" bind:tap="continueAdd">继续添加需求</view>
<view class="btn btn-secondary" bind:tap="backToList">返回招聘列表</view>
<view class="back_btn" bind:tap="backToHome">返回首页</view>
</view>
</view>
<template>
<div class="recruitment-review">
<div class="content">
<div class="info-list">
<div class="info-item">
<span class="label">门店名称</span>
<div class="value">
{{ detail.merchantName || '--' }}
<img v-if="detail.urgent === 1" class="ji" :src="`${IMG_URL}miniProgram/ji.png`" />
</div>
</div>
<div class="info-item">
<span class="label">近一月新车销量</span>
<div class="value">400</div>
</div>
<div class="info-item">
<span class="label">主营品牌</span>
<div class="value">鸿蒙智行/比亚迪</div>
</div>
<div class="info-item">
<span class="label">门店地址</span>
<div class="value">广东省深圳市深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层</div>
</div>
<div class="info-item">
<span class="label">业务类型</span>
<div class="value">{{ detail.businessTypeName || '--' }}</div>
</div>
<div class="info-item">
<span class="label">招聘类型</span>
<div class="value">{{ detail.recruitmentTypeName || '--' }}</div>
</div>
<div class="info-item">
<span class="label">招聘数量</span>
<div class="value">6</div>
</div>
<div class="info-item">
<span class="label">区域运营</span>
<div class="value">罗敏</div>
</div>
<div class="info-item">
<span class="label">需求描述</span>
<div class="value">{{ detail.requirementDescription || '--' }}</div>
</div>
<div class="info-item">
<span class="label">招聘负责人</span>
<div class="value flex-center">
{{ detail.recruiterName || '--' }}
<a v-if="detail.recruiterPhone" :href="'tel:' + detail.recruiterPhone" class="phone-icon-wrapper">
<!-- <van-icon name="phone-o" /> -->
<img class="phone_icon" src="../image/call-icon.png" />
</a>
</div>
</div>
<div class="info-item">
<span class="label">技术督导</span>
<div class="value flex-center">
{{ detail.technicalSupervisorName || '--' }}
<a v-if="detail.technicalSupervisorPhone" :href="'tel:' + detail.technicalSupervisorPhone" class="phone-icon-wrapper">
<!-- <van-icon name="phone-o" /> -->
<img class="phone_icon" src="../image/call-icon.png" />
</a>
</div>
</div>
<div class="info-item">
<span class="label">申请时间</span>
<div class="value">{{ detail.createdDate || '--' }}</div>
</div>
</div>
</div>
<div class="footer-btns">
<van-button class="btn reject-btn" @click="handleReject">驳回</van-button>
<van-button class="btn confirm-btn" type="primary" @click="handleConfirm">确认</van-button>
</div>
<!-- 驳回弹窗 -->
<van-dialog v-model:show="showRejectDialog" title="驳回" :show-confirm-button="false" :show-cancel-button="false" class="reject-dialog">
<div class="dialog-content">
<div class="dialog-label">
驳回原因
<span class="required">*</span>
</div>
<div class="textarea-wrapper">
<textarea v-model="rejectReason" class="custom-textarea" placeholder="请输入驳回原因" maxlength="200"></textarea>
<div class="char-count">{{ rejectReason.length }}/200</div>
</div>
<div class="dialog-tip">说明:驳回后,无法再进行招聘事项。</div>
</div>
<div class="dialog-footer">
<div class="dialog-btn cancel" @click="showRejectDialog = false">取消</div>
<div class="dialog-btn confirm" @click="confirmReject">确定</div>
</div>
</van-dialog>
</div>
</template>
<script>
import api from '../api'
import { Toast, Dialog } from 'vant'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
export default {
name: 'RecruitmentReview',
data() {
return {
IMG_URL,
detail: {},
showRejectDialog: false,
rejectReason: ''
}
},
created() {
this.fetchDetail()
},
methods: {
async fetchDetail() {
const id = this.$route.query.id
if (!id) {
Toast('参数错误')
return
}
try {
const res = await api.getRecruitDetailAPI({ id })
// if (res.code === 200) {
this.detail = res?.recruitment || {}
// } else {
// Toast(res.msg || '获取详情失败')
// }
} catch (error) {
console.error(error)
Toast('网络错误')
}
},
handleReject() {
this.rejectReason = ''
this.showRejectDialog = true
},
async confirmReject() {
if (!this.rejectReason) {
Toast('请输入驳回原因')
return
}
try {
await api.updateDemandStatusAPI({
id: this.detail.id || this.$route.query.id,
status: 3, // 3-已驳回
recallReason: this.rejectReason
})
Toast.success('已驳回')
this.showRejectDialog = false
this.$router.back()
} catch (error) {
console.error(error)
}
},
async handleConfirm() {
// Dialog.confirm({
// title: '提示',
// message: '确认通过该招聘需求吗?'
// })
// .then(async () => {
// try {
// await
const res = await api.updateDemandStatusAPI({
id: this.detail.id || this.$route.query.id,
status: 1 // 1-招聘中
})
Toast.success('已确认')
this.$router.back()
// }
// catch (error) {
// console.error(error)
// }
// })
// .catch(() => {
// // on cancel
// })
}
}
}
</script>
<style lang="scss" scoped>
.recruitment-review {
min-height: 100vh;
background: #fff;
padding-bottom: 80px; /* Space for footer */
display: flex;
flex-direction: column;
.content {
padding: 20px 16px;
flex: 1;
}
.info-list {
.info-item {
display: flex;
justify-content: space-between;
margin-bottom: 24px;
font-size: 14px;
line-height: 1.5;
.label {
color: #999;
width: 100px; /* Fixed width for labels to align */
flex-shrink: 0;
}
.value {
color: #333;
text-align: right;
flex: 1;
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
word-break: break-all;
}
.ji {
display: inline-block;
width: 16px;
height: 16px;
margin-left: 5px;
}
}
}
.flex-center {
display: flex;
align-items: center;
justify-content: flex-end;
}
.phone-icon-wrapper {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
// border: 1px dashed #999;
border-radius: 4px;
// margin-left: 8px;
color: #333;
}
.footer-btns {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 70px;
// background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
// box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
z-index: 100;
.btn {
width: 48%;
height: 40px;
border-radius: 4px;
font-size: 16px;
}
.reject-btn {
background: #f5f5f5;
color: #333;
border: none;
}
.confirm-btn {
background: #3b87ff; /* Blue color matching design typically */
border: none;
}
}
/* Custom Dialog Styles */
::v-deep .reject-dialog {
width: 90%;
max-width: 320px;
border-radius: 8px;
.van-dialog__header {
padding-top: 20px;
font-weight: 500;
font-size: 18px;
}
.dialog-content {
padding: 16px 20px;
.dialog-label {
font-size: 14px;
color: #333;
margin-bottom: 8px;
.required {
color: #ff4d4f;
margin-left: 4px;
}
}
.textarea-wrapper {
position: relative;
border: 1px solid #ebedf0;
border-radius: 4px;
padding: 8px;
background: #fff;
.custom-textarea {
width: 100%;
height: 120px;
border: none;
resize: none;
font-size: 14px;
color: #333;
padding: 0;
&::placeholder {
color: #c8c9cc;
}
&:focus {
outline: none;
}
}
.char-count {
text-align: right;
font-size: 12px;
color: #969799;
margin-top: 4px;
}
}
.dialog-tip {
font-size: 12px;
color: #999;
margin-top: 8px;
line-height: 1.5;
}
}
.dialog-footer {
display: flex;
justify-content: space-between;
padding: 0 20px 20px;
.dialog-btn {
flex: 1;
height: 40px;
line-height: 40px;
text-align: center;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
&.cancel {
background: #f5f5f5;
color: #333;
margin-right: 12px;
}
&.confirm {
background: #3b87ff;
color: #fff;
}
}
}
}
}
.phone_icon {
display: inline-block;
width: 20px;
height: 20px;
// margin-left: 5px;
vertical-align: middle;
}
</style>
......@@ -4,9 +4,9 @@ const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const resolve = dir => path.join(__dirname, dir)
// page title
// page title
const name = defaultSettings.title || '登录中...'
// 生产环境,测试和正式
// 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
/**
......@@ -16,14 +16,17 @@ const SpritesmithPlugin = require('webpack-spritesmith')
const spritesmithFunction = data => {
let { spritesheet, sprites } = data
let shared = `.sprite-icon { background-image: url(${data.sprites[0].image});background-size: ${spritesheet.width / 2}px ${spritesheet.height / 2}px;}`
let perSprite = sprites.map(sprite => {
let { name, width, height, offset_x, offset_y } = sprite
return `.icon-${name} { width: ${width / 2}px; height: ${height / 2}px; background-position: ${offset_x / 2}px ${offset_y / 2}px;}`
}).join('\n')
let perSprite = sprites
.map(sprite => {
let { name, width, height, offset_x, offset_y } = sprite
return `.icon-${name} { width: ${width / 2}px; height: ${height / 2}px; background-position: ${offset_x / 2}px ${offset_y / 2}px;}`
})
.join('\n')
return `${shared}\n${perSprite}`
}
module.exports = {
publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main-lwk/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main-zhangls/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router history模式使用 微信开发环境需打开
outputDir: 'dist', // 生产环境构建文件的目录
......@@ -33,9 +36,11 @@ module.exports = {
devServer: {
disableHostCheck: true,
// port: 9527, // 端口 dj-scrm-wx-work-lwk
port: 9528, // 端口 dj-scrm-wx-work-main-lwk
// port: 9528, // 端口 dj-scrm-wx-work-main-lwk
open: false, // 启动后打开浏览器.
public:'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main-lwk/#/',
// public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main-zhangls/#/',
overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false,
......@@ -81,13 +86,16 @@ module.exports = {
image: path.resolve(__dirname, './src/assets/images/sprite.png'),
// 生成SCSS
css: [
[path.resolve(__dirname, './src/assets/css/sprite.scss'), {
format: 'function_based_template'
}]
[
path.resolve(__dirname, './src/assets/css/sprite.scss'),
{
format: 'function_based_template'
}
]
]
},
customTemplates: {
'function_based_template': spritesmithFunction,
function_based_template: spritesmithFunction
},
//background引用路径
apiOptions: {
......@@ -100,11 +108,11 @@ module.exports = {
})
]
config.plugins = [...config.plugins, ...Plugins]
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
},
chainWebpack: config => {
......@@ -133,26 +141,30 @@ module.exports = {
return options
})
.end()
/**
* 打包分析
*/
/**
* 打包分析
*/
if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [{
analyzerMode: 'static'
}])
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'static'
}
])
}
config
// https://webpack.js.org/configuration/devtool/#development
// https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool('cheap-source-map'))
config.when(IS_PROD, config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/
}])
.use('script-ext-html-webpack-plugin', [
{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/
}
])
.end()
config.optimization.splitChunks({
chunks: 'all',
......@@ -181,4 +193,4 @@ module.exports = {
config.optimization.runtimeChunk('single')
})
}
}
\ 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!