URL跳转可以设置是否保留参数

This commit is contained in:
GoEdgeLab
2022-02-20 09:17:30 +08:00
parent d1c79b801b
commit cdd87a29ac
3 changed files with 13 additions and 2 deletions

View File

@@ -27,11 +27,13 @@ func (this *CreatePopupAction) RunGet(params struct {
} }
func (this *CreatePopupAction) RunPost(params struct { func (this *CreatePopupAction) RunPost(params struct {
Mode string
BeforeURL string BeforeURL string
AfterURL string AfterURL string
MatchPrefix bool MatchPrefix bool
MatchRegexp bool MatchRegexp bool
KeepRequestURI bool KeepRequestURI bool
KeepArgs bool
Status int Status int
CondsJSON []byte CondsJSON []byte
IsOn bool IsOn bool
@@ -99,12 +101,14 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
this.Data["redirect"] = maps.Map{ this.Data["redirect"] = maps.Map{
"mode": params.Mode,
"status": params.Status, "status": params.Status,
"beforeURL": params.BeforeURL, "beforeURL": params.BeforeURL,
"afterURL": params.AfterURL, "afterURL": params.AfterURL,
"matchPrefix": params.MatchPrefix, "matchPrefix": params.MatchPrefix,
"matchRegexp": params.MatchRegexp, "matchRegexp": params.MatchRegexp,
"keepRequestURI": params.KeepRequestURI, "keepRequestURI": params.KeepRequestURI,
"keepArgs": params.KeepArgs,
"conds": conds, "conds": conds,
"isOn": params.IsOn, "isOn": params.IsOn,
} }

View File

@@ -43,6 +43,13 @@
<p class="comment">选中后则跳转之后保留跳转之前的URL路径和参数。</p> <p class="comment">选中后则跳转之后保留跳转之前的URL路径和参数。</p>
</td> </td>
</tr> </tr>
<tr v-if="mode == 'equal' || mode == 'matchRegexp'">
<td>是否保留请求参数</td>
<td>
<checkbox name="keepArgs" value="1" v-model="redirect.keepArgs"></checkbox>
<p class="comment">选中后则跳转之后保留跳转之前的URL上的参数即问号之后的部分</p>
</td>
</tr>
<tr> <tr>
<td>跳转状态码</td> <td>跳转状态码</td>
<td> <td>

View File

@@ -11,6 +11,7 @@ Tea.context(function () {
matchPrefix: false, matchPrefix: false,
matchRegexp: false, matchRegexp: false,
keepRequestURI: false, keepRequestURI: false,
keepArgs: true,
conds: null, conds: null,
isOn: true isOn: true
} }
@@ -22,8 +23,7 @@ Tea.context(function () {
} else if (this.redirect.matchRegexp) { } else if (this.redirect.matchRegexp) {
this.mode = "matchRegexp" this.mode = "matchRegexp"
} else { } else {
this.mode = "matchPrefix" this.mode = "equal"
this.redirect.matchPrefix = true
} }
this.$delay(function () { this.$delay(function () {