zhengnaiwen_citu пре 7 месеци
родитељ
комит
07e9eee17c

+ 2 - 2
components/ResumeStatus/index.vue

@@ -27,8 +27,8 @@ import { getDict } from '@/hooks/useDictionaries.js'
 import { userStore } from '@/store/user'
 const useUserStore = userStore()
 
-watch(() => useUserStore.isLogin, (newVal, oldVal) => {
-  if (useUserStore.isLogin) {
+watch(() => useUserStore.refreshToken, (newVal, oldVal) => {
+  if (useUserStore.refreshToken) {
 		// 监听登录状态
 		console.log('重新登录了')
 		recommendCount()

+ 1 - 1
layout/index.vue

@@ -27,7 +27,7 @@ import { userStore } from '@/store/user'
 const { resetConfig } = useIM()
 const useUserStore = userStore()
 watch(() => useUserStore.accountInfo.userId, (newVal, oldVal) => {
-  if (useUserStore.isLogin) {
+  if (useUserStore.refreshToken) {
 		// 监听登录状态
     resetConfig()
 	}

+ 8 - 8
pages/index/communicate.vue

@@ -55,13 +55,13 @@ const useUserStore = userStore()
 
 const items = ref([])
 
-watch(() => useUserStore.isLogin, (newVal, oldVal) => {
-  if (useUserStore.isLogin) {
+watch(
+	() => useUserStore.refreshToken, (newVal, oldVal) => {
 		// 监听登录状态
-		console.log('重新登录')
+		console.log('重新登录, 更新列表')
 		init()
 	}
-})
+)
 
 onShow(() => {
 	init()
@@ -100,14 +100,14 @@ const handleTo = ({ userInfoVo, thatName, postNameCn, enterpriseAnotherName, cha
 async function init () {
 	try {
 		const { data } = await getConversationSync({ msg_count: 1 })
-		if (!data || !data.length) {
+		if (!data) {
 			return
 		}
 		items.value = data.map(item => {
 			return {
-				thatName: item.userInfoVo ? (item.userInfoVo.userInfoResp?.name ? item.userInfoVo.userInfoResp.name : '游客') : '系统消息',
-				enterpriseAnotherName: item.userInfoVo?.userInfoResp?.enterpriseAnotherName ?? '',
-				postNameCn: item.userInfoVo?.userInfoResp?.postNameCn ?? '',
+				thatName: item?.userInfoVo ? (item.userInfoVo.userInfoResp?.name ? item.userInfoVo.userInfoResp.name : '游客') : '系统消息',
+				enterpriseAnotherName: item?.userInfoVo?.userInfoResp?.enterpriseAnotherName ?? '',
+				postNameCn: item?.userInfoVo?.userInfoResp?.postNameCn ?? '',
 				...item
 			}
 		})

+ 13 - 3
pagesA/chart/index.vue

@@ -17,8 +17,8 @@
               <text v-if="!val.job.payFrom && !val.job.payTo" class="ml-3">面议</text>
               <text v-else class="ml-3">{{ val.job.payFrom ? val.job.payFrom + '-' : '' }}{{ val.job.payTo }}</text>
             </view>
-            <view :style="{'color': ['5', '98', '99'].includes(val.status) ? '#FE574A' : '#0E8E80'}">
-              {{ showStatus(val.status) }}
+            <view :style="`color: ${val.statusColor}`" >
+              {{ val.statusText }}
             </view>
           </view>
           <view class="mt-1 font-size-14 ellipsis" style="max-width: 100%;">
@@ -234,6 +234,7 @@ const {
 watch(
   () => conversationList.value,
   async (val) => {
+    console.log(val.value)
     if (!channelItem.value) {
       return
     }
@@ -261,7 +262,16 @@ function showStatus (status) {
 async function getInterviewInviteList () {
   if (!info.value.id) return
   const { data } = await getInterviewInviteListByInviteUserId(info.value.id)
-  interview.value = data.slice(0, 1)
+  interview.value = data.slice(0, 1).map(e => {
+    const statusItem = statusList.value.find(_e => _e.value === e.status)
+    const statusText = statusItem?.label || ''
+    const statusColor = ['5', '98', '99'].includes(e.status)
+    return {
+      ...e,
+      statusColor: statusColor ? '#FE574A' : '#0E8E80',
+      statusText
+    }
+  })
 }
 
 const getStatusList = () => {

+ 2 - 2
pagesA/recommendation/index.vue

@@ -29,8 +29,8 @@ import { onLoad } from '@dcloudio/uni-app'
 import { userStore } from '@/store/user'
 const useUserStore = userStore()
 
-watch(() => useUserStore.isLogin, (newVal, oldVal) => {
-  if (useUserStore.isLogin) {
+watch(() => useUserStore.refreshToken, (newVal, oldVal) => {
+  if (useUserStore.refreshToken) {
 		// 监听登录状态
 		console.log('重新登录了')
 		handleChange({ currentIndex: current.value })

+ 3 - 0
store/user.js

@@ -34,6 +34,7 @@ export const userStore = defineStore({
     baseInfo: {}, // 用户信息
     userInfo: {},
     isLogin: !!uni.getStorageSync('token'), // 登录状态
+    refreshToken: uni.getStorageSync('refresh-token'), // 用户切换
     lastUpdateTime: 0, // 上次更新时间
     accountInfo: cloneDeep(defaultAccountInfo), // 账号信息
   }),
@@ -92,11 +93,13 @@ export const userStore = defineStore({
     setToken(token = '', refreshToken = '') {
       if (token === '') {
         this.isLogin = false;
+        this.refreshToken = ''
         uni.removeStorageSync('token');
         uni.removeStorageSync('refresh-token');
       } else {
         this.isLogin = true;
         uni.setStorageSync('token', token);
+        this.refreshToken = refreshToken
         uni.setStorageSync('refresh-token', refreshToken);
         this.loginAfter();
       }