Blame view

uniapp_jiju/unpackage/dist/dev/app-plus/static/pdf.html 2.74 KB
d56bd957   “wangming”   修复问题,组建AI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  <!DOCTYPE html>
  <html lang="en">
  
  	<head>
  		<meta charset="UTF-8">
  		<meta name="viewport" content="width=device-width, initial-scale=1.0">
  		<title>在线预览</title>
  		<link rel="stylesheet" href="./js/pdfh5.css">
  		<!--<link rel="stylesheet" href="./css/style.css">-->
  		<style>
  			#pdf {
  				width: 100%;
  				height: 100vh;
  			}
  
  			.btn {
  				display: flex;
  				justify-content: center;
  				align-items: center;
  				width: 160px;
  				height: 40px;
  				background-color: #007BFF;
  				/* 蓝色背景 */
  				color: white;
  				/* 白色文字 */
  				border-radius: 25px;
  				/* 圆角 */
  				font-size: 16px;
  				font-weight: bold;
  				cursor: pointer;
  				/* 鼠标指针样式 */
  				transition: background-color 0.3s ease;
  				/* 平滑的背景色过渡 */
  			}
  
  			.btn:hover {
  				background-color: #0056b3;
  				/* 鼠标悬停时的蓝色 */
  			}
  
  			.footer {
  				width: 96%;
  				position: fixed;
  				bottom: 10px;
  				display: flex;
  				align-items: center;
  				justify-content: space-evenly;
  			}
  		</style>
  	</head>
  
  	<body>
  		<div id="app">
  			<div id="pdf" style="padding-top: 50px;"></div>
  
  			<div class="footer">
  				<div class="btn" style="background-color:#d0d0d0;color:#1b1c1a" @click="back">返回</div>
  				<!-- <div class="btn" @click="submit">预览文件</div> -->
  			</div>
  		</div>
  		<script src="./js/pdf.js"></script>
  		<script src="./js/pdf.worker.js"></script>
  		<script src="./js/jquery-3.6.0.min.js"></script>
  		<script src="./js/pdfh5.js"></script>
  		<!--<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>-->
  		<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  		<script src="./js/vue@2.js"></script>
  		<script type="text/javascript" src="./js/uni.webview.1.5.6.js"></script>
  		<script>
  			var app = new Vue({
  				el: '#app',
  				data: {},
  				methods: {
  					// submit() {
  					//     console.log('wx.miniProgram',wx.miniProgram)   
  					//     uni.miniProgram.navigateBack()  
  					//     wx.miniProgram.postMessage({ data: 'done' })
  					// },
  					back() {
  						uni.postMessage({
  							data: {
  								name:"back"
  							}
  						});
  					}
  				},
  
  				mounted() {
  					let searchURL = window.location.search;
  					// console.log('searchURL',searchURL);
  					searchURL = searchURL.substring(1, searchURL.length);
  					const pdfurl = searchURL.split("&")[0].split("=")[1];
  					// const pdfurl = 'http://8.130.38.56:8044/api/File/Image/annex/20241222_640536163110618373.pdf'
  					// console.log('pdfurl',pdfurl)
  					const pdfh5 = new Pdfh5('#pdf', {
  						pdfurl,
  					}, {
  						lazy: true
  					});
  
  					pdfh5.on("complete", (status) => {
  						if (status === 'error') return
  
  					})
  				},
  
  				unmounted() {
  					this.timer && clearInterval(this.timer)
  				},
  			})
  		</script>
  	</body>
  
  </html>