|
@@ -1,13 +1,10 @@
|
|
<template>
|
|
<template>
|
|
<view>
|
|
<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>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- const docx = require('docx-preview');
|
|
|
|
- window.JSZip = require('jszip')
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -18,7 +15,6 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
type: "",
|
|
type: "",
|
|
- word: false,
|
|
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad(param) {
|
|
onLoad(param) {
|
|
@@ -46,13 +42,10 @@
|
|
if (res.data.success) {
|
|
if (res.data.success) {
|
|
const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=")
|
|
const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=")
|
|
if (this.type == '1') { //使用协议
|
|
if (this.type == '1') { //使用协议
|
|
- this.isWord(res.data.single.userUseProtocol);
|
|
|
|
this.url = curryUrl(res.data.single.userUseProtocol);
|
|
this.url = curryUrl(res.data.single.userUseProtocol);
|
|
} else if (this.type == '2') { //隐私协议
|
|
} else if (this.type == '2') { //隐私协议
|
|
- this.isWord(res.data.single.userPrivacyProtocol);
|
|
|
|
this.url = curryUrl(res.data.single.userPrivacyProtocol);
|
|
this.url = curryUrl(res.data.single.userPrivacyProtocol);
|
|
} else if (this.type == '3') { //业主注册协议
|
|
} else if (this.type == '3') { //业主注册协议
|
|
- this.isWord(res.data.single.ownerRegistProtocol);
|
|
|
|
this.url = curryUrl(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>
|
|
</script>
|