فهرست منبع

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

lifanagju_citu 1 سال پیش
والد
کامیت
b7895fbf3b

+ 8 - 0
src/api/common/index.js

@@ -117,4 +117,12 @@ export const getHotArea = async () => {
   return await request.get({
     url: '/app-api/menduner/system/area/get/hot'
   })
+}
+
+// 获取人才信息
+export const getBaseInfo = async (params) => {
+  return await request.get({
+    url: '/app-api/menduner/system/person/get',
+    params
+  })
 }

+ 9 - 8
src/layout/personal/navBar.vue

@@ -14,7 +14,7 @@
             <p class="nav-city-box">
               <v-icon color="primary">mdi-map-marker</v-icon>
               <span class="nav-city-selected">广州</span>
-              <span class="switchover-city nav-city-selected">[切换城市]</span>
+              <span class="switchover-city nav-city-selected">[{{ $t('sys.switchCities') }}]</span>
             </p>
           </div>
           <div class="nav">
@@ -29,22 +29,22 @@
         <div class="d-flex user-nav">
           <div class="btns d-flex align-center" v-if="!getToken()">
             <span class="nav-resume-tools">
-              <a href="">我要找工作</a>
-              <a href="">我要招聘</a>
+              <a href="">{{ $t('sys.lookingJob') }}</a>
+              <a href="">{{ $t('sys.recruit') }}</a>
             </span>
-            <v-btn class="half-button" border color="primary" size="small" @click="handleLogin">登录/注册</v-btn>
+            <v-btn class="half-button" border color="primary" size="small" @click="handleLogin">{{ $t('login.register') }}</v-btn>
           </div>
           
           <!-- 头像用户名 -->
           <div class="d-flex align-center" v-if="getToken()">
-            <span style="cursor: pointer;">消息</span>
+            <span style="cursor: pointer;">{{ $t('sys.news') }}</span>
             <v-menu open-on-hover>
               <template v-slot:activator="{ props }">
                 <div class="d-flex ml-5 pl-2 align-center cursor-pointer" v-bind="props" @click="handleToPersonalCenter">
                   <v-avatar>
-                    <v-img alt="John" src="https://cdn.vuetifyjs.com/images/john.jpg"></v-img>
+                    <v-img alt="John" :src="baseInfo.avatar ?? 'https://cdn.vuetifyjs.com/images/john.jpg'"></v-img>
                   </v-avatar>
-                  <div class="ml-2">游客</div>
+                  <div class="ml-2">{{ baseInfo.name ?? $t('sys.tourist') }}</div>
                 </div>
               </template>
 
@@ -110,6 +110,8 @@ defineProps({
 })
 
 const localeStore = useLocaleStore()
+const userStore = useUserStore()
+const baseInfo = userStore.baseInfo // 人才信息
 
 const list = ref([
   { text: '首页', path: '/home' },
@@ -136,7 +138,6 @@ const handleToPersonalCenter = () => {
 }
 
 // 退出登录
-const userStore = useUserStore()
 const handleLogout = async () => {
   // try {
     await userStore.userLogout()

+ 6 - 1
src/locales/en.js

@@ -24,7 +24,12 @@ export default {
       errMsg504: 'Network timeout!',
       errMsg505: 'The http version does not support the request!',
       errMsg901: 'Demo mode, no write operations are possible!'
-    }
+    },
+    tourist: 'Tourist',
+    news: 'News',
+    lookingJob: 'Looking For Job',
+    recruit: 'Recruit',
+    switchCities: 'Switch Cities'
   },
   login: {
     username: 'Username',

+ 6 - 1
src/locales/zh-CN.js

@@ -24,7 +24,12 @@ export default {
       errMsg504: '网络超时!',
       errMsg505: 'http版本不支持该请求!',
       errMsg901: '演示模式,无法进行写操作!'
-    }
+    },
+    tourist: '游客',
+    news: '消息',
+    lookingJob: '我要找工作',
+    recruit: '我要招聘',
+    switchCities: '切换城市'
   },
   login: {
     username: '用户名',

+ 17 - 1
src/store/user.js

@@ -1,7 +1,7 @@
 import { defineStore } from 'pinia'
 import { reactive } from 'vue'
 import { setToken, removeToken } from '@/utils/auth'
-import { smsLogin, passwordLogin } from '@/api/common/index'
+import { smsLogin, passwordLogin, getBaseInfo } from '@/api/common/index'
 import { logout } from '@/api/common/index'
 import { getUserInfo } from '@/api/personal/user'
 import Snackbar from '@/plugins/snackbar'
@@ -10,6 +10,7 @@ export const useUserStore = defineStore('user',
   () => {
     let accountInfo = reactive({}) // 登录返回的信息
     let userInfo = reactive({}) // 当前登录账号信息
+    let baseInfo = reactive({}) // 人才信息
 
     // 短信登录
     const handleSmsLogin = async (data) => {
@@ -21,6 +22,7 @@ export const useUserStore = defineStore('user',
           localStorage.setItem('accountInfo', JSON.stringify(res))
           localStorage.setItem('expiresTime', res.expiresTime) // token过期时间
           getUserInfos()
+          getUserBaseInfos()
           resolve()
         }).catch(err => { reject(err) })
       })
@@ -36,6 +38,7 @@ export const useUserStore = defineStore('user',
           localStorage.setItem('accountInfo', JSON.stringify(res))
           localStorage.setItem('expiresTime', res.expiresTime) // token过期时间
           getUserInfos()
+          getUserBaseInfos()
           resolve()
         }).catch(err => { reject(err) })
       })
