Compare commits
5 Commits
8d44d5b351
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
446882b5a1 | ||
|
|
847704f6ff | ||
|
|
980cad4e54 | ||
|
|
45aa4e7351 | ||
|
|
4c8f79555d |
@@ -26,6 +26,24 @@
|
||||
<view class="filter-right">
|
||||
<!-- 内容区域 -->
|
||||
<view class="filter-content">
|
||||
<!-- 薪资 -->
|
||||
<view v-if="activeTab === 'salary'" class="content-section">
|
||||
<radio-group @change="(e) => handleSelect('salary', e)">
|
||||
<label
|
||||
v-for="option in salaryOptions"
|
||||
:key="option.value"
|
||||
class="radio-item"
|
||||
:class="{ checked: selectedValues['salary'] === String(option.value) }"
|
||||
>
|
||||
<radio
|
||||
:value="String(option.value)"
|
||||
:checked="selectedValues['salary'] === String(option.value)"
|
||||
/>
|
||||
<text class="option-label">{{ option.label }}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 学历要求 -->
|
||||
<view v-if="activeTab === 'education'" class="content-section">
|
||||
<radio-group @change="(e) => handleSelect('education', e)">
|
||||
@@ -62,24 +80,6 @@
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 薪资 -->
|
||||
<view v-if="activeTab === 'salary'" class="content-section">
|
||||
<radio-group @change="(e) => handleSelect('salary', e)">
|
||||
<label
|
||||
v-for="option in salaryOptions"
|
||||
:key="option.value"
|
||||
class="radio-item"
|
||||
:class="{ checked: selectedValues['salary'] === String(option.value) }"
|
||||
>
|
||||
<radio
|
||||
:value="String(option.value)"
|
||||
:checked="selectedValues['salary'] === String(option.value)"
|
||||
/>
|
||||
<text class="option-label">{{ option.label }}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 公司规模 -->
|
||||
<view v-if="activeTab === 'scale'" class="content-section">
|
||||
<radio-group @change="(e) => handleSelect('scale', e)">
|
||||
@@ -169,16 +169,16 @@ const getJobTypeData = () => {
|
||||
|
||||
// 标签页数据
|
||||
const tabs = [
|
||||
{ key: 'salary', label: '薪资' },
|
||||
{ key: 'education', label: '学历要求' },
|
||||
{ key: 'experience', label: '工作经验' },
|
||||
{ key: 'salary', label: '薪资' },
|
||||
{ key: 'scale', label: '公司规模' },
|
||||
{ key: 'jobType', label: '岗位类型' },
|
||||
{ key: 'area', label: '地区' }
|
||||
];
|
||||
|
||||
// 当前激活的标签
|
||||
const activeTab = ref('education');
|
||||
const activeTab = ref('salary');
|
||||
|
||||
// 存储已选中的值
|
||||
const selectedValues = reactive({
|
||||
|
||||
@@ -97,8 +97,8 @@
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"key" : "9cfc9370bd8a941951da1cea0308e9e3",
|
||||
"securityJsCode" : "7b16386c7f744c3ca05595965f2b037f",
|
||||
"key" : "b79ea14cb17704ab1a1a32c12d72f634",
|
||||
"securityJsCode" : "04795ef5b20919d34cadc2e33e01d609",
|
||||
"serviceHost" : ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import SelectJobs from '@/components/selectJobs/selectJobs.vue';
|
||||
import { reactive, inject, ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
|
||||
const { $api, navTo, navBack, config } = inject('globalFunction');
|
||||
@@ -76,6 +75,7 @@
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '', // 工作经历ID(编辑时使用)
|
||||
companyName: '',
|
||||
position: '',
|
||||
userId: '', // 将在确认时动态获取
|
||||
@@ -93,15 +93,17 @@
|
||||
pageType.value = options.type;
|
||||
}
|
||||
|
||||
// 如果是编辑模式,解析传递的数据
|
||||
if (options.type === 'edit' && options.data) {
|
||||
// 如果是编辑模式,从本地存储获取数据(避免URL长度限制)
|
||||
if (options.type === 'edit') {
|
||||
try {
|
||||
editData.value = JSON.parse(decodeURIComponent(options.data));
|
||||
console.log('编辑数据:', editData.value);
|
||||
const storedData = uni.getStorageSync('editWorkExperienceData');
|
||||
if (storedData) {
|
||||
editData.value = storedData;
|
||||
console.log('编辑数据:', editData.value);
|
||||
|
||||
// 回显数据到表单
|
||||
if (editData.value) {
|
||||
// 回显数据到表单
|
||||
formData.companyName = editData.value.companyName || '';
|
||||
formData.id = editData.value.id || '';
|
||||
formData.position = editData.value.position || '';
|
||||
formData.startDate = editData.value.startDate || '';
|
||||
formData.endDate = editData.value.endDate || '至今';
|
||||
@@ -110,6 +112,9 @@
|
||||
// 同步日期选择器的显示
|
||||
startDate.value = editData.value.startDate || '';
|
||||
endDate.value = editData.value.endDate || '至今';
|
||||
|
||||
// 使用完后清除存储
|
||||
uni.removeStorageSync('editWorkExperienceData');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('解析编辑数据失败:', error);
|
||||
@@ -196,13 +201,16 @@
|
||||
};
|
||||
|
||||
console.log('请求参数:', params);
|
||||
if (pageType.value === 'edit') {
|
||||
params.id = formData.id;
|
||||
}
|
||||
console.log('页面类型:', pageType.value);
|
||||
|
||||
let resData;
|
||||
// 根据页面类型调用不同的接口
|
||||
if (pageType.value === 'edit' && editData.value?.id) {
|
||||
if (pageType.value === 'edit' && formData.id) {
|
||||
// 编辑模式:调用更新接口
|
||||
resData = await $api.createRequest(`/app/userworkexperiences/edit`, {...params, id: editData.value.id}, 'put');
|
||||
resData = await $api.createRequest(`/app/userworkexperiences/edit`, params, 'put');
|
||||
console.log('编辑接口响应:', resData);
|
||||
} else {
|
||||
// 添加模式:调用新增接口
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<dict-Label dictType="area" :value="Number(userInfo.area)"></dict-Label>
|
||||
</view>
|
||||
<view class="mys-list">
|
||||
<view class="cards button-click" v-for="(title, index) in userInfo.jobTitle" :key="index">
|
||||
<view class="cards button-click" v-for="(title, index) in (userInfo.jobTitle || [])" :key="index">
|
||||
{{ title }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -236,9 +236,9 @@ const handleEditOrAdd = () => {
|
||||
|
||||
// 编辑单个经历
|
||||
const handleEditItem = (item) => {
|
||||
// 跳转到编辑页面,传递编辑标识和数据
|
||||
const itemData = encodeURIComponent(JSON.stringify(item));
|
||||
navTo(`/packageA/pages/addWorkExperience/addWorkExperience?type=edit&data=${itemData}`);
|
||||
// 使用本地存储传递数据,避免URL长度限制导致小程序框架报错
|
||||
uni.setStorageSync('editWorkExperienceData', item);
|
||||
navTo('/packageA/pages/addWorkExperience/addWorkExperience?type=edit');
|
||||
};
|
||||
|
||||
// 删除单个经历(带确认弹窗)
|
||||
|
||||
@@ -847,6 +847,28 @@ onUnmounted(() => {
|
||||
uni.$off('citySelected');
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
onShow(() => {
|
||||
// 页面显示时获取最新的企业信息
|
||||
getCompanyInfo();
|
||||
@@ -1458,27 +1480,6 @@ const toggleJobStatus = (job) => {
|
||||
$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,
|
||||
|
||||
@@ -11,6 +11,8 @@ import {
|
||||
|
||||
// 静态树 O(1) 超快查询!!!!!
|
||||
let IndustryMap = null
|
||||
// 复用同一批字典请求,避免 App 启动和页面组件同时初始化时产生竞态。
|
||||
let dictDataPromise = null
|
||||
// 构建索引
|
||||
function buildIndex(tree) {
|
||||
const map = new Map();
|
||||
@@ -50,46 +52,54 @@ const useDictStore = defineStore("dict", () => {
|
||||
return data
|
||||
})
|
||||
}
|
||||
if (complete.value) return
|
||||
if (dictLoading.value) return
|
||||
dictLoading.value = true
|
||||
try {
|
||||
const [education, experience, area, scale, sex, affiliation, nature, noticeType] =
|
||||
await Promise.all([
|
||||
getDictSelectOption('education'),
|
||||
getDictSelectOption('experience'),
|
||||
getDictSelectOption('area', true),
|
||||
getDictSelectOption('scale'),
|
||||
getDictSelectOption('app_sex'),
|
||||
getDictSelectOption('political_affiliation'),
|
||||
getDictSelectOption('company_nature'),
|
||||
getDictSelectOption('sys_notice_type'),
|
||||
]);
|
||||
if (complete.value) return Promise.resolve()
|
||||
// App.vue 会在启动时加载字典,页面组件也可能同时加载。
|
||||
// 不能在请求进行中直接 return,否则调用方会把当时的空 state 复制下来。
|
||||
if (dictDataPromise) return dictDataPromise
|
||||
|
||||
state.education = education;
|
||||
state.experience = experience;
|
||||
state.area = area;
|
||||
state.scale = scale;
|
||||
state.sex = sex;
|
||||
state.affiliation = affiliation;
|
||||
state.nature = nature
|
||||
state.noticeType = noticeType
|
||||
complete.value = true
|
||||
getIndustryDict() // 获取行业
|
||||
} catch (error) {
|
||||
console.error('Error fetching dictionary data:', error);
|
||||
// 确保即使出错也能返回空数组
|
||||
state.education = [];
|
||||
state.experience = [];
|
||||
state.area = [];
|
||||
state.scale = [];
|
||||
state.sex = [];
|
||||
state.affiliation = [];
|
||||
state.nature = [];
|
||||
state.noticeType = [];
|
||||
} finally {
|
||||
dictLoading.value = false
|
||||
}
|
||||
dictLoading.value = true
|
||||
dictDataPromise = (async () => {
|
||||
try {
|
||||
const [education, experience, area, scale, sex, affiliation, nature, noticeType] =
|
||||
await Promise.all([
|
||||
getDictSelectOption('education'),
|
||||
getDictSelectOption('experience'),
|
||||
getDictSelectOption('area', true),
|
||||
getDictSelectOption('scale'),
|
||||
getDictSelectOption('app_sex'),
|
||||
getDictSelectOption('political_affiliation'),
|
||||
getDictSelectOption('company_nature'),
|
||||
getDictSelectOption('sys_notice_type'),
|
||||
]);
|
||||
|
||||
state.education = education;
|
||||
state.experience = experience;
|
||||
state.area = area;
|
||||
state.scale = scale;
|
||||
state.sex = sex;
|
||||
state.affiliation = affiliation;
|
||||
state.nature = nature
|
||||
state.noticeType = noticeType
|
||||
complete.value = true
|
||||
getIndustryDict() // 获取行业
|
||||
} catch (error) {
|
||||
console.error('Error fetching dictionary data:', error);
|
||||
// 确保即使出错也能返回空数组
|
||||
state.education = [];
|
||||
state.experience = [];
|
||||
state.area = [];
|
||||
state.scale = [];
|
||||
state.sex = [];
|
||||
state.affiliation = [];
|
||||
state.nature = [];
|
||||
state.noticeType = [];
|
||||
} finally {
|
||||
dictLoading.value = false
|
||||
dictDataPromise = null
|
||||
}
|
||||
})()
|
||||
|
||||
return dictDataPromise
|
||||
};
|
||||
|
||||
async function getIndustryDict() {
|
||||
|
||||
Reference in New Issue
Block a user