日志-2021-8-26
RtZhao

TODO

添加、删除、修改之后需要刷新页面才能显示最新的数据,回调在关闭父层的layer时没起作用

多uid删除,没能实现数组的传递,还是走的json

搜索的reload没起作用

Node.js

创建第一个应用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var http = require('http');

http.createServer(function (request, response) {

// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});

// 发送响应数据 "Hello World"
response.end('Hello World\n');
}).listen(8888);

// 终端打印如下信息
console.log('Server running at http://127.0.0.1:8888/');

Web模块

HTTP服务器架构

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
var http = require('http');
var fs = require('fs');
var url = require('url');


// 创建服务器
http.createServer( function (request, response) {
// 解析请求,包括文件名
var pathname = url.parse(request.url).pathname;

// 输出请求的文件名
console.log("Request for " + pathname + " received.");

// 从文件系统中读取请求的文件内容
fs.readFile(pathname.substr(1), function (err, data) {
if (err) {
console.log(err);
// HTTP 状态码: 404 : NOT FOUND
// Content Type: text/html
response.writeHead(404, {'Content-Type': 'text/html'});
}else{
// HTTP 状态码: 200 : OK
// Content Type: text/html
response.writeHead(200, {'Content-Type': 'text/html'});

// 响应文件内容
response.write(data.toString());
}
// 发送响应数据
response.end();
});
}).listen(8080);

// 控制台会输出以下信息
console.log('Server running at http://127.0.0.1:8080/');

静态资源文件

1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>RtZhao</title>
</head>
<body>
<h1>我的第一个标题</h1>
<p>我的第一个段落。</p>
</body>
</html>

Web客户端

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
var http = require('http');

// 用于请求的选项
var options = {
host: 'localhost',
port: '8080',
path: '/index.html'
};

// 处理响应的回调函数
var callback = function(response){
// 不断更新数据
var body = '';
response.on('data', function(data) {
body += data;
});

response.on('end', function() {
// 数据接收完成
console.log(body);
});
}
// 向服务端发送请求
var req = http.request(options, callback);
req.end();

事务

ACID

原子性(Atomicity)

一致性(Consistency)

隔离性(Isolation)

持久性(Durability)

4种隔离级别

7种传播行为

html跳转传参

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 跳转时传参
var index = layer.open({
title: '编辑用户',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '../page/table/edit.html?uid=10003',
});


// 接收
var url = decodeURI(window.location.href);
var argsIndex = url .split("?uid=");
var arg = argsIndex[1];
console.log(arg+"----edit");

数据交互

SpringBoot接收Json

1
2
3
4
5
6
@RequestMapping(value = "/jsonTran")
@ResponseBody
public String userDetail( @RequestBody Map<String, Object> map){
System.out.println(map);
return "Hello World";
}
1
2
3
4
5
6
7
8
9
10
11
12
@RequestMapping(value = "/delectUserList")
@ResponseBody
public String delectUserList(@RequestBody List<TestUser> userList) throws IOException {
System.out.println(userList);
boolean flag = false;
for (TestUser testUser : userList) {
int uid = testUser.getUid();
int result = testUserService.deleteTestUser(uid);
flag = (result == 1);
}
return flag ? "删除成员列表成功" : "删除成员列表失败";
}
1
2
3
4
5
6
7
8
9
10
$.ajax({
url:"http://localhost:9091/test/delectUserList",
contentType: 'application/json;charset=UTF-8',
data:JSON.stringify(data),
type:"POST",
dataType:"json",
success:function (data) {
console.log(data);
}
})

Others

product specialists 产品专家

  • 本文标题:日志-2021-8-26
  • 本文作者:RtZhao
  • 创建时间:2021-08-26 08:49:27
  • 本文链接:https://www.rtzhao.site/2021/08/26/日志-2021-8-26/
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
 评论