From db6943750fa80531ba97250757b9b3693c51b0f2 Mon Sep 17 00:00:00 2001
From: hongxilin <17663930442@163.com>
Date: Tue, 25 Mar 2025 15:31:50 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AE=9A=E7=BB=88=E7=89=88=EF=BC=8Ck?=
=?UTF-8?q?=E7=BA=BF=E5=9B=BE=E9=9C=80=E8=A6=81=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
index.html | 1 +
src/App.vue | 9 ++-
src/api/AIxiaocaishen.js | 65 +++++++++++++---
src/assets/js/useAppBridge.js | 8 +-
src/assets/js/useProjectTracking.js | 26 ++++---
src/main.js | 5 ++
src/router/index.js | 5 ++
src/store/audio.js | 4 +-
src/store/dataList.js | 24 +++---
src/views/AIchat.vue | 146 +++++++++++++++++++++++++++++-------
src/views/AIfind.vue | 12 ++-
src/views/Announcement.vue | 8 +-
src/views/Echarts/KLine.vue | 124 ++++++++++++++++++++++++++----
src/views/homePage.vue | 50 +++++++-----
15 files changed, 394 insertions(+), 95 deletions(-)
diff --git a/.env.development b/.env.development
index 436b0ec..ab104ed 100644
--- a/.env.development
+++ b/.env.development
@@ -2,7 +2,7 @@
VITE_ENV = 'development'
VITE_OUTPUT_DIR = 'dev'
# public path
-VITE_PUBLIC_PATH = /
+VITE_PUBLIC_PATH = /AIxiaocaishen
#新数据接口
VITE_APP_API_BASE_URL = "http://39.101.133.168:8828/link"
diff --git a/index.html b/index.html
index e465776..8bae75e 100644
--- a/index.html
+++ b/index.html
@@ -5,6 +5,7 @@
+
AI小财神
diff --git a/src/App.vue b/src/App.vue
index 68a251a..632425f 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,14 @@
diff --git a/src/api/AIxiaocaishen.js b/src/api/AIxiaocaishen.js
index 2049393..c072c91 100644
--- a/src/api/AIxiaocaishen.js
+++ b/src/api/AIxiaocaishen.js
@@ -42,39 +42,86 @@ export const computedUsersAPI = function (params) {
}
})
}
+// 首次进入小财神
+export const useAiGodAPI = function (params) {
+ return request({
+ url: `${APIurl}/api/ai_god/useAiGod`,
+ method: 'post',
+ data: new URLSearchParams(params),
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+}
+// 停留时间
+export const updateStayTimeAPI = function (params) {
+ return request({
+ url: `${APIurl}/api/ai_god/updateStayTime`,
+ method: 'post',
+ data: new URLSearchParams(params),
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+}
+// 获取新闻接口
export const getNewsAPI = function () {
return request({
- url: `http://192.168.9.19:8080/api/ai_god/news`,
+ url: `${APIurl}/api/ai_god/news`,
method: 'POST'
})
}
-
+// 获取引导搜索词接口
export const getQuestionAPI = function () {
return request({
- url: `http://192.168.9.19:8080/api/ai_god/shows`,
+ url: `${APIurl}/api/ai_god/shows`,
method: 'POST',
data: new URLSearchParams({
"type": "1",
- "num": "10"
+ "num": "10",
+ "state": "1"
})
})
}
-
+// 获取公告接口
export const getAnnouncementAPI = function () {
return request({
- url: `http://192.168.9.19:8080/api/ai_god/shows`,
+ url: `${APIurl}/api/ai_god/shows`,
method: 'POST',
data: new URLSearchParams({
"type": "3",
- "num": "1"
+ "num": "1",
+ "state": "1"
})
})
}
-
+// 获取用户次数接口
export const getUserCountAPI = function (params) {
return request({
- url: `http://192.168.9.19:8080/api/ai_god/userUsageInfo`,
+ url: `${APIurl}/api/ai_god/userUsageInfo`,
+ method: 'POST',
+ data: new URLSearchParams(params),
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+}
+// 推荐问题/每日复盘/小财神简介点击事件接口
+export const qsArpAamClickAPI = function (params) {
+ return request({
+ url: `${APIurl}/api/ai_god/shows/click`,
+ method: 'POST',
+ data: new URLSearchParams(params),
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+}
+// 财经新闻点击事件接口
+export const newsClickAPI = function (params) {
+ return request({
+ url: `${APIurl}/api/ai_god/news/click`,
method: 'POST',
data: new URLSearchParams(params),
headers: {
diff --git a/src/assets/js/useAppBridge.js b/src/assets/js/useAppBridge.js
index 84a458e..477c434 100644
--- a/src/assets/js/useAppBridge.js
+++ b/src/assets/js/useAppBridge.js
@@ -1,3 +1,5 @@
+// import { platform } from "os"
+
//跳转app方法
export function useAppBridge() {
const fullClose = (n, m) => {
@@ -8,7 +10,8 @@ export function useAppBridge() {
return Math.floor(result)
}
- const packageFun = (funName, fun = () => {}, platform, data = {}) => {
+ const packageFun = (funName, fun = () => { }, platform, data = {}) => {
+ console.log('packageFun', funName, platform, data)
const JWrandom = fullClose(10000, 99999)
data.JWrandom = JWrandom
@@ -37,7 +40,10 @@ export function useAppBridge() {
}
})
break
+ default:
+ console.log('未知平台', platform)
}
+
} catch (e) {
console.error('Error in packageFun:', e)
}
diff --git a/src/assets/js/useProjectTracking.js b/src/assets/js/useProjectTracking.js
index a826240..63377e6 100644
--- a/src/assets/js/useProjectTracking.js
+++ b/src/assets/js/useProjectTracking.js
@@ -1,6 +1,6 @@
import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
import { useRouter } from 'vue-router'
-import { computedUsersAPI } from '@/api/sword'
+import { computedUsersAPI, useAiGodAPI, updateStayTimeAPI } from '@/api/AIxiaocaishen'
export function useProjectTracking(projectRoutes) {
const router = useRouter()
@@ -23,16 +23,24 @@ export function useProjectTracking(projectRoutes) {
const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1)
.toString()
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date
- .getHours()
- .toString()
- .padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date
- .getSeconds()
- .toString()
- .padStart(2, '0')}`
+ .getHours()
+ .toString()
+ .padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date
+ .getSeconds()
+ .toString()
+ .padStart(2, '0')}`
sessionStorage.setItem('projectEntryTime', formattedDate)
sessionStorage.setItem('hasRecordedEntry', 'true')
isInProject.value = true
hasRecordedEntry.value = true
+
+ const token = localStorage.getItem('localToken')
+ if (token) {
+ const result = useAiGodAPI({
+ token: token
+ })
+ console.log(result);
+ }
console.log('记录首次进入时间:', formattedDate)
}
@@ -63,13 +71,13 @@ export function useProjectTracking(projectRoutes) {
const params = {
stayTime: duration,
- loginTime: storedEntryTime,
+ // loginTime: storedEntryTime,
token: localToken
}
if (localToken) {
try {
- const res = await computedUsersAPI(params)
+ const res = await updateStayTimeAPI(params)
console.log('跟踪数据已发送:', res)
sessionStorage.removeItem('projectEntryTime')
sessionStorage.removeItem('hasRecordedEntry')
diff --git a/src/main.js b/src/main.js
index 9e17c6c..bb979a6 100644
--- a/src/main.js
+++ b/src/main.js
@@ -6,6 +6,9 @@ import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// import 'reset-css';
import { createPinia } from 'pinia'
+import { useAppBridge } from './assets/js/useAppBridge.js'
+const { packageFun, fullClose } = useAppBridge()
+
const app = createApp(App)
const pinia = createPinia()
@@ -15,4 +18,6 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.use(router)
app.use(ElementPlus)
app.use(pinia)
+app.provide('packageFun', packageFun)
+app.provide('fullClose', fullClose)
app.mount('#app')
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 93eeb49..e8a1b4b 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -20,6 +20,11 @@ const routes = [
name: 'AIfind',
component: () => import('@/views/AIfind.vue'),
meta: { title: '发现' }
+ },
+ {
+ path: '/Announcement',
+ name: 'Announcement',
+ component: () => import('@/views/Announcement.vue'),
}
]
// 创建路由实例
diff --git a/src/store/audio.js b/src/store/audio.js
index d23ed55..8697713 100644
--- a/src/store/audio.js
+++ b/src/store/audio.js
@@ -4,7 +4,9 @@ export const useAudioStore = defineStore('audio', {
state: () => ({
soundInstance: null, // Howl 实例
isPlaying: false, // 播放状态
- isVoiceEnabled: true // 新增声音开关状态
+ isVoiceEnabled: true, // 新增声音开关状态
+ lastVoiceState: null,
+ ttsUrl:''
}),
actions: {
// 设置音频实例
diff --git a/src/store/dataList.js b/src/store/dataList.js
index ab2e02a..7c2d74b 100644
--- a/src/store/dataList.js
+++ b/src/store/dataList.js
@@ -31,7 +31,9 @@ export const useDataStore = defineStore('data', () => {
const getQueryVariable = (variable) => {
const query = window.location.search.substring(1)
+ // console.log(query,'query')
const vars = query.split('&')
+ // console.log(vars,'vars')
for (let i = 0; i < vars.length; i++) {
const pair = vars[i].split('=')
if (pair[0] === variable) {
@@ -41,17 +43,17 @@ export const useDataStore = defineStore('data', () => {
return ''
}
- const getAnswer = (result) => {
- const data = result.data;
- const vars = query.split('&')
- for (let i = 0; i < vars.length; i++) {
- const pair = vars[i].split('=')
- if (pair[0] === variable) {
- return pair[1]
- }
- }
- return ''
- }
+ // const getAnswer = (result) => {
+ // const data = result.data;
+ // const vars = query.split('&')
+ // for (let i = 0; i < vars.length; i++) {
+ // const pair = vars[i].split('=')
+ // if (pair[0] === variable) {
+ // return pair[1]
+ // }
+ // }
+ // return ''
+ // }
// 使用示例,获取地址栏参数
// const token = ref(getQueryVariable('token'))
diff --git a/src/views/AIchat.vue b/src/views/AIchat.vue
index 816273d..4439c30 100644
--- a/src/views/AIchat.vue
+++ b/src/views/AIchat.vue
@@ -1,7 +1,7 @@