|
@@ -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>
|