<template>
    <view class="app-container" @touchstart="handleTouchStart" @touchmove="handleTouchMove">
        <!-- #ifdef MP-WEIXIN -->
        <!-- 小程序背景图片 -->
        <image class="mp-background" src="/static/icon/background2.png" mode="aspectFill"></image>
        <!-- #endif -->
        
        <!-- 企业账号显示卡片 -->
        <view class="enterprise-card btn-feel" v-if="shouldShowCompanyCard" @click="goToCompanyInfo">
            <view class="card-content">
                <!-- 企业图标 -->
                <view class="company-icon">
                    <image 
                        v-if="companyInfo.avatar" 
                        :src="companyInfo.avatar" 
                        class="logo-image"
                        mode="aspectFit"
                    />
                    <view v-else class="default-logo">
                        <uni-icons type="home-filled" size="32" color="#256BFA"></uni-icons>
                    </view>
                </view>
                
                <!-- 企业信息 -->
                <view class="company-info">
                    <view class="company-name">{{ companyInfo.name || '企业名称' }}</view>
                    <view class="company-details">
                        <text class="size">企业规模: {{ getDictLabel('scale', companyInfo.scale) || '暂无规模数据' }}</text>
                    </view>
                </view>
                
                <!-- 企业用户直播按钮 -->
                <!-- #ifndef H5 -->
                <view class="company-live-button press-button" @click.stop="handleLiveClick">
                    <view class="live-icon">
                        <uni-icons type="videocam-filled" size="16" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="live-text">直播</view>
                </view>
                <!-- #endif -->
            </view>
        </view>
        
        <view 
            class="nav-hidden hidden-animation" 
            :class="{ 'hidden-height': shouldHideTop }"
        >
            <view class="container-search" v-if="shouldShowJobSeekerContent">
                <view class="search-input button-click" @click="goToSearch">
                    <uni-icons class="iconsearch" color="#666666" type="search" size="18"></uni-icons>
                    <text class="inpute">职位名称、薪资要求等</text>
                </view>
                <!-- 直播入口按钮 -->
                <!-- #ifndef H5 -->
                <view class="live-button press-button" @click="handleLiveClick">
                    <view class="live-icon">
                        <uni-icons type="videocam-filled" size="16" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="live-text">直播</view>
                </view>
                <!-- #endif -->
                <!-- <view class="chart button-click">职业图谱</view> -->
            </view>
            <view class="cards" v-if="shouldShowJobSeekerContent">
                <view class="card press-button" @click="handleNearbyClick">
                    <view class="card-title">附近工作</view>
                    <view class="card-text">好岗职等你来</view>
                </view>
                <!-- <view class="card press-button" @click="navTo('/packageA/pages/choiceness/choiceness')">
                    <view class="card-title">精选企业</view>
                    <view class="card-text">优选职得信赖</view>
                </view> -->
            </view>
            
            <!-- H5端专用按钮 -->
            <!-- #ifdef H5 -->
            <view class="h5-action-buttons" v-if="shouldShowJobSeekerContent">
                <!-- <view class="h5-action-btn press-button" @click="handleH5SalaryClick">
                    <view class="btn-text">薪酬信息</view>
                </view> -->
                <view class="h5-action-btn press-button" @click="handelGoResumeGuide()">
                    <view class="btn-text">简历指导</view>
                </view>
                
            </view>
            <!-- #endif -->
            <!-- 服务功能网格 -->
            <!-- #ifndef H5 -->
            <view class="service-grid" v-if="shouldShowJobSeekerContent">
                <view class="service-item press-button" @click="handleServiceClick('service-guidance')">
                    <view class="service-icon service-icon-1">
                        <uni-icons type="auth-filled" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="service-title">服务指导</view>
                </view>
                
                <view class="service-item press-button" @click="handleServiceClick('resume-creation')">
                    <view class="service-icon service-icon-3">
                        <IconfontIcon name="jianli" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">简历指导</view>
                </view>
                <view class="service-item press-button" @click="handleServiceClick('labor-policy')">
                    <view class="service-icon service-icon-4">
                        <IconfontIcon name="zhengce" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">政策指引</view>
                </view>
                <view class="service-item press-button" @click="handleServiceClick('skill-training')">
                    <view class="service-icon service-icon-5">
                        <IconfontIcon name="jinengpeixun" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">技能课堂</view>
                </view>
                <view class="service-item press-button" @click="handleServiceClick('skill-evaluation')">
                    <view class="service-icon service-icon-6">
                        <IconfontIcon name="jinengpingjia" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">技能评价</view>
                </view>
                <!-- <view class="service-item press-button" @click="handleServiceClick('question-bank')">
                    <view class="service-icon service-icon-7">
                        <IconfontIcon name="suzhicepingtiku" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">题库和考试</view>
                </view> -->
                <view class="service-item press-button" @click="goCa()">
                    <view class="service-icon service-icon-8">
                        <IconfontIcon name="suzhicepingtiku" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">素质测评</view>
                </view>
                <view class="service-item press-button" @click="goCaAI()">
                    <view class="service-icon service-icon-9">
                        <IconfontIcon name="ai" :size="68" color="#FFFFFF" />
                    </view>
                    <view class="service-title">虚拟面试</view>
                </view>
                
                <view class="service-item press-button" @click="handleServiceClick('career-planning')">
                    <view class="service-icon service-icon-11">
                        <image class="service-icon-img" src="/static/icon/antOutline.png" mode="aspectFit"></image>
                    </view>
                    <view class="service-title">职业规划推荐</view>
                </view>
                <!-- <view class="service-item press-button" @click="handleSalaryInfoClick">
                    <view class="service-icon service-icon-12">
                        <span style="display:block;width:40rpx;height:40rpx;border-radius:100%;border:4rpx #ffffff solid;line-height:40rpx;text-align:center;">￥</span>
                    </view>
                    <view class="service-title">薪酬信息</view>
                </view> -->
                <view class="service-item press-button" @click="handleJobFairClick">
                    <view class="service-icon service-icon-1">
                        <uni-icons type="shop" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="service-title">招聘会</view>
                </view>
				<view class="service-item press-button" v-if="isFourLevelLinkagePurview" @click="helpClick">
				    <view class="service-icon service-icon-1">
				        <uni-icons type="shop" size="32" color="#FFFFFF"></uni-icons>
				    </view>
				    <view class="service-title">帮扶</view>
				</view>
				<view class="service-item press-button" v-if="isFourLevelLinkagePurview" @click="helpTaskClick">
				    <view class="service-icon service-icon-1">
				        <uni-icons type="shop" size="32" color="#FFFFFF"></uni-icons>
				    </view>
				    <view class="service-title">帮扶任务</view>
				</view>
                <view class="service-item press-button" @click="handleNoticeClick">
                    <view class="service-icon service-icon-10">
                        <uni-icons type="sound" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="service-title">培训评价公告</view>
                </view>
                <view class="service-item press-button" @click="handleInstitutionClick('training')">
                    <view class="service-icon service-icon-6">
						<uni-icons type="map-pin-ellipse" size="32" color="#FFFFFF"></uni-icons>
                        <!-- <image class="service-icon-img" src="/static/icon/pxjgxx.png" mode="aspectFit"></image> -->
                    </view>
                    <view class="service-title">培训机构信息</view>
                </view>
                <view class="service-item press-button" @click="handleInstitutionClick('evaluate')">
                    <view class="service-icon service-icon-7">
                        <IconfontIcon name="suzhicepingtiku" :size="48" color="#FFFFFF" />
                    </view>
                    <view class="service-title">评价机构信息</view>
                </view>
                <view class="service-item press-button" style="justify-content:normal" @click="goRc()">
                    <view class="service-icon service-icon-9">
                        <IconfontIcon name="Graduation-simple-" :size="32" color="#FFFFFF" />
                    </view>
                    <view class="service-title" style="overflow:unset">高校毕业生<br/>智慧就业服务</view>
                </view>
            </view>
            <!-- #endif -->
        </view>
        
        <!-- 企业用户内容 -->
        <!-- <view class="company-content" v-if="shouldShowCompanyContent">
            <view class="company-header">
                <text class="company-title">企业服务</text>
                <text class="company-subtitle">为您提供专业的企业招聘服务</text>
            </view>
            
            <view class="company-grid">
                <view class="company-item press-button" @click="navTo('/packageA/pages/job/publishJob')">
                    <view class="company-icon company-icon-1">
                        <uni-icons type="plus-filled" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="company-title">发布岗位</view>
                </view>
                <view class="company-item press-button" @click="handleServiceClick('company-management')">
                    <view class="company-icon company-icon-2">
                        <uni-icons type="settings-filled" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="company-title">企业管理</view>
                </view>
                <view class="company-item press-button" @click="handleServiceClick('recruitment-data')">
                    <view class="company-icon company-icon-3">
                        <uni-icons type="bar-chart-filled" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="company-title">招聘数据</view>
                </view>
                <view class="company-item press-button" @click="handleServiceClick('talent-pool')">
                    <view class="company-icon company-icon-4">
                        <uni-icons type="person-filled" size="32" color="#FFFFFF"></uni-icons>
                    </view>
                    <view class="company-title">人才库</view>
                </view>
            </view>
        </view> -->
        
        <!-- 吸顶筛选区域占位 -->
        <view class="filter-placeholder" v-if="shouldStickyFilter && shouldShowJobSeekerContent"></view>
        
        
        <view class="nav-filter" :class="{ 'sticky-filter': shouldStickyFilter }" v-if="shouldShowJobSeekerContent">
            <view class="filter-top">
                <scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
                    <view class="jobs-left">
                        <view
                            class="job button-click"
                            :class="{ active: state.tabIndex === 'all' }"
                            @click="choosePosition('all')"
                        >
                            全部
                        </view>
                        <view
                            class="job button-click"
                            :class="{ active: state.tabIndex === index }"
                            v-for="(item, index) in userInfo.jobTitle"
                            :key="index"
                            @click="choosePosition(index)"
                        >
                            {{ item }}
                        </view>
                    </view>
                </scroll-view>
                
                <view class="jobs-add button-click" @click="navTo('/packageA/pages/addPosition/addPosition')">
                    <uni-icons class="iconsearch" color="#666D7F" type="plusempty" size="18"></uni-icons>
                    <text>添加</text>
                </view>
                <view class="jobs-add button-click" @click="navTo('/packageA/pages/city-select/index')" style="padding-right:0;">
                    <text>{{ selectedCity.name || '地区' }}</text>
                    <image class="right-sx" :class="{ active: showFilter }" src="@/static/icon/shaixun.png"></image>
                </view>
            </view>
            <view class="filter-bottom">
                <view class="btm-left">
                    <view
                        class="button-click filterbtm"
                        :class="{ active: pageState.search.order === item.value }"
                        v-for="item in rangeOptions"
                        @click="handelHostestSearch(item)"
                        :key="item.value"
                    >
                        {{ item.text }}
                    </view>
                </view>
                <view class="btm-right-group">
                    <view class="btm-right button-click" @click="openFilter">
                        筛选
                        <image class="right-sx" :class="{ active: showFilter }" src="@/static/icon/shaixun.png"></image>
                    </view>
                    <view class="btm-clear button-click" v-if="hasActiveFilters" @click="clearFilters">
                        <uni-icons type="trash" size="18" color="#256BFA"></uni-icons>
                        <text>清除</text>
                    </view>
                </view>
            </view>
        </view>
        <view class="table-list">
            <scroll-view 
                :scroll-y="true" 
                class="falls-scroll" 
                @scroll="handleScroll" 
                @scrolltolower="scrollBottom"
                :enable-back-to-top="false"
                :scroll-with-animation="false"
            >
                <view class="falls" v-if="list.length">
                    <!-- #ifdef MP-WEIXIN -->
                    <!-- 小程序使用具名插槽 -->
                    <custom-waterfalls-flow
                        :column="columnCount"
                        :columnSpace="columnSpace"
                        ref="waterfallsFlowRef"
                        :value="list"
                    >
                        <view v-for="(job, index) in list" :key="index" :slot="`slot${index}`">
                            <view class="item btn-feel" v-if="!job.recommend">
                                <view class="falls-card" :class="{ 'disabled-card': Number(job.jobStatus) === 1 }" @click="nextDetail(job)">
                                    <view class="falls-card-pay">
                                        <view class="pay-text">
                                            <Salary-Expectation
                                                :max-salary="job.maxSalary"
                                                :min-salary="job.minSalary"
                                                :is-month="true"
                                            ></Salary-Expectation>
                                        </view>
                                        <image v-if="job.isHot" class="flame" src="/static/icon/flame.png"></image>
                                    </view>
                                    <view class="falls-card-title">{{ job.jobTitle }}</view>
                                    <view class="fl_box fl_warp">
                                        <view class="falls-card-education mar_ri10" v-if="job.education">
                                            <dict-Label dictType="education" :value="job.education"></dict-Label>
                                        </view>
                                        <view class="falls-card-experience" v-if="job.experience">
                                            <dict-Label dictType="experience" :value="job.experience"></dict-Label>
                                        </view>
                                    </view>
                                    <view class="falls-card-company" v-show="isShowJw !== 3">
                                        {{ config.appInfo.areaName }}
                                        <!-- {{ job.jobLocation }} -->
                                        <dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
                                    </view>
                                    <view class="falls-card-pepleNumber">
                                        <view>
                                            <image class="point2" src="/static/icon/pintDate.png"></image>
                                            <view class="fl_1">
                                                {{ job.postingDate || '发布日期' }}
                                            </view>
                                        </view>
                                        <view>
                                            <image class="point3" src="/static/icon/pointpeople.png"></image>
                                            <view class="fl_1">
                                                {{ vacanciesTo(job.vacancies) }}
                                            </view>
                                        </view>
                                    </view>
                                    <view class="falls-card-company2">
                                        {{ job.companyName }}
                                    </view>
                                    <!-- 招聘者显示上下架开关 -->
                                    <view class="falls-card-actions" v-if="isRecruiter">
                                        <view class="job-status-switch" @click.stop="toggleJobStatus(job)">
                                            <view class="switch-track" :class="{ 'active': Number(job.jobStatus) === 0 }">
                                                <view class="switch-thumb" :class="{ 'active': Number(job.jobStatus) === 0 }"></view>
                                            </view>
                                            <view class="switch-label">
                                                {{ Number(job.jobStatus) === 0 ? '已上架' : '已下架' }}
                                            </view>
                                        </view>
                                    </view>
                                    <!--  <view class="falls-card-matchingrate">
                                        <view class=""><matchingDegree :job="job"></matchingDegree></view>
                                        <uni-icons type="star" size="30"></uni-icons>
                                    </view> -->
                                </view>
                            </view>
                            <view class="item" :class="{ isBut: job.isBut }" v-else>
                                <view class="recommend-card">
                                    <view class="card-content">
                                        <view class="recommend-card-title">在找「{{ job.jobCategory }}」工作吗？</view>
                                        <view class="recommend-card-tip">{{ job.tip }}</view>
                                        <view class="recommend-card-line"></view>
                                        <view class="recommend-card-controll">
                                            <view class="controll-no" @click="clearfindJob(job)">不是</view>
                                            <view class="controll-yes" @click="findJob(job)">是的</view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </custom-waterfalls-flow>
                    <!-- #endif -->
                    <!-- #ifndef MP-WEIXIN -->
                    <!-- H5/App使用作用域插槽 -->
                    <custom-waterfalls-flow
                        :column="columnCount"
                        :columnSpace="columnSpace"
                        ref="waterfallsFlowRef"
                        :value="list"
                    >
                        <template v-slot:default="job">
                            <view class="item btn-feel" v-if="!job.recommend">
                                <view class="falls-card" :class="{ 'disabled-card': Number(job.jobStatus) === 1 }" @click="nextDetail(job)">
                                    <view class="falls-card-pay">
                                        <view class="pay-text">
                                            <Salary-Expectation
                                                :max-salary="job.maxSalary"
                                                :min-salary="job.minSalary"
                                                :is-month="true"
                                            ></Salary-Expectation>
                                        </view>
                                        <image v-if="job.isHot" class="flame" src="/static/icon/flame.png"></image>
                                    </view>
                                    <view class="falls-card-title">{{ job.jobTitle }}</view>
                                    <view class="fl_box fl_warp">
                                        <view class="falls-card-education mar_ri10" v-if="job.education">
                                            <dict-Label dictType="education" :value="job.education"></dict-Label>
                                        </view>
                                        <view class="falls-card-experience" v-if="job.experience">
                                            <dict-Label dictType="experience" :value="job.experience"></dict-Label>
                                        </view>
                                    </view>
                                    <view class="falls-card-company" v-show="isShowJw !== 3">
                                        {{ job.regionName  }}
                                        <!-- {{ job.jobLocation }} -->
                                        <dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
                                    </view>
                                    <view class="falls-card-pepleNumber">
                                        <view>
                                            <image class="point2" src="/static/icon/pintDate.png"></image>
                                            <view class="fl_1">
                                                {{ job.postingDate || '发布日期' }}
                                            </view>
                                        </view>
                                        <view>
                                            <image class="point3" src="/static/icon/pointpeople.png"></image>
                                            <view class="fl_1">
                                                {{ vacanciesTo(job.vacancies) }}
                                            </view>
                                        </view>
                                    </view>
                                    <view class="falls-card-company2">
                                        {{ job.companyName }}
                                    </view>
                                    <!-- 招聘者显示上下架开关 -->
                                    <view class="falls-card-actions" v-if="isRecruiter">
                                        <view class="job-status-switch" @click.stop="toggleJobStatus(job)">
                                            <view class="switch-track" :class="{ 'active': Number(job.jobStatus) === 0 }">
                                                <view class="switch-thumb" :class="{ 'active': Number(job.jobStatus) === 0 }"></view>
                                            </view>
                                            <view class="switch-label">
                                                {{ Number(job.jobStatus) === 0 ? '已上架' : '已下架' }}
                                            </view>
                                        </view>
                                    </view>
                                    <!--  <view class="falls-card-matchingrate">
                                        <view class=""><matchingDegree :job="job"></matchingDegree></view>
                                        <uni-icons type="star" size="30"></uni-icons>
                                    </view> -->
                                </view>
                            </view>
                            <view class="item" :class="{ isBut: job.isBut }" v-else>
                                <view class="recommend-card">
                                    <view class="card-content">
                                        <view class="recommend-card-title">在找「{{ job.jobCategory }}」工作吗？</view>
                                        <view class="recommend-card-tip">{{ job.tip }}</view>
                                        <view class="recommend-card-line"></view>
                                        <view class="recommend-card-controll">
                                            <view class="controll-no" @click="clearfindJob(job)">不是</view>
                                            <view class="controll-yes" @click="findJob(job)">是的</view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </template>
                    </custom-waterfalls-flow>
                    <!-- #endif -->
                    <loadmore ref="loadmoreRef"></loadmore>
                </view>
                <empty v-else pdTop="200"></empty>
            </scroll-view>
        </view>
        <!-- 筛选 -->
        <select-filter ref="selectFilterModel" />
        <!-- 新筛选页面 -->
        <new-filter-page 
            :show="showNewFilter" 
            @confirm="handleNewFilterConfirm" 
            @close="handleNewFilterClose"
            @update:show="(value) => showNewFilter = value"
        />

        <!-- 微信授权登录弹窗 -->
        <WxAuthLogin ref="wxAuthLoginRef" @success="handleLoginSuccess" />

        <!--        <view class="maskFristEntry" v-if="maskFristEntry">
            <view class="entry-content">
                <text class="text1">左滑查看视频</text>
                <text class="text2">左滑查看视频</text>
                <view class="goExperience">去体验</view>
                <view class="maskFristEntry-Close" @click="closeFristEntry">1</view>
            </view>
        </view> -->
    </view>
