Browse Source

fix: 未登录不调保存历史搜索接口

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 11 months ago
parent
commit
dc6b7f208b

+ 9 - 7
apps/mobile/src/views/search/result/buyer/index.vue

@@ -726,13 +726,15 @@ export default {
       }
     },
     onClickList(item) {
-      // 历史记录新增
-      saveViewHistoryQuery({
-        type: 'buyer',
-        name: item?.title,
-      }).then((res) => {
-        console.log(res, 'res')
-      })
+      if(this.isLogin) {
+        // 历史记录新增
+        saveViewHistoryQuery({
+          type: 'buyer',
+          name: item?.title,
+        }).then((res) => {
+          console.log(res, 'res')
+        })
+      }
       this.doSave()
       // 跳转页面
       let goLink = ''

+ 9 - 7
apps/mobile/src/views/search/result/company/index.vue

@@ -472,13 +472,15 @@ export default {
       }
     },
     goEntPage(item) {
-      // 历史记录新增
-      saveViewHistoryQuery({
-        type: 'ent',
-        name: item?.name + '_' + item?.id,
-      }).then((res) => {
-        console.log(res, 'res')
-      })
+      if (this.isLogin) {
+        // 历史记录新增
+        saveViewHistoryQuery({
+          type: 'ent',
+          name: item?.name + '_' + item?.id,
+        }).then((res) => {
+          console.log(res, 'res')
+        })
+      }
       const url = this.$envs.inWX
         ? '/weixin/frontPage/collection/sess/ent_portrait'
         : '/jyapp/big/page/ent_portrait'