|
@@ -1,15 +1,40 @@
|
|
|
<script setup>
|
|
|
import apiReport from '@/api/modules/report'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
+import { Message } from 'tdesign-mobile-vue';
|
|
|
+import apiCommon from '@/api/modules/common'
|
|
|
+import apiUser from '@/api/modules/user'
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
+// 获取系统配置
|
|
|
+let systemConfig=null
|
|
|
+function getSystemConfig(){
|
|
|
+ apiCommon.systemConfig().then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ systemConfig=res.Data
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+getSystemConfig()
|
|
|
+
|
|
|
+// 获取用户信息
|
|
|
+let userInfo=null
|
|
|
+function getUserInfo(){
|
|
|
+ apiUser.userInfo().then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ userInfo=res.Data
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+getUserInfo()
|
|
|
+
|
|
|
|
|
|
const reportId = route.query.reportid
|
|
|
const reportInfo = ref(null)
|
|
|
const reportContent = ref('')
|
|
|
const reportStatus = ref(0)//1已过期,2没有该品种权限,3没有权限,4有权限
|
|
|
-const reportCollected=ref(false)//报告是否收藏
|
|
|
+const reportCollected = ref(false)//报告是否收藏
|
|
|
async function getReportInfo() {
|
|
|
if (!reportId) return
|
|
|
const res = await apiReport.getReportDetail({
|
|
@@ -18,11 +43,17 @@ async function getReportInfo() {
|
|
|
if (res.Ret === 200) {
|
|
|
reportInfo.value = res.Data.Report
|
|
|
reportStatus.value = res.Data.Status
|
|
|
- reportCollected.value=res.Data.IsCollect||false
|
|
|
- if(res.Data.Status===4){
|
|
|
+ reportCollected.value = res.Data.IsCollect || false
|
|
|
+ if (res.Data.Status === 4) {
|
|
|
formatIframeData()
|
|
|
+ }else{//无权限
|
|
|
+ reportContent.value = reportInfo.value.ContentSub
|
|
|
}
|
|
|
-
|
|
|
+ nextTick(() => {
|
|
|
+ handlePreviewImgs()
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
// 设置分享文案
|
|
|
wx.miniProgram.postMessage({
|
|
|
data: {
|
|
@@ -42,10 +73,10 @@ function formatIframeData() {
|
|
|
|
|
|
|
|
|
// 用户阅读埋点
|
|
|
-let recordData = []
|
|
|
+let recordId = 0
|
|
|
function handleAddReadReportRecord() {
|
|
|
apiReport.addReportReadRecord({
|
|
|
- RecordId: recordData,
|
|
|
+ RecordId: recordId,
|
|
|
ReportId: Number(reportId),
|
|
|
ReportTitle: reportInfo.value.Title,
|
|
|
ClassifyIdFirst: reportInfo.value.ClassifyIdFirst,
|
|
@@ -55,6 +86,7 @@ function handleAddReadReportRecord() {
|
|
|
}).then(res => {
|
|
|
if (res.Ret === 200) {
|
|
|
console.log('记录成功');
|
|
|
+ recordId = res.Data.RecordId
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -64,7 +96,18 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
// 拨打电话
|
|
|
function handleCallPhone() {
|
|
|
- var phoneLink = 'tel:' + '15715575977';
|
|
|
+ let tel=''
|
|
|
+ if(reportStatus.value===3){
|
|
|
+ systemConfig.forEach(item => {
|
|
|
+ if(item.ConfKey==='ServicePhone'){
|
|
|
+ tel=item.ConfVal
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ tel=userInfo.SellerPhone
|
|
|
+ }
|
|
|
+
|
|
|
+ var phoneLink = 'tel:' + tel;
|
|
|
var link = document.createElement('a');
|
|
|
link.setAttribute('href', phoneLink);
|
|
|
link.onclick = function () {
|
|
@@ -76,10 +119,10 @@ function handleCallPhone() {
|
|
|
|
|
|
// 点击收藏
|
|
|
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
|
|
|
+ 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
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -102,25 +145,22 @@ function handleBackTop() {
|
|
|
|
|
|
// 点击报告内容中的图片
|
|
|
function handlePreviewImgs() {
|
|
|
- document.addEventListener('DOMContentLoaded', function () {
|
|
|
- document.querySelector('.rich-content').addEventListener('click', function (event) {
|
|
|
- let imgArray = [];
|
|
|
- let curImageSrc = event.target.src;
|
|
|
- let oParent = event.target.parentNode;
|
|
|
- if (curImageSrc && !oParent.hasAttribute('href')) {
|
|
|
- let imgs = document.querySelectorAll('.rich-content img');
|
|
|
- for (let i = 0; i < imgs.length; i++) {
|
|
|
- let itemSrc = imgs[i].src;
|
|
|
- imgArray.push(itemSrc);
|
|
|
- }
|
|
|
- wx.previewImage({ current: curImageSrc, urls: imgArray });
|
|
|
+ document.getElementById('rich-content').addEventListener('click', function (event) {
|
|
|
+ let imgArray = [];
|
|
|
+ let curImageSrc = event.target.src;
|
|
|
+ let oParent = event.target.parentNode;
|
|
|
+ if (curImageSrc && !oParent.hasAttribute('href')) {
|
|
|
+ let imgs = document.querySelectorAll('.rich-content img');
|
|
|
+ for (let i = 0; i < imgs.length; i++) {
|
|
|
+ let itemSrc = imgs[i].src;
|
|
|
+ imgArray.push(itemSrc);
|
|
|
}
|
|
|
- });
|
|
|
+ wx.previewImage({ current: curImageSrc, urls: imgArray });
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- handlePreviewImgs()
|
|
|
window.addEventListener('scroll', handlePageScroll)
|
|
|
})
|
|
|
onUnmounted(() => {
|
|
@@ -141,15 +181,19 @@ onUnmounted(() => {
|
|
|
<svg-icon name="icon01"></svg-icon>
|
|
|
<div>{{ reportInfo.Abstract }}</div>
|
|
|
</div>
|
|
|
- <div class="report-content-box rich-content" v-html="reportContent"></div>
|
|
|
+ <div
|
|
|
+ id="rich-content"
|
|
|
+ class="report-content-box rich-content"
|
|
|
+ v-html="reportContent"
|
|
|
+ ></div>
|
|
|
<!-- 右侧悬浮操作栏 -->
|
|
|
<div class="right-fix-box">
|
|
|
<!-- 收藏 -->
|
|
|
<svg-icon
|
|
|
@click="handleCollect"
|
|
|
class="item collect-icon"
|
|
|
- :name="reportCollected?'collected':'collect'"
|
|
|
- v-if="reportStatus===4"
|
|
|
+ :name="reportCollected ? 'collected' : 'collect'"
|
|
|
+ v-if="reportStatus === 4"
|
|
|
/>
|
|
|
<!-- 返回顶部 -->
|
|
|
<div class="item back-top-img">
|
|
@@ -311,4 +355,73 @@ onUnmounted(() => {
|
|
|
height: 200px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+@media (min-width: 600px) {
|
|
|
+ .report-detail-page {
|
|
|
+ .title-box {
|
|
|
+ font-size: 18px;
|
|
|
+ line-height: 22px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ .time-box {
|
|
|
+ margin-top: 5px;
|
|
|
+ }
|
|
|
+ .des-box {
|
|
|
+ padding: 10px;
|
|
|
+ margin: 10px 0;
|
|
|
+ gap: 0 5px;
|
|
|
+ line-height: 18px;
|
|
|
+ }
|
|
|
+ .report-content-box {
|
|
|
+ margin-top: 10px;
|
|
|
+ font-size: 18px;
|
|
|
+ :deep(span) {
|
|
|
+ font-size: 18px !important;
|
|
|
+ }
|
|
|
+ :deep(p) {
|
|
|
+ font-size: 18px !important;
|
|
|
+ }
|
|
|
+ :deep(ul) {
|
|
|
+ font-size: 18px !important;
|
|
|
+ }
|
|
|
+ :deep(ol) {
|
|
|
+ font-size: 18px !important;
|
|
|
+ }
|
|
|
+ :deep(li) {
|
|
|
+ font-size: 18px !important;
|
|
|
+ }
|
|
|
+ :deep(span.fr-emoticon) {
|
|
|
+ width: 18px !important;
|
|
|
+ height: 18px !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right-fix-box{
|
|
|
+ right: 17px;
|
|
|
+ bottom: 65px;
|
|
|
+ .item{
|
|
|
+ margin-top: 5px;
|
|
|
+ }
|
|
|
+ .back-top-img{
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ }
|
|
|
+ .collect-icon{
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .no-auth-wrap{
|
|
|
+ .opcity-box{
|
|
|
+ height: 65px;
|
|
|
+ }
|
|
|
+ .content-box{
|
|
|
+ padding-bottom: 100px;
|
|
|
+ }
|
|
|
+ .icon{
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|