mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-26 16:41:53 +08:00
release revsuit vBeta0.1.0 (#15)
Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user