From a911e1f0aea49668ced78e0cca82af835b1fdb90 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 5 Jul 2022 13:13:55 +0800 Subject: [PATCH] Update site.js --- route/static/app/site.js | 64 +++++++++++++--------------------------- 1 file changed, 20 insertions(+), 44 deletions(-) diff --git a/route/static/app/site.js b/route/static/app/site.js index f3aac26de..71ba77390 100755 --- a/route/static/app/site.js +++ b/route/static/app/site.js @@ -1626,6 +1626,7 @@ function toProxy(siteName, type, obj) { closeBtn: 2, shift: 5, shadeClose: false, + btn: ['提交','关闭'], content: "
" + "
"+ "目标URL" + @@ -1641,57 +1642,34 @@ function toProxy(siteName, type, obj) { "" + "
" + "" + - "
" + - "
" - }); - setTimeout(function() { - $('.btn-colse-proxy').click(function() { - layer.close(proxy_form); - }); - $('.btn-submit-proxy').click(function() { + "", + yes:function(){ + var to = $('[name="to"]').val(); var from = $('[name="from"]').val(); var host = $('[name="host"]').val(); - - $.post('/site/set_proxy', { - siteName: siteName, - from: from, - to: to, - host: host, - }, function(res) { - res = JSON.parse(res); + $.post('/site/set_proxy', {siteName: siteName,from: from,to: to,host: host}, function(res) { if (res.status) { layer.close(proxy_form); toProxy(siteName) } else { - layer.msg(res.msg, { - icon: 2 - }); + layer.msg(res.msg, {icon: 2}); } - }); - }); - }, 100); + },'json'); + + } + }); } if (type == 2) { - $.post('/site/del_proxy', { - siteName: siteName, - id: obj, - }, function(res) { - res = JSON.parse(res); + $.post('/site/del_proxy', {siteName: siteName,id: obj,}, function(res) { if (res.status == true) { - layer.msg('删除成功', { - time: 1000, - icon: 1 - }); + layer.msg('删除成功', {time: 1000,icon: 1}); toProxy(siteName) } else { - layer.msg(res.msg, { - time: 1000, - icon: 2 - }); + layer.msg(res.msg, {time: 1000,icon: 2}); } - }); + },'json'); return } @@ -1704,7 +1682,7 @@ function toProxy(siteName, type, obj) { res = JSON.parse(res); if (res.status == true) { var mBody = "
\ - \ + \
\
    \
  • 此处为反向代理配置文件,若您不了解配置规则,请勿随意修改.
  • \ @@ -1721,7 +1699,7 @@ function toProxy(siteName, type, obj) { btn: ['提交','关闭'], content: mBody, success: function () { - editor = CodeMirror.fromTextArea(document.getElementById("configRedirectBody"), { + editor = CodeMirror.fromTextArea(document.getElementById("configProxyBody"), { extraKeys: {"Ctrl-Space": "autocomplete"}, lineNumbers: true, matchBrackets:true, @@ -1731,7 +1709,7 @@ function toProxy(siteName, type, obj) { $("#onlineEditFileBtn").unbind('click'); }, yes:function(index,layero){ - $("#configRedirectBody").empty().text(editor.getValue()); + $("#configProxyBody").empty().text(editor.getValue()); var load = layer.load(); var data = { siteName: siteName, @@ -1780,12 +1758,9 @@ function toProxy(siteName, type, obj) { $("#webedit-con").html(body); var loadT = layer.msg(lan.site.the_msg,{icon:16,time:0,shade: [0.3, '#000']}); - $.post("/site/get_proxy_list", { - siteName: siteName - },function (response) { + $.post("/site/get_proxy_list", {siteName: siteName},function (res) { layer.close(loadT); $("#md-301-loading").remove(); - let res = JSON.parse(response); if (res.status === true) { let data = res.data.result; data.forEach(function(item){ @@ -1802,7 +1777,8 @@ function toProxy(siteName, type, obj) { } else { layer.msg(res.msg, {icon:2}); } -}) + },'json'); +///////// } //文件验证