|
|
@ -8,19 +8,28 @@ |
|
|
|
<div class="login-root"> |
|
|
|
<div class="input-container"> |
|
|
|
<div class="input-root"> |
|
|
|
<p>注册</p> |
|
|
|
<div class="inputs-class"> |
|
|
|
<div class="input-group input-group-lg input-class"> |
|
|
|
<span class="input-group-addon">用户</span> |
|
|
|
<input type="text" class="form-control" placeholder="请输入用户名" id="username" |
|
|
|
aria-describedby="sizing-addon1"> |
|
|
|
<div class="inputs-class regist"> |
|
|
|
<i-form> |
|
|
|
<form-item prop="user"> |
|
|
|
<i-input type="text" v-model="user.username" placeholder="请输入用户名"> |
|
|
|
<Icon type="ios-person-outline" slot="prepend"></Icon> |
|
|
|
</i-input> |
|
|
|
</form-item> |
|
|
|
<form-item prop="password"> |
|
|
|
<i-input type="password" v-model="user.userpwd" placeholder="请输入密码"> |
|
|
|
<Icon type="ios-lock-outline" slot="prepend"></Icon> |
|
|
|
</i-input> |
|
|
|
</form-item> |
|
|
|
<form-item prop="password"> |
|
|
|
<i-input type="password" v-model="user.userpwdrepeat" placeholder="请重复密码"> |
|
|
|
<Icon type="ios-lock-outline" slot="prepend"></Icon> |
|
|
|
</i-input> |
|
|
|
</form-item> |
|
|
|
<i-button type="info" long @click="regist">快速注册</i-button> |
|
|
|
</i-form> |
|
|
|
<div class="login-bottom"> |
|
|
|
<a href="/login">快速登录</a> |
|
|
|
</div> |
|
|
|
<div class="input-group input-group-lg input-class"> |
|
|
|
<span class="input-group-addon">密码</span> |
|
|
|
<input type="password" class="form-control" placeholder="请输入密码" id="userpwd" |
|
|
|
aria-describedby="sizing-addon1"> |
|
|
|
</div> |
|
|
|
<button class="layui-btn layui-btn-fluid" id="loginBtn">注册</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -28,36 +37,41 @@ |
|
|
|
</div> |
|
|
|
</body> |
|
|
|
<script> |
|
|
|
$(function () { |
|
|
|
$("#loginBtn").click(function () { |
|
|
|
var username = $("#username").val() |
|
|
|
var userpwd = $("#userpwd").val() |
|
|
|
if (username.trim().length < 4) { |
|
|
|
layer.msg('用户名最低4位', function () { |
|
|
|
}); |
|
|
|
var app = new Vue({ |
|
|
|
el: ".root-container", |
|
|
|
delimiters: ['${', '}'], |
|
|
|
data: { |
|
|
|
user: {} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
regist (){ |
|
|
|
var _this= this |
|
|
|
if (this.user.username.trim().length < 4) { |
|
|
|
this.$Message.warning('用户名最低4位'); |
|
|
|
return |
|
|
|
} |
|
|
|
if (userpwd.trim().length < 6) { |
|
|
|
layer.msg('密码最低6位', function () { |
|
|
|
}); |
|
|
|
if (this.user.userpwd.trim().length < 6) { |
|
|
|
this.$Message.warning('密码最低6位'); |
|
|
|
return |
|
|
|
} |
|
|
|
$.post('/api/regist', { |
|
|
|
username: username, |
|
|
|
userpwd: userpwd |
|
|
|
}, |
|
|
|
if (!this.user.userpwdrepeat || (this.user.userpwdrepeat.trim() != this.user.userpwd.trim())) { |
|
|
|
this.$Message.warning('两次密码输入不一致'); |
|
|
|
return |
|
|
|
} |
|
|
|
$.post('/api/regist', this.user, |
|
|
|
function (data) { |
|
|
|
console.log(data) |
|
|
|
if (data.Status == 1) { |
|
|
|
layer.msg(data.Msg, {icon: 5}); |
|
|
|
_this.$Message.warning(data.Msg); |
|
|
|
} else { |
|
|
|
layer.msg("注册成功,现在去登陆哦", {icon: 6}); |
|
|
|
_this.$Message.success("注册成功,现在去登陆哦"); |
|
|
|
setTimeout(function () { |
|
|
|
window.location.href = "/login" |
|
|
|
}, 800) |
|
|
|
} |
|
|
|
}, 'json') |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
</script> |
|
|
|
<script type="text/javascript" src="/static/js/seo.js"></script> |
|
|
|
</html> |