Browse Source

Merge branch 'ds_hxl' into ds

ds_hxl
宋杰 2 weeks ago
parent
commit
37b90a175a
  1. 4
      .env.development
  2. 8
      package-lock.json
  3. 2
      package.json
  4. 59
      src/api/AIxiaocaishen.js
  5. BIN
      src/assets/img/AIchat/主力作战.png
  6. BIN
      src/assets/img/AIchat/攻防三维.png
  7. BIN
      src/assets/img/AIchat/核心价值评估标题.png
  8. BIN
      src/assets/img/AIchat/框.png
  9. BIN
      src/assets/img/AIchat/综合作战.png
  10. BIN
      src/assets/img/AIchat/罗盘边框.png
  11. BIN
      src/assets/img/AIchat/边框.png
  12. 1
      src/utils/request.js
  13. 5177
      src/views/AIchat.vue
  14. 396
      src/views/homePage.vue

4
.env.development

@ -5,8 +5,8 @@ VITE_OUTPUT_DIR = 'dev'
VITE_PUBLIC_PATH = / VITE_PUBLIC_PATH = /
#新数据接口 #新数据接口
# VITE_APP_API_BASE_URL = "http://39.101.133.168:8828/link"
VITE_APP_API_BASE_URL = "https://api.homilychart.com/link"
VITE_APP_API_BASE_URL = "http://39.101.133.168:8828/link"
# VITE_APP_API_BASE_URL = "https://api.homilychart.com/link"
VITE_APP_IMG_API_BASE_URL = "http://39.101.133.168:8828/hljw/api/aws/upload" VITE_APP_IMG_API_BASE_URL = "http://39.101.133.168:8828/hljw/api/aws/upload"
#MJ API #MJ API

8
package-lock.json

@ -21,7 +21,7 @@
"html-to-text": "^9.0.5", "html-to-text": "^9.0.5",
"katex": "^0.16.21", "katex": "^0.16.21",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "^15.0.7",
"marked": "^15.0.12",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"moment": "^2.30.1", "moment": "^2.30.1",
"pinia": "^2.3.1", "pinia": "^2.3.1",
@ -5117,9 +5117,9 @@
} }
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "15.0.7",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/marked/-/marked-15.0.7.tgz",
"integrity": "sha512-dgLIeKGLx5FwziAnsk4ONoGwHwGPJzselimvlVskE9XLN4Orv9u2VA3GWw/lYUqjfA0rUT/6fqKwfZJapP9BEg==",
"version": "15.0.12",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/marked/-/marked-15.0.12.tgz",
"integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==",
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"marked": "bin/marked.js" "marked": "bin/marked.js"

2
package.json

@ -28,7 +28,7 @@
"html-to-text": "^9.0.5", "html-to-text": "^9.0.5",
"katex": "^0.16.21", "katex": "^0.16.21",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "^15.0.7",
"marked": "^15.0.12",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"moment": "^2.30.1", "moment": "^2.30.1",
"pinia": "^2.3.1", "pinia": "^2.3.1",

59
src/api/AIxiaocaishen.js

