服务器创建名字检测

This commit is contained in:
suwings 2018-02-17 17:23:02 +08:00
parent e6e094a45b
commit 0fe788f06a
2 changed files with 10 additions and 0 deletions

View File

@ -91,4 +91,10 @@
document.cookie = name + "=" + escape(value) + ";expires=" + new Date(Date.now() + 10000 * 60 * 60 * 4).toGMTString();
}
//判断是否是一个 标准字符串(标准的定义:仅有字母数字下划线)
TOOLS.isStdText = function (text) {
var reg = /^[A-Za-z0-9_]*$/igm;
return reg.test(text);
}
})();

View File

@ -102,6 +102,10 @@
methods: {
toCreateServer: function () {
var addCmdList = this.addCmd.split(' ');
if (!TOOLS.isStdText(this.name)) {
TOOLS.pushMsgWindow("服务器名字不合法!仅限字母数字下划线!");
return;
}
var obj = {
addCmd: addCmdList,
serverName: this.name,