-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathindex.html
More file actions
76 lines (72 loc) · 2.55 KB
/
Copy pathindex.html
File metadata and controls
76 lines (72 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<!-- <meta charset="UTF-8">-->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">-->
<!-- <title>够浪IM</title>-->
<!-- <link rel="stylesheet" href="asset/css/mui.min.css" />-->
<!-- <link rel="stylesheet" href="asset/css/login.css" />-->
<!-- <script src="asset/plugins/mui/js/mui.js" ></script>-->
<!-- <script src="asset/js/vue.min.js" ></script>-->
<!-- <script src="asset/js/util.js" ></script>-->
{{template "/chat/head.shtml"}}
</head>
<body>
<header class="mui-bar mui-bar-nav">
<h1 class="mui-title">登录</h1>
</header>
{{.}}
<div class="mui-content" id="pageapp">
<form id='login-form' class="mui-input-group">
<div class="mui-input-row">
<label>账号</label>
<input v-model="user.name" placeholder="请输入用户名" type="text" class="mui-input-clear mui-input" >
</div>
<div class="mui-input-row">
<label>密码</label>
<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">登录</button>
<div class="link-area"><a id='reg' href="/register">注册账号</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")
//检测密码是否为空
console.log(this.user.name)
console.log(this.user)
//网络请求
//封装了promis
util.post("/v1/user/login_pw",this.user).then(res=>{
console.log("返回",res.message)
if(res.code!=0){
mui.toast(res.message)
}else{
mui.toast("登录成功,即将跳转")
location.replace("//127.0.0.1:8000/toChat?userId="+res.userId+"&token="+res.tokens)
}
})
},
}
})
</script>