</template>

<script setup>
import { reactive, inject, watch, ref, onMounted, onUnmounted, watchEffect, nextTick, computed } from 'vue';
import img from '@/static/icon/filter.png';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
const { $api, navTo, vacanciesTo, formatTotal, config } = inject('globalFunction');
import { onLoad, onShow } from '@dcloudio/uni-app';
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
import { checkLoginAndNavigate, getPlatformType } from '@/utils/loginHelper';
const { userInfo, hasLogin, token } = storeToRefs(useUserStore());

// 计算是否显示求职者内容
const shouldShowJobSeekerContent = computed(() => {
    // 未登录时默认显示求职者内容
    if (!hasLogin.value) {
        return true;
    }
    
    // 优先从store获取，如果为空则从缓存获取
    const storeIsCompanyUser = userInfo.value?.isCompanyUser;
    const cachedUserInfo = uni.getStorageSync('userInfo') || {};
    const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
    
    // 获取用户类型：优先使用store中的isCompanyUser，如果store中没有，使用缓存中的isCompanyUser
    // 缓存中的值可能是字符串，需要转换为数值类型
    const userType = storeIsCompanyUser !== undefined ? Number(storeIsCompanyUser) : Number(cachedIsCompanyUser);
    
    // 企业用户(isCompanyUser=0)不显示求职者内容，其他用户类型显示
    return userType !== 0;
});

