|
@@ -5,7 +5,7 @@ import chartBox from '../chart/component/chartBox.vue'
|
|
|
import {
|
|
|
apiGetbaseEdbInfo,apiGetpredictEdbInfo,apiGetCalendarEventList
|
|
|
} from '@/api/hzyb/forexCalendar.js'
|
|
|
-import {setSplineOpt} from '../hooks/chartBase'
|
|
|
+import {setSplineOpt,setOptions} from '../hooks/chartBase'
|
|
|
/**
|
|
|
* 外汇日历详情
|
|
|
传入参数:
|
|
@@ -25,7 +25,9 @@ let chartData=ref({
|
|
|
yAxis:[],
|
|
|
|
|
|
})// 图表配置数据
|
|
|
-let resData=ref(null)//接口详情数据
|
|
|
+let resData=ref({
|
|
|
+ EdbInfo:{}
|
|
|
+})//接口详情数据
|
|
|
let pageBoxPosition=reactive({
|
|
|
top:window.innerHeight-165,
|
|
|
left:window.innerWidth-50,
|
|
@@ -33,15 +35,6 @@ let pageBoxPosition=reactive({
|
|
|
temLeft:0,
|
|
|
})
|
|
|
localStorage.setItem('hzyb-token',route.query.token)
|
|
|
-/* async function testChart(){
|
|
|
- const res=await apiMyChartDetail({
|
|
|
- ChartInfoId:'178',
|
|
|
- })
|
|
|
- resData.value=res.data
|
|
|
- chartData.value = setSplineOpt(res.data.EdbInfoList,resData)
|
|
|
-}
|
|
|
-testChart()
|
|
|
- */
|
|
|
function pageChange(){}
|
|
|
const pageTouchmove=(e)=>{
|
|
|
const touchObj=e.touches[0]
|
|
@@ -86,50 +79,59 @@ async function getEdbList(){
|
|
|
})
|
|
|
EdbList.value = events
|
|
|
currentEdbId.value = Number(edbInfoId)
|
|
|
- const eventIndex = events.findIndex(e=>e.edb_info_id===Number(edbInfoId))
|
|
|
+ const eventIndex = events.findIndex(e=>e.edbInfoId===Number(edbInfoId))
|
|
|
currentEdbIndex.value = eventIndex>=0?eventIndex:0
|
|
|
getEdbDetail()
|
|
|
})
|
|
|
}
|
|
|
getEdbList()
|
|
|
|
|
|
+function capitalizeFirstLetter(obj) {
|
|
|
+ return Object.keys(obj).reduce((acc, key) => {
|
|
|
+ const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
|
+ acc[capitalizedKey] = obj[key];
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+}
|
|
|
async function getEdbDetail(){
|
|
|
const res = EdbList.value[currentEdbIndex.value].matterType===2
|
|
|
?await apiGetbaseEdbInfo({edb_info_id:currentEdbId.value})
|
|
|
:await apiGetpredictEdbInfo({edb_info_id:currentEdbId.value})
|
|
|
resData.value=res.data
|
|
|
+ //由于EdbInfo大小写命名和后台不一致,重新整一份
|
|
|
+ const EdbInfo = capitalizeFirstLetter(res.data.EdbInfo)
|
|
|
const edbData = {
|
|
|
DataList:res.data.DataList||[],
|
|
|
EdbInfo:{
|
|
|
- ...res.data.EdbInfo,
|
|
|
+ ...EdbInfo,
|
|
|
ChartColor:'',
|
|
|
ChartStyle:'',
|
|
|
+ PredictChartColor:'',
|
|
|
ChartType:0,
|
|
|
- ChartWidth:0,
|
|
|
+ ChartWidth:3,
|
|
|
MaxData:res.data.EdbInfo.maxValue,
|
|
|
MinData:res.data.EdbInfo.minValue,
|
|
|
EdbInfoCategoryType:1,
|
|
|
- EdbInfoType:1,
|
|
|
- EdbName:res.data.EdbInfo.edbName,
|
|
|
- IsAxis:1
|
|
|
+ EdbInfoType:0,
|
|
|
+ IsAxis:1,
|
|
|
}
|
|
|
}
|
|
|
- chartData.value = setSplineOpt(
|
|
|
- [
|
|
|
- {
|
|
|
- ...edbData.EdbInfo,
|
|
|
- DataList:edbData.DataList
|
|
|
- }
|
|
|
- ],
|
|
|
- {value:{ChartInfo:{ChartType:1}}}
|
|
|
- )
|
|
|
+
|
|
|
+ chartData.value = EdbList.value[currentEdbIndex.value].matterType===2
|
|
|
+ ? setOptions(res.data.DataList||[],EdbInfo)
|
|
|
+ : setSplineOpt([{
|
|
|
+ ...edbData.EdbInfo,
|
|
|
+ DataList:res.data.DataList||[]
|
|
|
+ }],
|
|
|
+ {value:{ChartInfo:{ChartType:1}}}
|
|
|
+ )
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="edb-detail-wrap">
|
|
|
<div class="edb-title">{{resData.EdbInfo.edbName}}</div>
|
|
|
- <chartBox :options='chartData' :chartInfo="{ChartType:1}" v-if="!loading"></chartBox>
|
|
|
+ <chartBox :options='chartData' :chartInfo="{ChartType:1}" :showTitle="false"></chartBox>
|
|
|
<!-- 上一张下一张图切换 -->
|
|
|
<div
|
|
|
class="change-page-wrap"
|