Ver código fonte

研报图表详情图表被删除时页面展示

jwyu 2 anos atrás
pai
commit
362e0c1285

+ 2 - 2
src/api/hzyb/http.js

@@ -63,10 +63,10 @@ _axios.interceptors.response.use(
       data=response.data
     }
     // console.log(data);
-    if(![200,403].includes(data.code)){
+    if(![200,403,4003].includes(data.code)){
       setTimeout(() => {
         Toast(data.msg)
-      }, 10);
+      }, 100);
     }
     return data;
   },

+ 14 - 3
src/views/hzyb/chart/Detail.vue

@@ -208,6 +208,7 @@ const chartItemStyleArr = ref([
     { label: '散点图', key: 5 ,value: 'scatter'}
 ])//组合图配置时可选类型
 
+let nodata=ref(false)
 let noauth=ref(false)
 let noAuthData=ref(null)
 // 如果type:init 则是初始化获取数据 
@@ -286,6 +287,8 @@ const getChartInfo=async (type)=>{
     }else if(res.code==403){
         noauth.value=true
         noAuthData.value=res.data
+    }else if(res.code===4003){//图表不存在
+        nodata.value=true
     }
 }
 getChartInfo('init')
@@ -1509,7 +1512,7 @@ const posterParams=computed(()=>{
 </script>
 
 <template>
-    <div class="chart-detail" v-if="!loading&&!noauth">
+    <div class="chart-detail" v-if="!loading&&!noauth&&!nodata">
         <div class="chart-title">{{resData.ChartInfo.ChartName}}</div>
         <div class="top-box" v-if="$route.query.source!=='ybxcx_my_chart'">
             <div class="flex calendar-box" style="float:left" @click="handleShowDate" v-if="resData.ChartInfo.ChartType !== 7">
@@ -1662,8 +1665,16 @@ const posterParams=computed(()=>{
         </Popup>
     </div>
     <!-- 无权限 -->
-    <noAuth v-if="noauth" :data="noAuthData"></noAuth>
-
+    <noAuth v-if="noauth&&!nodata" :data="noAuthData"></noAuth>
+    <!-- 图表不存在 -->
+    <div class="chart-nodata" v-if="nodata">
+        <p style="text-align:center;padding-top:200px;font-size:16px">该图表已被删除!</p>
+        <collectBox 
+            v-if="$route.query.source=='ybxcx_my_chart'"
+            :code="$route.query.chartCode"
+            :isNodata="true"
+        />
+    </div>
 </template>
 
 <style lang="scss" scoped>

+ 13 - 2
src/views/hzyb/chart/component/collectBox.vue

@@ -9,7 +9,11 @@ const route=useRoute()
 
 const props = defineProps({
   code: String,
-  myChartInfo:Object
+  myChartInfo:Object,
+  isNodata:{
+      type:Boolean,
+      default:false
+  }
 })
 
 watch(
@@ -156,7 +160,14 @@ window.addEventListener('message',e=>{
 </script>
 
 <template>
-    <div class="collect-box">
+    <div v-if="props.isNodata" style="text-align:center">
+        <span 
+            @click="handleCollectStatusChange"
+            v-if="isCollect"
+            style="font-size:14px;display:inline-block;background:#E3B377;color:#fff;margin-top:20px;padding:8px 14px;border-radius:4px;line-height:1"
+        >取消收藏</span>
+    </div>
+    <div class="collect-box" v-else>
         <span 
             @click="handleCollectStatusChange"
             :style="{color:isCollect?'#999999':'#E3B377'}"