Browse Source

Merge branch 'milestone-20251031-简版功能开发' of http://39.101.133.168:8807/qimaohong/deepChartVueApp into wangyi/feature-20251026183100-deepmate王毅

lihuilin/feature-20251024095243-我的
wangyi 3 weeks ago
parent
commit
dea3bfcc8b
  1. 4
      api/customerServicePlatform/customerServicePlatform.js
  2. 9
      api/deepExploration/deepExploration.js
  3. 2491
      common/stockTimeInformation.js
  4. 8
      components/IndexCard.vue
  5. 6
      components/deepExploration_header.vue
  6. 59
      pages/customerServicePlatform/questionDetail.vue
  7. 21
      pages/deepExploration/MainForceActions.vue
  8. 6
      pages/deepExploration/deepExploration.vue
  9. 13
      pages/deepMate/deepMate.vue
  10. 112
      pages/marketSituation/marketDetail.vue
  11. 138
      pages/marketSituation/marketOverview.vue
  12. 4
      pages/marketSituation/marketSituation.vue

4
api/customerServicePlatform/customerServicePlatform.js

@ -14,7 +14,7 @@ export const uploadImageApi = (data) => {
export const getAnswerApi = (data) => {
return http({
method: 'POST',
url: 'http://pbb6edde.natappfree.cc' +'/api/customer/askQuestion',
url: '/api/customer/askQuestion',
data
})
}
@ -23,7 +23,7 @@ export const getAnswerApi = (data) => {
export const getQuestionApi = (data) => {
return http({
method: 'GET',
url: 'http://pbb6edde.natappfree.cc' +'/api/customer/getQuestion',
url: '/api/customer/getQuestion',
})
}

9
api/deepExploration/deepExploration.js

@ -101,6 +101,15 @@ export const RecordListApi = (data) => {
data:data
})
}
//历史记录删除
export const RecordListDeleteApi = (data) => {
return http({
method: 'POST',
url: '/api/coze/deleteRecord',
data:data
})
}
// 选股策略
export const stocSelectApi = (data) => {
return http({

2491
common/stockTimeInformation.js
File diff suppressed because it is too large
View File

8
components/IndexCard.vue

@ -12,8 +12,8 @@
<view class="price-info">
<text class="current-price" :style="{ color: priceColor }">{{ currentPrice }}</text>
<view class="change-info">
<text class="change-amount" :style="{ color: priceColor }">{{ changeAmount }}</text>
<text class="change-percent" :style="{ color: priceColor }">{{ changePercent }}</text>
<text class="change-amount" :style="{ color: priceColor }">{{ judgeSymbol(changeAmount) }}</text>
<text class="change-percent" :style="{ color: priceColor }">{{ judgeSymbol(changePercent) }}</text>
</view>
</view>
@ -63,6 +63,10 @@ const props = defineProps({
},
});
const judgeSymbol = (num) => {
return num[0] === "-" ? num : "+" + num;
};
const getMarketFlag = (market) => {
let imagePath;

6
components/deepExploration_header.vue

@ -98,6 +98,7 @@
import {
RecordListApi,
RecordInfoApi,
RecordListDeleteApi
} from "../api/deepExploration/deepExploration";
import { ref, onMounted, computed } from "vue";
import { useDeepExplorationStore } from "../stores/modules/deepExploration";
@ -147,8 +148,9 @@ const openHistoryDrawer = async () => {
};
const clearAllHistory = () => {
searchHistory.value = [];
historyList.value = [];
RecordListDeleteApi({
})
// uni.setStorageSync("search_history", []);
};

59
pages/customerServicePlatform/questionDetail.vue

@ -45,9 +45,12 @@
mode="aspectFit"></image>
<view class="card-text">
<text class="card-paragraph">
<rich-text :nodes="renderMarkdown(answerContent)"></rich-text>
<!-- <text class="card-paragraph">
{{answerContent}}
</text>
</text> -->
</view>
</view>
@ -65,6 +68,8 @@
import {
getAnswerApi
} from "../../api/customerServicePlatform/customerServicePlatform";
import marked from "marked"; // marked
export default {
data() {
return {
@ -72,7 +77,7 @@
iSMT: 0,
questionTitle: '',
answerContent: '正在思考...',
showLoginRegister:false,
showLoginRegister: false,
};
},
mounted() {
@ -90,6 +95,29 @@
}
},
methods: {
renderMarkdown(content) {
const renderer = new marked.Renderer();
// renderer.heading = function (text, level) {
// return `<p>${text}</p>`;
// };
// marked
marked.setOptions({
renderer: renderer,
highlight: null, //
langPrefix: "language-",
pedantic: false,
gfm: true,
breaks: false,
sanitize: false,
smartLists: true,
smartypants: false,
xhtml: false,
});
if (!content) return "";
let renderedContent = marked.parse(content);
renderedContent = renderedContent.replace(/\*/g, '');
return renderedContent;
},
async getAnswerContent() {
let conversationId = '';
try {
@ -98,7 +126,7 @@
} catch (e) {
conversationId = '';
}
try {
const res = await getAnswerApi({
question: this.questionTitle,
conversationId: conversationId,
@ -108,18 +136,29 @@
if (res.code == 200) {
uni.setStorageSync('conversationId', res.data.conversationId);
const answer = res.data.answer
this.answerContent = '';
for (let i = 0; i < answer.length; i++) {
this.answerContent += answer[i];
await this.sleepTime();
//
let currentIndex = 0;
const answerLength = answer.length;
//
this.interval = setInterval(() => {
this.answerContent = answer.slice(0, currentIndex);
currentIndex++;
if (currentIndex > answerLength) {
clearInterval(this.interval);
}
}, Math.floor(Math.random() * (150 - 30 + 1)) + 30);
} else {
this.answerContent = '获取回答失败,请重试';
}
} catch {
this.answerContent = '获取回答失败,请重试';
}
},
async sleepTime() {
sleepTime() {
const ms = Math.floor(Math.random() * (300 - 30 + 1)) + 30;
return new Promise(resolve => setTimeout(resolve, ms));
return ms;
},
toRegistration() {

21
pages/deepExploration/MainForceActions.vue

@ -415,9 +415,13 @@
stockPrice.value = result.data.StockInformation.Price || '435.900'
if (result.data.chartData) {
const rawData = JSON.parse(JSON.stringify(result.data.chartData));
if (rawData.categories.length > 1) { //
rawData.categories[rawData.categories.length - 1] = ''; //
console.log('删了;');
}
chartData.value = {
...JSON.parse(JSON.stringify(result.data.chartData))
...rawData
}
chartKey.value++;
console.log('chartData', chartData.value);
@ -430,24 +434,25 @@
rotate: false,
rotateLock: false,
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
padding: [15, 15, 0, 15],
padding: [15, 30, 0, 15],
dataLabel: false,
enableScroll: true,
enableMarkLine: false,
legend: {},
xAxis: {
labelCount: 4,
itemCount: 30,
itemCount: 20,
disableGrid: true,
gridColor: "#CCCCCC",
gridType: "solid",
dashLength: 4,
scrollShow: false,
rotate: 45,
scrollAlign: "left",
scrollColor: "#A6A6A6",
scrollBackgroundColor: "#EFEBEF",
labelColor: "#8C8C8C",
fontSize: 9
fontSize: 9,
},
yAxis: {
labelColor: "#8C8C8C",
@ -565,6 +570,9 @@
htmlContent.value = marked.parse(markdownContent.value);
//k线
if (historyData.value.stockData.chartData.categories.length > 1) { //
historyData.value.stockData.chartData.categories[historyData.value.stockData.chartData.categories.length - 1] = ''; //
}
chartData.value = {
...JSON.parse(JSON.stringify(historyData.value.stockData.chartData))
}
@ -764,6 +772,7 @@
.charts-box {
width: 100%;
height: 100%;
overflow: visible;
}
}
}
@ -793,7 +802,7 @@
}
.txtContent {
min-height: 200rpx;
min-height: 300rpx;
padding: 20rpx 30rpx;
margin-bottom: 100rpx;

6
pages/deepExploration/deepExploration.vue

@ -7,7 +7,7 @@
<deepExploration_header></deepExploration_header>
<view class="search">
<input v-model="stockName" class="searchInput" type="text" placeholder="请输入股票名称、股票代码"
placeholder-style="color: #A6A6A6; font-size: 22rpx;" />
placeholder-style="color: #A6A6A6; font-size: 28rpx; " />
<image @click="searchStock" class="seachIcon" src="/static/deepExploration-images/search.png"
mode="aspectFill"></image>
</view>
@ -307,6 +307,7 @@
.searchInput {
color: #111;
width: 100%;
}
}
@ -367,11 +368,12 @@
padding: 6rpx 20rpx;
color: #ffffff;
font-family: "PingFang SC";
font-size: 10rpx;
font-size: 24rpx;
font-style: normal;
font-weight: 100;
line-height: 29rpx;
height: 40rpx;
width: 140rpx;
}
}

13
pages/deepMate/deepMate.vue

@ -889,7 +889,17 @@ const scrollToBottom = () => {
});
};
const scrollToTop = () => {
// scroll-view
if (messages.value.length > 0) {
chatScrollTop.value = 0;
return;
}
//
try {
uni.pageScrollTo({ scrollTop: 0, duration: 200 });
} catch (e) {
//
}
};
//
const shouldAutoScroll = ref(true);
@ -903,6 +913,9 @@ const onChatScroll = (e) => {
const delta = st - lastScrollTop.value;
lastScrollTop.value = st;
//
chatScrollTop.value = st;
if (delta < 0) {
shouldAutoScroll.value = false;
return;

112
pages/marketSituation/marketDetail.vue

@ -36,7 +36,7 @@
<scroll-view class="content" :style="{ top: contentTopPosition + 'px' }" scroll-y="true">
<!-- 股票列表 -->
<view class="stock-list">
<view class="stock-row" v-for="(item,index) in sortedStockList" :key="item" @click="viewIndexDetail(item,index)">
<view class="stock-row" v-for="(item, index) in sortedStockList" :key="item" @click="viewIndexDetail(item, index)">
<view class="stock-cell name-column">
<view class="stock-name">{{ item.stockName }}</view>
<view class="stock-code">{{ item.stockCode }}</view>
@ -48,7 +48,7 @@
</view>
<view class="stock-cell change-column">
<text class="stock-change" :class="item.isRising ? 'rising' : 'falling'">
{{ item.changePercent }}
{{ judgeSymbol(item.changePercent) }}
</text>
</view>
</view>
@ -79,107 +79,6 @@ const sortType = ref(""); // 排序类型:'price' 或 'change'
const sortOrder = ref("desc"); // 'asc' 'desc'
const regionalGroupArray = ref([]);
//
const stockList = ref([
{
stockName: "Telecommunication",
stockCode: "888607",
price: 1349.47,
change: "+7.67%",
isRising: true,
},
{
stockName: "Other",
stockCode: "888607",
price: 1349.47,
change: "+6.67%",
isRising: true,
},
{
stockName: "Consumer Discretio...",
stockCode: "888610",
price: 1349.47,
change: "+5.67%",
isRising: true,
},
{
stockName: "Telecommunication",
stockCode: "888607",
price: 1349.47,
change: "+4.67%",
isRising: true,
},
{
stockName: "Other",
stockCode: "888611",
price: 1359.47,
change: "+3.67%",
isRising: true,
},
{
stockName: "Consumer Discretio...",
stockCode: "888610",
price: 1349.47,
change: "+2.67%",
isRising: true,
},
{
stockName: "Telecommunication",
stockCode: "888607",
price: 1349.47,
change: "+1.67%",
isRising: true,
},
{
stockName: "Other",
stockCode: "888611",
price: 1009.98,
change: "-1.67%",
isRising: false,
},
{
stockName: "Consumer Discretio...",
stockCode: "888610",
price: 1009.98,
change: "-0.67%",
isRising: false,
},
{
stockName: "Telecommunication",
stockCode: "888607",
price: 1009.98,
change: "-0.67%",
isRising: false,
},
{
stockName: "Other",
stockCode: "888611",
price: 1009.98,
change: "-1.67%",
isRising: false,
},
{
stockName: "Consumer Discretio...",
stockCode: "888610",
price: 1009.98,
change: "-4.67%",
isRising: false,
},
{
stockName: "Consumer Discretio...",
stockCode: "888610",
price: 1009.98,
change: "-3.67%",
isRising: false,
},
{
stockName: "Consumer Discretio...",
stockCode: "888610",
price: 1009.98,
change: "-3.67%",
isRising: false,
},
]);
//
const contentTopPosition = computed(() => {
@ -206,6 +105,10 @@ const sortedStockList = computed(() => {
return list;
});
const judgeSymbol = (num) => {
return num[0] === "-" ? num : "+" + num;
};
const getRegionalGroupList = async () => {
try {
const result = await getRegionalGroupListAPI({
@ -224,7 +127,7 @@ const goBack = () => {
};
//
const viewIndexDetail = (item,index) => {
const viewIndexDetail = (item, index) => {
console.log("查看指数详情:", item.stockName);
//
uni.navigateTo({
@ -348,7 +251,6 @@ const sendTcpMessage = (command) => {
break;
}
if (!messageData) {
return;
} else {
try {

138
pages/marketSituation/marketOverview.vue

@ -6,6 +6,10 @@
<scroll-view class="content_scroll" scroll-y="true" :style="{ top: contentTopPosition + 'px' }">
<view class="content">
<view class="map">
<view class="INDU">道琼斯<view :class="getSignClass(INDU.value)">{{ judgeSymbol(INDU.value) }}</view></view>
<view class="NDX">纳斯达克<view :class="getSignClass(NDX.value)">{{ judgeSymbol(NDX.value) }}</view></view>
<view class="HSI">恒生指数<view :class="getSignClass(HSI.value)">{{ judgeSymbol(HSI.value) }}</view></view>
<view class="CN">上证指数<view :class="getSignClass(CN.value)">{{ judgeSymbol(CN.value) }}</view></view>
<image src="/static/marketSituation-image/map.png" mode="widthFix"></image>
</view>
<view class="global_index">
@ -60,6 +64,11 @@ const contentHeight = ref(0);
const headerHeight = ref(0); // header
const isWarnTextOverflow = ref(false); // warn
const INDU = ref({ stockName: "道琼斯", stockCode: "INDU", value: "" });
const NDX = ref({ stockName: "纳斯达克", stockCode: "513300", value: "" });
const HSI = ref({ stockName: "恒生指数", stockCode: "HSI", value: "" });
const CN = ref({ stockName: "上证指数", stockCode: "1A0001", value: "" });
const pageIndex = ref(0);
const scrollToView = ref("");
@ -77,6 +86,20 @@ const warnTextClass = computed(() => {
const globalIndexArray = ref([]);
const judgeSymbol = (num) => {
return num[0] === "-" ? num : "+" + num;
};
function getSignClass(value) {
const s = typeof value === 'string' ? value : String(value ?? '');
const trimmed = s.trim();
if (trimmed.startsWith('-')) return 'index-down';
if (trimmed.startsWith('+')) return 'index-up';
const n = parseFloat(trimmed);
if (!isNaN(n)) return n >= 0 ? 'index-up' : 'index-down';
return '';
}
//
const onSearchInput = (e) => {
searchValue.value = e.detail.value;
@ -360,6 +383,27 @@ const parseStockData = (message) => {
changePercent: ((100 * (stockDataArray[item.stockCode][0].current_price - stockDataArray[item.stockCode][0].pre_close)) / stockDataArray[item.stockCode][0].pre_close).toFixed(2) + "%",
isRising: stockDataArray[item.stockCode][0].current_price - stockDataArray[item.stockCode][0].pre_close >= 0,
}));
if (stockDataArray[INDU.value.stockCode][0]) {
INDU.value.value = ((100 * (stockDataArray[INDU.value.stockCode][0].current_price - stockDataArray[INDU.value.stockCode][0].pre_close)) / stockDataArray[INDU.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("INDU不存在");
}
if (stockDataArray[NDX.value.stockCode][0]) {
NDX.value.value = ((100 * (stockDataArray[NDX.value.stockCode][0].current_price - stockDataArray[NDX.value.stockCode][0].pre_close)) / stockDataArray[NDX.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("NDX不存在");
}
if (stockDataArray[HSI.value.stockCode][0]) {
HSI.value.value = ((100 * (stockDataArray[HSI.value.stockCode][0].current_price - stockDataArray[HSI.value.stockCode][0].pre_close)) / stockDataArray[HSI.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("HSI不存在");
}
if (stockDataArray[CN.value.stockCode][0]) {
CN.value.value = ((100 * (stockDataArray[CN.value.stockCode][0].current_price - stockDataArray[CN.value.stockCode][0].pre_close)) / stockDataArray[CN.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("CN不存在");
}
}
} else if ((typeof message === "string" && message.includes('{"count')) || isMorePacket.batch_real_time) {
if (typeof message === "string" && message.includes('{"count')) {
@ -406,6 +450,27 @@ const parseStockData = (message) => {
changePercent: ((100 * (stockDataArray[item.stockCode][0].current_price - stockDataArray[item.stockCode][0].pre_close)) / stockDataArray[item.stockCode][0].pre_close).toFixed(2) + "%",
isRising: stockDataArray[item.stockCode][0].current_price - stockDataArray[item.stockCode][0].pre_close >= 0,
}));
if (stockDataArray[INDU.value.stockCode][0]) {
INDU.value.value = ((100 * (stockDataArray[INDU.value.stockCode][0].current_price - stockDataArray[INDU.value.stockCode][0].pre_close)) / stockDataArray[INDU.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("INDU不存在");
}
if (stockDataArray[NDX.value.stockCode][0]) {
NDX.value.value = ((100 * (stockDataArray[NDX.value.stockCode][0].current_price - stockDataArray[NDX.value.stockCode][0].pre_close)) / stockDataArray[NDX.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("NDX不存在");
}
if (stockDataArray[HSI.value.stockCode][0]) {
HSI.value.value = ((100 * (stockDataArray[HSI.value.stockCode][0].current_price - stockDataArray[HSI.value.stockCode][0].pre_close)) / stockDataArray[HSI.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("HSI不存在");
}
if (stockDataArray[CN.value.stockCode][0]) {
CN.value.value = ((100 * (stockDataArray[CN.value.stockCode][0].current_price - stockDataArray[CN.value.stockCode][0].pre_close)) / stockDataArray[CN.value.stockCode][0].pre_close).toFixed(2) + "%";
} else {
console.log("CN不存在");
}
}
} else {
// JSON
@ -719,6 +784,67 @@ watch(headerHeight, (newHeight) => {
min-height: 200rpx;
}
.NDX {
position: absolute;
top: 30%;
left: 17%;
transform: translate(-50%, -50%);
font-size: 11rpx;
color: #000000;
padding: 5rpx 10rpx;
border-radius: 10rpx;
background-color: #ffffff;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
.INDU {
position: absolute;
top: 22%;
left: 35%;
transform: translate(-50%, -50%);
font-size: 11rpx;
color: #000000;
padding: 5rpx 10rpx;
border-radius: 10rpx;
background-color: #ffffff;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
.HSI {
position: absolute;
top: 30%;
right: 4%;
transform: translate(-50%, -50%);
font-size: 11rpx;
color: #000000;
padding: 5rpx 10rpx;
border-radius: 10rpx;
background-color: #ffffff;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
.CN {
position: absolute;
top: 23%;
right: 8%;
transform: translate(-50%, -50%);
font-size: 11rpx;
color: #000000;
padding: 5rpx 10rpx;
border-radius: 10rpx;
background-color: #ffffff;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
.map image {
width: 100%;
height: auto;
@ -848,8 +974,8 @@ watch(headerHeight, (newHeight) => {
.global_index_title {
margin-left: 20rpx;
font-size: 40rpx;
font-weight: 100;
color: #333333;
font-weight: bold;
color: black;
align-items: center;
}
@ -977,4 +1103,12 @@ watch(headerHeight, (newHeight) => {
overflow: hidden;
background-color: white;
}
.index-up {
color: #2fc25b !important;
}
.index-down {
color: #f04864 !important;
}
</style>

4
pages/marketSituation/marketSituation.vue

@ -496,8 +496,8 @@ watch(headerHeight, (newHeight) => {
}
.scroll_indicator image {
width: 20rpx;
height: 20rpx;
width: 30rpx;
height: 30rpx;
opacity: 0.5;
}

Loading…
Cancel
Save