Xiao_123 10 maanden geleden
bovenliggende
commit
59a4c300b1

+ 8 - 1
src/components/Position/longCompany.vue

@@ -15,7 +15,10 @@
       </div>
       <div class="company-info-bottom">
         <div class="chipBox">
-          <v-chip class="mr-2" color="primary" size="x-small" label v-for="(k, i) in item.welfareList" :key="i">{{ k }}</v-chip>
+          <div class="d-inline-block" v-for="(val, i) in item.welfareList" :key="i">
+            <span>{{ val }}</span>
+            <span class="mx-1" v-if="i !== item.welfareList.length - 1">|</span>
+          </div>
         </div>
         <div class="position" @click="handleClickEnterprise(item, 'recruitmentPositions')">
           查看全部职位
@@ -93,8 +96,12 @@ const handleClickEnterprise = (item, key) => {
   background-color: #f8fcfb;
   .chipBox {
     width: 70%;
+    min-width: 70%;
     overflow: hidden;
+    text-overflow: ellipsis;
     white-space: nowrap;
+    font-size: 13px; 
+    color: #999;
   }
   .position {
     color: #666;

+ 16 - 3
src/config/axios/service.js

@@ -3,6 +3,7 @@ import Snackbar from '@/plugins/snackbar'
 import Confirm from '@/plugins/confirm'
 import qs from 'qs'
 import { config } from '@/config/axios/config'
+import { getSuffixAfterPrefix } from '@/utils/prefixUrl'
 import { getCurrentLocaleLang } from '@/utils/lang'
 import { enterpriseRefreshToken, userRefreshToken } from '@/api/common'
 import { getToken, getRefreshToken, removeToken, setToken, setRefreshToken } from '@/utils/auth'
@@ -37,7 +38,10 @@ const RETURNED_API = '/admin-api/menduner/reward/event-track/click'
 
 // 规则配置跟踪列表
 const eventRules = localStorage.getItem('eventList')
-const eventList = (eventRules ? JSON.parse(eventRules) : []).filter(_e => _e.type === '0')
+// 请求成功后触发
+const requestCompletionTrigger = (eventRules ? JSON.parse(eventRules) : []).filter(_e => _e.type === '0')
+// 点击触发
+const clickTrigger = (eventRules ? JSON.parse(eventRules) : []).filter(_e => _e.type === '1')
 
 // 创建axios实例
 const service = axios.create({
@@ -83,6 +87,13 @@ service.interceptors.request.use(
         config.url = config.url + '?' + paramsStr
       }
     }
+    // 截取request url
+    const url = getSuffixAfterPrefix(config.url)
+    if (!url || !clickTrigger.length) return config
+    const _obj = clickTrigger.find(e => e.url === url)
+    if (_obj) {
+      rewardEventTrackClick(_obj.url)
+    }
     return config
   },
   (error) => {
@@ -96,6 +107,8 @@ service.interceptors.request.use(
 service.interceptors.response.use(
   async (response) => {
     if (response.config.url.includes(RETURNED_API)) {
+      console.log(response.data.data, '积分获取data')
+      if (!response.data.data) return
       const { match, title, point } = response.data.data
       if (match) Snackbar.success(`恭喜您${title}获得${point}积分`)
       return
@@ -186,10 +199,10 @@ service.interceptors.response.use(
     }
     
     // 请求成功后触发获取积分
-    if (!eventList.length) {
+    if (!requestCompletionTrigger.length) {
       return data
     }
-    const _list = eventList.filter(_e => {
+    const _list = requestCompletionTrigger.filter(_e => {
       return response.config.url.includes(_e.url)
     })
     if (_list.length) {

+ 15 - 0
src/utils/prefixUrl.js

@@ -0,0 +1,15 @@
+const prefixList = ['/app-api', '/admin-api']
+
+export const getSuffixAfterPrefix = (str) => {
+  const matchingPrefix = prefixList.find(prefix => str.startsWith(prefix))
+  if (matchingPrefix) {
+    const matchUrl = str.slice(matchingPrefix.length)
+    const hasQuery = matchUrl.indexOf('?') !== -1
+    if (hasQuery) {
+      const arr = matchUrl.split('?')
+      return arr[0]
+    }
+    else return matchUrl
+  }
+  return undefined
+}

+ 1 - 1
src/views/recruit/position/components/details.vue

@@ -162,7 +162,7 @@ getCollectionStatus()
 const handleCollection = async () => {
   const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
   await api(isCollection.value ? id : { jobId: id })
-  getCollectionStatus()
+  await getCollectionStatus()
 }
 
 const dialog = ref(false)