Browse Source

兼容pdf

张文飞 3 years ago
parent
commit
8a78ddbb9b
1 changed files with 12 additions and 1 deletions
  1. 12 1
      pages/ownerCertification/ownerCertification.vue

+ 12 - 1
pages/ownerCertification/ownerCertification.vue

@@ -166,7 +166,18 @@
 					data: {},
 				})
 				if(res.data.success){
-					this.proviceUrl = res.data.single.ownerRegistProtocol;
+					const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=");
+					this.proviceUrl = curryUrl(res.data.single.ownerRegistProtocol)
+				}
+			},
+			curry(baseUrl) {
+				return function(url) {
+					let index = url.lastIndexOf('.');
+					if (url.substring(index + 1).indexOf('pdf') > -1) {
+						return baseUrl + url;
+					} else {
+						return url;
+					}
 				}
 			},
 			onKeyYHKNameInput(event){