瀏覽代碼

Merge branch 'recruit-enterprise' of https://git.citupro.com/zhengnaiwen_citu/menduner-uniapp into recruit-enterprise

Xiao_123 1 月之前
父節點
當前提交
cb70d6578e

+ 15 - 15
components/PositionList/index.vue

@@ -74,6 +74,7 @@ import { ref } from 'vue'
 import { timesTampChange } from '@/utils/date'
 import { formatName } from '@/utils/getText'
 import payPopup from '@/components/payPopup'
+import { userStore } from '@/store/user'; const useUserStore = userStore()
 import {
   topJobAdvertisedCancel,
   topJobAdvertised,
@@ -81,7 +82,6 @@ import {
   closeJobAdvertised,
   enableJobAdvertised
 } from '@/api/new/position'
-import { userStore } from '@/store/user'; const useUserStore = userStore()
 const emit = defineEmits(['entClick', 'refresh'])
 const props = defineProps({
   tab: { type: Number, default: 0 },
@@ -99,7 +99,7 @@ const toPay = async (val) => {
   // 待发布且有额度的激活职位即可
   if (userInfo.value.entitlement?.publishJobCount > 0) {
     await enableJobAdvertised([val.id])
-    emit('refresh', true)
+    emit('refresh', { reset: true, updatePublishJobCount: true })
     setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success' }) }, 1000)
     return
   }
@@ -134,12 +134,12 @@ const handleAction = async (index, type, { id }, item) => {
 
     // 没有可发布额度激活职位需重新付款
     userInfo.value = await useUserStore.getUserInfos()
-    if (index === 1 && userInfo.value?.entitlement.publishJobCount <= 3990039900) {
+    if (index === 1 && userInfo.value?.entitlement?.publishJobCount-0 <= 0) {
       toPay(item)
       return
     }
     await apiList[index](ids)
-    emit('refresh', true)
+    emit('refresh', { reset: true })
     setTimeout(() => { uni.showToast({ title: '操作成功', icon: 'success' }) }, 1000)
     // 
   } catch (error) {
@@ -155,18 +155,18 @@ const handleClose = () => {
 }
 
 // 取消置顶
-const topUpSvgClickVal = ref({})
-const topUpSvgClick = (item) => {
-  topUpSvgClickVal.value = item
-  confirmType.value = 'topUpJob' // 确认框类型
-  const positionName = item?.name ? '【' + formatName(item?.name) + '】职位' : '职位'
-  dialogContent.value = `是否取消置顶${positionName}?`
-  confirm.value.open()
-}
+// const topUpSvgClickVal = ref({})
+// const topUpSvgClick = (item) => {
+//   topUpSvgClickVal.value = item
+//   confirmType.value = 'topUpJob' // 确认框类型
+//   const positionName = item?.name ? '【' + formatName(item?.name) + '】职位' : '职位'
+//   dialogContent.value = `是否取消置顶${positionName}?`
+//   confirm.value.open()
+// }
 
 const handleConfirm = () => {
   if (confirmType.value === 'closeJob') closeJob()
-  if (confirmType.value === 'topUpJob') handleAction(4, '', topUpSvgClickVal.value)
+  // if (confirmType.value === 'topUpJob') handleAction(4, '', topUpSvgClickVal.value)
 }
 
 // 关闭职位
@@ -174,7 +174,7 @@ const closeJob = async () => {
   try {
     uni.showLoading({ title: '关闭中...', mask: true })
     await apiList[handleActionInfo?.index](handleActionInfo?.ids)
-    emit('refresh', true)
+    emit('refresh', { reset: true })
     setTimeout(() => { uni.showToast({ title: '关闭成功', icon: 'success' }) }, 1000)
   } catch (error) {
     uni.showToast({ title: '关闭失败', icon: 'error' })
@@ -208,7 +208,7 @@ const handleToResume = (val) => {
 }
 
 const paySuccess = () => {
-  emit('refresh', true)
+  emit('refresh', { reset: true })
   setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success', duration: 2000 }) }, 1000)
 }
 

+ 0 - 1
components/positionItem/components/extend.vue

@@ -80,7 +80,6 @@ const getQuery = () => {
     major:  majorDataClone.value?.length ? majorName.value : '',
     majorId:  majorDataClone.value?.length ? majorDataClone.value.find(e => e.nameCn === majorName.value)?.id : ''
   }
-  console.log('扩展信息:', obj)
   return obj
 }
 

+ 1 - 2
components/positionItem/index.vue

@@ -121,11 +121,10 @@ const getSubmitParams = async() => {
   }
   
   if (jobId.value) submitParams.id = jobId.value  // 有id则为编辑
-  debugger
   saveEmit()
 }
 // 
-const price = 1 // 39900
+const price = 39900 // 39900 职位价格,传递单位:分
 const isStudent = ref(false)
 let _jobId = ''
 const saveEmit = async (retry) => {

+ 3 - 2
pages/index/loading.vue

@@ -24,14 +24,15 @@ const tabBarControl = (show = false) => { // 显示/隐藏 TabBar
 
 onShow(async() => {
   tabBarControl(false) // 隐藏页面底部导航
+  
   // 检查是否是个人令牌
   if (getAccessToken() && uni.getStorageSync('isPersonalToken')) {
-    
     // 查看用户是否有在申请中的数据
-    const { code } =  await useUserStore.getPersonalApplyingData()
+    const { code } = await useUserStore.getPersonalApplyingData()
     uni.redirectTo({ url: code ? '/pages/register/review?hasData=true' : '/pages/register/index' })
     return
   }
+
 	if (!getAccessToken()) showAuthModal()
   uni.reLaunch({ url: '/pages/index/search' }) // 进入门墩儿
 })

+ 24 - 1
pages/index/position.vue

@@ -19,6 +19,10 @@
               :focus="false"
               @confirm="onSearch"
             ></uni-search-bar>
+            <!-- 可发布职位数 -->
+            <view class="publishJobCountBox">
+              <span>可发布职位数 <span class="color-primary">{{ publishJobCount }}</span> 个</span>
+            </view>
           </view>
           <view v-if="!positionListData?.length && more !== 'loading'" class="d-flex flex-column align-center justify-center ss-m-t-30">
             <view class="nodata-img-parent">
@@ -55,6 +59,7 @@ import { getJobAdvertisedList } from '@/api/new/position'
 import { onShow, onLoad } from '@dcloudio/uni-app'
 import { getAccessToken } from '@/utils/request'
 import { showAuthModal } from '@/hooks/useModal'
+import { userStore } from '@/store/user'; const useUserStore = userStore()
 
 const tab = ref(1)
 
@@ -126,8 +131,16 @@ onShow(() => {
   // 设置当前tab页的下标index
   currentTabBar?.setData({ selected: 1 })
   init()
+  getPublishJobCount()
 })
 
+const publishJobCount = ref(0)
+const getPublishJobCount = async () => {
+  const info = await useUserStore.getUserInfos()
+  console.log('info:', info)
+  publishJobCount.value = info?.entitlement?.publishJobCount - 0 || 0
+}
+
 const init = () => {
   query.value.pageNo = 1
   getData()
@@ -147,7 +160,8 @@ const loadingMore = () => {
   getData()
 }
 
-const refresh = (reset = false) => {
+// reset: 刷新列表
+const refresh = async ({ reset = false }) => {
   if (reset) query.value.pageNo = 1
   getData()
 }
@@ -257,4 +271,13 @@ const handleClickAdd = () => {
     }
   }
 }
+.publishJobCountBox {
+  font-size: 12px;
+  margin-left: 30rpx;
+  color: #666;
+  padding-bottom: 10px;
+  .color-primary {
+    font-weight: bold;
+  }
+}
 </style>

+ 4 - 2
pages/register/contact.vue

@@ -39,7 +39,7 @@
 import { ref, computed } from 'vue'
 import { userStore } from '@/store/user'
 import { onLoad } from '@dcloudio/uni-app'
-import { realName, mobile, emailRequired, password } from '@/utils/validate'
+import { mobile, emailRequired, password } from '@/utils/validate'
 import { enterpriseRegisterApply } from '@/api/enterprise'
 
 const useUserStore = userStore()
@@ -49,7 +49,9 @@ console.log(adminUserPhone.value, '注册手机号', register.value)
 
 const formRef = ref()
 const formRules = {
-	contactName: realName,
+	contactName: {
+		rules: [{required: true, errorMessage: '请输入姓名' }]
+	},
   phone: mobile,
 	email: emailRequired,
 	password,

+ 31 - 10
pages/register/review.vue

@@ -1,11 +1,11 @@
 <template>
-	<view style="padding: 15px;">
+	<view v-if="show" style="padding: 15px;">
 		<!-- 提交企业注册以后跳转显示页面 -->
 		<view v-if="!applyInfo?.status">
 			<view class="d-flex flex-column align-center">
 				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
 			</view>
-			<view style="text-align: center;"><span class="color-primary font-size-20 font-weight-bold">您的企业注册申请已提交</span></view>
+			<view class="text-center"><span class="color-primary font-size-20 font-weight-bold">您的企业注册申请已提交</span></view>
       <view class="mt-5">审核时间预计在1~3个工作日内,申请结果会以短信方式通知到您的手机上,请注意查收。</view>
       <view style="width: 100%;">
         <view class="mt-5 mb-1">如有疑问请长按二维码添加下方企业微信联系我们:</view>
@@ -14,6 +14,7 @@
         </view>
         <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
       </view>
+			<button class="recomm-button" @tap="refresh">刷新结果</button>
 		</view>
 		<!-- 等待审核 -->
 		<view v-else-if="applyInfo?.status === '0'">
@@ -33,6 +34,7 @@
         </view>
         <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
       </view>
+			<button class="recomm-button" @tap="refresh">刷新结果</button>
 		</view>
 
 		<!-- 审核不通过 -->
@@ -55,13 +57,18 @@
         </view>
         <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
       </view>
-		</view>
-
-		<view>
-			<!-- <button :class="{'second-button': applyInfo.status === '2', 'send-button': applyInfo.status !== '2'}" @tap="handleToHome">回到首页</button> -->
-			<button v-if="applyInfo?.status === '2'" class="recomm-button" @tap="handleConfirm">重新提交</button>
+			<button class="recomm-button" @tap="handleConfirm">重新提交</button>
 			<button class="recomm-button" @tap="refresh">刷新结果</button>
 		</view>
+		
+		<!-- 审核通过  -->
+		<view v-else-if="applyInfo?.status === '1'" class="ss-m-b-100">
+			<view class="d-flex flex-column align-center">
+				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
+			</view>
+			<view class="text-center"><span class="color-primary font-size-20 font-weight-bold">您的企业注册申请已通过</span></view>
+			<button class="recomm-button" @tap="toLogin">前往门墩儿招聘</button>
+		</view>
 	</view>
 </template>
 
@@ -69,11 +76,12 @@
 import { ref } from 'vue'
 import { getUserRegisterEnterpriseApply } from '@/api/enterprise.js'
 import { timesTampChange } from '@/utils/date'
-import { onLoad } from '@dcloudio/uni-app'
+import { onLoad, onShow } from '@dcloudio/uni-app'
 import { userStore } from '@/store/user'
 
 const user = userStore()
 const applyInfo = ref({})
+const show = ref(false)
 
 // 查看用户是否有在申请中的数据
 const getApplyInfo = async () => {
@@ -86,7 +94,7 @@ const getApplyInfo = async () => {
 		result = data || {}
 		uni.setStorageSync('entRegisterData', JSON.stringify(result))
 	}
-	
+
   applyInfo.value = {
 		phone: result.phone,
     createTime: timesTampChange(result.createTime), // 创建时间
@@ -107,6 +115,10 @@ onLoad((options) => {
 	getApplyInfo()
 })
 
+onShow(() => {
+	show.value = true
+})
+
 const refresh = async () => {
 	hasData = false
 	await getApplyInfo()
@@ -116,11 +128,21 @@ const refresh = async () => {
 // 回到首页时需将当前个人登录状态及缓存中的数据清除
 const handleToHome = async () => {
 	await user.handleUserLogout()
+	uni.removeStorageSync('isPersonalToken') // 注册企业时个人登录
 	uni.reLaunch({
 		url: '/pages/index/my'
 	})
 }
 
+// 进入平台时需将当前个人登录状态及缓存中的数据清除
+const toLogin = async () => {
+	await user.handleUserLogout()
+	uni.removeStorageSync('token');
+	uni.removeStorageSync('refresh-token');	
+	uni.removeStorageSync('isPersonalToken') // 注册企业时个人登录
+  uni.reLaunch({ url: '/pages/index/search' }) // 进入门墩儿
+}
+
 const handleConfirm = () => {
 	if (uni.getStorageSync('token') && uni.getStorageSync('isPersonalToken')) {
 		uni.navigateTo({ url: '/pages/register/index' })
@@ -133,5 +155,4 @@ const handleConfirm = () => {
 </script>
 
 <style scoped lang="scss">
-
 </style>

+ 12 - 4
store/user.js

@@ -92,7 +92,7 @@ export const userStore = defineStore('user', {
     // 查看用户是否有在申请中的数据
     async getPersonalApplyingData () {
       const { data } = await getUserRegisterEnterpriseApply()
-      const bool = data && Object.keys(data).length > 0 && data.status !== '1'
+      const bool = data && Object.keys(data).length > 0
       uni.setStorageSync('entRegisterData', bool ? JSON.stringify(data) : "") // 企业注册申请中的数据
       return Promise.resolve({ code: bool ? 1 : 0 , data: bool ? JSON.stringify(data) : "" });
     },
@@ -146,13 +146,21 @@ export const userStore = defineStore('user', {
 
     // 登出系统
     async handleLogout() {
-      await logout(uni.getStorageSync('token'))
-      this.resetUserData();
-      return !this.isLogin;
+      try {
+        await logout(uni.getStorageSync('token'))
+        this.resetUserData()
+      } catch (error) {
+        console.log('handleLogout:error', error)
+        // if (error?.msg === '企业登录授权错误,请重新登录')
+        this.resetUserData()
+      }
+      // return !this.isLogin;
     },
     // 账号注册-回到首页
     async handleUserLogout () {
       await userLogout()
+      uni.removeStorageSync('isPersonalToken') // 注册企业时个人登录
+      uni.removeStorageSync('entRegisterData') // 企业注册申请中的数据
       this.resetUserData()
       return !this.isLogin
     },