mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-16 13:40:24 +08:00
优化组件显示
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Vue.component("values-box", {
|
Vue.component("values-box", {
|
||||||
props: ["values", "v-values", "size", "maxlength", "name", "placeholder", "v-allow-empty"],
|
props: ["values", "v-values", "size", "maxlength", "name", "placeholder", "v-allow-empty", "validator"],
|
||||||
data: function () {
|
data: function () {
|
||||||
let values = this.values;
|
let values = this.values;
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
@@ -44,6 +44,22 @@ Vue.component("values-box", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
if (typeof(this.validator) == "function") {
|
||||||
|
let resp = this.validator.call(this, this.value)
|
||||||
|
if (typeof resp == "object") {
|
||||||
|
if (typeof resp.isOk == "boolean" && !resp.isOk) {
|
||||||
|
if (typeof resp.message == "string") {
|
||||||
|
let that = this
|
||||||
|
teaweb.warn(resp.message, function () {
|
||||||
|
that.$refs.value.focus();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isUpdating) {
|
if (this.isUpdating) {
|
||||||
Vue.set(this.realValues, this.index, this.value);
|
Vue.set(this.realValues, this.index, this.value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -190,7 +190,10 @@ Vue.component("http-cache-ref-box", {
|
|||||||
<tr v-if="condCategory == 'simple'">
|
<tr v-if="condCategory == 'simple'">
|
||||||
<td class="color-border">{{condComponent.paramsTitle}} *</td>
|
<td class="color-border">{{condComponent.paramsTitle}} *</td>
|
||||||
<td>
|
<td>
|
||||||
|
<component :is="condComponent.component" :v-cond="ref.simpleCond" v-if="condComponent.type != 'params'"></component>
|
||||||
|
<table class="ui table" v-if="condComponent.type == 'params'">
|
||||||
<component :is="condComponent.component" :v-cond="ref.simpleCond"></component>
|
<component :is="condComponent.component" :v-cond="ref.simpleCond"></component>
|
||||||
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="condCategory == 'simple' && condComponent.caseInsensitive">
|
<tr v-if="condCategory == 'simple' && condComponent.caseInsensitive">
|
||||||
|
|||||||
@@ -716,8 +716,7 @@ Vue.component("http-cond-params", {
|
|||||||
this.cond.value = this.versionRangeMinValue + "," + this.versionRangeMaxValue
|
this.cond.value = this.versionRangeMinValue + "," + this.versionRangeMaxValue
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<table class="ui table definition">
|
template: `<tbody>
|
||||||
<tbody>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 8em">参数值</td>
|
<td style="width: 8em">参数值</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -835,5 +834,5 @@ Vue.component("http-cond-params", {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>`
|
`
|
||||||
})
|
})
|
||||||
@@ -991,7 +991,45 @@ window.teaweb = {
|
|||||||
}
|
}
|
||||||
return color
|
return color
|
||||||
},
|
},
|
||||||
DefaultChartColor: "#9DD3E8"
|
DefaultChartColor: "#9DD3E8",
|
||||||
|
validateIP: function (ip) {
|
||||||
|
if (typeof ip != "string") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ip.length == 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPv6
|
||||||
|
if (ip.indexOf(":") >= 0) {
|
||||||
|
let pieces = ip.split(":")
|
||||||
|
if (pieces.length > 8) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let isOk = true
|
||||||
|
pieces.forEach(function (piece) {
|
||||||
|
if (!/^[\da-fA-F]{0,4}$/.test(piece)) {
|
||||||
|
isOk = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return isOk
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let pieces = ip.split(".")
|
||||||
|
let isOk = true
|
||||||
|
pieces.forEach(function (v) {
|
||||||
|
let v1 = parseInt(v)
|
||||||
|
if (v1 > 255) {
|
||||||
|
isOk = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return isOk
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String.prototype.quoteIP = function () {
|
String.prototype.quoteIP = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user