@ -213,12 +213,53 @@ export const getMarketAndCodeAPI = function (params) {
}; };
// 登录获取次数接口 // 登录获取次数接口
export const addUsageAPI = function (params) { export const addUsageAPI = function (params) {
return request({
url: `${APIurl}/api/ai_god/addUsage`,
method: "POST",
data: new URLSearchParams(params),
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
return request({
url: `${APIurl}/api/ai_god/addUsage`,
method: "POST",
data: new URLSearchParams(params),
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
// duobao11
export const dbqbFirstAPI = function (params) {
return request({
url: `${APIurl}/api/workflow/dbqbFirst`,
method: "POST",
data: params,
});
};
// duobao21
export const dbqbSecondOneAPI = function (params) {
return request({
url: `${APIurl}/api/workflow/dbqbSecondOne`,
method: "POST",
data: params,
});
};
// duobao22
export const dbqbSecondTwoAPI = function (params) {
return request({
url: `${APIurl}/api/workflow/dbqbSecondTwo`,
method: "POST",
data: params,
});
};
// duobao23
export const dbqbSecondThreeAPI = function (params) {
return request({
url: `${APIurl}/api/workflow/dbqbSecondThree`,
method: "POST",
data: params,
});
};
// duobao24
export const dbqbSecondFourAPI = function (params) {
return request({
url: `${APIurl}/api/workflow/dbqbSecondFour`,
method: "POST",
data: params,
});
};

BIN
src/assets/img/AIchat/主力作战.png

After

Width: 603  |  Height: 64  |  Size: 32 KiB

BIN
src/assets/img/AIchat/攻防三维.png

After

Width: 597  |  Height: 64  |  Size: 36 KiB

BIN
src/assets/img/AIchat/核心价值评估标题.png

After

Width: 618  |  Height: 93  |  Size: 22 KiB

BIN
src/assets/img/AIchat/框.png

After

Width: 616  |  Height: 227  |  Size: 92 KiB

BIN
src/assets/img/AIchat/综合作战.png

After

Width: 597  |  Height: 64  |  Size: 35 KiB

BIN
src/assets/img/AIchat/罗盘边框.png

After

Width: 616  |  Height: 347  |  Size: 183 KiB

BIN
src/assets/img/AIchat/边框.png

After

Width: 630  |  Height: 468  |  Size: 196 KiB

1
src/utils/request.js

@ -115,6 +115,7 @@ service.interceptors.response.use(
const errorMsg = res.msg || 'Unkonw error' const errorMsg = res.msg || 'Unkonw error'
// ElMessage.error(errorMsg) // ElMessage.error(errorMsg)
// return Promise.reject(new Error(res.msg || 'Error')) // return Promise.reject(new Error(res.msg || 'Error'))
return response.data
} else { } else {
return response.data return response.data
} }

5177
src/views/AIchat.vue
File diff suppressed because it is too large
View File

396
src/views/homePage.vue

@ -3,14 +3,14 @@
import { ref, computed, onMounted, watch, nextTick, onUnmounted } from "vue"; import { ref, computed, onMounted, watch, nextTick, onUnmounted } from "vue";
import { setHeight } from "../utils/setHeight"; import { setHeight } from "../utils/setHeight";
import { getUserCountAPI } from "../api/AIxiaocaishen"; import { getUserCountAPI } from "../api/AIxiaocaishen";
import { ElMessage } from 'element-plus'
import { ElMessage } from "element-plus";
import AIchat from "./AIchat.vue"; import AIchat from "./AIchat.vue";
import AIfind from "./AIfind.vue"; import AIfind from "./AIfind.vue";
import Feedback from "./Feedback.vue"; import Feedback from "./Feedback.vue";
import { useAppBridge } from '../assets/js/useAppBridge.js'
import { useDataStore } from '@/store/dataList.js'
import { useChatStore } from '../store/chat'
import { useAudioStore } from '../store/audio'
import { useAppBridge } from "../assets/js/useAppBridge.js";
import { useDataStore } from "@/store/dataList.js";
import { useChatStore } from "../store/chat";
import { useAudioStore } from "../store/audio";
import _ from "lodash"; import _ from "lodash";
import logo from "../assets/img/homePage/logo.png"; import logo from "../assets/img/homePage/logo.png";
@ -23,7 +23,7 @@ import languageBtn from "../assets/img/homePage/tail/language.png";
import dbqbButton01 from "../assets/img/AiEmotion/dbqb-button01.png"; import dbqbButton01 from "../assets/img/AiEmotion/dbqb-button01.png";
import dbqbButton02 from "../assets/img/AiEmotion/dbqb-button02.png"; import dbqbButton02 from "../assets/img/AiEmotion/dbqb-button02.png";
import emotionButton01 from "../assets/img/AiEmotion/emotion-button01.png"; import emotionButton01 from "../assets/img/AiEmotion/emotion-button01.png";
import emotionButton02 from "../assets/img/AiEmotion/emotion-button02.png";
import emotionButton02 from "../assets/img/AiEmotion/emotion-button02.png";
import voice from "../assets/img/homePage/tail/voice.png"; import voice from "../assets/img/homePage/tail/voice.png";
import voiceNoActive from "../assets/img/homePage/tail/voice-no-active.png"; import voiceNoActive from "../assets/img/homePage/tail/voice-no-active.png";
import sendBtn from "../assets/img/homePage/tail/send.png"; import sendBtn from "../assets/img/homePage/tail/send.png";
@ -31,24 +31,23 @@ import msgBtn from "../assets/img/homePage/tail/msg.png";
import feedbackBtn from "../assets/img/Feedback/feedbackBtn.png"; import feedbackBtn from "../assets/img/Feedback/feedbackBtn.png";
import AiEmotion from "./AiEmotion.vue"; import AiEmotion from "./AiEmotion.vue";
// import VConsole from 'vconsole'; // import VConsole from 'vconsole';
// const vConsole = new VConsole(); // const vConsole = new VConsole();
// AiEmotion ref // AiEmotion ref
const aiEmotionRef = ref(null)
const aiEmotionRef = ref(null);
// import { useUserStore } from "../store/userPessionCode.js"; // import { useUserStore } from "../store/userPessionCode.js";
const { getQueryVariable, setActiveTabIndex } = useDataStore()
const dataStore = useDataStore()
const chatStore = useChatStore()
const { getQueryVariable, setActiveTabIndex } = useDataStore();
const dataStore = useDataStore();
const chatStore = useChatStore();
// //
// //
const audioStore = useAudioStore()
const isVoice = computed(() => audioStore.isVoiceEnabled)
const audioStore = useAudioStore();
const isVoice = computed(() => audioStore.isVoiceEnabled);
const toggleVoice = () => { const toggleVoice = () => {
audioStore.toggleVoice()
}
audioStore.toggleVoice();
};
// sessionStorage 使 'aifindCow'tab // sessionStorage 使 'aifindCow'tab
const activeTab = ref(sessionStorage.getItem("activeTabAI") || "AIchat"); const activeTab = ref(sessionStorage.getItem("activeTabAI") || "AIchat");
const activeIndex = ref( const activeIndex = ref(
@ -66,13 +65,13 @@ const tabs = computed(() => [
// }, // },
{ {
name: "AiEmotion", name: "AiEmotion",
label: "AI情绪大模型"
}
label: "AI情绪大模型",
},
]); ]);
// setActiveTab forceAIchat // setActiveTab forceAIchat
const setActiveTab = (tab, index, forceAIchat = false) => { const setActiveTab = (tab, index, forceAIchat = false) => {
isScrolling.value = false; //
isScrolling.value = false; //
isAnnouncementVisible.value = false; isAnnouncementVisible.value = false;
if (forceAIchat && activeTab.value !== "AIchat") { if (forceAIchat && activeTab.value !== "AIchat") {
activeTab.value = "AIchat"; activeTab.value = "AIchat";
@ -85,7 +84,7 @@ const setActiveTab = (tab, index, forceAIchat = false) => {
sessionStorage.setItem("activeTabAI", tab); sessionStorage.setItem("activeTabAI", tab);
sessionStorage.setItem("activeIndexAI", index.toString()); sessionStorage.setItem("activeIndexAI", index.toString());
} }
setActiveTabIndex(index)
setActiveTabIndex(index);
console.log(tab, index, "tab, index"); console.log(tab, index, "tab, index");
setHeight(document.getElementById("testId")); // setHeight(document.getElementById("testId")); //
}; };
@ -110,12 +109,11 @@ const ensureAIchat = () => {
}; };
// //
const UserCount = computed(() => chatStore.UserCount)
const UserCount = computed(() => chatStore.UserCount);
const getCount = () => { const getCount = () => {
console.log('点击了获取次数的按钮')
}
console.log("点击了获取次数的按钮");
};
// //
const isThinking = ref(true); const isThinking = ref(true);
@ -128,7 +126,9 @@ const message = ref("");
// //
const messages = ref([]); const messages = ref([]);
// //
const isLoading = computed(() => { chatStore.isLoading });
const isLoading = computed(() => {
chatStore.isLoading;
});
// //
const updateMessage = (title) => { const updateMessage = (title) => {
@ -136,14 +136,17 @@ const updateMessage = (title) => {
// console.log("updateMessage :", title); // console.log("updateMessage :", title);
}; };
const sendMessage = async () => { const sendMessage = async () => {
if (localStorage.getItem('localToken') == null || localStorage.getItem('localToken') == '') {
ElMessage.error('请先登录');
if (
localStorage.getItem("localToken") == null ||
localStorage.getItem("localToken") == ""
) {
ElMessage.error("请先登录");
return; return;
} }
isScrolling.value = false; isScrolling.value = false;
// AiEmotion // AiEmotion
if (activeTab.value === 'AiEmotion') {
if (activeTab.value === "AiEmotion") {
// AiEmotion handleSendMessage // AiEmotion handleSendMessage
aiEmotionRef.value?.handleSendMessage(message.value); aiEmotionRef.value?.handleSendMessage(message.value);
message.value = ""; // message.value = ""; //
@ -153,11 +156,11 @@ const sendMessage = async () => {
// ensureAIchat AIchat // ensureAIchat AIchat
ensureAIchat(); ensureAIchat();
console.log(chatStore.isLoading, 'isLoading.value1111');
console.log(chatStore.isLoading, "isLoading.value1111");
if (!message.value) return; if (!message.value) return;
if (chatStore.isLoading) return; if (chatStore.isLoading) return;
chatStore.setLoading(true); chatStore.setLoading(true);
console.log(chatStore.isLoading, 'isLoading.value2222');
console.log(chatStore.isLoading, "isLoading.value2222");
const messageContent = message.value; const messageContent = message.value;
// //
@ -172,12 +175,10 @@ const sendMessage = async () => {
sender: "user", sender: "user",
content: messageContent, content: messageContent,
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}
},
]; ];
console.log(messages.value, 'messages.value');
console.log(messages.value, "messages.value");
}, 200); }, 200);
}; };
// //
@ -190,8 +191,8 @@ const isAnnouncementVisible = ref(false);
const showAnnouncement = async () => { const showAnnouncement = async () => {
console.log("打开公告"); console.log("打开公告");
dataStore.isFeedback = false; // dataStore.isFeedback = false; //
isScrolling.value = false; //
setActiveTab('', -1); //
isScrolling.value = false; //
setActiveTab("", -1); //
isAnnouncementVisible.value = true; // isAnnouncementVisible.value = true; //
}; };
@ -200,7 +201,7 @@ const showAnnouncement = async () => {
const showFeedback = () => { const showFeedback = () => {
console.log("打开用户反馈"); console.log("打开用户反馈");
dataStore.isFeedback = true; // dataStore.isFeedback = true; //
}
};
// //
// ref // ref
@ -216,10 +217,10 @@ const showCount = () => {
// //
const tabContent = ref(null); const tabContent = ref(null);
const isScrolling = ref(false); //
const isScrolling = ref(false); //
const smoothScrollToBottom = async () => { const smoothScrollToBottom = async () => {
console.log('调用滚动到底部的方法')
console.log("调用滚动到底部的方法");
// await nextTick(); // await nextTick();
const container = tabContent.value; const container = tabContent.value;
// console.log(container, 'container') // console.log(container, 'container')
@ -235,10 +236,11 @@ const smoothScrollToBottom = async () => {
// container.scrollTop = container.scrollHeight + container.offsetHeight; // container.scrollTop = container.scrollHeight + container.offsetHeight;
// console.log(container.scrollHeight, container.offsetHeight, container.scrollHeight - container.offsetHeight, container.scrollTop, "", "", "") // console.log(container.scrollHeight, container.offsetHeight, container.scrollHeight - container.offsetHeight, container.scrollTop, "", "", "")
} }
};
}
const throttledSmoothScrollToBottom = _.throttle(smoothScrollToBottom, 500, { trailing: false });
const throttledSmoothScrollToBottom = _.throttle(smoothScrollToBottom, 500, {
trailing: false,
});
watch( watch(
() => chatStore.messages, () => chatStore.messages,
@ -250,16 +252,15 @@ watch(
{ deep: true, immediate: true } { deep: true, immediate: true }
); );
watch( watch(
activeTab, activeTab,
async () => { async () => {
console.log('activeTab变化了', activeTab.value)
if (activeTab.value === 'AIchat') {
isScrolling.value = false; //
console.log("activeTab变化了", activeTab.value);
if (activeTab.value === "AIchat") {
isScrolling.value = false; //
setTimeout(() => { setTimeout(() => {
throttledSmoothScrollToBottom(); throttledSmoothScrollToBottom();
}, 100)
}, 100);
} }
// setTimeout(throttledSmoothScrollToBottom, 100); // setTimeout(throttledSmoothScrollToBottom, 100);
}, },
@ -272,43 +273,46 @@ const fnGetToken = () => {
window.JWready = (ress) => { window.JWready = (ress) => {
// console.log('JWready') // console.log('JWready')
try { try {
ress = JSON.parse(ress)
ress = JSON.parse(ress);
// console.log(ress, 'ress') // console.log(ress, 'ress')
} catch (error) { } catch (error) {
console.log(error, 'fnGetToken error')
console.log(error, "fnGetToken error");
} //platform5app } //platform5app
// platform.value = ress.data.platform // platform.value = ress.data.platform
// //
console.log(ress.data.platform, 'ress.data.platform')
console.log(ress.data.platform, "ress.data.platform");
if (!ress.data.platform) { if (!ress.data.platform) {
// AppURL // AppURL
localStorage.setItem('localToken', decodeURIComponent(String(getQueryVariable('token'))))
localStorage.setItem(
"localToken",
decodeURIComponent(String(getQueryVariable("token")))
);
// localStorage.setItem('localToken', "+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w") // localStorage.setItem('localToken', "+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w")
} else { } else {
// App // App
useAppBridge().packageFun( useAppBridge().packageFun(
'JWgetStorage',
"JWgetStorage",
(response) => { (response) => {
const res = JSON.parse(response) //
localStorage.setItem('localToken', res.data)
const res = JSON.parse(response); //
localStorage.setItem("localToken", res.data);
// localStorage.setItem('localToken', "+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w") // localStorage.setItem('localToken', "+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w")
}, },
5, 5,
{ {
key: 'token'
key: "token",
} }
)
);
} }
}
};
// console.log('') // console.log('')
// App // App
useAppBridge().packageFun('JWwebReady', () => { }, 5, {})
}
useAppBridge().packageFun("JWwebReady", () => {}, 5, {});
};
// setTimeout // setTimeout
setTimeout(() => { setTimeout(() => {
fnGetToken()
}, 800)
fnGetToken();
}, 800);
const heightListener = () => { const heightListener = () => {
const tabContainer = tabContent.value; const tabContainer = tabContent.value;
@ -318,9 +322,10 @@ const heightListener = () => {
const aftertop = tabContainer.scrollTop; const aftertop = tabContainer.scrollTop;
// //
const isBottom = aftertop + tabContainer.offsetHeight + 50 >= tabContainer.scrollHeight;
const isBottom =
aftertop + tabContainer.offsetHeight + 50 >= tabContainer.scrollHeight;
if (activeTab.value === 'AIchat') {
if (activeTab.value === "AIchat") {
if (aftertop - befortop > 0) { if (aftertop - befortop > 0) {
// console.log(''); // console.log('');
isScrolling.value = true; isScrolling.value = true;
@ -340,52 +345,62 @@ const heightListener = () => {
// console.log(isScrolling.value, 'isScrolling.value') // console.log(isScrolling.value, 'isScrolling.value')
tabContainer.addEventListener('scroll', scrollHandler);
tabContainer.addEventListener("scroll", scrollHandler);
}; };
const throttledHeightListener = _.throttle(heightListener, 500, { trailing: false });
const throttledHeightListener = _.throttle(heightListener, 500, {
trailing: false,
});
const goToRecharge = () => { const goToRecharge = () => {
console.log('点击充值')
console.log("点击充值");
// http://39.101.133.168:8919/payment/recharge/index? // http://39.101.133.168:8919/payment/recharge/index?
// url=http%3A%2F%2Flocalhost%3A8080%2FLiveActivity%2Fpck // url=http%3A%2F%2Flocalhost%3A8080%2FLiveActivity%2Fpck
// &platform=1 // &platform=1
// &token=+S4h5QEE1hTIb4CxphrnbZi0+fEeMx8pywnIlrmTmo4QO6IolWnVWu5r+J4rKXMwK41UPfKqyIp+RvWmtM8 // &token=+S4h5QEE1hTIb4CxphrnbZi0+fEeMx8pywnIlrmTmo4QO6IolWnVWu5r+J4rKXMwK41UPfKqyIp+RvWmtM8
const userAgent = navigator.userAgent.toLowerCase(); const userAgent = navigator.userAgent.toLowerCase();
const mobileKeywords = ['mobile', 'android', 'iphone', 'ipad', 'ipod'];
const isMobile = mobileKeywords.some(keyword => userAgent.includes(keyword));
console.log(isMobile ? '手机' : '电脑')
const url = encodeURI("http://39.101.133.168:8857/aixiaocaishen/homePage")
console.log(url, 'url')
const platform = isMobile ? 2 : 1
const token = encodeURIComponent(localStorage.getItem('localToken'))
console.log(token, 'token')
const rechargeUrl = 'http://39.101.133.168:8919/payment/recharge/index?' + 'url=' + url + '&platform=' + platform + '&token=' + token
console.log(rechargeUrl, 'rechargeUrl')
window.location.href = rechargeUrl
const mobileKeywords = ["mobile", "android", "iphone", "ipad", "ipod"];
const isMobile = mobileKeywords.some((keyword) =>
userAgent.includes(keyword)
);
console.log(isMobile ? "手机" : "电脑");
const url = encodeURI("http://39.101.133.168:8857/aixiaocaishen/homePage");
console.log(url, "url");
const platform = isMobile ? 2 : 1;
const token = encodeURIComponent(localStorage.getItem("localToken"));
console.log(token, "token");
const rechargeUrl =
"http://39.101.133.168:8919/payment/recharge/index?" +
"url=" +
url +
"&platform=" +
platform +
"&token=" +
token;
console.log(rechargeUrl, "rechargeUrl");
window.location.href = rechargeUrl;
// window.open(rechargeUrl) // window.open(rechargeUrl)
}
};
const adjustFooterPosition = (height) => { const adjustFooterPosition = (height) => {
console.log('调整底部位置', height)
const footer = document.querySelector('.el-footer');
const main = document.querySelector('.el-main');
const homePage = document.querySelector('.homepage');
const app = document.getElementById('app');
console.log("调整底部位置", height);
const footer = document.querySelector(".el-footer");
const main = document.querySelector(".el-main");
const homePage = document.querySelector(".homepage");
const app = document.getElementById("app");
// Footer 60px // Footer // Footer 60px // Footer
// footer.style.bottom = `${keyboardHeight}px`;
// footer.style.bottom = `${keyboardHeight}px`;
// Main Footer + // Main Footer +
homePage.style.height = `${height}px`; homePage.style.height = `${height}px`;
// app.style.height = `${height}px`; // app.style.height = `${height}px`;
void homePage.offsetHeight; void homePage.offsetHeight;
const html = document.querySelector('html');
const body = document.querySelector('body');
const html = document.querySelector("html");
const body = document.querySelector("body");
html.style.height = `${height}px`; html.style.height = `${height}px`;
body.style.height = `${height}px`; body.style.height = `${height}px`;
@ -394,9 +409,9 @@ const adjustFooterPosition = (height) => {
setTimeout(() => { setTimeout(() => {
// //
html.style.overflow = 'hidden';
body.style.overflow = 'hidden';
}, 200)
html.style.overflow = "hidden";
body.style.overflow = "hidden";
}, 200);
// console.log(html.offsetHeight, 'html') // console.log(html.offsetHeight, 'html')
// console.log(html.clientHeight, 'html') // console.log(html.clientHeight, 'html')
@ -411,68 +426,74 @@ const adjustFooterPosition = (height) => {
// console.log(main.offsetHeight, 'main') // console.log(main.offsetHeight, 'main')
// console.log(main.clientHeight, 'mainClientHeight') // console.log(main.clientHeight, 'mainClientHeight')
// console.log(main.scrollHeight, 'mainScrollHeight') // console.log(main.scrollHeight, 'mainScrollHeight')
}; };
const onFocus = function () { const onFocus = function () {
const visualViewport = window.visualViewport
const visualViewport = window.visualViewport;
// //
setTimeout(() => { setTimeout(() => {
console.log('输入框聚焦')
console.log("输入框聚焦");
console.log(visualViewport.height, 'visualViewport.height')
const keyboardHeight = window.innerHeight - visualViewport.height
console.log(window.innerHeight, 'window.innerHeight')
console.log(keyboardHeight, 'keyboardHeight')
console.log(visualViewport.height, "visualViewport.height");
const keyboardHeight = window.innerHeight - visualViewport.height;
console.log(window.innerHeight, "window.innerHeight");
console.log(keyboardHeight, "keyboardHeight");
adjustFooterPosition(visualViewport.height)
}, 200)
}
adjustFooterPosition(visualViewport.height);
}, 200);
};
const onBlur = function () { const onBlur = function () {
const visualViewport = window.visualViewport
const visualViewport = window.visualViewport;
setTimeout(() => { setTimeout(() => {
console.log('输入框失焦')
console.log("输入框失焦");
const keyboardHeight = window.innerHeight - visualViewport.height
console.log(window.innerHeight, 'window.innerHeight')
console.log(visualViewport.height, 'visualViewport.height')
console.log(keyboardHeight, 'keyboardHeight')
adjustFooterPosition(visualViewport.height)
}, 200)
}
const keyboardHeight = window.innerHeight - visualViewport.height;
console.log(window.innerHeight, "window.innerHeight");
console.log(visualViewport.height, "visualViewport.height");
console.log(keyboardHeight, "keyboardHeight");
adjustFooterPosition(visualViewport.height);
}, 200);
};
window.addEventListener('resize', () => {
window.addEventListener("resize", () => {
// iOS // iOS
const isIOS = /iPhone|iPad|iPod|ios/i.test(navigator.userAgent); const isIOS = /iPhone|iPad|iPod|ios/i.test(navigator.userAgent);
console.log('是否为iOS设备:', isIOS);
console.log("是否为iOS设备:", isIOS);
if (!isIOS) { if (!isIOS) {
console.log('窗口大小变化')
const homePage = document.querySelector('.homepage');
console.log("窗口大小变化");
const homePage = document.querySelector(".homepage");
homePage.style.height = `${window.innerHeight}px`; homePage.style.height = `${window.innerHeight}px`;
} }
}); });
// //
document.addEventListener('touchmove', (e) => {
if (!dataStore.isFeedback) {
//
const isScrollableArea = e.target.closest('.tab-content');
//
if (!isScrollableArea) {
e.preventDefault();
document.addEventListener(
"touchmove",
(e) => {
if (!dataStore.isFeedback) {
//
const isScrollableArea = e.target.closest(".tab-content");
//
if (!isScrollableArea) {
e.preventDefault();
}
} }
}
}, { passive: false });
},
{ passive: false }
);
onMounted(async () => { onMounted(async () => {
const isPhone = const isPhone =
/phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test( /phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test(
navigator.userAgent navigator.userAgent
)
);
!isPhone && !isPhone &&
localStorage.setItem('localToken', decodeURIComponent(String(getQueryVariable('token'))))
localStorage.setItem(
"localToken",
decodeURIComponent(String(getQueryVariable("token")))
);
setHeight(document.getElementById("testId")); // setHeight(document.getElementById("testId")); //
// //
await chatStore.getUserCount(); await chatStore.getUserCount();
@ -486,7 +507,7 @@ onMounted(async () => {
// //
// updateAppHeight(); // updateAppHeight();
})
});
</script> </script>
<template> <template>
@ -505,8 +526,16 @@ onMounted(async () => {
<img :src="getCountAll" class="action-btn" /> <img :src="getCountAll" class="action-btn" />
<div class="count-number">{{ UserCount }}</div> <div class="count-number">{{ UserCount }}</div>
</div> </div>
<img :src="announcementBtn" class="announcement-btn action-btn" @click="showAnnouncement" />
<img :src="feedbackBtn" class="announcement-btn action-btn" @click="showFeedback" />
<img
:src="announcementBtn"
class="announcement-btn action-btn"
@click="showAnnouncement"
/>
<img
:src="feedbackBtn"
class="announcement-btn action-btn"
@click="showFeedback"
/>
</div> </div>
</el-header> </el-header>
@ -515,18 +544,30 @@ onMounted(async () => {
<div class="main-wrapper"> <div class="main-wrapper">
<section class="tab-section"> <section class="tab-section">
<div class="tab-container"> <div class="tab-container">
<div v-for="(tab, index) in tabs" :key="tab.name" @click="setActiveTab(tab.name, index)"
:class="['tab-item', { active: activeIndex === index && !isAnnouncementVisible }]">
<div
v-for="(tab, index) in tabs"
:key="tab.name"
@click="setActiveTab(tab.name, index)"
:class="[
'tab-item',
{ active: activeIndex === index && !isAnnouncementVisible },
]"
>
<span>{{ tab.label }}</span> <span>{{ tab.label }}</span>
</div> </div>
</div> </div>
</section> </section>
<div class="tab-content" ref="tabContent"> <div class="tab-content" ref="tabContent">
<component :is="activeComponent" :messages="messages" @updateMessage="updateMessage"
@sendMessage="sendMessage" @ensureAIchat="ensureAIchat" ref="aiEmotionRef"/>
<component
:is="activeComponent"
:messages="messages"
@updateMessage="updateMessage"
@sendMessage="sendMessage"
@ensureAIchat="ensureAIchat"
ref="aiEmotionRef"
/>
</div> </div>
</div> </div>
</el-main> </el-main>
<!-- 尾部 问题输入框 深度思考 多语言 语音播报 --> <!-- 尾部 问题输入框 深度思考 多语言 语音播报 -->
<el-footer class="homepage-footer" id="input"> <el-footer class="homepage-footer" id="input">
@ -537,24 +578,41 @@ onMounted(async () => {
<img v-else :src="thinkNoActive" @click="toggleThink" class="action-btn" /> <img v-else :src="thinkNoActive" @click="toggleThink" class="action-btn" />
<img :src="languageBtn" @click="changeLanguage" class="action-btn" /> --> <img :src="languageBtn" @click="changeLanguage" class="action-btn" /> -->
<!-- 夺宝奇兵大模型按钮 --> <!-- 夺宝奇兵大模型按钮 -->
<img
:src="activeTab === 'AIchat' ? dbqbButton02 : dbqbButton01"
@click="setActiveTab('AIchat', 0)"
class="action-btn model-btn"
alt="夺宝奇兵大模型"
<img
:src="activeTab === 'AIchat' ? dbqbButton02 : dbqbButton01"
@click="setActiveTab('AIchat', 0)"
class="action-btn model-btn"
alt="夺宝奇兵大模型"
/> />
<!-- AI情绪大模型按钮 --> <!-- AI情绪大模型按钮 -->
<img
:src="activeTab === 'AiEmotion' ? emotionButton02 : emotionButton01"
@click="setActiveTab('AiEmotion', 1)"
class="action-btn model-btn"
alt="AI情绪大模型"
<img
:src="
activeTab === 'AiEmotion' ? emotionButton02 : emotionButton01
"
@click="setActiveTab('AiEmotion', 1)"
class="action-btn model-btn"
alt="AI情绪大模型"
/>
<img
v-if="isVoice"
:src="voice"
@click="toggleVoice"
class="action-btn"
/>
<img
v-else
:src="voiceNoActive"
@click="toggleVoice"
class="action-btn"
/> />
<img v-if="isVoice" :src="voice" @click="toggleVoice" class="action-btn" />
<img v-else :src="voiceNoActive" @click="toggleVoice" class="action-btn" />
</div> </div>
<img v-if="!chatStore.isLoading" :src="sendBtn" @click="sendMessage" class="action-btn send-btn" />
<div v-else>
<img
v-if="!chatStore.isLoading"
:src="sendBtn"
@click="sendMessage"
class="action-btn send-btn"
/>
<div v-else @click="chatStore.setLoading(false)">
<el-icon class="is-loading"> <el-icon class="is-loading">
<Loading /> <Loading />
</el-icon> </el-icon>
@ -564,9 +622,17 @@ onMounted(async () => {
<!-- 第二行输入框 --> <!-- 第二行输入框 -->
<div class="footer-second-line"> <div class="footer-second-line">
<img :src="msgBtn" class="msg-icon" /> <img :src="msgBtn" class="msg-icon" />
<el-input type="textarea" v-model="message" @focus="onFocus" @blur="onBlur"
:autosize="{ minRows: 1, maxRows: 4 }" placeholder="给AI小财神发消息..." class="msg-input"
@keydown.enter.exact.prevent="isLoading ? null : sendMessage()" resize="none">
<el-input
type="textarea"
v-model="message"
@focus="onFocus"
@blur="onBlur"
:autosize="{ minRows: 1, maxRows: 4 }"
placeholder="给AI小财神发消息..."
class="msg-input"
@keydown.enter.exact.prevent="isLoading ? null : sendMessage()"
resize="none"
>
</el-input> </el-input>
</div> </div>
</el-footer> </el-footer>
@ -584,8 +650,16 @@ onMounted(async () => {
<img :src="getCountAll" class="action-btn" /> <img :src="getCountAll" class="action-btn" />
<div class="count-number">{{ UserCount }}</div> <div class="count-number">{{ UserCount }}</div>
</div> </div>
<img :src="announcementBtn" class="announcement-btn action-btn" @click="showAnnouncement" />
<img :src="feedbackBtn" class="announcement-btn action-btn" @click="showFeedback" />
<img
:src="announcementBtn"
class="announcement-btn action-btn"
@click="showAnnouncement"
/>
<img
:src="feedbackBtn"
class="announcement-btn action-btn"
@click="showFeedback"
/>
</div> </div>
</el-header> </el-header>
@ -605,15 +679,9 @@ onMounted(async () => {
</template> </template>
<!-- 中间内容部分 --> <!-- 中间内容部分 -->
<div class="ruleContent"> <div class="ruleContent">
<p>
试运行期间AI小财神可以检索全市场数据
</p>
<p>
每个市场20支股票股票详情参见公告页面
</p>
<p>
弘历会员每人每日拥有10次检索机会
</p>
<p>试运行期间AI小财神可以检索全市场数据</p>
<p>每个市场20支股票股票详情参见公告页面</p>
<p>弘历会员每人每日拥有10次检索机会</p>
</div> </div>
<!-- <template #footer> --> <!-- <template #footer> -->
<!-- 添加一个div来包裹按钮并设置样式使其居中 --> <!-- 添加一个div来包裹按钮并设置样式使其居中 -->
@ -655,7 +723,7 @@ onMounted(async () => {
.tab-item.active { .tab-item.active {
/* color: #000; /* color: #000;
border-color: #000; */ border-color: #000; */
background: linear-gradient(0deg, #ffffff, #fec13e);
background: linear-gradient(0deg, #ffffff, #fec13e);
-webkit-background-clip: text; -webkit-background-clip: text;
background-clip: text; background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;

Loading…
Cancel
Save