Browse Source

Merge branch 'milestone-20251031-简版功能开发' into zhaowenkang/feature-20251028181547-行情页面

zhaowenkang/feature-20251028181547-行情页面
zhaowenkang 4 weeks ago
parent
commit
4033ca4d43
  1. 5
      .hbuilderx/launch.json
  2. 21
      App.vue
  3. 18
      api/deepExploration/deepExploration.js
  4. 15
      api/setting/share.js
  5. 92
      api/tcpConnection.js
  6. 31
      components/DeepMate.vue
  7. 8
      components/MarketOverview.vue
  8. 190
      components/SharePopup.vue
  9. 10
      components/deepExploration_header.vue
  10. 9
      manifest.json
  11. 7
      pages.json
  12. 5
      pages/customerServicePlatform/csPlatformIndex.vue
  13. 9
      pages/customerServicePlatform/historyRecord.vue
  14. 5
      pages/customerServicePlatform/questionDetail.vue
  15. 444
      pages/deepExploration/MainForceActions.vue
  16. 146
      pages/deepExploration/deepExploration.vue
  17. 326
      pages/deepExploration/stockSelectDetail.vue
  18. 21
      pages/deepMate/deepMate.vue
  19. 41
      pages/home/home.vue
  20. 278
      pages/setting/share.vue
  21. BIN
      static/my/share/KakaoTalk.png
  22. BIN
      static/my/share/Line.png
  23. BIN
      static/my/share/WeChat.png
  24. BIN
      static/my/share/WhatsApp.png
  25. BIN
      static/my/share/share.png
  26. BIN
      static/my/share/success.png
  27. 4
      utils/http.js
  28. 22
      vue.config.js

5
.hbuilderx/launch.json

@ -2,8 +2,9 @@
"version" : "1.0",
"configurations" : [
{
"customPlaygroundType" : "local",
"playground" : "standard",
"customPlaygroundType" : "device",
"packageName" : "io.dcloud.HBuilder",
"playground" : "custom",
"type" : "uni-app:app-android"
}
]

21
App.vue

@ -1,8 +1,25 @@
<script>
export default {
import { useDeviceStore } from './stores/modules/deviceInfo'
export default {
onLaunch: function() {
console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
console.log('App Launch')
//
// const deviceStore = useDeviceStore()
// try {
// const sys = uni.getSystemInfoSync()
// let deviceId = ''
// // #ifdef APP-PLUS
// try { deviceId = plus?.device?.uuid || '' } catch(e) {}
// // #endif
// if (!deviceId) deviceId = uni.getStorageSync('device_id')
// if (!deviceId) {
// deviceId = `web_${Date.now()}_${Math.random().toString(36).slice(2,10)}`
// uni.setStorageSync('device_id', deviceId)
// }
// deviceStore.setDeviceInfo({ deviceId, platform: sys.platform, model: sys.model })
// console.log('Device init:', deviceStore.deviceInfo)
// } catch(e) { console.warn('Init device info failed:', e) }
},
onShow: function() {
console.log('App Show')
@ -10,7 +27,7 @@
onHide: function() {
console.log('App Hide')
}
}
}
</script>
<style lang="scss">

18
api/deepExploration/deepExploration.js

@ -101,8 +101,22 @@ export const RecordListApi = (data) => {
data:data
})
}
// 选股策略
export const stocSelectApi = (data) => {
return http({
method: 'POST',
url: '/api/deep/getStrategy',
data:data
})
}
//根据名字选股策略
export const stocSelectByNameApi = (data) => {
return http({
method: 'POST',
url: '/api/deep/getStrategyByName',
data:data
})
}
//历史记录详情

15
api/setting/share.js

@ -0,0 +1,15 @@
import { http } from '../../utils/http'
/**
* 分享接口获取dccode
* @param data
* @returns {*}
*/
export const Share = (data) => {
return http({
method: 'POST',
url: '/api/my/share',
data: data,
})
}

92
api/tcpConnection.js

