mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-10 17:30:29 +08:00
URL跳转增加匹配前缀和是否保留RequestURI选项
This commit is contained in:
@@ -24,9 +24,12 @@ func (this *CreatePopupAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *CreatePopupAction) RunPost(params struct {
|
func (this *CreatePopupAction) RunPost(params struct {
|
||||||
BeforeURL string
|
BeforeURL string
|
||||||
AfterURL string
|
AfterURL string
|
||||||
Status int
|
MatchPrefix bool
|
||||||
|
KeepRequestURI bool
|
||||||
|
|
||||||
|
Status int
|
||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
@@ -69,10 +72,12 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
Gte(0, "请选择正确的跳转状态码")
|
Gte(0, "请选择正确的跳转状态码")
|
||||||
|
|
||||||
this.Data["redirect"] = maps.Map{
|
this.Data["redirect"] = maps.Map{
|
||||||
"status": params.Status,
|
"status": params.Status,
|
||||||
"beforeURL": params.BeforeURL,
|
"beforeURL": params.BeforeURL,
|
||||||
"afterURL": params.AfterURL,
|
"afterURL": params.AfterURL,
|
||||||
"isOn": true,
|
"matchPrefix": params.MatchPrefix,
|
||||||
|
"keepRequestURI": params.KeepRequestURI,
|
||||||
|
"isOn": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Success()
|
this.Success()
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Vue.component("http-host-redirect-box", {
|
|||||||
<!-- TODO 将来支持排序,并支持isOn切换 -->
|
<!-- TODO 将来支持排序,并支持isOn切换 -->
|
||||||
<div v-if="redirects.length > 0">
|
<div v-if="redirects.length > 0">
|
||||||
<div v-for="(redirect, index) in redirects" class="ui label basic small" style="margin-bottom: 0.5em;margin-top: 0.5em">
|
<div v-for="(redirect, index) in redirects" class="ui label basic small" style="margin-bottom: 0.5em;margin-top: 0.5em">
|
||||||
<span v-if="redirect.status > 0">[{{redirect.status}}]</span> {{redirect.beforeURL}} -> {{redirect.afterURL}} <a href="" @click.prevent="update(index, redirect)" title="修改"><i class="icon pencil small"></i></a> <a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a>
|
<span v-if="redirect.status > 0">[{{redirect.status}}]</span><span v-if="redirect.matchPrefix">[prefix]</span> {{redirect.beforeURL}} -> {{redirect.afterURL}} <a href="" @click.prevent="update(index, redirect)" title="修改"><i class="icon pencil small"></i></a> <a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,12 +8,30 @@
|
|||||||
|
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>跳转前URL *</td>
|
<td class="title">跳转前URL *</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="beforeURL" placeholder="比如 http://www.url1.com" v-model="redirect.beforeURL" ref="focus"/>
|
<input type="text" name="beforeURL" placeholder="比如 http://www.url1.com" v-model="redirect.beforeURL" ref="focus"/>
|
||||||
<p class="comment">需要填写完整的URL,包括<code-label>http://</code-label>或者<code-label>https://</code-label>,如果有非默认端口,也需要带上端口号。</p>
|
<p class="comment">需要填写完整的URL,包括<code-label>http://</code-label>或者<code-label>https://</code-label>,如果有非默认端口,也需要带上端口号。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>匹配模式</td>
|
||||||
|
<td>
|
||||||
|
<select class="ui dropdown auto-width" name="matchPrefix" v-model="matchPrefix">
|
||||||
|
<option value="0">精准匹配</option>
|
||||||
|
<option value="1">匹配前缀</option>
|
||||||
|
</select>
|
||||||
|
<p class="comment" v-if="matchPrefix == 0">精准匹配跳转前的URL。</p>
|
||||||
|
<p class="comment" v-if="matchPrefix == 1">只要URL头部部分包含跳转前URL,即可跳转。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="matchPrefix == 1">
|
||||||
|
<td>是否保留URL路径参数</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="keepRequestURI" value="1" v-model="redirect.keepRequestURI"></checkbox>
|
||||||
|
<p class="comment">选中后,则跳转之后,保留跳转之前的URL路径和参数。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>跳转后URL *</td>
|
<td>跳转后URL *</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -22,7 +40,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="title">跳转状态码</td>
|
<td>跳转状态码</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="ui dropdown auto-width" name="status" v-model="redirect.status">
|
<select class="ui dropdown auto-width" name="status" v-model="redirect.status">
|
||||||
<option value="0">[默认]</option>
|
<option value="0">[默认]</option>
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
this.isCreating = true
|
this.isCreating = true
|
||||||
if (window.parent.UPDATING_REDIRECT != null) {
|
if (window.parent.UPDATING_REDIRECT != null) {
|
||||||
this.isCreating = false
|
this.isCreating = false
|
||||||
this.redirect = window.parent.UPDATING_REDIRECT
|
this.redirect = window.parent.UPDATING_REDIRECT
|
||||||
} else {
|
} else {
|
||||||
this.redirect = {
|
this.redirect = {
|
||||||
status: 0,
|
status: 0,
|
||||||
beforeURL: "",
|
beforeURL: "",
|
||||||
afterURL: ""
|
afterURL: "",
|
||||||
}
|
matchPrefix: false,
|
||||||
}
|
keepRequestURI: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.matchPrefix = (this.redirect.matchPrefix ? 1 : 0)
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user