蚂蚁前端课程聊天室界面框架

网页图标

1
<img rel="icon" type="image/png" href="https://dyinjin.github.io/images/avatar.gif"> 

登录界面

HTML

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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>测试网页标题</title>
<script>
function buttonClick(){
if(checkUsername() && checkPassword()){
window.open("聊天界面.html");
}
}
function checkUsername(){
var username = document.getElementById("in1").value;
if(username=="wyj"){
return true;
}else{
alert("请输入正确用户名");
}
}
//检查登录密码
function checkPassword(){
var password = document.getElementById("in2").value;
if(password=="123"){
return true;
}else{
alert("请输入正确密码");
}
}
</script>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<div class="bgimg">
<div class="ndiv" >
<h1 class="ntitle">登入</h1>
<input class="ninput" id="in1" type="text" placeholder="请输入账号"/>
<input class="ninput" id="in2" type="password" placeholder="请输入密码"/>
<button class="neu" id="but1" onclick="buttonClick();"><span>LOGIN</span></button>
</div>
</div>
</body>
</html>

CSS

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
html,body {
padding: 0;
margin: 0;
width: 100vw;
height: 50vh;
display: grid;
place-items: center;
background-color: #e6e6e6;

}
.neu {
width: 200px;
height: 50px;
border: none;
border-radius: 20px;
background-color: #e6e6e6;
box-shadow: 5px 5px 10px #bbbbbb, -5px -5px 10px #ffffff;
}
.neu:active {
box-shadow: inset 5px 5px 10px #bbbbbb, inset -5px -5px 10px #ffffff;
}
.neu:focus {
outline: none;
}
.neu span {
display: block;
user-select: none;
color: #767676;
font-size: 24px;
text-align: center;
line-height: 36px;
transition: 0.1s;
}
.neu:active span {
transform: scale(0.95);
}
.neu#but1{
position: absolute;
top:100px;
left:0px;
right:0px;
bottom:0px;
margin:auto;
}
.ninput{
width: 200px;
height: 50px;
border: none;
border-radius: 20px;
background-color: #e6e6e6;
box-shadow: 5px 5px 10px #bbbbbb, -5px -5px 10px #ffffff;
}
.ninput#in1{
position: absolute;
top:-190px;
left:0px;
right:0px;
bottom:0px;
margin:auto;
}
.ninput#in2{
position: absolute;
top:-40px;
left:0px;
right:0px;
bottom:0px;
margin:auto;
}
.ndiv {
width: 500px;
height: 500px;
border: none;
border-radius: 20px;
background-color: #bfc0bf;
opacity:0.95;
box-shadow: 5px 5px 10px #494848, -5px -5px 10px #ffffff;
position: absolute;
top:0px;
left:0px;
right:0px;
bottom:0px;
margin:auto;
}
.bgimg {
height: 300%;
width: 100%;
background:
linear-gradient(63deg, #999 23%, transparent 23%) 7px 0,
linear-gradient(63deg, transparent 74%, #999 78%),
linear-gradient(63deg, transparent 34%, #999 38%, #999 58%, transparent 62%),#444;
background-size: 16px 48px;
}

.ntitle{
font-size: 50px;
top:10px;
text-align:center;
}

聊天界面

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<html>
<head>
<meta charset="UTF-8">
<title>测试</title>
<style>
body{
margin: 0;
}
.warp0{
display:flex;
height:100%;
}
.left1{
width:150px;
background-color: black;
color: #ffffff;
}
.right1{
flex: 1;
background-color: antiquewhite;
display: flex;
flex-direction: column;
}
.cl2{
border-bottom: 1px solid rgb(70, 70, 70);
padding: 5px;
}
.msglist2{
flex: 1;
overflow: scroll;
background-color: rgb(239, 239, 239);
padding: 10px;;
}
.title2{
text-align: center;
border-bottom: 1px solid rgb(0, 0, 0);
background-color: dimgrey;
color: #ffffff;
}
.msg3{
display: flex;
}
.msg3me{
flex-direction: row-reverse;
}
.msg3me .text4{
background-color: green;
}

.img4{
width: 50px;
height: 50px;
border-radius:50%;
margin: 0 5px;
}
.text4{
display: inline-block;
background-color: #fff;
padding: 5px;
border-radius: 5px;
height: fit-content;
background-color: #e6e6e6;
box-shadow: 5px 5px 10px #bbbbbb, -5px -5px 10px #ffffff;
}
.msgsend2{
display: flex;
border-top: 1px solid green;
}
.input3{
flex: 1;
}
</style>
<script>
function buttonClick(){
var box = document.getElementById("box");
var x = document.getElementById("sendmsg").value;
var div0 = document.createElement("div");
var img1 = document.createElement("img");
var div2 = document.createElement("div");
div0.setAttribute("class","msg3 msg3me");
img1.setAttribute("class","img4");
img1.setAttribute("src","图片1.jpg");
div2.setAttribute("class","text4");
div2.innerHTML=x;
div0.appendChild(img1);
div0.appendChild(div2);
box.appendChild(div0);
document.getElementById("sendmsg").value="";
}
</script>
</head>

<body>
<div class="warp0">
<div class="left1">
<div class="cl2">A</div>
<div class="cl2">B</div>
<div class="cl2">C</div>
<div class="cl2">D</div>
</div>

<div class="right1">
<div class="title2">
Tom
</div>
<div class="msglist2" id="box">
<div class="msg3">
<img class="img4" src="图片1.jpg">
<div class="text4">HELLO</div>
</div>
<div class="msg3 msg3me">
<img class="img4" src="图片1.jpg">
<div class="text4">begin</div>
</div>
</div>
<div class="msgsend2">
<textarea class="input3" type="text" id="sendmsg" placeholder="请输入"></textarea>
<button onclick="buttonClick();">send</button>
</div>
</div>
</div>
</body>
</html>

仅作简单了解前端的练习

---------------THEEND---------------