From 416ac2644dfd293833d0808caa3c4871014bcf31 Mon Sep 17 00:00:00 2001 From: RainSun Date: Sun, 9 Feb 2020 20:25:10 +0800 Subject: [PATCH] update --- Miscellaneous/UI.md | 4 -- Miscellaneous/flask.md | 2 + Miscellaneous/flutter.md | 140 ++++++++++++++++++++++++++++++++---- Miscellaneous/test.js | 110 ---------------------------- Miscellaneous/todo.md | 25 ++++++- Miscellaneous/typescript.md | 19 +++++ Miscellaneous/冰箱.md | 21 ------ 7 files changed, 173 insertions(+), 148 deletions(-) delete mode 100644 Miscellaneous/UI.md delete mode 100644 Miscellaneous/test.js create mode 100644 Miscellaneous/typescript.md delete mode 100644 Miscellaneous/冰箱.md diff --git a/Miscellaneous/UI.md b/Miscellaneous/UI.md deleted file mode 100644 index 4763ce1..0000000 --- a/Miscellaneous/UI.md +++ /dev/null @@ -1,4 +0,0 @@ -宽度 1366 -高度 768 (暂定十倍) - -header-banner -> 44px \ No newline at end of file diff --git a/Miscellaneous/flask.md b/Miscellaneous/flask.md index 13bcde7..4586281 100644 --- a/Miscellaneous/flask.md +++ b/Miscellaneous/flask.md @@ -45,12 +45,14 @@ `export FLASK_APP=yiban.py` `export FLASK_APP=qrcodeLi.py` `export FLASK_APP=coc.py` +`export FLASK_APP=app.py` `export FLASK_ENV=development` 启动 `flask run --host=127.0.0.1 -p 5003` +`flask run --host=0.0.0.0 -p 5000` 在虚拟环境下安装gunicorn diff --git a/Miscellaneous/flutter.md b/Miscellaneous/flutter.md index 45a16bc..6122dae 100644 --- a/Miscellaneous/flutter.md +++ b/Miscellaneous/flutter.md @@ -1,18 +1,110 @@ # flutter 学习笔记 # 组件的使用 -* Text +* Text文字组件 + * `textAlign: TextAlign.start,` // 文本对齐方式 + * `textDirection: TextDirection.ltr` // 文本方向 + * `maxLines:1` // 最大行数 + * `textScaleFactor: 1.5,` // 文字缩放 + * `overflow: TextOverflow.ellipsis,` // 超出处理 + * `style:` + * TextStyle组件 + ```dart + TextStyle( + color: Colors.blue, + fontSize: 18.0, + height: 1.2, + fontFamily: "Courier", + background: new Paint()..color=Colors.yellow, + decoration:TextDecoration.underline, + decorationStyle: TextDecorationStyle.dashed + ), + ``` + * 文本接合,多个textSpan对文本进行修饰,然后拼合在一起 ```dart - Text( - 'flutter demo', - // 文本对齐方式 - textAlign: TextAlign.start, - // 文本方向 还有rtl - textDirection: TextDirection.ltr - ), - + Text.rich(TextSpan( + children: [ + TextSpan( + text: "https://flutterchina.club", + style: TextStyle( + color: Colors.blue + ), + recognizer: _tapRecognizer + ), + ... + ] + )) ``` - + * 字体设置[链接]('https://book.flutterchina.club/chapter3/text.html') +* 按钮 + * `RaisedButton` // 悬浮按钮 + * `FlatButton` // 扁平按钮 + * `OutlineButton` // 默认有边框 + * `IconButton` // 可点击的icon + * `icon: Icon(Icons.thumb_up),` + * 前三个都可以加`.icon`然后属性变成`icon`和`label` + * 自定义 + ```dart + const FlatButton({ + ... + @required this.onPressed, //按钮点击回调 + this.textColor, //按钮文字颜色 + this.disabledTextColor, //按钮禁用时的文字颜色 + this.color, //按钮背景颜色 + this.disabledColor,//按钮禁用时的背景颜色 + this.highlightColor, //按钮按下时的背景颜色 + this.splashColor, //点击时,水波动画中水波的颜色 + this.colorBrightness,//按钮主题,默认是浅色主题 + this.padding, //按钮的填充 + this.shape, //外形 + @required this.child, //按钮的内容 + }) + ``` +* 图片 + * pubspec.yaml配置 + ```yaml + assets: + - images/avatar.png + ``` + * 加载图片 + ```dart + Image( + image: AssetImage("images/avatar.png"), + width: 100.0 + ); + Image.asset("images/avatar.png", + width: 100.0, + ) + Image( + image: NetworkImage( + "https://avatars2.githubusercontent.com/u/20411648?s=460&v=4"), + width: 100.0, + ) + Image.network( + "https://avatars2.githubusercontent.com/u/20411648?s=460&v=4", + width: 100.0, + ) + const Image({ + ... + this.width, //图片的宽 + this.height, //图片高度 + this.color, //图片的混合色值 + this.colorBlendMode, //混合模式 + this.fit,//缩放模式 + this.alignment = Alignment.center, //对齐方式 + this.repeat = ImageRepeat.noRepeat, //重复方式 + ... + }) + ``` +* ICON + * `Icon(Icons.accessible,color: Colors.green,),` + * 使用自定义字体图标[链接]('https://book.flutterchina.club/chapter3/img_and_icon.html') +* Switch开关组件 + * `value: true` + * `onChanged` +* Checkbox多选组件 + * `value: true` + * `onChanged` * Stack层叠组件 * 定位相对于父元素 * `alignment: Alignment.center` // 总体控制 @@ -24,7 +116,7 @@ * `child: ` // 需要定位的子组件 * Positioned组件 * `left, bottom, top, right` // int 默认为0 - * `child: ` // 需要定位的子组件 + * `child: ` // 需要定位的子组件image * AspectRatio组件 * 默认横向占满父组件 * 可以用来控制图片 @@ -217,4 +309,28 @@ - assets/my_icon.png - assets/background.png ``` - assets指定应包含在应用程序中的文件, 每个asset都通过相对于pubspec.yaml文件所在的文件系统路径来标识自身的路径。asset的声明顺序是无关紧要的,asset的实际目录可以是任意文件夹(在本示例中是assets文件夹) \ No newline at end of file + assets指定应包含在应用程序中的文件, 每个asset都通过相对于pubspec.yaml文件所在的文件系统路径来标识自身的路径。asset的声明顺序是无关紧要的,asset的实际目录可以是任意文件夹(在本示例中是assets文件夹) +* 在Widget树中获取State对象 + * 方法一 + ```dart + // 直接通过of静态方法来获取ScaffoldState + ScaffoldState _state=Scaffold.of(context); + _state.showSnackBar( + SnackBar( + content: Text("我是SnackBar"), + ), + ); + ``` + * 方法二 + ```dart + //定义一个globalKey, 由于GlobalKey要保持全局唯一性,我们使用静态变量存储 + static GlobalKey _globalKey= GlobalKey(); + ... + Scaffold( + key: _globalKey , //设置key + ... + ) + _globalKey.currentState.openDrawer() + ``` + GlobalKey是Flutter提供的一种在整个APP中引用element的机制。如果一个widget设置了GlobalKey,那么我们便可以通过globalKey.currentWidget获得该widget对象、globalKey.currentElement来获得widget对应的element对象,如果当前widget是StatefulWidget,则可以通过globalKey.currentState来获得该widget对应的state对象。 +* \ No newline at end of file diff --git a/Miscellaneous/test.js b/Miscellaneous/test.js deleted file mode 100644 index 113666d..0000000 --- a/Miscellaneous/test.js +++ /dev/null @@ -1,110 +0,0 @@ -// function add() { -// // 第一次执行时,定义一个数组专门用来存储所有的参数 -// var _args = Array.prototype.slice.call(arguments); - -// // 在内部声明一个函数,利用闭包的特性保存_args并收集所有的参数值 -// var _adder = function() { -// _args.push(...arguments); -// return _adder; -// }; - -// // 利用toString隐式转换的特性,当最后执行时隐式转换,并计算最终的值返回 -// _adder.toString = function () { -// return _args.reduce(function (a, b) { -// return a + b; -// }); -// } -// return _adder; -// } - -// add(1)(2)(3) // 6 -// add(1, 2, 3)(4) // 10 -// add(1)(2)(3)(4)(5) // 15 -// add(2, 6)(1) - -// function f() { -// return 1 -// } - -// var obj = { -// c: true -// } -// var arr = [] -// var obj1 = { -// a: 2, -// b: obj, -// c: arr, -// d:f, -// e:function () { -// return 1 -// } -// } -// console.log(obj1) -// var test = JSON.parse(JSON.stringify(obj1)) -// console.log(test) -// var test1 = Object.assign({}, obj1) -// console.log(test1) -// obj = { -// c: false -// } -// arr = ['w'] -// obj1.b = [] -// console.log(obj) -// console.log(obj1) -// console.log(test) -// console.log(test1) - -// var obj = { -// // set a(val) { -// // this._a_ = val * 2 -// // }, -// // get a() { -// // return this._a_ -// // }, - -// } -// Object.defineProperty( -// obj, -// 'a', -// { -// set: function(val) { -// this._a_ = val * 2 -// }, -// get: function() { -// return this._a_ -// }, - -// writable: false, -// enumerable: true -// } -// ) -// obj.a = 2 -// console.log(obj) -// console.log(obj.a) - -// function Foo(who) { -// this.me = who -// } -// Foo.prototype.indetify = function() { -// return "I am" + this.me -// } -// function Bar(who) { -// Foo.call(this, who) -// } -// Bar.prototype = Object.create(Foo.prototype) -// Bar.prototype.speak = function() { -// alert('Hello,'+ this.indetify() + '.') -// } -// var b1 = new Bar('b1') -// var b2 = new Bar('b2') -// b1.speak() -// b2.speak() - -// var a = [1,2,3] -// var b = [1,2,3] -// var c = "1,2,3" -// console.log(a == b) -// console.log(a == c) -// console.log(b == c) - - diff --git a/Miscellaneous/todo.md b/Miscellaneous/todo.md index 130c054..1454e08 100644 --- a/Miscellaneous/todo.md +++ b/Miscellaneous/todo.md @@ -15,4 +15,27 @@ * `https://github.com/mikaelbr/node-notifier` -* `https://www.jianshu.com/p/077c9d5928f1` \ No newline at end of file +* `https://www.jianshu.com/p/077c9d5928f1` + +# Pass By +* 千百度 + * 仍然存在因为易班导致的用户流失问题 + * 仍然没实现最初想的短信通知的功能 + * 创建商品时有逻辑问题 + * 需要和coc进行登录端的结合以及授权 +* coc + * 未能实现成绩查询 + * 需要将登录单独抽离成一个接口 +* 学习了JavaScript + * 还剩半本没看 +* 学习了flutter + * 还剩一些高级操作没学 +* 学习了typeScript + * 对于vue的结合还需深入学习 +* qrcode + * 可以考虑二维码的生成,放在文件夹里由百度进行加速,防止接口失效 + * 可以做一个生成二维码的接口,但是做好防盗链 + +# Future +* codeBook +* 上边的问题一项一项解决,顺序是coc,qrcode,千百度 \ No newline at end of file diff --git a/Miscellaneous/typescript.md b/Miscellaneous/typescript.md new file mode 100644 index 0000000..b1e8f39 --- /dev/null +++ b/Miscellaneous/typescript.md @@ -0,0 +1,19 @@ +# typeScript 学习笔记 + +* 基础类型 + * any 声明为 any 的变量可以赋予任意类型的值。 + * number 双精度 64 位浮点值。它可以用来表示整数和分数。 + * string 一个字符系列 + * boolean true false + * 数组 + * `let arr: number[] = [1, 2];` + * `let arr: Array = [1, 2];` + * 元组 用来表示已知元素数量和类型的数组,各元素的类型不必相同,对应位置的类型需要相同 + * `let x: [string, number]; x = ['Runoob', 1];` + * enum 枚举类型用于定义数值集合。 + * `enum Color {Red, Green, Blue}; let c: Color = Color.Blue; console.log(c); // 输出 2` + * void 标识方法返回值的类型,表示此方法没有返回值 + * null + * undefined + * never + * 可以用 | 来支持多种类型 let x: number | null | undefined; \ No newline at end of file diff --git a/Miscellaneous/冰箱.md b/Miscellaneous/冰箱.md deleted file mode 100644 index 963d564..0000000 --- a/Miscellaneous/冰箱.md +++ /dev/null @@ -1,21 +0,0 @@ -# 冰箱物品整理 -* 一层 - * 肉皮 - * 饺子 - * 豆角 - * 一块冻干30%的肉 - * 一小块黄油 -* 二层 - * 一堆豆角 - * 蛋挞皮 - * 玉米粒 - * 两穗玉米 - * 一袋山菜 - * 冻豆腐 -* 三层 - * 四袋鱼 - * 三穗玉米 - * 未知液体 - * 三袋山菜 - * 玻璃叶饼 - * 花卷馒头