Browse Source

Merge branch 'xqc_587'

jwyu 1 year ago
parent
commit
50ef085da2
2 changed files with 107 additions and 1 deletions
  1. 8 0
      src/api/hzyb/chart.js
  2. 99 1
      src/views/hzyb/chart/Detail.vue

+ 8 - 0
src/api/hzyb/chart.js

@@ -147,4 +147,12 @@ export const apiCommonChartSave = params => {
  */
  export const apiRelevanceChartRefresh = params => {
     return post('/my_chart/correlation/refreshChartInfo',params)
+}
+
+/**
+ * 获取我的图库中切换上一张下一张的数据
+ * @param classify_id
+ */
+export const apiMyChartChangeChartList=params=>{
+    return get('/my_chart/locate',params)
 }

+ 99 - 1
src/views/hzyb/chart/Detail.vue

@@ -9,7 +9,19 @@ import {useRoute, useRouter,onBeforeRouteUpdate} from 'vue-router'
 import moment from 'moment'
 import _ from 'lodash';
 import Highcharts from 'highcharts/highstock';
-import {apiChartInfo,apiChartList,apiChartSave,apiChartBeforeAndNext,apiChartRefresh,apiMyChartDetail,apiCommonChartDetail,apiCommonChartRefresh,apiCommonChartSave,apiRelevanceChartRefresh} from '@/api/hzyb/chart.js'
+import {
+    apiChartInfo,
+    apiChartList,
+    apiChartSave,
+    apiChartBeforeAndNext,
+    apiChartRefresh,
+    apiMyChartDetail,
+    apiCommonChartDetail,
+    apiCommonChartRefresh,
+    apiCommonChartSave,
+    apiRelevanceChartRefresh,
+    apiMyChartChangeChartList
+} from '@/api/hzyb/chart.js'
 const router=useRouter()
 const route=useRoute()
 document.title='图表详情'
@@ -243,6 +255,7 @@ const getChartInfo=async (type)=>{
     }
     loading.value=false
     if(res.code===200){
+        nodata.value=false
         resData.value=res.data
         // document.title=res.data.ChartInfo.ChartName
         
@@ -301,6 +314,7 @@ const getChartInfo=async (type)=>{
         noauth.value=true
         noAuthData.value=res.data
     }else if(res.code===4003){//图表不存在
+        console.log('图表不存在');
         nodata.value=true
     }
 }
@@ -2117,6 +2131,51 @@ const posterParams=computed(()=>{
 const sourceColl = ref(false)
 
 
+// 获取我的图库中切换上一张下一张的数据
+let myChartPageChangeList=ref([])
+let myChartCurIndex=-1
+const getMychartPageChangeData=async ()=>{
+    const res=await apiMyChartChangeChartList({classify_id:route.query.classifyId?Number(route.query.classifyId):''})
+    if(res.code===200){
+        const arr=res.data||[]
+        myChartPageChangeList.value=arr
+        // 从列表来的
+        if(!route.query.classifyId){
+            myChartCurIndex=arr.findIndex(e=>e.chart_info_id==route.query.ChartInfoId)
+        }else{
+            myChartCurIndex=arr.findIndex(e=>e.my_chart_classify_id==route.query.classifyId&&e.chart_info_id==route.query.ChartInfoId)
+        }
+        
+    }
+}
+if(route.query.source==='ybxcx_my_chart'){
+    getMychartPageChangeData()
+}
+const myChartPageChange=(type)=>{
+    console.log(myChartCurIndex);
+    if(myChartCurIndex==-1) return
+    if(type==='before'){
+        if(myChartCurIndex==0){
+            Toast('当前已是第一张')
+        }else{
+            myChartCurIndex--
+            ChartInfoId=myChartPageChangeList.value[myChartCurIndex].chart_info_id
+            chartSource=myChartPageChangeList.value[myChartCurIndex].chart_info_source
+            console.log(ChartInfoId);
+            getChartInfo('init')
+        }
+    }else{
+        if(myChartCurIndex==myChartPageChangeList.value.length-1){
+            Toast('当前已是最后一张')
+        }else{
+            myChartCurIndex++
+            ChartInfoId=myChartPageChangeList.value[myChartCurIndex].chart_info_id
+            chartSource=myChartPageChangeList.value[myChartCurIndex].chart_info_source
+            getChartInfo('init')
+        }
+    }
+}
+
 </script>
 
 <template>
@@ -2223,6 +2282,18 @@ const sourceColl = ref(false)
             <div class="bot" @click.stop="pageChange('next')"></div>
         </div>
 
+        <!-- 我的图库进入的详情上一张下一张切换 -->
+        <div 
+            v-if="$route.query.source==='ybxcx_my_chart'"
+            class="change-page-wrap" 
+            :style="{left:pageBoxPosition.left+'px',top:pageBoxPosition.top+'px'}"
+            @touchmove.stop="pageTouchmove"
+            @touchstart.stop="pageTouchStart"
+        >
+            <div class="top" @click.stop="myChartPageChange('before')"></div>
+            <div class="bot" @click.stop="myChartPageChange('next')"></div>
+        </div>
+
         <!-- 日期选择 -->
         <Popup
             v-model:show="showDate"
@@ -2295,6 +2366,17 @@ const sourceColl = ref(false)
             :code="$route.query.chartCode"
             :isNodata="true"
         />
+        <!-- 我的图库进入的详情上一张下一张切换 -->
+        <div 
+            v-if="$route.query.source==='ybxcx_my_chart'"
+            class="change-page-wrap" 
+            :style="{left:pageBoxPosition.left+'px',top:pageBoxPosition.top+'px'}"
+            @touchmove.stop="pageTouchmove"
+            @touchstart.stop="pageTouchStart"
+        >
+            <div class="top" @click.stop="myChartPageChange('before')"></div>
+            <div class="bot" @click.stop="myChartPageChange('next')"></div>
+        </div>
     </div>
 </template>
 
@@ -2305,6 +2387,22 @@ const sourceColl = ref(false)
         font-size: 16px;
     }
 }
+.chart-nodata{
+    .change-page-wrap{
+        position: fixed;
+        right: 0;
+        bottom: 50px;
+        width: 50PX;
+        height: 115PX;
+        background-image: url('../../../assets/hzyb/chart/before-next.png');
+        background-size: cover;
+        z-index: 10;
+        .top,.bot{
+            height: 50%;
+        }
+
+    }
+}
 .chart-detail{
     .flex{
         display: flex;