From 9fdd61674b78b18a6ed6a3f84e3022cd30a18c89 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 10 Nov 2023 14:59:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BB=84=E4=BB=B6=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/http-pages-and-shutdown-box.js | 175 ++++++++++-------- .../js/components/server/http-pages-box.js | 63 +++++-- 2 files changed, 148 insertions(+), 90 deletions(-) diff --git a/web/public/js/components/server/http-pages-and-shutdown-box.js b/web/public/js/components/server/http-pages-and-shutdown-box.js index 1104189a..858e63cb 100644 --- a/web/public/js/components/server/http-pages-and-shutdown-box.js +++ b/web/public/js/components/server/http-pages-and-shutdown-box.js @@ -48,29 +48,32 @@ Vue.component("http-pages-and-shutdown-box", { addPage: function () { let that = this teaweb.popup("/servers/server/settings/pages/createPopup", { - height: "26em", + 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: "26em", + height: "30em", callback: function (resp) { Vue.set(that.pages, pageIndex, resp.data.page) + that.notifyChange() } }) }, removePage: function (pageIndex) { let that = this - teaweb.confirm("确定要移除此页面吗?", function () { + teaweb.confirm("确定要删除此自定义页面吗?", function () { that.pages.$remove(pageIndex) + that.notifyChange() }) }, addShutdownHTMLTemplate: function () { - this.shutdownConfig.body = ` + this.shutdownConfig.body = ` \t升级中 @@ -89,80 +92,106 @@ Vue.component("http-pages-and-shutdown-box", { ` + }, + 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: `
- - - - - - - - - -
自定义页面 -
-
- {{page.status}} -> {{page.url}}[HTML内容] -
-
-
-
- -
-

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

-
临时关闭页面 -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
临时关闭网站 -
- - -
-

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

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

将从此URL中读取内容。

-
显示页面HTML * - -

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

-
状态码
-

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

-
-
+

自定义页面

+ +

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

+ +
+ + + + + + + + + + + + + +
响应状态码页面类型操作
+ {{page.status[0]}} + {{page.status}} + {{page.url}}[HTML内容] + 修改   + 删除 +
+
+
+ +
+ +

临时关闭页面

+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
启用临时关闭网站 +
+ + +
+

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

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

将从此URL中读取内容。

+
显示页面HTML * + +

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

+
状态码
+
` }) \ No newline at end of file diff --git a/web/public/js/components/server/http-pages-box.js b/web/public/js/components/server/http-pages-box.js index 5171cf39..699606d5 100644 --- a/web/public/js/components/server/http-pages-box.js +++ b/web/public/js/components/server/http-pages-box.js @@ -17,6 +17,7 @@ Vue.component("http-pages-box", { height: "26em", callback: function (resp) { that.pages.push(resp.data.page) + that.notifyChange() } }) }, @@ -26,6 +27,7 @@ Vue.component("http-pages-box", { height: "26em", callback: function (resp) { Vue.set(that.pages, pageIndex, resp.data.page) + that.notifyChange() } }) }, @@ -33,28 +35,55 @@ Vue.component("http-pages-box", { let that = this teaweb.confirm("确定要移除此页面吗?", function () { that.pages.$remove(pageIndex) + that.notifyChange() }) + }, + 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: `
- - - - - -
自定义页面 -
-
- {{page.status}} -> {{page.url}}[HTML内容] -
-
-
-
- -
-

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

-
+ +
+ + + + + + + + + + + + + +
响应状态码页面类型操作
+ {{page.status[0]}} + {{page.status}} + {{page.url}}[HTML内容] + 修改   + 删除 +
+
+
+ +
` }) \ No newline at end of file