// 企业信息数据
const companyInfo = reactive({
    name: '',
    avatar: '',
    industry: '',
    scale: '',
    isVerified: false
});

// 计算是否显示企业卡片
const shouldShowCompanyCard = computed(() => {
    // 未登录时不显示
    if (!hasLogin.value) {
        return false;
    }
    
    // 优先从store获取，如果为空则从缓存获取
    const storeIsCompanyUser = userInfo.value?.isCompanyUser;
    const cachedUserInfo = uni.getStorageSync('userInfo') || {};
    const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
    
    // 获取用户类型：优先使用store中的isCompanyUser，如果store中没有，使用缓存中的isCompanyUser
    // 缓存中的值可能是字符串，需要转换为数值类型
    const userType = storeIsCompanyUser !== undefined ? Number(storeIsCompanyUser) : Number(cachedIsCompanyUser);
    
    // 只有企业用户(isCompanyUser=0)才显示企业卡片
    if (userType !== 0) {
        return false;
    }
    
    // 检查企业信息是否已完善
    return companyInfo.name && companyInfo.name.trim() !== '';
});

// 计算是否显示企业用户内容
const shouldShowCompanyContent = computed(() => {
    // 未登录时不显示企业内容
    if (!hasLogin.value) {
        return false;
    }
    
    // 优先从store获取，如果为空则从缓存获取
    const storeIsCompanyUser = userInfo.value?.isCompanyUser;
    const cachedUserInfo = uni.getStorageSync('userInfo') || {};
    const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
    
    // 获取用户类型：优先使用store中的isCompanyUser，如果store中没有，使用缓存中的isCompanyUser
    // 缓存中的值可能是字符串，需要转换为数值类型
    const userType = storeIsCompanyUser !== undefined ? Number(storeIsCompanyUser) : Number(cachedIsCompanyUser);
    
    // 只有企业用户(isCompanyUser=0)才显示企业内容
    return userType === 0;
});

// 判断当前用户是否为招聘者（企业用户）
const isRecruiter = computed(() => {
    if (!hasLogin.value) {
        return false;
    }
    
    // 优先从store获取，如果为空则从缓存获取
    const storeIsCompanyUser = userInfo.value?.isCompanyUser;
    const cachedUserInfo = uni.getStorageSync('userInfo') || {};
    const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
    
    // 获取用户类型：优先使用store中的isCompanyUser，如果store中没有，使用缓存中的isCompanyUser
    // 缓存中的值可能是字符串，需要转换为数值类型
    const userType = storeIsCompanyUser !== undefined ? Number(storeIsCompanyUser) : Number(cachedIsCompanyUser);
    
    // 企业用户(isCompanyUser=0)是招聘者
    return userType === 0;
});

import useDictStore from '@/stores/useDictStore';
const { getTransformChildren, oneDictData, dictLabel: getDictLabel, industryLabel } = useDictStore();
import useLocationStore from '@/stores/useLocationStore';
import selectFilter from '@/components/selectFilter/selectFilter.vue';
import newFilterPage from '@/components/new-filter-page/new-filter-page.vue';
import { useRecommedIndexedDBStore, jobRecommender } from '@/stores/useRecommedIndexedDBStore.js';
import { useScrollDirection } from '@/hook/useScrollDirection';
import { useColumnCount } from '@/hook/useColumnCount';
import WxAuthLogin from '@/components/WxAuthLogin/WxAuthLogin.vue';
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
// 企业卡片组件已内联到模板中
// 滚动状态管理
const shouldHideTop = ref(false);
const shouldStickyFilter = ref(false);
const lastScrollTop = ref(0);
const scrollTop = ref(0);
// 当用户与筛选/导航交互时，临时锁定头部显示状态，避免因数据刷新导致回弹显示
const isInteractingWithFilter = ref(false);
// 触摸事件状态
const touchStartY = ref(0);
const touchMoveY = ref(0);
// 滚动阈值配置
const HIDE_THRESHOLD = 50; // 隐藏顶部区域的滚动阈值（降低阈值，更容易触发）
const SHOW_THRESHOLD = 5; // 显示顶部区域的滚动阈值（接近顶部）
const STICKY_THRESHOLD = 80; // 筛选区域吸顶的滚动阈值
const TOUCH_MOVE_THRESHOLD = 30; // 触摸滑动阈值，用于判断是否为有效滑动

// 处理触摸开始事件
function handleTouchStart(e) {
    // 记录触摸起始位置
    touchStartY.value = e.touches[0].clientY;
}

// 处理触摸移动事件
function handleTouchMove(e) {
    // 记录触摸移动位置
    touchMoveY.value = e.touches[0].clientY;
    
    // 计算滑动距离
    const diffY = touchStartY.value - touchMoveY.value;
    
    // 当向上滑动超过阈值时，隐藏顶部区域
    if (diffY > TOUCH_MOVE_THRESHOLD) {
        if (!shouldHideTop.value) {
            shouldHideTop.value = true;
        }
        if (!shouldStickyFilter.value) {
            shouldStickyFilter.value = true;
        }
    }
    // 当向下滑动超过阈值且在顶部附近时，显示顶部区域
    else if (diffY < -TOUCH_MOVE_THRESHOLD && scrollTop.value <= SHOW_THRESHOLD) {
        if (shouldHideTop.value && !isInteractingWithFilter.value) {
            shouldHideTop.value = false;
        }
        if (shouldStickyFilter.value) {
            shouldStickyFilter.value = false;
        }
    }
}

// 简化的滚动处理函数
function handleScroll(e) {
    const currentScrollTop = e.detail.scrollTop || 0;
    
    // 简单的滚动逻辑：向下滚动超过阈值就隐藏，滚动到顶部就显示
    if (currentScrollTop > HIDE_THRESHOLD) {
        if (!shouldHideTop.value) {
            shouldHideTop.value = true;
        }
    } else if (currentScrollTop <= SHOW_THRESHOLD) {
        // 仅在非交互期才允许自动显示顶部区域
        if (shouldHideTop.value && !isInteractingWithFilter.value) {
            shouldHideTop.value = false;
        }
    }
    
    // 控制筛选区域吸顶
    if (currentScrollTop > STICKY_THRESHOLD) {
        if (!shouldStickyFilter.value) {
            shouldStickyFilter.value = true;
        }
    } else {
        if (shouldStickyFilter.value) {
            shouldStickyFilter.value = false;
        }
    }
    
    // 更新最后的滚动位置
    lastScrollTop.value = currentScrollTop;
    scrollTop.value = currentScrollTop;
}
const recommedIndexDb = useRecommedIndexedDBStore();
const emits = defineEmits(['onShowTabbar']);
const waterfallsFlowRef = ref(null);
const loadmoreRef = ref(null);
const conditionSearch = ref({});
const waterfallcolumn = ref(2);
const maskFristEntry = ref(false);
const wxAuthLoginRef = ref(null);
const state = reactive({
    tabIndex: 'all',
});
//帮扶模块跳转
const helpClick = () => {
    navTo('/packageB/priority/helpFilter');
};
const helpTaskClick = () =>{
	navTo('/packageB/priority/index');
}
//招聘会模块跳转
const handleJobFairClick = () => {
    navTo('/pages/careerfair/careerfair');
};
const list = ref([]);
const pageState = reactive({
    page: 0,
    total: 0,
    maxPage: 2,
    pageSize: 10,
    search: {
        order: 0,
    },
});
const inputText = ref('');
const showFilter = ref(false);
const selectFilterModel = ref(null);
const showModel = ref(false);
const showNewFilter = ref(false);
// 判断是否有活跃的筛选条件
const hasActiveFilters = computed(() => {
    // 城市选择
    if (selectedCity.value.code) return true;
    // 筛选弹窗的条件（除了 order 之外还有其他字段）
    const searchKeys = Object.keys(pageState.search).filter(k => k !== 'order');
    if (searchKeys.length > 0) return true;
    return false;
});
// 选中的城市
const selectedCity = ref({ code: '', name: '' });
const rangeOptions = ref([
    { value: 0, text: '推荐' },
    { value: 1, text: '最热' },
    { value: 2, text: '最新发布' },
    // { value: 3, text: '疆外' },
    { value: 4, text: '零工岗位' }
]);
const isLoaded = ref(false);
const isInitialized = ref(false); // 添加初始化标志

