|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <web-view :webview-styles="webviewStyles" :src="url" v-if="iOS"></web-view>
|
|
|
+ <web-view :webview-styles="webviewStyles" :src="url"></web-view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -48,57 +48,8 @@
|
|
|
} else if (this.type = '3') { //业主注册协议
|
|
|
this.url = res.data.single.ownerRegistProtocol;
|
|
|
}
|
|
|
- let index = this.url.lastIndexOf('.');
|
|
|
- let ah = this.url.substring(index+1);
|
|
|
- if(ah.indexOf('pdf')>-1){ //是pdf
|
|
|
- this.loadpdf();
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
- loadpdf() {
|
|
|
- uni.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- console.log(res)
|
|
|
- if (res.system.includes('iOS')) {
|
|
|
- this.iOS = true;
|
|
|
- } else {
|
|
|
- this.iOS = false;
|
|
|
- // Android 需要下载后再打开
|
|
|
- uni.downloadFile({
|
|
|
- url: this.url,
|
|
|
- success: (res) => {
|
|
|
- const path = res.tempFilePath;
|
|
|
- uni.openDocument({
|
|
|
- filePath: path,
|
|
|
- fileType: 'pdf',
|
|
|
- success: (res) => {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- });
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- uni.showToast({
|
|
|
- title: '打开文件失败',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- console.log(err);
|
|
|
- uni.showToast({
|
|
|
- title: '下载文件失败',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|