Преглед изворни кода

校验是否完善人才必填信息

lifanagju_citu пре 6 месеци
родитељ
комит
0d3ef82c46

+ 5 - 0
hooks/useDictionaries.js

@@ -9,6 +9,7 @@ import {
   getAreaTreeData,
   getPositionData
 } from '@/api/common'
+import { getSecondNodes } from '@/utils/dealData'
 
 // const setDict = (type, val, cacheTime = 7200) => {
 const setDict = (type, val) => {
@@ -46,6 +47,9 @@ const setDict = (type, val) => {
       }
     }
   }
+  if (type === 'positionSecondData') {
+    val.data = getSecondNodes(val.data)
+  }
   // 一小时过期
   const currentTime = new Date()
   currentTime.setTime(currentTime.getTime() + 3600 * 1000)
@@ -79,6 +83,7 @@ export const getDict = (type, params, apiType = 'dict') => {
         skillList: getSkillList,
         areaList: getAreaListData,
         areaMap: getAreaMapData,
+        positionSecondData: getPositionTreeData,
         positionData: getPositionData
       }
       apiFn[apiType](query).then(data => {

+ 9 - 3
layout/components/auth-modal.vue

@@ -1,8 +1,13 @@
 <!--  -->
 <template>
-  <ct-popup :show="authType !== ''" round="10" :showClose="true" @close="closeAuthModal">
-    <login></login>
-  </ct-popup>
+  <view v-if="authType !== ''">
+    <ct-popup :show="authType !== 'necessaryInfo'" round="10" :showClose="true" @close="closeAuthModal">
+      <login></login>
+    </ct-popup>
+    <ct-popup :show="authType === 'necessaryInfo'" round="0" :showClose="false" @close="closeAuthModal">
+      <necessaryInfo ></necessaryInfo>
+    </ct-popup>
+  </view>
 </template>
 
 <script setup>
@@ -10,6 +15,7 @@ import { closeAuthModal } from '@/hooks/useModal'
 import ctPopup from '@/components/ui/ct-popup'
 import { modalStore } from '@/store/modal';
 import login from './authModal/login'
+import necessaryInfo from './authModal/necessaryInfo'
 
 
 const modal = modalStore()

+ 170 - 0
layout/components/authModal/necessaryInfo/index.vue

@@ -0,0 +1,170 @@
+<!-- 校验是否完善人才必填信息 -->
+<template>
+  <scroll-view class="scrollBox" scroll-y="true">
+    <view class="content">
+      <view class="text-center ss-m-b-50 font-size-20 color-primary">请完善您的基本信息</view>
+      <uni-forms
+        ref="baseInfoRef"
+        v-model="formData"
+        :rules="formRules"
+        validateTrigger="bind"
+        label-width="86px"
+        labelAlign="center"
+      >
+        <uni-forms-item name="name" label="姓名" required>
+          <uni-easyinput placeholder="请输入姓名" v-model="formData.name" :inputBorder="false" type="text"></uni-easyinput>
+        </uni-forms-item>
+        <uni-forms-item name="sex" label="性别" required>
+          <uni-data-picker v-model="formData.sex" :localdata="dictObj.sex" :clear-icon="false" popup-title="请选择性别" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
+        </uni-forms-item>
+        <uni-forms-item name="phone" label="联系电话" required>
+          <uni-easyinput placeholder="请输入联系电话" v-model="formData.phone" :inputBorder="false" type="number"></uni-easyinput>
+        </uni-forms-item>
+        <uni-forms-item name="email" label="联系邮箱" required>
+          <uni-easyinput v-model="formData.email" placeholder="请输入联系邮箱" />
+        </uni-forms-item>
+        <uni-forms-item required label="出生日期" name="birthday">
+          <uni-datetime-picker type="date" return-type="timestamp" v-model="formData.birthday" />
+        </uni-forms-item>
+        <uni-forms-item name="enterpriseName" label="任职企业名称" required>
+          <uni-easyinput placeholder="请填写任职企业名称(可填暂无)" v-model="formData.enterpriseName" :clear-icon="true" :inputBorder="false" type="text"></uni-easyinput>
+        </uni-forms-item>
+        <uni-forms-item name="positionName" label="任职职位名称" required>
+          <uni-easyinput placeholder="请填写任职职位名称(可填暂无)" v-model="formData.positionName" :clear-icon="true" :inputBorder="false" type="text"></uni-easyinput>
+        </uni-forms-item>
+        <uni-forms-item name="interestedPositionList" label="意向职位" required>
+          <uni-data-picker v-model="formData.interestedPositionList" :localdata="dictObj.positionSecondData" :clear-icon="false" popup-title="请选择意向职位" :map="{ text: 'nameCn', value: 'id' }"></uni-data-picker>
+        </uni-forms-item>
+        <uni-forms-item name="jobStatus" label="求职状态" required>
+          <uni-data-picker v-model="formData.jobStatus" :localdata="dictObj.jobStatus" :clear-icon="false" popup-title="请选择求职状态" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
+        </uni-forms-item>
+        <uni-forms-item name="expType" label="工作经验" required>
+          <uni-data-picker v-model="formData.expType" :localdata="dictObj.exp" :clear-icon="false" popup-title="请选择工作经验" :clear="false" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
+        </uni-forms-item>
+        <uni-forms-item name="eduType" label="最高学历" required>
+          <uni-data-picker v-model="formData.eduType" :localdata="dictObj.edu" :clear-icon="false" popup-title="请选择最高学历" :clear="false" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
+        </uni-forms-item>
+      </uni-forms>
+      <view class="f-horizon-center">
+        <button type="primary" size="default" class="send-button" @click="submit">提 交</button>
+      </view>
+      <view class="f-horizon-center">
+        <view class="changeRole" @tap="handleLogout">切换账号</view>
+      </view>
+    </view>
+    <uni-popup ref="logoutPopup" type="dialog">
+      <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="系统提示" content="确认退出账号?" @confirm="handleLogoutConfirm" @close="handleLogoutClose">
+      </uni-popup-dialog>
+    </uni-popup>
+  </scroll-view>
+</template>
+<script setup>
+import { ref, unref, watch } from 'vue'
+import { mobile, emailRequired } from '@/utils/validate'
+import { dictObj } from '@/utils/position.js'
+import { savePersonSimpleInfo } from '@/api/user'
+import { showAuthModal } from '@/hooks/useModal'
+import { userStore } from '@/store/user'; const useUserStore = userStore()
+
+const baseInfoRef = ref()
+const formData = ref({ // 必填项目
+  name: null,
+  sex: null,
+  phone: null,
+  email: null,
+  birthday: '1990-01-01',
+  enterpriseName: null,
+  positionName: null,
+  interestedPositionList: null,
+  jobStatus: null,
+  expType: null,
+  eduType: null,
+})
+
+// 监听登录状态
+watch(() => useUserStore?.baseInfo, (newVal) => {
+  if (newVal && Object.keys(newVal).length) {
+    Object.keys(formData.value).forEach(key => {
+      formData.value[key] = newVal[key] || newVal[key] === 0 ? newVal[key] : null
+    })
+  }
+}, { deep: true, immediate: true })
+
+const formRules = {
+	name:{
+		rules: [{required: true, errorMessage: '请输入姓名' }]
+	},
+  sex : {
+    rules: [{required: true, errorMessage: '请选择您的性别' }]
+  },
+  phone: mobile,
+  birthday:{
+		rules: [{required: true, errorMessage: '请选择您的出生日期' }]
+	},
+  enterpriseName:{
+		rules: [{required: true, errorMessage: '请填写任职企业名称(可填暂无)' }]
+	},
+  positionName:{
+		rules: [{required: true, errorMessage: '请填写任职职位名称(可填暂无)' }]
+	},
+  email: emailRequired,
+  expType: {
+		rules: [{required: true, errorMessage: '请选择您的工作年限' }]
+	},
+  eduType: {
+		rules: [{required: true, errorMessage: '请选择您的最高学历' }]
+	},
+  jobStatus: {
+		rules: [{required: true, errorMessage: '请选择您的求职状态' }]
+	}
+}
+
+const logoutPopup = ref()
+// 退出登录
+const handleLogout = () => {
+  logoutPopup.value.open()
+}
+const handleLogoutClose = () => {
+  logoutPopup.value.close()
+}
+const handleLogoutConfirm = async () => {
+  await useUserStore.handleLogout()
+  // necessaryInfoPopup.value.close()
+  showAuthModal()
+}
+
+const submit = async () => {
+  const validate = await unref(baseInfoRef).validate()
+  if (!validate) return uni.showToast({ title: '请将信息补充完整', icon: 'none' })
+  if (!formData.value.email) return uni.showToast({ title: '请输入邮箱', icon: 'none' })
+  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.value.email)) return uni.showToast({ title: '邮箱格式不正确', icon: 'none' })
+  try {
+    // console.log(1, '23456', formData.value)
+    await savePersonSimpleInfo(formData.value)
+    uni.showToast({ title: '保存成功', icon: 'none' })
+    await useUserStore.getInfo()
+    // await useUserStore.getUserInfo()
+  } catch (err) {
+    uni.showToast({ title: err.msg || '保存失败', icon: 'none' })
+  }
+}
+
+</script>
+<style lang="scss" scoped>
+.scrollBox {
+  width: 100vw;
+  // height: 100vh;
+  height: calc(100vh - 30rpx);
+  margin-bottom: 30rpx;
+}
+.content {
+  padding: 30rpx;
+}
+
+.changeRole {
+  color: var(--color-666);
+  font-size: 15px;
+  line-height: 26px;
+  margin-bottom: 40rpx;
+}
+</style>

