撤回pdf修改

This commit is contained in:
田岩
2025-09-05 17:56:43 +08:00
parent bff2099444
commit 4a9bdedb74
2 changed files with 57 additions and 72 deletions
-30
View File
@@ -24,36 +24,6 @@ export const useAccountLoginApp = (data) => request({
}) => {
if (rtnCode === '0000') {
setToken(body)
// 获取科技鹿
// queryCurrentValidMascotInfo().then(({body}) => {
// const userInfo = getUserInfo()
// setUserInfo({
// ...userInfo,
// 'mascotInfo': body
// })
// const userInfo2 = getUserInfo()
// console.log('设置科技鹿', userInfo2);
// if (body.imgAddr) {
// setTimeout(() => {
// const img = new Image(); // 创建Image对象
// // 图片加载成功(缓存完成)
// img.onload = () => {
// console.log(`图片缓存成功: ${url}`);
// resolve(img); // 返回加载完成的Image对象
// };
// // 图片加载失败
// img.onerror = () => {
// console.error(`图片缓存失败: ${url}`);
// reject(new Error(`Failed to load image: ${url}`));
// };
// // 开始加载图片(设置src触发请求,浏览器会自动缓存)
// img.src = url;
// })
// }
// })
// const user_data = await queryCurrentUser()
const res = await Promise.all([queryCurrentUser(), queryCurrentValidMascotInfo()])
const userInfo = getUserInfo()
const mascotInfo = res[1]
+57 -42
View File
@@ -1,19 +1,23 @@
<template>
<view class="popup-view">
<view class="body-title">
<uv-icon class="arrow-icon" name="arrow-left" @click="backRouter()" />
文件预览
</view>
<view class="body-title">
<uv-icon class="arrow-icon" name="arrow-left" @click="backRouter()" />
文件预览
</view>
<view class="popup-view-preview" v-if="showView">
<web-view :src="showUrl" :fullscreen="true" :webview-styles="{
width: '100%',
height: '100%'
}"></web-view>
<web-view
:src="showUrl"
:fullscreen="true"
:webview-styles="{
width: '100%',
height: '100%'
}"
></web-view>
</view>
</view>
</template>
<script >
<script>
import {
getToken
} from "@/common/common.js"
@@ -24,7 +28,7 @@
import {
get_base_url
} from '@/api/request.js'
var wv
var wv
export default{
data(){
return {
@@ -45,7 +49,7 @@
},
onReady(){
//#ifdef APP-PLUS
var currentWebview = this.$scope.$getAppWebview()
var currentWebview = this.$scope.$getAppWebview()
setTimeout(()=>{
wv = currentWebview.children()[0]
wv.setStyle({
@@ -66,11 +70,11 @@
},
openPdfFn(data){
const base_url = get_base_url('/traask/traFilePreview/')
const token = getToken();
const header = {};
const token = getToken();
const header = {};
let _id = data?.fileId
let fileUrl = base_url + '/traask/traFilePreview/' + _id
if (token)
if (token)
header['summary'] = token
uni.downloadFile({
//需要预览的文件地址
@@ -78,13 +82,24 @@
header: header,
success: (res) => {
//下载成功,得到文件临时地址
//条件编译,若为h5端则直接赋值文件地址
//条件编译,若为h5端则直接赋值文件地址
// #ifdef H5
let newUrl = res.tempFilePath
// #endif
//条件编译,若为App端,则需要将本地文件系统URL转换为平台绝对路径
//条件编译,若为App端,则需要将本地文件系统URL转换为平台绝对路径
// #ifdef APP-PLUS
console.log('getFileInfo', res);
uni.getFileInfo({
res.tempFilePath,
success: (ress) => {
console.log('success', ress);
},
fail: (ress) => {
console.log('fail', ress);
}
})
let newUrl = plus.io.convertLocalFileSystemURL(res.tempFilePath)
console.log('newUrl', newUrl);
// #endif
this.showUrl = this.viewerUrl + '?file=' + newUrl
this.showView = true
@@ -96,32 +111,32 @@
</script>
<style lang="scss" scoped>
.popup-view{
.popup-view {
width: 100vw;
height: 100vh;
}
.body-title {
height: 90rpx;
text-align: center;
font-size: 33rpx;
padding-top: 10rpx;
line-height: 46rpx;
box-sizing: border-box;
font-weight: 500;
color: #000;
position: fixed;
top: var(--status-bar-height);
left: 0;
width: 100vw;
z-index: 10000;
// margin-bottom: 23rpx;
.arrow-icon {
position: absolute;
left: 21rpx;
top: 5rpx;
color: #000;
padding: 15rpx;
// background-color: red;
}
}
</style>
.body-title {
height: 90rpx;
text-align: center;
font-size: 33rpx;
padding-top: 10rpx;
line-height: 46rpx;
box-sizing: border-box;
font-weight: 500;
color: #000;
position: fixed;
top: var(--status-bar-height);
left: 0;
width: 100vw;
z-index: 10000;
// margin-bottom: 23rpx;
.arrow-icon {
position: absolute;
left: 21rpx;
top: 5rpx;
color: #000;
padding: 15rpx;
// background-color: red;
}
}
</style>