mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-02-21 08:05:45 +08:00
自定义页面增加例外URL和限制URL设置
This commit is contained in:
@@ -5,6 +5,7 @@ Vue.component("url-patterns-box", {
|
||||
if (this.value != null) {
|
||||
patterns = this.value
|
||||
}
|
||||
|
||||
return {
|
||||
patterns: patterns,
|
||||
isAdding: false,
|
||||
@@ -12,7 +13,9 @@ Vue.component("url-patterns-box", {
|
||||
addingPattern: {"type": "wildcard", "pattern": ""},
|
||||
editingIndex: -1,
|
||||
|
||||
patternIsInvalid: false
|
||||
patternIsInvalid: false,
|
||||
|
||||
windowIsSmall: window.innerWidth < 600
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -105,7 +108,7 @@ Vue.component("url-patterns-box", {
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="isAdding" style="margin-top: 0.5em">
|
||||
<div class="ui fields inline">
|
||||
<div :class="{'ui fields inline': !windowIsSmall}">
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown auto-width" v-model="addingPattern.type">
|
||||
<option value="wildcard">通配符</option>
|
||||
|
||||
@@ -118,32 +118,38 @@ Vue.component("http-pages-and-shutdown-box", {
|
||||
|
||||
<p class="comment" style="padding-top: 0; margin-top: 0">根据响应状态码返回一些自定义页面,比如404,500等错误页面。</p>
|
||||
|
||||
<div v-if="pages.length > 0" style="max-width: 30em">
|
||||
<div v-if="pages.length > 0">
|
||||
<table class="ui table selectable celled">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="four wide">响应状态码</th>
|
||||
<th class="two wide">响应状态码</th>
|
||||
<th>页面类型</th>
|
||||
<th style="width: 6.5em">操作</th>
|
||||
<th class="two wide">新状态码</th>
|
||||
<th>例外URL</th>
|
||||
<th>限制URL</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="(page,index) in pages">
|
||||
<td>
|
||||
<span v-if="page.status != null && page.status.length == 1">{{page.status[0]}}</span>
|
||||
<span v-else>{{page.status}}</span>
|
||||
<a href="" @click.prevent="updatePage(index, page.id)">
|
||||
<span v-if="page.status != null && page.status.length == 1">{{page.status[0]}}</span>
|
||||
<span v-else>{{page.status}}</span>
|
||||
|
||||
<i class="icon expand small"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td style="word-break: break-all">
|
||||
<div v-if="page.bodyType == 'url'">
|
||||
{{page.url}}
|
||||
<div>
|
||||
<grey-label>读取</grey-label>
|
||||
<grey-label v-if="page.newStatus > 0">{{page.newStatus}}</grey-label>
|
||||
<grey-label>读取URL</grey-label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="page.bodyType == 'redirectURL'">
|
||||
{{page.url}}
|
||||
<div>
|
||||
<grey-label>跳转</grey-label>
|
||||
<grey-label>跳转URL</grey-label>
|
||||
<grey-label v-if="page.newStatus > 0">{{page.newStatus}}</grey-label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,6 +160,22 @@ Vue.component("http-pages-and-shutdown-box", {
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="page.newStatus > 0">{{page.newStatus}}</span>
|
||||
<span v-else class="disabled">保持</span>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="page.exceptURLPatterns != null && page.exceptURLPatterns">
|
||||
<span v-for="urlPattern in page.exceptURLPatterns" class="ui basic label small">{{urlPattern.pattern}}</span>
|
||||
</div>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="page.onlyURLPatterns != null && page.onlyURLPatterns">
|
||||
<span v-for="urlPattern in page.onlyURLPatterns" class="ui basic label small">{{urlPattern.pattern}}</span>
|
||||
</div>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" title="修改" @click.prevent="updatePage(index, page.id)">修改</a>
|
||||
<a href="" title="删除" @click.prevent="removePage(index)">删除</a>
|
||||
|
||||
@@ -59,32 +59,38 @@ Vue.component("http-pages-box", {
|
||||
template: `<div>
|
||||
<input type="hidden" name="pagesJSON" :value="JSON.stringify(pages)"/>
|
||||
|
||||
<div v-if="pages.length > 0" style="max-width: 30em">
|
||||
<div v-if="pages.length > 0">
|
||||
<table class="ui table selectable celled">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="four wide">响应状态码</th>
|
||||
<th class="two wide">响应状态码</th>
|
||||
<th>页面类型</th>
|
||||
<th style="width: 6.5em">操作</th>
|
||||
<th class="two wide">新状态码</th>
|
||||
<th>例外URL</th>
|
||||
<th>限制URL</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="(page,index) in pages">
|
||||
<td>
|
||||
<span v-if="page.status != null && page.status.length == 1">{{page.status[0]}}</span>
|
||||
<span v-else>{{page.status}}</span>
|
||||
<a href="" @click.prevent="updatePage(index, page.id)">
|
||||
<span v-if="page.status != null && page.status.length == 1">{{page.status[0]}}</span>
|
||||
<span v-else>{{page.status}}</span>
|
||||
|
||||
<i class="icon expand small"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td style="word-break: break-all">
|
||||
<div v-if="page.bodyType == 'url'">
|
||||
{{page.url}}
|
||||
<div>
|
||||
<grey-label>读取</grey-label>
|
||||
<grey-label v-if="page.newStatus > 0">{{page.newStatus}}</grey-label>
|
||||
<grey-label>读取URL</grey-label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="page.bodyType == 'redirectURL'">
|
||||
{{page.url}}
|
||||
<div>
|
||||
<grey-label>跳转</grey-label>
|
||||
<grey-label>跳转URL</grey-label>
|
||||
<grey-label v-if="page.newStatus > 0">{{page.newStatus}}</grey-label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,6 +101,22 @@ Vue.component("http-pages-box", {
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="page.newStatus > 0">{{page.newStatus}}</span>
|
||||
<span v-else class="disabled">保持</span>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="page.exceptURLPatterns != null && page.exceptURLPatterns">
|
||||
<span v-for="urlPattern in page.exceptURLPatterns" class="ui basic label small">{{urlPattern.pattern}}</span>
|
||||
</div>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="page.onlyURLPatterns != null && page.onlyURLPatterns">
|
||||
<span v-for="urlPattern in page.onlyURLPatterns" class="ui basic label small">{{urlPattern.pattern}}</span>
|
||||
</div>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" title="修改" @click.prevent="updatePage(index, page.id)">修改</a>
|
||||
<a href="" title="删除" @click.prevent="removePage(index)">删除</a>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{$layout "layout_popup"}
|
||||
<h3>添加自定义页面</h3>
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="exceptURLPatternsJSON" :value="JSON.stringify(exceptURLPatterns)"/>
|
||||
<input type="hidden" name="onlyURLPatternsJSON" :value="JSON.stringify(onlyURLPatterns)"/>
|
||||
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">响应状态码 *</td>
|
||||
@@ -20,7 +23,7 @@
|
||||
<tr v-show="bodyType == 'html'">
|
||||
<td>显示页面HTML *</td>
|
||||
<td>
|
||||
<textarea name="body" ref="htmlBody"></textarea>
|
||||
<textarea name="body" ref="htmlBody" rows="7"></textarea>
|
||||
<p class="comment"><a href="" @click.prevent="addHTMLTemplate">[使用模板]</a>。填写页面的HTML内容,支持请求变量。</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -38,13 +41,26 @@
|
||||
<p class="comment">将会跳转到此URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新状态码</td>
|
||||
<td>
|
||||
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em"/>
|
||||
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>例外URL <tip-icon content="对这些URL将不做任何限制。"></tip-icon></td>
|
||||
<td><url-patterns-box v-model="exceptURLPatterns"></url-patterns-box></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>限制URL <tip-icon content="只对这些URL做限制。"></tip-icon></td>
|
||||
<td><url-patterns-box v-model="onlyURLPatterns"></url-patterns-box></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新状态码</td>
|
||||
<td>
|
||||
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em"/>
|
||||
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -22,4 +22,7 @@ Tea.context(function () {
|
||||
</body>
|
||||
</html>`
|
||||
}
|
||||
|
||||
this.exceptURLPatterns = []
|
||||
this.onlyURLPatterns = []
|
||||
})
|
||||
@@ -2,6 +2,8 @@
|
||||
<h3>修改自定义页面</h3>
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="pageId" :value="pageConfig.id"/>
|
||||
<input type="hidden" name="exceptURLPatternsJSON" :value="JSON.stringify(pageConfig.exceptURLPatterns)"/>
|
||||
<input type="hidden" name="onlyURLPatternsJSON" :value="JSON.stringify(pageConfig.onlyURLPatterns)"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">响应状态码 *</td>
|
||||
@@ -39,13 +41,26 @@
|
||||
<p class="comment">将会跳转到此URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新状态码</td>
|
||||
<td>
|
||||
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" v-model="newStatus"/>
|
||||
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>例外URL <tip-icon content="对这些URL将不做任何限制。"></tip-icon></td>
|
||||
<td><url-patterns-box v-model="pageConfig.exceptURLPatterns"></url-patterns-box></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>限制URL <tip-icon content="只对这些URL做限制。"></tip-icon></td>
|
||||
<td><url-patterns-box v-model="pageConfig.onlyURLPatterns"></url-patterns-box></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新状态码</td>
|
||||
<td>
|
||||
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" v-model="newStatus"/>
|
||||
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
Reference in New Issue
Block a user