This commit is contained in:
许允枞 2025-03-24 14:13:15 +08:00
parent 7fc1979928
commit 4e159b12fd
4 changed files with 28 additions and 11 deletions

View File

@ -12,6 +12,7 @@ VUE_APP_BASE_API = 'http://localhost:48080'
VUE_APP_FILE_API = 'http://122.51.230.86:9000/'
VUE_APP_PREVIEW_URL = 'https://www.nuoyunr.com/minio/'
VUE_APP_IMAGE_URL = 'http://122.51.230.86:9000'
VUE_APP_INSPECTION_FILE_URL = 'http://lanan-file.lighting-it.cn/'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -14,6 +14,7 @@ PUBLIC_PATH = 'http://159.75.168.143:82'
# VUE_APP_FILE_API = 'https://www.nuoyunr.com/minio/'
VUE_APP_FILE_API = 'http://122.51.230.86:9000/'
VUE_APP_PREVIEW_URL = 'https://www.nuoyunr.com/minio/'
VUE_APP_INSPECTION_FILE_URL = 'http://lanan-file.lighting-it.cn/'
# 二级部署路径
VUE_APP_APP_NAME ='yudao-admin'

View File

@ -40,6 +40,7 @@ service.interceptors.request.use(config => {
// 设置租户
if (getTenantEnable()) {
const tenantId = getTenantId();
// console.log('请求时的租户id', tenantId)
if (tenantId) {
config.headers['tenant-id'] = tenantId;
}

View File

@ -106,23 +106,33 @@
<el-dialog :title="'文件预览(' + selectFile.fileName + ''" :visible.sync="isShowFile" width="70%" append-to-body>
<div class="preview-container">
<audio v-if="isAudioType" class="preview-iframe" controls>
<source :src="imageUrl + selectFile.filePath"/>
<source :src="selectFile.filePath.includes('http')
? inspectionFileUrl + selectFile.filePath.replace(/^.*?uploads\//, 'uploads/')
: imageUrl + selectFile.filePath"/>
</audio>
<!-- 左侧预览区域 -->
<iframe
:src="fileUrl"
frameborder="0"
class="preview-iframe" v-if="!isImage && selectFile.fileType != 'txt' && !isAudioType && selectFile.fileType != 'pdf'"
class="preview-iframe"
v-if="!isImage && selectFile.fileType != 'txt' && !isAudioType && selectFile.fileType != 'pdf'"
>
</iframe>
<image-preview
class="preview-iframe"
:src="selectFile.filePath.includes('http') ? selectFile.filePath : imageUrl + selectFile.filePath"
:src="selectFile.filePath.includes('http')
? inspectionFileUrl + selectFile.filePath.replace(/^.*?uploads\//, 'uploads/')
: imageUrl + selectFile.filePath"
v-if="isImage">
</image-preview>
<!-- 如果selectFile.filePath包含http就不拼接imageUrl -->
<!-- :src="selectFile.filePath.includes('http') ? selectFile.filePath : imageUrl + selectFile.filePath"
-->
<iframe
:src="imageUrl + selectFile.filePath"
:src="selectFile.filePath.includes('http')
? inspectionFileUrl + selectFile.filePath.replace(/^.*?uploads\//, 'uploads/')
: imageUrl + selectFile.filePath"
frameborder="0"
class="preview-iframe"
v-if="selectFile.fileType == 'txt' || selectFile.fileType == 'pdf'"
@ -239,7 +249,7 @@
</el-form-item>
<!-- 上传进度 -->
</el-form>
<!-- <el-progress v-if="uploadProgress !== null" :percentage="uploadProgress" />-->
<!-- <el-progress v-if="uploadProgress !== null" :percentage="uploadProgress" />-->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBatchForm"> </el-button>
<el-button @click="cancelBatch"> </el-button>
@ -265,17 +275,18 @@ import {
import inspFileUpload from '@/components/FileUpload/index.vue'
import {getAccessToken} from "@/utils/auth";
// import cos from "@/utils/cosUpload"
import cos from "@/utils/cos"
import cos from "@/utils/cos"
export default {
name: "InspectionFile",
components: {inspFileUpload},
data() {
return {
uploadProgress:0,
uploadProgress: 0,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/cosUpload",
imageUrl: process.env.VUE_APP_FILE_API,
previewUrl: process.env.VUE_APP_PREVIEW_URL,
inspectionFileUrl: process.env.VUE_APP_INSPECTION_FILE_URL,
//
loading: true,
//
@ -390,7 +401,10 @@ export default {
preview(item) {
console.log('预览文件地址', this.previewUrl)
this.fileUrl = 'https://view.officeapps.live.com/op/view.aspx?src=' +
(item.filePath.includes('http') ? item.filePath : this.previewUrl + item.filePath);
(item.filePath.includes('http')
? this.inspectionFileUrl + item.filePath.replace(/^.*?uploads\//, 'uploads/')
: this.previewUrl + item.filePath);
// this.fileUrl = 'https://view.xdocin.com/view?src=' + this.imageUrl + item.filePath
console.log(this.fileUrl)
@ -770,14 +784,14 @@ export default {
return reject();
}
this.$message.success("上传成功:" + data.Location);
this.fileList.push({ name: file.name, url: data.Location });
this.fileList.push({name: file.name, url: data.Location});
resolve();
}
);
});
},
// 使 cos-js-sdk
async uploadToCOS({ file }) {
async uploadToCOS({file}) {
const fileName = `files/${file.name}`; //
cos.putObject(
{
@ -887,7 +901,7 @@ export default {
// if (res.code === 0) {
// // edit by
// this.uploadList.push({name: res.data.name, url: res.data.url});
this.uploadedSuccessfully();
this.uploadedSuccessfully();
// } else {
// this.number--;
// this.$modal.closeLoading();