jwyu 10 mēneši atpakaļ
vecāks
revīzija
701b03f1cd

+ 1 - 1
.env.test

@@ -1,5 +1,5 @@
 # 接口地址
-VITE_APP_API_URL="/api"
+VITE_APP_API_URL="http://8.136.199.33:8709/api"
 # 路由根地址
 VITE_APP_BASE_URL="/"
 # 打包输入文件名

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

@@ -4,5 +4,13 @@ export default{
   // 获取图表详情
   getChartDetail:params=>{
     return get('/chart/detail',params)
+  },
+  // 收藏图表
+  chartCollect:params=>{
+    return post('/mychart/collect',params)
+  },
+  // 取消收藏图表
+  chartCollectCancel:params=>{
+    return post('/mychart/collectCancel',params)
   }
 }

+ 9 - 0
src/api/modules/common.js

@@ -0,0 +1,9 @@
+import {get,post} from '@/api/index'
+
+export default{
+  // 系统配置
+  systemConfig:()=>{
+    return get('/system/config',{})
+  }
+  
+}

+ 8 - 0
src/api/modules/report.js

@@ -8,5 +8,13 @@ export default{
   //报告阅读埋点记录
   addReportReadRecord:params=>{
     return post('/user/addReportRecord',params)
+  },
+  // 收藏报告
+  reportCollect:params=>{
+    return post('/myreport/collect',params)
+  },
+  // 取消收藏报告
+  reportCollectCancel:params=>{
+    return post('/myreport/collectCancel',params)
   }
 }

+ 9 - 1
src/styles/common.scss

@@ -3,7 +3,7 @@ html,body,#app{
   font-size: var(--font-size);
   color: var(--text-color);
   width: 100%;
-  background-color: var(--bg-color);
+  background-color: var(--bg-grey-color);
 }
 
 div{
@@ -11,4 +11,12 @@ div{
 }
 .flex{
   display: flex;
+}
+
+
+@media (min-width: 600px) {
+  html,body,#app{
+    max-width: 1080px;
+    margin: 0 auto;
+  }
 }

+ 75 - 21
src/views/chart/Detail.vue

@@ -1,24 +1,45 @@
 <script setup>
-import {useRoute} from 'vue-router'
+import { useRoute } from 'vue-router'
 import apiChart from '@/api/modules/chart'
+import apiCommon from '@/api/modules/common'
 
-const route=useRoute()
+const route = useRoute()
 