const { columnCount, columnSpace } = useColumnCount(() => {
    pageState.pageSize = 10 * (columnCount.value - 1) + 10;
    
    // 只在首次初始化时调用，避免重复调用
    if (!isInitialized.value) {
        isInitialized.value = true;
        getJobRecommend('refresh');
    }
    
    nextTick(() => {
        waterfallsFlowRef.value?.refresh?.();
        useLocationStore().getLocation();
    });
});

// 获取企业信息
const getCompanyInfo = () => {
    try {
        const cachedUserInfo = uni.getStorageSync('userInfo') || {};
        console.log('缓存中的userInfo:', cachedUserInfo);
        
        // 重置企业信息
        companyInfo.name = '';
        companyInfo.avatar = '';
        companyInfo.industry = '';
        companyInfo.scale = '';
        companyInfo.isVerified = false;
        
        // 检查是否有company字段
        if (cachedUserInfo.company) {
            const company = cachedUserInfo.company;
            
            // 基本信息
            companyInfo.name = company.name || '';
            companyInfo.avatar = company.avatar || '';
            companyInfo.industry = company.industryType || '互联网';
            companyInfo.scale = company.scale || '100-999人';
            
            // 判断是否实名：legalIdCard字段有值则表示已实名
            companyInfo.isVerified = !!(company.legalIdCard && company.legalIdCard.trim());
            
            console.log('企业信息已更新:', {
                name: companyInfo.name,
                industry: companyInfo.industry,
                size: companyInfo.scale,
                isVerified: companyInfo.isVerified
            });
        } else {
            console.log('缓存中没有company字段，企业信息已重置');
        }
    } catch (error) {
        console.error('获取企业信息失败:', error);
        // 重置为默认值
        companyInfo.name = '';
        companyInfo.avatar = '';
        companyInfo.industry = '';
        companyInfo.scale = '';
        companyInfo.isVerified = false;
    }
};

// 跳转到企业信息详情页面
const goToCompanyInfo = () => {
    navTo('/pages/mine/company-info');
};


// 组件初始化时加载数据
onMounted(() => {
    // 获取企业信息
    getCompanyInfo();
    // pageNull.value = 0;
    uni.$on('showLoginModal', () => {
        wxAuthLoginRef.value?.open();
        pageNull.value = 0;
    });
});

onMounted(() => {
    // 在组件挂载时绑定事件监听，确保只绑定一次
    // 先移除可能存在的旧监听，避免重复绑定
    uni.$off('showLoginModal');
    uni.$off('citySelected');
    
    // 绑定新的监听
    uni.$on('showLoginModal', () => {
        console.log('收到showLoginModal事件，打开登录弹窗');
        wxAuthLoginRef.value?.open();
        pageNull.value = 0;
    });
    
    // 监听城市选择事件
    uni.$on('citySelected', (city) => {
        console.log('收到citySelected事件，选择的城市:', city);
        selectedCity.value = city;
        // 可以在这里添加根据城市筛选职位的逻辑
        conditionSearch.value.regionCode = city.code;
        getJobRecommend('refresh');
    });
    
    // 获取企业信息
    getCompanyInfo();
});

onUnmounted(() => {
    // 组件销毁时移除事件监听
    uni.$off('showLoginModal');
    uni.$off('citySelected');
});

onShow(() => {
    // 页面显示时获取最新的企业信息
    getCompanyInfo();
    // 四级联动单点及权限
    getIsFourLevelLinkagePurview();
});

// 监听用户信息变化，当登录状态改变时重新获取企业信息
watch([hasLogin, userInfo], () => {
    if (hasLogin.value) {
        getCompanyInfo();
    }
}, { deep: true });

// 登录检查函数
const checkLogin = () => {
    const tokenValue = uni.getStorageSync('token') || '';
    if (!tokenValue || !hasLogin.value) {
        // 未登录，根据平台类型跳转到对应登录页面
        checkLoginAndNavigate();
        return false;
    }
    return true;
};

// 登录成功回调
const handleLoginSuccess = () => {
    // 登录成功后刷新数据
    getJobRecommend('refresh');
    
    // 重新获取企业信息
    getCompanyInfo();
    //四级联动单点及权限
    getIsFourLevelLinkagePurview()
};
// H5环境下从URL获取token并自动登录
// onLoad 函数已移至下方，包含筛选参数处理

// 跳转到搜索页面，筛选弹窗的地区用 area，添加旁地区的城市用 regionCode
const goToSearch = () => {
    const query = {
        regionCode: selectedCity.value.code,
        regionName: selectedCity.value.name,
    };
    // area 只有在筛选弹窗选了地区时才传
    if (pageState.search.area) {
        query.area = pageState.search.area;
    }
    navTo('/pages/search/search', { query });
};

// 处理附近工作点击
const handleNearbyClick = (options  ) => {
    // #ifdef MP-WEIXIN
    if (checkLogin()) {
        navTo('/packageA/pages/nearby/nearby');
    }
    // #endif
    // #ifdef H5
    const token = options.token || uni.getStorageSync('zkr-token');
    if (token) {
        navTo('/packageA/pages/nearby/nearby');
    }
    // #endif
};
const handleNoticeClick = () =>{
	uni.navigateTo({
		url:'/packageB/notice/index'
	})
}
function handleInstitutionClick(type){
	if(type=='evaluate'){
		uni.navigateTo({
			url:'/packageB/institution/evaluationAgency'
		})
	}else if (type=='training'){
		uni.navigateTo({
			url:'/packageB/institution/trainingInstitution'
		})
	}
	
}
// 处理服务功能点击
const handleServiceClick = (serviceType) => {
    if (checkLogin()) {
        navToService(serviceType);
    }
};
// H5的简历指导跳转
const handelGoResumeGuide = () => {
    const token = uni.getStorageSync('zkr-token');
    // myToken.value = token;
    if (token) {
        // navTo()
        navTo('/pages/resume-guide/resume-guide');
    }
    
}
// 处理直播按钮点击
const handleLiveClick = () => {
    // #ifdef MP-WEIXIN
    const feedId = "sphKH1AEeLfTJJE";
    
    // 使用微信原生 API 打开视频号主页
    if (typeof wx !== "undefined" && wx.openChannelsUserProfile) {
        wx.openChannelsUserProfile({
            finderUserName: feedId,
            success: (res) => {
                console.log("打开视频号成功", res);
            },
            fail: (err) => {
                console.error("打开视频号失败", err);
                $api.msg(err.errMsg || "无法打开直播，请稍后重试");
            },
        });
    } else {
        // 如果 API 不存在，提示用户更新微信版本
        $api.msg("请更新微信版本以使用该功能");
    }
    // #endif
    
    // #ifndef MP-WEIXIN
    // 非微信小程序环境提示
    $api.msg("该功能仅在微信小程序中可用");
    // #endif
};

// 处理薪酬信息点击
const handleSalaryInfoClick = () => {
    navTo('/pages/service/salary-info');
};

const handleH5SalaryClick = () => {
    const salaryUrl = "https://www.mohrss.gov.cn/SYrlzyhshbzb/laodongguanxi_/fwyd/202506/t20250627_544623.html";
    window.location.assign(salaryUrl);
};

async function loadData() {
    try {
        if (isLoaded.value) return;
        isLoaded.value = true;
    } catch (err) {
        isLoaded.value = false; // 重置状态允许重试
        throw err;
    }
}
const pageNull = ref(0);
function scrollBottom() {
    if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
        loadmoreRef.value.change('loading');
    }
    if (state.tabIndex === 'all') {
		pageNull.value++;
        getJobRecommend();
    } else {
        getJobList();
    }
}

function findJob(job) {
    if (job.isBut) {
        $api.msg('已确认');
    } else {
        list.value = list.value.map((item) => {
            if (item.recommend && item.jobCategory === job.jobCategory) {
                return {
                    ...item,
                    isBut: true,
                };
            }
            return item;
        });
        const jobstr = job.jobCategory;
        const jobsObj = {
            地区: 'area',
            岗位: 'jobTitle',
            经验: 'experience',
        };
        const [name, value] = jobstr.split(':');
        const nameAttr = jobsObj[name];
        if (name === '岗位') {
            conditionSearch.value[nameAttr] = value;
        } else {
            const valueAttr = oneDictData(nameAttr).filter((item) => item.label === value);
            if (valueAttr.length) {
                const val = valueAttr[0].value;
                conditionSearch.value[nameAttr] = val;
            }
        }
    }
}

function clearfindJob(job) {
    if (job.isBut) {
        $api.msg('已确认');
    } else {
        list.value = list.value.map((item) => {
            if (item.recommend && item.jobCategory === job.jobCategory) {
                return {
                    ...item,
                    isBut: true,
                };
            }
            return item;
        });
        recommedIndexDb.deleteRecords(job);
    }
}

function nextDetail(job) {
    navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
}

function navToService(serviceType) {
    // 根据服务类型跳转到不同页面
    const serviceRoutes = {
        'service-guidance': '/pages/service/guidance',
        'public-recruitment': '/pages/service/public-recruitment', 
        'resume-creation': '/pages/resume-guide/resume-guide',
        'labor-policy': '/packageRc/pages/policy/policyList',
        'skill-training': '/packageB/train/video/videoList',
        'skill-evaluation': '/packageB/train/index',
        // 'skill-evaluation': '/pages/service/skill-evaluation',
        'question-bank': '/pages/service/question-bank',
        // 'quality-assessment': '/packageCa/search/search',
        // 'ai-interview': '/packageA/pages/chat/chat',
        'job-search': '/pages/search/search',
        'career-planning': '/pages/service/career-planning',
        'salary-query': '/pages/service/salary-query',
        'company-info': '/pages/service/company-info',
        'interview-tips': '/pages/service/interview-tips',
        'employment-news': '/pages/service/employment-news',
        'more-services': '/pages/service/more-services',
    };
    if((serviceType=='skill-training'||serviceType=='skill-evaluation')&&!uni.getStorageSync('userInfo').idCard){
        $api.msg('请先完善信息');
		return
	}
    const route = serviceRoutes[serviceType];
    if (route) {
        navTo(route);
    } else {
        $api.msg('功能开发中，敬请期待');
    }
}

