jwyu 2 years ago
parent
commit
7385ad9bc6
2 changed files with 32 additions and 15 deletions
  1. 8 0
      src/api/hzyb/chart.js
  2. 24 15
      src/views/hzyb/chart/Detail.vue

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

@@ -51,4 +51,12 @@ export const apiChartSave=params=>{
  */
 export const apiChartRefresh=params=>{
     return post('/my_chart/refreshChartInfo',params)
+}
+
+/**
+ * 小程序中我的图库中查看详情
+ * @param ChartInfoId
+ */
+export const apiMyChartDetail=params=>{
+    return get('/my_chart/detail',params)
 }

+ 24 - 15
src/views/hzyb/chart/Detail.vue

@@ -8,7 +8,7 @@ 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} from '@/api/hzyb/chart.js'
+import {apiChartInfo,apiChartList,apiChartSave,apiChartBeforeAndNext,apiChartRefresh,apiMyChartDetail} from '@/api/hzyb/chart.js'
 const router=useRouter()
 const route=useRoute()
 document.title='图表详情'
@@ -213,17 +213,25 @@ let noAuthData=ref(null)
 const getChartInfo=async (type)=>{
     // resData.value=null
     loading.value=true
-    const res=await apiChartInfo({
-        ChartInfoId:ChartInfoId,
-        DateType:dateType.value,
-        StartDate:startDate.value&&sameOptionType.value.includes(resData.value.ChartInfo.ChartType)?startDate.value:'',
-        EndDate:endDate.value&&sameOptionType.value.includes(resData.value.ChartInfo.ChartType)?endDate.value:'',
-        SeasonStartDate:startDate.value&&resData.value.ChartInfo.ChartType===2?startDate.value:'',
-        SeasonEndDate:endDate.value&&resData.value.ChartInfo.ChartType===2?endDate.value:'',
-        Calendar:calendarType.value,
-        Authorization:route.query.token,
-        MyChartClassifyId:Number(route.query.MyChartClassifyId)
-    })
+    let res=null
+    // 如果是从我的图库中来的
+    if(route.query.source=='ybxcx_my_chart'){
+        res=await apiMyChartDetail({
+            ChartInfoId:ChartInfoId,
+        })
+    }else{
+        res=await apiChartInfo({
+            ChartInfoId:ChartInfoId,
+            DateType:dateType.value,
+            StartDate:startDate.value&&sameOptionType.value.includes(resData.value.ChartInfo.ChartType)?startDate.value:'',
+            EndDate:endDate.value&&sameOptionType.value.includes(resData.value.ChartInfo.ChartType)?endDate.value:'',
+            SeasonStartDate:startDate.value&&resData.value.ChartInfo.ChartType===2?startDate.value:'',
+            SeasonEndDate:endDate.value&&resData.value.ChartInfo.ChartType===2?endDate.value:'',
+            Calendar:calendarType.value,
+            Authorization:route.query.token,
+            MyChartClassifyId:Number(route.query.MyChartClassifyId)
+        })
+    }
     loading.value=false
     if(res.code===200){
         resData.value=res.data
@@ -1386,7 +1394,7 @@ const posterParams=computed(()=>{
 <template>
     <div class="chart-detail" v-if="!loading&&!noauth">
         <div class="chart-title">{{resData.ChartInfo.ChartName}}</div>
-        <div class="top-box">
+        <div class="top-box" v-if="$route.query.source!=='ybxcx_my_chart'">
             <div class="flex calendar-box" style="float:left" @click="handleShowDate">
                 <img src="../../../assets/hzyb/chart/calendar.png" alt="">
                 <span class="date">{{startDate||'开始日期'}}</span>
@@ -1410,7 +1418,7 @@ const posterParams=computed(()=>{
         </div>
 
         <chartBox :options='chartData' v-if="!loading"></chartBox>
-        
+        <template v-if="$route.query.source!=='ybxcx_my_chart'">
         <div class="flex source-box">
             <div :style="{flex:resData&&resData.ChartInfo.ChartType===2?1:2}"><span v-if="resData&&resData.ChartInfo.ChartType!==2">来源:{{resData&&resData.ChartInfo.ChartSource}}</span></div>
             <div class="season-change-box" style="flex:1" v-if="resData&&resData.ChartInfo.ChartType===2">
@@ -1449,10 +1457,11 @@ const posterParams=computed(()=>{
                 </li>
             </ul>   
         </div>
+        </template>
 
         <!-- 上一张下一张图切换 -->
         <div 
-            v-if="$route.query.from!='share'"
+            v-if="$route.query.from!='share'&&$route.query.source!=='ybxcx_my_chart'"
             class="change-page-wrap" 
             :style="{left:pageBoxPosition.left+'px',top:pageBoxPosition.top+'px'}"
             @touchmove.stop="pageTouchmove"