From 1674ff52a2874cfdf59bc876290c0d102265ad32 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 19 九月 2024 15:40:00 +0800
Subject: [PATCH] document文档资源查看修改

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

diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js
index 4808f57..13930df 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({
 
   /**
@@ -67,10 +70,16 @@
     const token = wx.getStorageSync(app.config.tokenKey)
     if (!token) {
       loginInfo(app, (data) => {
-        if (data) {} else {}
+        if (data) {
+          this.resourceDetailsData()
+        } else {
+          this.resourceDetailsData()
+        }
       })
+    } else {
+      this.resourceDetailsData()
     }
-    this.resourceDetailsData()
+
   },
 
   /**
@@ -150,9 +159,8 @@
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */
-  onShareAppMessage() {
-
-  },
+  onShareAppMessage() {},
+  onShareTimeline() {},
   goBack() {
     wx.navigateBack()
   },
@@ -275,7 +283,6 @@
   //鍒氳繘鏉ョ殑鏃跺�欒皟鐢�
   handleTeachData(item) {
     //鍥剧墖
-    console.log(item, 'item11111');
     if (item.selectType == 'picture') {
       this.setData({
         showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile,
@@ -299,13 +306,17 @@
       app.MG.file.getPdfInfo({
         md5: item.file
       }).then((res) => {
-        if (res && res.totalPages) {
-          for (let i = 0; i < res.totalPages; i++) {
+        let naturalResources = []
+        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');
+            naturalResources.push(src)
           }
         }
+        this.setData({
+          naturalResources
+        })
+        console.log('ppt', this.data.naturalResources);
       })
     }
   },

--
Gitblit v1.9.1