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: "html", url: "", body: "", status: 0 } if (this.vShutdownConfig != null) { if (this.vShutdownConfig.body == null) { this.vShutdownConfig.body = "" } if (this.vShutdownConfig.bodyType == null) { this.vShutdownConfig.bodyType = "html" } 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: "30em", callback: function (resp) { that.pages.push(resp.data.page) that.notifyChange() } }) }, updatePage: function (pageIndex, pageId) { let that = this teaweb.popup("/servers/server/settings/pages/updatePopup?pageId=" + pageId, { height: "30em", callback: function (resp) { Vue.set(that.pages, pageIndex, resp.data.page) that.notifyChange() } }) }, removePage: function (pageIndex) { let that = this teaweb.confirm("确定要删除此自定义页面吗?", function () { that.pages.$remove(pageIndex) that.notifyChange() }) }, addShutdownHTMLTemplate: function () { this.shutdownConfig.body = ` \t升级中 \t \t

网站升级中

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

Connection: \${remoteAddr} (Client) -> \${serverAddr} (Server)
Request ID: \${requestId}
` }, notifyChange: function () { let parent = this.$el.parentNode while (true) { if (parent == null) { break } if (parent.tagName == "FORM") { break } parent = parent.parentNode } if (parent != null) { setTimeout(function () { Tea.runActionOn(parent) }, 100) } } }, template: `

自定义页面

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

响应状态码 页面类型 新状态码 例外URL 限制URL 操作
{{page.status[0]}} {{page.status}}
{{page.url}}
读取URL
{{page.url}}
跳转URL {{page.newStatus}}
[HTML内容]
{{page.newStatus}}
{{page.newStatus}} 保持
{{urlPattern.pattern}}
-
{{urlPattern.pattern}}
-
修改   删除

临时关闭页面

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

启用临时关闭网站

选中后,表示临时关闭当前网站,并显示自定义内容。

显示内容类型 *
显示页面URL *

将从此URL中读取内容。

跳转到URL *

将会跳转到此URL。

显示页面HTML *

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

状态码
` })