-const chartInfo=ref(null)
-function getChartDetail(){
-  apiChart.getChartDetail({}).then(res=>{
-    if(res.Ret===200){
-      chartInfo.value=res.Data
+// 获取配置
+const chartBaseUrl = ref('')
+function getSystemConfig() {
+  apiCommon.systemConfig().then(res => {
+    if (res.Ret === 200) {
+      const arr = res.Data || []
+      arr.forEach(item => {
+        if (item.ConfKey === 'ChartViewUrl') {
+          chartBaseUrl.value = item.ConfVal
+        }
+      });
+    }
+  })
+}
+getSystemConfig()
+
+const chartInfo = ref(null)
+function getChartDetail() {
+  apiChart.getChartDetail({}).then(res => {
+    if (res.Ret === 200) {
+      chartInfo.value = res.Data
     }
   })
 }
 // getChartDetail()
 
-function handleCollect(){
+function handleCollect() {
 
 }
 
-const isShowMZSM=ref(false)
+const chartRenderUrl = computed(() => {
+  return `${chartBaseUrl.value}/chart/preview?code=&source=etamini&token=${route.query.token}`
+})
+
+const isShowMZSM = ref(false)
 </script>
 <template>
   <div class="chart-detail-page">
@@ -26,7 +47,7 @@ const isShowMZSM=ref(false)
     <div class="mz-tips" @click="isShowMZSM = true">免责声明</div>
     <!-- 图表渲染盒子 -->
     <div class="chart-render-wrap">
-      <iframe src="http://192.168.77.25:3000/chart/preview?code=a4ef161347660d1b23c1b045f3562a66&source=etamini&token=6ea9ab1baa0efb9e19094440c317e21bdefc086f9498d024a0ca6fe32328c68b"></iframe>
+      <iframe :src="chartRenderUrl"></iframe>
     </div>
     <div><span>来源:</span></div>
 
@@ -42,41 +63,42 @@ const isShowMZSM=ref(false)
 </template>
 
 <style lang="scss" scoped>
-.chart-detail-page{
+.chart-detail-page {
+  background-color: #fff;
   padding: var(--page-padding);
-  .chart-title{
+  .chart-title {
     font-size: 36px;
     line-height: 44px;
     margin-bottom: 20px;
   }
-  .mz-tips{
+  .mz-tips {
     text-align: right;
     color: var(--primary-color);
     font-size: var(--font-size-small);
   }
-  .chart-render-wrap{
+  .chart-render-wrap {
     margin-top: 50px;
     height: 800px;
-    iframe{
-        width: 100%;
-        height: 100%;
-        border: none;
+    iframe {
+      width: 100%;
+      height: 100%;
+      border: none;
     }
   }
-  .change-btns-box{
+  .change-btns-box {
     position: fixed;
     left: var(--page-padding);
     right: var(--page-padding);
     bottom: 69px;
     display: flex;
     justify-content: space-between;
-    .btn{
+    .btn {
       width: 48%;
       height: 68px;
       text-align: center;
       border-radius: 68px;
       line-height: 68px;
-      background-color: #F3F5F9;
+      background-color: #f3f5f9;
     }
   }
 }
@@ -88,4 +110,36 @@ const isShowMZSM=ref(false)
   width: 100px;
   height: 100px;
 }
+
+@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{
+    right: 17px;
+    bottom: 75px;
+    width: 50px;
+    height: 50px;
+  }
+}
 </style>

+ 15 - 4
src/views/report/Detail.vue

@@ -9,6 +9,7 @@ const reportId = route.query.reportid
 const reportInfo = ref(null)
 const reportContent = ref('')
 const reportStatus = ref(0)//1已过期,2没有该品种权限,3没有权限,4有权限
+const reportCollected=ref(false)//报告是否收藏
 async function getReportInfo() {
   if (!reportId) return
   const res = await apiReport.getReportDetail({
@@ -17,7 +18,11 @@ async function getReportInfo() {
   if (res.Ret === 200) {
     reportInfo.value = res.Data.Report
     reportStatus.value = res.Data.Status
-    formatIframeData()
+    reportCollected.value=res.Data.IsCollect||false
+    if(res.Data.Status===4){
+      formatIframeData()
+    }
+    
     // 设置分享文案
     wx.miniProgram.postMessage({
       data: {
@@ -70,8 +75,12 @@ function handleCallPhone() {
 
 
 // 点击收藏
-function handleCollect() {
-
+async function handleCollect() {
+  const res=reportCollected.value?apiReport.reportCollectCancel({ReportId:Number(reportId)}) : await apiReport.reportCollect({ReportId:Number(reportId)})
+  if(res.Ret===200){
+    Message('success',reportCollected.value?'取消收藏成功':'收藏成功')
+    reportCollected.value=!reportCollected.value
+  }
 }
 
 // 显示免责声明
@@ -139,7 +148,8 @@ onUnmounted(() => {
       <svg-icon
         @click="handleCollect"
         class="item collect-icon"
-        name="collect"
+        :name="reportCollected?'collected':'collect'"
+        v-if="reportStatus===4"
       />
       <!-- 返回顶部 -->
       <div class="item back-top-img">
@@ -181,6 +191,7 @@ onUnmounted(() => {
 
 <style lang="scss" scoped>
 .report-detail-page {
+  background-color: #fff;
   padding: var(--page-padding);
   .title-box {
     font-size: 36px;

+ 2 - 2
vite.config.js

@@ -66,10 +66,10 @@ export default defineConfig(({ mode }) => {
       outDir: ENV.VITE_APP_OUTDIR,
     },
     server: {
-      port: 8707,
+      port: 8708,
       proxy: {
         "/api": {
-          target: "http://192.168.77.27:8714/api",
+          target: "http://8.136.199.33:8709/api",
           changeOrigin: true,
           rewrite: (path) => path.replace(/^\/api/, ""),
         },