10.13 修改时间筛选逻辑,去掉分时图线上圆圈展示,修改K线图颜色

This commit is contained in:
尚政杰
2025-10-13 16:48:21 +08:00
parent bf2388c3ec
commit b53bb9715e
93 changed files with 736 additions and 352 deletions

View File

@@ -8,7 +8,7 @@
<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}}</view>
<view class="eventContent">{{eventDetails.event_desc}}<text class="ai">AI合成</text></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}}
@@ -36,7 +36,7 @@
<view class="price flex1">{{item.trade_data?item.trade_data.latest_price:''}}</view>
<view :class="'chg flex1 '+(getRateUpOrDown(item.trade_data?item.trade_data.change_pct:'')?'down':'up')">{{item.trade_data?item.trade_data.change_pct:''}}%</view>
</view>
<view class="content">{{item.relation_desc}}</view>
<view class="content">{{item.relation_desc}}<text class="ai">AI合成</text></view>
</view>
</view>
<view v-if="selectCategory==1" class="conceptList flexWrap">
@@ -275,29 +275,26 @@
confine: true
},
grid:{
left: '0%',
right: '0%',
left: '10%',
right: '6%',
top: '0%',
bottom: '20%',
},
xAxis: [
{
type: 'category',
data: [],
axisTick:{
show:false
},
axisLine:{
show:false
},
}
],
xAxis:{
type: 'category',
scale:true,
data: [],
// axisTick:{ show:false },
axisLine:{ show:false },
axisLabel:{ show:false }
},
yAxis: [
{
type: 'value',
show:false,
axisTick: { show: false },
scale:true
axisTick: { show:false },
scale:true,
axisLabel: { show:false },
splitLine: { show:false }
}
],
series: {
@@ -342,14 +339,29 @@
const chartDom = that.$refs['chartRef'+index][0]
chartDom.init(echarts).then(res=>{
let option = {...that.option}
let categoryData = []
let valueData = []
for (let item1 of item.minute_chart_data) {
categoryData.push(item1.time)
valueData.push(item1.close)
}
option.series.data = valueData
option.xAxis.data = categoryData
let time = that.eventDetails.event_start_time.split('T')[1]
let firstOpen = item.minute_chart_data[0].open
option.series.markLine.data = [{yAxis:firstOpen}]
// console.log(option.series.markLine.data)
option.series.markLine.data = [
{
xAxis:time,
lineStyle:
{
type:'solid',
width: 1,
color: '#ffd700'
},
},
{
yAxis:firstOpen,
}]
let lastClose = item.minute_chart_data.slice(-1)[0].close
if(lastClose>=firstOpen)
{
@@ -479,6 +491,8 @@
title:res.message,
icon:'none'
})
uni.$emit('editSuccess')
this.getEventRelatedStockData()
}).catch(error=>{
})
@@ -669,6 +683,10 @@
font-weight: 500;
color: #666;
line-height: 1.2rem;
.ai
{
color: #C00000;
}
}
.categoryList
{
@@ -751,6 +769,10 @@
font-size: 20rpx;
font-weight: 500;
color: #666;
.ai
{
color: #C00000;
}
}
}
}
@@ -989,6 +1011,10 @@
font-size: 24rpx;
font-weight: 500;
color: #666;
.ai
{
color: #C00000;
}
}
.increaseRateList
{
@@ -1402,6 +1428,10 @@
font-size: 24rpx;
font-weight: 500;
color: #666;
.ai
{
color: #C00000;
}
}
}
}

View File

