jwyu 10 月之前
父节点
当前提交
6cf8f62f9f
共有 8 个文件被更改,包括 144 次插入41 次删除
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 1 1
      .env.test
  4. 0 1
      src/App.vue
  5. 12 0
      src/api/modules/report.js
  6. 35 24
      src/styles/vars.css
  7. 91 10
      src/views/report/Detail.vue
  8. 3 3
      vite.config.js

+ 1 - 1
.env.development

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

+ 1 - 1
.env.production

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

+ 1 - 1
.env.test

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

+ 0 - 1
src/App.vue

@@ -5,4 +5,3 @@
 <template>
   <router-view></router-view>
 </template>
-

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

@@ -0,0 +1,12 @@
+import {get,post} from '@/api/index'
+
+export default{
+  // 获取报告详情
+  getReportDetail:params=>{
+    return get('/report/detail',params)
+  },
+  //报告阅读埋点记录
+  addReportReadRecord:params=>{
+    return post('/user/addReportRecord',params)
+  }
+}

+ 35 - 24
src/styles/vars.css

@@ -1,31 +1,42 @@
-:root{
-  --primary-color:#053CC9;
-    --primary-color_sub:#DDE6FF;
+:root {
+  --primary-color: #053cc9;
+  --primary-color_sub: #dde6ff;
 
-    --success-color:#4cd964;
-    --warning-color:#FFEFB6;
-    --error-color:#C54322;
+  --success-color: #4cd964;
+  --warning-color: #ffefb6;
+  --error-color: #c54322;
 
-    --bg-color:#ffffff;
-    --bg-grey-color:#F8F8FA;
-    --bg-index-page:#F6F9FF;
+  --bg-color: #ffffff;
+  --bg-grey-color: #f8f8fa;
+  --bg-index-page: #f6f9ff;
 
-    --border-color:#DCDFE6;
+  --border-color: #dcdfe6;
 
-    --text-color:#333333;
-    --text-color-sub :#666666;
-    --text-color-inverse:#ffffff;
-    --text-color-grey:#999;
-    --text-color-warning:#8F5600;
+  --text-color: #333333;
+  --text-color-sub: #666666;
+  --text-color-inverse: #ffffff;
+  --text-color-grey: #999;
+  --text-color-warning: #8f5600;
 
-    --font-size:28px;
-    --font-size-small:24px;
-    --font-size-large:30px;
-    --font-size-huge:34px;
+  --font-size: 28px;
+  --font-size-small: 24px;
+  --font-size-large: 30px;
+  --font-size-huge: 34px;
 
-    --page-padding:34px;
+  --page-padding: 34px;
 
-    /* 修改td组件颜色 */
-    --td-primary-color-7:#053CC9;
-    --td-primary-color-1:#F5F8FF;
-}
+  /* 修改td组件颜色 */
+  --td-primary-color-7: #053cc9;
+  --td-primary-color-1: #f5f8ff;
+}
+
+@media (min-width: 600px) {
+  :root {
+    --font-size: 14px;
+    --font-size-small: 12px;
+    --font-size-large: 15px;
+    --font-size-huge: 17px;
+
+    --page-padding: 17px;
+  }
+}

+ 91 - 10
src/views/report/Detail.vue

@@ -1,4 +1,72 @@
 <script setup>
