فهرست منبع

网页打开邀请新同事链接加入后不清除登录状态

Xiao_123 6 ماه پیش
والد
کامیت
13498bb6a5

+ 1 - 1
src/store/user.js

@@ -64,7 +64,7 @@ export const useUserStore = defineStore('user',
             updateEventList(true) // 获取规则配置跟踪列表
             await this.getUserInfos()
             this.getUserBaseInfos()
-            resolve()
+            resolve(res)
           }).catch(err => { reject(err) })
         })
       },

+ 17 - 16
src/views/recruit/enterprise/systemManagement/groupAccount/components/record.vue

@@ -55,12 +55,13 @@ const getData = async () => {
   try {
     const info = JSON.parse(localStorage.getItem('entBaseInfo')) || null
     const { list, total: number } = await enterpriseInviteRecordPage(query.value)
-    const invitedNames = await Promise.all(list.map(async () => getInvited()))
-    tableData.value = list.map((e, index) => {
+    // const invitedNames = await Promise.all(list.map(async () => getInvited()))
+    tableData.value = list.map(e => {
       const showInfo = {
         currentAccountEnterpriseAnotherName: info?.enterpriseAnotherName || '--',
         currentAccountUserName: info?.name || '--',
-        invited: invitedNames[index] || '--', // 使用预先获取的invited名称
+        // invited: invitedNames[index] || '--', // 使用预先获取的invited名称
+        invited: e?.enterpriseUser?.enterpriseName || '--', // 使用预先获取的invited名称
         time: e.createTime ? timesTampChange(e.createTime) : '--',
       }
       return { showInfo, ...e }
@@ -72,19 +73,19 @@ const getData = async () => {
   }
 }
 
-const getInvited = async (val) => {
-  try {
-    if (val) {
-      const api = props.inviteType - 0 ? enterpriseInviteRecordPage: enterpriseInviteRecordPage
-      const { data } = await api(query.value)
-      return data.name
-    } else {
-      return '-占位-'
-    }
-  } catch (error) {
-    console.log('error', error)
-  }
-}
+// const getInvited = async (val) => {
+//   try {
+//     if (val) {
+//       const api = props.inviteType - 0 ? enterpriseInviteRecordPage: enterpriseInviteRecordPage
+//       const { data } = await api(query.value)
+//       return data.name
+//     } else {
+//       return '-占位-'
+//     }
+//   } catch (error) {
+//     console.log('error', error)
+//   }
+// }
 getData()
 
 const handleChangePage = (index) => {

+ 10 - 14
src/views/recruit/enterprise/systemManagement/groupAccount/inviteConfirm.vue

@@ -22,6 +22,7 @@
           <v-btn :loading="loginLoading" color="warning" class="white--text mt-5" min-width="350" @click="handleLogin" :style="{'width': isMobile ? '100%' : '350px' }">
             {{ $t('common.confirmJoin') }}
           </v-btn>
+          <div class="font-size-15 text-end color-666 mt-2">提示:未注册的手机号,加入自动注册账号</div>
           <!-- <div class="color-999 mt-2" style="font-size: 13px;">注:确认即代表加入该企业</div> -->
         </template>
       </div>
@@ -48,12 +49,9 @@ import simplePageForm from './components/simplePageForm.vue'
 import { useRoute } from 'vue-router'; const route = useRoute()
 import { enterpriseInviteRecordConsent, getEnterpriseInfoByCode } from '@/api/recruit/enterprise/enterpriseInvite.js'
 import Snackbar from '@/plugins/snackbar'
-import { getToken, setToken, setRefreshToken } from '@/utils/auth'
-import {
-  smsLogin,
-  getBaseInfo,
-  logout
-} from '@/api/common'
+import { getToken } from '@/utils/auth'
+import { getBaseInfo, logout } from '@/api/common'
+import { useUserStore } from '@/store/user'
 import { savePersonSimpleInfo } from '@/api/recruit/personal/shareJob'
 
 
@@ -78,21 +76,19 @@ const handleLogin = async () => {
   loginLoading.value = true
   try {
     const params = { ...phoneRef.value.loginData, autoRegister: true } // 只能验证码登录
-    //
     // 如果用户登录后点击关闭填写简易人才信息,再次点击登录仅弹出填写,不再调用登录
     if (copyLoginData === (params.phone + params.code.toString()) && userId) {
       getUserBaseInfos(userId)
       return
     }
-    const res = await smsLogin(params)
+    const data = await useUserStore().handleSmsLogin(params)
     copyLoginData = params.phone + params.code.toString()
-    setToken(res.accessToken)
-    setRefreshToken(res.refreshToken)
-    userId = res.userId
-    getUserBaseInfos(res.userId)
+    userId = data.userId
+    getUserBaseInfos(data.userId)
   } catch (error) {
     const msg = error?.msg || error
     Snackbar.error(msg)
+    logoutFun()
   } finally {
     loginLoading.value = false
   }
@@ -104,7 +100,6 @@ const getUserBaseInfos = async (userId) => {
   loginLoading.value = true
   try {
     const data = await getBaseInfo({ userId })
-    console.log('data', data)
     if (!data) {
       showSimpleInput.value = true; Snackbar.warning('请先完善个人基本信息')
       return 
@@ -134,7 +129,7 @@ const join = async () => {
   } catch (error) {
     Snackbar.error('加入失败! ' + error)
   } finally {
-    logoutFun()
+    if (isMobile.value) logoutFun() // 网页打开保留登录状态
     loginLoading.value = false
   }
 }
@@ -161,6 +156,7 @@ const simpleInfoSubmit = async () => {
     if (!obj) return
     await savePersonSimpleInfo(obj)
     join()
+    if (!isMobile.value) await useUserStore().getUserBaseInfos() // 网页打开需更新用户信息
     showSimpleInput.value = false
   } catch (error) {
     console.error('error', error)