Browse Source

Merge branch 'feature_20250512_chatAI页面' into uat(dev)

zhujindu 6 months ago
parent
commit
3cf4de7a4e
2 changed files with 42 additions and 1 deletions
  1. 10 0
      src/api/chatAI.js
  2. 32 1
      src/views/chatAIPage/index.vue

+ 10 - 0
src/api/chatAI.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request';
+
+// 获取AiToken
+export function getAiToken(query) {
+  return request({
+    url: '/mobile/reportMobile/getAiToken',
+    method: 'get',
+    params: query,
+  });
+}

+ 32 - 1
src/views/chatAIPage/index.vue

@@ -5,7 +5,11 @@
       <div class="titleTip">欢迎进入随身邦chatBl,智能助理为您提供以下服务</div>
     </div>
     <div class="content">
-      <div class="tabItem" v-for="item in tabData" :style="{ background: item.backColor }">
+      <div
+        class="tabItem"
+        v-for="item in tabData"
+        :style="{ background: item.backColor }"
+        @click="openAiPage">
         <div class="tabName">{{ item.tabName }}</div>
         <div class="message">{{ item.message }}</div>
         <div class="icon">
@@ -28,6 +32,7 @@
   </div>
 </template>
 <script>
+import { getAiToken } from '@/api/chatAI.js';
 export default {
   name: 'chatAIPage',
   data() {
@@ -47,8 +52,34 @@ export default {
         },
       ],
       chatBoxMessage: '',
+      AIToken: '',
     };
   },
+  created() {
+    this.getAiTokenFun();
+  },
+  methods: {
+    getAiTokenFun() {
+      this.toastLoading(0, '上传中...', true);
+      getAiToken()
+        .then((res) => {
+          this.toastLoading().clear();
+          if (res.code == 200) {
+            this.AIToken = res.msg;
+          } else {
+            this.$toast(res.msg);
+          }
+        })
+        .catch((error) => {
+          this.toastLoading().clear();
+          this.$toast(error.msg);
+        });
+    },
+    openAiPage() {
+      window.location.href =
+        'http://bi.dgtis.com/cboard/h5/index.html?token=' + this.AIToken + '#/chatbi';
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>