function openFilter() {
    isInteractingWithFilter.value = true;
    showNewFilter.value = true;
    emits('onShowTabbar', false);
}

function clearFilters() {
    // 清除筛选弹窗条件，保留 order
    pageState.search = { order: pageState.search.order };
    // 清除城市选择
    selectedCity.value = { code: '', name: '' };
    conditionSearch.value = {};
    // 刷新列表
    getJobRecommend('refresh');
}

function handleNewFilterConfirm(values) {
    pageState.search = {
        ...pageState.search,
    };
    for (const [key, value] of Object.entries(values)) {
        // 特殊处理岗位类型，直接传递数字值
        if (key === 'jobType') {
            pageState.search.type = value;
        } else if (key === 'area') {
            // 地区多选，转为逗号分隔字符串；未选择时设为空字符串
            if (Array.isArray(value) && value.length > 0) {
                pageState.search[key] = value.join(',');
            } else {
                pageState.search[key] = '';
            }
        } else if (value) {
            pageState.search[key] = value;
        } else {
            // 如果值为空，删除该搜索条件
            delete pageState.search[key];
        }
    }
    showNewFilter.value = false;
    getJobList('refresh');
    // 短暂延迟后解除交互锁，避免数据刷新导致顶部区域回弹
    setTimeout(() => { isInteractingWithFilter.value = false; }, 400);
    emits('onShowTabbar', true);
}

// 监听页面加载，接收筛选参数
onLoad((options) => {
    // #ifdef H5
        const token = uni.getStorageSync('zkr-token');
        if (token) {
            useUserStore().loginSetToken(token);
        }
    // #endif
    
    // 接收从筛选页面传递过来的参数
    if (options.filterParams) {
        try {
            const filterParams = JSON.parse(options.filterParams);
            console.log('filterParams:', filterParams);
            for (const [key, value] of Object.entries(filterParams)) {
                if (key === 'jobType') {
                    pageState.search.type = value;
                } else if (value) {
                    pageState.search[key] = value;
                }
            }
            console.log('pageState.search:', pageState.search);
            getJobList('refresh');
        } catch (error) {
            console.error('解析筛选参数失败:', error);
        }
    }
});

function handleNewFilterClose() {
    showNewFilter.value = false;
    emits('onShowTabbar', true);
    setTimeout(() => { isInteractingWithFilter.value = false; }, 200);
}

function handleFilterConfirm(e) {
    // 处理筛选确认
}

function choosePosition(index) {
    isInteractingWithFilter.value = true;
    state.tabIndex = index;
    list.value = [];
    if (index === 'all') {
        pageState.search = {
            order: pageState.search.order,
        };
        inputText.value = '';
        getJobRecommend('refresh');
    } else {
        // const id = useUserStore().userInfo.jobTitleId.split(',')[index];
        pageState.search.jobTitle = userInfo.value.jobTitle[index];
        inputText.value = '';
        getJobList('refresh');
    }
    nextTick(() => { setTimeout(() => { isInteractingWithFilter.value = false; }, 300); });
}
const isShowJw = ref(0);
function handelHostestSearch(val) {
    isInteractingWithFilter.value = true;
    isShowJw.value = val.value;
    pageState.search.order = val.value;
    pageState.search.jobType = val.value === 3 ? 1 : 0;
    if(val.value === 4) {
        pageState.search.type = 4;
    } else {
        delete pageState.search.type;
    }
    
    if (state.tabIndex === 'all') {
        getJobRecommend('refresh');
    } else {
        getJobList('refresh');
    }
    nextTick(() => { setTimeout(() => { isInteractingWithFilter.value = false; }, 300); });
}

function getJobRecommend(type = 'add') {
    if (type === 'refresh') {
        list.value = [];
        if (waterfallsFlowRef.value) waterfallsFlowRef.value.refresh();
    }
    let params = {
        pageSize: pageState.pageSize + 10,
        sessionId: useUserStore().seesionId,
        ...pageState.search,
        ...conditionSearch.value,
        isPublish: 1,
    };
    // 当选中零工市场(4)或疆外(3)时，order参数传递0
    if (pageState.search.order === 3 || pageState.search.order === 4) {
        params.order = 0;
    }
    // 优先从store获取，如果为空则从缓存获取
    const storeIsCompanyUser = userInfo.value?.isCompanyUser;
    const cachedUserInfo = uni.getStorageSync('userInfo') || {};
    const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
    const userType = storeIsCompanyUser !== undefined ? Number(storeIsCompanyUser) : Number(cachedIsCompanyUser);
    console.log('---------userType-----', userType)
    // 只有企业用户(isCompanyUser=0)才添加current字段
    if (userType === 0) {
        params.current = pageNull.value;
    } else {
        // 求职者只显示已上架的岗位（jobStatus=0）
        params.jobStatus = 0;
    }
    let comd = { recommend: true, jobCategory: '', tip: '确认你的兴趣，为您推荐更多合适的岗位' };
    $api.createRequest('/app/job/recommend', params).then((resData) => {
        console.log('=== /app/job/recommend 解密后的数据 ===', resData);
        console.log('=== 岗位列表 data ===', resData.data);
        const { data, total } = resData;
        pageState.total = 0;
        if (type === 'add') {
            // 记录系统
            recommedIndexDb.getRecord().then((res) => {
                if (res.length) {
                    // 数据分析系统
                    const resultData = recommedIndexDb.analyzer(res);
                    const { sort, result } = resultData;
                    // 岗位询问系统
                    const conditionCounts = Object.fromEntries(
                        sort.filter((item) => item[1] > 1) // 过滤掉次数为 1 的项
                    );
                    jobRecommender.updateConditions(conditionCounts);

                    const question = jobRecommender.getNextQuestion();

                    if (question) {
                        comd.jobCategory = question;
                        data.unshift(comd);
                    }
                }
                const reslist = dataToImg(data);
                list.value.push(...reslist);
            });
        } else {
            const reslist = dataToImg(data);
            list.value = reslist;
        }
        if (data.length > 0) {
            pageNull.value++;
        } else {
            $api.msg('没有更多岗位了');
        }
        // 切换状态
        if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
            if (data.length < pageState.pageSize) {
                loadmoreRef.value.change('noMore');
            } else {
                loadmoreRef.value.change('more');
            }
        }
        // 当没有岗位，刷新sessionId重新啦
        if (!data.length) {
            useUserStore().initSeesionId();
        }
    });
}

function getJobList(type = 'add') {
    if (type === 'add' && pageState.page < pageState.maxPage) {
        pageState.page += 1;
    }
    if (type === 'refresh') {
        list.value = [];
        pageState.page = 1;
        pageState.maxPage = 2;
        // waterfallsFlowRef.value.refresh();
        if (waterfallsFlowRef.value) waterfallsFlowRef.value.refresh();
    }
    
    let params = {
        pageSize: pageState.pageSize,
        ...pageState.search,
        // ...conditionSearch.value,
    };
    // 当选中零工市场(4)或疆外(3)时，order参数传递0
    if (pageState.search.order === 3 || pageState.search.order === 4) {
        params.order = 0;
    }
    
    // 判断用户类型，求职者只显示已上架的岗位（jobStatus=0）
    // 优先从store获取，如果为空则从缓存获取
    const storeIsCompanyUser = userInfo.value?.isCompanyUser;
    const cachedUserInfo = uni.getStorageSync('userInfo') || {};
    const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
    const userType = storeIsCompanyUser !== undefined ? Number(storeIsCompanyUser) : Number(cachedIsCompanyUser);
    
    // 如果不是企业用户（求职者），只显示已上架的岗位
    if (userType !== 0) {
        params.jobStatus = 0;
    }

    $api.createRequest('/app/job/list', params).then((resData) => {
        const { rows, total } = resData;
        if (type === 'add') {
            const str = pageState.pageSize * (pageState.page - 1) + 10;
            const end = list.value.length;
            const reslist = dataToImg(rows);
            list.value.splice(str, end, ...reslist);
        } else {
            list.value = dataToImg(rows);
        }
        pageState.total = resData.total;
        pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
        // 切换状态
        if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
            if (rows.length < pageState.pageSize) {
                loadmoreRef.value?.change('noMore');
            } else {
                loadmoreRef.value?.change('more');
            }
        }
    });
}

// 上架岗位
const jobUp = (jobId) => {
    if (!checkLogin()) return;
    
    uni.showLoading({
        title: '处理中...',
        mask: true
    });
    
    $api.createRequest(`/app/job/jobUp/${jobId}`, {}, 'PUT', true).then((res) => {
        uni.hideLoading();
        $api.msg('上架成功');
        // 刷新数据
        if (state.tabIndex === 'all') {
            getJobRecommend('refresh');
        } else {
            getJobList('refresh');
        }
    }).catch((err) => {
        uni.hideLoading();
        console.error('上架失败:', err);
        $api.msg('上架失败，请重试');
    });
};

// 下架岗位
const jobDown = (jobId) => {
    if (!checkLogin()) return;
    
    uni.showLoading({
        title: '处理中...',
        mask: true
    });
    
    $api.createRequest(`/app/job/jobDown/${jobId}`, {}, 'PUT', true).then((res) => {
        uni.hideLoading();
        $api.msg('下架成功');
        // 刷新数据
        if (state.tabIndex === 'all') {
            getJobRecommend('refresh');
        } else {
            getJobList('refresh');
        }
    }).catch((err) => {
        uni.hideLoading();
        console.error('下架失败:', err);
        $api.msg('下架失败，请重试');
    });
};

