个股搜索添加
This commit is contained in:
@@ -5,9 +5,15 @@
|
||||
<view class="searchC fixed flex" :style="'top:'+navH+'px;'">
|
||||
<image class="icon" src="/static/icon/home/conceptCenter/search.png" mode="widthFix"></image>
|
||||
<input class="flex1" type="text" v-model="keywords" placeholder="输入股票代码或名称"
|
||||
placeholder-style="color:#eeeeee" confirm-type="search" @confirm="clickSearch()" />
|
||||
placeholder-style="color:#eeeeee" confirm-type="search" @input="clickSearch()" />
|
||||
</view>
|
||||
<view v-if="searchShow" class="searchResultList fixed" :style="'top:'+searchResultTop+'px;'" @click="clickSearchResultBg()">
|
||||
<view class="list">
|
||||
<view class="item" v-for="(item,index) in searchResultList" :key="index" @click.stop="clickSearchResultListItem(item)">
|
||||
{{item.stock_code}} {{item.stock_name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y class="stockDetailsC fixed" :style="'top:'+contentTop+'px;'">
|
||||
<view>
|
||||
<view style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16rpx; margin: 0 20rpx;">
|
||||
@@ -60,7 +66,9 @@
|
||||
inject
|
||||
} from 'vue'
|
||||
import {
|
||||
marketHeatmap
|
||||
marketHeatmap,
|
||||
searchStockInfo,
|
||||
stockBasicInfo
|
||||
} from '@/request/api'
|
||||
|
||||
export default {
|
||||
@@ -71,6 +79,12 @@
|
||||
allStockData: [],
|
||||
filteredData: [],
|
||||
currentDate: '', // 最终要赋值的日期
|
||||
searchResultTop:'', //搜索结果
|
||||
contentTop: '',
|
||||
keywords: '', //搜索关键字
|
||||
searchShow:false, //是否展示搜索结果
|
||||
searchResultList:[], //搜索结果
|
||||
selectSearchStockInfo:null, //选中的搜索股票信息
|
||||
topLists: [{
|
||||
title: '超大盘股',
|
||||
value: '(>1000亿)',
|
||||
@@ -89,10 +103,66 @@
|
||||
},
|
||||
onLoad(e) {
|
||||
this.currentDate = e.currentDate
|
||||
this.searchResultTop = this.navH + (20 + 70) / 750 * inject('windowWidth')
|
||||
this.contentTop = this.navH + (20 + 70 + 25) / 750 * inject('windowWidth')
|
||||
this.marketHeatmap()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击搜索
|
||||
*/
|
||||
clickSearch() {
|
||||
if(this.keywords) {
|
||||
this.getSearchStockInfoListData()
|
||||
}else
|
||||
this.selectSearchStockInfo = null
|
||||
},
|
||||
/**
|
||||
* 点击搜索结果背景
|
||||
*/
|
||||
clickSearchResultBg()
|
||||
{
|
||||
this.searchShow = false
|
||||
},
|
||||
/**
|
||||
* 点击搜索结果列表项
|
||||
*/
|
||||
clickSearchResultListItem(item) {
|
||||
this.selectSearchStockInfo = item
|
||||
this.searchShow = false
|
||||
this.getStockBasicInfoData()
|
||||
//this.getQuoteDetailsData()
|
||||
},
|
||||
/**
|
||||
* 根据输入内容获取搜索列表项
|
||||
*/
|
||||
getSearchStockInfoListData() {
|
||||
let param = {q:this.keywords,limit:10}
|
||||
searchStockInfo(param).then(res=>{
|
||||
this.searchResultList = res.data
|
||||
this.searchShow = this.searchResultList.length>0
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取股票基本信息
|
||||
*/
|
||||
getStockBasicInfoData() {
|
||||
let code = this.stockCode
|
||||
if (this.selectSearchStockInfo) {
|
||||
code = this.selectSearchStockInfo.stock_code
|
||||
}
|
||||
// stockBasicInfo(code).then(res=>{
|
||||
// this.stockBasicInfo = res.data
|
||||
// this.navTitle = res.data.SECNAME+'('+res.data.SECCODE+')'
|
||||
// }).catch(error=>{
|
||||
|
||||
// })
|
||||
uni.navigateTo({
|
||||
url: '/pagesStock/stockCenterDetails/stockCenterDetails?code=' + code
|
||||
})
|
||||
},
|
||||
handleTypeClick(index) {
|
||||
this.list2Index = index;
|
||||
// 先请求数据,再筛选
|
||||
@@ -130,8 +200,10 @@
|
||||
},
|
||||
marketHeatmap() {
|
||||
let param = {
|
||||
limit: 500,
|
||||
date: this.currentDate
|
||||
limit: 500
|
||||
}
|
||||
if (this.currentDate && this.currentDate !== 'undefined' && this.currentDate.trim() !== '') {
|
||||
param.date = this.currentDate;
|
||||
}
|
||||
marketHeatmap(param).then(res => {
|
||||
// 存储原始数据
|
||||
@@ -218,4 +290,25 @@
|
||||
background-color: white;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.searchResultList {
|
||||
background-color: #00000080;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 0 25rpx;
|
||||
.list
|
||||
{
|
||||
background-color: white;
|
||||
border-radius: 10rpx;
|
||||
.item
|
||||
{
|
||||
padding: 0 42rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
z-index: 20;
|
||||
}
|
||||
</style>
|
||||
@@ -5,9 +5,15 @@
|
||||
<view class="searchC fixed flex" :style="'top:'+navH+'px;'">
|
||||
<image class="icon" src="/static/icon/home/conceptCenter/search.png" mode="widthFix"></image>
|
||||
<input class="flex1" type="text" v-model="keywords" placeholder="输入股票代码或名称"
|
||||
placeholder-style="color:#eeeeee" confirm-type="search" @confirm="clickSearch()" />
|
||||
placeholder-style="color:#eeeeee" confirm-type="search" @input="clickSearch()" />
|
||||
</view>
|
||||
<view v-if="searchShow" class="searchResultList fixed" :style="'top:'+searchResultTop+'px;'" @click="clickSearchResultBg()">
|
||||
<view class="list">
|
||||
<view class="item" v-for="(item,index) in searchResultList" :key="index" @click.stop="clickSearchResultListItem(item)">
|
||||
{{item.stock_code}} {{item.stock_name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y class="stockDetailsC fixed" :style="'top:'+contentTop+'px;'">
|
||||
<view>
|
||||
<view style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16rpx; padding: 20rpx;">
|
||||
@@ -74,12 +80,12 @@
|
||||
mode="widthFix"></image>
|
||||
<view style="font-size: 28rpx; color: #2B2B2B; font-weight: bold; flex: 1; margin-left: 10rpx;">异动监控
|
||||
</view>
|
||||
<view @click="allAction(1)"
|
||||
<!-- <view @click="allAction(1)"
|
||||
style="border: 1rpx solid #DCDCDC; border-radius: 5rpx; padding: 2rpx 10rpx; display: flex; align-items: center; justify-content: center; margin: 0 10rpx;">
|
||||
<view style="color: #888888; font-size: 22rpx; font-weight: 500;">全部</view>
|
||||
<image style="width: 11rpx; height: 6rpx; margin-left: 40rpx;"
|
||||
src="/static/icon/invest/downArrow.png" mode="widthFix"></image>
|
||||
</view>
|
||||
</view> -->
|
||||
<view @click="allAction(2)"
|
||||
style="border: 1rpx solid #DCDCDC; border-radius: 5rpx; padding: 2rpx 10rpx; display: flex; align-items: center; justify-content: center;">
|
||||
<view style="color: #888888; font-size: 22rpx; font-weight: 500;">{{currentDate}}</view>
|
||||
@@ -88,9 +94,9 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
<!-- <view
|
||||
style="height: 400rpx; display: flex; align-items: center; justify-content: center; background-color: red;">
|
||||
折线图占位 </view>
|
||||
折线图占位 </view> -->
|
||||
|
||||
<view style="height: 1rpx; margin: 0 20rpx; background-color: #E7E7E7;"></view>
|
||||
<view style="height: 88rpx; display: flex; align-items: center; margin: 0 20rpx;">
|
||||
@@ -107,8 +113,9 @@
|
||||
|
||||
<view style="display: flex; align-items: center; margin-top: 10rpx;">
|
||||
<view style="color: #2B2B2B; font-weight: bold; font-size: 26rpx; margin-right: 10rpx;">
|
||||
{{item.concept_name}}
|
||||
{{truncateText(item.concept_name, 5)}}
|
||||
</view>
|
||||
|
||||
<view :style="{
|
||||
color: alertTypeConfig[item.alert_type]?.color || '#FF7A45',
|
||||
fontSize: '20rpx',
|
||||
@@ -306,8 +313,11 @@
|
||||
marketHeatmap,
|
||||
marketStatistics,
|
||||
marketHotspotOverview,
|
||||
conceptStocks
|
||||
conceptStocks,
|
||||
searchStockInfo,
|
||||
stockBasicInfo
|
||||
} from '@/request/api'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -431,26 +441,116 @@
|
||||
formattedAvg: 0,
|
||||
upCount: 0,
|
||||
downCount: 0,
|
||||
limit_up_ratio: 0
|
||||
limit_up_ratio: 0,
|
||||
searchResultTop:'', //搜索结果
|
||||
contentTop: '',
|
||||
keywords: '', //搜索关键字
|
||||
searchShow:false, //是否展示搜索结果
|
||||
searchResultList:[], //搜索结果
|
||||
selectSearchStockInfo:null, //选中的搜索股票信息
|
||||
isShowTime:false
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.activeIndex = e.index
|
||||
this.searchResultTop = this.navH + (20 + 70) / 750 * inject('windowWidth')
|
||||
this.contentTop = this.navH + (20 + 70 + 25) / 750 * inject('windowWidth')
|
||||
//this.conceptsDailyTop()
|
||||
this.conceptsDailyTop()
|
||||
|
||||
// 获取当前日期,并减去一天
|
||||
const now = new Date()
|
||||
// 核心修改:将日期减去 1 天(1 天 = 24 * 60 * 60 * 1000 毫秒)
|
||||
now.setTime(now.getTime() - 24 * 60 * 60 * 1000)
|
||||
|
||||
const year = now.getFullYear()
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
||||
const day = now.getDate().toString().padStart(2, '0')
|
||||
this.currentDate = `${year}-${month}-${day}`
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.isShowTime=false;
|
||||
this.marketHeatmap();
|
||||
this.marketStatistics()
|
||||
|
||||
this.marketHotspotListOverview()
|
||||
},
|
||||
methods: {
|
||||
truncateText(text, length) {
|
||||
if (!text) return ''; // 处理空值,避免报错
|
||||
return text.length > length
|
||||
? text.substring(0, length) + '...'
|
||||
: text;
|
||||
},
|
||||
/**
|
||||
* 点击搜索
|
||||
*/
|
||||
clickSearch() {
|
||||
if(this.keywords) {
|
||||
this.getSearchStockInfoListData()
|
||||
}else
|
||||
this.selectSearchStockInfo = null
|
||||
},
|
||||
/**
|
||||
* 点击搜索结果背景
|
||||
*/
|
||||
clickSearchResultBg()
|
||||
{
|
||||
this.searchShow = false
|
||||
},
|
||||
/**
|
||||
* 点击搜索结果列表项
|
||||
*/
|
||||
clickSearchResultListItem(item) {
|
||||
this.selectSearchStockInfo = item
|
||||
this.searchShow = false
|
||||
this.getStockBasicInfoData()
|
||||
//this.getQuoteDetailsData()
|
||||
},
|
||||
/**
|
||||
* 根据输入内容获取搜索列表项
|
||||
*/
|
||||
getSearchStockInfoListData() {
|
||||
let param = {q:this.keywords,limit:10}
|
||||
searchStockInfo(param).then(res=>{
|
||||
this.searchResultList = res.data
|
||||
this.searchShow = this.searchResultList.length>0
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取股票基本信息
|
||||
*/
|
||||
getStockBasicInfoData() {
|
||||
let code = this.stockCode
|
||||
if (this.selectSearchStockInfo) {
|
||||
code = this.selectSearchStockInfo.stock_code
|
||||
}
|
||||
// stockBasicInfo(code).then(res=>{
|
||||
// this.stockBasicInfo = res.data
|
||||
// this.navTitle = res.data.SECNAME+'('+res.data.SECCODE+')'
|
||||
// }).catch(error=>{
|
||||
|
||||
// })
|
||||
uni.navigateTo({
|
||||
url: '/pagesStock/stockCenterDetails/stockCenterDetails?code=' + code
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取股票当前市场价格信息
|
||||
*/
|
||||
getQuoteDetailsData() {
|
||||
let code = this.stockCode
|
||||
if (this.selectSearchStockInfo) {
|
||||
code = this.selectSearchStockInfo.stock_code
|
||||
}
|
||||
quoteDetailsInfo(code).then(res=>{
|
||||
this.quoteDetailsInfo = res.data
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
},
|
||||
formatAlpha(value) {
|
||||
// 1. 空值/非数字处理
|
||||
if (value === null || value === undefined || isNaN(Number(value))) {
|
||||
@@ -519,9 +619,13 @@
|
||||
let param = {
|
||||
limit: 500
|
||||
}
|
||||
if(this.isShowTime){
|
||||
|
||||
if (currentDate && currentDate !== 'undefined' && currentDate.trim() !== '') {
|
||||
param.date = currentDate;
|
||||
}
|
||||
}
|
||||
|
||||
marketHeatmap(param).then(res => {
|
||||
this.topLists[2].value = res.statistics.rising_count + "/" + res.statistics.falling_count;
|
||||
// 存储原始数据
|
||||
@@ -694,9 +798,14 @@
|
||||
})
|
||||
},
|
||||
moreAction() {
|
||||
if(this.isShowTime){
|
||||
uni.navigateTo({
|
||||
url: '/pages/geGuCenter/detail?currentDate=' + this.currentDate
|
||||
})}else{
|
||||
uni.navigateTo({
|
||||
url: '/pages/geGuCenter/detail'
|
||||
})
|
||||
}
|
||||
},
|
||||
allAction(index) {
|
||||
if (index == 1) {
|
||||
@@ -734,6 +843,7 @@
|
||||
const day = now.getDate().toString().padStart(2, '0')
|
||||
this.currentDate = `${year}-${month}-${day}`
|
||||
}
|
||||
this.isShowTime=true;
|
||||
this.marketHeatmap(this.currentDate)
|
||||
this.marketStatistics()
|
||||
|
||||
@@ -846,4 +956,26 @@
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
.searchResultList {
|
||||
background-color: #00000080;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 0 25rpx;
|
||||
.list
|
||||
{
|
||||
background-color: white;
|
||||
border-radius: 10rpx;
|
||||
.item
|
||||
{
|
||||
padding: 0 42rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -8,7 +8,7 @@
|
||||
<image style="width: 40rpx; height: 40rpx;" src="/pagesStock/static/icon/ai-icon.png" mode="widthFix">
|
||||
</image>
|
||||
<text style="font-size: 36rpx; margin-left: 10rpx; margin-right: 20rpx;">AI总结</text>
|
||||
<text style="font-size: 28rpx;">市场情绪温和,主线题材:存储芯片</text>
|
||||
<text style="font-size: 28rpx;"></text>
|
||||
</view>
|
||||
|
||||
<view style="background-color: white; border-radius: 10rpx; overflow: hidden; margin: 25rpx;">
|
||||
@@ -94,7 +94,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 7rpx; margin-top: 25rpx;">
|
||||
<view v-for="(item, index) in bkList" :key="index" @click="bkydAction(index)" :style="{
|
||||
<view v-for="(item, index) in bkList" :key="index" :style="{
|
||||
backgroundColor: item.bgColor,
|
||||
borderRadius: '5rpx',
|
||||
padding: '15rpx',
|
||||
@@ -132,17 +132,17 @@
|
||||
style="width: 100%; height: 500rpx; display: flex; align-items: center; justify-content: center; color: #999;">
|
||||
板块关联图内容区域
|
||||
</view> -->
|
||||
<view v-show="activeType === 0" style="width: 100%; height: 500rpx;">
|
||||
<!-- <view v-show="activeType === 0" style="width: 100%; height: 500rpx;">
|
||||
<l-echart ref="graphChartRef"></l-echart>
|
||||
</view>
|
||||
<view v-show="activeType === 1" style="width: 100%; height: 500rpx;">
|
||||
</view> -->
|
||||
<view v-show="activeType === 0" style="width: 100%; height: 500rpx;">
|
||||
<l-echart ref="chartRef"></l-echart>
|
||||
</view>
|
||||
<WordCloud v-show="activeType === 2" :wordData="wordData" :width="330" :height="330" />
|
||||
<WordCloud v-show="activeType === 1" :wordData="wordData" :width="330" :height="330" />
|
||||
</view>
|
||||
|
||||
|
||||
<view style="color: #2B2B2B; font-weight: 500; display: flex; margin: 25rpx 20rpx;">
|
||||
<!-- <view style="color: #2B2B2B; font-weight: 500; display: flex; margin: 25rpx 20rpx;">
|
||||
<image style="width: 40rpx; height: 42rpx;" src="/pagesStock/static/icon/all-icon-3.png"
|
||||
mode="widthFix"></image>
|
||||
<view style="margin-left: 10rpx;">
|
||||
@@ -186,7 +186,7 @@
|
||||
<image style="width: 27rpx; height: 25rpx; margin-right: 10rpx;"
|
||||
src="/pagesStock/static/icon/all-icon-5.png" mode="widthFix"></image>
|
||||
<text>高位股风险较高,追涨需谨慎</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -355,8 +355,13 @@
|
||||
level: '无热度'
|
||||
} // ≤20%
|
||||
],
|
||||
// bkTypes: [
|
||||
// '板块关联图',
|
||||
// '板块分布',
|
||||
// '热门概念词云'
|
||||
// ],
|
||||
bkTypes: [
|
||||
'板块关联图',
|
||||
|
||||
'板块分布',
|
||||
'热门概念词云'
|
||||
],
|
||||
@@ -446,7 +451,7 @@
|
||||
this.fetchData()
|
||||
// 页面就绪后,若默认选中的是板块分布,初始化饼图
|
||||
//if (this.activeType === 0) {
|
||||
this.initGraphChart(); // 初始化关系图
|
||||
//this.initPieChart(); // 初始化关系图
|
||||
//} else if (this.activeType === 1) {
|
||||
// 初始化饼图
|
||||
//}
|
||||
@@ -467,10 +472,12 @@
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
this.$refs.graphChartRef && this.initGraphChart(); // 增加存在性判断
|
||||
//this.$refs.graphChartRef && this.initGraphChart(); // 增加存在性判断
|
||||
this.$refs.chartRef && this.initPieChart(); // 增加存在性判断
|
||||
break;
|
||||
case 1:
|
||||
this.$refs.chartRef && this.initPieChart(); // 增加存在性判断
|
||||
//this.$refs.chartRef && this.initPieChart(); // 增加存在性判断
|
||||
this.initWordCloud();
|
||||
break;
|
||||
case 2:
|
||||
this.initWordCloud();
|
||||
|
||||
Reference in New Issue
Block a user