diff --git a/20191208/20191208.md b/20191208/20191208.md new file mode 100644 index 0000000..84b07e1 --- /dev/null +++ b/20191208/20191208.md @@ -0,0 +1,4 @@ +# 20191208 + +![js](https://img.shields.io/badge/language-js-orange.svg) + diff --git a/20191211/20191211.md b/20191211/20191211.md new file mode 100644 index 0000000..cca4c93 --- /dev/null +++ b/20191211/20191211.md @@ -0,0 +1,68 @@ +# 20191211 + +![js](https://img.shields.io/badge/language-js-orange.svg) + +* 原型链 原型对象与实例对象之间的关系,是通过__proto__产生联系的 +```js +var box = document.getElementById('div') +// 实例对象的__proto__必然指向一个构造函数的原型对象prototype +box.__proto__ = HTMLDivElement.prototype +HTMLDivElement.__proto__ = HTMLElement.prototype +HTMLELement.__proto__ = Element.prototype +Element.__proto__ = Node.prototype +Node.__proto__ = EventTarget.prototype +EventTarget.__proto__ = Object.prototype +Object.__proto__ = null +``` +* 面向对象思想编程,提出需求,抽出相关对象,分析和总结对象的特征和行为,把特征定义成成属性,把行为定义成方法,定义构造函数 +* 通过构造函数的属性和方法,来完成相关需求 +* js不是一门面向对象的语言,而是基于对象的一门语言 +* 面向对象编程思想,都有类的概念,但是js没有类,但是可以通过构造函数模拟类,通过原型对象机继承,继承的目的是为了共享数据 +* 原型的作用之一:共享数据,节省内存 +* 原型的作用之二:实现继承 +* 多态 同一对象的不同行为或者同一行为针对同一对象产生的不同效果,现有继承后有多态 + +* 动物类 有名字, 颜色,都能吃 +* 狗类 有名字, 颜色,也都能吃, 也能看门 +* 大黄 有名字, 颜色, 也能吃,也能叫,能看门,能玩 +```js +function Animal(name, color) { + this.name = name + this.color = color +} +Animal.prototype.eat = function() { + console.log('能吃') +} +// 创建狗类 +function Dog(weight) { + this.weight = weight +} +// 改变原型指向实现继承 +Dog.prototype = new Animal('大黄','黑色') +Dog.prototype.bark = function() { + console.log('能叫能看门') +} +// 创建大黄 +function DaHuang(sex) { + this.sex = sex +} +DaHuang.prototype = new Dog('50Kg') +DaHuang.prototype.play = function() { + console.log('逗主任玩...') +} +var dh = new DaHuang('male') +console.log(dh.name, dh.color, dh.weight, dh.sex) +``` + +* 通过原型进行继承,改变原型的指向 -> 数据共享 + * 缺陷:因为改变原型指向实现继承,必须同时进行初始化赋值,所以导致属性重复,如果想改变属性,只有通过调用对象属性重新赋值 + * 解决属性重复赋值的问题 -> 通过借用构造函数来实现继承 + * 借用构造函数 构造函数名.call(this, 属性1, 属性2) + * 缺陷:不能共享方法 +```js +function Student(score, name, age, sex) { + Person.call(this,name,age,sex) + this.score = score +} +var st = new Student(100, '张三', 19, 'male') +``` diff --git a/Miscellaneous/UI.md b/Miscellaneous/UI.md new file mode 100644 index 0000000..4763ce1 --- /dev/null +++ b/Miscellaneous/UI.md @@ -0,0 +1,4 @@ +宽度 1366 +高度 768 (暂定十倍) + +header-banner -> 44px \ No newline at end of file diff --git a/Miscellaneous/flask.md b/Miscellaneous/flask.md index 9cdbaed..8ca5dd4 100644 --- a/Miscellaneous/flask.md +++ b/Miscellaneous/flask.md @@ -42,13 +42,13 @@ 设置全局变量 -`export FLASK_APP=app.py` +`export FLASK_APP=yiban.py` `export FLASK_ENV=development` 启动 -`flask run --host=0.0.0.0 -p 2000` +`flask run --host=0.0.0.0 -p 8001` 在虚拟环境下安装gunicorn @@ -74,7 +74,8 @@ autostart = ture 启动gunicorn -`gunicorn qrcode:app -c gunicorn.conf` +`gunicorn qrcodeLi:app -c gunicornLi.conf` +`gunicorn qrcodeMe:app -c gunicornMe.conf` 查询gunicorn diff --git a/Miscellaneous/nginx.conf b/Miscellaneous/nginx.conf index 539d3cd..b51f450 100644 --- a/Miscellaneous/nginx.conf +++ b/Miscellaneous/nginx.conf @@ -13,9 +13,19 @@ server { add_header Strict-Transport-Security "max-age=31536000"; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE; ssl_prefer_server_ciphers on; + location /data/ { + alias /data/qrcode/data/; + } + location /qr { + alias /data/qrcode/qr/; + index qrcode.html; + } location / { proxy_pass http://127.0.0.1:5000; } + location /li { + proxy_pass http://127.0.0.1:5001; + } } server { @@ -42,6 +52,44 @@ server { } } +server { + listen 80; + server_name blog.powerrain.cn; + + location / { + root /data/blog; + index index.html index.htm; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /data/wwwroot; + } +} + +server { + #SSL 访问端口号为 443 + listen 443 ssl http2; #填写绑定证书的域名 + server_name blog.powerrain.cn; + #证书文件名称 + ssl_certificate 1_blog.powerrain.cn_bundle.crt; + #私钥文件名称 + ssl_certificate_key 2_blog.powerrain.cn.key; + ssl_session_timeout 5m; + #请按照这个协议配置 + ssl_protocols TLSv1.1 TLSv1.2; + add_header Strict-Transport-Security "max-age=31536000"; + ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE; + ssl_prefer_server_ciphers on; + location / { + root /data/blog; + index index.html index.htm; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /data/wwwroot; + } +} + server { #SSL 访问端口号为 443 listen 443 ssl http2; #填写绑定证书的域名 @@ -136,7 +184,21 @@ server { server { listen 80; - server_name powerrain.cn localhost; + server_name powerrain.cn; + + location / { + root /data/wwwroot; + index index.html index.htm; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /data/wwwroot; + } +} + +server { + listen 80; + server_name localhost; location / { root /data/wwwroot;