wangxy há 1 dia atrás
pai
commit
b0a9b24405
3 ficheiros alterados com 25 adições e 12 exclusões
  1. 12 0
      api/pdf.js
  2. 1 4
      pages.json
  3. 12 8
      pages/pdfPage/pdfPage.vue

+ 12 - 0
api/pdf.js

@@ -0,0 +1,12 @@
+import request from '@/utils/request'
+export function getPDFUrl(data = {}) {
+    return request({
+        'url': '/app/user/my/tiku/pdf',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data,
+        timeout: 20000
+    })
+}

+ 1 - 4
pages.json

@@ -129,10 +129,7 @@
 		},
 		{
 			"path" : "pages/pdfPage/pdfPage",
-			"style" : 
-			{
-				// "navigationStyle": "custom"
-			}
+			"style" : {}
 		}
 	],
 	 "tabBar": {

+ 12 - 8
pages/pdfPage/pdfPage.vue

@@ -10,15 +10,20 @@
 	import {ref} from "vue"
 	import {onLoad} from "@dcloudio/uni-app"
 	import ssDownload from "./ssDownload.vue"
-	
-	
+  import * as httpApi from "@/apis/pdf.js"
+
 	const pdfUrl = ref('');
 	const httpUrl = ref('');
 	const ssRef = ref(null)
 	
-	function updatePdfUrl(url) {
-		httpUrl.value = url;
-		pdfUrl.value = '/hybrid/html/web/viewer.html?file=' + encodeURIComponent(url);
+	function updatePdfUrl({banben,nianji}) {
+    httpApi.getPDFUrl({
+      banben,
+      nianji,
+    }).then(url => {
+      httpUrl.value = url;
+      pdfUrl.value = '/hybrid/html/web/viewer.html?file=' + encodeURIComponent(url);
+    })
 	}
 	
 	function getPostMessage() {
@@ -30,9 +35,8 @@
 	}
 	
 	
-	onLoad(({url}) => {
-		const mockUrl = "https://501351981.github.io/vue-office/examples/dist/static/test-files/test.pdf"
-		updatePdfUrl(url||mockUrl);
+	onLoad(({banben, nianji}) => {
+		updatePdfUrl({banben, nianji});
 	})
 	
 </script>