Browse Source

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

lifanagju_citu 10 months ago
parent
commit
0a10e37592
3 changed files with 18 additions and 7 deletions
  1. 3 3
      src/store/user.js
  2. 14 4
      src/utils/eventList.js
  3. 1 0
      src/views/recruit/personal/shareJob/index.vue

+ 3 - 3
src/store/user.js

@@ -5,7 +5,7 @@ import { getUserInfo } from '@/api/personal/user'
 import { getEnterpriseUserAccount, getUserAccount } from '@/api/common'
 import Snackbar from '@/plugins/snackbar'
 import { timesTampChange } from '@/utils/date'
-import { getRewardEventList } from '@/utils/eventList'
+import { updateEventList } from '@/utils/eventList'
 import { getBaseInfoDictOfName } from '@/utils/getText'
 
 
@@ -63,7 +63,7 @@ export const useUserStore = defineStore('user',
           const data = await api({ id: this.accountInfo.userId })
           this.userInfo = data
           localStorage.setItem('userInfo', JSON.stringify(data))
-          getRewardEventList() // 获取规则配置跟踪列表
+          updateEventList(true) // 获取规则配置跟踪列表
           this.getUserAccountInfo()
         } catch (error) {
           Snackbar.error(error.msg)
@@ -121,7 +121,7 @@ export const useUserStore = defineStore('user',
         localStorage.setItem('currentRole', 'enterprise')
         await this.getEnterpriseInfo()
         await this.getEnterpriseUserAccountInfo()
-        getRewardEventList()
+        updateEventList(false)
         Snackbar.success('切换成功')
       },
       // 获取当前登录的企业用户信息

+ 14 - 4
src/utils/eventList.js

@@ -2,19 +2,29 @@
 import { getToken } from '@/utils/auth'
 import { ref } from 'vue'
 import { getRewardEventTrackList } from '@/api/integral'
+import { useUserStore } from '@/store/user'
 
-export const getRewardEventList = async () => {
+const getRewardEventList = async () => {
   const eventList = await getRewardEventTrackList()
   localStorage.setItem('eventList', JSON.stringify(eventList) ?? [])
 }
 
-// 规则配置跟踪列表(每10分钟更新一次)
-export const updateEventList = () => {
+// 规则配置跟踪列表(每5分钟更新一次)
+export const updateEventList = (type) => {
+  const store = useUserStore()
   const timer = ref(null)
   if (getToken()) {
+    getRewardEventList()
+    if (timer.value) clearInterval(timer.value)
+
     timer.value = setInterval(async () => {
       getRewardEventList()
-    }, 600000)
+
+      // 更新账户信息
+      if (type) await store.getUserAccountInfo()
+      else await store.getEnterpriseUserAccountInfo()
+    }, 300000)
+
   } else {
     timer.value = null
     clearInterval(timer.value)

+ 1 - 0
src/views/recruit/personal/shareJob/index.vue

@@ -193,6 +193,7 @@ const loginSuccess = async (info) => {
   if (actions.value) {
     actions.value = false
     Snackbar.success('登录成功')
+    await handleCollection()
     return 
   }
   const bool = await handleCheckJobDelivery()