Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop

This commit is contained in:
田岩
2025-11-28 16:04:29 +08:00
6 changed files with 67 additions and 85 deletions
+23 -22
View File
@@ -305,28 +305,29 @@ export const previewFileFnc = ({
}) => {
let userInfo = getUserInfo()
let userParams = '/' + (userInfo?.loginName ?? '')
if (getPhoneEnvBool('AND')) {
navigateTo('/pages/index/preview?fileId=' + fileId + '&fileApiSrc=' + getFileSrc);
} else {
if (isDownloading) return
const base_url = get_base_url(getFileSrc);
let fileUrl = base_url + getFileSrc + fileId + userParams;
const localFilePath = '_doc/pdf_view/' + fileName + '.pdf';
isDownloading = true
downloadFileFnc(fileUrl, localFilePath).then((res) => {
uni.openDocument({
filePath: res,
showMenu: true,
success: function() {
console.log('打开文档成功');
}
})
}).finally(() => {
setTimeout(() => {
isDownloading = false
}, 1000)
});
}
navigateTo('/pages/index/preview?fileId=' + fileId + '&fileApiSrc=' + getFileSrc);
// if (getPhoneEnvBool('AND')) {
// navigateTo('/pages/index/preview?fileId=' + fileId + '&fileApiSrc=' + getFileSrc);
// } else {
// if (isDownloading) return
// const base_url = get_base_url(getFileSrc);
// let fileUrl = base_url + getFileSrc + fileId + userParams;
// const localFilePath = '_doc/pdf_view/' + fileName + '.pdf';
// isDownloading = true
// downloadFileFnc(fileUrl, localFilePath).then((res) => {
// uni.openDocument({
// filePath: res,
// showMenu: true,
// success: function() {
// console.log('打开文档成功');
// }
// })
// }).finally(() => {
// setTimeout(() => {
// isDownloading = false
// }, 1000)
// });
// }
}
const downloadFileFnc = async (fileUrl, localFilePath) => {
try {
+17 -16
View File
@@ -465,22 +465,23 @@
});
break;
case 'preview':
if (getPhoneEnvBool('AND')) {
common.navigateTo('/pages/index/preview?fileId=' + info.docId);
} else {
const base_url = get_base_url('/traask/traFilePreview/');
let fileUrl = base_url + '/traask/traFilePreview/' + info.docId + userParams;
const localFilePath = '_doc/pdf_view/' + info.docName + '.pdf';
downloadAndSaveAvatar(fileUrl, localFilePath).then((res) => {
uni.openDocument({
filePath: res,
showMenu: true,
success: function() {
console.log('打开文档成功');
}
});
});
}
common.navigateTo('/pages/index/preview?fileId=' + info.docId);
// if (getPhoneEnvBool('AND')) {
// common.navigateTo('/pages/index/preview?fileId=' + info.docId);
// } else {
// const base_url = get_base_url('/traask/traFilePreview/');
// let fileUrl = base_url + '/traask/traFilePreview/' + info.docId + userParams;
// const localFilePath = '_doc/pdf_view/' + info.docName + '.pdf';
// downloadAndSaveAvatar(fileUrl, localFilePath).then((res) => {
// uni.openDocument({
// filePath: res,
// showMenu: true,
// success: function() {
// console.log('打开文档成功');
// }
// });
// });
// }
break;
case 'toCourse':
console.log(type, data, id);
+24 -41
View File
@@ -492,47 +492,30 @@
});
break;
case 'preview':
if (getPhoneEnvBool('AND')) {
common.navigateTo('/pages/index/preview?fileId=' + info.docId);
} else {
if(isDownloading.value) return
const base_url = get_base_url('/traask/traFilePreview/');
let fileUrl = base_url + '/traask/traFilePreview/' + info.docId + userParams;
const localFilePath = '_doc/pdf_view/' + info.docName + '.pdf';
isDownloading.value = true
downloadAndSaveAvatar(fileUrl, localFilePath).then((res) => {
uni.openDocument({
filePath: res,
showMenu: true,
success: function () {
console.log('打开文档成功');
}
})
}).finally(()=>{
setTimeout(()=>{
isDownloading.value = false
},1000)
});
// uni.downloadFile({
// url: fileUrl,
// success: function (res) {
// uni.saveFile({
// tempFilePath: res.tempFilePath,
// success: function (resS) {
// var filePath = resS.savedFilePath
// uni.openDocument({
// filePath: filePath,
// showMenu: true,
// success: function () {
// console.log('打开文档成功')
// }
// })
// }
// })
// }
// })
}
common.navigateTo('/pages/index/preview?fileId=' + info.docId);
// if (getPhoneEnvBool('AND')) {
// common.navigateTo('/pages/index/preview?fileId=' + info.docId);
// } else {
// common.navigateTo('/pages/index/preview?fileId=' + info.docId); return
// if(isDownloading.value) return
// const base_url = get_base_url('/traask/traFilePreview/');
// let fileUrl = base_url + '/traask/traFilePreview/' + info.docId + userParams;
// const localFilePath = '_doc/pdf_view/' + info.docName + '.pdf';
// isDownloading.value = true
// downloadAndSaveAvatar(fileUrl, localFilePath).then((res) => {
// uni.openDocument({
// filePath: res,
// showMenu: true,
// success: function () {
// console.log('打开文档成功');
// }
// })
// }).finally(()=>{
// setTimeout(()=>{
// isDownloading.value = false
// },1000)
// });
// }
break;
case 'toCourse':
console.log(type, data, id);
+2 -2
View File
@@ -30,7 +30,7 @@ export default {
showUrl: '',
// viewerUrl: '/static/pdf-view/web/viewer.html',
viewerUrl: '/static/view-pdf/pdf.html',
showView: false,
showView: true,
wv: null,
userParams: ''
}
@@ -64,7 +64,7 @@ export default {
wv.setStyle({
top: 80
})
uni.onKeyboardHeightChange(setHeight)
uni.onKeyboardHeightChange(this.setHeight)
}, 1000)
// #endif
},
-3
View File
@@ -67,9 +67,6 @@
traId: traId.value,
talkingType: isPreview.value? 'preview' : 'practice'
}).then(res=>{
watchFlag.value = 1;
socketStore?.closeSocket();
changePlayItemId('')
common.navigateTo('/pages/sparring/result?isOver=1&traId='
+ traId.value
+ '&execId='