Browse Source

Merge branch 'dev/v1.0.53_yf' of jianyu/web into feature/v1.0.53

yangfeng 1 year ago
parent
commit
cf9327ac89

+ 2 - 1
data/data-models/modules/quick-search-history/model/index.js

@@ -5,10 +5,11 @@ function useSearchHistoryModel(config) {
   const useApiModel = new SearchHistoryBaseApi(config)
 
   const { getHistoryQuery, clearHistoryQuery, saveViewHistoryQuery } = useApiModel
-  const { searchHistoryList } = toRefs(reactive(useApiModel))
+  const { searchHistoryList, browseHistoryList } = toRefs(reactive(useApiModel))
 
   return {
     searchHistoryList,
+    browseHistoryList,
     getHistoryQuery,
     clearHistoryQuery,
     saveViewHistoryQuery

+ 17 - 1
data/data-models/modules/quick-search-history/plugins/base.js

@@ -25,6 +25,7 @@ class SearchHistoryBaseApi {
 
   async runQuery(params) {
     this.searchHistoryList = []
+    this.browseHistoryList = []
     const query = Object.assign({}, params, this._getParams(params))
     const result = await this.ajaxQuery(query)
     if (result.success) {
@@ -41,7 +42,22 @@ class SearchHistoryBaseApi {
   async ajaxQuery(params) {
     return ajaxGetSearchHistory(params).then((res) => {
       let success = res?.error_code === 0
-
+      if (res?.data?.browse) {
+        // 格式化浏览历史数据(企业画像浏览记录跳转需要企业id, 存历史记录的时候保存格式为“企业名称_企业id”)
+        res.data.browse = res.data.browse.map((item) => {
+          if (item.indexOf('_') > -1) {
+            const [name, id] = item.split('_')
+            return {
+              name,
+              id
+            }
+          } else {
+            return {
+              name: item
+            }
+          }
+        })
+      }
       return {
         success: success,
         search: res?.data?.search ? res.data.search.reverse() : [],