Bläddra i källkod

就是不支持word

张文飞 3 år sedan
förälder
incheckning
0e8538356c
2 ändrade filer med 2 tillägg och 18 borttagningar
  1. 1 1
      App.vue
  2. 1 17
      pages/webviewPage/webviewPage.vue

+ 1 - 1
App.vue

@@ -12,7 +12,7 @@
 			 *    bug: 如果之前去掉code,则会进入(一)进入了死循环;
 			 *    想法:先去让他带着code去regist,成功则说明是新的code,失败则去掉code进入(一)
 			 */
-			if(!code&&false){
+			if(!code){
 				let url =  href.split('#')[0];
 				url = encodeURIComponent(url);
 				url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+config.appid+"&redirect_uri="+url+"&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect"

+ 1 - 17
pages/webviewPage/webviewPage.vue

@@ -1,13 +1,10 @@
 <template>
 	<view>
-		<view ref='file' v-if="word"></view>
-		<web-view v-else :webview-styles="webviewStyles" :src="url"></web-view>
+		<web-view  :webview-styles="webviewStyles" :src="url"></web-view>
 	</view>
 </template>
 
 <script>
-	const docx = require('docx-preview');
-	window.JSZip = require('jszip')
 	export default {
 		data() {
 			return {
@@ -18,7 +15,6 @@
 					}
 				},
 				type: "",
-				word: false,
 			};
 		},
 		onLoad(param) {
@@ -46,13 +42,10 @@
 				if (res.data.success) {
 					const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=")
 					if (this.type == '1') { //使用协议
-						this.isWord(res.data.single.userUseProtocol);
 						this.url = curryUrl(res.data.single.userUseProtocol);
 					} else if (this.type == '2') { //隐私协议
-						this.isWord(res.data.single.userPrivacyProtocol);
 						this.url = curryUrl(res.data.single.userPrivacyProtocol);
 					} else if (this.type == '3') { //业主注册协议
-						this.isWord(res.data.single.ownerRegistProtocol);
 						this.url = curryUrl(res.data.single.ownerRegistProtocol);
 					}
 				}
@@ -67,15 +60,6 @@
 					}
 				}
 			},
-			isWord(url) {
-				let index = url.lastIndexOf('.');
-				if (url.substring(index + 1).indexOf('docx') > -1) {
-					 this.word = true;
-					 docx.renderAsync(new Blob([url]),this.$refs.file) // 渲染到页面预览
-				} else {
-					this.word = false;
-				}
-			}
 		}
 	}
 </script>