+ 17 - 2
pages/index/my.vue

@@ -75,7 +75,7 @@ import { ref, computed, watch } from 'vue'
 import ResumeStatus from '@/components/ResumeStatus'
 import { userStore } from '@/store/user'
 import { getUserAvatar } from '@/utils/avatar'
-import { getAccessToken } from '@/utils/request'
+import { getAccessToken, showNecessaryInfoPopup } from '@/utils/request'
 import layoutPage from '@/layout'
 import { showAuthModal } from '@/hooks/useModal'
 import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
@@ -178,6 +178,14 @@ const handleToLink = (item) => {
 		showAuthModal()
 		return
 	}
+  if (showNecessaryInfoPopup()) {
+		uni.showToast({
+			title: '请先完善基本信息',
+			icon: 'none'
+		})
+		showAuthModal('necessaryInfo')
+		return
+	}
   if (item.path === 'shareQrCode') {
 		handleShareCode()
 		return
@@ -199,7 +207,14 @@ const handleShareCode = async () => {
 		showAuthModal()
 		return
 	}
-  // if (!getAccessToken())
+  if (showNecessaryInfoPopup()) {
+		uni.showToast({
+			title: '请先完善基本信息',
+			icon: 'none'
+		})
+		showAuthModal('necessaryInfo')
+		return
+	}
 	const query = {
 		scene: 'shareId=' + userId,
 		path: 'pages/login/index',

+ 9 - 0
pages/index/welfare.vue

@@ -111,6 +111,7 @@ import { getTaskList } from '@/api/integral'
 import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
 import { userStore } from '@/store/user'
 import { showAuthModal } from '@/hooks/useModal'
+import { showNecessaryInfoPopup } from '@/utils/request'
 
 const inputDialog = ref()
 const useUserStore = userStore()
@@ -273,6 +274,14 @@ function handleTo (page) {
 		showAuthModal()
 		return
   }
+  if (showNecessaryInfoPopup()) {
+		uni.showToast({
+			title: '请先完善基本信息',
+			icon: 'none'
+		})
+		showAuthModal('necessaryInfo')
+		return
+	}
   uni.navigateTo({
     url: `/pagesA/${page}/index`
   })

+ 45 - 44
pages/login/index.vue

@@ -50,7 +50,7 @@
 
     <AdvertisePop></AdvertisePop>
 
-    <uni-popup ref="popup" background-color="#fff" type="bottom" :is-mask-click="false">
+    <!-- <uni-popup ref="popup" background-color="#fff" type="bottom" :is-mask-click="false">
       <view style="padding: 20px;">
         <view class="text-center ss-m-b-50 font-size-20 color-primary">请完善您的基本信息</view>
         <uni-forms
@@ -84,7 +84,7 @@
       <view class="f-horizon-center">
 				<button type="primary" size="default" class="send-button"  @click="submit">提 交</button>
 			</view>
-		</uni-popup>
+		</uni-popup> -->
   </view>
 </template>
 
@@ -98,15 +98,16 @@ import { onLoad } from '@dcloudio/uni-app'
 import { useIM } from '@/hooks/useIM'
 import { watch } from 'vue'
 import AdvertisePop from '@/components/Advertisement'
-import { dictObj } from '@/utils/position.js'
-import { savePersonSimpleInfo } from '@/api/user'
+// import { dictObj } from '@/utils/position.js'
+// import { savePersonSimpleInfo } from '@/api/user'
+// import { showAuthModal } from '@/hooks/useModal'
 
 const useUserStore = userStore()
 const smsLoginRef = ref()
 const protocol = ref(false)
-const popup = ref()
-const baseInfoRef = ref()
-const formData = ref({})
+// const popup = ref()
+// const baseInfoRef = ref()
+// const formData = ref({})
 const state = ref({
   isMobileEnd: false, // 手机号输入完毕
   codeText: '获取验证码',
@@ -120,26 +121,26 @@ const state = ref({
     phone: mobile
   }
 })
-const formRules = {
-	name:{
-		rules: [{required: true, errorMessage: '请输入姓名' }]
-	},
-  phone:{
-		rules: [{required: true, errorMessage: '请输入联系电话' }]
-	},
-	sex : {
-		rules: [{required: true, errorMessage: '请选择您的性别' }]
-	},
-  expType: {
-		rules: [{required: true, errorMessage: '请选择您的工作年限' }]
-	},
-  eduType: {
-		rules: [{required: true, errorMessage: '请选择您的最高学历' }]
-	},
-  jobStatus: {
-		rules: [{required: true, errorMessage: '请选择您的求职状态' }]
-	}
-}
+// const formRules = {
+// 	name:{
+// 		rules: [{required: true, errorMessage: '请输入姓名' }]
+// 	},
+//   phone:{
+// 		rules: [{required: true, errorMessage: '请输入联系电话' }]
+// 	},
+// 	sex : {
+// 		rules: [{required: true, errorMessage: '请选择您的性别' }]
+// 	},
+//   expType: {
+// 		rules: [{required: true, errorMessage: '请选择您的工作年限' }]
+// 	},
+//   eduType: {
+// 		rules: [{required: true, errorMessage: '请选择您的最高学历' }]
+// 	},
+//   jobStatus: {
+// 		rules: [{required: true, errorMessage: '请选择您的求职状态' }]
+// 	}
+// }
 
 const { resetConfig } = useIM()
 watch(() => useUserStore?.accountInfo?.userId, (newVal, oldVal) => {
@@ -197,25 +198,25 @@ const handleLogin = async () => {
   if (!result || !Object.keys(result).length) return
   
   uni.showToast({ icon: 'none', title: '请先完善信息' })
-  formData.value.phone = state.value.sms.phone
-  popup.value.open()
+  // formData.value.phone = state.value.sms.phone
+  // popup.value.open()
 }
 
-const submit = async () => {
-  const validate = await unref(baseInfoRef).validate()
-  if (!validate) return uni.showToast({ title: '请将信息补充完整', icon: 'none' })
-  try {
-    await savePersonSimpleInfo(formData.value)
-    uni.showToast({ title: '保存成功', icon: 'none' })
-    await useUserStore.getInfo()
-    await useUserStore.getUserInfo()
-    uni.switchTab({
-      url: '/pages/index/position'
-    })
-  } catch (err) {
-    uni.showToast({ title: err.msg || '保存失败', icon: 'none' })
-  }
-}
+// const submit = async () => {
+//   const validate = await unref(baseInfoRef).validate()
+//   if (!validate) return uni.showToast({ title: '请将信息补充完整', icon: 'none' })
+//   try {
+//     await savePersonSimpleInfo(formData.value)
+//     uni.showToast({ title: '保存成功', icon: 'none' })
+//     await useUserStore.getInfo()
+//     await useUserStore.getUserInfo()
+//     uni.switchTab({
+//       url: '/pages/index/position'
+//     })
+//   } catch (err) {
+//     uni.showToast({ title: err.msg || '保存失败', icon: 'none' })
+//   }
+// }
 
 
 // const showProtocolToast = () => {

+ 25 - 1
pagesB/positionDetail/index.vue

@@ -206,7 +206,7 @@ import {
 } from '@/api/position'
 import { getPersonResumeCv, saveResume } from '@/api/user'
 import { dealDictObjData } from '@/utils/position'
-import { getAccessToken } from '@/utils/request'
+import { getAccessToken, showNecessaryInfoPopup } from '@/utils/request'
 import { onLoad, onShareAppMessage, onShow } from '@dcloudio/uni-app'
 import { prologue, defaultText } from '@/hooks/useIM'
 import { userStore } from '@/store/user'
@@ -455,6 +455,14 @@ const handleDelivery = async () => {
     showAuthModal()
     return
   }
+  if (showNecessaryInfoPopup()) {
+		uni.showToast({
+			title: '请先完善基本信息',
+			icon: 'none'
+		})
+		showAuthModal('necessaryInfo')
+		return
+	}
   // 已投递
   if (delivery.value) {
     uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
@@ -508,6 +516,14 @@ async function handleSend () {
     showAuthModal()
     return
   }
+  if (showNecessaryInfoPopup()) {
+		uni.showToast({
+			title: '请先完善基本信息',
+			icon: 'none'
+		})
+		showAuthModal('necessaryInfo')
+		return
+	}
   const userId = info.value.contact.userId
   const enterpriseId = info.value.contact.enterpriseId
   const textObj = {
@@ -606,6 +622,14 @@ const handleClickShare = () => {
     showAuthModal()
     return
   }
+  if (showNecessaryInfoPopup()) {
+		uni.showToast({
+			title: '请先完善基本信息',
+			icon: 'none'
+		})
+		showAuthModal('necessaryInfo')
+		return
+	}
   sharePopup.value.open()
 }
 </script>

+ 24 - 7
store/user.js

@@ -1,10 +1,11 @@
 import { defineStore } from 'pinia';
 import { getBaseInfo, getUserInfo } from '@/api/user';
 import { smsLogin, passwordLogin, weChatLogin, logout, userRegister, shareUserRegister } from '@/api/common'
-import { closeAuthModal } from '@/hooks/useModal'
+import { closeAuthModal, showAuthModal } from '@/hooks/useModal'
 import { timesTampChange } from '@/utils/date'
 import { getBaseInfoDictOfName } from '@/utils/getText'
 import { updateEventList } from '@/utils/eventList'
+import { checkPersonBaseInfo } from '@/utils/check'
 
 // 默认用户信息
 const defaultBaseInfo = {
@@ -24,6 +25,8 @@ const defaultAccountInfo = {
   userId: ''
 }
 
+let phone = ''
+
 const tabUrl = [
   'pages/index/position',
   'pages/index/communicate',
@@ -58,12 +61,13 @@ export const userStore = defineStore('user', {
         })
       }
       this.accountInfo = data
-      this.getInfo()
+      const res = await this.getInfo()
       this.getUserInfo()
-      closeAuthModal()
+      return Promise.resolve(res);
     },
 
     async handleRegister (query) {
+      phone = query?.phone || ''
       const { data, code } = await userRegister(query)
       if (code === 0) {
         uni.showToast({
@@ -71,22 +75,22 @@ export const userStore = defineStore('user', {
         })
       }
       this.accountInfo = data
-      this.getInfo()
+      const res = await this.getInfo()
       this.getUserInfo()
-      closeAuthModal()
+      return Promise.resolve(res);
     },
     // 扫码注册登录
     async handleShareUserRegister (query) {
       try {
+        phone = query?.phone || ''
         const { data, code } = await shareUserRegister(query)
         if (code === 0) {
           uni.showToast({
             title: '登录成功'
           })
           this.accountInfo = data
-          this.getInfo()
+          await this.getInfo()
           this.getUserInfo()
-          closeAuthModal()
         }
         return Promise.resolve(data);
       } catch (err) {
@@ -96,10 +100,22 @@ export const userStore = defineStore('user', {
         })
       }
     },
+
+    // 校验是否完善人才必填信息
+    checkPersonBaseInfoFun(data) {
+      data = data || { phone }
+      const necessaryInfoReady = checkPersonBaseInfo(data)
+      data.necessaryInfoReady = necessaryInfoReady
+      if (necessaryInfoReady) closeAuthModal()
+      else showAuthModal('necessaryInfo')
+      uni.setStorageSync('necessaryInfoReady', necessaryInfoReady ? 'ready' : 'fddeaddc47868b');
+    },
+
     // 获取人才信息
     async getInfo() {
       const { code, data } = await getBaseInfo({ userId: this.accountInfo.userId });
       updateEventList() // 更新事件列表
+      this.checkPersonBaseInfoFun(data) // 校验是否完善人才必填信息
       if (code !== 0) {
         return;
       }
@@ -174,6 +190,7 @@ export const userStore = defineStore('user', {
     },
     // 字典对应中文
     async getFieldText (data) {
+      if (!data || !Object.keys(data).length) return {}
       if (data.birthday && data.birthday !== 0) {
         data.birthdayText = timesTampChange(data.birthday, 'Y-M-D') // 出生日期
       }

+ 18 - 0
utils/check.js

@@ -0,0 +1,18 @@
+// 校验是否完善人才必填信息
+export const checkPersonBaseInfo = (info) => {
+  // const info = baseInfo ? baseInfo : localStorage.getItem('baseInfo') ? JSON.parse(localStorage.getItem('baseInfo')) : {}
+  if (!info || !Object.keys(info).length) return false
+  const keyArr = [ // 必填项目
+    'name',
+    'sex',
+    'phone',
+    'email',
+    'birthday',
+    'jobStatus',
+    'expType',
+    'eduType'
+  ]
+  const necessaryInfoReady = keyArr.every(e => info[e] && info[e] !== 0)
+  return necessaryInfoReady
+  // return true // return true关闭弹窗
+}

+ 49 - 0
utils/dealData.js

@@ -0,0 +1,49 @@
+// 获取所有的叶子节点
+export const getLeafNodes = (tree) => {
+  const leafNodes = []
+  function traverse(node) {
+    if (!node.children || node.children.length === 0) {
+      leafNodes.push(node)
+    } else {
+      for (let child of node.children) {
+        traverse(child)
+      }
+    }
+  }
+  // 开始遍历
+  if (!tree?.length) return []
+  for (let rootNode of tree) {
+    traverse(rootNode)
+  }
+  return leafNodes
+}
+
+// 获取所有二级节点
+export const getSecondNodes = (tree) => {
+  let nodes = []
+  for (const rootNode of tree) {
+    if (rootNode.children?.length) nodes = [...nodes, ...rootNode.children]
+  }
+  return nodes
+}
+
+// 找到数组中第一对重复的元素并返回元素及元素在原数组的下标
+export const findFirstDuplicateWithIndices = (arr) => {
+  const elementIndices = new Map();
+  for (let i = 0; i < arr.length; i++) {
+    const element = arr[i];
+    if (elementIndices.has(element)) {
+      // 如果元素已经在 elementIndices 中,返回元素和它的两个下标
+      return {
+        element: element,
+        firstIndex: elementIndices.get(element),
+        secondIndex: i
+      };
+    } else {
+      // 如果元素不在 elementIndices 中,存储它的下标
+      elementIndices.set(element, i);
+    }
+  }
+  // 如果没有找到重复元素,返回 null 或其他表示未找到的值
+  return null;
+}

+ 2 - 0
utils/position.js

@@ -15,6 +15,7 @@ export const dictObj = reactive({
   jobType: [],
   areaTreeData: [],
   areaTreeDataExtend: [],
+  positionSecondData: [],
   eduSystemType: []
 })
 const dictList = ref([
@@ -33,6 +34,7 @@ const dictList = ref([
   { type: 'areaTreeData', value: 'areaTreeData', key: 'areaId', label: 'areaName', params: {}, apiType: 'areaTreeData', nameKey: 'name', valueKey: 'id' },
   { type: 'areaTreeDataExtend', value: 'areaTreeDataExtend', key: 'areaId', label: 'areaName', params: {}, apiType: 'areaTreeDataExtend', nameKey: 'name', valueKey: 'id' },
   { type: 'positionTreeData', value: 'positionTreeData', key: 'positionTreeId', label: 'positionName', params: {}, apiType: 'positionTreeData', nameKey: 'nameCn', valueKey: 'id' },
+  { type: 'positionSecondData', value: 'positionSecondData', key: 'positionSecondId', label: 'positionSecondName', params: {}, apiType: 'positionSecondData', nameKey: 'nameCn', valueKey: 'id' },
   { type: 'industryTreeData', value: 'industryTreeData', key: 'industryTreeId', label: 'industryName', params: {}, apiType: 'industryTreeData', nameKey: 'nameCn', valueKey: 'id' },
 ])
 

+ 5 - 0
utils/request.js

@@ -383,6 +383,11 @@ const getIntegral = (url) => {
   rewardEventTrackClick(url).then(() => {})
 }
 
+/** 获得必填人才信息情况 */
+export const showNecessaryInfoPopup = () => {
+  return uni.getStorageSync('necessaryInfoReady') === 'fddeaddc47868b';
+}
+
 /** 获得访问令牌 */
 export const getAccessToken = () => {
   return uni.getStorageSync('token');

+ 35 - 0
utils/validate.js

@@ -50,6 +50,39 @@ export const code = {
   ],
 };
 
+// 校验邮箱格式
+export const emailFormat = {
+  rules: [
+    {
+      validateFunction: function (rule, value, data, callback) {
+        const emailReg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;  
+        if (!emailReg.test(value)) {
+          callback('邮箱格式不正确');
+        }
+        return true;
+      },
+    },
+  ],
+};
+// 邮箱必填且校验邮箱格式
+export const emailRequired = {
+  rules: [
+    {
+      required: true,
+      errorMessage: '请输入邮箱',
+    },
+    {
+      validateFunction: function (rule, value, data, callback) {
+        const emailReg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;  
+        if (!emailReg.test(value)) {
+          callback('邮箱格式不正确');
+        }
+        return true;
+      },
+    },
+  ],
+};
+
 // 真实姓名
 export const realName = {
   rules: [
@@ -159,6 +192,8 @@ export default {
   realName,
   password,
   code,
+  emailFormat,
+  emailRequired,
   taxNo,
   taxName,
 };