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_FILE_API = 'http://122.51.230.86:9000/'
VUE_APP_PREVIEW_URL = 'https://www.nuoyunr.com/minio/' VUE_APP_PREVIEW_URL = 'https://www.nuoyunr.com/minio/'
VUE_APP_IMAGE_URL = 'http://122.51.230.86:9000' 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 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 = 'https://www.nuoyunr.com/minio/'
VUE_APP_FILE_API = 'http://122.51.230.86:9000/' VUE_APP_FILE_API = 'http://122.51.230.86:9000/'
VUE_APP_PREVIEW_URL = 'https://www.nuoyunr.com/minio/' 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' VUE_APP_APP_NAME ='yudao-admin'

View File

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