10 Commits

  1. 21
      api/customerServicePlatform/customerServicePlatform.js
  2. 122
      pages/customerServicePlatform/questionDetail.vue
  3. 29
      pages/deepExploration/MainForceActions.vue
  4. 6
      pages/deepExploration/deepExploration.vue
  5. 14
      pages/marketSituation/marketOverview.vue
  6. 2
      pages/start/startup/startup.vue
  7. BIN
      static/start-gif.gif

21
api/customerServicePlatform/customerServicePlatform.js

@ -9,9 +9,24 @@ export const uploadImageApi = (data) => {
data
})
}
//问题回答
export const getAnswerApi = (data) => {
//问题回答最终内容
export const getAnswerContentApi = (data) => {
return http({
method: 'POST',
url: '/api/customer/getAnswer',
data
})
}
//问题回答轮询
export const getAnswerStatusApi = (data) => {
return http({
method: 'POST',
url: '/api/customer/getState',
data
})
}
//问题回答获取Id
export const getAnswerIdApi = (data) => {
return http({
method: 'POST',
url: '/api/customer/askQuestion',

122
pages/customerServicePlatform/questionDetail.vue

@ -14,7 +14,7 @@
</view>
</view>
<scroll-view scroll-y class="content-container">
<scroll-view scroll-y class="content-container" :scroll-into-view="scrollIntoView">
<view class="content-header">
<view class="content-header-area">
@ -47,7 +47,7 @@
<view class="card-text">
<rich-text :nodes="renderMarkdown(answerContent)"></rich-text>
<view id="answer-end" style="width:1px;height:1px;"></view>
<!-- <text class="card-paragraph">
{{answerContent}}
</text> -->
@ -66,7 +66,9 @@
<script>
import {
getAnswerApi
getAnswerIdApi,
getAnswerStatusApi,
getAnswerContentApi
} from "../../api/customerServicePlatform/customerServicePlatform";
import marked from "marked"; // marked
@ -78,12 +80,21 @@
questionTitle: '',
answerContent: '正在思考...',
showLoginRegister: false,
//
pollInterval: null,
pollTimeout: null,
scrollIntoView: ''
};
},
mounted() {
this.iSMT = uni.getSystemInfoSync().statusBarHeight || 0;
this.getAnswerContent()
},
onUnload() {
clearInterval(this.pollInterval);
clearTimeout(this.pollTimeout);
clearInterval(this.interval);
},
onLoad(options) {
if (options.question) {
this.questionTitle = decodeURIComponent(options.question);
@ -95,6 +106,18 @@
}
},
methods: {
scrollToBottom() {
// 使 $nextTick rich-text /DOM
this.$nextTick(() => {
// idscroll-view 使
this.scrollIntoView = 'answer-end';
// 便
setTimeout(() => {
this.scrollIntoView = '';
}, 100);
});
},
renderMarkdown(content) {
const renderer = new marked.Renderer();
// renderer.heading = function (text, level) {
@ -120,39 +143,102 @@
},
async getAnswerContent() {
let conversationId = '';
let chatId = '';
//
try {
const cache = uni.getStorageSync('conversationId');
const chatIdCache = uni.getStorageSync('chatId');
if (cache) conversationId = cache;
if (chatIdCache) chatId = chatIdCache
} catch (e) {
conversationId = '';
}
try {
const res = await getAnswerApi({
const res = await getAnswerIdApi({
question: this.questionTitle,
conversationId: conversationId,
chatId: chatId
})
console.log(res)
if (res.code == 200) {
uni.setStorageSync('conversationId', res.data.conversationId);
const answer = res.data.answer
//
let currentIndex = 0;
const answerLength = answer.length;
if (res.code == 200 && res.data.chatId) {
const resConversationId = res.data.conversationId;
const resChatId = res.data.chatId;
uni.setStorageSync('conversationId', resConversationId);
uni.setStorageSync('chatId', resChatId);
let pollCount = 0;
const maxPoll = 10;
this.pollInterval && clearInterval(this.pollInterval);
this.pollTimeout && clearTimeout(this.pollTimeout);
// === ===
const checkStatus = async () => {
pollCount++;
const pollRes = await getAnswerStatusApi({
conversationId: resConversationId,
chatId: resChatId
});
console.log("pollRes =>", pollRes);
const status = pollRes?.data;
//
if (status === "completed") {
clearInterval(this.pollInterval);
clearTimeout(this.pollTimeout);
//
const answerRes = await getAnswerContentApi({
conversationId: resConversationId,
chatId: resChatId
});
console.log("answerRes =>", answerRes);
const answer = answerRes?.data;
//
if (answer) {
//
let currentIndex = 0;
const answerLength = answer.length;
this.interval && clearInterval(this.interval);
this.interval = setInterval(() => {
this.answerContent = answer.slice(0, currentIndex);
currentIndex++;
this.scrollToBottom();
if (currentIndex > answerLength) {
clearInterval(this.interval);
this.scrollToBottom();
}
}, Math.floor(Math.random() * (150 - 30 + 1)) + 30);
} else {
this.answerContent = "获取回答失败,请重试";
}
return;
}
//10
if (pollCount >= maxPoll) {
clearInterval(this.pollInterval);
clearTimeout(this.pollTimeout);
this.answerContent = "获取回答失败,请重试";
return;
}
//
this.interval = setInterval(() => {
this.answerContent = answer.slice(0, currentIndex);
currentIndex++;
};
if (currentIndex > answerLength) {
clearInterval(this.interval);
}
}, Math.floor(Math.random() * (150 - 30 + 1)) + 30);
// 2
this.pollInterval = setInterval(checkStatus, 2000);
// 10s
this.pollTimeout = setTimeout(() => {
clearInterval(this.pollInterval);
this.answerContent = "获取回答失败,请重试";
}, 20000);
} else {
this.answerContent = '获取回答失败,请重试';
}
} catch {
this.pollInterval && clearInterval(this.pollInterval);
this.pollTimeout && clearTimeout(this.pollTimeout);
this.interval && clearInterval(this.interval);
this.answerContent = '获取回答失败,请重试';
}
},

29
pages/deepExploration/MainForceActions.vue

@ -36,13 +36,14 @@
<text>{{stockAdd}}</text>
</view>
<view class="graph_content">
<view class="charts-box">
<view class="loadingGraph" v-show="graphLoading">加载中...</view>
<view class="charts-box" v-show="!graphLoading">
<!-- uCharts 蜡烛图组件 -->
<qiun-data-charts type="candle" :opts="opts" :chartData="chartData" :disableScroll="true"
:ontouch="true" :onzoom="true" :key="chartKey" />
</view>
<image @click.stop="showFullscreenKline" src="/static/deepExploration-images/kLineAll.png"
mode="aspectFill"></image>
<!-- <image @click.stop="showFullscreenKline" src="/static/deepExploration-images/kLineAll.png"
mode="aspectFill"></image> -->
</view>
</view>
@ -135,6 +136,8 @@
const isLandscape = ref(true); //
const fullscreenChartKey = ref(0); //
const graphLoading = ref(true)
// K线
@ -245,7 +248,7 @@
//
const handleModels = async () => {
try {
graphLoading.value = true
if (userInfo.isVisitor) {
console.log('是游客');
loginPrompt.value.show()
@ -479,6 +482,7 @@
chartData.value = {
...rawData
}
graphLoading.value = false
chartKey.value++;
console.log('chartData', chartData.value);
}
@ -842,13 +846,22 @@
}
text:nth-child(3) {
margin-left: 150rpx;
margin-left: 110rpx;
}
}
.graph_content {
position: relative;
min-height: 500rpx;
display: flex;
justify-content: center;
align-items: center;
.loadingGraph {
font-size: 35rpx;
color: #6a6a6a;
}
image {
position: absolute;
@ -895,8 +908,10 @@
/* 全屏容器 */
.fullscreen-container {
width: 100vh; /* 横屏时宽度等于屏幕高度 */
height: 100vw; /* 横屏时高度等于屏幕宽度 */
width: 100vh;
/* 横屏时宽度等于屏幕高度 */
height: 100vw;
/* 横屏时高度等于屏幕宽度 */
transition: transform 0.3s ease;
position: relative;
}

6
pages/deepExploration/deepExploration.vue

@ -45,8 +45,8 @@
</view>
</view>
<view class="stockSelection_content">
<view class="selectionItem">
<view class="stockSelection_content" >
<view class="selectionItem" @click="viewAll">
<view class="header">
<view class="left">
<image
@ -81,7 +81,7 @@
</view>
<view class="stockSelection_content">
<view class="selectionItem">
<view class="selectionItem" @click="viewAll">
<view class="header">
<view class="left">
<image

14
pages/marketSituation/marketOverview.vue

@ -8,16 +8,16 @@
<view class="content">
<view class="map">
<view class="INDU"
>道琼斯<view :class="getSignClass(INDU.value)">{{ judgeSymbol(INDU.value) }}</view></view
>道琼斯<view :class="getSignClass(INDU.value)" @click="viewDetail(INDU)">{{ judgeSymbol(INDU.value) }}</view></view
>
<view class="NDX"
>纳斯达克<view :class="getSignClass(NDX.value)">{{ judgeSymbol(NDX.value) }}</view></view
>纳斯达克<view :class="getSignClass(NDX.value)" @click="viewDetail(NDX)">{{ judgeSymbol(NDX.value) }}</view></view
>
<view class="HSI"
>恒生指数<view :class="getSignClass(HSI.value)">{{ judgeSymbol(HSI.value) }}</view></view
>恒生指数<view :class="getSignClass(HSI.value)" @click="viewDetail(HSI)">{{ judgeSymbol(HSI.value) }}</view></view
>
<view class="CN"
>上证指数<view :class="getSignClass(CN.value)">{{ judgeSymbol(CN.value) }}</view></view
>上证指数<view :class="getSignClass(CN.value)" @click="viewDetail(CN)">{{ judgeSymbol(CN.value) }}</view></view
>
<image src="/static/marketSituation-image/map.png" mode="widthFix"></image>
</view>
@ -83,6 +83,12 @@ const CN = ref({ stockName: "上证指数", stockCode: "1A0001", value: "" });
const pageIndex = ref(0);
const scrollToView = ref("");
const viewDetail = (item) => {
uni.navigateTo({
url: `/pages/marketSituation/marketCondition?stockInformation=${encodeURIComponent(JSON.stringify(item))}&from=map`,
});
};
// contenttop
const contentTopPosition = computed(() => {
const statusBarHeight = iSMT.value || 0;

2
pages/start/startup/startup.vue

@ -40,7 +40,7 @@ onShow(() => {
animationDuration: 1000,
});
}
}, 2000);
}, 3500);
});
</script>

BIN
static/start-gif.gif

Before

Width: 750  |  Height: 1624  |  Size: 298 KiB

After

Width: 750  |  Height: 1624  |  Size: 414 KiB

Loading…
Cancel
Save