@ -6,7 +6,7 @@
*/
// 引用TCP插件
//const TCPSocket = uni.requireNativePlugin('Aimer-TCPPlugin');
// const TCPSocket = uni.requireNativePlugin('Aimer-TCPPlugin');
// const TCPSocket = uni.requireNativePlugin("Aimer-TCPPlugin");
// TCP连接配置
@ -67,52 +67,52 @@ class TCPConnection {
}
console.log('开始建立TCP连接:', connectionConfig);
// TCPSocket.connect(
// connectionConfig,
// result => {
// /**
// * status : 0 连接成功
// * status : 1 断开连接
// * receivedMsg : 服务器返回字符串(普通的字符串交互)
// * receivedHexMsg : 服务器返回字节数组(单片机、智能家居等硬件数据交互)
// */
// if (result.status == '0') {
// // TCP连接成功
// this.channelConnections.set(connectionConfig.channel, true);
// console.log(`TCP连接成功 - Channel ${connectionConfig.channel}`);
// this._notifyConnectionCallbacks('connected', result, connectionConfig.channel);
// } else if (result.status == '1') {
// // TCP断开连接
// this.channelConnections.set(connectionConfig.channel, false);
// console.log(`TCP断开连接 - Channel ${connectionConfig.channel}`);
// this._notifyConnectionCallbacks('disconnected', result, connectionConfig.channel);
// }
// if (result.receivedMsg) {
// // 服务器返回字符串
// console.log('收到字符串消息:', result.receivedMsg);
// this._notifyMessageCallbacks('string', result.receivedMsg, null, connectionConfig.channel);
// }
TCPSocket.connect(
connectionConfig,
result => {
/**
* status : 0 连接成功
* status : 1 断开连接
* receivedMsg : 服务器返回字符串(普通的字符串交互)
* receivedHexMsg : 服务器返回字节数组(单片机智能家居等硬件数据交互)
*/
if (result.status == '0') {
// TCP连接成功
this.channelConnections.set(connectionConfig.channel, true);
console.log(`TCP连接成功 - Channel ${connectionConfig.channel}`);
this._notifyConnectionCallbacks('connected', result, connectionConfig.channel);
} else if (result.status == '1') {
// TCP断开连接
this.channelConnections.set(connectionConfig.channel, false);
console.log(`TCP断开连接 - Channel ${connectionConfig.channel}`);
this._notifyConnectionCallbacks('disconnected', result, connectionConfig.channel);
}
// // if (result.receivedHexMsg) {
// // // 硬件服务器返回16进制数据
// // console.log('收到16进制消息:', result.receivedHexMsg);
// // let msg = result.receivedHexMsg;
// // let sum = msg.length / 2;
// // let arr = [];
// // for (let k = 0; k < sum; k++) {
// // let i = msg.substring(k * 2, k * 2 + 2);
// // arr.push(i);
// // }
// // console.log('解析后的16进制数组:', arr);
// // this._notifyMessageCallbacks('hex', result.receivedHexMsg, arr);
// // }
if (result.receivedMsg) {
// 服务器返回字符串
console.log('收到字符串消息:', result.receivedMsg);
this._notifyMessageCallbacks('string', result.receivedMsg, null, connectionConfig.channel);
}
// // 执行回调函数
// if (callback && typeof callback === "function") {
// callback(result);
// if (result.receivedHexMsg) {
// // 硬件服务器返回16进制数据
// console.log('收到16进制消息:', result.receivedHexMsg);
// let msg = result.receivedHexMsg;
// let sum = msg.length / 2;
// let arr = [];
// for (let k = 0; k < sum; k++) {
// let i = msg.substring(k * 2, k * 2 + 2);
// arr.push(i);
// }
// console.log('解析后的16进制数组:', arr);
// this._notifyMessageCallbacks('hex', result.receivedHexMsg, arr);
// }
// });
// 执行回调函数
if (callback && typeof callback === "function") {
callback(result);
}
});
}
/**
@ -144,7 +144,7 @@ class TCPConnection {
sendConfig.charsetname = config.charsetname;
}
//TCPSocket.send(sendConfig);
TCPSocket.send(sendConfig);
console.log("js成功发送TCP消息:", messageStr);
return true;
}
@ -159,7 +159,7 @@ class TCPConnection {
channel: channel
};
//TCPSocket.disconnect(disconnectConfig);
TCPSocket.disconnect(disconnectConfig);
this.channelConnections.set(channel, false);
console.log(`TCP连接已断开 - Channel ${channel}`, disconnectConfig);
}

31
components/DeepMate.vue

@ -34,8 +34,14 @@
</view>
</view>
<view class="deepmate-action">
<input class="stock-input" type="text" placeholder="请输入股票代码/名称,获取AI洞察" />
<view class="send-button-container">
<input
class="stock-input"
type="text"
placeholder="请输入股票代码/名称,获取AI洞察"
v-model="inputValue"
@confirm="handleSend"
/>
<view class="send-button-container" @click="handleSend">
<image class="send-button" src="https://d31zlh4on95l9h.cloudfront.net/images/3da018821a5c82b06a1d6ddc81b960ac.png" mode="aspectFit"></image>
</view>
</view>
@ -49,7 +55,28 @@
name: 'DeepMate',
data() {
return {
inputValue: ''
}
},
methods: {
handleSend() {
//
if (!this.inputValue.trim()) {
uni.showToast({
title: '请输入股票代码或名称',
icon: 'none',
duration: 2000
})
return
}
// deepMate
uni.navigateTo({
url: `/pages/deepMate/deepMate?query=${encodeURIComponent(this.inputValue.trim())}`
})
//
this.inputValue = ''
}
}
}

8
components/MarketOverview.vue

@ -47,7 +47,7 @@
<text class="analysis-dot blue"></text>
<text class="analysis-text">市场风险评级: 需警惕潜在风险</text>
</view>
<view class="analysis-item">
<view class="analysis-item" @click="goToMorningAnalysis">
<text class="analysis-dot green"></text>
<text class="analysis-text">早盘解析: 今日高开, 芯片稀土公共</text>
</view>
@ -142,6 +142,12 @@ export default {
}
},
methods: {
//
goToMorningAnalysis() {
uni.navigateTo({
url: '/pages/morningMarketAnalysis/morningMarketAnalysis'
})
},
showMarketSelector() {
//
this.showForexMarket = !this.showForexMarket;

190
components/SharePopup.vue

@ -0,0 +1,190 @@
<!--自定义分享弹窗 使用uni的更改-->
<template>
<view class="uni-popup-share">
<!-- <view class="uni-share-title">-->
<!-- <text class="uni-share-title-text">{{ shareTitleText }}</text>-->
<!-- </view>-->
<view class="uni-share-content">
<view class="uni-share-content-box">
<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index"
@click.stop="select(item,index)">
<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
<text class="uni-share-text">{{ item.text }}</text>
</view>
</view>
</view>
<view class="uni-share-button-box">
<button class="uni-share-button" @click="close">{{ cancelText }}</button>
</view>
</view>
</template>
<script>
import popup from '../uni_modules/uni-popup/components/uni-popup/popup.js'
// import popup from '../uni-popup/popup.js'
import {initVueI18n} from '@dcloudio/uni-i18n'
import messages from '../uni_modules/uni-popup/components/uni-popup/i18n/index.js'
const {t} = initVueI18n(messages)
export default {
name: 'SharePopup',
mixins: [popup],
emits: ['select'],
props: {
title: {
type: String,
default: ''
},
beforeClose: {
type: Boolean,
default: false
}
},
data() {
return {
bottomData: [{
text: 'WhatsApp',
icon: '/static/my/share/WhatsApp.png',
name: 'WhatsApp'
},
{
text: 'Line',
icon: '/static/my/share/Line.png',
name: 'Line'
},
{
text: 'KakaoTalk',
icon: '/static/my/share/KakaoTalk.png',
name: 'KakaoTalk'
},
{
text: 'WeChat',
icon: '/static/my/share/WeChat.png',
name: 'WeChat'
},
{
text: '复制链接',
icon: '/static/my/share/share.png',
name: '复制链接'
},
]
}
},
created() {
},
computed: {
cancelText() {
return t("uni-popup.cancel")
},
shareTitleText() {
return this.title || t("uni-popup.shareTitle")
}
},
methods: {
/**
* 选择内容
*/
select(item, index) {
this.$emit('select', {
item,
index
})
// this.close()
},
/**
* 关闭窗口
*/
close() {
if (this.beforeClose) return
this.popup.close()
}
}
}
</script>
<style lang="scss">
.uni-popup-share {
background-color: #fff;
border-top-left-radius: 11px;
border-top-right-radius: 11px;
}
.uni-share-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
height: 40px;
}
.uni-share-title-text {
font-size: 14px;
color: #666;
}
.uni-share-content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 10px;
}
.uni-share-content-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: wrap;
width: 360px;
}
.uni-share-content-item {
width: 72px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
padding: 10px 0;
align-items: center;
}
.uni-share-content-item:active {
background-color: #f5f5f5;
}
.uni-share-image {
width: 42px;
height: 42px;
}
.uni-share-text {
margin-top: 10px;
font-size: 14px;
color: #3B4144;
}
.uni-share-button-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
padding: 10px 15px;
}
.uni-share-button {
flex: 1;
border-radius: 50px;
color: #666;
font-size: 16px;
}
.uni-share-button::after {
border-radius: 50px;
}
</style>

10
components/deepExploration_header.vue

@ -156,13 +156,19 @@ async function itemClick(item) {
model: 5,
});
if (res.code == 200) {
const message = res.data;
const deepExplorationStore = useDeepExplorationStore();
deepExplorationStore.setDeepExplorationInfo(message);
console.log('点击了历史数据',deepExplorationStore.deepExplorationInfo);
onDrawerBackClick();
console.log(deepExplorationStore.deepExplorationInfo);
setTimeout(() => {
uni.navigateTo({
url: '/pages/deepExploration/MainForceActions'
});
}, 200);
}
}
const historyList = ref([]);

9
manifest.json

@ -17,7 +17,8 @@
"delay" : 0
},
"modules" : {
"OAuth" : {}
"OAuth" : {},
"Share" : {}
},
/* */
"distribute" : {
@ -53,6 +54,12 @@
"google" : {
"clientid" : "135"
}
},
"share" : {
"weixin" : {
"appid" : "wx6143d111fc5c9ba3",
"UniversalLinks" : ""
}
}
}
},

7
pages.json

