10 Commits

  1. 21
      api/customerServicePlatform/customerServicePlatform.js
  2. 122
      pages/customerServicePlatform/questionDetail.vue
  3. 51
      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 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({ return http({
method: 'POST', method: 'POST',
url: '/api/customer/askQuestion', url: '/api/customer/askQuestion',

122
pages/customerServicePlatform/questionDetail.vue

@ -14,7 +14,7 @@
</view> </view>
</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">
<view class="content-header-area"> <view class="content-header-area">
@ -47,7 +47,7 @@
<view class="card-text"> <view class="card-text">
<rich-text :nodes="renderMarkdown(answerContent)"></rich-text> <rich-text :nodes="renderMarkdown(answerContent)"></rich-text>
<view id="answer-end" style="width:1px;height:1px;"></view>
<!-- <text class="card-paragraph"> <!-- <text class="card-paragraph">
{{answerContent}} {{answerContent}}
</text> --> </text> -->
@ -66,7 +66,9 @@
<script> <script>
import { import {
getAnswerApi
getAnswerIdApi,
getAnswerStatusApi,
getAnswerContentApi
} from "../../api/customerServicePlatform/customerServicePlatform"; } from "../../api/customerServicePlatform/customerServicePlatform";
import marked from "marked"; // marked import marked from "marked"; // marked
@ -78,12 +80,21 @@
questionTitle: '', questionTitle: '',
answerContent: '正在思考...', answerContent: '正在思考...',
showLoginRegister: false, showLoginRegister: false,
//
pollInterval: null,
pollTimeout: null,
scrollIntoView: ''
}; };
}, },
mounted() { mounted() {
this.iSMT = uni.getSystemInfoSync().statusBarHeight || 0; this.iSMT = uni.getSystemInfoSync().statusBarHeight || 0;
this.getAnswerContent() this.getAnswerContent()
}, },
onUnload() {
clearInterval(this.pollInterval);
clearTimeout(this.pollTimeout);
clearInterval(this.interval);
},
onLoad(options) { onLoad(options) {
if (options.question) { if (options.question) {
this.questionTitle = decodeURIComponent(options.question); this.questionTitle = decodeURIComponent(options.question);
@ -95,6 +106,18 @@
} }
}, },
methods: { methods: {
scrollToBottom() {
// 使 $nextTick rich-text /DOM
this.$nextTick(() => {
// idscroll-view 使
this.scrollIntoView = 'answer-end';
// 便
setTimeout(() => {
this.scrollIntoView = '';
}, 100);
});
},
renderMarkdown(content) { renderMarkdown(content) {
const renderer = new marked.Renderer(); const renderer = new marked.Renderer();
// renderer.heading = function (text, level) { // renderer.heading = function (text, level) {
@ -120,39 +143,102 @@
}, },
async getAnswerContent() { async getAnswerContent() {
let conversationId = ''; let conversationId = '';
let chatId = '';
//
try { try {
const cache = uni.getStorageSync('conversationId'); const cache = uni.getStorageSync('conversationId');
const chatIdCache = uni.getStorageSync('chatId');
if (cache) conversationId = cache; if (cache) conversationId = cache;
if (chatIdCache) chatId = chatIdCache
} catch (e) { } catch (e) {
conversationId = ''; conversationId = '';
} }
try { try {
const res = await getAnswerApi({
const res = await getAnswerIdApi({
question: this.questionTitle, question: this.questionTitle,
conversationId: conversationId, conversationId: conversationId,
chatId: chatId
}) })
console.log(res) 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 { } else {
this.answerContent = '获取回答失败,请重试'; this.answerContent = '获取回答失败,请重试';
} }
} catch { } catch {
this.pollInterval && clearInterval(this.pollInterval);
this.pollTimeout && clearTimeout(this.pollTimeout);
this.interval && clearInterval(this.interval);
this.answerContent = '获取回答失败,请重试'; this.answerContent = '获取回答失败,请重试';
} }
}, },

51
pages/deepExploration/MainForceActions.vue

@ -36,13 +36,14 @@
<text>{{stockAdd}}</text> <text>{{stockAdd}}</text>
</view> </view>
<view class="graph_content"> <view class="graph_content">
<view class="charts-box">
<view class="loadingGraph" v-show="graphLoading">加载中...</view>
<view class="charts-box" v-show="!graphLoading">
<!-- uCharts 蜡烛图组件 --> <!-- uCharts 蜡烛图组件 -->
<qiun-data-charts type="candle" :opts="opts" :chartData="chartData" :disableScroll="true" <qiun-data-charts type="candle" :opts="opts" :chartData="chartData" :disableScroll="true"
:ontouch="true" :onzoom="true" :key="chartKey" /> :ontouch="true" :onzoom="true" :key="chartKey" />
</view> </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>
</view> </view>
@ -135,6 +136,8 @@
const isLandscape = ref(true); // const isLandscape = ref(true); //
const fullscreenChartKey = ref(0); // const fullscreenChartKey = ref(0); //
const graphLoading = ref(true)
// K线 // K线
@ -245,7 +248,7 @@
// //
const handleModels = async () => { const handleModels = async () => {
try { try {
graphLoading.value = true
if (userInfo.isVisitor) { if (userInfo.isVisitor) {
console.log('是游客'); console.log('是游客');
loginPrompt.value.show() loginPrompt.value.show()
@ -479,6 +482,7 @@
chartData.value = { chartData.value = {
...rawData ...rawData
} }
graphLoading.value = false
chartKey.value++; chartKey.value++;
console.log('chartData', chartData.value); console.log('chartData', chartData.value);
} }
@ -549,7 +553,7 @@
} }
} }
}) })
// //
const fullscreenOpts = ref({ const fullscreenOpts = ref({
...opts.value, // ...opts.value, //
@ -842,13 +846,22 @@
} }
text:nth-child(3) { text:nth-child(3) {
margin-left: 150rpx;
margin-left: 110rpx;
} }
} }
.graph_content { .graph_content {
position: relative; position: relative;
min-height: 500rpx; min-height: 500rpx;
display: flex;
justify-content: center;
align-items: center;
.loadingGraph {
font-size: 35rpx;
color: #6a6a6a;
}
image { image {
position: absolute; position: absolute;
@ -865,20 +878,20 @@
} }
} }
} }
/* 横屏按钮样式 */ /* 横屏按钮样式 */
.rotate-btn { .rotate-btn {
background: transparent; background: transparent;
padding: 0 10rpx; padding: 0 10rpx;
margin-left: 15rpx; margin-left: 15rpx;
.btn-icon { .btn-icon {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
vertical-align: middle; vertical-align: middle;
} }
} }
/* 全屏遮罩 */ /* 全屏遮罩 */
.fullscreen-mask { .fullscreen-mask {
position: fixed; position: fixed;
@ -892,47 +905,49 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
/* 全屏容器 */ /* 全屏容器 */
.fullscreen-container { .fullscreen-container {
width: 100vh; /* 横屏时宽度等于屏幕高度 */
height: 100vw; /* 横屏时高度等于屏幕宽度 */
width: 100vh;
/* 横屏时宽度等于屏幕高度 */
height: 100vw;
/* 横屏时高度等于屏幕宽度 */
transition: transform 0.3s ease; transition: transform 0.3s ease;
position: relative; position: relative;
} }
/* 关闭按钮 */ /* 关闭按钮 */
.fullscreen-close { .fullscreen-close {
position: absolute; position: absolute;
top: 20rpx; top: 20rpx;
right: 20rpx; right: 20rpx;
z-index: 10; z-index: 10;
image { image {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
} }
} }
/* 旋转按钮 */ /* 旋转按钮 */
.fullscreen-rotate { .fullscreen-rotate {
position: absolute; position: absolute;
top: 20rpx; top: 20rpx;
left: 20rpx; left: 20rpx;
z-index: 10; z-index: 10;
image { image {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
} }
} }
/* 全屏图表容器 */ /* 全屏图表容器 */
.fullscreen-chart { .fullscreen-chart {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
/* 竖屏模式适配 */ /* 竖屏模式适配 */
:deep(.fullscreen-container:not([style*="rotate(90deg)"])) { :deep(.fullscreen-container:not([style*="rotate(90deg)"])) {
width: 100vw; width: 100vw;

6
pages/deepExploration/deepExploration.vue

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

14
pages/marketSituation/marketOverview.vue

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

2
pages/start/startup/startup.vue

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