+import apiReport from '@/api/modules/report'
+import { useRoute } from 'vue-router'
+
+const route = useRoute()
+
+
+const reportId = route.query.reportid
+const reportInfo = ref(null)
+const reportContent = ref('')
+const reportStatus = ref(0)//1已过期,2没有该品种权限,3没有权限,4有权限
+async function getReportInfo() {
+  if (!reportId) return
+  const res = await apiReport.getReportDetail({
+    ReportId: Number(reportId)
+  })
+  if (res.Ret === 200) {
+    reportInfo.value = res.Data.Report
+    reportStatus.value = res.Data.Status
+    formatIframeData()
+    // 设置分享文案
+    wx.miniProgram.postMessage({
+      data: {
+        title: res.Data.Report.Title
+      }
+    });
+
+    handleAddReadReportRecord()
+  }
+}
+getReportInfo()
+
+// 给报告详情中图表加参数
+function formatIframeData() {
+  reportContent.value = reportInfo.value.Content.replace(/\/chartshow\?code=/g, `/chartshow?source=etamini&token=${localStorage.getItem('token')}&reportId=${reportId}&code=`)
+}
+
+
+// 用户阅读埋点
+let recordData = []
+function handleAddReadReportRecord() {
+  apiReport.addReportReadRecord({
+    RecordId: recordData,
+    ReportId: Number(reportId),
+    ReportTitle: reportInfo.value.Title,
+    ClassifyIdFirst: reportInfo.value.ClassifyIdFirst,
+    ClassifyNameFirst: reportInfo.value.ClassifyNameFirst,
+    ClassifyIdSecond: reportInfo.value.ClassifyIdSecond,
+    ClassifyNameSecond: reportInfo.value.ClassifyNameSecond,
+  }).then(res => {
+    if (res.Ret === 200) {
+      console.log('记录成功');
+    }
+  })
+}
+onBeforeUnmount(() => {
+  handleAddReadReportRecord()
+})
+
+// 拨打电话
+function handleCallPhone() {
+  var phoneLink = 'tel:' + '15715575977';
+  var link = document.createElement('a');
+  link.setAttribute('href', phoneLink);
+  link.onclick = function () {
+    return true;
+  };
+  link.click();
+}
 
 
 // 点击收藏
@@ -53,18 +121,18 @@ onUnmounted(() => {
 </script>
 
 <template>
-  <div class="report-detail-page">
-    <div class="title-box">报告标题</div>
-    <div class="author-box">作者</div>
+  <div class="report-detail-page" v-if="reportInfo">
+    <div class="title-box">{{ reportInfo.Title }}</div>
+    <div class="author-box">{{ reportInfo.Author }}</div>
     <div class="time-box">
-      <span>2023-02-02 12:12</span>
+      <span>{{ reportInfo.PublishTime }}</span>
       <span class="btn" @click="isShowMZSM = true">免责声明</span>
     </div>
-    <div class="des-box">
+    <div class="des-box" v-if="reportInfo.Abstract">
       <svg-icon name="icon01"></svg-icon>
-      <div>摘要内容部分</div>
+      <div>{{ reportInfo.Abstract }}</div>
     </div>
-    <div class="report-content-box rich-content"></div>
+    <div class="report-content-box rich-content" v-html="reportContent"></div>
     <!-- 右侧悬浮操作栏 -->
     <div class="right-fix-box">
       <!-- 收藏 -->
@@ -85,12 +153,24 @@ onUnmounted(() => {
     </div>
   </div>
   <!-- 无权限  -->
-  <div class="no-auth-wrap" v-if="false">
+  <div class="no-auth-wrap" v-if="reportStatus !== 4">
     <div class="opcity-box"></div>
     <div class="content-box">
       <img class="icon" src="@/assets/imgs/lock-img.png" alt="" />
-      <div class="text">您暂无权限查看,<br />请联系客服人员开通!</div>
-      <t-button theme="primary" block style="width: 300px; margin: 30px auto"
+      <div class="text" v-if="reportStatus === 3">
+        您暂无权限查看,<br />请联系客服人员开通!
+      </div>
+      <div class="text" v-if="reportStatus === 2">
+        您暂无该品种权限,<br />请联系销售人员开通!
+      </div>
+      <div class="text" v-if="reportStatus === 1">
+        您的权限已过期,<br />请联系销售人员开通!
+      </div>
+      <t-button
+        theme="primary"
+        block
+        style="width: 300px; margin: 30px auto"
+        @click="handleCallPhone"
         >立即联系</t-button
       >
     </div>
@@ -127,6 +207,7 @@ onUnmounted(() => {
     line-height: 36px;
   }
   .report-content-box {
+    margin-top: 20px;
     line-height: 1.8;
     font-size: 36px;
     :deep(img) {

+ 3 - 3
vite.config.js

@@ -68,10 +68,10 @@ export default defineConfig(({ mode }) => {
     server: {
       port: 8707,
       proxy: {
-        "/v1": {
-          target: "http://8.136.199.33:8705/adminapi",
+        "/api": {
+          target: "http://192.168.77.27:8714/api",
           changeOrigin: true,
-          rewrite: (path) => path.replace(/^\/v1/, ""),
+          rewrite: (path) => path.replace(/^\/api/, ""),
         },
       },
     },