Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
SimpleAstronaut committed May 7, 2022
1 parent a84651f commit fee6998
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ app.get('/add', function(req, res) {
})
})

res.send('添加留言接口');
res.send('1');
ret = Date()+"-"+req.ip+"-添加留言请求";
log(ret);
console.log(ret);
Expand Down
16 changes: 12 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./vue.js"></script>
<script src="./main.js"></script>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="./main.css">
<title>简单留言板</title>
</head>
<body>
<h1 id="h1">简单留言板-测试版</h1>
<div id="app" class="demo">
<p>{{ message }}</p>
<button id="re">刷新</button>
<div id="msg">
<p>test</p>
</div>
<script src="./main.js"></script>
显示名称:
<input id="user" type="text" required />
<br>
留言内容:
<input id="text" type="text" required/>
<br>
<button id="send" onclick="send()">发送</button>
</body>
</html>
15 changes: 9 additions & 6 deletions public/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Vue.createApp({
data() {
return {
message: '跑通了芜湖!'
function send(){
var user = document.getElementById("user").value;
var msg = document.getElementById("text").value;
$.get("http://127.0.0.1/add", { user : user , msg :msg }, function( data ,status ){
var sta = 1;
if (sta ==1){
alert(status);
}
}
}).mount('#app')
})
}s
3 changes: 3 additions & 0 deletions save/log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ Sat May 07 2022 09:06:06 GMT+0800 (GMT+08:00)-::ffff:127.0.0.1-主页面访问
Sat May 07 2022 09:10:27 GMT+0800 (GMT+08:00)-server-on
Sat May 07 2022 09:10:31 GMT+0800 (GMT+08:00)-::ffff:127.0.0.1-主页面访问
Sat May 07 2022 09:12:12 GMT+0800 (GMT+08:00)-::ffff:127.0.0.1-主页面访问
Sat May 07 2022 10:09:50 GMT+0800 (GMT+08:00)-server-on
Sat May 07 2022 10:11:55 GMT+0800 (GMT+08:00)-::ffff:127.0.0.1-主页面访问
Sat May 07 2022 10:12:15 GMT+0800 (GMT+08:00)-::ffff:127.0.0.1-添加留言请求
4 changes: 4 additions & 0 deletions save/msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
{
"user": "ph",
"msg": "芜湖!"
},
{
"user": "1",
"msg": "e"
}
]

0 comments on commit fee6998

Please sign in to comment.