Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

 Conflicts:
	pom.xml
	ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java
	ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
	ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java
	ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
	ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java
	ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
	ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
	ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
	ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
	ruoyi-ui/src/layout/components/Settings/index.vue
	ruoyi-ui/src/plugins/download.js
	ruoyi-ui/src/store/modules/permission.js
	ruoyi-ui/src/views/index.vue
	ruoyi-ui/src/views/monitor/server/index.vue
	ruoyi-ui/src/views/system/role/index.vue
	ry.bat
This commit is contained in:
疯狂的狮子Li
2021-10-25 18:24:55 +08:00
16 changed files with 144 additions and 57 deletions

View File

@ -1,6 +1,7 @@
import { saveAs } from 'file-saver'
import axios from 'axios'
import { getToken } from '@/utils/auth'
import { Message } from 'element-ui'
const baseURL = process.env.VUE_APP_BASE_API
@ -35,9 +36,14 @@ export default {
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then(res => {
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
this.saveAs(blob, decodeURI(res.headers['download-filename']))
}).then(async (res) => {
const isLogin = await this.blobValidate(res.data);
if (isLogin) {
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
this.saveAs(blob, decodeURI(res.headers['download-filename']))
} else {
Message.error('无效的会话,或者会话已过期,请重新登录。');
}
})
},
oss(ossId) {
@ -47,9 +53,14 @@ export default {
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then(res => {
const blob = new Blob([res.data], { type: 'application/octet-stream' })
this.saveAs(blob, decodeURI(res.headers['download-filename']))
}).then(async (res) => {
const isLogin = await this.blobValidate(res.data);
if (isLogin) {
const blob = new Blob([res.data], { type: 'application/octet-stream' })
this.saveAs(blob, decodeURI(res.headers['download-filename']))
} else {
Message.error('无效的会话,或者会话已过期,请重新登录。');
}
})
},
zip(url, name) {
@ -59,13 +70,27 @@ export default {
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then(res => {
const blob = new Blob([res.data], { type: 'application/zip' })
this.saveAs(blob, name)
}).then(async (res) => {
const isLogin = await this.blobValidate(res.data);
if (isLogin) {
const blob = new Blob([res.data], { type: 'application/zip' })
this.saveAs(blob, name)
} else {
Message.error('无效的会话,或者会话已过期,请重新登录。');
}
})
},
saveAs(text, name, opts) {
saveAs(text, name, opts);
}
},
async blobValidate(data) {
try {
const text = await data.text();
JSON.parse(text);
return false;
} catch (error) {
return true;
}
},
}