mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-01 01:10:25 +08:00
改进文字提示
This commit is contained in:
@@ -23,14 +23,14 @@
|
||||
<tr>
|
||||
<td class="title">节点名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="50" ref="focus"/>
|
||||
<input type="text" name="name" maxlength="50" ref="focus" v-model="name" @input="changeName"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IP地址 *</td>
|
||||
<td>
|
||||
<node-ip-addresses-box></node-ip-addresses-box>
|
||||
<p class="comment">用于访问节点和域名解析等。</p>
|
||||
<p class="comment">用于访问节点和域名解析等<span v-if="defaultIP.length > 0"><strong>,如果没有填写默认为{{defaultIP}}</strong></span>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="dnsRoutes.length > 0">
|
||||
|
||||
@@ -5,6 +5,7 @@ Tea.context(function () {
|
||||
this.sshPort = ""
|
||||
this.grantId = 0
|
||||
this.step = "info"
|
||||
this.name = ""
|
||||
|
||||
this.success = function (resp) {
|
||||
this.node = resp.data.node
|
||||
@@ -170,4 +171,32 @@ Tea.context(function () {
|
||||
this.createNext = function () {
|
||||
teaweb.reload()
|
||||
}
|
||||
|
||||
this.defaultIP = ""
|
||||
this.changeName = function () {
|
||||
if (this.validateIP(this.name)) {
|
||||
this.defaultIP = this.name
|
||||
} else {
|
||||
this.defaultIP = ""
|
||||
}
|
||||
}
|
||||
|
||||
this.validateIP = function (v) {
|
||||
// 目前只支持ipv4
|
||||
let pieces = v.split(".")
|
||||
if (pieces.length != 4) {
|
||||
return false
|
||||
}
|
||||
for (let i = 0; i < pieces.length; i++) {
|
||||
if (!/^\d{1,3}$/.test(pieces[i])) {
|
||||
return false
|
||||
}
|
||||
let p = parseInt(pieces[i], 10)
|
||||
if (p > 255) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user