@@ -52,16 +55,29 @@ export const useUserStore = defineStore('user',
       }
     }
 
+    // 获取当前登录账户的基本信息(人才信息)
+    const getUserBaseInfos = async () => {
+      try {
+        const data = await getBaseInfo({ userId: accountInfo.userId })
+        baseInfo = data
+        localStorage.setItem('baseInfo', JSON.stringify(data))
+      } catch (error) {
+        Snackbar.error(error.msg)
+      }
+    }
+
     // 退出登录
     const userLogout = async () => {
       await logout()
       removeToken()
       userInfo = {}
+      baseInfo = {}
       accountInfo = {}
       localStorage.clear()
     }
     return {
       userInfo,
+      baseInfo,
       handleSmsLogin,
       userLogout,
       handlePasswordLogin

+ 1 - 1
src/styles/personal/navBar.css

@@ -67,7 +67,7 @@
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
-  max-width: 84px;
+  max-width: 95px;
   vertical-align: middle;
 }
 

+ 1 - 1
src/styles/personal/navBar.min.css

@@ -1 +1 @@
-.user-nav .nav-resume-tools{display:inline-block;vertical-align:middle}.user-nav .nav-resume-tools>a{display:inline-block;font-weight:500;color:var(--v-primary-base);line-height:20px;height:auto;padding:3px 7px;vertical-align:middle;border-radius:4px;margin-right:8px;border:1px solid transparent}.banner{width:100%;height:50px;z-index:var(--zIndex-nav) !important;color:#fff;background-color:#d5e6e8;padding-left:0px;height:50px;font-size:14px}.banner .left{height:100%;display:flex;align-items:center;font-size:20px;cursor:pointer}.hover:hover{cursor:pointer;background:rgba(0,0,0,0.03)}.innerBox{position:relative;width:1184px;max-width:1184px;margin:0 auto;align-items:center}.nav-logo{float:left}.nav-city{float:left;position:relative;cursor:pointer;height:49px;line-height:49px;color:var(--v-primary-base);margin-left:50px}.nav-city-selected{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:84px;vertical-align:middle}.switchover-city{color:var(--v-primary-base);margin-left:10px}.nav{font-size:0;float:left;margin-left:50px;height:49px;line-height:49px}.nav ul{display:flex;white-space:nowrap;vertical-align:top}.nav ul li{text-align:center;font-size:14px;margin:0 5px;list-style:none}.nav li a{display:block;padding:0 5px;position:relative;text-decoration:none;color:var(--v-primary-base)}.user-nav{color:var(--v-primary-base)}.user-nav .btns .btn-outline{border-radius:8px;text-align:center;font-size:14px;height:26px;line-height:26px;min-width:0;padding:0 11px;margin-left:14px;background-color:transparent}.user-nav .btn{display:inline-block;box-sizing:content-box;border:1px solid var(--v-primary-base);letter-spacing:1px;cursor:pointer}.user-nav a{text-decoration:none}
+.user-nav .nav-resume-tools{display:inline-block;vertical-align:middle}.user-nav .nav-resume-tools>a{display:inline-block;font-weight:500;color:var(--v-primary-base);line-height:20px;height:auto;padding:3px 7px;vertical-align:middle;border-radius:4px;margin-right:8px;border:1px solid transparent}.banner{width:100%;height:50px;z-index:var(--zIndex-nav) !important;color:#fff;background-color:#d5e6e8;padding-left:0px;height:50px;font-size:14px}.banner .left{height:100%;display:flex;align-items:center;font-size:20px;cursor:pointer}.hover:hover{cursor:pointer;background:rgba(0,0,0,0.03)}.innerBox{position:relative;width:1184px;max-width:1184px;margin:0 auto;align-items:center}.nav-logo{float:left}.nav-city{float:left;position:relative;cursor:pointer;height:49px;line-height:49px;color:var(--v-primary-base);margin-left:50px}.nav-city-selected{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:95px;vertical-align:middle}.switchover-city{color:var(--v-primary-base);margin-left:10px}.nav{font-size:0;float:left;margin-left:50px;height:49px;line-height:49px}.nav ul{display:flex;white-space:nowrap;vertical-align:top}.nav ul li{text-align:center;font-size:14px;margin:0 5px;list-style:none}.nav li a{display:block;padding:0 5px;position:relative;text-decoration:none;color:var(--v-primary-base)}.user-nav{color:var(--v-primary-base)}.user-nav .btns .btn-outline{border-radius:8px;text-align:center;font-size:14px;height:26px;line-height:26px;min-width:0;padding:0 11px;margin-left:14px;background-color:transparent}.user-nav .btn{display:inline-block;box-sizing:content-box;border:1px solid var(--v-primary-base);letter-spacing:1px;cursor:pointer}.user-nav a{text-decoration:none}

+ 1 - 1
src/styles/personal/navBar.scss

@@ -59,7 +59,7 @@
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
-  max-width: 84px;
+  max-width: 95px;
   vertical-align: middle;
 }
 .switchover-city {