调整合同预览PDF插件
This commit is contained in:
@@ -10,8 +10,8 @@ import router from '../router'
|
||||
|
||||
// 基础配置
|
||||
const config = {
|
||||
// apiUrl : 'https://douhuo.douhuofalv.com/api/',
|
||||
apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境
|
||||
apiUrl : 'https://douhuo.douhuofalv.com/api/',
|
||||
// apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境
|
||||
timeout : 60000
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name" : "抖火",
|
||||
"appid" : "__UNI__C305C03",
|
||||
"description" : "纵有疾风起,人生不言弃",
|
||||
"versionName" : "1.4.3",
|
||||
"versionName" : "1.4.4",
|
||||
"versionCode" : 104,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
@@ -108,6 +108,20 @@
|
||||
"pid" : "11384",
|
||||
"parameters" : {}
|
||||
}
|
||||
},
|
||||
"Html5App-openFile" : {
|
||||
"__plugin_info__" : {
|
||||
"name" : "Android 和 IOS 办公Office文档 doc docx ppt pdf 浏览支持离线浏览",
|
||||
"description" : "支持格式:doc,docx,ppt,pptx,xls,xlsx,txt,pdf,epub,支持64位手机",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "https://ext.dcloud.net.cn/plugin?id=477",
|
||||
"android_package_name" : "io.douhuofalv.com",
|
||||
"ios_bundle_id" : "io.douhuofalv.com",
|
||||
"isCloud" : true,
|
||||
"bought" : 1,
|
||||
"pid" : "477",
|
||||
"parameters" : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
</view>
|
||||
<radio class="choose-radio" value="code"></radio>
|
||||
</label> -->
|
||||
<!--
|
||||
<label class="choose-item nowrap" v-if="Number(total) <= 5000">
|
||||
<view class="choose-text">
|
||||
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
|
||||
支付宝支付
|
||||
</view>
|
||||
<radio class="choose-radio" value="ali" :checked="payMethod == 'ali'"></radio>
|
||||
</label> -->
|
||||
</label>
|
||||
<label class="choose-item nowrap">
|
||||
<view class="choose-text">
|
||||
<image src="@/static/icons/pay_wechat.png" mode="aspectFill"></image>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<!-- 合同文件 -->
|
||||
<view class="files-title">合同文件列表</view>
|
||||
<view class="files">
|
||||
<view class="files-flex" v-for="(item, index) in files" :key="index" @click="onPdf(item.fileName, item.downloadUrl)">
|
||||
<view class="files-flex" v-for="(item, index) in files" :key="index" @click="isX5(item.fileName, item.downloadUrl)">
|
||||
<view class="files-flex-title">{{item.fileName}}</view>
|
||||
<view class="files-flex-id">{{item.fileId}}</view>
|
||||
<u-icon class="files-flex-icon" name="arrow-right" size="28rpx"></u-icon>
|
||||
@@ -35,7 +35,7 @@
|
||||
<!-- 附件文件 -->
|
||||
<view class="files-title">附件文件列表</view>
|
||||
<view class="files">
|
||||
<view class="files-flex" v-for="(item, index) in attachments" :key="index" @click="onPdf(item.fileName, item.downloadUrl)">
|
||||
<view class="files-flex" v-for="(item, index) in attachments" :key="index" @click="isX5(item.fileName, item.downloadUrl)">
|
||||
<view class="files-flex-title">{{item.fileName}}</view>
|
||||
<view class="files-flex-id">{{item.fileId}}</view>
|
||||
<u-icon class="files-flex-icon" name="arrow-right" size="28rpx"></u-icon>
|
||||
@@ -45,7 +45,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const plugin = uni.requireNativePlugin('Pdf-Plugin')
|
||||
// const plugin = uni.requireNativePlugin('Pdf-Plugin')
|
||||
const open = uni.requireNativePlugin("Html5App-openFile");
|
||||
|
||||
import { getFlows } from '@/apis/interfaces/user.js'
|
||||
export default {
|
||||
data() {
|
||||
@@ -88,14 +90,77 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onPdf(name, url){
|
||||
plugin.showPdf({
|
||||
title : name,
|
||||
url : url,
|
||||
maxScale : '20',
|
||||
waterMark : '河北抖火法律咨询服务有限公司',
|
||||
// this.user.name + ' ' + this.user.mobile,
|
||||
isX5(name, url){
|
||||
// #ifdef APP-PLUS
|
||||
if (uni.getSystemInfoSync().platform === 'android') {
|
||||
let iswxX5 = open.isLoadTbs();
|
||||
if(!iswxX5){
|
||||
uni.showLoading({
|
||||
title: '内核下载中...',
|
||||
mask : true
|
||||
})
|
||||
uni.downloadFile({
|
||||
url : 'https://douhuo-storage.oss-cn-beijing.aliyuncs.com/tbs_core_046239_20230210162827_nolog_fs_obfs_arm64-v8a_release.tbs',
|
||||
success : x5 => {
|
||||
open.installLocalTbs({
|
||||
tbsFilePath : plus.io.convertLocalFileSystemURL(x5.tempFilePath),
|
||||
isdelete : true
|
||||
}, (installTabsRes) => {
|
||||
switch(installTabsRes.code){
|
||||
case '1':
|
||||
uni.showLoading({
|
||||
title: '内核安装中...',
|
||||
mask : true
|
||||
})
|
||||
break;
|
||||
case '0':
|
||||
this.onPdf(name, url)
|
||||
break;
|
||||
case '-2':
|
||||
uni.showToast({
|
||||
title: '工具安装失败,请稍后重试, 错误码: ' + installTabsRes.msg,
|
||||
})
|
||||
break;
|
||||
default:
|
||||
uni.showToast({
|
||||
title: installTabsRes.msg,
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail : x5Err => {
|
||||
uni.showToast({
|
||||
title: '工具安装失败,合同打开失败,请检查您的网络并稍后重试',
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
this.onPdf(name, url)
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
onPdf(name, url){
|
||||
uni.downloadFile({
|
||||
url,
|
||||
success: path => {
|
||||
open.openFile({
|
||||
filename : plus.io.convertLocalFileSystemURL(path.tempFilePath),
|
||||
isShowBackIcon : true
|
||||
}, res => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
})
|
||||
// plugin.showPdf({
|
||||
// title : name,
|
||||
// url : url,
|
||||
// maxScale : '20',
|
||||
// waterMark : '河北抖火法律咨询服务有限公司',
|
||||
// // this.user.name + ' ' + this.user.mobile,
|
||||
// })
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
|
||||
Reference in New Issue
Block a user