diff --git a/nezha-fronted/src/assets/css/components/common/login.scss b/nezha-fronted/src/assets/css/components/common/login.scss
index ba983f320..d915a9f64 100644
--- a/nezha-fronted/src/assets/css/components/common/login.scss
+++ b/nezha-fronted/src/assets/css/components/common/login.scss
@@ -164,7 +164,7 @@
text-align: center;
line-height: 30px;
display: flex;
- justify-content: space-around;
+ justify-content: space-between;
.license-info {
margin-bottom: 10px;
color: white;
diff --git a/nezha-fronted/src/components/common/login.vue b/nezha-fronted/src/components/common/login.vue
index 34e0407d5..7588803e6 100644
--- a/nezha-fronted/src/components/common/login.vue
+++ b/nezha-fronted/src/components/common/login.vue
@@ -31,7 +31,7 @@
-
+
{
- const fileName = 'Login' + '-' + this.getTimeString() + '.xml'
+ let fileName = this.licenseList.id + '-' + this.getTimeString() + '.xml'
+ const resFileName = res.headers['content-disposition'].split('=')[1]
+ if (resFileName) {
+ fileName = resFileName
+ }
if (window.navigator.msSaveOrOpenBlob) {
// 兼容ie11
- const blobObject = new Blob([res])
+ const blobObject = new Blob([res.data])
window.navigator.msSaveOrOpenBlob(blobObject, fileName)
} else {
- const url = URL.createObjectURL(new Blob([res]))
+ const url = URL.createObjectURL(new Blob([res.data]))
const a = document.createElement('a')
document.body.appendChild(a) // 此处增加了将创建的添加到body当中
a.href = url
diff --git a/nezha-fronted/src/components/page/config/system/license.vue b/nezha-fronted/src/components/page/config/system/license.vue
index 44a9b1d76..2b80d6aa0 100644
--- a/nezha-fronted/src/components/page/config/system/license.vue
+++ b/nezha-fronted/src/components/page/config/system/license.vue
@@ -194,13 +194,17 @@ export default {
},
downloadLicense () {
this.$get('/sys/license/token').then(res => {
- const fileName = this.licenseList.id + '-' + this.getTimeString() + '.xml'
+ let fileName = this.licenseList.id + '-' + this.getTimeString() + '.xml'
+ const resFileName = res.headers['content-disposition'].split('=')[1]
+ if (resFileName) {
+ fileName = resFileName
+ }
if (window.navigator.msSaveOrOpenBlob) {
// 兼容ie11
- const blobObject = new Blob([res])
+ const blobObject = new Blob([res.data])
window.navigator.msSaveOrOpenBlob(blobObject, fileName)
} else {
- const url = URL.createObjectURL(new Blob([res]))
+ const url = URL.createObjectURL(new Blob([res.data]))
const a = document.createElement('a')
document.body.appendChild(a) // 此处增加了将创建的添加到body当中
a.href = url
diff --git a/nezha-fronted/src/http.js b/nezha-fronted/src/http.js
index 55321bb5e..c2df199c5 100644
--- a/nezha-fronted/src/http.js
+++ b/nezha-fronted/src/http.js
@@ -77,6 +77,12 @@ export function get (url, params) {
axios.get(url, {
params: params
}).then(response => {
+ if (url.indexOf('/sys/license/token') !== -1) {
+ resolve({
+ data: response.data,
+ headers: response.headers
+ })
+ }
resolve(response.data)
}).catch(err => {
if (err.response) {