11.26 修改K线图样式

This commit is contained in:
尚政杰
2025-11-26 17:19:38 +08:00
parent 48f49c6cf0
commit 4e64455b9b
4803 changed files with 146408 additions and 648 deletions

View File

@@ -8,7 +8,10 @@
<text class="title">{{eventDetails.event_title}}</text>
</view>
<view class="eventTime">{{eventDetails.event_created_at.substr(0,16)}}</view>
<view class="eventContent">{{eventDetails.event_desc}}<text class="ai">AI合成风险提示解析内容由价值前沿人工采集整理自新闻公告研报等公开信息团队辛苦编写未经许可严禁转载本产品内容内容均不构成投资建议请投资者注意风险独立审慎决策</text></view>
<view class="eventContent">{{eventDetails.event_desc}}<text class="ai">AI合成</text></view>
<view class="riskTips">
风险提示解析内容由价值前沿人工采集整理自新闻公告研报等公开信息团队辛苦编写未经许可严禁转载本产品内容内容均不构成投资建议请投资者注意风险独立审慎决策
</view>
<scroll-view scroll-x class="categoryList">
<view :class="'item relative '+(selectCategory==index?'select':'')" v-for="(item,index) in categoryList" :key="index" @click="clickCategoryItem(index)">
{{item}}
@@ -278,8 +281,8 @@
grid:{
left: '10%',
right: '6%',
top: '0%',
bottom: '20%',
top: '5%',
bottom: '10%',
},
xAxis:{
type: 'category',
@@ -306,6 +309,7 @@
position:'top',
fontSize:12,
},
symbol:'none',
silent:true,
data: [],
itemStyle:{
@@ -350,6 +354,7 @@
option.series.data = valueData
option.xAxis.data = categoryData
let time = that.eventDetails.event_start_time.split('T')[1]
time = time.substring(0,5)
let firstOpen = item.minute_chart_data[0].open
option.series.markLine.data = [
{
@@ -690,6 +695,15 @@
color: #C00000;
}
}
.riskTips
{
margin: 20rpx 25rpx 0;
padding-bottom: 30rpx;
line-height: 1.4rem;
font-size: 20rpx;
color: #999;
border-bottom: solid 1rpx #E4E4E4;
}
.categoryList
{
white-space: nowrap;

View File

@@ -37,10 +37,10 @@
</view>
</scroll-view>
</view>
<scroll-view scroll-y class="eventListC fixed" :style="'top:'+listTop+'px'" @scrolltolower="loadMoreData()">
<view style="width:750rpx; height:400rpx">
<scroll-view scroll-y class="eventListC fixed" :style="'top:'+listTop+'px'" refresher-enabled :refresher-triggered="isRefreshing" @refresherrefresh="pullDownRefresh()" @scrolltolower="loadMoreData()">
<!-- <view style="width:750rpx; height:400rpx">
<l-echart ref="chartRef"></l-echart>
</view>
</view> -->
<view class="list">
<view class="item" @click="clickEventItem(item.id)" v-for="(item,index) in eventList" :key="index">
<view class="flex">
@@ -68,9 +68,9 @@
{{getRateStr(item.related_week_chg)}}%
</view>
</scroll-view>
<scroll-view scroll-x class="stockList">
<!-- <scroll-view scroll-x class="stockList">
<view class="stockItem" v-for="(sitem,sindex) in item.related_stocks" :key="sindex" @click.stop="clickLookRelatedStockItem(item.id,sitem.stock_code)">{{sitem.stock_name}} <text :class="'change '+(getRateUpOrDown(sitem.daily_change)?'down':'up')">{{(getRateUpOrDown(sitem.daily_change)?'':'+')+sitem.daily_change}}%</text></view>
</scroll-view>
</scroll-view> -->
<view class="timeToolBarC flex">
<view class="time flex1">{{getLocaleTime(item.created_at)}}</view>
<view class="toolBarC flex">
@@ -91,7 +91,7 @@
</view>
</view>
</scroll-view>
<uni-popup ref="sortPopup" type="top" mask-background-color="transparent">
<uni-popup ref="sortPopup" type="top" mask-background-color="transparent" :animation="false">
<view class="sortPopup relative">
<image class="arrow absolute" src="/static/icon/home/sortArrow.png" mode="widthFix"></image>
<view class="list" :style="'margin-top:'+sortListTop+'px;'">
@@ -263,6 +263,7 @@
import { filterOptions, eventList, homeData, industryCategoryList, loginByEmail, followEvent, stockCategoryList } from '@/request/api'
import { getRateStr, getRateUpOrDown, getLocaleTime } from '@/utils/util.js'
const echarts = require('../../uni_modules/lime-echart/static/echarts.min.js');
import posthog from '@/utils/posthog.js';
export default {
data() {
@@ -274,6 +275,7 @@
contentTop:'',
listTop:'',
sortListTop:'',
isRefreshing:false,
keywords:'', //关键词
sortList:[],
selectSortKey:'', //选中排序key
@@ -449,7 +451,8 @@
monthDateList.push(daysOfMonth)
}
}
this.monthDateList = monthDateList
this.monthDateList = monthDateList
posthog.capture("首页")
},
onReady() {
uni.createSelectorQuery().select('#topCategory').boundingClientRect(rect=>{
@@ -461,11 +464,18 @@
this.secondScrollWidth = Math.round(rect.width)
}
}).exec()
},
onPullDownRefresh() {
this.clickSearch()
},
methods: {
/**
* 下拉刷新
*/
pullDownRefresh(){
this.isRefreshing = true
this.clickSearch()
},
/**
* 上拉加载
*/
loadMoreData()
{
if(!this.loadAll)
@@ -916,7 +926,7 @@
this.importanceList.unshift({desc: "全部",key: "all",name: "全部"})
}else
{
reject(1)
resolve(1)
uni.showToast({
title:res.message,
icon:'none'
@@ -1025,85 +1035,85 @@
}
}
eventList(param).then(res=>{
this.isRefreshing = false
if(res.success)
{
let valueData = []
let data = res.data.overall_stats.change_distribution
valueData.push({
value:data.limit_down,
itemStyle: {color:'#35542266'},
label:{
textStyle: {color:'#35542266'},
},
})
valueData.push({
value:data.down_over_5,
itemStyle: {color:'#35542299'},
label:{
textStyle: {color:'#355422'},
},
},)
valueData.push({
value:data.down_5_to_1,
itemStyle: {color:'#355422CC'},
label:{
textStyle: {color:'#355422'},
},
})
valueData.push({
value:data.down_within_1,
itemStyle: {color:'#355422'},
label:{
textStyle: {color:'#355422'},
},
})
valueData.push({
value:data.flat,
itemStyle: {color:'#ACB0C0'},
label:{
textStyle: {color:'#666'},
},
},)
valueData.push({
value:data.up_within_1,
itemStyle: {color:'#C00000'},
label:{
textStyle: {color:'#C00000'},
},
})
valueData.push({
value:data.up_1_to_5,
itemStyle: {color:'#C00000CC'},
label:{
textStyle: {color:'#C00000'},
}
})
valueData.push({
value:data.up_over_5,
itemStyle: {color:'#C0000099'},
label:{
textStyle: {color:'#C00000'},
}
})
valueData.push({
value:data.limit_up,
itemStyle: {color:'#C0000066'},
label:{
textStyle: {color:'#C0000066'},
}
})
this.option.series[0].data = valueData
this.init()
// let valueData = []
// let data = res.data.overall_stats.change_distribution
// valueData.push({
// value:data.limit_down,
// itemStyle: {color:'#35542266'},
// label:{
// textStyle: {color:'#35542266'},
// },
// })
// valueData.push({
// value:data.down_over_5,
// itemStyle: {color:'#35542299'},
// label:{
// textStyle: {color:'#355422'},
// },
// },)
// valueData.push({
// value:data.down_5_to_1,
// itemStyle: {color:'#355422CC'},
// label:{
// textStyle: {color:'#355422'},
// },
// })
// valueData.push({
// value:data.down_within_1,
// itemStyle: {color:'#355422'},
// label:{
// textStyle: {color:'#355422'},
// },
// })
// valueData.push({
// value:data.flat,
// itemStyle: {color:'#ACB0C0'},
// label:{
// textStyle: {color:'#666'},
// },
// },)
// valueData.push({
// value:data.up_within_1,
// itemStyle: {color:'#C00000'},
// label:{
// textStyle: {color:'#C00000'},
// },
// })
// valueData.push({
// value:data.up_1_to_5,
// itemStyle: {color:'#C00000CC'},
// label:{
// textStyle: {color:'#C00000'},
// }
// })
// valueData.push({
// value:data.up_over_5,
// itemStyle: {color:'#C0000099'},
// label:{
// textStyle: {color:'#C00000'},
// }
// })
// valueData.push({
// value:data.limit_up,
// itemStyle: {color:'#C0000066'},
// label:{
// textStyle: {color:'#C0000066'},
// }
// })
// this.option.series[0].data = valueData
// this.init()
if(this.page==1)
{
this.eventList = res.data.events
}else
this.eventList = this.eventList.concat(res.data.events)
this.loadAll = !res.data.pagination.has_next
}
}).catch(error=>{
this.isRefreshing = false
})
},
/**
@@ -1565,7 +1575,8 @@
border-radius: 5rpx;
font-size: 28rpx;
font-weight: 500;
color: #B0B0B0;
// color: #B0B0B0;
color:#858C9A;
.start
{
text-align: right;

View File

@@ -9,11 +9,18 @@
</view>
</view>
<view :class="'contentC fixed '+(type==2?'radius':'')" :style="'top:'+contentTop+'px;'">
<!-- <view v-if="type==1&&tradeData" class="volumeAmountC flex">
<text class="volume">成交量{{tradeData.volume}}</text>
<text class="amount">成交金额{{tradeData.amount}}</text>
</view> -->
<view v-if="type==1" style="width:750rpx; height:400rpx">
<l-echart ref="chartRef"></l-echart>
</view>
<view class="section">关联描述</view>
<view class="des">{{relatedDesc}}<text class="ai">AI合成风险提示解析内容由价值前沿人工采集整理自新闻公告研报等公开信息团队辛苦编写未经许可严禁转载本产品内容内容均不构成投资建议请投资者注意风险独立审慎决策</text></view>
<view class="des">{{relatedDesc}}<text class="ai">AI合成</text></view>
<view class="riskTips">
风险提示解析内容由价值前沿人工采集整理自新闻公告研报等公开信息团队辛苦编写未经许可严禁转载本产品内容内容均不构成投资建议请投资者注意风险独立审慎决策
</view>
<view v-if="type==1&&sourceList.length>0" class="section">信息来源</view>
<view class="list">
<view class="item" v-for="(item,index) in sourceList" :key="index">
@@ -46,6 +53,7 @@
stockCode:'', //股票code
categoryList:['分时图','日K线'],
selectCategory:0,
tradeData:null, //成交数据
option:{
title: {
show:false
@@ -84,7 +92,7 @@
axisLine: { onZero: false },
splitLine: { show: false },
min: 'dataMin',
max: 'dataMax'
max: ''
},
yAxis: {
scale: true,
@@ -112,10 +120,10 @@
type: 'candlestick',
data: [],
itemStyle: {
color: '#ec0000',
color0: '#00da3c',
borderColor: '#ec0000',
borderColor0: '#00da3c'
color: '#ffffff',
color0: '#355422',
borderColor: '#c00000',
borderColor0: '#355422'
}
}],
@@ -127,16 +135,16 @@
tooltip: {
position:function (pos, params, dom, rect, size) {
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
var obj = {top: '10%'};
var obj = {top: '5%'};
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5;
return obj;
},
trigger: 'axis',
formatter: function (params) {
console.log(params)
let res = '时间:'+params[0].name+'\n'+'高:'+params[0].data[2]+'\n'+'开:'+params[0].data[3]
+'\n'+'低:'+params[0].data[4]+'\n'+'收:'+params[0].data[1]+'\n'+'涨幅:'+params[0].data[5]+'%'
+'\n'+'低:'+params[0].data[4]+'\n'+'收:'+params[0].data[1]+'\n'+'涨幅:'+params[0].data[5]+'%'
+'\n'+'量:'+params[0].data[6]+'\n'+'金额:'+params[0].data[7]
return res;
},
},
@@ -148,7 +156,10 @@
},
xAxis: {
type:'category',
scale:true
scale:true,
axisLabel: {
customValues:['09:30','10:00','10:30','11:00','11:30','13:00','13:30','14:00','14:30','15:00',]
},
},
yAxis: {
show:false,
@@ -206,6 +217,9 @@
async init() {
// chart 图表实例不能存在data里
const chart = await this.$refs.chartRef.init(echarts);
// chart.on('click',function (params) {
// console.log(params)
// })
if(this.selectCategory==0)
{
//分时图
@@ -242,13 +256,23 @@
{
this.navTitle = res.data.basic_info.stock_name+'('+res.data.basic_info.stock_code+')'
let data = res.data.minute_chart_data
this.tradeData = res.data.latest_trade
let categoryData = []
let valueData = []
let open = data[0].open
for (let item of data) {
categoryData.push(item.time)
let rate = accMul(accDiv(accSub(item.close,open),open).toFixed(4),100)
valueData.push([item.time,item.close,item.high,item.open,item.low,rate])
let volume = item.volume
if (volume>10000) {
volume = (volume/10000).toFixed(0)+'万'
}
let amount = item.amount
if (amount>10000)
{
amount = (amount/10000).toFixed(0)+'万'
}
valueData.push([item.time,item.close,item.high,item.open,item.low,rate,volume,amount])
}
let min = open
let max = 0
@@ -288,7 +312,8 @@
this.option1.yAxis.max = intervalList[intervalList.length-1].toFixed(2)
this.option1.series.data = valueData
let markData = []
let time = res.data.event_info
let time = res.data.event_info.event_start_time.split('T')[1]
time = time.substring(0,5)
for (let item of intervalList) {
markData.push({
xAxis:time,
@@ -416,6 +441,14 @@
right: 0;
bottom: 0;
overflow-y: scroll;
.volumeAmountC {
padding: 20rpx;
font-size: 26rpx;
color: #333;
.volume {
margin-right: 20rpx;
}
}
.section
{
padding: 0 28rpx;
@@ -426,9 +459,7 @@
}
.des
{
padding: 0 0 30rpx;
margin: 0 25rpx;
border-bottom: solid 1rpx #E4E4E4;
line-height: 1.4rem;
font-size: 24rpx;
font-weight: 500;
@@ -438,6 +469,15 @@
color: #C00000;
}
}
.riskTips
{
margin: 20rpx 25rpx 0;
padding-bottom: 30rpx;
line-height: 1.4rem;
font-size: 20rpx;
color: #999;
border-bottom: solid 1rpx #E4E4E4;
}
.list
{
padding: 0 25rpx;