@ -88,6 +88,13 @@
}
},
{
"path" : "pages/morningMarketAnalysis/morningMarketAnalysis",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path": "pages/marketSituation/marketSituation",
"style": {
"navigationStyle": "custom",

5
pages/customerServicePlatform/csPlatformIndex.vue

@ -90,7 +90,6 @@
</template>
<script>
import { useUserStore } from "../../stores/modules/userInfo.js"
import {
getQuestionApi,
addFeedbackRecordApi,
@ -118,15 +117,12 @@
showQuestions: [],
feedbackText: '',
images: [],
token:''
}
},
mounted() {
//
this.iSMT = uni.getSystemInfoSync().statusBarHeight;
this.getQuestionList()
const memberStore = useUserStore()
this.token = memberStore.userInfo?.token
},
methods: {
onSuccess() {
@ -267,7 +263,6 @@
}
const [image1 = '', image2 = '', image3 = ''] = uploadedImages;
const res = await addFeedbackRecordApi({
token: this.token,
content: this.feedbackText,
image1,
image2,

9
pages/customerServicePlatform/historyRecord.vue

@ -57,7 +57,6 @@
</template>
<script>
import { useUserStore } from "../../stores/modules/userInfo.js"
import {
getFeedbackRecordsApi,
} from "../../api/customerServicePlatform/customerServicePlatform";
@ -67,14 +66,12 @@
iSMT: 0,
statusText: '反馈成功',
historyList: [],
token:''
};
},
mounted() {
this.iSMT = uni.getSystemInfoSync().statusBarHeight;
this.loadHistoryList()
const memberStore = useUserStore()
this.token = memberStore.userInfo?.token
},
methods: {
formatTime(str) {
@ -95,9 +92,7 @@
}
},
async loadHistoryList() {
const res = await getFeedbackRecordsApi({
token: this.token
})
const res = await getFeedbackRecordsApi()
console.log(res)
if (res.code == 200) {
this.historyList = res.data.map(item => {

5
pages/customerServicePlatform/questionDetail.vue

@ -62,7 +62,6 @@
</template>
<script>
import { useUserStore } from "../../stores/modules/userInfo.js"
import {
getAnswerApi
} from "../../api/customerServicePlatform/customerServicePlatform";
@ -74,14 +73,11 @@
questionTitle: '',
answerContent: '正在思考...',
showLoginRegister:false,
token:''
};
},
mounted() {
this.iSMT = uni.getSystemInfoSync().statusBarHeight || 0;
this.getAnswerContent()
const memberStore = useUserStore()
this.token = memberStore.userInfo?.token
},
onLoad(options) {
if (options.question) {
@ -106,7 +102,6 @@
const res = await getAnswerApi({
question: this.questionTitle,
conversationId: conversationId,
token:this.token
})
console.log(res)

444
pages/deepExploration/MainForceActions.vue

@ -23,24 +23,22 @@
<view class="graphAndTxt">
<view class="graph">
<view class="graph_header">
<view class="left">TESA</view>
<view class="left">{{stockCode}}</view>
<view class="center">
<image class="last" src="/static/deepExploration-images/last.png" mode="aspectFill"></image>
<text>Taewlkj.sejssssssssf</text>
<image class="next" src="/static/deepExploration-images/next.png" mode="aspectFill"></image>
<text>{{stockName}}</text>
</view>
<view class="right">2025/10/26</view>
<view class="right">{{stockTime}}</view>
</view>
<view class="graph_data">
<text>435.900</text>
<text>22.410</text>
<text>5.120%</text>
<text>{{stockPrice}}</text>
<text>{{stockChange}}</text>
<text>{{stockAdd}}</text>
</view>
<view class="graph_content">
<view class="charts-box">
<!-- uCharts 蜡烛图组件 -->
<qiun-data-charts type="candle" :opts="opts" :chartData="chartData" :disableScroll="true"
:ontouch="true" :onzoom="true" />
:ontouch="true" :onzoom="true" :key="chartKey" />
</view>
</view>
</view>
@ -65,7 +63,8 @@
<script setup>
import {
ref,
onMounted
onMounted,
watch
} from 'vue'
import deepExploration_header from '@/components/deepExploration_header.vue'
import footerBar from '@/components/footerBar.vue'
@ -87,6 +86,13 @@
import marked from 'marked'; // marked
import hljs from 'highlight.js';
import 'highlight.js/styles/atom-one-dark.css'; //
import {
useDeepExplorationStore
} from '@/stores/modules/deepExploration'
const deepExplorationStore = useDeepExplorationStore()
const historyData = ref({})
//
const type = ref('deepExploration')
@ -113,10 +119,9 @@
//
const searchStock = () => {
htmlContent.value = ''
console.log('搜索参数:', stockName.value);
if (currentIndex.value ) {
console.log('搜索参数:', stockName.value, currentIndex.value);
if (currentIndex.value >= 0 && currentIndex.value <= 3) {
handleModels()
getServerData()
} else {
uni.showToast({
title: '请选择模块',
@ -127,20 +132,22 @@
}
//
const handleModel = async(index) => {
const handleModel = async (index) => {
htmlContent.value = ''
currentIndex.value = index
await handleModels()
// await getServerData()
}
const stockName = ref('')
const stockName = ref('Tesla Inc.')
const searchName = ref('')
const stockCode = ref('')
const stockCode = ref('TSLA')
const language = ref('')
const recordId = ref('')
const parentId = ref('')
const stockId = ref('')
const market = ref('')
const stockTime = ref('2025/10/24')
const loading = ref(true);
const error = ref('');
@ -175,31 +182,25 @@
// htmlContent.value = marked.parse(markdownContent.value);
loading.value = true;
if (searchName.value == '') {
console.log('没有搜索',searchName.value);
const rresult = await handleDefault()
// markdownContent.value = res.data.markdown
htmlContent.value = marked.parse(markdownContent.value);
}else{
console.log('搜索',searchName.value);
console.log('没有搜索', searchName.value);
handleDefault()
} else {
console.log('搜索', searchName.value);
const result = await getModel1First({
content: searchName.value,
language: "cn",
marketList: "hk,cn,usa,my,sg,vi,in,gb",
model: currentIndex.value+1
model: currentIndex.value + 1
})
console.log('result', result);
if (result.code == 200) {
stockCode.value = result.data.code
stockName.value = result.data.name
// stockName.value = result.data.name
recordId.value = result.data.recordId
parentId.value = result.data.parentId
stockId.value = result.data.stockId
language.value = result.data.language
market.value = result.data.market
} else {
return
}
const res = await getModel1Second({
@ -217,10 +218,22 @@
htmlContent.value = marked.parse(markdownContent.value);
}
console.log('res', res);
await getServerData()
} else if (result.code == 400) {
markdownContent.value = result.message;
htmlContent.value = marked.parse(markdownContent.value);
} else {
return
}
} catch {
}
} catch (e) {
error.value = e.message || '加载失败,请重试';
} finally {
loading.value = false;
@ -230,25 +243,52 @@
const handleDefault = async () => {
const result = await getModeldefault({
token: "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
model: currentIndex.value+1
model: currentIndex.value + 1
})
if (result.code == 200) {
const rawMarkdown = result.data.markdown;
const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // ###
markdownContent.value = adaptedMarkdown;
htmlContent.value = marked.parse(markdownContent.value);
} else {
}
}
const getServerData = async() =>{
const stockPrice = ref('435.900')
const stockAdd = ref('22.410')
const stockChange = ref('5.120%')
const chartKey = ref(0);
const getServerData = async () => {
const result = await getData({
market: market.value || '',
code: searchName || '',
code: searchName.value || '',
language: "cn",
brainPrivilegeState: 1,
marketList: "usa.sg.my.hk.cn.can.vi.th.in.gb"
})
console.log('k线数据',result);
console.log('k线数据', result);
stockName.value = result.data.StockInformation.Name || 'Tesla Inc.'
stockCode.value = result.data.StockInformation.Code || 'TSLA'
stockTime.value = result.data.StockInformation.Time || '2025/10/29'
stockChange.value = result.data.StockInformation.Zhang || '5.120%'
stockAdd.value = result.data.StockInformation.ZhangFu || '22.410'
stockPrice.value = result.data.StockInformation.Price || '435.900'
if (result.data.chartData) {
chartData.value = {
...JSON.parse(JSON.stringify(result.data.chartData))
}
chartKey.value++;
console.log('chartData', chartData.value);
}
}
// 1. K线
@ -316,51 +356,20 @@
})
// 2. K线
const chartData = ref({})
const chartData = ref({
categories: [],
series: [{
name: '',
data: []
}]
})
// K线methods
// const getServerData = () => {
//K线methods
// const getServerData1 = () => {
// //
// setTimeout(() => {
// const res = {
// "categories": [
// "2025/08/25",
// "2025/08/26",
// "2025/08/27",
// "2025/08/28",
// "2025/08/29",
// "2025/09/01",
// "2025/09/02",
// "2025/09/03",
// "2025/09/04",
// "2025/09/05",
// "2025/09/08",
// "2025/09/09",
// "2025/09/10",
// "2025/09/11",
// "2025/09/12",
// "2025/09/15",
// "2025/09/16",
// "2025/09/17",
// "2025/09/18",
// "2025/09/19",
// "2025/09/22",
// "2025/09/23",
// "2025/09/24",
// "2025/09/25",
// "2025/09/26",
// "2025/09/29",
// "2025/09/30",
// "2025/10/09",
// "2025/10/10",
// "2025/10/13",
// "2025/10/14",
// "2025/10/15",
// "2025/10/16",
// "2025/10/17",
// "2025/10/20",
// "2025/10/21",
// "2025/10/22",
// "2025/10/23",
// "2025/10/24",
// "2025/10/27"
@ -369,228 +378,6 @@
// "name": "",
// "data": [
// [
// 1470.01,
// 1496.0,
// 1466.0,
// 1499.33
// ],
// [
// 1490.32,
// 1474.23,
// 1480.01,
// 1481.61
// ],
// [
// 1481.88,
// 1484.93,
// 1448.0,
// 1448.0
// ],
// [
// 1447.97,
// 1456.1,
// 1438.77,
// 1446.1
// ],
// [
// 1453.0,
// 1482.58,
// 1452.0,
// 1480.0
// ],
// [
// 1482.2,
// 1488.0,
// 1465.7,
// 1476.1
// ],
// [
// 1478.66,
// 1509.0,
// 1478.0,
// 1491.3
// ],
// [
// 1491.0,
// 1503.5,
// 1466.0,
// 1480.55
// ],
// [
// 1472.0,
// 1479.3,
// 1460.47,
// 1480.66
// ],
// [
// 1471.0,
// 1486.97,
// 1464.0,
// 1483.0
// ],
// [
// 1483.0,
// 1506.44,
// 1477.5,
// 1501.23
// ],
// [
// 1505.0,
// 1509.95,
// 1493.42,
// 1505.0
// ],
// [
// 1506.66,
// 1529.95,
// 1496.0,
// 1522.01
// ],
// [
// 1522.01,
// 1526.02,
// 1508.5,
// 1523.5
// ],
// [
// 1526.0,
// 1538.02,
// 1510.53,
// 1516.0
// ],
// [
// 1515.87,
// 1517.48,
// 1501.5,
// 1515.1
// ],
// [
// 1515.1,
// 1520.99,
// 1496.21,
// 1499.98
// ],
// [
// 1499.99,
// 1510.28,
// 1490.01,
// 1493.0
// ],
// [
// 1492.0,
// 1497.8,
// 1463.5,
// 1467.96
// ],
// [
// 1467.99,
// 1475.5,
// 1457.01,
// 1467.97
// ],
// [
// 1465.09,
// 1467.97,
// 1450.01,
// 1453.35
// ],
// [
// 1450.5,
// 1457.5,
// 1440.0,
// 1447.42
// ],
// [
// 1434.07,
// 1456.78,
// 1434.07,
// 1442.0
// ],
// [
// 1442.83,
// 1445.21,
// 1436.0,
// 1439.0
// ],
// [
// 1441.18,
// 1447.11,
// 1428.01,
// 1435.0
// ],
// [
// 1439.38,
// 1469.99,
// 1435.0,
// 1460.86
// ],
// [
// 1460.0,
// 1460.76,
// 1440.0,
// 1443.99
// ],
// [
// 1436.0,
// 1439.38,
// 1420.0,
// 1436.78
// ],
// [
// 1437.6,
// 1439.94,
// 1427.5,
// 1430.0
// ],
// [
// 1415.7,
// 1422.85,
// 1415.12,
// 1419.2
// ],
// [
// 1429.99,
// 1464.0,
// 1429.99,
// 1451.02
// ],
// [
// 1450.98,
// 1463.0,
// 1445.08,
// 1462.0
// ],
// [
// 1461.92,
// 1484.95,
// 1458.88,
// 1484.91
// ],
// [
// 1483.1,
// 1488.0,
// 1454.03,
// 1455.0
// ],
// [
// 1455.0,
// 1469.5,
// 1454.88,
// 1457.93
// ],
// [
// 1459.0,
// 1469.94,
// 1455.5,
// 1462.26
// ],
// [
// 1462.08,
// 1465.73,
// 1456.0,
// 1458.7
// ],
// [
// 1455.0,
// 1468.8,
// 1447.2,
@ -616,10 +403,51 @@
// }, 500)
// }
let unwatch = null;
// onReady
onMounted(() => {
onMounted(async () => {
iSMT.value = uni.getSystemInfoSync().statusBarHeight
getServerData() //
await getServerData() //
await handleModels()
unwatch = watch(
() => deepExplorationStore.deepExplorationInfo, //
(newVal, oldVal) => {
console.log('deepExplorationInfo 变化了:', newVal)
historyData.value = {
...newVal
}
console.log(historyData.value.wokeFlowData);
console.log('222', historyData.value.stockData.StockInformation);
//
const rawMarkdown = historyData.value.wokeFlowData.One.markdown;
const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // ###
markdownContent.value = adaptedMarkdown;
// markdownContent.value = res.data.markdown
htmlContent.value = marked.parse(markdownContent.value);
//k线
chartData.value = {
...JSON.parse(JSON.stringify(historyData.value.stockData.chartData))
}
chartKey.value++;
console.log('chartData', chartData.value);
stockName.value = historyData.value.stockData.StockInformation.Name || 'Tesla Inc.'
stockCode.value = historyData.value.stockData.StockInformation.Code || 'TSLA'
stockTime.value = historyData.value.stockData.StockInformation.Time || '2025/10/29'
stockChange.value = historyData.value.stockData.StockInformation.Zhang || '5.120%'
stockAdd.value = historyData.value.stockData.StockInformation.ZhangFu || '22.410'
stockPrice.value = historyData.value.stockData.StockInformation.Price || '435.900'
}, {
deep: true,
immediate: true
} //
)
})
//
@ -629,8 +457,8 @@
console.log('模块:', currentIndex.value)
}
if (e.stockName) {
stockName.value = e.stockName
console.log('股票名称:', stockName.value)
searchName.value = e.stockName
console.log('股票名称:', searchName.value)
}
})
</script>
@ -738,7 +566,7 @@
}
.center {
margin-left: 105rpx;
margin-left: 155rpx;
display: flex;
align-items: center;
@ -758,21 +586,11 @@
line-height: 18px;
}
.last {
width: 15rpx;
height: 20rpx;
margin-right: 30rpx;
}
.next {
width: 15rpx;
height: 20rpx;
margin-left: 30rpx;
}
}
.right {
margin-left: 50rpx;
margin-left: 60rpx;
color: #6a6a6a;
font-family: "PingFang SC";
font-size: 13px;
@ -804,6 +622,8 @@
}
.graph_content {
min-height: 500rpx;
.charts-box {
width: 100%;
height: 100%;

146
pages/deepExploration/deepExploration.vue

@ -96,9 +96,9 @@
</view>
<view class="contentItem">
<view class="row" v-for="(item, index) in stockData" :key="index">
<view class="nameItem">{{ item.name }}</view>
<view class="nameItem">{{ item.tscode }}</view>
<view class="closeItem">{{ item.close }}</view>
<view class="priceItem">{{ item.select }}</view>
<view class="priceItem">{{ item.preClose }}</view>
</view>
</view>
</view>
@ -113,7 +113,7 @@
src="/static/deepExploration-images/plus.png"
mode="aspectFill"
></image>
<text>抄底卖顶</text>
<text>波段行情</text>
</view>
<view class="right">
<image
@ -130,10 +130,10 @@
<view class="contentTitle_price">选股价格</view>
</view>
<view class="contentItem">
<view class="row" v-for="(item, index) in stockData" :key="index">
<view class="nameItem">{{ item.name }}</view>
<view class="row" v-for="(item, index) in stockDataByName" :key="index">
<view class="nameItem">{{ item.tscode }}</view>
<view class="closeItem">{{ item.close }}</view>
<view class="priceItem">{{ item.select }}</view>
<view class="priceItem">{{ item.preClose }}</view>
</view>
</view>
</view>
@ -145,9 +145,13 @@
</template>
<script setup>
import { ref, onMounted } from "vue";
import footerBar from "@/components/footerBar.vue";
import deepExploration_header from "@/components/deepExploration_header.vue";
import {
ref,
onMounted
} from 'vue'
import footerBar from '@/components/footerBar.vue'
import deepExploration_header from '@/components/deepExploration_header.vue'
import { stocSelectApi, stocSelectByNameApi } from '@/api/deepExploration/deepExploration.js'
const type = ref("deepExploration");
const iSMT = ref(0);
@ -182,43 +186,109 @@ const searchStock = () => {
});
};
//
const viewAll = () => {
//
const viewAll = () => {
uni.navigateTo({
url: "/pages/deepExploration/stockSelectDetail",
});
};
//
const stockData = [
{
name: "(MKTW)MarketWise Inc",
close: "$14.190",
select: "$13.180",
},
{
name: "(MTCH)Match Group Inc",
close: "$32.120",
select: "$28.120",
},
{
name: "(MKTW)MarketWise Inc",
close: "$14.190",
select: "$13.180",
},
];
onMounted(() => {
url: '/pages/deepExploration/stockSelectDetail'
})
}
//
const stockData = ref([]);
const stockDataByName = ref([]); //
//
const loadStockSelection = async () => {
try {
const res = await stocSelectApi({ language: 'cn', size: 3 })
// console.log(':', typeof res === 'object' ? JSON.stringify(res) : res)
const raw = res?.data
const listCandidates = [
raw?.list,
raw?.data?.list,
raw?.data?.rows,
raw?.rows,
Array.isArray(raw) ? raw : null
].filter(Array.isArray)
let list = listCandidates.length ? listCandidates[0] : []
//
if ((!Array.isArray(list) || !list.length) && raw && typeof raw === 'object' && !Array.isArray(raw)) {
const arrays = Object.values(raw).filter(Array.isArray)
if (arrays.length) {
list = arrays.flat()
}
}
if (Array.isArray(list) && list.length) {
const mapped = list.map(item => ({
tscode: item.tsCode ?? item.tscode ?? item.code ?? '',
close: item.close ?? item.lastClose ?? '',
preClose: item.preClose ?? item.preclose ?? item.prevClose ?? ''
}))
stockData.value = mapped.slice(0, 3)
console.log('选股策略列表长度:', stockData.value.length, '首项:', stockData.value[0])
} else {
console.warn('选股策略接口返回空列表或结构不匹配', raw)
}
} catch (e) {
console.error('选股策略接口调用失败', e)
uni.showToast({ title: '选股策略加载失败', icon: 'none' })
}
}
//
const loadStockSelectionByName = async () => {
try {
const res = await stocSelectByNameApi({ name: '安徽' })
const raw = res?.data
const dataObj = raw?.data || raw
let list = []
if (Array.isArray(dataObj)) {
list = dataObj
} else if (dataObj && typeof dataObj === 'object') {
const target = dataObj['安徽']
if (Array.isArray(target)) {
list = target
} else {
const firstArr = Object.values(dataObj).find(v => Array.isArray(v))
if (Array.isArray(firstArr)) list = firstArr
}
}
if (Array.isArray(list) && list.length) {
const mapped = list.map(item => ({
tscode: item.tsCode ?? item.tscode ?? item.code ?? '',
close: item.close ?? item.lastClose ?? '',
preClose: item.preClose ?? item.preclose ?? item.prevClose ?? ''
}))
stockDataByName.value = mapped.slice(0, 3)
console.log('安徽板块列表长度:', stockDataByName.value.length, '首项:', stockDataByName.value[0])
} else {
console.warn('按名称(安徽)接口返回空列表或结构不匹配', raw)
}
} catch (e) {
console.error('按名称(安徽)接口调用失败', e)
uni.showToast({ title: '安徽板块加载失败', icon: 'none' })
}
}
onMounted(() => {
//
iSMT.value = uni.getSystemInfoSync().statusBarHeight;
});
//
loadStockSelection()
loadStockSelectionByName() //
})
</script>
<style scoped lang="scss">
.main {
width: 100%;
height: 100vh;
min-height: 100vh; //
height: auto; //
overflow-y: auto; //
background-color: #fff;
padding-bottom: 120rpx; //
.search {
position: relative;
@ -451,6 +521,8 @@ onMounted(() => {
.static-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
}

326
pages/deepExploration/stockSelectDetail.vue

@ -3,7 +3,7 @@
<view class="table">
<view class="tableHeader">
<scroll-view class="tabs" scroll-x="true">
<view v-for="(item,index) in tabsData" :key="index" class="tabItem" @click="handleTab(item)">
<view v-for="(item,index) in tabsData" :key="index" :class="['tabItem', { 'tabItem-active': item === activeTab }]" @click="handleTab(item)">
{{item}}
</view>
</scroll-view>
@ -23,7 +23,7 @@
</view>
</view>
<view class="box_content">
<view class="row" v-for="(item,index) in fakeData" :key="index" :class="{ 'increase-positive': item.increase.startsWith('+'),
<view class="row" v-for="(item,index) in strategyData" :key="index" :class="{ 'increase-positive': item.increase.startsWith('+'),
'increase-negative': item.increase.startsWith('-')}">
<view class="name_colum">
<text class="stockName">{{item.name}}</text>
@ -48,153 +48,182 @@
</template>
<script setup>
import {
ref
} from 'vue'
const tabsData = ref(['全部', '抄底卖顶', '波段行情', '价值投资', '资金及仓位管理', '价值投资', '价值投资', '价值投资', ])
const handleTab = (item) => {
uni.showToast({
title: `查看 ${item} 详情`,
icon: 'none',
duration: 2000
})
import { ref, onMounted } from 'vue'
import { stocSelectApi, stocSelectByNameApi } from '@/api/deepExploration/deepExploration.js'
import { useUserStore } from '@/stores/modules/userInfo.js'
import { useDeviceStore } from '@/stores/modules/deviceInfo.js'
import { LoginApi } from '@/api/start/login.js'
const tabsData = ref(['全部', '抄底卖顶', '波段行情', '价值投资', '资金及仓位管理', ])
const activeTab = ref('全部')
//
const handleTab = async (item) => {
activeTab.value = item
const nameMap = {
'抄底卖顶': '北京',
'波段行情': '安徽',
'价值投资': '重庆',
'资金及仓位管理': '黑龙江'
}
if (item === '全部') {
await loadStrategy()
uni.showToast({ title: `查看 ${item} 详情`, icon: 'none', duration: 1500 })
return
}
const apiName = nameMap[item]
if (apiName) {
await loadByName(apiName)
uni.showToast({ title: `${item}数据已更新`, icon: 'none', duration: 1500 })
} else {
uni.showToast({ title: `暂不支持:${item}`, icon: 'none' })
}
}
//
const ifASC = ref(true)
//
const tableContentHeaderData = ref(['最新', '涨幅', '跌幅', '昨收', '成交量', '成交额', '开盘价', '最高价', '最低价'])
const fakeData = [{
name: "TechCore",
stockCode: "600001",
latest: 1315.00,
increase: "+5.2%",
decrease: "+5.2%",
previousClose: 1250.00,
volume: 12000,
turnover: "15780K",
openingPrice: 1237.50,
highestPrice: 1320.00,
lowestPrice: 1230.00
},
{
name: "MediaLink",
stockCode: "600002",
latest: 1138.70,
increase: "-3.5%",
decrease: "-3.5%",
previousClose: 1180.00,
volume: 8500,
turnover: "967.9K",
openingPrice: 1191.80,
highestPrice: 1195.00,
lowestPrice: 1130.00
},
{
name: "FinServ",
stockCode: "600003",
latest: 1413.72,
increase: "+7.1%",
decrease: "+7.1%",
previousClose: 1320.00,
volume: 15000,
turnover: "2120.6K",
openingPrice: 1293.60,
highestPrice: 1420.00,
lowestPrice: 1290.00
},
{
name: "AutoDrive",
stockCode: "600004",
latest: 1080.40,
increase: "+2.8%",
decrease: "+2.8%",
previousClose: 1050.00,
volume: 9000,
turnover: "972.4K",
openingPrice: 1055.25,
highestPrice: 1085.00,
lowestPrice: 1050.00
},
{
name: "EduSmart",
stockCode: "600005",
latest: 968.24,
increase: "-1.2%",
decrease: "-1.2%",
previousClose: 980.00,
volume: 7000,
turnover: "677.8K",
openingPrice: 975.10,
highestPrice: 978.00,
lowestPrice: 965.00
},
{
name: "HealthPlusqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",
stockCode: "600006",
latest: 1463.00,
increase: "+4.5%",
decrease: "+4.5%",
previousClose: 1400.00,
volume: 13000,
turnover: "1901.9K",
openingPrice: 1393.00,
highestPrice: 1470.00,
lowestPrice: 1385.00
},
{
name: "AgriTech",
stockCode: "600007",
latest: 1038.36,
increase: "+1.8%",
decrease: "+1.8%",
previousClose: 1020.00,
volume: 6500,
turnover: "674.9K",
openingPrice: 1028.16,
highestPrice: 1040.00,
lowestPrice: 1025.00
},
{
name: "LogiFlow",
stockCode: "600008",
latest: 1094.24,
increase: "-2.3%",
decrease: "-2.3%",
previousClose: 1120.00,
volume: 8000,
turnover: "875.4K",
openingPrice: 1122.24,
highestPrice: 1125.00,
lowestPrice: 1090.00
},
{
name: "EnergySol",
stockCode: "600009",
latest: 1435.05,
increase: "+6.3%",
decrease: "+6.3%",
previousClose: 1350.00,
volume: 14000,
turnover: "2009.1K",
openingPrice: 1339.75,
highestPrice: 1440.00,
lowestPrice: 1335.00
},
{
name: "RealEstate",
stockCode: "600010",
latest: 995.00,
increase: "-0.5%",
decrease: "-0.5%",
previousClose: 1000.00,
volume: 7500,
turnover: "746.3K",
openingPrice: 1003.00,
highestPrice: 1005.00,
lowestPrice: 990.00
}
];
const tableContentHeaderData = ref(['最新', '涨幅', '涨跌', '昨收', '成交量', '成交额', '开盘价', '最高价', '最低价'])
//
const strategyData = ref([])
// token
const ensureAuth = async () => {
const userStore = useUserStore()
if (userStore.userInfo?.token) return
try {
const deviceStore = useDeviceStore()
let deviceId = deviceStore.deviceInfo?.deviceId
if (!deviceId) {
const cached = uni.getStorageSync('deviceId')
deviceId = cached || `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
uni.setStorageSync('deviceId', deviceId)
deviceStore.setDeviceInfo({ ...(deviceStore.deviceInfo || {}), deviceId })
}
const res = await LoginApi({
loginType: 'VISITOR',
account: deviceId,
useCode: false
})
if (res?.code === 200 && res?.data?.token) {
userStore.setUserInfo(res.data)
console.log('游客登录成功,token=', res.data.token)
} else {
console.warn('游客登录失败', res)
}
} catch (err) {
console.warn('游客登录异常', err)
}
}
const formatPctChg = (val) => {
if (val === null || val === undefined || val === '') return ''
const num = Number(val)
if (!isFinite(num)) return String(val)
const sign = num > 0 ? '+' : ''
return `${sign}${num.toFixed(2)}%`
}
// ( pctChg )
const sortByPctDesc = (arr) => arr.sort((a, b) => (Number(b.pctChg) || -Infinity) - (Number(a.pctChg) || -Infinity))
// ///
const loadByName = async (apiName) => {
try {
const userStore = useUserStore()
if (!userStore.userInfo?.token) {
await ensureAuth()
}
const token = useUserStore().userInfo?.token
const res = await stocSelectByNameApi({ name: apiName, token })
const raw = res?.data
const dataObj = raw?.data || raw
let list = []
if (dataObj && typeof dataObj === 'object' && !Array.isArray(dataObj)) {
const target = dataObj[apiName]
if (Array.isArray(target)) list = target
else {
const firstArr = Object.values(dataObj).find(v => Array.isArray(v))
if (Array.isArray(firstArr)) list = firstArr
}
}
if ((!Array.isArray(list) || !list.length) && Array.isArray(raw)) {
list = raw
}
//
if (Array.isArray(list)) list = sortByPctDesc(list)
if (Array.isArray(list) && list.length) {
strategyData.value = list.map(item => ({
name: item.tsCode ?? item.tscode ?? '',
stockCode: item.tsCode ?? item.tscode ?? '',
latest: item.close ?? '',
increase: formatPctChg(item.pctChg),
decrease: item.change ?? '',
previousClose: item.preClose ?? item.preclose ?? '',
volume: item.vol ?? '',
turnover: item.amount ?? '',
openingPrice: item.open ?? '',
highestPrice: item.high ?? '',
lowestPrice: item.low ?? ''
}))
console.log(`按名称(${apiName})加载成功,条数:`, strategyData.value.length, '首项:', strategyData.value[0])
} else {
console.warn('getStrategyByName 返回空列表或结构不匹配', raw)
}
} catch (e) {
console.error('getStrategyByName 接口调用失败', e)
uni.showToast({ title: '按名称加载失败', icon: 'none' })
}
}
const loadStrategy = async () => {
try {
const userStore = useUserStore()
if (!userStore.userInfo?.token) {
await ensureAuth()
}
const token = useUserStore().userInfo?.token
const res = await stocSelectApi({ language: 'cn', token })
const raw = res?.data
const listCandidates = [
raw?.list,
raw?.data?.list,
raw?.data?.rows,
raw?.rows,
Array.isArray(raw) ? raw : null
].filter(Array.isArray)
let list = listCandidates.length ? listCandidates[0] : []
if ((!Array.isArray(list) || !list.length) && raw && typeof raw === 'object' && !Array.isArray(raw)) {
const arrays = Object.values(raw).filter(Array.isArray)
if (arrays.length) list = arrays.flat()
}
//
if (Array.isArray(list)) list = sortByPctDesc(list)
if (Array.isArray(list) && list.length) {
strategyData.value = list.map(item => ({
name: item.tsCode ?? item.tscode ?? '',
stockCode: item.tsCode ?? item.tscode ?? '',
latest: item.close ?? '',
increase: formatPctChg(item.pctChg),
decrease: item.change ?? '',
previousClose: item.preClose ?? item.preclose ?? '',
volume: item.vol ?? '',
turnover: item.amount ?? '',
openingPrice: item.open ?? '',
highestPrice: item.high ?? '',
lowestPrice: item.low ?? ''
}))
console.log('stockSelectDetail 加载成功(已按涨幅降序),条数:', strategyData.value.length, '首项:', strategyData.value[0])
} else {
console.warn('stockSelectDetail 接口返回空列表或结构不匹配', raw)
}
} catch (e) {
console.error('stockSelectDetail 接口调用失败', e)
uni.showToast({ title: '选股策略详情加载失败', icon: 'none' })
}
}
onMounted(() => {
loadStrategy()
})
</script>
<style scoped lang="scss">
@ -229,12 +258,17 @@
background-color: rgb(243, 243, 243);
}
.tabItem-active {
background-color: #DB1F1D; //
color: #fff;
}
}
}
.tableContent {
width: 100%;
background-color: #fff;
position: relative;
.showAll {

21
pages/deepMate/deepMate.vue

@ -291,7 +291,7 @@ const { safeAreaInsets } = uni.getSystemInfoSync();
import { ref, computed, onMounted, onUnmounted, watch, nextTick } from "vue";
import footerBar from "../../components/footerBar";
import marked from "marked"; // marked
import { onPageScroll } from "@dcloudio/uni-app";
import { onPageScroll, onLoad } from "@dcloudio/uni-app";
import {
postStock,
postIntent,
@ -358,6 +358,25 @@ const hotTopics = ref([
},
]);
//
onLoad((options) => {
console.log('deepMate页面接收到参数:', options);
// query
if (options.query) {
const decodedQuery = decodeURIComponent(options.query);
console.log('解码后的查询内容:', decodedQuery);
//
inputMessage.value = decodedQuery;
//
setTimeout(() => {
sendMessage();
}, 500);
}
});
//
onMounted(() => {
const sys = uni.getSystemInfoSync();

41
pages/home/home.vue

@ -47,7 +47,7 @@
<text class="section-title">深度探索</text>
</view>
<view class="header-right">
<text class="more-btn">查看更多</text>
<text class="more-btn" @click="goToDeepExploration">查看更多</text>
</view>
</view>
</view>
@ -192,7 +192,7 @@
import footerBar from '../../components/footerBar.vue'
import MarketOverview from '../../components/MarketOverview.vue'
import DeepMate from '../../components/DeepMate.vue'
// import tcpConnection from '../../api/tcpConnection.js'
import tcpConnection from '../../api/tcpConnection.js'
import th from '../../static/language/th'
import MySelectionsAPI from '../../api/home/mySelections.js'
import { useUserStore } from '../../stores/modules/userInfo'
@ -373,21 +373,21 @@ export default {
uni.$on('visitorLoginSuccess', this.handleVisitorLoginSuccess)
// TCP
this.$nextTick(() => {
console.log('页面渲染完成,开始自动连接TCP服务器...')
//
setTimeout(() => {
// TCPchannel 1
console.log('连接今日市场概览TCP(channel 1)...')
this.connectTcp()
// TCPchannel 2
setTimeout(() => {
console.log('连接我的自选TCP(channel 2)...')
this.connectMyStocksTcp()
}, 500)
}, 1000)
})
// this.$nextTick(() => {
// console.log('TCP...')
// //
// setTimeout(() => {
// // TCPchannel 1
// console.log('TCPchannel 1...')
// this.connectTcp()
// // TCPchannel 2
// setTimeout(() => {
// console.log('TCPchannel 2...')
// this.connectMyStocksTcp()
// }, 500)
// }, 1000)
// })
},
//
@ -430,6 +430,13 @@ export default {
},
methods: {
//
goToDeepExploration() {
uni.navigateTo({
url: '/pages/deepExploration/deepExploration'
})
},
//
handleVisitorLoginSuccess(data) {
console.log('收到游客登录成功事件:', data)

278
pages/setting/share.vue

@ -1,88 +1,255 @@
<template>
<view class="all">
<img class="img-share" src="/static/my/shareBackground.png" />
<img class="img-greenBack" src="/static/my/greenBackground.png" />
<img class="img-QRcode" src="/static/my/QRcode.png" />
<img class="img-award" src="/static/my/award.png" />
<img class="img-myFriends" src="/static/my/myFriends.png" />
<img class="img-friends" src="/static/my/shareFriends.png" />
<text class="jwcode">{{ jwcode }}</text>
<button class="invite">立即邀请</button>
<!-- 背景图部分 -->
<image class="img-share" src="/static/my/shareBackground.png"/>
<image class="img-greenBack" src="/static/my/greenBackground.png"/>
<!-- todo 这里给我个码-->
<image class="img-QRcode" src="/static/my/QRcode.png"/>
<image class="img-award" src="/static/my/award.png"/>
<image class="img-myFriends" src="/static/my/myFriends.png"/>
<image class="img-friends" src="/static/my/shareFriends.png"/>
<!-- dccode -->
<text class="jwcode">{{ dccode }}</text>
<!-- 邀请按钮 -->
<button class="invite" @click="openShare">立即邀请</button>
<!-- 分享弹窗 -->
<uni-popup ref="shareRef" type="share" safeArea>
<SharePopup @select="onShareSelect" @close="closeShare" title=" "/>
</uni-popup>
<!-- 二次弹窗 -->
<uni-popup ref="secondPopup" type="share">
<view class="second-popup">
<view style=" display: flex;justify-content: center;align-items: center; font-size: 17px">
<image style="width: 16px; height: 16px; margin-right: 8rpx" src="/static/my/share/success.png"/>
<text>已复制</text>
</view>
<view class="popup-msg-box">
<text>{{ popupMsg }}</text>
</view>
<view style="justify-content: center; align-items: center;">
<!-- 二次弹窗中的按钮图标 -->
<button
style="border-radius: 40rpx; background-color: black; color: white; display: flex; align-items: center; justify-content: center; padding: 12rpx 24rpx;"
@click="closeSecondPopup">
<image style="width: 25px; height: 25px; margin-right: 8rpx;"
:src="platformIconMap[selectedPlatform]"/>
去粘贴给好友
</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {ref} from 'vue'
import SharePopup from '@/components/SharePopup.vue'
import {getUserInfo} from "@/api/member";
import {Share} from "@/api/setting/share";
/* =============== 数据与引用 =============== */
const shareRef = ref(null)
const secondPopup = ref(null)
const popupMsg = ref('')
// const jwcode = ref('90047681')
//
const selectedPlatform = ref('')
// dccode
const dccode = ref('')
// token
const token = ref('1ab8f83f391ca866191385d0e5048938')
//
const deviceId = ref(100)
//
const version = ref(100)
//
const client = ref('android')
//
const platformIconMap = ref({
'WeChat': '/static/my/share/WeChat.png',
'WhatsApp': '/static/my/share/WhatsApp.png',
'Line': '/static/my/share/Line.png',
'KakaoTalk': '/static/my/share/KakaoTalk.png',
'复制链接': '/static/my/share/share.png'
})
//
const userInfoRes = ref()
// dccode
const shareLink = ref('')
/* =============== 方法 =============== */
userInfoRes.value = getUserInfo()
userInfoRes.value.then(res => {
dccode.value = res.data.dccode
console.log('用户信息', res.data)
})
const ShareRes = ref()
ShareRes.value = Share()
ShareRes.value.then(res => {
if (res.code === 200){
shareLink.value = res.message
console.log('分享接口返回', res.data)
}else {
console.log('分享接口返回失败', res.data)
}
})
//
function openShare() {
Share()
shareRef.value.open()
}
//
function closeShare() {
shareRef.value.close()
}
//
//
function onShareSelect({item}) {
console.log('选择了:', item.name)
selectedPlatform.value = item.name //
// //
// const baseUrl = 'https:'
// // const shareLink = `${baseUrl}?token=${encodeURIComponent(token.value)}&deviceId=${encodeURIComponent(deviceId.value)}&version=${encodeURIComponent(version.value)}&client=${encodeURIComponent(client.value)}`
// const shareLink = `$ `
//
shareRef.value.close()
popupMsg.value = `【DeepChart】邀请你加入,点击链接帮我助力: ${shareLink.value}`
uni.setClipboardData({
data: popupMsg.value,
showToast: false
});
/* // 根据分享选项显示不同提示
if (item.name === '复制链接') {
popupMsg.value = '链接已复制,快去分享给好友吧~'
} else if (item.name === 'WeChat') {
popupMsg.value = '请在微信中分享~'
} else {
popupMsg.value = `你选择了 ${item.name}`
}*/
//
secondPopup.value.open()
}
//
function closeSecondPopup() {
if (selectedPlatform.value === 'WeChat') {
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 1,
summary: popupMsg.value,
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
});
secondPopup.value.close()
}
//
else if (selectedPlatform.value === 'WhatsApp' || selectedPlatform.value === 'Line' || selectedPlatform.value === 'KakaoTalk') {
secondPopup.value.close()
uni.showToast({title: '开发中……', icon: 'none'})
} else if (selectedPlatform.value === '复制链接') {
uni.showToast({title: '已复制', icon: 'success'})
secondPopup.value.close()
}
}
const jwcode = ref('90047681')
</script>
<style>
.all {
<style scoped>
.all {
position: relative;
width: 750rpx;
height: auto;
}
}
.img-share {
/* 背景图片部分 */
.img-share {
width: 750rpx;
height: 2118rpx;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.img-QRcode{
width:320rpx;
height:320rpx;
position:absolute;
top:26vh;
left:215rpx;
z-index: 3;
}
}
.img-greenBack {
.img-greenBack {
width: 670rpx;
height: 1740rpx;
position: absolute;
top: 16vh;
/* 为什么要用这个替代 margin-top */
left: 40rpx;
/* 还有 padding-left */
z-index: 2;
}
}
.img-friends {
width: 602rpx;
height: 840rpx;
.img-QRcode {
width: 320rpx;
height: 320rpx;
position: absolute;
top: 68vh;
left: 74rpx;
top: 26vh;
left: 215rpx;
z-index: 3;
}
}
.img-award {
.img-award {
width: 300rpx;
height: 120rpx;
position: absolute;
top: 61vh;
left: 75rpx;
z-index: 3;
}
}
.img-myFriends {
.img-myFriends {
width: 300rpx;
height: 88rpx;
position: absolute;
top: 61vh;
right: 75rpx;
z-index: 3;
}
}
.img-friends {
width: 602rpx;
height: 840rpx;
position: absolute;
top: 68vh;
left: 74rpx;
z-index: 3;
}
.jwcode {
/* 邀请码与按钮 */
.jwcode {
width: 320rpx;
height: 38rpx;
display: flex;
@ -92,14 +259,14 @@
top: 19vh;
left: 212rpx;
z-index: 999;
}
}
.invite {
.invite {
width: 320rpx;
height: 80rpx;
border-radius: 40rpx;
background-color: black;
color:white;
color: white;
display: flex;
justify-content: center;
align-items: center;
@ -107,5 +274,26 @@
top: 50.7vh;
left: 212rpx;
z-index: 999;
}
}
/* 第二个弹窗样式 */
.second-popup {
background-color: #fff;
border-radius: 12px;
padding: 30rpx;
text-align: center;
}
.popup-msg-box {
background-color: #F3F3F3;
border-radius: 8px;
padding: 12px 16px;
margin: 10px;
align-items: center;
justify-content: center;
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 溢出部分显示... */
}
</style>

BIN
static/my/share/KakaoTalk.png

After

Width: 42  |  Height: 42  |  Size: 2.5 KiB

BIN
static/my/share/Line.png

After

Width: 42  |  Height: 42  |  Size: 2.2 KiB

BIN
static/my/share/WeChat.png

After

Width: 42  |  Height: 42  |  Size: 2.4 KiB

BIN
static/my/share/WhatsApp.png

After

Width: 42  |  Height: 42  |  Size: 3.6 KiB

BIN
static/my/share/share.png

After

Width: 42  |  Height: 42  |  Size: 1.3 KiB

BIN
static/my/share/success.png

After

Width: 32  |  Height: 32  |  Size: 1.6 KiB

4
utils/http.js

@ -2,8 +2,8 @@ import { useUserStore } from "../stores/modules/userInfo"
import { useDeviceStore } from "../stores/modules/deviceInfo"
import { useLoginStore } from "../stores/modules/login"
// const baseURL = "https://dbqb.nfdxy.net/testApi"
const baseURL = "http://192.168.40.8:9000"
const baseURL = "https://dbqb.nfdxy.net/testApi"
const httpInterceptor = {
// 拦截前触发

22
vue.config.js

@ -1,18 +1,8 @@
module.exports = {
devServer: {
/* proxy: {
'/api': { // 你的目标服务器的请求路径前缀
target: 'https://hwjb.homilychart.com', // 目标服务器的地址
changeOrigin: true, // 是否跨域
secure: false, // 如果是https接口,需要配置这个参数
pathRewrite: {
'^/api': '' // 将 /api 替换为 /testApi,以便正确请求目标服务器的资源
}
}
} */
proxy: {
'/api': { // 你的目标服务器的请求路径前缀
target: 'http://192.168.40.8:9000', // 目标服务器的地址
target: 'https://hwjb.homilychart.com', // 目标服务器的地址
changeOrigin: true, // 是否跨域
secure: false, // 如果是https接口,需要配置这个参数
pathRewrite: {
@ -20,5 +10,15 @@ module.exports = {
}
}
}
// proxy: {
// '/api': { // 你的目标服务器的请求路径前缀
// target: 'http://192.168.40.8:9000', // 目标服务器的地址
// changeOrigin: true, // 是否跨域
// secure: false, // 如果是https接口,需要配置这个参数
// pathRewrite: {
// '^/api': '' // 将 /api 替换为 /testApi,以便正确请求目标服务器的资源
// }
// }
// }
}
}
Loading…
Cancel
Save