Bläddra i källkod

Merge branch 'yb11.1' into debug

yujinwen 1 vecka sedan
förälder
incheckning
6e018c5d3c
2 ändrade filer med 199 tillägg och 0 borttagningar
  1. 5 0
      src/router/hzyb/index.js
  2. 194 0
      src/views/hzyb/report/RaiDetail.vue

+ 5 - 0
src/router/hzyb/index.js

@@ -65,6 +65,11 @@ export const hzybRoutes=[
                 path:"previewpdf",
                 name:"hzybPreviewPDF",
                 component:() => import("@/views/hzyb/report/PreviewPDF.vue")
+            },
+            {
+                path:"raiDetail",
+                name:"hzybReportRaiDetail",
+                component:() => import("@/views/hzyb/report/RaiDetail.vue")
             }
         ]
     },

+ 194 - 0
src/views/hzyb/report/RaiDetail.vue

@@ -0,0 +1,194 @@
+<script setup>
+import { ref, onMounted } from "vue";
+import { apiReportDetail, apiRddpShareImg, } from '@/api/hzyb/report'
+import { apiApplyPermission, apiUserInfo } from '@/api/hzyb/user'
+import { useRoute } from "vue-router";
+import moment from "moment";
+import reportCancel from './components/reportCancel.vue'
+
+const route = useRoute()
+
+// 获取详情如果为联系销售根据判断条件是否主动申请一次
+function validateAutoApply(info) {
+  if (info.permission_check.type == 'contact' && !info.permission_check.customer_info.has_apply) {
+    if (info.permission_check.customer_info.status == '冻结' || (info.permission_check.customer_info.status == '试用' && info.permission_check.customer_info.is_suspend == 1)) {
+      apiApplyPermission({
+        company_name: info.permission_check.customer_info.company_name,
+        real_name: info.permission_check.customer_info.name,
+        source: 4,
+        from_page: '报告详情'
+      }).then(res => {
+        if (res.code === 200) {
+          console.log('主动申请成功');
+        }
+      })
+    }
+  }
+}
+
+//向小程序发送分享数据
+async function handleGetShareData(info) {
+  let shareTitle = ''
+  let shareImg = ''
+  let imgText = ''//分享图上需要显示的内容
+  const shareTime = moment(info.report_info.publish_time).format('MMDD')
+  if (info.report_info.abstract) {
+    shareTitle = info.report_info.abstract
+    imgText = `<div style="font-size:78px">${info.report_info.title}(${shareTime})</div>`
+  } else {
+    shareTitle = info.report_info.title
+    imgText = `<div style="font-size:78px">${moment(info.report_info.publish_time).format('YYYY/MM/DD')}</div><div style="font-size:78px">${info.report_info.classify_name_second}</div>`
+  }
+  const rddpImgRes = await apiRddpShareImg({
+    pars: JSON.stringify({
+      title: imgText,
+      time_format: moment(info.report_info.publish_time).format('YYYY/MM/DD'),
+      background_img: info.report_info.share_bg_img,
+    }),
+    report_id: Number(route.query.reportId),
+  })
+  if (rddpImgRes.code === 200) {
+    shareImg = rddpImgRes.data
+  }
+
+  wx.miniProgram.postMessage({
+    data: {
+      title: shareTitle,
+      reportId: route.query.reportId,
+      shareImg: shareImg
+    }
+  });
+
+}
+
+const userInfo = ref(null)
+async function getUserInfo() {
+  const res = await apiUserInfo()
+  if (res.code === 200) {
+    userInfo.value = res.data
+  }
+}
+
+// 获取报告详情
+const isReportPublishCancel = ref(false)
+const reportInfo = ref(null)
+async function getReportDetail() {
+  const res = await apiReportDetail({
+    report_id: Number(route.query.reportId)
+  })
+  if (res.code === 200) {
+    reportInfo.value = res.data
+    if (!res.data.auth_ok) {
+      validateAutoApply(res.data)
+    }
+
+    handleGetShareData(res.data)
+  } else if (res.code === 4002) {
+    isReportPublishCancel.value = true
+  }
+
+}
+
+
+
+function initPage() {
+  if (route.query.token) {
+    localStorage.setItem('hzyb-token', route.query.token)
+    localStorage.setItem('hzyb-userId', route.query.userId)
+  }
+  getReportDetail()
+  getUserInfo()
+}
+initPage()
+
+
+
+
+</script>
+
+
+<template>
+  <div class="rai-report-detail-page" v-if="reportInfo">
+    <iframe :src="reportInfo.rai_report_url" class="iframe-wrap"></iframe>
+    <!-- 无权限 -->
+    <div class="no-auth-wrap" v-if="userInfo?.is_bind === 0">
+      <div class="apply-box">
+        <div>您尚未登录,请登录后查看更多信息</div>
+        <div class="btn" @click="handleGoLogin">立即登录</div>
+      </div>
+    </div>
+    <template v-else>
+      <div class="no-auth-wrap" v-if="!reportInfo.auth_ok">
+        <div
+          class="apply-box"
+          v-if="reportInfo.permission_check.type == 'apply'"
+        >
+          <div>您暂无权限查看报告,若想查看请申请开通</div>
+          <div class="btn" @click="handleGoApply">立即申请</div>
+        </div>
+        <div class="apply-box" v-else>
+          <div>您暂无权限查看报告</div>
+          <div>
+            若想查看请联系对口销售:{{ reportInfo.permission_check.name }}
+          </div>
+          <a
+            class="btn"
+            :href="'tel:' + reportInfo.permission_check.mobile"
+            tag="div"
+            >立即联系</a
+          >
+        </div>
+      </div>
+    </template>
+  </div>
+  <reportCancel v-if="isReportPublishCancel" />
+</template>
+
+
+
+<style lang="scss" scope>
+.rai-report-detail-page {
+  width: 100vw;
+  height: 100vh;
+  .iframe-wrap {
+    width: 100%;
+    height: 100%;
+    border: none;
+  }
+  .no-auth-wrap {
+    background: linear-gradient(
+      360deg,
+      #ffffff 60%,
+      rgba(255, 255, 255, 0) 88%
+    );
+    position: fixed;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    top: 0;
+    z-index: 99;
+    text-align: center;
+    font-size: 32px;
+    color: #e3b377;
+    overflow: hidden;
+    .apply-box {
+      padding-top: 250px;
+      position: absolute;
+      bottom: 100px;
+      left: 5%;
+      width: 90%;
+    }
+    .btn {
+      width: 100%;
+      margin-left: auto;
+      margin-right: auto;
+      line-height: 80px;
+      background-color: #e6b77d;
+      border-radius: 4px;
+      color: #fff;
+      margin-top: 100px;
+      display: block;
+    }
+  }
+}
+</style>