@@ -45,7 +45,7 @@
<view class="item" @click="clickEventItem(item.id)" v-for="(item,index) in eventList" :key="index">
<view class="flex">
<view :class="'level '+item.importance">{{item.importance}}</view>
<view class="title">{{item.title}}</view>
<view class="title flex1">{{item.title}}</view>
</view>
<view :class="'content '+(item.isExpand?'':'retract')" @click.stop="clickExpandOrRetract(index)">{{item.description}}</view>
<scroll-view scroll-x class="increaseRateList">
@@ -69,7 +69,7 @@
</view>
</scroll-view>
<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)?'':'+')+sitem.daily_change}}%</text></view>
<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>
<view class="timeToolBarC flex">
<view class="time flex1">{{getLocaleTime(item.created_at)}}</view>
@@ -460,8 +460,7 @@
}).exec()
},
onPullDownRefresh() {
this.page = 1
this.getEventListData()
this.clickSearch()
},
methods: {
loadMoreData()
@@ -469,7 +468,11 @@
if(!this.loadAll)
{
this.page ++
this.getEventListData()
if(this.selectScreenCategory==0)
{
this.getEventListData()
}else
this.getHotEventListData()
}
},
async init() {
@@ -483,7 +486,11 @@
clickSearch()
{
this.page = 1
this.getEventListData()
if(this.selectTimeCategory==0)
{
this.getEventListData()
}else
this.getHotEventListData()
},
/**
* 点击事件筛选
@@ -649,21 +656,31 @@
{
if(this.startDate)
{
let date1 = new Date(this.startDate)
let date2 = new Date(item.date)
if(date1>date2)
{
this.endDate = this.startDate
this.endTimeStamp = this.startTimeStamp
if(this.endDate) {
//如果选过结束日期了
this.startDate = item.date
this.startTimeStamp = item.timestamp
this.endDate = null
this.endTimeStamp = null
}else
{
this.endDate = item.date
this.endTimeStamp = item.timestamp
let date1 = new Date(this.startDate)
let date2 = new Date(item.date)
if(date1>date2)
{
this.endDate = this.startDate
this.endTimeStamp = this.startTimeStamp
this.startDate = item.date
this.startTimeStamp = item.timestamp
}else
{
this.endDate = item.date
this.endTimeStamp = item.timestamp
}
}
}else
{
//如果没选过开始日期
this.startDate = item.date
this.startTimeStamp = item.timestamp
}
@@ -845,6 +862,7 @@
title:res.message,
icon:'none'
})
this.clickSearch()
}).catch(error=>{
})
@@ -854,6 +872,11 @@
*/
clickEventItem(id)
{
let that = this
uni.$on('editSuccess',res=>{
that.clickSearch()
uni.$off('editSuccess')
})
uni.navigateTo({
url:'/pages/index/eventDetails/eventDetails?id='+id
})
@@ -1328,6 +1351,7 @@
}
.title
{
// min-width: 0;
font-size: 30rpx;
font-weight: bold;
color: #222;
@@ -1392,7 +1416,11 @@
font-size: 30rpx;
font-weight: bold;
color: #222;
.change
.change.down
{
color: #355422;
}
.change.up
{
color: #F97316;
}

View File

@@ -13,7 +13,7 @@
<l-echart ref="chartRef"></l-echart>
</view>
<view class="section">关联描述</view>
<view class="des">{{relatedDesc}}</view>
<view class="des">{{relatedDesc}}<text class="ai">AI合成</text></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">
@@ -32,7 +32,7 @@
<script>
import { inject } from 'vue';
import { stockCandlestickChartData, stockDetails } from '@/request/api';
import { getLocalDate } from '@/utils/util.js';
import { accDiv, accMul, accSub, getLocalDate } from '@/utils/util.js';
const echarts = require('../../../uni_modules/lime-echart/static/echarts.min.js');
export default {
@@ -47,115 +47,135 @@
categoryList:['分时图','日K线'],
selectCategory:0,
option:{
title: {
show:false
},
tooltip: {
position:function (pos, params, dom, rect, size) {
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
var obj = {top: '10%'};
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5;
return obj;
title: {
show:false
},
trigger: 'axis',
axisPointer: {
type: 'cross'
},
formatter: function (params) {
console.log(params)
let res = '日期:'+params[0].name+'\n'+'开盘价:'+params[0].data[1]+'\n'+'收盘价:'+params[0].data[2]+'\n'+'最低价:'+params[0].data[3]+'\n'+'最高价:'+params[0].data[4]
console.log(res)
return res; // 经过这么一加工,最终返回出去并渲染,最终就出现了我们所看的效果
tooltip: {
position:function (pos, params, dom, rect, size) {
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
var obj = {top: '10%'};
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5;
return obj;
},
trigger: 'axis',
axisPointer: {
type: 'cross'
},
formatter: function (params) {
console.log(params)
let res = '日期:'+params[0].name+'\n'+'开盘价:'+params[0].data[1]+'\n'+'收盘价:'+params[0].data[2]+'\n'+'最低价:'+params[0].data[3]+'\n'+'最高价:'+params[0].data[4]
return res; // 经过这么一加工,最终返回出去并渲染,最终就出现了我们所看的效果
},
},
},
legend: {
legend: {
show:false
},
grid: {
left: '10%',
right: '10%',
bottom: '15%'
},
xAxis: {
type: 'category',
data: [],
boundaryGap: false,
axisLine: { onZero: false },
splitLine: { show: false },
min: 'dataMin',
max: 'dataMax'
},
yAxis: {
scale: true,
splitArea: {
show: true
}
},
dataZoom: [
{
type: 'inside',
start: 50,
end: 100
},
{
show: true,
type: 'slider',
top: '90%',
start: 50,
end: 100
}
],
series: [
{
},
grid: {
top: '10%',
left: '10%',
right: '10%',
bottom:"15%"
},
xAxis: {
type: 'category',
data: [],
boundaryGap: false,
axisLine: { onZero: false },
splitLine: { show: false },
min: 'dataMin',
max: 'dataMax'
},
yAxis: {
scale: true,
splitArea: {
show: true
}
},
dataZoom: [
{
type: 'inside',
start: 50,
end: 100
},
{
show: true,
type: 'slider',
top: '90%',
start: 50,
end: 100
}
],
series: [
{
name: '日K',
type: 'candlestick',
data: [],
itemStyle: {
color: '#ec0000',
color0: '#8A0000',
borderColor: '#00da3c',
borderColor0: '#008F28'
},
}
]
color0: '#00da3c',
// borderColor: '#8A0000',
// borderColor0: '#008F28'
}
}],
},
option1:{
title: {
show:false
},
tooltip: {
trigger: 'axis'
position:function (pos, params, dom, rect, size) {
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
var obj = {top: '10%'};
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]+'%'
return res;
},
},
grid: {
left: '10%',
right: '12%',
top: '10%',
left: '12%',
right: '14%',
bottom: '10%'
},
xAxis: {
type:'category'
type:'category',
scale:true
},
yAxis: {
scale:true
show:false,
scale:true,
},
dataZoom: [
{
type: 'inside'
}
],
series: {
series:{
name: '分时图',
type: 'line',
symbol:'none',
markLine: {
silent: true,
symbol:['none','none'],
lineStyle: {
width: 2,
color: '#AAA'
},
data: []
silent: true,
symbol:['none','none'],
lineStyle: {
type:'solid',
width: 1,
color: '#dedede'
},
z:1
},
}
data: [],
},
animation:false
},
relatedDesc:'', //关联描述
sourceList:[], //来源列表
@@ -224,30 +244,84 @@
let data = res.data.minute_chart_data
let categoryData = []
let valueData = []
let open = data[0].open
for (let item of data) {
categoryData.push(item.time)
valueData.push(item.close)
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 min = open
let max = 0
for (let item of valueData) {
let value = item[1]
if(parseFloat(value)<min)
{
min = parseFloat(value)
}
if(parseFloat(value)>max)
{
max = parseFloat(value)
}
}
let minInterval = (open - min)/3
let maxInterval = (max - open)/3
let intervalList = []
if(minInterval>maxInterval)
{
for (var i = 3; i > 0; i--) {
intervalList.push(open-i*minInterval)
}
for (var i = 0; i < 4; i++) {
intervalList.push(open+i*minInterval)
}
}else
{
for (var i = 3; i > 0; i--) {
intervalList.push(open-i*maxInterval)
}
for (var i = 0; i < 4; i++) {
intervalList.push(open+i*maxInterval)
}
}
this.option1.xAxis.data = categoryData
this.option1.yAxis.min = intervalList[0].toFixed(2)
this.option1.yAxis.max = intervalList[intervalList.length-1].toFixed(2)
this.option1.series.data = valueData
this.option1.series.markLine.data = [{
yAxis:data[0].open,
label:{
show:true,
position:'start',
// formatter:'111',
color:'#333'
let markData = []
let time = res.data.event_info
for (let item of intervalList) {
markData.push({
xAxis:time,
lineStyle:{
type:'solid',
width: 1,
color: '#ffd700'
},
label:{
position:'middle',
formatter:'事件发生',
color: '#ffd700'
}
},
},
{
yAxis:data[0].open,
label:{
show:true,
position:'end',
formatter:'0.00%',
color:'#333'
{
yAxis:item,
label:{
show:true,
position:'start',
color:'#333'
},
},
}]
{
yAxis:item,
label:{
show:true,
position:'end',
formatter:accMul(accDiv(accSub(item,open),open).toFixed(4),100)+'%',
color:'#333'
},
})
}
this.option1.series.markLine.data = markData
let relatedDesc = res.data.related_desc
if(relatedDesc)
{
@@ -359,6 +433,10 @@
font-size: 24rpx;
font-weight: 500;
color: #666;
.ai
{
color: #C00000;
}
}
.list
{

View File

@@ -11,6 +11,7 @@
<view v-if="investDetails" class="contentC fixed" :style="'top:'+contentTop+'px;'">
<view v-if="selectCategory==0" class="former">
<ua-markdown :source="former" />
<text class="ai">AI合成</text>
</view>
<view v-if="selectCategory==1" class="former">
<ua-markdown :source="investDetails.forecast" />
@@ -36,7 +37,7 @@
</view>
</view>
</view>
<view v-if="selectCategory==4" class="">
<view v-if="selectCategory==4">
<view class="conceptList">
<view class="item relative" v-for="(item,index) in investDetails.extracted_concepts" :key="index" @click="clickConceptItem()">
<image class="cover" :src="item.first_image" mode="aspectFill"></image>
@@ -206,10 +207,17 @@
left: 0;
right: 0;
bottom: 0;
// margin-top: 10rpx;
// border-radius: 20rpx 20rpx 0 0;
overflow-y: scroll;
.former
{
padding: 40rpx 25rpx;
.ai
{
font-size: 28rpx;
color: #C00000;
}
}
.stockCategoryList
{