// 切换岗位状态（上架/下架）
const toggleJobStatus = (job) => {
    if (!checkLogin()) return;
    
    uni.showLoading({
        title: '处理中...',
        mask: true
    });
    
    // 根据当前状态决定调用哪个接口
    const isCurrentlyUp = Number(job.jobStatus) === 0; // 0: 已上架, 1: 已下架
    const apiUrl = isCurrentlyUp ? `/app/job/jobDown/${job.jobId}` : `/app/job/jobUp/${job.jobId}`;
    
    $api.createRequest(apiUrl, {}, 'PUT', true).then((res) => {
        uni.hideLoading();
        $api.msg(isCurrentlyUp ? '下架成功' : '上架成功');
        
        // 更新本地数据状态，避免立即刷新整个列表
        const jobIndex = list.value.findIndex(item => item.jobId === job.jobId);
        if (jobIndex !== -1) {
            // 更新状态
            list.value[jobIndex].jobStatus = isCurrentlyUp ? 1 : 0;
        }
        
        // 也可以选择刷新数据
        // if (state.tabIndex === 'all') {
        //     getJobRecommend('refresh');
        // } else {
        //     getJobList('refresh');
        // }
    }).catch((err) => {
        uni.hideLoading();
        console.error('操作失败:', err);
        $api.msg(isCurrentlyUp ? '下架失败，请重试' : '上架失败，请重试');
    });
};
const isFourLevelLinkagePurview=ref(false)
const getIsFourLevelLinkagePurview=()=>{
    let userInfo = uni.getStorageSync('userInfo')
    if(userInfo){
        $api.myRequest('/auth/login2/ks',{userid: userInfo.dwUserid, idcardno: userInfo.idCard},"POST",9100,{}).then(res=>{
            if(res.code == 200){
                uni.setStorageSync('fourLevelLinkage-token',res.data.access_token)
                let roleIdList= ['103','106','107']
                if(res.data.roleIdList.some(item=>roleIdList.includes(item))){
                    isFourLevelLinkagePurview.value=true
                }
            }
        })
    }
}
function dataToImg(data) {
    const result = data.map((item) => ({
        ...item,
        image: img,
        hide: true,
    }));
    return result;
}

// import { loginRc } from '@/apiRc/login/login.js';
import storeRc from '@/utilsRc/store/index.js';
// 跳转到高校毕业页面
function goRc(){
    if (checkLogin()) {
        let userInfo = uni.getStorageSync('userInfo')
        if(userInfo.isCompanyUser == 2){
            storeRc.dispatch('LoginByID', userInfo.dwUserid || 2025111679160750).then(res => {
            // storeRc.dispatch('LoginByID', 2025111679160750).then(res => {
                storeRc.dispatch('GetInfo').then(res => {
                    navTo('/packageRc/pages/daiban/daiban');
                });
            });
//             test0001  202511491561998
// test0002  202511381669113
// test0003  2025111679160750
        }else if(userInfo.isCompanyUser == 1){
            storeRc.dispatch('LoginByUserInfo', userInfo).then(res => {
                navTo('/packageRc/pages/index/index');
            })
        }else{
            showToast('企业账号无法查看此模块～');
        }
        // storeRc.dispatch('LoginByID', userInfo.userId).then(res => {
    }
}
// 跳转到素质测评
function goCa(){
    if (checkLogin()) {
        let userInfo = uni.getStorageSync('userInfo')
        storeRc.dispatch('LoginByUserInfo', userInfo).then(res => {
            navTo(`/packageCa/search/search?name=${userInfo.name}&userId=${userInfo.idCard}`);
        });
    }
}
// 跳转到AI面试
function goCaAI(){
    if (checkLogin()) {
        let userInfo = uni.getStorageSync('userInfo')
        storeRc.dispatch('LoginByUserInfo', userInfo).then(res => {
            navTo(`/packageCa/search/AIAudition?name=${userInfo.name}&userId=${userInfo.idCard}`);
        });
    }
}


defineExpose({ loadData });
</script>

<style lang="stylus" scoped>
// .maskFristEntry
//     position: fixed;
//     // right: 20rpx;
//     // bottom: calc(50% - 200rpx);
//     height: 100vh
//     width: 100vw
//     background: rgba(0,0,0,0.3)
//     .entry-content
//         display: flex;
//         align-items: center
//         position: absolute
//         left: 50%
//         top: 40%
//         transform: translate(-50%, -50%)
//         flex-direction: column
//         background: url('@/static/imgs/fristEntry.png') 0 0 no-repeat;
//         background-size: 100% 100%;
//         width: 480rpx
//         height: 584rpx
//         // padding-left: 80rpx
//         .text1
//             margin-top: 370rpx
//             font-size: 36rpx
//             background: linear-gradient(273.34deg, #356CFA 3.58%, #A47FFD 85.84%);
//             -webkit-background-clip: text;
//             -webkit-text-fill-color: transparent;
//             background-clip: text; /* 有些浏览器兼容用 */
//             text-fill-color: transparent;
//             padding-left: 28rpx
//         .text2
//             padding-left: 28rpx
//             margin-top: 8rpx
//             font-size: 20rpx;
//             color: #666666;
//             text-align: center;
//         .indicateArrow
//             height: 76rpx
//             width: 68rpx
//         .indicatefristEntry
//             width: 244rpx
//             height: 244rpx
//         .goExperience
//             margin-left: 28rpx
//             margin-top: 28rpx
//             width: 160rpx;
//             height: 60rpx;
//             background: linear-gradient( 180deg, #9974FD 0%, #286BFA 100%);
//             border-radius: 12rpx 12rpx 12rpx 12rpx;
//             font-size: 28rpx;
//             color: #FFFFFF;
//             text-align: center;
//             line-height: 60rpx
//         .maskFristEntry-Close
//             position: absolute;
//             left: calc(50% - 10rpx);
//             bottom: -130rpx
//             width: 42rpx
//             height: 42rpx
//             background: linear-gradient(273.34deg, #356CFA 3.58%, #A47FFD 85.84%);
//             border-radius: 50%;
//         .maskFristEntry-Close::before
//             position: absolute;
//             left: calc( 50% - 2rpx)
//             top: calc( 50% - 10rpx)
//             transform: rotate(45deg);
//             content: ''
//             background: #FFFFFF
//             width: 4rpx
//             height: 20rpx
//         .maskFristEntry-Close::after
//             position: absolute;
//             left: calc( 50% - 2rpx)
//             top: calc( 50% - 10rpx)
//             transform: rotate(-45deg);
//             content: ''
//             background: #FFFFFF
//             width: 4rpx
//             height: 20rpx


.app-container
    width: 100%;
    height: 100vh;
    /* #ifdef H5 */
    height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
    background: url('@/static/icon/background2.png') 0 0 no-repeat;
    background-size: 100% 728rpx;
    /* #endif */
    /* #ifdef MP-WEIXIN */
    /* 小程序不支持CSS中的本地图片，使用image标签替代 */
    position: relative;
    /* #endif */
    background-color: #FFFFFF;
    display: flex;
    flex-direction: column;
    overflow: hidden;

/* #ifdef MP-WEIXIN */
.mp-background
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 728rpx;
    z-index: 0;
/* #endif */
.hidden-animation
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    will-change: transform, opacity;

.hidden-height
    opacity: 0 !important;
    transform: translateY(-100%) !important;
    pointer-events: none !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;

.container-search
    padding: 16rpx 24rpx
    display: flex
    justify-content: space-between
    align-items: center
    .search-input
        display: flex
        align-items: center;
        flex: 1
        height: 80rpx;
        line-height: 80rpx
        margin-right: 16rpx
        background: #FFFFFF;
        border-radius: 75rpx 75rpx 75rpx 75rpx;
        .iconsearch
            padding-left: 36rpx
        .inpute
            margin-left: 30rpx
            font-weight: 400;
            font-size: 63rpx;
            color: #B5B5B5;
            width: 100%
    .live-button
        display: flex
        align-items: center
        justify-content: center
        width: 90rpx
        height: 42rpx
        background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%)
        border-radius: 40rpx
        box-shadow: 0 3rpx 8rpx rgba(255, 107, 107, 0.2)
        transition: all 0.2s ease
        flex-shrink: 0
        
        &:active
            transform: scale(0.96)
            box-shadow: 0 2rpx 6rpx rgba(255, 107, 107, 0.25)
        
        .live-icon
            margin-right: 8rpx
            display: flex
            align-items: center
            justify-content: center
            
        .live-text
            font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
            font-weight: 500
            font-size: 36rpx
            color: #FFFFFF
            text-align: center
            white-space: nowrap
    .chart
        font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
        width: 170rpx;
        background: radial-gradient( 0% 56% at 87% 61%, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0.47) 100%);
        box-shadow: 0rpx 8rpx 40rpx 0rpx rgba(210,210,210,0.14);
        border-radius: 80rpx 80rpx 80rpx 80rpx;
        border: 2rpx solid #FFFFFF;
        text-align: center
        font-weight: 500;
        font-size: 42rpx;
        height: 54rpx;
        color: #000000;
        padding: 20rpx 30rpx
.cards
    padding: 10rpx 28rpx
    display: grid
    grid-gap: 38rpx;
    grid-template-columns: 1fr;
    .card
        padding: 22rpx 26rpx
        box-shadow: 0rpx 8rpx 40rpx 0rpx rgba(210,210,210,0.14);
        border-radius: 16rpx 16rpx 16rpx 16rpx;
        border: 2rpx solid #FFFFFF;
        .card-title
            font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
            font-weight: 600;
            font-size: 96rpx;
            color: #000000;
        .card-text
            font-weight: 400;
            font-size: 48rpx;
            color: #9E9E9E;
            margin-top: 4rpx
    .card:first-child
        background: radial-gradient( 0% 56% at 87% 61%, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0.47) 100%),
            url('@/static/icon/fujin.png');
        background-size: 100%, 100%
    .card:last-child
        background: radial-gradient( 0% 56% at 87% 61%, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0.47) 100%),
            url('@/static/icon/jinxuan.png');
        background-size: 100%, 100%
        background-size: cover;
        background-position: center;

