generated from msb_47094/GinChat
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.1 KiB
67 lines
2.1 KiB
10 months ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<!--js include-->
|
||
|
{{template "/chat/head.shtml"}}
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<header class="mui-bar mui-bar-nav">
|
||
|
<h1 class="mui-title">登录</h1>
|
||
|
</header>
|
||
|
{{.}}
|
||
|
<div class="mui-content login-page" id="pageapp">
|
||
|
<form id='login-form' class="mui-input-group login-from">
|
||
|
<div class="mui-input-row">
|
||
|
<input v-model="user.name" placeholder="请输入用户名" type="text" class="mui-input-clear mui-input" >
|
||
|
</div>
|
||
|
<div class="mui-input-row">
|
||
|
<input v-model="user.password" placeholder="请输入密码" type="password" class="mui-input-clear mui-input" >
|
||
|
</div>
|
||
|
</form>
|
||
|
<div class="mui-content-padded">
|
||
|
<button @click="login" type="button" class="mui-btn mui-btn-block mui-btn-primary btn-login">登录</button>
|
||
|
<div class="link-area"><a id='reg' href="/toRegister">注册账号</a> <span class="spliter">|</span> <a id='forgetPassword'>忘记密码</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="mui-content-padded oauth-area">
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|
||
|
<script>
|
||
|
var app = new Vue({
|
||
|
el:"#pageapp",
|
||
|
data:function(){
|
||
|
return {
|
||
|
user:{
|
||
|
name:"",
|
||
|
password:"",
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
methods:{
|
||
|
login:function(){
|
||
|
//检测手机号是否正确
|
||
|
console.log("login")
|
||
|
//检测密码是否为空
|
||
|
|
||
|
//网络请求
|
||
|
//封装了promis
|
||
|
util.post("user/findUserByNameAndPwd",this.user).then(res=>{
|
||
|
console.log(res)
|
||
|
if(res.code!=0){
|
||
|
mui.toast(res.message)
|
||
|
}else{
|
||
|
var url = "/toChat?userId="+res.data.ID+"&token="+res.data.Identity
|
||
|
userInfo(res.data)
|
||
|
userId(res.data.ID)
|
||
|
mui.toast("登录成功,即将跳转")
|
||
|
location.href = url
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
}
|
||
|
})
|
||
|
</script>
|