Xiao_123 7 месяцев назад
Родитель
Сommit
a7795a12ea

+ 4 - 1
src/components/Enterprise/components/positions.vue

@@ -246,14 +246,17 @@ const desc = [
   { mdi: 'mdi-clock-time-ten-outline', value: 'expName' }
 ]
 
+let toDetailsInfo = {}
 // 沟通
 const toDetails = async (info) => {
+  if (info) toDetailsInfo = info // 快速登录弹窗回调使用
+  else info = toDetailsInfo
   if (!getToken()) {
     showLogin.value = true // 打开快速登录弹窗
     Snackbar.warning('您还未登录,请先登录后再试')
     //
     loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
-    nextFunc.value = null // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
+    nextFunc.value = toDetails // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
     return
   }
   const userId = info.contact.userId

+ 4 - 1
src/components/Position/longStrip.vue

@@ -99,14 +99,17 @@ const handleToEnterprise = (item) => {
   router.push(`/recruit/personal/company/details/${item.enterprise.id}?key=briefIntroduction`)
 }
 
+let toDetailsInfo = {}
 // 立即沟通
 const toDetails = async (info) => {
+  if (info) toDetailsInfo = info // 快速登录弹窗回调使用
+  else info = toDetailsInfo
   if (!getToken()) {
     showLogin.value = true // 打开快速登录弹窗
     Snackbar.warning('您还未登录,请先登录后再试')
     //
     loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
-    nextFunc.value = null // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
+    nextFunc.value = toDetails // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
     return
   }
   const userId = info.contact.userId

+ 2 - 2
src/layout/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="parent" @click="layoutClick">
-    <Headers class="headers"></Headers>
+    <NavBar class="headers"></NavBar>
     <div class="content">
       <router-view></router-view>
       <!-- <router-view v-slot="{ Component }">
@@ -16,7 +16,7 @@
 </template>
 
 <script setup>
-import Headers from './personal/navBar.vue'
+import NavBar from './personal/navBar.vue'
 import Footers from './personal/footer.vue'
 import Slider from './personal/slider.vue'
 import { useSharedState } from '@/store/sharedState'

+ 1 - 2
src/layout/personal/navBar.vue

@@ -150,8 +150,6 @@ onMounted(() => {
   }
 })
 
-// const useIM = useIMStore()
-
 const { t } = useI18n()
 // const localeStore = useLocaleStore()
 const userStore = useUserStore()
@@ -272,6 +270,7 @@ userStore.$subscribe((mutation, state) => {
   if (Object.keys(state.baseInfo).length) baseInfo.value = state.baseInfo
   if (state.userInfo && Object.keys(state.userInfo).length) userInfo.value = state?.userInfo
   if (Object.keys(state.userAccount).length) userAccount.value = state.userAccount
+  if (state.token) showBall.value = true
 })
 
 const handleLogin = () => {

+ 2 - 0
src/store/user.js

@@ -26,6 +26,7 @@ import { getBaseInfoDictOfName } from '@/utils/getText'
 export const useUserStore = defineStore('user',
   {
     state: () => ({
+      token: getToken(),
       accountInfo: localStorage.getItem('accountInfo') ? JSON.parse(localStorage.getItem('accountInfo')) : {}, // 登录返回的信息
       userInfo: localStorage.getItem('userInfo') ? JSON.parse(localStorage.getItem('userInfo')) : {}, // 当前登录账号信息
       baseInfo: localStorage.getItem('baseInfo') ? JSON.parse(localStorage.getItem('baseInfo')) : {}, // 人才信息
@@ -53,6 +54,7 @@ export const useUserStore = defineStore('user',
       handleSmsLogin (data) {
         return new Promise((resolve, reject) => {
           smsLogin(data).then(async res => {
+            this.token = res.accessToken
             setToken(res.accessToken)
             setRefreshToken(res.refreshToken)
             this.accountInfo = res

+ 7 - 10
src/views/recruit/personal/position/components/details.vue

@@ -157,7 +157,7 @@
 
 <script setup>
 defineOptions({ name: 'position-details' })
-import { nextTick, ref } from 'vue'
+import { ref } from 'vue'
 import { useRouter } from 'vue-router'
 import Snackbar from '@/plugins/snackbar'
 import html2canvas from 'html2canvas'
@@ -181,7 +181,7 @@ const props = defineProps({
     default: true
   },
   propJobId: {
-    type: String,
+    type: [String, Number],
     default: ''
   },
 })
@@ -241,9 +241,7 @@ let loginCloseWarningWord = ''
 const loginSuccess = () => {
   showLogin.value = false
   Snackbar.success('登录成功')
-  nextTick(() => {
-    if (nextFunc.value) nextFunc.value()
-  })
+  if (nextFunc.value) nextFunc.value()
 }
 
 const loginClose = () => {
@@ -429,17 +427,17 @@ const handleSubmit = async (val) =>{
   }, 3000)
 }
 
-// let toDetailsInfo = {}
+let toDetailsInfo = {}
 // 沟通
 const toDetails = async (info) => {
-  // if (info) toDetailsInfo = info // 快速登录弹窗回调使用
-  // else info = toDetailsInfo
+  if (info) toDetailsInfo = info // 快速登录弹窗回调使用
+  else info = toDetailsInfo
   if (!getToken()) {
     showLogin.value = true // 打开快速登录弹窗
     Snackbar.warning('您还未登录,请先登录后再试')
     //
     loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
-    nextFunc.value = null // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
+    nextFunc.value = toDetails // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
     return
   }
   try {
@@ -449,7 +447,6 @@ const toDetails = async (info) => {
       text: defaultText,
       positionInfo: positionInfo.value
     }
-    console.log(textObj)
     await prologue({userId, enterpriseId, text: JSON.stringify(textObj)})
     let url = `/recruit/personal/message?id=${info.id}`
     if (info.contact.enterpriseId) {