|
@@ -0,0 +1,217 @@
|
|
|
+<script setup>
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+import apiReport from '@/api/modules/report'
|
|
|
+import apiCommon from '@/api/modules/common'
|
|
|
+import { Message } from 'tdesign-mobile-vue';
|
|
|
+
|
|
|
+const route = useRoute()
|
|
|
+let chartId=route.query.chartId
|
|
|
+
|
|
|
+
|
|
|
+// 获取配置
|
|
|
+const chartBaseUrl = ref('')
|
|
|
+function getSystemConfig() {
|
|
|
+ apiCommon.systemConfig({config:'ChartLibUrlPrefix'}).then(res => {
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ const ConfVal = res.data.Value || ''
|
|
|
+ chartBaseUrl.value = ConfVal
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+getSystemConfig()
|
|
|
+
|
|
|
+const chartInfo = ref({
|
|
|
+ UniqueCode: route.query.UniqueCode,
|
|
|
+ ChartName: route.query.ChartName,
|
|
|
+ IsCollect: true,
|
|
|
+ chartId: route.query.chartId
|
|
|
+})
|
|
|
+
|
|
|
+function getChartDetail(obj) {
|
|
|
+ const {chartInfoId, chartName, uniqueCode} = obj
|
|
|
+ chartInfo.value = {
|
|
|
+ chartId: chartInfoId,
|
|
|
+ ChartName: chartName,
|
|
|
+ UniqueCode: uniqueCode,
|
|
|
+ IsCollect: true
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+async function handleCollect() {
|
|
|
+ const data = {
|
|
|
+ sourceType: 'chart',
|
|
|
+ sourceId: Number(chartInfo.value.chartId)
|
|
|
+ }
|
|
|
+ const res = chartInfo.value.IsCollect ? await apiReport.reportCollectCancel(data) : await apiReport.reportCollect(data)
|
|
|
+ if(res.Ret===200){
|
|
|
+ Message.success(chartInfo.value.IsCollect?'取消收藏成功':'收藏成功')
|
|
|
+ chartInfo.value.IsCollect=!chartInfo.value.IsCollect
|
|
|
+ // 通知更新收藏列表
|
|
|
+ wx.miniProgram.postMessage({
|
|
|
+ data: 'refreshCollectList'
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const chartRenderUrl = computed(() => {
|
|
|
+ return `${chartBaseUrl.value}/chart/previewHT?code=${chartInfo.value.UniqueCode}&token=${route.query.token}`
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+// 获取图列表切换用
|
|
|
+let changeChartList=ref([])
|
|
|
+async function getChangeChartList(){
|
|
|
+ // if(route.query.fromPage!=='myCollect') return
|
|
|
+ let res=await apiReport.myChartLocate({
|
|
|
+ key: route.query.searchKey,
|
|
|
+ })
|
|
|
+ if(res.Ret===200){
|
|
|
+ changeChartList.value=res.data||[]
|
|
|
+ }
|
|
|
+}
|
|
|
+getChangeChartList()
|
|
|
+
|
|
|
+// 切换上一张下一张
|
|
|
+function handleChangeChart(type){
|
|
|
+ const index=changeChartList.value.findIndex(e=>e.chartInfoId==chartInfo.value.chartId)
|
|
|
+ if(type==='pre'){
|
|
|
+ if(index<1) return Message.warning('当前已是第一张')
|
|
|
+ const obj=changeChartList.value[index-1]
|
|
|
+ getChartDetail(obj)
|
|
|
+ }else{
|
|
|
+ if(index===changeChartList.value.length-1) return Message.warning('当前已是最后一张')
|
|
|
+ const obj=changeChartList.value[index+1]
|
|
|
+ getChartDetail(obj)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const isShowMZSM = ref(false)
|
|
|
+
|
|
|
+
|
|
|
+</script>
|
|
|
+<template>
|
|
|
+ <div class="chart-detail-page" v-if="chartInfo">
|
|
|
+ <div class="chart-title">{{chartInfo.ChartName}}</div>
|
|
|
+ <div class="collect-icon" @click="handleCollect" >{{chartInfo.IsCollect?'取消收藏':'收藏'}}</div>
|
|
|
+ <!-- <div class="mz-tips" @click="isShowMZSM = true">免责声明</div> -->
|
|
|
+ <!-- 图表渲染盒子 -->
|
|
|
+ <div class="chart-render-wrap">
|
|
|
+ <iframe :src="chartRenderUrl"></iframe>
|
|
|
+ </div>
|
|
|
+ <div v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).text"><span>来源:{{chartInfo.SourcesFrom?JSON.parse(chartInfo.SourcesFrom).text:''}}</span></div>
|
|
|
+
|
|
|
+ <div class="change-btns-box" v-if="changeChartList.length>1">
|
|
|
+ <div class="btn bottom" @click="handleChangeChart('pre')">
|
|
|
+ <div class="triangle-left"></div>
|
|
|
+ <div>上一张</div>
|
|
|
+ </div>
|
|
|
+ <div class="btn" @click="handleChangeChart('next')">
|
|
|
+ <div class="triangle-right"></div>
|
|
|
+ <div>下一张</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 收藏 -->
|
|
|
+ <!-- <svg-icon @click="handleCollect" class="collect-icon" :name="chartInfo.IsCollect?'collected':'collect'" /> -->
|
|
|
+ </div>
|
|
|
+ <!-- 免责声明 -->
|
|
|
+ <disclaimers-wrap v-model:show="isShowMZSM" />
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.chart-detail-page {
|
|
|
+ background-color: #fff;
|
|
|
+ padding: var(--page-padding);
|
|
|
+ min-height: 100vh;
|
|
|
+ .chart-title {
|
|
|
+ font-size: 36px;
|
|
|
+ line-height: 44px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+ .mz-tips {
|
|
|
+ text-align: right;
|
|
|
+ color: var(--primary-color);
|
|
|
+ font-size: var(--font-size-small);
|
|
|
+ }
|
|
|
+ .chart-render-wrap {
|
|
|
+ margin-top: 50px;
|
|
|
+ height: 850px;
|
|
|
+ margin-bottom: 40px;
|
|
|
+ iframe {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .change-btns-box {
|
|
|
+ position: fixed;
|
|
|
+ z-index: 99;
|
|
|
+ right: 34px;
|
|
|
+ bottom: 150px;
|
|
|
+ .btn {
|
|
|
+ width: 100%;
|
|
|
+ height: 120px;
|
|
|
+ background-color: #f3f5f9;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column; /* 垂直方向排列子元素 */
|
|
|
+ justify-content: center; /* 水平居中(对于列布局,这将使整列居中) */
|
|
|
+ .triangle-left {
|
|
|
+ margin: 0 auto;
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border-top: 20px solid transparent;
|
|
|
+ border-right: 40px solid #fff;
|
|
|
+ border-bottom: 20px solid transparent;
|
|
|
+ border-left: none;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ .triangle-right {
|
|
|
+ margin: 0 auto;
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border-top: 20px solid transparent;
|
|
|
+ border-left: 40px solid #fff;
|
|
|
+ border-bottom: 20px solid transparent;
|
|
|
+ border-right: none;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bottom {
|
|
|
+ border-bottom: #666666 1px solid;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.collect-icon {
|
|
|
+ color: #666666;
|
|
|
+}
|
|
|
+
|
|
|
+@media (min-width: 600px) {
|
|
|
+ .chart-detail-page {
|
|
|
+ min-height: 100vh;
|
|
|
+ .chart-title {
|
|
|
+ font-size: 18px;
|
|
|
+ line-height: 22px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ .chart-render-wrap {
|
|
|
+ margin-top: 25px;
|
|
|
+ height: 400px;
|
|
|
+ }
|
|
|
+ .change-btns-box{
|
|
|
+ bottom: 35px;
|
|
|
+ justify-content: center;
|
|
|
+ gap: 0 10px;
|
|
|
+ .btn{
|
|
|
+ max-width: 200px;
|
|
|
+ height: 34px;
|
|
|
+ border-radius: 34px;
|
|
|
+ line-height: 34px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .collect-icon{
|
|
|
+ color: #666666;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|