更换报告预览方式

main
yanzai 1 year ago
parent fe776cf4e1
commit 09c97ee942

@ -1,7 +1,7 @@
let url_ = "https://bjrrtj-api.sixinyun.com";
let report_url_ = "https://bjrrtj-api.sixinyun.com";
let h5_url_ = "https://bjrrtj-api.sixinyun.com";
const dev = 1;
const dev = 0;
if (dev === 1) {
url_ = "http://localbeijingrenren";
report_url_ = "http://192.168.31.106:5173";

@ -3,7 +3,7 @@ import {
} from '@/lu/axios.js'
import $api from './api.js'
let url_ = "https://bjrrtj-api.sixinyun.com";
const dev =1
const dev =0
if (dev === 1) {
url_ = "http://localbeijingrenren"
}

@ -34,6 +34,14 @@
"enablePullDownRefresh": false
}
},{
"path" : "pages/test/test",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}],
"subPackages": [{
"root": "pages/buy",

@ -0,0 +1,92 @@
<template>
<view>
<view v-if="downLoadOk==false" class="loading">...</view>
<view v-else class="tishi">
<view class="tishi2">
<view style=" transform: rotate(125deg) scaleX(2) scaleY(1);margin-bottom: 30%;margin-left: 30%; " ><uni-icons type="undo" size="100"></uni-icons></view>
<view>文档打开后</view>
<view>点击右上角按钮可下载或转发保存</view>
</view>
<view class="ok" @click="openfile()">
我知道了,打开文档
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
let downLoadOk = ref(false);
onLoad((e) => {
console.log(e)
tiao(e)
})
let filePath = ref('');
const tiao = (e) => {
console.log("开始下载")
uni.downloadFile({
url: e.url,
success: function(res) {
downLoadOk.value = true
filePath.value = res.tempFilePath;
},
});
}
const openfile = () => {
uni.openDocument({
filePath: filePath.value,
showMenu: true,
fileType:"pdf",
success: function(res) {
console.log("打开文档成功");
// wx.navigateBack({
// delta: 1
// })
},
});
}
</script>
<style scoped>
.loading {
margin-top: 200rpx;
width: 100%;
text-align: center;
}
.tishi {
width: 100%;
height: calc(100vh - 200rpx);
background-color: black;
opacity: 0.5;
color: #fff;
padding-top: 200rpx;
}
.tishi2 {
width: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
}
.ok {
width: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
border: 1px solid #fff;
margin-top: 70%;
padding: 20rpx;
border-radius: 20rpx;
}
</style>

@ -5,7 +5,8 @@
* date2023年3月19日 13:38:24
*/
import {
ref
ref,
onMounted
} from 'vue'
import {
$image,
@ -15,7 +16,7 @@
import {
onShow
} from '@dcloudio/uni-app'
import wx from 'weixin-js-sdk'
const props = defineProps({
list: {
type: Object,
@ -28,10 +29,11 @@
}
}
});
const popup=ref(null)
let url = ref('')
const ReportDown = async (id) => {
uni.showLoading({
title: '正在下载,请打开弹窗拦截'
title: '正在查询报告...'
})
const response = await ReportDownAction({
rid: props.list.info.id,
@ -41,7 +43,8 @@
uni.hideLoading()
$response(response, () => {
url.value = $image(response.data.url)
jianqieban(url.value)
popup.value.open()
//jianqieban(url.value)
})
}
const jianqieban = (url) => {
@ -82,10 +85,51 @@
}
});
}
let Env = ''
onMounted(() => {
console.log(props.list)
if(props.list && props.list.list.length>0){
}else{
uni.$lu.toast("暂无报告可下载")
}
Env = uni.getSystemInfoSync().platform
console.log(Env)
})
const tiao = (url) => {
console.log(url)
wx.miniProgram.navigateTo({
url: '/pages/test/test?url=' + url
})
}
const preview=()=>{
if(Env=='ios'){
//window.location.href = url.value
tiao(url.value)
}
if(Env=='android'){
tiao(url.value)
}
}
</script>
<template>
<view>
<view>
<uni-popup ref="popup">
<view class="tan">
<view class="t_row" @click="preview">
<view class="t_logo"><uni-icons type="eye-filled" color="#42b983" size="60rpx"></uni-icons>
</view>
<view class="t_title">报告预览</view>
</view>
<view class="t_row" v-if="Env != 'android'" @click="jianqieban(url)">
<view class="t_logo"><uni-icons type="download-filled" color="#42b983" size="60rpx"></uni-icons>
</view>
<view class="t_title">报告下载</view>
</view>
</view>
</uni-popup>
</view>
<view class="report_list_wrapper" v-if="props.list.list.length>0">
<view @click="ReportDown(i['文件Id'])" class="report_item_wrapper" v-for="(i,k) in props.list.list" :key="k">
<view class="report_item_icon_wrapper">
@ -182,4 +226,26 @@
color: #ccc;
padding-top: 60rpx;
}
.tan{
padding: 40rpx;
background-color: #fff;
border-radius: 5rpx;
}
.t_row{
display: flex;
font-size: 30rpx;
border: 1px solid #88ebd6;
border-radius: 5rpx;
margin: 40rpx;
padding: 10rpx 60rpx;
}
.t_logo{
color:#42b983;
margin-right: 20rpx;
}
.t_title{
font-size: 33rpx;
color:#333;
margin-top: 8rpx;
}
</style>

@ -1,5 +1,6 @@
{
"dependencies": {
"echarts": "^5.4.2"
"echarts": "^5.4.2",
"weixin-js-sdk": "^1.6.5"
}
}

@ -1,12 +1,23 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
echarts:
specifier: ^5.4.2
version: registry.npmmirror.com/echarts@5.4.2
weixin-js-sdk:
specifier: ^1.6.5
version: 1.6.5
packages:
/weixin-js-sdk@1.6.5:
resolution: {integrity: sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ==}
dev: false
registry.npmmirror.com/echarts@5.4.2:
resolution: {integrity: sha512-2W3vw3oI2tWJdyAz+b8DuWS0nfXtSDqlDmqgin/lfzbkB01cuMEN66KWBlmur3YMp5nEDEEt5s23pllnAzB4EA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/echarts/-/echarts-5.4.2.tgz}
name: echarts

Loading…
Cancel
Save