FML 3 月之前
父节点
当前提交
89c2466140

+ 1 - 1
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "PDF查看",
+    "name" : "银通产品介绍",
     "appid" : "__UNI__9961234",
     "description" : "",
     "versionName" : "1.0.0",

+ 3 - 66
pages/index.vue

@@ -11,7 +11,7 @@ export default {
         return { 
 			fileUrl: '',
 			fileType: '2',
-			fileMap: {     
+			fileMap: {      
 				'1': '/static/pdf/2.pdf', //银通汽车4s管理系统
 				'2': '/static/pdf/3.pdf', //银通汽车租赁管理系统 
 				'3': '/static/pdf/1.pdf', // 银通云越管理系统
@@ -22,71 +22,8 @@ export default {
 		console.log(options)
 		const fileIndex = options.file || '1';
 		const baseUrl = this.fileMap[fileIndex] || this.fileMap['1'];
-		this.fileUrl = baseUrl + '?t=' + Date.now(); 
-		console.log(this.fileUrl)
-		this.handlePreview();
-	},
-	methods: {
-		handlePreview() {
-			//#ifdef MP-WEIXIN
-			this.previewWechat(this.fileUrl);
-			return;
-			//#endif
-			
-			//#ifdef H5
-			if (this.isWechat()) {
-				this.clearWechatCache();
-			}
-			//#endif
-		},
-		isWechat() {
-			var ua = navigator.userAgent.toLowerCase();
-			return ua.indexOf('micromessenger') !== -1;
-		},
-		previewWechat(urlPdf) {
-			uni.showLoading({ title: '加载中...' });
-			uni.downloadFile({
-				url: urlPdf,
-				header: {
-					'Cache-Control': 'no-cache',
-					'Pragma': 'no-cache'
-				},
-				success: (res) => {
-					if (res.statusCode === 200) {
-						uni.openDocument({
-							filePath: res.tempFilePath,
-							fileType: 'pdf',
-							showMenu: true,
-							success: () => {
-								console.log('打开成功');
-							},
-							fail: (err) => {
-								console.error('打开失败:', err);
-								uni.showToast({ title: '打开失败', icon: 'none' });
-							}
-						});
-					} else {
-						uni.showToast({ title: '下载失败', icon: 'none' });
-					}
-				},
-				fail: (err) => {
-					console.error('下载失败:', err);
-					uni.showToast({ title: '下载失败', icon: 'none' });
-				},
-				complete: () => {
-					uni.hideLoading();
-				}
-			});
-		},
-		clearWechatCache() {
-			try {
-				if (window.location.reload) {
-					window.location.reload(true);
-				}
-			} catch (e) {
-				console.log('刷新失败:', e);
-			}
-		}
+		this.fileUrl = baseUrl + '?t=' + Date.now();  
+		console.log(this.fileUrl);
 	}
 };
 </script>

+ 3 - 3
uni_modules/ss-preview/package.json

@@ -1,9 +1,9 @@
 {
   "id": "ss-preview",
-  "displayName": "PDF查看",
+  "displayName": "银通产品介绍",
   "version": "1.0.3",
-  "description": "PDF查看",
-  "keywords": [
+  "description": "银通产品介绍",
+  "keywords": [ 
     "移动端",
     "H5",
     "微信小程序",

文件差异内容过多而无法显示
+ 12 - 0
unpackage/dist/build/web/assets/index-B9wkV93B.js


+ 1 - 0
unpackage/dist/build/web/assets/index-Bm6V95Xz.css

@@ -0,0 +1 @@
+.box[data-v-a2587aaf]{padding:0}

+ 1 - 0
unpackage/dist/build/web/assets/pages-index.B1nVDRKs.js

@@ -0,0 +1 @@
+import{_ as e,r as a,a as s}from"./uni-app.es.Bg6gPrdB.js";import{r as l,c as i,w as f,i as t,o,a as p}from"./index-B9wkV93B.js";const r=e({components:{},data:()=>({fileUrl:"",fileType:"2",fileMap:{1:"/static/pdf/2.pdf",2:"/static/pdf/3.pdf",3:"/static/pdf/1.pdf"}}),onLoad(e){console.log(e);const a=e.file||"1",s=this.fileMap[a]||this.fileMap[1];this.fileUrl=s+"?t="+Date.now(),console.log(this.fileUrl)}},[["render",function(e,r,n,d,c,u){const U=a(l("ss-preview"),s),m=t;return o(),i(m,{class:"box"},{default:f((()=>[p(U,{fileUrl:c.fileUrl,fileType:c.fileType},null,8,["fileUrl","fileType"])])),_:1})}],["__scopeId","data-v-a2587aaf"]]);export{r as default};

+ 1 - 0
unpackage/dist/build/web/assets/pages-preview.BPCWh3Rz.js

@@ -0,0 +1 @@
+import{_ as e,r as i,a as s}from"./uni-app.es.Bg6gPrdB.js";import{r as a,c as t,w as l,i as r,o as f,a as p}from"./index-B9wkV93B.js";const n=e({data:()=>({fileUrl:"",fileType:"",imageList:[]}),onLoad(e){let i=JSON.parse(decodeURIComponent(e.item));if(this.fileType=i.type,"1"===i.type)return this.imageList=i.src;this.fileUrl=i.src}},[["render",function(e,n,o,m,d,u){const c=i(a("ss-preview"),s),y=r;return f(),t(y,null,{default:l((()=>[p(c,{fileUrl:d.fileUrl,fileType:d.fileType,imageList:d.imageList},null,8,["fileUrl","fileType","imageList"])])),_:1})}]]);export{n as default};

+ 1 - 0
unpackage/dist/build/web/assets/uni-app-BjePXLKt.css

@@ -0,0 +1 @@
+.page[data-v-1ea100d4]{height:100%}.page .video-detail-page[data-v-1ea100d4]{width:100%}.page .video-detail-page uni-video[data-v-1ea100d4]{width:100%}

+ 1 - 0
unpackage/dist/build/web/assets/uni-app.es.Bg6gPrdB.js

@@ -0,0 +1 @@
+import{o as e,c as s,w as t,b as a,F as i,d as l,a as r,e as d,f as n,S as o,g as c,h as f,j as p,i as y}from"./index-B9wkV93B.js";const u=(e,s)=>{const t=e.__vccOpts||e;for(const[a,i]of s)t[a]=i;return t};const w=u({name:"ss-preview",props:{fileUrl:{type:String,default:""},fileType:{type:String,default:""},imageList:{type:Array,default:()=>[]}},data:()=>({webviewStyles:{progress:{color:"#FF3333"}},src:""}),methods:{previewPdf(e){this.src=`/uni_modules/ss-preview/hybrid/html/pdf-reader/index.html?file=${encodeURIComponent(e)}&_t=${Date.now()}`}},watch:{fileType:{deep:!0,immediate:!0,handler:function(e){"2"===e&&this.previewPdf(this.fileUrl)}}}},[["render",function(u,w,h,m,v,g){const _=n,b=o,k=c,x=f,S=p,T=y;return e(),s(T,{class:"page"},{default:t((()=>["1"===h.fileType?(e(),s(k,{key:0,class:"swiper",style:{width:"100%",height:"calc(100vh - 44px)",margin:"0 auto"}},{default:t((()=>[(e(!0),a(i,null,l(h.imageList,((a,i)=>(e(),s(b,{key:"key"+i},{default:t((()=>[r(_,{src:a,style:{width:"100%",height:"100%"},mode:"aspectFit"},null,8,["src"])])),_:2},1024)))),128))])),_:1})):d("",!0),"2"===h.fileType?(e(),s(x,{key:1,"webview-styles":v.webviewStyles,src:v.src},null,8,["webview-styles","src"])):d("",!0),"3"===h.fileType?(e(),s(T,{key:2,class:"video-detail-page"},{default:t((()=>[r(T,{class:"video-box"},{default:t((()=>[r(S,{src:h.fileUrl,controls:""},null,8,["src"])])),_:1})])),_:1})):d("",!0)])),_:1})}],["__scopeId","data-v-1ea100d4"]]);function h(e,s){return"string"==typeof e?s:e}export{u as _,w as a,h as r};

+ 2 - 2
unpackage/dist/build/web/index.html

@@ -11,10 +11,10 @@
         '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
         (coverSupport ? ', viewport-fit=cover' : '') + '" />')
     </script>
-    <title>PDF查看</title>
+    <title>银通产品介绍</title>
     <!--preload-links-->
     <!--app-context-->
-    <script type="module" crossorigin src="/assets/index-B37YRguy.js"></script>
+    <script type="module" crossorigin src="/assets/index-B9wkV93B.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-yksqsBZR.css">
   </head>
   <body>

部分文件因为文件数量过多而无法显示