mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
Merge remote-tracking branch 'origin/master' into dev
This commit is contained in:
commit
c5f29f18d3
2
pom.xml
2
pom.xml
@ -29,7 +29,7 @@
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>1.6.5-snapshot</revision>
|
||||
<revision>1.6.6-snapshot</revision>
|
||||
<!-- Maven 相关 -->
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>1.6.5-snapshot</revision>
|
||||
<revision>1.6.6-snapshot</revision>
|
||||
<!-- 统一依赖管理 -->
|
||||
<spring.boot.version>2.7.7</spring.boot.version>
|
||||
<!-- Web 相关 -->
|
||||
|
@ -9,10 +9,11 @@ import io.minio.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import static cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig.ENDPOINT_ALIYUN;
|
||||
import static cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig.ENDPOINT_TENCENT;
|
||||
|
||||
/**
|
||||
* 基于 S3 协议的文件客户端,实现 MinIO、阿里云、腾讯云、七牛云、华为云等云服务
|
||||
*
|
||||
* <p>
|
||||
* S3 协议的客户端,采用亚马逊提供的 software.amazon.awssdk.s3 库
|
||||
*
|
||||
* @author 芋道源码
|
||||
@ -78,6 +79,11 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> {
|
||||
.replaceAll("-internal", "")// 去除内网 Endpoint 的后缀
|
||||
.replaceAll("https://", "");
|
||||
}
|
||||
// 腾讯云必须有 region,否则会报错
|
||||
if (config.getEndpoint().contains(ENDPOINT_TENCENT)) {
|
||||
return StrUtil.subAfter(config.getEndpoint(), ".cos.", false)
|
||||
.replaceAll("." + ENDPOINT_TENCENT, ""); // 去除 Endpoint
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ public class S3FileClientConfig implements FileClientConfig {
|
||||
|
||||
public static final String ENDPOINT_QINIU = "qiniucs.com";
|
||||
public static final String ENDPOINT_ALIYUN = "aliyuncs.com";
|
||||
public static final String ENDPOINT_TENCENT = "myqcloud.com";
|
||||
|
||||
/**
|
||||
* 节点地址
|
||||
|
@ -75,7 +75,7 @@ public class ConfigController {
|
||||
if (config == null) {
|
||||
return null;
|
||||
}
|
||||
if (config.getVisible()) {
|
||||
if (!config.getVisible()) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||
}
|
||||
return success(config.getValue());
|
||||
|
@ -1,11 +1,14 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.file;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.file.core.client.db.DBFileContentFrameworkDAO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
|
||||
@ -27,9 +30,11 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
|
||||
|
||||
@Override
|
||||
public byte[] selectContent(Long configId, String path) {
|
||||
FileContentDO fileContentDO = fileContentMapper.selectOne(
|
||||
buildQuery(configId, path).select(FileContentDO::getContent));
|
||||
return fileContentDO != null ? fileContentDO.getContent() : null;
|
||||
List<FileContentDO> list = fileContentMapper.selectList(
|
||||
buildQuery(configId, path).select(FileContentDO::getContent).orderByDesc(FileContentDO::getId));
|
||||
return Optional.ofNullable(CollUtil.getFirst(list))
|
||||
.map(FileContentDO::getContent)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<FileContentDO> buildQuery(Long configId, String path) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yudao-ui-admin-vue3",
|
||||
"version": "1.6.5-snapshot.1901",
|
||||
"version": "1.6.6-snapshot.1901",
|
||||
"description": "基于vue3、vite4、element-plus、typesScript",
|
||||
"author": "xingyu",
|
||||
"private": false,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yudao-ui-admin",
|
||||
"version": "1.6.5-snapshot",
|
||||
"version": "1.6.6-snapshot",
|
||||
"description": "芋道管理系统",
|
||||
"author": "芋道",
|
||||
"license": "MIT",
|
||||
|
@ -1,14 +1,16 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<doc-alert title="上传下载" url="https://doc.iocoder.cn/file/" />
|
||||
<doc-alert title="上传下载" url="https://doc.iocoder.cn/file/"/>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="文件路径" prop="path">
|
||||
<el-input v-model="queryParams.path" placeholder="请输入文件路径" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
@ -35,6 +37,9 @@
|
||||
<template v-slot="scope">
|
||||
<image-preview v-if="scope.row.type&&scope.row.type.indexOf('image/') === 0" :src="scope.row.url"
|
||||
:width="'100px'"></image-preview>
|
||||
<video v-else-if="scope.row.type&&scope.row.type.indexOf('video/') === 0" :width="'100px'">
|
||||
<source :src="scope.row.url"/>
|
||||
</video>
|
||||
<i v-else>无法预览,点击
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" target="_blank"
|
||||
:href="getFileUrl + scope.row.configId + '/get/' + scope.row.path">下载
|
||||
@ -118,7 +123,7 @@ export default {
|
||||
title: "", // 弹出层标题
|
||||
isUploading: false, // 是否禁用上传
|
||||
url: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/upload", // 请求地址
|
||||
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
||||
headers: {Authorization: "Bearer " + getAccessToken()}, // 设置上传的请求头部
|
||||
data: {} // 上传的额外数据,用于文件名
|
||||
},
|
||||
};
|
||||
@ -189,19 +194,20 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除文件编号为"' + id + '"的数据项?').then(function() {
|
||||
this.$modal.confirm('是否确认删除文件编号为"' + id + '"的数据项?').then(function () {
|
||||
return deleteFile(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
// 用户昵称展示
|
||||
sizeFormat(row, column) {
|
||||
const unitArr = ["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];
|
||||
const unitArr = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||
const srcSize = parseFloat(row.size);
|
||||
const index = Math.floor(Math.log(srcSize) / Math.log(1024));
|
||||
let size =srcSize/Math.pow(1024,index);
|
||||
let size = srcSize / Math.pow(1024, index);
|
||||
size = size.toFixed(2);//保留的小数位数
|
||||
return size + ' ' + unitArr[index];
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user