7 changed files with 1373 additions and 4038 deletions
-
2README.md
-
BINsrc/assets/img/AIchat/PCbackPic.png
-
BINsrc/assets/img/AIchat/new-app-bgc.png
-
374src/store/dataList.js
-
5022src/views/AIchat.vue
-
12src/views/Announcement.vue
-
1src/views/Feedback.vue
After Width: 2280 | Height: 1900 | Size: 216 KiB |
After Width: 647 | Height: 1144 | Size: 16 KiB |
@ -1,196 +1,218 @@ |
|||
|
|||
import { defineStore } from 'pinia' |
|||
import { ref, watch } from 'vue' |
|||
import { useUserStore } from './userPessionCode' |
|||
import { useLanguage } from '@/utils/languageService' |
|||
import { dataListAPI } from '@/api/AIxiaocaishen' |
|||
import { defineStore } from "pinia"; |
|||
import { ref, watch } from "vue"; |
|||
import { useUserStore } from "./userPessionCode"; |
|||
import { useLanguage } from "@/utils/languageService"; |
|||
import { dataListAPI } from "@/api/AIxiaocaishen"; |
|||
// import { useSkeletonStore } from '@/utils/skeletonLoader'
|
|||
import { useRoute } from 'vue-router' |
|||
import { useRoute } from "vue-router"; |
|||
// const skeletonStore = useSkeletonStore()
|
|||
// const { t } = useLanguage()
|
|||
|
|||
export const useDataStore = defineStore('data', () => { |
|||
const route = useRoute() |
|||
console.log(route, '地址栏携带的参数。。。。。。') |
|||
const userStore = useUserStore() |
|||
const brainDataList = ref(null) |
|||
const swordDataList = ref(null) |
|||
const priceDataList = ref(null) |
|||
const timeDataList = ref(null) |
|||
const showALLData = ref(null) |
|||
const HomePage = ref(null) |
|||
const AIBull = ref(null) |
|||
const AIGoldBull = ref(null) |
|||
const AIRadar = ref(null) |
|||
const loading = ref(false) |
|||
const klineData = ref(null) |
|||
const activeTabIndex = ref(null) |
|||
const isFeedback = ref(false) // 用于控制是否显示反馈页面的标志
|
|||
const setKlineData = (data) => { |
|||
klineData.value = data |
|||
} |
|||
export const useDataStore = defineStore("data", () => { |
|||
const route = useRoute(); |
|||
console.log(route, "地址栏携带的参数。。。。。。"); |
|||
const userStore = useUserStore(); |
|||
const brainDataList = ref(null); |
|||
const swordDataList = ref(null); |
|||
const priceDataList = ref(null); |
|||
const timeDataList = ref(null); |
|||
const showALLData = ref(null); |
|||
const HomePage = ref(null); |
|||
const AIBull = ref(null); |
|||
const AIGoldBull = ref(null); |
|||
const AIRadar = ref(null); |
|||
const loading = ref(false); |
|||
const klineData = ref(null); |
|||
const activeTabIndex = ref(null); |
|||
const isFeedback = ref(false); // 用于控制是否显示反馈页面的标志
|
|||
const setKlineData = (data) => { |
|||
klineData.value = data; |
|||
}; |
|||
|
|||
const setActiveTabIndex = (index) => { |
|||
activeTabIndex.value = index |
|||
} |
|||
const setActiveTabIndex = (index) => { |
|||
activeTabIndex.value = index; |
|||
}; |
|||
|
|||
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) { |
|||
return pair[1] |
|||
} |
|||
} |
|||
return '' |
|||
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) { |
|||
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 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'))
|
|||
// const market = ref(getQueryVariable('market'))
|
|||
// const code = ref(getQueryVariable('code'))
|
|||
// console.log(token.value) // 输出 token 的值,例如 "111"
|
|||
// const fetchChartData = async () => {
|
|||
// const getTokenString = String(localStorage.getItem('localToken'))
|
|||
// const getMarketString = String(localStorage.getItem('localMarket'))
|
|||
// const getCodeString = String(localStorage.getItem('localCode'))
|
|||
// // const getMarket = String()
|
|||
// try {
|
|||
// const res = await dataListAPI({
|
|||
// token: getTokenString || '',
|
|||
// market: getMarket() || getMarketString || 'gb',
|
|||
// code: getQueryVariable('code') || getCodeString || 'NDX',
|
|||
// language: 'cn', //t.value.suoxie,
|
|||
// brainPrivilegeState: userStore.brainPerssion,
|
|||
// swordPrivilegeState: userStore.swordPerssion,
|
|||
// stockForecastPrivilegeState: userStore.pricePerssion,
|
|||
// spaceForecastPrivilegeState: userStore.timePerssion,
|
|||
// aibullPrivilegeState: userStore.aibullPerssion,
|
|||
// aigoldBullPrivilegeState: userStore.aiGnbullPerssion,
|
|||
// airadarPrivilegeState: userStore.airadarPerssion,
|
|||
// marketList: userStore.aiGoldMarketList
|
|||
// })
|
|||
// 使用示例,获取地址栏参数
|
|||
const token = ref(getQueryVariable("token")); |
|||
const market = ref(getQueryVariable("market")); |
|||
const code = ref(getQueryVariable("code")); |
|||
console.log(token.value); // 输出 token 的值,例如 "111"
|
|||
const fetchChartData = async (market,code) => { |
|||
const getTokenString = String(localStorage.getItem("localToken")); |
|||
// const getMarketString = String(localStorage.getItem("localMarket"));
|
|||
// const getCodeString = String(localStorage.getItem("localCode"));
|
|||
// const getMarket = String()
|
|||
try { |
|||
const res = await dataListAPI({ |
|||
token: getTokenString || "", |
|||
market: market || "gb", |
|||
code: code || "NDX", |
|||
language: "cn", //t.value.suoxie,
|
|||
brainPrivilegeState: userStore.brainPerssion, |
|||
swordPrivilegeState: userStore.swordPerssion, |
|||
stockForecastPrivilegeState: userStore.pricePerssion, |
|||
spaceForecastPrivilegeState: userStore.timePerssion, |
|||
aibullPrivilegeState: userStore.aibullPerssion, |
|||
aigoldBullPrivilegeState: userStore.aiGnbullPerssion, |
|||
airadarPrivilegeState: userStore.airadarPerssion, |
|||
marketList: userStore.aiGoldMarketList, |
|||
}); |
|||
|
|||
// brainDataList.value = res.data.Brain
|
|||
// swordDataList.value = res.data.Sword
|
|||
// priceDataList.value = res.data.StockForecast
|
|||
// timeDataList.value = res.data.SpaceForecast
|
|||
// showALLData.value = res.data.ShowAll
|
|||
// HomePage.value = res.data.HomePage
|
|||
// AIBull.value = res.data.AIBull
|
|||
// AIGoldBull.value = res.data.AIGoldBull
|
|||
// AIRadar.value = res.data.AIRadar
|
|||
// } catch (error) {
|
|||
// console.error('获取图表数据出错:', error)
|
|||
// } finally {
|
|||
// loading.value = false
|
|||
// console.log('数据获取过程结束')
|
|||
// }
|
|||
// }
|
|||
brainDataList.value = res.data.Brain; |
|||
swordDataList.value = res.data.Sword; |
|||
priceDataList.value = res.data.StockForecast; |
|||
timeDataList.value = res.data.SpaceForecast; |
|||
showALLData.value = res.data.ShowAll; |
|||
HomePage.value = res.data.HomePage; |
|||
AIBull.value = res.data.AIBull; |
|||
AIGoldBull.value = res.data.AIGoldBull; |
|||
AIRadar.value = res.data.AIRadar; |
|||
} catch (error) { |
|||
console.error("获取图表数据出错:", error); |
|||
} finally { |
|||
loading.value = false; |
|||
console.log("数据获取过程结束"); |
|||
} |
|||
}; |
|||
|
|||
// 获取路径上market的值
|
|||
const getMarket = () => { |
|||
let market = '' |
|||
const queryMarket = getQueryVariable('market') |
|||
if (queryMarket) { |
|||
if ( |
|||
['sg', 'my', 'in', 'hk', 'th', 'vi', 'usa', 'can', 'gb', 'cn'].includes(queryMarket) |
|||
) { |
|||
return queryMarket |
|||
} else { |
|||
switch (queryMarket) { |
|||
case 'SGX': return 'sg' |
|||
case 'BMB': return 'my' |
|||
case 'IDX': return 'in' |
|||
case 'HKEX': return 'hk' |
|||
case 'SET': return 'th' |
|||
case 'HN': return 'vi' |
|||
case 'HONSE': return 'vi' |
|||
case 'AMERA': return 'usa' |
|||
case 'NYSE': return 'usa' |
|||
case 'NASDAQ': return 'usa' |
|||
case 'DLD': return 'can' |
|||
case 'DLDCY': return 'can' |
|||
case 'GINDEX': return 'gb' |
|||
case 'BZ': return 'cn' |
|||
case 'SH': return 'cn' |
|||
case 'SZ': return 'cn' |
|||
default: return '无市场数据' |
|||
} |
|||
} |
|||
// 获取路径上market的值
|
|||
const getMarket = () => { |
|||
let market = ""; |
|||
const queryMarket = getQueryVariable("market"); |
|||
if (queryMarket) { |
|||
if ( |
|||
["sg", "my", "in", "hk", "th", "vi", "usa", "can", "gb", "cn"].includes( |
|||
queryMarket |
|||
) |
|||
) { |
|||
return queryMarket; |
|||
} else { |
|||
switch (queryMarket) { |
|||
case "SGX": |
|||
return "sg"; |
|||
case "BMB": |
|||
return "my"; |
|||
case "IDX": |
|||
return "in"; |
|||
case "HKEX": |
|||
return "hk"; |
|||
case "SET": |
|||
return "th"; |
|||
case "HN": |
|||
return "vi"; |
|||
case "HONSE": |
|||
return "vi"; |
|||
case "AMERA": |
|||
return "usa"; |
|||
case "NYSE": |
|||
return "usa"; |
|||
case "NASDAQ": |
|||
return "usa"; |
|||
case "DLD": |
|||
return "can"; |
|||
case "DLDCY": |
|||
return "can"; |
|||
case "GINDEX": |
|||
return "gb"; |
|||
case "BZ": |
|||
return "cn"; |
|||
case "SH": |
|||
return "cn"; |
|||
case "SZ": |
|||
return "cn"; |
|||
default: |
|||
return "无市场数据"; |
|||
} |
|||
return '' |
|||
} |
|||
} |
|||
return ""; |
|||
}; |
|||
|
|||
const isLoading = ref(true) |
|||
const initData = async () => { |
|||
isLoading.value = true |
|||
try { |
|||
// 初始化逻辑
|
|||
} catch (error) { |
|||
console.error('Error loading data:', error) |
|||
} finally { |
|||
isLoading.value = false |
|||
} |
|||
const isLoading = ref(true); |
|||
const initData = async () => { |
|||
isLoading.value = true; |
|||
try { |
|||
// 初始化逻辑
|
|||
} catch (error) { |
|||
console.error("Error loading data:", error); |
|||
} finally { |
|||
isLoading.value = false; |
|||
} |
|||
}; |
|||
|
|||
// watch(
|
|||
// () => [userStore.isReady, t.value?.suoxie],
|
|||
// ([isReady]) => {
|
|||
// console.log('isReady 或 language 变化:', isReady)
|
|||
// if (isReady) {
|
|||
// setTimeout(() => fetchChartData(), 500)
|
|||
// }
|
|||
// },
|
|||
// { immediate: true, deep: true }
|
|||
// )
|
|||
// watch(
|
|||
// () => [userStore.isReady, t.value?.suoxie],
|
|||
// ([isReady]) => {
|
|||
// console.log('isReady 或 language 变化:', isReady)
|
|||
// if (isReady) {
|
|||
// setTimeout(() => fetchChartData(), 500)
|
|||
// }
|
|||
// },
|
|||
// { immediate: true, deep: true }
|
|||
// )
|
|||
|
|||
// watch(() => route.query, () => {
|
|||
// if (route.query.market || route.query.code) {
|
|||
// fetchChartData()
|
|||
// }
|
|||
// })
|
|||
watch( |
|||
() => window.location.ancestorOrigins, |
|||
(newQuery, oldQuery) => { |
|||
console.log("newQuery", newQuery); |
|||
// if () {
|
|||
// fetchChartData();
|
|||
// }
|
|||
} |
|||
); |
|||
|
|||
// watch(() => userStore.aibullPerssion, (newValue) => {
|
|||
// if (newValue === 1) fetchChartData()
|
|||
// })
|
|||
// watch(() => userStore.aibullPerssion, (newValue) => {
|
|||
// if (newValue === 1) fetchChartData()
|
|||
// })
|
|||
|
|||
initData() |
|||
initData(); |
|||
|
|||
return { |
|||
// brainDataList,
|
|||
// swordDataList,
|
|||
// priceDataList,
|
|||
// timeDataList,
|
|||
// showALLData,
|
|||
// HomePage,
|
|||
// AIBull,
|
|||
// AIGoldBull,
|
|||
// loading,
|
|||
// AIRadar,
|
|||
// fetchChartData,
|
|||
activeTabIndex, |
|||
klineData, |
|||
setKlineData, |
|||
initData, |
|||
getMarket, |
|||
getQueryVariable, |
|||
setActiveTabIndex, |
|||
isFeedback |
|||
} |
|||
}) |
|||
return { |
|||
// brainDataList,
|
|||
// swordDataList,
|
|||
// priceDataList,
|
|||
// timeDataList,
|
|||
// showALLData,
|
|||
HomePage, |
|||
// AIBull,
|
|||
AIGoldBull, |
|||
// loading,
|
|||
// AIRadar,
|
|||
fetchChartData, |
|||
activeTabIndex, |
|||
klineData, |
|||
setKlineData, |
|||
initData, |
|||
getMarket, |
|||
getQueryVariable, |
|||
setActiveTabIndex, |
|||
isFeedback, |
|||
}; |
|||
}); |
5022
src/views/AIchat.vue
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue