release revsuit vBeta0.1.0 (#15)

Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
Li4n0
2021-05-16 12:11:35 +08:00
committed by GitHub
co-authored by E99p1ant
parent b39ee101f9
commit 5b63e90390
98 changed files with 2357 additions and 623 deletions
+99
View File
@@ -0,0 +1,99 @@
<template>
<div>
<SettingForm :form="form" :spinning="spinning"></SettingForm>
<a-result v-if="status"
:status="status"
:title="title"
:sub-title="subTitle"
>
<template #extra>
<a-row>
<a-col :span="12" :offset="7">
<div style="text-align: left">
<li v-for="err in errors" :key="err">{{ err }}</li>
</div>
</a-col>
</a-row>
</template>
</a-result>
</div>
</template>
<script>
import {getHttpConfig, updateHttpConfig} from "@/api/settings"
import SettingForm from "@/components/SettingForm";
export default {
name: "Http",
data() {
return {
form: {},
spinning: false,
status: "",
title: "",
subTitle: "",
errors: []
}
},
methods: {
getConfig() {
getHttpConfig().then(res => {
this.form = res.data
}).catch(e => {
this.$notification.error({
message: 'Error',
description:
e.response.data.error,
style: {
width: '600px',
marginLeft: `${335 - 600}px`,
},
duration: 4
});
})
},
updateConfig() {
this.spinning = true
let targetConfig = JSON.stringify(this.form)
updateHttpConfig(this.form).then(
() => {
setTimeout(() => {
getHttpConfig().then((res) => {
this.spinning = false
let nowConfig = JSON.stringify(res.data)
if (nowConfig !== targetConfig) {
this.status = "warning"
this.title = "Updating the configuration seems to have failed"
this.subTitle = "Please check your config options."
}
this.form = res.data
this.status = ""
this.title = ""
this.subTitle = ""
}
).catch(() => {
this.status = "error"
this.title = "Updating the configuration seems to have failed, and may cause the platform to exit abnormally, please restart manually."
this.subTitle = "Please check your config options carefully."
})
}, 3000)
}
).catch(() => {
this.status = "error"
this.title = "Updating the configuration seems to have failed, and may cause the platform to exit abnormally, please restart manually."
this.subTitle = "Please check your config options carefully."
})
}
},
mounted() {
this.getConfig()
},
components: {
SettingForm
}
}
</script>
<style scoped>
</style>