From b9d08f45e3dc1fce9b8ae37ae8b95562843d4cbe Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期四, 19 九月 2024 14:23:26 +0800
Subject: [PATCH] pdf

---
 packageDomain/pages/resourceDetails/document/index.js |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js
index 0ca3e50..ef0ca54 100644
--- a/packageDomain/pages/resourceDetails/document/index.js
+++ b/packageDomain/pages/resourceDetails/document/index.js
@@ -1,6 +1,9 @@
 // pages/resourceDetails/document/index.js
 import Toast from 'tdesign-miniprogram/toast/index';
 const app = getApp()
+import {
+  loginInfo
+} from '../../../../assets/js/login';
 Page({
 
   /**
@@ -16,6 +19,7 @@
     navBarHeight: '',
     barHeight: '',
     activeId: '',
+    storeInfo: '',
     bookId: '',
     bookName: '',
     cmsId: '',
@@ -55,6 +59,7 @@
       activeId: options.activeId,
       bookId: options.bookId,
       bookName: options.bookName,
+      storeInfo: options.storeInfo,
       cmsId: options.cmsId,
       parentName: options.parentName,
       parentProductLinkPath: options.parentProductLinkPath,
@@ -62,7 +67,19 @@
       applyState: options.applyState,
       deadline: options.deadline
     })
-    this.resourceDetailsData()
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        if (data) {
+          this.resourceDetailsData()
+        } else {
+          this.resourceDetailsData()
+        }
+      })
+    } else {
+      this.resourceDetailsData()
+    }
+
   },
 
   /**
@@ -142,9 +159,8 @@
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */
-  onShareAppMessage() {
-
-  },
+  onShareAppMessage() {},
+  onShareTimeline() {},
   goBack() {
     wx.navigateBack()
   },
@@ -173,6 +189,9 @@
         start: 0,
         size: 999
       }
+    }
+    if (this.data.storeInfo) {
+      query.storeInfo = this.data.storeInfo
     }
     app.MG.store.getProductDetail(query).then((res) => {
       console.log(res);
@@ -288,8 +307,8 @@
       app.MG.file.getPdfInfo({
         md5: item.file
       }).then((res) => {
-        if (res && res.totalPages) {
-          for (let i = 0; i < res.totalPages; i++) {
+        if (res && JSON.parse(res).totalPages) {
+          for (let i = 0; i < JSON.parse(res).totalPages; i++) {
             const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + item.file + '&index=' + (i + 1) + '&dpi=300'
             this.data.naturalResources.push(src)
             // console.log(this.data.naturalResources, ' this.data.naturalResources');

--
Gitblit v1.9.1