修改预览模式

This commit is contained in:
yangjun 2025-01-16 10:04:54 +08:00
parent 6b8f6ce299
commit 3e6aa172e9
3 changed files with 19 additions and 41 deletions

View File

@ -362,14 +362,14 @@ async function handleShangchuan(record) {
function handlePreview(record) { function handlePreview(record) {
const parts = record.stuFilePath.split('.'); const parts = record.stuFilePath.split('.');
const filetype = parts[parts.length - 1]; const filetype = parts[parts.length - 1];
if(filetype=='jpg' || filetype=='png' || filetype=='jpeg' || filetype=='xls' || filetype=='xlsx' || filetype=='text' ){ if(filetype=='jpg' || filetype=='png' || filetype=='jpeg' || filetype=='xls' || filetype=='xlsx' || filetype=='text' || filetype=='doc' || filetype=='docx' || filetype=='pdf'){
var file = baseApiUrl + "/"+record.stuFilePath; var file = baseApiUrl + "/"+record.stuFilePath;
console.log('🤬', file); console.log('🤬', file);
window.open('https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file))); window.open('https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file)));
}else if(filetype=='doc' || filetype=='docx' || filetype=='pdf'){ // }else if(filetype=='doc' || filetype=='docx' || filetype=='pdf'){
var url2 = getFileAccessHttpUrl(record.stuPdfPath); // var url2 = getFileAccessHttpUrl(record.stuPdfPath);
let url = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(url2); // let url = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(url2);
window.open(url, '_blank'); // window.open(url, '_blank');
}else{ }else{
createMessage.error('暂不支持该文件预览!'); createMessage.error('暂不支持该文件预览!');
} }

View File

@ -318,14 +318,6 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<!-- <a-col :span="24">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQueryZyxq">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" style="margin-left: 8px"> 导出</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="batchHandleFabu" style="margin-left: 8px">发布成绩</a-button> -->
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="batchHandleKhcl" style="margin-left: 8px">上传考核材料</a-button> -->
<!-- <span class="tishi" style="margin-left: 20px; padding: 10px">温馨提示作业完成后请及时发布评分</span>
</a-col> -->
</a-row> </a-row>
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24" :lg="{ span: 16 }"> <a-col :span="24" :lg="{ span: 16 }">
@ -930,34 +922,16 @@ function handleDown(text) {
// //
function yulanFile(record) { function yulanFile(record) {
console.log('🙇‍♀️', record); console.log('🙇‍♀️', record);
if (record.pdfPath) {
var url2 = getFileAccessHttpUrl(record.pdfPath);
let url = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(url2);
window.open(url, '_blank');
} else {
const parts = record.filePath.split('.'); const parts = record.filePath.split('.');
const filetype = parts[parts.length - 1]; const filetype = parts[parts.length - 1];
if (filetype == 'jpg' || filetype == 'png' || filetype == 'jpeg' || filetype == 'xls' || filetype == 'xlsx' || filetype == 'text') { if(filetype=='jpg' || filetype=='png' || filetype=='jpeg' || filetype=='xls' || filetype=='xlsx' || filetype=='text' || filetype=='doc' || filetype=='docx' || filetype=='pdf'){
imgvisible.value = true; var file = baseApiUrl + "/"+record.filePath;
var url2 = getFileAccessHttpUrl(record.filePath); console.log('🤬', file);
console.log('👀', url2); window.open('https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file)));
ylimgurl.value = url2;
// var file = baseApiUrl + "/"+record.filePath;
// console.log('🤬', file);
// window.open('https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file)));
// var url2 = getFileAccessHttpUrl(record.filePath);
// let url = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(url2);
// window.open(url, '_blank');
} else if (filetype == 'doc' || filetype == 'docx' || filetype == 'pdf') {
var url2 = getFileAccessHttpUrl(record.pdfPath);
let url = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(url2);
window.open(url, '_blank');
} else { } else {
createMessage.error('当前作业不支持预览,请下载后查阅!'); createMessage.error('当前作业不支持预览,请下载后查阅!');
} }
} }
}
// //
async function handleBohui(record: Recordable) { async function handleBohui(record: Recordable) {
createConfirm({ createConfirm({

View File

@ -86,6 +86,7 @@
import { useGlobSetting } from '/@/hooks/setting'; import { useGlobSetting } from '/@/hooks/setting';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { getToken } from '/@/utils/auth'; import { getToken } from '/@/utils/auth';
import { encryptByBase64 } from '/@/utils/cipher';
const props = defineProps({ const props = defineProps({
formDisabled: { type: Boolean, default: false }, formDisabled: { type: Boolean, default: false },
@ -199,9 +200,12 @@ function rotateImage2() {
showType.value = '2'; showType.value = '2';
}else if(filetype=='doc' || filetype=='docx' || filetype=='pdf'){ }else if(filetype=='doc' || filetype=='docx' || filetype=='pdf'){
showType.value = '1'; showType.value = '1';
var file2 = getFileAccessHttpUrl(record.pdfPath); // var file2 = getFileAccessHttpUrl(record.pdfPath);
let url2 = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(file2); // let url2 = baseApiUrl + '/generic/web/viewer.html?file=' + encodeURIComponent(file2);
ylurl.value = url2; var file3 = baseApiUrl + "/"+record.filePath;
let url3 = 'https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file3));
ylurl.value = url3;
}else if(filetype=='mp4'|| filetype=='avi'|| filetype=='mp3'|| filetype=='wav'){ }else if(filetype=='mp4'|| filetype=='avi'|| filetype=='mp3'|| filetype=='wav'){
showType.value = '3'; showType.value = '3';