// H5端专用按钮样式
.h5-action-buttons
    padding: 16rpx 28rpx
    display: flex
    gap: 16rpx
    .h5-action-btn
        flex: 1
        height: 90rpx
        background:#FFFFFF
        border-radius: 8rpx
        display: flex
        align-items: center
        justify-content: center
        transition: opacity 0.2s ease
        box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(37, 107, 250, 0.3)
        &:active
            opacity: 0.8
        
        .btn-text
            font-family: 'PingFangSC-Regular', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
            font-weight: 400
            font-size: 66rpx
            color: #256BFA
// 服务功能网格样式
.service-grid
    padding: 10rpx 28rpx
    display: grid
    grid-template-columns: 1fr 1fr 1fr 1fr
    grid-gap: 10rpx
    .service-item
        display: flex
        flex-direction: column
        align-items: center
        justify-content: center
        height: 120rpx
        background: transparent
        padding: 2rpx 0px
        .service-icon
            width: 62rpx
            height: 62rpx
            border-radius: 10rpx
            margin-bottom: 14rpx
            flex-shrink: 0
        .service-icon-1
            background: linear-gradient(180deg, #FF8E8E 0%, #E53E3E 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-2
            background: linear-gradient(180deg, #6ED5CE 0%, #38B2AC 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-3
            background: linear-gradient(180deg, #6BC5D8 0%, #3182CE 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-4
            background: linear-gradient(180deg, #FFB74D 0%, #ED8936 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-5
            background: linear-gradient(180deg, #F06292 0%, #C2185B 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-6
            background: linear-gradient(180deg, #FFB74D 0%, #ED8936 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-7
            background: linear-gradient(180deg, #6BC5D8 0%, #3182CE 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-8
            background: linear-gradient(180deg, #81C784 0%, #4CAF50 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-9
            background: linear-gradient(180deg, #6BC5D8 0%, #3182CE 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-10
            background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-11
            background-color: #72A4FC
            position: relative
            display: flex
            align-items: center
            justify-content: center
            .service-icon-img
                width: 42rpx
                height: 42rpx
                position: relative
                z-index: 1
                filter: brightness(1.8) contrast(1.4)
        .service-icon-12
            background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%)
            position: relative
            display: flex
            align-items: center
            justify-content: center
        .service-icon-13
            background: linear-gradient(135deg, #607D8B 0%, #90A4AE 100%)
            position: relative
            &::before
                content: '🏢'
                position: absolute
                top: 50%
                left: 50%
                transform: translate(-50%, -50%)
                font-size: 32rpx
        .service-icon-14
            background: linear-gradient(135deg, #E91E63 0%, #F06292 100%)
            position: relative
            &::before
                content: '💡'
                position: absolute
                top: 50%
                left: 50%
                transform: translate(-50%, -50%)
                font-size: 32rpx
        .service-icon-15
            background: linear-gradient(135deg, #795548 0%, #A1887F 100%)
            position: relative
            &::before
                content: '📰'
                position: absolute
                top: 50%
                left: 50%
                transform: translate(-50%, -50%)
                font-size: 32rpx
        .service-icon-16
            background: linear-gradient(135deg, #424242 0%, #757575 100%)
            position: relative
            &::before
                content: '⚙️'
                position: absolute
                top: 50%
                left: 50%
                transform: translate(-50%, -50%)
                font-size: 32rpx
        .service-title
            font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
            font-weight: 500
            font-size: 36rpx
            color: #333333
            text-align: center
            line-height: 1.2
            white-space: nowrap
            overflow: hidden
            text-overflow: ellipsis
            width: 100%
            max-width: 100%
        .service-title-special
            overflow: none;

// 吸顶筛选区域占位
.filter-placeholder
    height: 140rpx; // 根据筛选区域的实际高度调整（包含padding）
    width: 100%;
    /* #ifdef H5 */
    height: 0; // H5使用sticky，不需要占位
    /* #endif */
    /* #ifdef MP-WEIXIN */
    height: 140rpx; // 小程序需要占位
    /* #endif */

.nav-filter
    padding: 16rpx 28rpx
    box-sizing: border-box;
    font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    background: #FFFFFF;
    z-index: 10;
    
    &.sticky-filter
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
        z-index: 100;
        will-change: transform;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        /* #ifdef H5 */
        position: sticky;
        top: 0;
        z-index: 100;
        /* #endif */
        /* #ifdef MP-WEIXIN */
        position: fixed;
        top: 0;
        padding: 16rpx 28rpx;
        padding-top: calc(16rpx + env(safe-area-inset-top));
        padding-left: calc(28rpx + env(safe-area-inset-left));
        padding-right: calc(28rpx + env(safe-area-inset-right));
        /* #endif */
    .filter-top
        display: flex
        justify-content: space-between;
        .tab-scroll
            flex: 1;
            overflow: hidden;
            margin-right: 20rpx;
            /* #ifdef MP-WEIXIN */
            margin-right: 0;
            /* #endif */
            white-space: nowrap;
            overflow: hidden;
            text-overflow: clip;
            -webkit-mask-image: linear-gradient(to right, black 60%, transparent);
            mask-image: linear-gradient(to right, black 60%, transparent);
            .jobs-left
                display: flex
                flex-wrap: nowrap
                .job
                    font-weight: 400;
                    font-size: 66rpx;
                    color: #666D7F;
                    margin-right: 32rpx;
                    white-space: nowrap
                .active
                    font-weight: 500;
                    font-size: 66rpx;
                    color: #000000;
        .jobs-add
            font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            display: flex
            align-items: center;
            justify-content: center;
            font-weight: 400;
            font-size: 66rpx;
            color: #666D7F;
            line-height: 57rpx;
            min-width: 80rpx;
            padding: 8rpx 12rpx;
            white-space: nowrap;
            .right-sx
                width: 28rpx;
                height: 28rpx;
    .filter-bottom
        display: flex
        justify-content: space-between
        padding: 24rpx 0
        .btm-left
            display: flex
            font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            .filterbtm
                font-weight: 400;
                font-size: 66rpx;
                color: #666D7F;
                margin-right: 8rpx
                padding: 0rpx 6rpx
            .active
                font-weight: 500;
                font-size: 66rpx;
                color: #256BFA;
        .btm-right-group
            display: flex
            align-items: center
        .btm-right
            font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            font-weight: 400;
            font-size: 66rpx;
            color: #6C7282;
            .right-sx
                width: 32rpx;
                height: 32rpx;
            .active
                transform: rotate(180deg)
        .btm-clear
            display: flex
            align-items: center
            gap: 4rpx
            padding: 10rpx 16rpx
            margin-left: 12rpx
            background: #EBF0FF
            border: 1rpx solid #B3C6FF
            border-radius: 10rpx
            font-size: 36rpx
            color: #256BFA
            white-space: nowrap
.table-list
    background: #F4F4F4
    flex: 1
    overflow: hidden
    // 确保flex容器正确计算高度
    position: relative;
    .falls-scroll
        width: 100%
        height: 100%
        // 确保滚动容器可以正常滚动
        -webkit-overflow-scrolling: touch;
        // 解决H5端嵌套环境滑动问题
        touch-action: pan-y;
        /* #ifdef H5 */
        // 修复H5端在一体机嵌套环境中的滚动问题
        overflow-y: auto;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        /* #endif */
        .falls
            padding: 28rpx 28rpx;
            .item
                position: relative;
                // background: linear-gradient( 180deg, rgba(19, 197, 124, 0.4) 0%, rgba(255, 255, 255, 0) 30%), rgba(255, 255, 255, 0);
                .falls-card
                    padding: 30rpx;
                    .falls-card-title
                        font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
                        color: #606060;
                        text-align: left;
                        word-break:break-all
                        font-weight: 500;
                        font-size: 57rpx;
                        color: #333333;
                        margin-top: 10rpx
                    .falls-card-pay
                        // height: 50rpx;
                        word-break:break-all
                        color: #002979;
                        text-align: left;
                        display: flex;
                        align-items: end;
                        position: relative
                        .pay-text
                            font-family: DIN-Medium;
                            color: #4C6EFB;
                            padding-right: 10rpx
                            font-weight: 500;
                            font-size: 66rpx;
                            color: #4C6EFB;
                            line-height: 67.5rpx;
                            text-align: left;
                        .flame
                            position: absolute
                            bottom: 0
                            right: -10rpx
                            transform: translate(0, -30%)
                            width: 24rpx
                            height: 31rpx
                    .falls-card-education,.falls-card-experience
                        width: fit-content;
                        height: 45rpx;
                        background: #F4F4F4;
                        border-radius: 4rpx;
                        padding: 12rpx 20rpx;
                        line-height: 45rpx;
                        font-weight: 400;
                        font-size: 48rpx;
                        color: #6C7282;
                        text-align: center;
                        margin-top: 20rpx;
                        white-space: nowrap

                    .falls-card-company,.falls-card-pepleNumber
                        margin-top: 20rpx;
                        font-size: 48rpx;
                        color: #999999;
                        line-height: 37.5rpx;
                        text-align: left;
                    .falls-card-pepleNumber
                        display: flex;
                        justify-content: space-between;
                        flex-wrap: wrap
                        margin-top: 10rpx;
                        font-weight: 400;
                        font-size: 48rpx;
                        color: #999999;
                        line-height: 69rpx
                        view
                            display:flex
                            align-items: center
                            white-space: nowrap;
                            .point2
                                margin: 0rpx 6rpx 0 2rpx
                                height: 22rpx
                                width: 22rpx
                            .point3
                                margin: 0rpx 4rpx 0 0
                                height: 28rpx
                                width: 28rpx
                    .falls-card-matchingrate
                        margin-top: 10rpx;
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
                        font-size: 48rpx;
                        color: #4778EC;
                        text-align: left;
                    .falls-card-company2
                        margin-top: 4rpx;
                        font-size: 48rpx;
                        color: #999999;
                        text-align: left;
                        display: flex
                        .point3
                            margin: 16rpx 4rpx 0 0
                            height: 26rpx
                            width: 26rpx
// 推荐卡片
.recommend-card::before
    position: absolute
    left: 0
    top: 0
    content: ''
    height: 60rpx
    width: 100%
    height: 8rpx;
    background: linear-gradient( to left, #9E74FD 0%, #256BFA 100%);
    box-shadow: 0rpx 8rpx 40rpx 0rpx rgba(0,54,170,0.15);
.recommend-card::after
    content ''
    position absolute
    z-index 0
    left 50%
    top 40%
    transform: translate(-50%, -50%)
    width 250rpx
    height 250rpx
    background url('@/static/icon/backAI.png') no-repeat center center
    opacity 0.6
    background-size contain
    pointer-events none
    filter: blur(3rpx)
// 企业用户内容样式
.company-content
    padding: 40rpx 30rpx
    background: #ffffff
    margin: 20rpx 30rpx
    border-radius: 20rpx
    box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(0, 0, 0, 0.1)
    
    .company-header
        text-align: center
        margin-bottom: 40rpx
        
        .company-title
            font-size: 54rpx
            font-weight: bold
            color: #333333
            display: block
            margin-bottom: 10rpx
            
        .company-subtitle
            font-size: 36rpx
            color: #666666
            display: block
    
    .company-grid
        display: grid
        grid-template-columns: 1fr 1fr
        gap: 30rpx
        
        .company-item
            display: flex
            flex-direction: column
            align-items: center
            padding: 30rpx 20rpx
            background: #f8f9fa
            border-radius: 15rpx
            transition: all 0.3s ease
            
            &:active
                transform: scale(0.95)
                background: #e9ecef
                
            .company-icon
                width: 60rpx
                height: 60rpx
                border-radius: 50%
                display: flex
                align-items: center
                justify-content: center
                margin-bottom: 15rpx
                
                &.company-icon-1
                    background: #256BFA
                &.company-icon-2
                    background: #52c41a
                &.company-icon-3
                    background: #fa8c16
                &.company-icon-4
                    background: #eb2f96
                    
            .company-title
                font-size: 36rpx
                color: #333333
                font-weight: 500

.recommend-card
    padding 36rpx 24rpx
    background: linear-gradient( 360deg, #DFE9FF 0%, #FFFFFF 52%, #FFFFFF 100%);
    border-radius: 20rpx 20rpx 20rpx 20rpx;
    position relative
    box-shadow 0rpx 4rpx 8rpx 0rpx rgba(72, 89, 123, 0.3)
    .card-content
        position: relative;
        z-index: 2;
        .recommend-card-title
            font-weight: 500;
            font-size: 42rpx;
            color: #333333;
        .recommend-card-tip
            font-weight: 400;
            font-size: 42rpx;
            color: #6C7282;
            margin-top: 28rpx
        .recommend-card-line
            width: calc(100%);
            height: 0rpx;
            border-radius: 0rpx 0rpx 0rpx 0rpx;
            border: 2rpx dashed rgba(0,0,0,0.14);
            margin-top: 50rpx
            position: relative
        // .recommend-card-line::before
        //     position: absolute
        //     content: ''
        //     left: 0
        //     top: 0
        //     transform: translate(-50% - 90rpx, -50%)
        //     width: 28rpx;
        //     height: 28rpx;
        //     background: #F4F4F4;
        //     border-radius: 50%;
        // .recommend-card-line::after
        //     position: absolute
        //     content: ''
        //     right: 0
        //     top: 0
        //     transform: translate(50% + 90rpx, -50%)
        //     width: 28rpx;
        //     height: 28rpx;
        //     background: #F4F4F4;
        //     border-radius: 50%;
        .recommend-card-controll
            display: flex
            align-items: center
            justify-content: space-between
            margin-top: 40rpx
            padding: 0 6rpx;
            .controll-yes
                width: 124rpx;
                height: 60rpx;
                background: rgba(37,107,250,0.1);
                border-radius: 12rpx 12rpx 12rpx 12rpx;
                text-align: center;
                line-height: 60rpx
                color: #256BFA
                font-weight: 400;
                font-size: 42rpx;
            .controll-no
                width: 124rpx;
                height: 56rpx;
                line-height: 56rpx
                border-radius: 12rpx 12rpx 12rpx 12rpx;
                border: 2rpx solid #DEDEDE;
                font-weight: 400;
                font-size: 42rpx;
                color: #333333;
                text-align: center;
            .controll-yes:active, .controll-no:active
                width: 120rpx;
                height: 66rpx;
                line-height: 66rpx
                background: #e8e8e8
                border: 2rpx solid #e8e8e8
.isBut{
    filter: grayscale(100%);
}

// 企业账号显示卡片样式
.enterprise-card
    margin: 20rpx 28rpx
    padding: 28rpx
    background: rgba(255, 255, 255, 0.9)
    backdrop-filter: blur(20rpx)
    -webkit-backdrop-filter: blur(20rpx)
    border-radius: 24rpx
    border: 1rpx solid rgba(255, 255, 255, 0.4)
    box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.08), 0 2rpx 8rpx rgba(0, 0, 0, 0.04)
    position: relative
    overflow: hidden
    cursor: pointer
    transition: all 0.3s ease
    
    &:active
        transform: scale(0.98)
        box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.12), 0 1rpx 4rpx rgba(0, 0, 0, 0.08)
    
    // 玻璃态效果 - 更强烈的渐变
    &::before
        content: ''
        position: absolute
        top: 0
        left: 0
        right: 0
        bottom: 0
        background: linear-gradient(135deg, 
            rgba(255, 255, 255, 0.2) 0%, 
            rgba(255, 255, 255, 0.1) 50%, 
            rgba(255, 255, 255, 0.05) 100%)
        border-radius: 24rpx
        pointer-events: none
        z-index: 0
    
    // 添加微妙的边框高光
    &::after
        content: ''
        position: absolute
        top: 0
        left: 0
        right: 0
        bottom: 0
        border-radius: 24rpx
        padding: 1rpx
        background: linear-gradient(135deg, 
            rgba(255, 255, 255, 0.6) 0%, 
            rgba(255, 255, 255, 0.2) 100%)
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)
        mask-composite: xor
        -webkit-mask-composite: xor
        pointer-events: none
        z-index: 1
    
    .card-content
        display: flex
        align-items: center
        position: relative
        z-index: 2
        
        .company-icon
            width: 88rpx
            height: 88rpx
            border-radius: 18rpx
            background: linear-gradient(135deg, #256BFA 0%, #4A90E2 100%)
            display: flex
            align-items: center
            justify-content: center
            margin-right: 28rpx
            flex-shrink: 0
            box-shadow: 0 6rpx 16rpx rgba(37, 107, 250, 0.25)
            position: relative
            
            // 添加图标内部高光
            &::before
                content: ''
                position: absolute
                top: 4rpx
                left: 4rpx
                right: 4rpx
                height: 20rpx
                background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%)
                border-radius: 18rpx 18rpx 0 0
                pointer-events: none
            
            .default-logo
                display: flex
                align-items: center
                justify-content: center
                color: #ffffff
                
        .company-info
            flex: 1
            min-width: 0
            z-index: 2
            position: relative
            
            .company-name
                font-size: 51rpx
                font-weight: 600
                color: #000000
                line-height: 1.3
                margin-bottom: 10rpx
                overflow: hidden
                text-overflow: ellipsis
                white-space: nowrap
                font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
                
            .company-details
                display: flex
                align-items: center
                font-size: 39rpx
                color: #666666
                line-height: 1.2
                
                .industry
                    color: #666666
                    font-weight: 400
                    
                .separator
                    margin: 0 10rpx
                    color: #CCCCCC
                    font-weight: 300
                    
            .size
                color: #666666
                font-weight: 400
        
        // 企业用户直播按钮样式
        .company-live-button
            display: flex
            align-items: center
            justify-content: center
            width: 100rpx
            height: 48rpx
            background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%)
            border-radius: 40rpx
            box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.3)
            transition: all 0.2s ease
            flex-shrink: 0
            margin-left: 20rpx
            
            &:active
                transform: scale(0.95)
                box-shadow: 0 2rpx 8rpx rgba(255, 107, 107, 0.4)
            
            .live-icon
                margin-right: 6rpx
                display: flex
                align-items: center
                justify-content: center
                
            .live-text
                font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
                font-weight: 500
                font-size: 36rpx
                color: #FFFFFF
                text-align: center
                white-space: nowrap

// 上下架开关样式
.falls-card-actions
    margin-top: 20rpx
    .job-status-switch
        display: flex
        align-items: center
        justify-content: space-between
        padding: 8rpx 0
        .switch-track
            width: 80rpx
            height: 40rpx
            background: #e0e0e0
            border-radius: 20rpx
            position: relative
            transition: all 0.3s ease
            cursor: pointer
            &.active
                background: #52c41a
            .switch-thumb
                position: absolute
                top: 4rpx
                left: 4rpx
                width: 32rpx
                height: 32rpx
                background: #ffffff
                border-radius: 50%
                box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2)
                transition: all 0.3s ease
                &.active
                    left: 44rpx
        .switch-label
            font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
            font-weight: 500
            font-size: 24rpx
            color: #666666
            margin-left: 16rpx
            min-width: 80rpx
            text-align: center

// 下架后卡片置灰样式
.disabled-card
    opacity: 0.6
    filter: grayscale(50%)
    background: #f8f8f8 !important
    .falls-card-title,
    .falls-card-company,
    .falls-card-pepleNumber,
    .falls-card-company2
        color: #999999 !important
</style>
