Vue.component("http-pages-and-shutdown-box", { props: ["v-pages", "v-shutdown-config", "v-is-location"], data: function () { let pages = [] if (this.vPages != null) { pages = this.vPages } let shutdownConfig = { isPrior: false, isOn: false, bodyType: "url", url: "", body: "", status: 0 } if (this.vShutdownConfig != null) { if (this.vShutdownConfig.body == null) { this.vShutdownConfig.body = "" } if (this.vShutdownConfig.bodyType == null) { this.vShutdownConfig.bodyType = "url" } shutdownConfig = this.vShutdownConfig } let shutdownStatus = "" if (shutdownConfig.status > 0) { shutdownStatus = shutdownConfig.status.toString() } return { pages: pages, shutdownConfig: shutdownConfig, shutdownStatus: shutdownStatus } }, watch: { shutdownStatus: function (status) { let statusInt = parseInt(status) if (!isNaN(statusInt) && statusInt > 0 && statusInt < 1000) { this.shutdownConfig.status = statusInt } else { this.shutdownConfig.status = 0 } } }, methods: { addPage: function () { let that = this teaweb.popup("/servers/server/settings/pages/createPopup", { height: "26em", callback: function (resp) { that.pages.push(resp.data.page) } }) }, updatePage: function (pageIndex, pageId) { let that = this teaweb.popup("/servers/server/settings/pages/updatePopup?pageId=" + pageId, { height: "26em", callback: function (resp) { Vue.set(that.pages, pageIndex, resp.data.page) } }) }, removePage: function (pageIndex) { let that = this teaweb.confirm("确定要移除此页面吗?", function () { that.pages.$remove(pageIndex) }) }, addShutdownHTMLTemplate: function () { this.shutdownConfig.body = ` \t升级中 \t

网站升级中

为了给您提供更好的服务,我们正在升级网站,请稍后重新访问。

Request ID: \${requestId}.
` } }, template: `
自定义页面
{{page.status}} -> {{page.url}}[HTML内容]

根据响应状态码返回一些自定义页面,比如404,500等错误页面。

临时关闭页面
开启
内容类型 *
页面URL *

页面文件是相对于节点安装目录的页面文件比如pages/40x.html,或者一个完整的URL。

HTML *

[使用模板]。填写页面的HTML内容,支持请求变量。

状态码

开启临时关闭页面时,所有请求都会直接显示此页面。可用于临时升级网站或者禁止用户访问某个网页。

` })