Merge remote-tracking branch 'LionLi/dev' into dev

This commit is contained in:
phanes 2021-11-09 21:43:12 +08:00
commit 53e844ee9f
8 changed files with 18 additions and 11 deletions

View File

@ -24,7 +24,7 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
private UploadManager uploadManager;
private BucketManager bucketManager;
private String token;
private Auth auth;
@Override
public void init(CloudStorageProperties cloudStorageProperties) {
@ -35,9 +35,8 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
config.useHttpsDomains = false;
config.useHttpsDomains = "Y".equals(properties.getIsHttps());
uploadManager = new UploadManager(config);
Auth auth = Auth.create(properties.getAccessKey(), properties.getSecretKey());
auth = Auth.create(properties.getAccessKey(), properties.getSecretKey());
String bucketName = properties.getBucketName();
token = auth.uploadToken(bucketName);
bucketManager = new BucketManager(auth, config);
if (!ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
@ -69,9 +68,10 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
@Override
public UploadResult upload(byte[] data, String path, String contentType) {
try {
Response res = uploadManager.put(data, path, token, null, contentType, false);
String token = auth.uploadToken(properties.getBucketName());
Response res = uploadManager.put(data, path, token, null, contentType, false);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
throw new RuntimeException("上传七牛出错:" + res.error);
}
} catch (Exception e) {
throw new OssException("上传文件失败,请核对七牛配置信息:[" + e.getMessage() + "]");
@ -85,7 +85,7 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
path = path.replace(getEndpointLink() + "/", "");
Response res = bucketManager.delete(properties.getBucketName(), path);
if (!res.isOK()) {
throw new RuntimeException("删除七牛文件出错:" + res.toString());
throw new RuntimeException("删除七牛文件出错:" + res.error);
}
} catch (Exception e) {
throw new OssException(e.getMessage());

View File

@ -7,6 +7,9 @@ ENV = 'development'
# 若依管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
# 应用访问路径 例如使用前缀 /admin/index
VUE_APP_CONTEXT_PATH = '/index'
# 监控地址
VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/login'

View File

@ -4,6 +4,9 @@ VUE_APP_TITLE = RuoYi-Vue-Plus后台管理系统
# 生产环境配置
ENV = 'production'
# 应用访问路径 例如使用前缀 /admin/index
VUE_APP_CONTEXT_PATH = '/index'
# 监控地址
VUE_APP_MONITRO_ADMIN = '/admin/login'

View File

@ -6,6 +6,9 @@ NODE_ENV = production
# 测试环境配置
ENV = 'staging'
# 应用访问路径 例如使用前缀 /admin/index
VUE_APP_CONTEXT_PATH = '/index'
# 监控地址
VUE_APP_MONITRO_ADMIN = '/admin/login'

View File

@ -102,7 +102,7 @@ export default {
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = this.$router.options.base + '/index';
location.href = process.env.VUE_APP_CONTEXT_PATH;
})
}).catch(() => {});
}

View File

@ -167,7 +167,6 @@ export const constantRoutes = [
]
export default new Router({
base: "", // 项目前缀 与 publicPath 同步 例如 /api
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes

View File

@ -65,7 +65,7 @@ service.interceptors.response.use(res => {
}
).then(() => {
store.dispatch('LogOut').then(() => {
location.href = this.$router.options.base + '/index';
location.href = process.env.VUE_APP_CONTEXT_PATH;
})
}).catch(() => {});
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')

View File

@ -16,8 +16,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
// 设置基路径参考文档: http://doc.ruoyi.vip/ruoyi-vue/document/qdsc.html#应用路径
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
publicPath: process.env.VUE_APP_CONTEXT_PATH,
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)