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) {
response.writeHead(200, {'Content-Type': 'text/plain'});
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); response.writeHead(404, {'Content-Type': 'text/html'}); }else{ 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 产品专家