浏览代码

市局埋点收集集成

songxy 3 月之前
父节点
当前提交
c5b0b9d74c
共有 2 个文件被更改,包括 10 次插入14 次删除
  1. 4 8
      ais_search_sj/web/src/api/manager.js
  2. 6 6
      ais_search_sj/web/src/views/ai-search/ai-search.vue

+ 4 - 8
ais_search_sj/web/src/api/manager.js

@@ -1,17 +1,13 @@
-import { createRequest } from '@/utils/api';
-
-const request = createRequest(window.AppGlobalConfig.managerServer);
+import http from "@/utils/http";
 
 export default {
-  getNews: (param) => request('/news/info/list', { ...param }, 'get', false),
-  getNewsDetail: (id) => request('/news/info/detail', { id }, 'get', false),
   // 问题采集
-  collect: (data) => request('/api/collect/question', { ...data }, 'post', false),
+  collect: async (data) => await http.post('/ai/question/collect', { ...data }, false),
   // 上报埋点必须要使用此方法来做同步请求,axios 异步请求无法发送
   collectUserBehavior: (data) => {
     const blob = new Blob([JSON.stringify(data)], {type: 'application/json;charset=UTF-8'})
     navigator.sendBeacon(`${window.AppGlobalConfig.managerServer}/api/collect/user/behavior/log`, blob);
   },
-  feedback: (id, feedback) =>
-    request(`/api/collect/question/${id}/feedback`, { feedback }, 'get', false)
+  feedback: async (id, feedback) =>
+    await http.get(`/api/collect/question/${id}/feedback`, { feedback }, false)
 };

+ 6 - 6
ais_search_sj/web/src/views/ai-search/ai-search.vue

@@ -1531,12 +1531,12 @@ const collectQuestion = () => {
     param.userId = id;
   }
 
-  // ManagerAPI.collect(param).then((res) => {
-  //   if (res.data) {
-  //     // 记录日志,用来反馈
-  //     currentResponse.value.logId = res.data;
-  //   }
-  // });
+  ManagerAPI.collect(param).then((res) => {
+    if (res.data) {
+      // 记录日志,用来反馈
+      currentResponse.value.logId = res.data;
+    }
+  });
 };
 
 const questions = ref([]);