Browse Source

冲突合并

Xiao_123 11 months ago
parent
commit
a7cec988c7

+ 7 - 5
src/layout/personal/navBar.vue

@@ -103,6 +103,7 @@ import { reactive, ref } from 'vue'
 import { getToken } from '@/utils/auth'
 import { useUserStore } from '@/store/user'
 import { useLocaleStore } from '@/store/locale'
+import { useLoginType } from '@/store/loginType'
 import Dialog from '@/components/CtDialog'
 defineOptions({ name: 'personal-navbar' })
 
@@ -113,6 +114,7 @@ defineProps({
   }
 })
 
+const changeLoginType = useLoginType()
 const localeStore = useLocaleStore()
 const userStore = useUserStore()
 
@@ -127,13 +129,13 @@ const router = useRouter()
 const handleLogoClick = () => { router.push({ path: '/home'}) }
 
 const show = ref(false)
-const userType = ref(0) // 0企业用户、1个人用户
+const loginType = ref(1) // 0企业用户、1个人用户
 const changeRole = () => {
-  if (userType.value) {
-    show.value = true
-    router.push({ path: '/enterprise/register' })
+  if (loginType.value) {
+    show.value = true // 选择切换类型
   } else {
-    // 重新走登录拿数据
+    router.push({ path: '/enterprise/home' })
+    changeLoginType.change(0)
   }
 }
 

+ 5 - 1
src/router/modules/remaining.js

@@ -2,6 +2,10 @@ import personal from './personal'
 import enterprise from './enterprise'
 import recruit from './recruit'
 import Layout from '@/layout'
+// import { useSharedState } from '@/store/sharedState'
+// const sharedState = useSharedState()
+// const loginType = sharedState.loginType
+const loginType = 0
 
 // const type  = 0
 const routeArray = [
@@ -50,7 +54,7 @@ const remainingRouter = [
   },
   {
     path: '',
-    component: Layout,
+    component: loginType === 0 ? Layout : null,
     children: [
       {
         path: '',

+ 14 - 0
src/store/loginType.js

@@ -0,0 +1,14 @@
+import { defineStore } from 'pinia'
+
+export const useLoginType = defineStore('changeLoginType', {
+  state: () => ({
+    // loginType: 0
+    loginType: localStorage.getItem('loginType') || 0
+  }),
+  actions: {
+    change(type) {
+      this.loginType = type
+      localStorage.setItem('loginType', type) // 用户登录类型,0:企业, 1:用户
+    }
+  }
+})

+ 0 - 1
src/store/user.js

@@ -63,7 +63,6 @@ export const useUserStore = defineStore('user',
       try {
         const data = await getBaseInfo({ userId: userId || accountInfo.userId })
         baseInfo = await getFieldText(data)
-        console.log('baseInfo->', baseInfo)
         localStorage.setItem('baseInfo', JSON.stringify(baseInfo))
       } catch (error) {
         Snackbar.error(error.msg)

+ 12 - 2
src/views/Home/company/index.vue

@@ -1,11 +1,21 @@
 <template>
-  <div>
-    企业用户首页
+  <div class="text-center mt-5">
+    <div>企业用户首页</div>
+    <v-btn class="half-button mt-5" size="small" color="primary" variant="tonal" @click="handleChange">切换为求职者</v-btn>
   </div>
 </template>
 
 <script setup>
 defineOptions({ name:'enterprise-home-index'})
+// import { useLoginType } from '@/store/loginType'
+// import { useRouter } from 'vue-router'
+
+// const router = useRouter()
+// const changeLoginType = useLoginType()
+const handleChange = () => {
+  // router.push({ path: '/home'})
+  // changeLoginType.change(1)
+}
 </script>
 
 <style lang="scss" scoped>

+ 1 - 1
src/views/enterprise/components/register copy.vue

@@ -1,6 +1,6 @@
 <!-- 企业注册表单 -->
 <template>
-  <div>
+  <div class="default-width pt-5">
     <!-- (输入提示框-> 如果是选择了某个公司,带出公司信息,展开预览信息,点击加入) -->
     <!-- 多个招聘专员注册多个boss账号,但这些账号只能认证一个公司主体。新建的需要门墩后台审核,加入的由公司主体账户审核 -->
       <v-tabs v-model="tab" align-tabs="center" color="primary">