zhengnaiwen_citu 7 mesiacov pred
rodič
commit
1617e1db16
9 zmenil súbory, kde vykonal 915 pridanie a 11 odobranie
  1. 254 0
      api/resume.js
  2. 6 0
      pages.json
  3. 2 1
      pages/index/my.vue
  4. 528 0
      pagesA/resumeOnline/index.vue
  5. BIN
      static/iconfont.ttf
  6. 12 0
      static/iconfont.wxss
  7. 48 10
      store/user.js
  8. 8 0
      utils/date.js
  9. 57 0
      utils/getText.js

+ 254 - 0
api/resume.js

@@ -0,0 +1,254 @@
+import request from "@/utils/request"
+
+// 保存基本信息
+// export const saveResumeBasicInfo = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/info/save',
+//     data
+//   })
+// }
+
+// // 保存个人优势
+// export const saveResumeAdvantage = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/advantage/save',
+//     data
+//   })
+// }
+
+// // 保存培训经历
+// export const saveResumeTrainExp = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/train/exp/save',
+//     data
+//   })
+// }
+
+// // 删除培训经历
+// export const deleteResumeTrainExp = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/train/exp/remove?id=' + id
+//   })
+// }
+
+// 获取培训经历
+export const getResumeTrainExp = async () => {
+  return request({
+    url: '/app-api/menduner/system/person/resume/get/train/exp',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// // 获取-教育经历
+export const getResumeEduExp = async () => {
+  return request({
+    url: '/app-api/menduner/system/person/resume/get/edu/exp',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// // 删除-教育经历
+// export const deleteResumeEduExp = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/edu/exp/remove?id=' + id
+//   })
+// }
+
+// // 保存-教育经历
+// export const saveResumeEduExp = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/edu/exp/save',
+//     data
+//   })
+// }
+
+// 获取-工作经历
+export const getResumeWorkExp = async () => {
+  return request({
+    url: '/app-api/menduner/system/person/resume/get/work/exp',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// // 删除-工作经历
+// export const deleteResumeWorkExp = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/work/exp/remove?id=' + id
+//   })
+// }
+
+// // 保存-工作经历
+// export const saveResumeWorkExp = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/work/exp/save',
+//     data
+//   })
+// }
+
+// // 保存项目经历
+// export const saveResumeProjectExp = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/project/exp/save',
+//     data
+//   })
+// }
+
+// // 删除项目经历
+// export const deleteResumeProjectExp = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/project/exp/remove?id=' + id
+//   })
+// }
+
+// 获取项目经历
+export const getResumeProjectExp = async () => {
+  return request({
+    url: '/app-api/menduner/system/person/resume/get/project/exp',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// // 获取-技能树形
+// export const getSkillTree = async () => {
+//   return await request.get({
+//     url: '/app-api/menduner/system/skill/get/tree'
+//   })
+// }
+
+// 获取-职业技能
+export const getResumePersonSkill = async () => {
+  return request({
+    url: '/app-api/menduner/system/person/resume/get/person/skill',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// // 删除-职业技能
+// export const deleteResumePersonSkill = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/person/skill/remove?id=' + id
+//   })
+// }
+
+// // 保存-职业技能
+// export const saveResumePersonSkill = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/person/skill/save',
+//     data
+//   })
+// }
+
+// // 保存求职意向
+// export const saveResumeJobInterested = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/job/interested/save',
+//     data
+//   })
+// }
+
+// // 删除求职意向
+// export const deleteResumeJobInterested = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/job/interested/remove?id=' + id
+//   })
+// }
+
+// // 获取求职意向
+export const getResumeJobInterested = async () => {
+  return request({
+    url: '/app-api/menduner/system/person/resume/get/job/interested',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// // 根据专业名称模糊搜索
+// export const schoolMajorByName = async (params) => {
+//   return await request.get({
+//     url: '/app-api/menduner/system/major/search/by/name',
+//     params
+//   })
+// }
+
+// // 根据学校名称模糊搜索
+// export const schoolSearchByName = async (params) => {
+//   return await request.get({
+//     url: '/app-api/menduner/system/school/search/by/name',
+//     params
+//   })
+// }
+
+// // 根据企业名称模糊搜索
+// export const enterpriseSearchByName = async (params) => {
+//   return await request.get({
+//     url: '/app-api/menduner/system/enterprise/search/by/name',
+//     params
+//   })
+// }
+
+// // 保存附件
+// export const savePersonResumeCv = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/person/cv/save',
+//     data
+//   })
+// }
+
+// // 删除附件
+// export const deletePersonResumeCv = async (id) => {
+//   return await request.delete({
+//     url: '/app-api/menduner/system/person/resume/person/cv/remove?id=' + id
+//   })
+// }
+
+// // 获取附件列表
+// export const getPersonResumeCv = async () => {
+//   return await request.get({
+//     url: '/app-api/menduner/system/person/resume/get/person/cv'
+//   })
+// }
+
+// // 修改求职类型
+// export const updateJobStatus = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/job/status/update?status=' + data,
+//   })
+// }
+
+// // 修改人才头像
+// export const updatePersonAvatar = async (url) => {
+//   return await request.post({
+//     url: `/app-api/menduner/system/person/resume/avatar/update?avatar=${url}`
+//   })
+// }
+
+// // 修改个人画像
+// export const savePersonPortrait = async (data) => {
+//   return await request.post({
+//     url: '/app-api/menduner/system/person/resume/tag/update',
+//     data
+//   })
+// }

+ 6 - 0
pages.json

@@ -42,6 +42,12 @@
 		{
 			"root": "pagesA",
 			"pages": [
+				{
+					"path": "resumeOnline/index",
+					"style": {
+						"navigationBarTitleText": "在线简历"
+					}
+				},
 				{
 					"path": "resume/index",
 					"style": {

+ 2 - 1
pages/index/my.vue

@@ -74,7 +74,8 @@ const itemList = [
 ]
 
 const list = [
-	{	title: '我的简历',	path: '/pagesA/resume/index'	},					
+	{	title: '在线简历',	path: '/pagesA/resumeOnline/index'	},					
+	{	title: '附件简历',	path: '/pagesA/resume/index'	},					
 	{ title: '面试管理', path: '/pagesA/interview/index' },
 	{ title: '门墩甄选', appId: 'wx6decdf12f9e7a061' },
 	{ title: '我要招聘', key: 'recruit' }

+ 528 - 0
pagesA/resumeOnline/index.vue

@@ -0,0 +1,528 @@
+<template>
+  <view>
+    <view class="baseInfo borderLine">
+      <view>
+        <view class="baseInfo-name">
+          <text class="name title">{{ baseInfo.name }}</text>
+          <uni-icons
+            type="icon-Edit"
+            color="#333"
+            custom-prefix="iconfont"
+            size="20"
+          ></uni-icons>
+        </view>
+        <view class="baseInfo-desc">{{ baseInfo.expTypeText }} - {{ baseInfo.age }}岁 - {{ baseInfo.eduTypeText }}</view>
+        <view class="baseInfo-phone">
+          <uni-icons
+            type="icon-Phone"
+            color="#999"
+            custom-prefix="iconfont"
+            size="14"
+          ></uni-icons>
+          <text class="number">{{ baseInfo.phone }}</text>
+        </view>
+      </view>
+      <view class="head">
+        <image
+          :src="baseInfo.avatar"
+          mode="scaleToFill"
+        />
+      </view>
+    </view>
+    <view class="characteristic">
+      <view class="titleBox">
+        <text class="title">个人画像</text>
+        <uni-icons
+          type="icon-Edit"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="tags">
+        <view
+          v-for="tag in baseInfo.tagList"
+          :key="tag"
+          class="tag"
+        >
+          {{ tag }}
+        </view>
+      </view>
+    </view>
+    <view>
+      <uni-list>
+        <uni-list-item showArrow :rightText="baseInfo.jobStatusText">
+          <template v-slot:body>
+            <view class="title flex-1 soloHeight">求职状态</view>
+          </template>
+        </uni-list-item>
+      </uni-list>
+    </view>
+    <view class="advantage borderLine">
+      <view class="titleBox">
+        <text class="title">个人优势</text>
+        <uni-icons
+          type="icon-Edit"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="ellipsis-2 text">{{ baseInfo.advantage }}</view>
+    </view>
+    <view class="intention borderLine">
+      <view class="titleBox">
+        <text class="title">求职意向</text>
+        <uni-icons
+          type="icon-add"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="content">
+        <view class="text" v-if="!intention.length">请填写您的求职意向...</view>
+      </view>
+    </view>
+    <view class="educationExp borderLine">
+      <view class="titleBox">
+        <text class="title">教育经历</text>
+        <uni-icons
+          type="icon-add"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="content">
+        <view class="text" v-if="!educationExp.length">请填写您的教育经历...</view>
+        <uni-list :border="false">
+          <uni-list-item
+            v-for="education in educationExp"
+            :key="education.id"
+            showArrow
+            :border="false"
+            :title="education.schoolName"
+            :note="`${education.major} ${education.educationTypeText}`"
+            :rightText="education.time"
+          />
+        </uni-list>
+      </view>
+    </view>
+    <view class="workExp borderLine">
+      <view class="titleBox">
+        <text class="title">工作经历</text>
+        <uni-icons
+          type="icon-add"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="content">
+        <view
+          v-for="work in workExp"
+          :key="work.id"
+          class="content-item"
+        >
+          <view class="content-title">
+            <view class="name">{{ work.enterpriseName }}</view>
+            <view class="time">
+              {{ work.time }}
+              <uni-icons
+                class="icon"
+                type="right"
+                color="#aaa"
+                size="16"
+              />
+            </view>
+          </view>
+          <view class="content-subTitle">{{ work.positionName }}</view>
+          <view class="content-main ellipsis-2">内容:{{ work.content }}</view>
+        </view>
+      </view>
+    </view>
+    <view class="projectExp workExp borderLine">
+      <view class="titleBox">
+        <text class="title">项目经历</text>
+        <uni-icons
+          type="icon-add"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="content">
+        <view
+          v-for="project in projectExp"
+          :key="project.id"
+          class="content-item"
+        >
+          <view class="content-title">
+            <view class="name">{{ project.name }}</view>
+            <view class="time">
+              {{ project.time }}
+              <uni-icons
+                class="icon"
+                type="right"
+                color="#aaa"
+                size="16"
+              />
+            </view>
+          </view>
+          <view class="content-main ellipsis-2">描述:{{ project.content }}</view>
+        </view>
+      </view>
+    </view>
+    <view class="workExp trainExp borderLine">
+      <view class="titleBox">
+        <text class="title">培训经历</text>
+        <uni-icons
+          type="icon-add"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="content">
+        <view
+          v-for="train in trainExp"
+          :key="train.id"
+          class="content-item"
+        >
+          <view class="content-title">
+            <view class="name">{{ train.orgName }}</view>
+            <view class="time">
+              {{ train.time }}
+              <uni-icons
+                class="icon"
+                type="right"
+                color="#aaa"
+                size="16"
+              />
+            </view>
+          </view>
+          <view class="content-subTitle">课程:{{ train.course }}</view>
+          <view class="content-main ellipsis-2">描述:{{ train.content }}</view>
+        </view>
+      </view>
+    </view>
+    <view class="characteristic">
+      <view class="titleBox">
+        <text class="title">职业技能</text>
+        <uni-icons
+          type="icon-Edit"
+          color="#666"
+          custom-prefix="iconfont"
+          size="18"
+        ></uni-icons>
+      </view>
+      <view class="tags">
+        <view
+          v-for="skill in skillExp"
+          :key="skill.title"
+          class="tag"
+        >
+          {{ skill.title }}
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+import { getAgeByBirthdayTimestamp, timesTampChange } from '@/utils/date'
+import {
+  getResumeJobInterested,
+  getResumeEduExp,
+  getResumeWorkExp,
+  getResumeProjectExp,
+  getResumeTrainExp,
+  getResumePersonSkill
+} from '@/api/resume'
+import { getText } from '@/utils/getText'
+import { getDict } from '@/hooks/useDictionaries'
+import { userStore } from '@/store/user'
+
+const useUserStore = userStore()
+
+const baseInfo = ref({})
+
+const intention = ref([])
+const educationExp = ref([])
+const workExp = ref([])
+const projectExp = ref([])
+const trainExp = ref([])
+const skillExp = ref([])
+
+// 获取基础信息
+function getBaseInfo () {
+  const { name, phone, ...obj } = useUserStore.baseInfo
+  baseInfo.value = {
+    ...obj,
+    name: name ? name : useUserStore.userInfo.phone,
+    phone: phone ? phone : useUserStore.userInfo.phone,
+    age: obj.birthday ? getAgeByBirthdayTimestamp(obj.birthday) : 0
+  }
+}
+
+// 获取求职意向
+async function getJobInterested () {
+  const { data } = await getResumeJobInterested()
+  if (!data || !data.length) {
+    return
+  }
+  // 完成度展示
+  // emit('complete', { status: Boolean(data?.length), id: 'jobIntention' })
+  // if (!data.length) return
+  // interestList.value = data
+  // interestList.value = dealJobData(data)
+}
+
+// 获取教育经历
+async function getEduExp () {
+  const { data: dict } = await getDict('menduner_education_type')
+  if (dict.code !== 0) {
+    return
+  }
+  const { data } = await getResumeEduExp()
+  if (!data || !data.length) {
+    return
+  }
+  educationExp.value = data.map(e => {
+    const item = dict.data.find(_e => _e.value === e.educationType)
+    return {
+      ...e,
+      educationTypeText: item?.label ?? '',
+      time: `${timesTampChange(e.startTime ,'Y')}-${timesTampChange(e.endTime ,'Y')} `
+    }
+  })
+  // 完成度展示
+  // emit('complete', { status: Boolean(data?.length), id: 'educationExp' })
+  // dataList.value = data
+}
+
+// 获取工作经验
+async function getWorkExp () {
+  const { data } = await getResumeWorkExp()
+  if (!data || !data.length) {
+    return
+  }
+  // console.log(data)
+  // 完成度展示
+  // emit('complete', { status: Boolean(data?.length), id: 'workExperience' })
+  workExp.value = data.map(e => {
+    return {
+      ...e,
+      time: `${timesTampChange(e.startTime ,'Y')}-${e.endTime ? timesTampChange(e.endTime ,'Y') : '至今'} `
+    }
+  })
+}
+
+// 项目经历
+async function getProjectExpData () {
+  const { data } = await getResumeProjectExp()
+  if (!data || !data.length) {
+    return
+  }
+  // 完成度展示
+  // emit('complete', { status: Boolean(data?.length), id: 'projectExperience' })
+  projectExp.value = data.map(e => {
+    return {
+      ...e,
+      time: `${timesTampChange(e.startTime ,'Y')}-${e.endTime ? timesTampChange(e.endTime ,'Y') : '至今'} `
+    }
+  })
+}
+
+// 培训经历
+async function getTrainExpData () {
+  const { data } = await getResumeTrainExp()
+  if (!data || !data.length) {
+    return
+  }
+  // 完成度展示
+  // emit('complete', { status: Boolean(data?.length), id: 'trainingExperience' })
+  trainExp.value = data.map(e => {
+    return {
+      ...e,
+      time: `${timesTampChange(e.startTime ,'Y')}-${e.endTime ? timesTampChange(e.endTime ,'Y') : '至今'} `
+    }
+  })
+}
+
+// 职业技能
+async function getSkillExpData () {
+  const { data: _skillList} = await getDict('skillList', {}, 'skillList')
+  const skillList = _skillList?.data
+  if (!skillList || !skillList.length) {
+    return
+  }
+
+  const { data: _skillLevelArr } = await getDict('menduner_skill_level')
+  const skillLevelArr = _skillLevelArr?.data
+    if (!skillLevelArr || !skillLevelArr.length) {
+    return
+  }
+
+  const { data } = await getResumePersonSkill()
+  if (!data || !data.length) {
+    return
+  }
+  // 完成度展示
+  // emit('complete', { status: Boolean(data?.length), id: 'vocationalSkills' })
+  skillExp.value = data.map(e => {
+    return {
+      ...e,
+      title: `${getText(e.skillId, skillList, 'nameCn', 'id')} / ${getText(e.level, skillLevelArr)}`
+    }
+  })
+  console.log(skillExp.value)
+}
+
+// 获取基础信息
+getBaseInfo()
+// 获取求职意向
+getJobInterested()
+// 获取教育经历
+getEduExp()
+// 获取工作经验
+getWorkExp()
+// 项目经历
+getProjectExpData()
+// 培训经历
+getTrainExpData()
+// 职业技能
+getSkillExpData()
+</script>
+
+<style lang="scss" scoped>
+$px: 30rpx;
+.borderLine {
+  border-bottom: 2rpx solid #f5f5f5;
+}
+.title {
+  font-size: 40rpx;
+  font-weight: 600;
+}
+.flex-1 {
+  flex: 1;
+}
+.soloHeight {
+  height: 80rpx;
+  line-height: 80rpx;
+}
+.px-20 {
+  padding-left: 20rpx;
+  padding-right: 20rpx;
+  box-sizing: border-box;
+}
+.ellipsis-2 {
+  overflow: hidden;
+  display: -webkit-box;
+  text-overflow: ellipsis; //属性规定当文本溢出包含元素时发生的事情  text-overflow: clip|ellipsis|string; (修剪/省略号/指定字符串)
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical; //属性规定框的子元素应该被水平或垂直排列
+}
+.titleBox {
+  margin-bottom: 10rpx;
+  display: flex;
+  justify-content: space-between;
+}
+.text {
+  font-size: 28rpx;
+  color: #666;
+}
+.baseInfo {
+  padding: 20rpx $px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  &-name {
+    margin-bottom: 10rpx;
+    .name {
+      margin-right: 10rpx;
+    }
+  }
+  &-desc {
+    font-size: 28rpx;
+    color: #666;
+    margin-bottom: 10rpx;
+  }
+  &-phone {
+    font-size: 28rpx;
+    color: #666;
+    .number {
+      margin-left: 10rpx;
+    }
+  }
+  .head {
+    image {
+      width: 150rpx;
+      height: 150rpx;
+      border: 2rpx solid #ccc;
+      border-radius: 50%;
+    }
+  }
+}
+.advantage {
+  padding: $px;
+}
+
+.characteristic {
+  padding: $px;
+  .tags {
+    padding-top: $px;
+    display: flex;
+    flex-wrap: wrap;
+    .tag {
+      margin: 0 10rpx 10rpx 0;
+      border: 2rpx solid #008978;
+      color: #008978;
+      white-space: nowrap;
+      padding: 4rpx 10rpx;
+      border-radius: 10rpx;
+      font-size: 24rpx;
+    }
+  }
+}
+.intention,.educationExp,.workExp,.projectExp {
+  padding: $px;
+}
+.workExp {
+  .content {
+    &-item {
+      padding: $px 20rpx;
+    }
+    &-title {
+      display: flex;
+      justify-content: space-between;
+      .name {
+        // font-weight: 600;
+        font-size: 30rpx;
+        color: #333;
+      }
+      .time {
+        color: #999;
+        font-size: 24rpx;
+        display: flex;
+        align-items: center;
+        .icon {
+          margin-left: 20rpx;
+        }
+      }
+    }
+    &-subTitle {
+      font-size: 24rpx;
+      margin-top: 6rpx;
+      color: #999;
+    }
+    &-main {
+      margin-top: 20rpx;
+      font-size: 24rpx;
+      color: #999;
+    }
+  }
+}
+</style>

BIN
static/iconfont.ttf


+ 12 - 0
static/iconfont.wxss

@@ -11,6 +11,18 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-add:before {
+  content: "\e633";
+}
+
+.icon-Edit:before {
+  content: "\e616";
+}
+
+.icon-Phone:before {
+  content: "\e89a";
+}
+
 .icon-renminbi1688:before {
   content: "\e6cb";
 }

+ 48 - 10
store/user.js

@@ -3,6 +3,8 @@ import { clone, cloneDeep } from 'lodash-es';
 import { getBaseInfo, getUserInfo } from '@/api/user';
 import { smsLogin, passwordLogin, logout, userRegister } from '@/api/common'
 import { closeAuthModal } from '@/hooks/useModal'
+import { timesTampChange } from '@/utils/date'
+import { getBaseInfoDictOfName } from '@/utils/getText'
 
 // 默认用户信息
 const defaultBaseInfo = {
@@ -27,17 +29,20 @@ const tabUrl = [
   'pages/index/communicate',
   'pages/index/my'
 ]
-
 export const userStore = defineStore({
   id: 'user',
-  state: () => ({
-    baseInfo: {}, // 用户信息
-    userInfo: {},
-    isLogin: !!uni.getStorageSync('token'), // 登录状态
-    refreshToken: uni.getStorageSync('refresh-token'), // 用户切换
-    lastUpdateTime: 0, // 上次更新时间
-    accountInfo: cloneDeep(defaultAccountInfo), // 账号信息
-  }),
+  state: () => {
+    const userInfo = JSON.parse(uni.getStorageSync('user') ?? '{}')
+    console.log('userInfo====',userInfo)
+    return {
+      baseInfo: userInfo ? userInfo.baseInfo : {}, // 用户信息
+      userInfo: userInfo ? userInfo.userInfo : {},
+      isLogin: !!uni.getStorageSync('token'), // 登录状态
+      refreshToken: uni.getStorageSync('refresh-token'), // 用户切换
+      lastUpdateTime: 0, // 上次更新时间
+      accountInfo: cloneDeep(defaultAccountInfo), // 账号信息
+    }
+  },
 
   actions: {
     setLogin (val) {
@@ -90,7 +95,8 @@ export const userStore = defineStore({
       if (code !== 0) {
         return;
       }
-      this.baseInfo = data;
+      const _data = await this.getFieldText(data)
+      this.baseInfo = _data
       return Promise.resolve(data);
     },
     // 获取用户信息
@@ -157,6 +163,38 @@ export const userStore = defineStore({
       this.resetUserData();
       return !this.isLogin;
     },
+    // 字典对应中文
+    async getFieldText (data) {
+      if (data.birthday && data.birthday !== 0) {
+        data.birthdayText = timesTampChange(data.birthday, 'Y-M-D') // 出生日期
+      }
+      if (data.firstWorkTime && data.firstWorkTime !== 0) {
+        data.firstWorkTimeText = timesTampChange(data.firstWorkTime, 'Y-M-D') // 首次工作时间
+      }
+      if (data.areaId && data.areaId !== 0) {
+        await getBaseInfoDictOfName(0, data, data.areaId, 'areaName') // 现居住地text
+        await getBaseInfoDictOfName(0, data, data.regId, 'regName') // 户籍地text
+      }
+      if (data.eduType && data.eduType !== 0) {
+        await getBaseInfoDictOfName(1, data, data.eduType, 'eduTypeText') // 学历
+      }
+      if (data.expType && data.expType !== 0) {
+        await getBaseInfoDictOfName(2, data, data.expType, 'expTypeText') // 工作经验
+      }
+      if (data.sex && data.sex !== 0) {
+        await getBaseInfoDictOfName(3, data, data.sex, 'sexTypeText') // 性别
+      }
+      if (data.jobType && data.jobType !== 0) {
+        await getBaseInfoDictOfName(4, data, data.jobType, 'jobTypeText') // 求职类型
+      }
+      if (data.jobStatus && data.jobStatus !== 0) {
+        await getBaseInfoDictOfName(5, data, data.jobStatus, 'jobStatusText') // 	求职状态
+      }
+      if (data.maritalStatus && data.maritalStatus !== 0) {
+        await getBaseInfoDictOfName(6, data, data.maritalStatus, 'maritalText') // 	婚姻状况
+      }
+      return data
+    }
   },
   persist: {
     // enabled: true,

+ 8 - 0
utils/date.js

@@ -16,4 +16,12 @@ export const timesTampChange = (timestamp, format = 'Y-M-D h:m:s') => {
   if (!formattedDate) formattedDate = Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' + s
 
   return formattedDate
+}
+
+// 根据生日时间戳计算年龄
+export const getAgeByBirthdayTimestamp = (timestamp) => {
+  const now = new Date()
+  const birthday = new Date(timestamp)
+  const age = now.getFullYear() - birthday.getFullYear()
+  return age
 }

+ 57 - 0
utils/getText.js

@@ -0,0 +1,57 @@
+import { getDict } from '@/hooks/useDictionaries'
+
+export const getText = (value, arr, itemText = 'label', itemValue = 'value') => { // 一维数组
+  // console.log('getText', value, arr)
+  if (!arr?.length || !(value && value !== 0)) return
+  const item = arr.find(formItem => formItem[itemValue] === value)
+  if (!item) return
+  return item[itemText]
+}
+
+export const getBaseInfoDictOfName = async (index = 0, baseInfo, value, addKeyName) => { // 一维数组
+  const test = [
+    { dictType: 'menduner_area_type', itemText: 'name', itemValue: 'id', saveType: 'areaList' },
+    { dictType: 'menduner_education_type', itemText: 'label', itemValue: 'value' },
+    { dictType: 'menduner_exp_type', itemText: 'label', itemValue: 'value' },
+    { dictType: 'menduner_sex', itemText: 'label', itemValue: 'value' },
+    { dictType: 'menduner_job_type', itemText: 'label', itemValue: 'value' },
+    { dictType: 'menduner_job_status', itemText: 'label', itemValue: 'value' },
+    { dictType: 'menduner_marital_status', itemText: 'label', itemValue: 'value' },
+  ]
+  const e = test[index]
+
+  if (!value && value !== 0 && !e) baseInfo[addKeyName] = '暂无'
+  const params = e.saveType === 'areaList' ? {} : null
+  const { data } = await getDict(e.dictType, params, (e.saveType || 'dict'))
+  if (data.code !== 0) {
+    return
+  }
+  const item = data.data.find(formItem => Number(formItem[e.itemValue]) === Number(value))
+  baseInfo[addKeyName] = item ? item[e.itemText] : '暂无'
+}
+
+// export const getBaseInfoDictOfName1 = async (baseInfo, value, addKey, itemText = 'name', itemValue = 'id') => { // 一维数组
+//   if (!value && value !== 0) baseInfo[addKey] = '暂无'
+//   const { data } = await getDict('menduner_area_type', {}, 'areaList')
+//   const item = data.find(formItem => Number(formItem[itemValue]) === Number(value))
+//   baseInfo[addKey] = item ? item[itemText] : '暂无'
+// }
+
+export const dealCanBeInputtedValueAndLabel = (formItem, data) => {
+  if (!formItem.key || !formItem.itemTextName) return
+  //
+  formItem.value = data[formItem.key] || data[formItem.itemTextName]
+  formItem[formItem.itemTextName] = data[formItem.itemTextName]
+  if (data[formItem.key] && data[formItem.itemTextName]) {
+    formItem.search(data[formItem.itemTextName]) // 存在id的情况下->回显下拉框列表
+  }
+  // if (data[formItem.key] && data[formItem.itemTextName]) {
+  //   formItem.items = [{ [formItem.itemText]: data[formItem.itemTextName], [formItem.itemValue]: data[formItem.key] }] // 存在id的情况下->回显下拉框
+  // }
+}
+export const dealCanBeInputtedSave = (formItem, params) => {
+  if (formItem.value === formItem[formItem.itemTextName]) {
+    params[formItem.key] = null; params[formItem.itemTextName] = formItem[formItem.itemTextName]
+  }
+  else { params[formItem.key] = formItem.value; params[formItem.itemTextName] = formItem[formItem.itemTextName] }
+}