|
@@ -0,0 +1,205 @@
|
|
|
+<script setup>
|
|
|
+import {ref} from 'vue'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
+import moment from 'moment'
|
|
|
+import { useStore } from 'vuex';
|
|
|
+
|
|
|
+const route=useRoute()
|
|
|
+const router=useRouter()
|
|
|
+const store=useStore()
|
|
|
+
|
|
|
+const selectDate=ref('')//选择的日期
|
|
|
+// 周六日禁用
|
|
|
+function disabledDate(t){
|
|
|
+ if([5,6].includes(moment(t).weekday())){
|
|
|
+ return true
|
|
|
+ }else{
|
|
|
+ return false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+let url=ref('')
|
|
|
+function init(){
|
|
|
+ const queryObj={
|
|
|
+ classify_name:route.query.classify_name,
|
|
|
+ classify_type:route.query.classify_type,
|
|
|
+ exchange:route.query.exchange,
|
|
|
+ token:localStorage.getItem('token'),
|
|
|
+ timestamp:new Date().getTime(),//防止缓存
|
|
|
+ }
|
|
|
+ let queryObjStr=''
|
|
|
+ for (const key in queryObj) {
|
|
|
+ if(!queryObjStr){
|
|
|
+ queryObjStr=`${key}=${queryObj[key]}`
|
|
|
+ }else{
|
|
|
+ queryObjStr=`${queryObjStr}&${key}=${queryObj[key]}`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('拼接字符串:',queryObjStr);
|
|
|
+ url.value=`${import.meta.env.MODE==='production'?'https://details.hzinsights.com':'http://192.168.77.19:3000/xcx_h5'}/hzyb/chart/positionanalysis?${queryObjStr}`
|
|
|
+}
|
|
|
+init()
|
|
|
+
|
|
|
+window.addEventListener('message',(e)=>{
|
|
|
+ // 监听iframe高度
|
|
|
+ if(e.data?.opt=="updateIframeHeight"){
|
|
|
+ console.log(e.data.height);
|
|
|
+ const iframeEl=document.getElementById('iframe')
|
|
|
+ iframeEl.style.height=e.data.height+100+'px'
|
|
|
+ }
|
|
|
+ // 监听iframe重新获取数据时的参数
|
|
|
+ if(e.data?.opt=="updateInfo"){
|
|
|
+ selectDate.value=e.data.data_time
|
|
|
+ router.replace({
|
|
|
+ query:{
|
|
|
+ exchange:e.data.exchange,
|
|
|
+ classify_name:e.data.classify_name,
|
|
|
+ classify_type:e.data.classify_type
|
|
|
+ }
|
|
|
+ })
|
|
|
+ store.commit('modifyBreadCrumb',e.data.title)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// 操作选项
|
|
|
+function handleOpt(type){
|
|
|
+ let obj={}
|
|
|
+ if(type==='date'){
|
|
|
+ obj={
|
|
|
+ opt:type,
|
|
|
+ val:selectDate.value
|
|
|
+ }
|
|
|
+ }else if(type==='beforeDate'){
|
|
|
+ obj={
|
|
|
+ opt:type
|
|
|
+ }
|
|
|
+ }else if(type==='nextDate'){
|
|
|
+ obj={
|
|
|
+ opt:type
|
|
|
+ }
|
|
|
+ }else if(type==='beforeClassifyType'){
|
|
|
+ obj={
|
|
|
+ opt:type
|
|
|
+ }
|
|
|
+ }else if(type==='nextClassifyType'){
|
|
|
+ obj={
|
|
|
+ opt:type
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const target=document.getElementById('iframe')
|
|
|
+ target.contentWindow.postMessage(obj,"*")
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="hasrightaside-box position-analysis-detail-page">
|
|
|
+ <div class="content-box detail-content">
|
|
|
+ <iframe id='iframe' :src="url"></iframe>
|
|
|
+ </div>
|
|
|
+ <div class="right-aside-box right-wrap">
|
|
|
+ <div class="fix-top">
|
|
|
+ <div class="backlist-box" @click="$router.back()">返回持仓列表</div>
|
|
|
+ <div class="item-box">
|
|
|
+ <div class="lable">日期选择</div>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="selectDate"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择日期"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ :disabled-date="disabledDate"
|
|
|
+ @change="handleOpt('date')"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item-box">
|
|
|
+ <div class="lable">切换合约</div>
|
|
|
+ <div class="btn" @click="handleOpt('beforeClassifyType')">上一个合约</div>
|
|
|
+ <div class="btn" @click="handleOpt('nextClassifyType')">下一个合约</div>
|
|
|
+ </div>
|
|
|
+ <div class="item-box">
|
|
|
+ <div class="lable">切换日期</div>
|
|
|
+ <div class="btn" @click="handleOpt('beforeDate')">查看前一天</div>
|
|
|
+ <div class="btn" @click="handleOpt('nextDate')">查看后一天</div>
|
|
|
+ </div>
|
|
|
+ <div class="item-box">
|
|
|
+ <div class="lable">操作指南</div>
|
|
|
+ <div style="color:#666;font-size: 14px;line-height: 24px;">上下滑动图表,点击图表中柱体弹出详细信息。</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .el-date-editor--date{
|
|
|
+ width: 180px !important;
|
|
|
+ .el-input__wrapper{
|
|
|
+ background: #F6F6F6;
|
|
|
+ border: 1px solid #EBEBEB;
|
|
|
+ border-radius: 20px;
|
|
|
+ height: 40px;
|
|
|
+ box-shadow: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.position-analysis-detail-page{
|
|
|
+ min-height: calc(100vh - 410px);
|
|
|
+
|
|
|
+ .detail-content{
|
|
|
+ #iframe{
|
|
|
+ width: 100%;
|
|
|
+ min-height: 800px;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right-wrap{
|
|
|
+ .backlist-box{
|
|
|
+ color: #999999;
|
|
|
+ cursor: pointer;
|
|
|
+ vertical-align: middle;
|
|
|
+ &::before{
|
|
|
+ content: '';
|
|
|
+ display: inline-block;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ background-image: url('@/assets/icon-back2.png');
|
|
|
+ background-size: cover;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .item-box{
|
|
|
+ margin-top: 40px;
|
|
|
+ .lable{
|
|
|
+ font-size: 18px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &::before{
|
|
|
+ content: '';
|
|
|
+ display: inline-block;
|
|
|
+ width: 3px;
|
|
|
+ height: 20px;
|
|
|
+ background-color: #F3A52F;
|
|
|
+ border-radius: 2px;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .btn{
|
|
|
+ width: 140px;
|
|
|
+ height: 40px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border: 1px solid #F3A52F;
|
|
|
+ border-radius: 20px;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 40px;
|
|
|
+ color: #F3A52F;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|