Update site.js

pull/119/head
midoks 3 years ago
parent 7eb8dce4c9
commit a911e1f0ae
  1. 64
      route/static/app/site.js

@ -1626,6 +1626,7 @@ function toProxy(siteName, type, obj) {
closeBtn: 2, closeBtn: 2,
shift: 5, shift: 5,
shadeClose: false, shadeClose: false,
btn: ['提交','关闭'],
content: "<form id='form_redirect' class='divtable pd20' style='padding-bottom: 60px'>" + content: "<form id='form_redirect' class='divtable pd20' style='padding-bottom: 60px'>" +
"<div class='line'>"+ "<div class='line'>"+
"<span class='tname'>目标URL</span>" + "<span class='tname'>目标URL</span>" +
@ -1641,57 +1642,34 @@ function toProxy(siteName, type, obj) {
"<input name='host' value='$host' class='bt-input-text mr5' type='text' style='width:200px'>" + "<input name='host' value='$host' class='bt-input-text mr5' type='text' style='width:200px'>" +
"</div>" + "</div>" +
"</div>" + "</div>" +
"<div class='bt-form-submit-btn'><button type='button' class='btn btn-sm btn-danger btn-colse-proxy'>关闭</button><button type='button' class='btn btn-sm btn-success btn-submit-proxy'>提交</button></div>" + "</form>",
"</form>" yes:function(){
});
setTimeout(function() {
$('.btn-colse-proxy').click(function() {
layer.close(proxy_form);
});
$('.btn-submit-proxy').click(function() {
var to = $('[name="to"]').val(); var to = $('[name="to"]').val();
var from = $('[name="from"]').val(); var from = $('[name="from"]').val();
var host = $('[name="host"]').val(); var host = $('[name="host"]').val();
$.post('/site/set_proxy', {siteName: siteName,from: from,to: to,host: host}, function(res) {
$.post('/site/set_proxy', {
siteName: siteName,
from: from,
to: to,
host: host,
}, function(res) {
res = JSON.parse(res);
if (res.status) { if (res.status) {
layer.close(proxy_form); layer.close(proxy_form);
toProxy(siteName) toProxy(siteName)
} else { } else {
layer.msg(res.msg, { layer.msg(res.msg, {icon: 2});
icon: 2
});
} }
}); },'json');
});
}, 100); }
});
} }
if (type == 2) { if (type == 2) {
$.post('/site/del_proxy', { $.post('/site/del_proxy', {siteName: siteName,id: obj,}, function(res) {
siteName: siteName,
id: obj,
}, function(res) {
res = JSON.parse(res);
if (res.status == true) { if (res.status == true) {
layer.msg('删除成功', { layer.msg('删除成功', {time: 1000,icon: 1});
time: 1000,
icon: 1
});
toProxy(siteName) toProxy(siteName)
} else { } else {
layer.msg(res.msg, { layer.msg(res.msg, {time: 1000,icon: 2});
time: 1000,
icon: 2
});
} }
}); },'json');
return return
} }
@ -1704,7 +1682,7 @@ function toProxy(siteName, type, obj) {
res = JSON.parse(res); res = JSON.parse(res);
if (res.status == true) { if (res.status == true) {
var mBody = "<div class='webEdit-box' style='padding: 20px'>\ var mBody = "<div class='webEdit-box' style='padding: 20px'>\
<textarea style='height: 320px; width: 445px; margin-left: 20px; line-height:18px' id='configRedirectBody'>"+res.data.result+"</textarea>\ <textarea style='height: 320px; width: 445px; margin-left: 20px; line-height:18px' id='configProxyBody'>"+res.data.result+"</textarea>\
<div class='info-r'>\ <div class='info-r'>\
<ul class='help-info-text c7 ptb10'>\ <ul class='help-info-text c7 ptb10'>\
<li>此处为反向代理配置文件,若您不了解配置规则,请勿随意修改.</li>\ <li>此处为反向代理配置文件,若您不了解配置规则,请勿随意修改.</li>\
@ -1721,7 +1699,7 @@ function toProxy(siteName, type, obj) {
btn: ['提交','关闭'], btn: ['提交','关闭'],
content: mBody, content: mBody,
success: function () { success: function () {
editor = CodeMirror.fromTextArea(document.getElementById("configRedirectBody"), { editor = CodeMirror.fromTextArea(document.getElementById("configProxyBody"), {
extraKeys: {"Ctrl-Space": "autocomplete"}, extraKeys: {"Ctrl-Space": "autocomplete"},
lineNumbers: true, lineNumbers: true,
matchBrackets:true, matchBrackets:true,
@ -1731,7 +1709,7 @@ function toProxy(siteName, type, obj) {
$("#onlineEditFileBtn").unbind('click'); $("#onlineEditFileBtn").unbind('click');
}, },
yes:function(index,layero){ yes:function(index,layero){
$("#configRedirectBody").empty().text(editor.getValue()); $("#configProxyBody").empty().text(editor.getValue());
var load = layer.load(); var load = layer.load();
var data = { var data = {
siteName: siteName, siteName: siteName,
@ -1780,12 +1758,9 @@ function toProxy(siteName, type, obj) {
$("#webedit-con").html(body); $("#webedit-con").html(body);
var loadT = layer.msg(lan.site.the_msg,{icon:16,time:0,shade: [0.3, '#000']}); var loadT = layer.msg(lan.site.the_msg,{icon:16,time:0,shade: [0.3, '#000']});
$.post("/site/get_proxy_list", { $.post("/site/get_proxy_list", {siteName: siteName},function (res) {
siteName: siteName
},function (response) {
layer.close(loadT); layer.close(loadT);
$("#md-301-loading").remove(); $("#md-301-loading").remove();
let res = JSON.parse(response);
if (res.status === true) { if (res.status === true) {
let data = res.data.result; let data = res.data.result;
data.forEach(function(item){ data.forEach(function(item){
@ -1802,7 +1777,8 @@ function toProxy(siteName, type, obj) {
} else { } else {
layer.msg(res.msg, {icon:2}); layer.msg(res.msg, {icon:2});
} }
}) },'json');
/////////
} }
//文件验证 //文件验证

Loading…
Cancel
Save