Pārlūkot izejas kodu

求职者:有注册过老师的支持切换

Xiao_123 2 mēneši atpakaļ
vecāks
revīzija
ebfff3e794

+ 31 - 3
src/layout/personal/navBar.vue

@@ -45,7 +45,8 @@
           
           <!-- 头像用户名 -->
           <div class="d-flex align-center color-333" v-if="isLogin">
-            <span class="cursor-pointer mr-5 commonHover" @click="handleSwitch">我要招聘</span>
+            <span class="cursor-pointer mr-5 commonHover" v-if="showTeacherLogin" @click="handleSwitchTeacher">切换为老师</span>
+            <span class="cursor-pointer mr-5 commonHover" v-else @click="handleSwitchEnterprise">我要招聘</span>
             <span class="cursor-pointer commonHover" @click="router.push({ path: paths[6] })">
               <span>
                 现金:{{ userAccount?.balance && userAccount?.balance > 0 ? (userAccount?.balance / 100.0).toFixed(2) : 0 }}
@@ -138,6 +139,7 @@ import MessageNotification from '../message.vue'
 import { getUserAvatar } from '@/utils/avatar'
 import defineListPage from '@/views/entrances/navBar/components/defineListPage'
 import { formatName } from '@/utils/getText'
+import { getSchoolInformation } from '@/api/school'
 
 defineOptions({ name: 'personal-navbar' })
 
@@ -153,10 +155,23 @@ defineProps({
 })
 
 const showBall = ref(false)
+const showTeacherLogin = ref(false)
+
+// 获取老师注册信息
+const schoolInfo = ref({})
+const getSchoolInfo = async () => {
+  const data = await getSchoolInformation()
+  if (data && Object.keys(data).length > 0) {
+    schoolInfo.value = data
+    showTeacherLogin.value = true
+  }
+}
 
-onMounted(() => {
+onMounted(async () => {
   if (getToken()) {
     showBall.value = true
+
+    await getSchoolInfo()
   }
 })
 
@@ -225,7 +240,7 @@ const show = ref(false)
 const radios = ref(null)
 const enterpriseList = ref([])
 // 切换为招聘者
-const handleSwitch = async () => {
+const handleSwitchEnterprise = async () => {
   await getApplyInfo() // 查询申请信息(注册进度)
   const data = await getUserBindEnterpriseList() // 申请通过才有数据,否则空数组
   enterpriseList.value = data || []
@@ -267,6 +282,19 @@ const newRegistering = () => {
   router.replace({ path })
 }
 
+// 跳转老师页面
+const statusList = [
+  { status: '0', path: '/register/school/inReview', key: 'registerSchoolInfo' }, // 审核中
+  { status: '1', path: '/recruit/teacher/studentList/index', key: 'schoolInfo' }, // 审核通过
+  { status: '2', path: '/register/school/inReview', key: 'registerSchoolInfo' }, // 审核不通过
+]
+const handleSwitchTeacher = () => {
+  const obj = statusList.find(item => item.status === schoolInfo.value?.authStatus)
+  if (!obj || !schoolInfo.value) return
+  localStorage.setItem(obj.key, JSON.stringify(schoolInfo.value))
+  router.push({ path: obj.path })
+}
+
 const handleToPersonalCenter = () => {
   router.push({ path: paths[5] })
 }

+ 2 - 7
src/store/user.js

@@ -283,8 +283,8 @@ export const useUserStore = defineStore('user',
           console.log('没有注册过,直接跳转到学校注册页面')
           router.push({ path: '/register/schoolIndex' })
         }
-        else if (data?.authStatus === '0') {
-          console.log('审核中,等待审核')
+        else if (data?.authStatus === '0' || data?.authStatus === '2') {
+          console.log('审核中,等待审核  || 审核不通过,重新填写信息提交', data.authStatus)
           localStorage.setItem('registerSchoolInfo', JSON.stringify(data))
           router.push({ path: '/register/school/inReview' })
         }
@@ -293,11 +293,6 @@ export const useUserStore = defineStore('user',
           console.log('审核通过直接进入老师页面')
           router.push('/recruit/teacher') 
         }
-        else if (data?.authStatus === '2') {
-          console.log('审核不通过,重新填写信息提交')
-          localStorage.setItem('registerSchoolInfo', JSON.stringify(data))
-          router.push({ path: '/register/school/inReview' })
-        }
       }
     }
   },

+ 11 - 2
src/views/recruit/teacher/studentList/index.vue

@@ -7,7 +7,8 @@
         <Autocomplete class="mr-3" v-model="query.schoolDeptId" :item="schoolDepartmentItem"></Autocomplete>
         <TextInput class="mr-3" v-model="query.name" :item="studentNameItem" @enter="handleSearch()"></TextInput>
         <v-btn color="primary" class="half-button ml-3" @click="handleSearch()">查 询</v-btn>
-        <v-btn class="half-button ml-3" prepend-icon="mdi-refresh" variant="outlined" color="primary" @click="handleSearch(true)">刷 新</v-btn>
+        <v-btn class="half-button ml-3" prepend-icon="mdi-refresh" variant="outlined" color="primary" @click="handleReset">重 置</v-btn>
+        <v-btn class="half-button ml-3" prepend-icon="mdi-refresh" variant="outlined" color="warning" @click="handleSearch(true)">刷 新</v-btn>
       </div>
       <!-- <v-btn :loading="exportLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="null">导出</v-btn> -->
     </div>
@@ -87,7 +88,7 @@ const studentNameItem = ref({
   type: 'text',
   width: 300,
   label: '请输入学生姓名搜索',
-  clearable: true,
+  clearable: false,
   hideDetails: true
 })
 const enterpriseId = ref(null)
@@ -134,6 +135,14 @@ const handleSearch = (refresh = false) => {
   getData(refresh)
 }
 
+// 重置
+const handleReset = () => {
+  query.value.pageNo = 1
+  query.value.name = null
+  query.value.schoolDeptId = null
+  getData()
+}
+
 const schoolInfo = ref(localStorage.getItem('schoolInfo') ? JSON.parse(localStorage.getItem('schoolInfo')) : {})
 const schoolDepartmentItem = ref({ width: 300, items: [], clearable: false, hideDetails: true, label: '请选择院系', itemText: 'name', itemValue: 'id' })