增加 web_base_url 配置, 用于配置 web 后台可置于代理子路径下

This commit is contained in:
涵曦
2019-05-10 16:29:55 +00:00
parent 4b7b2f4c27
commit 383dbd1b7b
21 changed files with 124 additions and 73 deletions

View File

@@ -162,7 +162,7 @@
$("#add").on("click", function () {
$.ajax({
type: "POST",
url: "/index/add",
url: "{{.web_base_url}}/index/add",
data: $("form").serializeArray(),
success: function (res) {
alert(res.msg)

View File

@@ -160,7 +160,7 @@
$("#add").on("click", function () {
$.ajax({
type: "POST",
url: "/index/edit",
url: "{{.web_base_url}}/index/edit",
data: $("form").serializeArray(),
success: function (res) {
alert(res.msg)

View File

@@ -112,7 +112,7 @@
$("#add").on("click", function () {
$.ajax({
type: "POST",
url: "/index/addhost",
url: "{{.web_base_url}}/index/addhost",
data: $("form").serializeArray(),
success: function (res) {
alert(res.msg)

View File

@@ -116,7 +116,7 @@
$("#add").on("click", function () {
$.ajax({
type: "POST",
url: "/index/edithost",
url: "{{.web_base_url}}/index/edithost",
data: $("form").serializeArray(),
success: function (res) {
alert(res.msg)

View File

@@ -18,7 +18,7 @@
<div class="content">
<div class="table-responsive">
<div id="toolbar">
<a href="/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}"
<a href="{{.web_base_url}}/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}"
class="btn btn-primary dim"
type="button" langtag="info-new">新增</a>
</div>
@@ -158,7 +158,7 @@
if (confirm("Are you sure you want to delete it")) {
$.ajax({
type: "POST",
url: "/index/delhost",
url: "{{.web_base_url}}/index/delhost",
data: {"id": id},
success: function (res) {
alert(res.msg)
@@ -171,7 +171,7 @@
}
function edit(id) {
window.location.href = "/index/edithost?id=" + id
window.location.href = "{{.web_base_url}}/index/edithost?id=" + id
}

View File

@@ -18,7 +18,7 @@
<div class="content">
<div class="table-responsive">
<div id="toolbar">
<a href="/index/add?type={{.type}}&client_id={{.client_id}}" class="btn btn-primary dim"
<a href="{{.web_base_url}}/index/add?type={{.type}}&client_id={{.client_id}}" class="btn btn-primary dim"
type="button" langtag="info-new">新增</a>
</div>
<table id="taskList_table" class="table-striped table-hover"
@@ -40,7 +40,7 @@
$('#table').bootstrapTable({
toolbar: "#toolbar",
method: 'post', // 服务器数据的请求方式 get or post
url: "/index/gettunnel", // 服务器数据的加载地址
url: "{{.web_base_url}}/index/gettunnel", // 服务器数据的加载地址
queryParams: function (params) {
return {
"offset": params.offset,
@@ -191,7 +191,7 @@
if (confirm("Are you sure you want to delete it")) {
$.ajax({
type: "POST",
url: "/index/del",
url: "{{.web_base_url}}/index/del",
data: {"id": id},
success: function (res) {
alert(res.msg)
@@ -207,7 +207,7 @@
if (confirm("Are you sure you want to start it")) {
$.ajax({
type: "POST",
url: "/index/start",
url: "{{.web_base_url}}/index/start",
data: {"id": id},
success: function (res) {
alert(res.msg)
@@ -223,7 +223,7 @@
if (confirm("Are you sure you want to stop it")) {
$.ajax({
type: "POST",
url: "/index/stop",
url: "{{.web_base_url}}/index/stop",
data: {"id": id},
success: function (res) {
alert(res.msg)
@@ -236,7 +236,7 @@
}
function edit(id) {
window.location.href = "/index/edit?id=" + id
window.location.href = "{{.web_base_url}}/index/edit?id=" + id
}
</script>