├── .gitignore ├── AmnesiaNotepad ├── README.md ├── miniprogram │ ├── app.js │ ├── app.json │ ├── app.wxss │ ├── assets │ │ ├── iconfont.wxss │ │ └── weiui.wxss │ ├── components │ │ └── picker │ │ │ └── picker.wxss │ ├── images │ │ ├── add.png │ │ ├── author.png │ │ ├── bg-Pblack.jpg │ │ ├── clock.png │ │ ├── clockOn.png │ │ ├── commont.png │ │ ├── copy.png │ │ ├── copy_1.png │ │ ├── copy_2.png │ │ ├── copy_3.png │ │ ├── copy_4.png │ │ ├── daily.png │ │ ├── del.png │ │ ├── edition.png │ │ ├── empty.png │ │ ├── help.png │ │ ├── label.png │ │ ├── large.png │ │ ├── logo.png │ │ ├── logo_1.png │ │ ├── logo_2.png │ │ ├── logout.png │ │ ├── personal.png │ │ ├── personal_select.png │ │ ├── remind.png │ │ ├── sort.png │ │ ├── task.png │ │ ├── task_select.png │ │ ├── tim.gif │ │ ├── today.png │ │ └── today_select.png │ ├── miniprogram_npm │ │ ├── mobx-miniprogram-bindings │ │ │ ├── index.js │ │ │ └── index.js.map │ │ └── mobx-miniprogram │ │ │ └── index.js │ ├── node_modules │ │ ├── mobx-miniprogram-bindings │ │ │ ├── .babelrc │ │ │ ├── .eslintrc.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── gulpfile.js │ │ │ ├── miniprogram_dist │ │ │ │ ├── index.js │ │ │ │ └── index.js.map │ │ │ ├── package.json │ │ │ └── src │ │ │ │ └── index.js │ │ └── mobx-miniprogram │ │ │ ├── CHANGELOG.md │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── lib │ │ │ ├── api │ │ │ │ ├── action.d.ts │ │ │ │ ├── actiondecorator.d.ts │ │ │ │ ├── autorun.d.ts │ │ │ │ ├── become-observed.d.ts │ │ │ │ ├── computed.d.ts │ │ │ │ ├── configure.d.ts │ │ │ │ ├── decorate.d.ts │ │ │ │ ├── extendobservable.d.ts │ │ │ │ ├── extras.d.ts │ │ │ │ ├── flow.d.ts │ │ │ │ ├── intercept-read.d.ts │ │ │ │ ├── intercept.d.ts │ │ │ │ ├── iscomputed.d.ts │ │ │ │ ├── isobservable.d.ts │ │ │ │ ├── object-api.d.ts │ │ │ │ ├── observable.d.ts │ │ │ │ ├── observabledecorator.d.ts │ │ │ │ ├── observe.d.ts │ │ │ │ ├── tojs.d.ts │ │ │ │ ├── trace.d.ts │ │ │ │ ├── transaction.d.ts │ │ │ │ └── when.d.ts │ │ │ ├── core │ │ │ │ ├── action.d.ts │ │ │ │ ├── atom.d.ts │ │ │ │ ├── computedvalue.d.ts │ │ │ │ ├── derivation.d.ts │ │ │ │ ├── globalstate.d.ts │ │ │ │ ├── observable.d.ts │ │ │ │ ├── reaction.d.ts │ │ │ │ └── spy.d.ts │ │ │ ├── internal.d.ts │ │ │ ├── mobx.d.ts │ │ │ ├── mobx.js.flow │ │ │ ├── types │ │ │ │ ├── intercept-utils.d.ts │ │ │ │ ├── listen-utils.d.ts │ │ │ │ ├── modifiers.d.ts │ │ │ │ ├── observablearray.d.ts │ │ │ │ ├── observablemap.d.ts │ │ │ │ ├── observableobject.d.ts │ │ │ │ ├── observableset.d.ts │ │ │ │ ├── observablevalue.d.ts │ │ │ │ └── type-utils.d.ts │ │ │ └── utils │ │ │ │ ├── comparer.d.ts │ │ │ │ ├── decorators2.d.ts │ │ │ │ ├── eq.d.ts │ │ │ │ ├── iterable.d.ts │ │ │ │ └── utils.d.ts │ │ │ ├── miniprogram_dist │ │ │ └── index.js │ │ │ └── package.json │ ├── package-lock.json │ ├── package.json │ ├── pages │ │ ├── about │ │ │ ├── about.js │ │ │ ├── about.json │ │ │ ├── about.wxml │ │ │ └── about.wxss │ │ ├── author │ │ │ ├── author.js │ │ │ ├── author.json │ │ │ ├── author.wxml │ │ │ └── author.wxss │ │ ├── daily │ │ │ ├── daily.js │ │ │ ├── daily.json │ │ │ ├── daily.wxml │ │ │ └── daily.wxss │ │ ├── edition │ │ │ ├── edition.js │ │ │ ├── edition.json │ │ │ ├── edition.wxml │ │ │ └── edition.wxss │ │ ├── help │ │ │ ├── help.js │ │ │ ├── help.json │ │ │ ├── help.wxml │ │ │ └── help.wxss │ │ ├── label │ │ │ ├── label.js │ │ │ ├── label.json │ │ │ ├── label.wxml │ │ │ ├── label.wxss │ │ │ ├── label2.js │ │ │ ├── label2.wxml │ │ │ └── label2.wxss │ │ ├── personal │ │ │ ├── personal.js │ │ │ ├── personal.json │ │ │ ├── personal.wxml │ │ │ └── personal.wxss │ │ ├── task │ │ │ ├── task.js │ │ │ ├── task.json │ │ │ ├── task.wxml │ │ │ └── task.wxss │ │ └── totalTask │ │ │ ├── totalTask.js │ │ │ ├── totalTask.json │ │ │ ├── totalTask.wxml │ │ │ └── totalTask.wxss │ ├── sitemap.json │ ├── store.js │ └── utils │ │ ├── DataUtils.js │ │ ├── api.js │ │ ├── config.js │ │ ├── dateTimePicker.js │ │ └── request.js └── project.config.json ├── README.md ├── amnesia ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── xdx │ │ ├── App.java │ │ ├── common │ │ ├── common │ │ │ ├── AjaxResult.java │ │ │ ├── MyBaseMapper.java │ │ │ └── MyCommonService.java │ │ ├── config │ │ │ └── WebAppConfig.java │ │ ├── enums │ │ │ ├── IBaseEnum.java │ │ │ ├── TaskTypeEnum.java │ │ │ └── YesOrNoStatusEnum.java │ │ ├── handler │ │ │ └── BaseEnumTypeHandler.java │ │ ├── interceptor │ │ │ └── LoginInterceptor.java │ │ └── utils │ │ │ ├── AccessToken.java │ │ │ ├── CheckParams.java │ │ │ ├── DateUtils.java │ │ │ ├── FileUtils.java │ │ │ ├── HttpClient.java │ │ │ ├── JsonUtils.java │ │ │ ├── PasswordUtils.java │ │ │ ├── SpringContextUtils.java │ │ │ ├── Tools.java │ │ │ ├── UUIDUtils.java │ │ │ └── wx │ │ │ ├── AccessToken.java │ │ │ ├── Tools.java │ │ │ └── WxMsgUtils.java │ │ ├── controller │ │ ├── label │ │ │ └── SyLabelController.java │ │ ├── other │ │ │ └── OtherController.java │ │ ├── task │ │ │ └── SyTaskController.java │ │ ├── template │ │ │ └── TmpController.java │ │ └── user │ │ │ └── SyUserController.java │ │ ├── entitys │ │ ├── config │ │ │ └── AppletConfig.java │ │ └── pojo │ │ │ ├── SyEdition.java │ │ │ ├── SyLabel.java │ │ │ ├── SyTask.java │ │ │ ├── SyTemplate.java │ │ │ └── SyUser.java │ │ ├── mapper │ │ ├── label │ │ │ └── SyLabelMapper.java │ │ ├── other │ │ │ └── SyEditionMapper.java │ │ ├── task │ │ │ └── SyTaskMapper.java │ │ ├── template │ │ │ └── SyTemplateMapper.java │ │ └── user │ │ │ └── SyUserMapper.java │ │ ├── service │ │ ├── label │ │ │ ├── SyLabelService.java │ │ │ └── impl │ │ │ │ └── SyLabelServiceImpl.java │ │ ├── other │ │ │ ├── OtherService.java │ │ │ └── impl │ │ │ │ └── OtherServiceImpl.java │ │ ├── task │ │ │ ├── SyTaskService.java │ │ │ └── impl │ │ │ │ └── SyTaskServiceImpl.java │ │ ├── timingtask │ │ │ ├── ChangeTask.java │ │ │ └── RemoveTask.java │ │ ├── tmplate │ │ │ ├── TmpService.java │ │ │ └── impl │ │ │ │ └── TmpServiceImpl.java │ │ └── user │ │ │ ├── SyUserService.java │ │ │ └── impl │ │ │ └── SyUserServiceImpl.java │ │ └── timingtask │ │ ├── ChangeTask.java │ │ ├── RemoveTask.java │ │ └── TodoNoticeTask.java │ └── resources │ ├── application-dev.yml │ ├── application.yml │ ├── logback-spring.xml │ └── mappers │ ├── label │ └── SyLabelMapper.xml │ ├── other │ └── SyEditionMapper.xml │ ├── task │ └── SyTaskMapper.xml │ ├── template │ └── SyTemplateMapper.xml │ └── user │ └── SyUserMapper.xml └── other ├── amnesia.jpg ├── preview.png └── tx_amnesia.sql /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | 3 | ##ignore this file## 4 | /target/ 5 | 6 | .classpath 7 | .project 8 | .settings 9 | ##filter databfile、sln file## 10 | *.mdb 11 | *.ldb 12 | *.sln 13 | ##class file## 14 | *.com 15 | *.class 16 | *.dll 17 | *.exe 18 | *.o 19 | *.so 20 | # compression file 21 | *.7z 22 | *.dmg 23 | *.gz 24 | *.iso 25 | *.jar 26 | *.rar 27 | *.tar 28 | *.zip 29 | *.via 30 | *.tmp 31 | *.err 32 | # OS generated files # 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | Icon? 39 | ehthumbs.db 40 | Thumbs.db 41 | *.iml 42 | .idea 43 | *.log 44 | 45 | amnesia/src/main/resources/application-prod.yml 46 | -------------------------------------------------------------------------------- /AmnesiaNotepad/README.md: -------------------------------------------------------------------------------- 1 | # 云开发 quickstart 2 | 3 | 这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力: 4 | 5 | - 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库 6 | - 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理 7 | - 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码 8 | 9 | ## 参考文档 10 | 11 | - [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html) 12 | 13 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | 4 | }) 5 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/task/task", 4 | "pages/personal/personal", 5 | "pages/author/author", 6 | "pages/about/about", 7 | "pages/help/help", 8 | "pages/totalTask/totalTask", 9 | "pages/label/label" 10 | ], 11 | "window": { 12 | "backgroundColor": "#F6F6F6", 13 | "backgroundTextStyle": "light", 14 | "navigationBarBackgroundColor": "#F6F6F6", 15 | "navigationBarTitleText": "失忆备忘录", 16 | "navigationBarTextStyle": "black" 17 | }, 18 | "tabBar": { 19 | "selectedColor":"#1296db", 20 | "list": [{ 21 | "pagePath": "pages/task/task", 22 | "text": "今日任务", 23 | "iconPath":"./images/today.png", 24 | "selectedIconPath":"./images/today_select.png" 25 | },{ 26 | "pagePath": "pages/totalTask/totalTask", 27 | "text": "任务总览", 28 | "iconPath":"./images/task.png", 29 | "selectedIconPath":"./images/task_select.png" 30 | },{ 31 | "pagePath": "pages/personal/personal", 32 | "text": "个人中心", 33 | "iconPath":"./images/personal.png", 34 | "selectedIconPath":"./images/personal_select.png" 35 | }] 36 | }, 37 | "sitemapLocation": "sitemap.json", 38 | "style": "v2" 39 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | flex-direction: column; 4 | align-items: center; 5 | box-sizing: border-box; 6 | background-color: white; 7 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/components/picker/picker.wxss: -------------------------------------------------------------------------------- 1 | 2 | .mask { 3 | position: fixed; 4 | left: 0; 5 | right: 0; 6 | bottom: 0; 7 | top: 0; 8 | z-index: 9999; 9 | background: rgba(0, 0, 0, .4); 10 | transition: all .4s ease-in-out 0; 11 | pointer-events: none; 12 | opacity: 1; 13 | pointer-events: auto 14 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/add.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/author.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/author.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/bg-Pblack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/bg-Pblack.jpg -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/clock.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/clockOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/clockOn.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/commont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/commont.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/copy.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/copy_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/copy_1.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/copy_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/copy_2.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/copy_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/copy_3.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/copy_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/copy_4.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/daily.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/daily.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/del.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/del.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/edition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/edition.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/empty.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/help.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/label.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/large.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/logo.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/logo_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/logo_1.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/logo_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/logo_2.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/logout.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/personal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/personal.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/personal_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/personal_select.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/remind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/remind.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/sort.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/task.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/task_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/task_select.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/tim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/tim.gif -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/today.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/today.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/images/today_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/AmnesiaNotepad/miniprogram/images/today_select.png -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram-bindings/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | ["module-resolver", { 4 | "root": ["./src"], 5 | "alias": {} 6 | }] 7 | ], 8 | "presets": [ 9 | ["env", {"loose": true, "modules": "commonjs"}] 10 | ] 11 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram-bindings/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'extends': [ 3 | 'airbnb-base', 4 | 'plugin:promise/recommended' 5 | ], 6 | 'parserOptions': { 7 | 'ecmaVersion': 9, 8 | 'ecmaFeatures': { 9 | 'jsx': false 10 | }, 11 | 'sourceType': 'module' 12 | }, 13 | 'env': { 14 | 'es6': true, 15 | 'node': true, 16 | 'jest': true 17 | }, 18 | 'plugins': [ 19 | 'import', 20 | 'node', 21 | 'promise' 22 | ], 23 | 'rules': { 24 | 'arrow-parens': 'off', 25 | 'comma-dangle': [ 26 | 'error', 27 | 'only-multiline' 28 | ], 29 | 'complexity': ['error', 10], 30 | 'func-names': 'off', 31 | 'global-require': 'off', 32 | 'handle-callback-err': [ 33 | 'error', 34 | '^(err|error)$' 35 | ], 36 | 'import/no-unresolved': [ 37 | 'error', 38 | { 39 | 'caseSensitive': true, 40 | 'commonjs': true, 41 | 'ignore': ['^[^.]'] 42 | } 43 | ], 44 | 'import/prefer-default-export': 'off', 45 | 'linebreak-style': 'off', 46 | 'no-catch-shadow': 'error', 47 | 'no-continue': 'off', 48 | 'no-div-regex': 'warn', 49 | 'no-else-return': 'off', 50 | 'no-param-reassign': 'off', 51 | 'no-plusplus': 'off', 52 | 'no-shadow': 'off', 53 | 'no-multi-assign': 'off', 54 | 'no-underscore-dangle': 'off', 55 | 'node/no-deprecated-api': 'error', 56 | 'node/process-exit-as-throw': 'error', 57 | 'object-curly-spacing': [ 58 | 'error', 59 | 'never' 60 | ], 61 | 'operator-linebreak': [ 62 | 'error', 63 | 'after', 64 | { 65 | 'overrides': { 66 | ':': 'before', 67 | '?': 'before' 68 | } 69 | } 70 | ], 71 | 'prefer-arrow-callback': 'off', 72 | 'prefer-destructuring': 'off', 73 | 'prefer-template': 'off', 74 | 'quote-props': [ 75 | 1, 76 | 'as-needed', 77 | { 78 | 'unnecessary': true 79 | } 80 | ], 81 | 'semi': [ 82 | 'error', 83 | 'never' 84 | ] 85 | }, 86 | 'globals': { 87 | 'window': true, 88 | 'document': true, 89 | 'App': true, 90 | 'Page': true, 91 | 'Component': true, 92 | 'Behavior': true, 93 | 'wx': true, 94 | 'getCurrentPages': true, 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram-bindings/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 wechat-miniprogram 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram-bindings/gulpfile.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const gulp = require('gulp') 3 | const clean = require('gulp-clean') 4 | const webpack = require('webpack') 5 | const nodeExternals = require('webpack-node-externals') 6 | 7 | const src = path.resolve(__dirname, 'src') 8 | const dist = path.resolve(__dirname, 'miniprogram_dist') 9 | 10 | function getWebpackConfig(production) { 11 | return { 12 | mode: production ? 'production' : 'development', 13 | entry: src, 14 | output: { 15 | path: dist, 16 | filename: 'index.js', 17 | libraryTarget: 'commonjs2', 18 | }, 19 | target: 'node', 20 | externals: [nodeExternals()], 21 | module: { 22 | rules: [{ 23 | test: /\.js$/i, 24 | use: [ 25 | 'babel-loader', 26 | 'eslint-loader' 27 | ], 28 | exclude: /node_modules/ 29 | }], 30 | }, 31 | resolve: { 32 | modules: [src, 'node_modules'], 33 | extensions: ['.js', '.json'], 34 | }, 35 | plugins: [ 36 | new webpack.DefinePlugin({}), 37 | new webpack.optimize.LimitChunkCountPlugin({maxChunks: 1}), 38 | ], 39 | optimization: { 40 | minimize: false, 41 | }, 42 | devtool: 'nosources-source-map', 43 | performance: { 44 | hints: 'warning', 45 | assetFilter: assetFilename => assetFilename.endsWith('.js') 46 | } 47 | } 48 | } 49 | 50 | gulp.task('clean', () => gulp.src(dist, {read: false, allowEmpty: true}).pipe(clean())) 51 | 52 | gulp.task('dev', (cb) => { 53 | webpack(getWebpackConfig(false), cb) 54 | }) 55 | 56 | gulp.task('build', (cb) => { 57 | webpack(getWebpackConfig(true), cb) 58 | }) 59 | 60 | gulp.task('default', gulp.series('clean', 'build')) 61 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram-bindings/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "mobx-miniprogram-bindings", 3 | "_id": "mobx-miniprogram-bindings@1.2.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-mWwFY7p0LrWDXZcr0+9FqZr4SBE=", 6 | "_location": "/mobx-miniprogram-bindings", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "mobx-miniprogram-bindings", 12 | "name": "mobx-miniprogram-bindings", 13 | "escapedName": "mobx-miniprogram-bindings", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npm.taobao.org/mobx-miniprogram-bindings/download/mobx-miniprogram-bindings-1.2.1.tgz", 23 | "_shasum": "996c0563ba742eb5835d972bd3ef45a99af84811", 24 | "_spec": "mobx-miniprogram-bindings", 25 | "_where": "C:\\Users\\Administrator\\Desktop\\AmnesiaNotepad\\miniprogram", 26 | "author": { 27 | "name": "wechat-miniprogram" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/wechat-miniprogram/mobx-miniprogram-bindings/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "deprecated": false, 34 | "description": "Mobx binding utils for WeChat miniprogram", 35 | "devDependencies": { 36 | "babel-core": "^6.26.3", 37 | "babel-loader": "^7.1.5", 38 | "babel-plugin-module-resolver": "^3.2.0", 39 | "babel-preset-env": "^1.7.0", 40 | "colors": "^1.3.1", 41 | "eslint": "^5.14.1", 42 | "eslint-config-airbnb-base": "13.1.0", 43 | "eslint-loader": "^2.1.2", 44 | "eslint-plugin-import": "^2.16.0", 45 | "eslint-plugin-node": "^7.0.1", 46 | "eslint-plugin-promise": "^3.8.0", 47 | "gulp": "^4.0.0", 48 | "gulp-clean": "^0.4.0", 49 | "gulp-if": "^2.0.2", 50 | "gulp-install": "^1.1.0", 51 | "gulp-less": "^4.0.1", 52 | "gulp-rename": "^1.4.0", 53 | "gulp-sourcemaps": "^2.6.5", 54 | "jest": "^23.5.0", 55 | "miniprogram-simulate": "^1.0.7", 56 | "mobx-miniprogram": "^4.0.0", 57 | "through2": "^2.0.3", 58 | "vinyl": "^2.2.0", 59 | "webpack": "^4.29.5", 60 | "webpack-node-externals": "^1.7.2" 61 | }, 62 | "homepage": "https://github.com/wechat-miniprogram/mobx-miniprogram-bindings#readme", 63 | "jest": { 64 | "testEnvironment": "jsdom", 65 | "testURL": "https://jest.test", 66 | "collectCoverageFrom": [ 67 | "src/**/*.js" 68 | ], 69 | "moduleDirectories": [ 70 | "node_modules", 71 | "src" 72 | ] 73 | }, 74 | "keywords": [ 75 | "mobx", 76 | "wechat", 77 | "miniprogram" 78 | ], 79 | "license": "MIT", 80 | "main": "miniprogram_dist/index.js", 81 | "miniprogram": "miniprogram_dist", 82 | "name": "mobx-miniprogram-bindings", 83 | "peerDependencies": { 84 | "mobx-miniprogram": "^4.0.0" 85 | }, 86 | "repository": { 87 | "type": "git", 88 | "url": "git+https://github.com/wechat-miniprogram/mobx-miniprogram-bindings.git" 89 | }, 90 | "scripts": { 91 | "build": "gulp", 92 | "clean": "gulp clean", 93 | "clean-dev": "gulp clean --develop", 94 | "coverage": "jest ./test/* --coverage --bail", 95 | "dev": "gulp dev", 96 | "dist": "npm run build", 97 | "lint": "eslint \"src/**/*.js\"", 98 | "lint-tools": "eslint \"tools/**/*.js\"", 99 | "test": "jest ./test/* --bail" 100 | }, 101 | "version": "1.2.1" 102 | } 103 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Michel Weststrate 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/action.d.ts: -------------------------------------------------------------------------------- 1 | import { IAction } from "../internal"; 2 | export interface IActionFactory { 3 | R>(fn: T): T & IAction; 4 | R>(fn: T): T & IAction; 5 | R>(fn: T): T & IAction; 6 | R>(fn: T): T & IAction; 7 | R>(fn: T): T & IAction; 8 | R>(fn: T): T & IAction; 9 | R>(name: string, fn: T): T & IAction; 10 | R>(name: string, fn: T): T & IAction; 11 | R>(name: string, fn: T): T & IAction; 12 | R>(name: string, fn: T): T & IAction; 13 | R>(name: string, fn: T): T & IAction; 14 | R>(name: string, fn: T): T & IAction; 15 | (fn: T): T & IAction; 16 | (name: string, fn: T): T & IAction; 17 | (customName: string): (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor) => void; 18 | (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void; 19 | bound(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void; 20 | } 21 | export declare const action: IActionFactory; 22 | export declare function runInAction(block: () => T): T; 23 | export declare function runInAction(name: string, block: () => T): T; 24 | export declare function isAction(thing: any): boolean; 25 | export declare function defineBoundAction(target: any, propertyName: string, fn: Function): void; 26 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/actiondecorator.d.ts: -------------------------------------------------------------------------------- 1 | import { BabelDescriptor } from "../internal"; 2 | declare function dontReassignFields(): void; 3 | export declare function namedActionDecorator(name: string): (target: any, prop: any, descriptor: BabelDescriptor) => any; 4 | export declare function actionFieldDecorator(name: string): (target: any, prop: any, descriptor: any) => void; 5 | export declare function boundActionDecorator(target: any, propertyName: any, descriptor: any, applyToInstance?: boolean): { 6 | configurable: boolean; 7 | enumerable: boolean; 8 | get(): any; 9 | set: typeof dontReassignFields; 10 | } | { 11 | enumerable: boolean; 12 | configurable: boolean; 13 | set(v: any): void; 14 | get(): undefined; 15 | } | null; 16 | export {}; 17 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/autorun.d.ts: -------------------------------------------------------------------------------- 1 | import { IReactionPublic, IReactionDisposer, IEqualsComparer } from "../internal"; 2 | export interface IAutorunOptions { 3 | delay?: number; 4 | name?: string; 5 | scheduler?: (callback: () => void) => any; 6 | onError?: (error: any) => void; 7 | } 8 | /** 9 | * Creates a named reactive view and keeps it alive, so that the view is always 10 | * updated if one of the dependencies changes, even when the view is not further used by something else. 11 | * @param view The reactive view 12 | * @returns disposer function, which can be used to stop the view from being updated in the future. 13 | */ 14 | export declare function autorun(view: (r: IReactionPublic) => any, opts?: IAutorunOptions): IReactionDisposer; 15 | export declare type IReactionOptions = IAutorunOptions & { 16 | fireImmediately?: boolean; 17 | equals?: IEqualsComparer; 18 | }; 19 | export declare function reaction(expression: (r: IReactionPublic) => T, effect: (arg: T, r: IReactionPublic) => void, opts?: IReactionOptions): IReactionDisposer; 20 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/become-observed.d.ts: -------------------------------------------------------------------------------- 1 | import { IObservableArray, IObservable, IComputedValue, ObservableMap, ObservableSet, Lambda } from "../internal"; 2 | export declare function onBecomeObserved(value: IObservable | IComputedValue | IObservableArray | ObservableMap | ObservableSet, listener: Lambda): Lambda; 3 | export declare function onBecomeObserved(value: ObservableMap | Object, property: K, listener: Lambda): Lambda; 4 | export declare function onBecomeUnobserved(value: IObservable | IComputedValue | IObservableArray | ObservableMap | ObservableSet, listener: Lambda): Lambda; 5 | export declare function onBecomeUnobserved(value: ObservableMap | Object, property: K, listener: Lambda): Lambda; 6 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/computed.d.ts: -------------------------------------------------------------------------------- 1 | import { IComputedValueOptions, IComputedValue } from "../internal"; 2 | export interface IComputed { 3 | (options: IComputedValueOptions): any; 4 | (func: () => T, setter: (v: T) => void): IComputedValue; 5 | (func: () => T, options?: IComputedValueOptions): IComputedValue; 6 | (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor): void; 7 | struct(target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor): void; 8 | } 9 | export declare const computedDecorator: Function; 10 | /** 11 | * Decorator for class properties: @computed get value() { return expr; }. 12 | * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`; 13 | */ 14 | export declare const computed: IComputed; 15 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/configure.d.ts: -------------------------------------------------------------------------------- 1 | export declare function configure(options: { 2 | enforceActions?: boolean | "strict" | "never" | "always" | "observed"; 3 | computedRequiresReaction?: boolean; 4 | computedConfigurable?: boolean; 5 | isolateGlobalState?: boolean; 6 | disableErrorBoundaries?: boolean; 7 | arrayBuffer?: number; 8 | reactionScheduler?: (f: () => void) => void; 9 | }): void; 10 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/decorate.d.ts: -------------------------------------------------------------------------------- 1 | export declare function decorate(clazz: new (...args: any[]) => T, decorators: { 2 | [P in keyof T]?: MethodDecorator | PropertyDecorator | Array | Array; 3 | }): void; 4 | export declare function decorate(object: T, decorators: { 5 | [P in keyof T]?: MethodDecorator | PropertyDecorator | Array | Array; 6 | }): T; 7 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/extendobservable.d.ts: -------------------------------------------------------------------------------- 1 | import { CreateObservableOptions } from "../internal"; 2 | export declare function extendShallowObservable(target: A, properties: B, decorators?: { 3 | [K in keyof B]?: Function; 4 | }): A & B; 5 | export declare function extendObservable(target: A, properties: B, decorators?: { 6 | [K in keyof B]?: Function; 7 | }, options?: CreateObservableOptions): A & B; 8 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/extras.d.ts: -------------------------------------------------------------------------------- 1 | export interface IDependencyTree { 2 | name: string; 3 | dependencies?: IDependencyTree[]; 4 | } 5 | export interface IObserverTree { 6 | name: string; 7 | observers?: IObserverTree[]; 8 | } 9 | export declare function getDependencyTree(thing: any, property?: string): IDependencyTree; 10 | export declare function getObserverTree(thing: any, property?: string): IObserverTree; 11 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/flow.d.ts: -------------------------------------------------------------------------------- 1 | export declare type CancellablePromise = Promise & { 2 | cancel(): void; 3 | }; 4 | export interface FlowYield { 5 | "!!flowYield": undefined; 6 | } 7 | export interface FlowReturn { 8 | "!!flowReturn": T; 9 | } 10 | export declare type FlowReturnType = IfAllAreFlowYieldThenVoid ? FR extends Promise ? FRP : FR : R extends Promise ? FlowYield : R>; 11 | export declare type IfAllAreFlowYieldThenVoid = Exclude extends never ? void : Exclude; 12 | export declare function flow(generator: (...args: Args) => IterableIterator): (...args: Args) => CancellablePromise>; 13 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/intercept-read.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda, IObservableValue, IObservableArray, ObservableMap, ObservableSet } from "../internal"; 2 | export declare type ReadInterceptor = (value: any) => T; 3 | /** Experimental feature right now, tested indirectly via Mobx-State-Tree */ 4 | export declare function interceptReads(value: IObservableValue, handler: ReadInterceptor): Lambda; 5 | export declare function interceptReads(observableArray: IObservableArray, handler: ReadInterceptor): Lambda; 6 | export declare function interceptReads(observableMap: ObservableMap, handler: ReadInterceptor): Lambda; 7 | export declare function interceptReads(observableSet: ObservableSet, handler: ReadInterceptor): Lambda; 8 | export declare function interceptReads(object: Object, property: string, handler: ReadInterceptor): Lambda; 9 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/intercept.d.ts: -------------------------------------------------------------------------------- 1 | import { IInterceptor, IValueWillChange, IObservableValue, Lambda, IObservableArray, IArrayWillChange, IArrayWillSplice, ObservableMap, IMapWillChange, ObservableSet, ISetWillChange, IObjectWillChange } from "../internal"; 2 | export declare function intercept(value: IObservableValue, handler: IInterceptor>): Lambda; 3 | export declare function intercept(observableArray: IObservableArray, handler: IInterceptor | IArrayWillSplice>): Lambda; 4 | export declare function intercept(observableMap: ObservableMap, handler: IInterceptor>): Lambda; 5 | export declare function intercept(observableMap: ObservableSet, handler: IInterceptor>): Lambda; 6 | export declare function intercept(observableMap: ObservableMap, property: K, handler: IInterceptor>): Lambda; 7 | export declare function intercept(object: Object, handler: IInterceptor): Lambda; 8 | export declare function intercept(object: T, property: K, handler: IInterceptor>): Lambda; 9 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/iscomputed.d.ts: -------------------------------------------------------------------------------- 1 | export declare function _isComputed(value: any, property?: string): boolean; 2 | export declare function isComputed(value: any): boolean; 3 | export declare function isComputedProp(value: any, propName: string): boolean; 4 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/isobservable.d.ts: -------------------------------------------------------------------------------- 1 | export declare function isObservable(value: any): boolean; 2 | export declare function isObservableProp(value: any, propName: string): boolean; 3 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/object-api.d.ts: -------------------------------------------------------------------------------- 1 | import { ObservableMap, IObservableArray, ObservableSet } from "../internal"; 2 | export declare function keys(map: ObservableMap): ReadonlyArray; 3 | export declare function keys(ar: IObservableArray): ReadonlyArray; 4 | export declare function keys(set: ObservableSet): ReadonlyArray; 5 | export declare function keys(obj: T): ReadonlyArray; 6 | export declare function values(map: ObservableMap): ReadonlyArray; 7 | export declare function values(set: ObservableSet): ReadonlyArray; 8 | export declare function values(ar: IObservableArray): ReadonlyArray; 9 | export declare function values(obj: T): ReadonlyArray; 10 | export declare function entries(map: ObservableMap): ReadonlyArray<[K, T]>; 11 | export declare function entries(set: ObservableSet): ReadonlyArray<[T, T]>; 12 | export declare function entries(ar: IObservableArray): ReadonlyArray<[number, T]>; 13 | export declare function entries(obj: T): ReadonlyArray<[string, any]>; 14 | export declare function set(obj: ObservableMap, values: { 15 | [key: string]: V; 16 | }): any; 17 | export declare function set(obj: ObservableMap, key: K, value: V): any; 18 | export declare function set(obj: ObservableSet, value: T): any; 19 | export declare function set(obj: IObservableArray, index: number, value: T): any; 20 | export declare function set(obj: T, values: { 21 | [key: string]: any; 22 | }): any; 23 | export declare function set(obj: T, key: string, value: any): any; 24 | export declare function remove(obj: ObservableMap, key: K): any; 25 | export declare function remove(obj: ObservableSet, key: T): any; 26 | export declare function remove(obj: IObservableArray, index: number): any; 27 | export declare function remove(obj: T, key: string): any; 28 | export declare function has(obj: ObservableMap, key: K): boolean; 29 | export declare function has(obj: ObservableSet, key: T): boolean; 30 | export declare function has(obj: IObservableArray, index: number): boolean; 31 | export declare function has(obj: T, key: string): boolean; 32 | export declare function get(obj: ObservableMap, key: K): V | undefined; 33 | export declare function get(obj: IObservableArray, index: number): T | undefined; 34 | export declare function get(obj: T, key: string): any; 35 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/observable.d.ts: -------------------------------------------------------------------------------- 1 | import { IEqualsComparer, IObservableDecorator, IEnhancer, IObservableArray, ObservableMap, IObservableObject, IObservableValue, IObservableSetInitialValues, ObservableSet, IObservableMapInitialValues } from "../internal"; 2 | export declare type CreateObservableOptions = { 3 | name?: string; 4 | equals?: IEqualsComparer; 5 | deep?: boolean; 6 | defaultDecorator?: IObservableDecorator; 7 | }; 8 | export declare const defaultCreateObservableOptions: CreateObservableOptions; 9 | export declare const shallowCreateObservableOptions: { 10 | deep: boolean; 11 | name: undefined; 12 | defaultDecorator: undefined; 13 | }; 14 | export declare function asCreateObservableOptions(thing: any): CreateObservableOptions; 15 | export declare const deepDecorator: IObservableDecorator; 16 | export declare const refDecorator: IObservableDecorator; 17 | export interface IObservableFactory { 18 | (value: number | string | null | undefined | boolean): never; 19 | (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor): any; 20 | (value: T[], options?: CreateObservableOptions): IObservableArray; 21 | (value: Set, options?: CreateObservableOptions): ObservableSet; 22 | (value: Map, options?: CreateObservableOptions): ObservableMap; 23 | (value: T, decorators?: { 24 | [K in keyof T]?: Function; 25 | }, options?: CreateObservableOptions): T & IObservableObject; 26 | } 27 | export interface IObservableFactories { 28 | box(value?: T, options?: CreateObservableOptions): IObservableValue; 29 | shallowBox(value?: T, options?: CreateObservableOptions): IObservableValue; 30 | array(initialValues?: T[], options?: CreateObservableOptions): IObservableArray; 31 | shallowArray(initialValues?: T[], options?: CreateObservableOptions): IObservableArray; 32 | set(initialValues?: IObservableSetInitialValues, options?: CreateObservableOptions): ObservableSet; 33 | map(initialValues?: IObservableMapInitialValues, options?: CreateObservableOptions): ObservableMap; 34 | shallowMap(initialValues?: IObservableMapInitialValues, options?: CreateObservableOptions): ObservableMap; 35 | object(props: T, decorators?: { 36 | [K in keyof T]?: Function; 37 | }, options?: CreateObservableOptions): T & IObservableObject; 38 | shallowObject(props: T, decorators?: { 39 | [K in keyof T]?: Function; 40 | }, options?: CreateObservableOptions): T & IObservableObject; 41 | /** 42 | * Decorator that creates an observable that only observes the references, but doesn't try to turn the assigned value into an observable.ts. 43 | */ 44 | ref: IObservableDecorator; 45 | /** 46 | * Decorator that creates an observable converts its value (objects, maps or arrays) into a shallow observable structure 47 | */ 48 | shallow: IObservableDecorator; 49 | deep: IObservableDecorator; 50 | struct: IObservableDecorator; 51 | } 52 | export declare const observable: IObservableFactory & IObservableFactories & { 53 | enhancer: IEnhancer; 54 | }; 55 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/observabledecorator.d.ts: -------------------------------------------------------------------------------- 1 | import { IEnhancer } from "../internal"; 2 | export declare type IObservableDecorator = { 3 | (target: Object, property: string | symbol, descriptor?: PropertyDescriptor): void; 4 | enhancer: IEnhancer; 5 | }; 6 | export declare function createDecoratorForEnhancer(enhancer: IEnhancer): IObservableDecorator; 7 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/observe.d.ts: -------------------------------------------------------------------------------- 1 | import { IObservableArray, IArrayChange, IArraySplice, IObservableValue, IComputedValue, IValueDidChange, Lambda, ObservableSet, ISetDidChange, ObservableMap, IMapDidChange, IObjectDidChange } from "../internal"; 2 | export declare function observe(value: IObservableValue | IComputedValue, listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 3 | export declare function observe(observableArray: IObservableArray, listener: (change: IArrayChange | IArraySplice) => void, fireImmediately?: boolean): Lambda; 4 | export declare function observe(observableMap: ObservableSet, listener: (change: ISetDidChange) => void, fireImmediately?: boolean): Lambda; 5 | export declare function observe(observableMap: ObservableMap, listener: (change: IMapDidChange) => void, fireImmediately?: boolean): Lambda; 6 | export declare function observe(observableMap: ObservableMap, property: K, listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 7 | export declare function observe(object: Object, listener: (change: IObjectDidChange) => void, fireImmediately?: boolean): Lambda; 8 | export declare function observe(object: T, property: K, listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 9 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/tojs.d.ts: -------------------------------------------------------------------------------- 1 | export declare type ToJSOptions = { 2 | detectCycles?: boolean; 3 | exportMapsAsObjects?: boolean; 4 | recurseEverything?: boolean; 5 | }; 6 | /** 7 | * Basically, a deep clone, so that no reactive property will exist anymore. 8 | */ 9 | export declare function toJS(source: T, options?: ToJSOptions): T; 10 | export declare function toJS(source: any, options?: ToJSOptions): any; 11 | export declare function toJS(source: any, options: ToJSOptions): any; 12 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/trace.d.ts: -------------------------------------------------------------------------------- 1 | export declare function trace(thing?: any, prop?: string, enterBreakPoint?: boolean): void; 2 | export declare function trace(thing?: any, enterBreakPoint?: boolean): void; 3 | export declare function trace(enterBreakPoint?: boolean): void; 4 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/transaction.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * During a transaction no views are updated until the end of the transaction. 3 | * The transaction will be run synchronously nonetheless. 4 | * 5 | * @param action a function that updates some reactive state 6 | * @returns any value that was returned by the 'action' parameter. 7 | */ 8 | export declare function transaction(action: () => T, thisArg?: undefined): T; 9 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/api/when.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda, IReactionDisposer } from "../internal"; 2 | export interface IWhenOptions { 3 | name?: string; 4 | timeout?: number; 5 | onError?: (error: any) => void; 6 | } 7 | export declare function when(predicate: () => boolean, opts?: IWhenOptions): Promise & { 8 | cancel(): void; 9 | }; 10 | export declare function when(predicate: () => boolean, effect: Lambda, opts?: IWhenOptions): IReactionDisposer; 11 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/action.d.ts: -------------------------------------------------------------------------------- 1 | export interface IAction { 2 | isMobxAction: boolean; 3 | } 4 | export declare function createAction(actionName: string, fn: Function): Function & IAction; 5 | export declare function executeAction(actionName: string, fn: Function, scope?: any, args?: IArguments): any; 6 | export declare function allowStateChanges(allowStateChanges: boolean, func: () => T): T; 7 | export declare function allowStateChangesStart(allowStateChanges: boolean): boolean; 8 | export declare function allowStateChangesEnd(prev: boolean): void; 9 | export declare function allowStateChangesInsideComputed(func: () => T): T; 10 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/atom.d.ts: -------------------------------------------------------------------------------- 1 | import { IObservable, IDerivationState } from "../internal"; 2 | export interface IAtom extends IObservable { 3 | reportObserved(): any; 4 | reportChanged(): any; 5 | } 6 | /** 7 | * Anything that can be used to _store_ state is an Atom in mobx. Atoms have two important jobs 8 | * 9 | * 1) detect when they are being _used_ and report this (using reportObserved). This allows mobx to make the connection between running functions and the data they used 10 | * 2) they should notify mobx whenever they have _changed_. This way mobx can re-run any functions (derivations) that are using this atom. 11 | */ 12 | export declare class Atom implements IAtom { 13 | name: string; 14 | isPendingUnobservation: boolean; 15 | isBeingObserved: boolean; 16 | observers: never[]; 17 | observersIndexes: {}; 18 | diffValue: number; 19 | lastAccessedBy: number; 20 | lowestObserverState: IDerivationState; 21 | /** 22 | * Create a new atom. For debugging purposes it is recommended to give it a name. 23 | * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. 24 | */ 25 | constructor(name?: string); 26 | onBecomeUnobserved(): void; 27 | onBecomeObserved(): void; 28 | /** 29 | * Invoke this method to notify mobx that your atom has been used somehow. 30 | * Returns true if there is currently a reactive context. 31 | */ 32 | reportObserved(): boolean; 33 | /** 34 | * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate. 35 | */ 36 | reportChanged(): void; 37 | toString(): string; 38 | } 39 | export declare const isAtom: (x: any) => x is Atom; 40 | export declare function createAtom(name: string, onBecomeObservedHandler?: () => void, onBecomeUnobservedHandler?: () => void): IAtom; 41 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/computedvalue.d.ts: -------------------------------------------------------------------------------- 1 | import { IObservable, IValueDidChange, Lambda, IEqualsComparer, IDerivation, IDerivationState, CaughtException, TraceMode } from "../internal"; 2 | export interface IComputedValue { 3 | get(): T; 4 | set(value: T): void; 5 | observe(listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 6 | } 7 | export interface IComputedValueOptions { 8 | get?: () => T; 9 | set?: (value: T) => void; 10 | name?: string; 11 | equals?: IEqualsComparer; 12 | context?: any; 13 | requiresReaction?: boolean; 14 | keepAlive?: boolean; 15 | } 16 | /** 17 | * A node in the state dependency root that observes other nodes, and can be observed itself. 18 | * 19 | * ComputedValue will remember the result of the computation for the duration of the batch, or 20 | * while being observed. 21 | * 22 | * During this time it will recompute only when one of its direct dependencies changed, 23 | * but only when it is being accessed with `ComputedValue.get()`. 24 | * 25 | * Implementation description: 26 | * 1. First time it's being accessed it will compute and remember result 27 | * give back remembered result until 2. happens 28 | * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3. 29 | * 3. When it's being accessed, recompute if any shallow dependency changed. 30 | * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step. 31 | * go to step 2. either way 32 | * 33 | * If at any point it's outside batch and it isn't observed: reset everything and go to 1. 34 | */ 35 | export declare class ComputedValue implements IObservable, IComputedValue, IDerivation { 36 | dependenciesState: IDerivationState; 37 | observing: IObservable[]; 38 | newObserving: null; 39 | isBeingObserved: boolean; 40 | isPendingUnobservation: boolean; 41 | observers: never[]; 42 | observersIndexes: {}; 43 | diffValue: number; 44 | runId: number; 45 | lastAccessedBy: number; 46 | lowestObserverState: IDerivationState; 47 | unboundDepsCount: number; 48 | __mapid: string; 49 | protected value: T | undefined | CaughtException; 50 | name: string; 51 | triggeredBy: string; 52 | isComputing: boolean; 53 | isRunningSetter: boolean; 54 | derivation: () => T; 55 | setter: (value: T) => void; 56 | isTracing: TraceMode; 57 | scope: Object | undefined; 58 | private equals; 59 | private requiresReaction; 60 | private keepAlive; 61 | /** 62 | * Create a new computed value based on a function expression. 63 | * 64 | * The `name` property is for debug purposes only. 65 | * 66 | * The `equals` property specifies the comparer function to use to determine if a newly produced 67 | * value differs from the previous value. Two comparers are provided in the library; `defaultComparer` 68 | * compares based on identity comparison (===), and `structualComparer` deeply compares the structure. 69 | * Structural comparison can be convenient if you always produce a new aggregated object and 70 | * don't want to notify observers if it is structurally the same. 71 | * This is useful for working with vectors, mouse coordinates etc. 72 | */ 73 | constructor(options: IComputedValueOptions); 74 | onBecomeStale(): void; 75 | onBecomeUnobserved(): void; 76 | onBecomeObserved(): void; 77 | /** 78 | * Returns the current value of this computed value. 79 | * Will evaluate its computation first if needed. 80 | */ 81 | get(): T; 82 | peek(): T; 83 | set(value: T): void; 84 | private trackAndCompute; 85 | computeValue(track: boolean): T | CaughtException; 86 | suspend(): void; 87 | observe(listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 88 | warnAboutUntrackedRead(): void; 89 | toJSON(): T; 90 | toString(): string; 91 | valueOf(): T; 92 | } 93 | export declare const isComputedValue: (x: any) => x is ComputedValue; 94 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/derivation.d.ts: -------------------------------------------------------------------------------- 1 | import { IDepTreeNode, IObservable, IAtom } from "../internal"; 2 | export declare enum IDerivationState { 3 | NOT_TRACKING = -1, 4 | UP_TO_DATE = 0, 5 | POSSIBLY_STALE = 1, 6 | STALE = 2 7 | } 8 | export declare enum TraceMode { 9 | NONE = 0, 10 | LOG = 1, 11 | BREAK = 2 12 | } 13 | /** 14 | * A derivation is everything that can be derived from the state (all the atoms) in a pure manner. 15 | * See https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 16 | */ 17 | export interface IDerivation extends IDepTreeNode { 18 | observing: IObservable[]; 19 | newObserving: null | IObservable[]; 20 | dependenciesState: IDerivationState; 21 | /** 22 | * Id of the current run of a derivation. Each time the derivation is tracked 23 | * this number is increased by one. This number is globally unique 24 | */ 25 | runId: number; 26 | /** 27 | * amount of dependencies used by the derivation in this run, which has not been bound yet. 28 | */ 29 | unboundDepsCount: number; 30 | __mapid: string; 31 | onBecomeStale(): void; 32 | isTracing: TraceMode; 33 | } 34 | export declare class CaughtException { 35 | cause: any; 36 | constructor(cause: any); 37 | } 38 | export declare function isCaughtException(e: any): e is CaughtException; 39 | /** 40 | * Finds out whether any dependency of the derivation has actually changed. 41 | * If dependenciesState is 1 then it will recalculate dependencies, 42 | * if any dependency changed it will propagate it by changing dependenciesState to 2. 43 | * 44 | * By iterating over the dependencies in the same order that they were reported and 45 | * stopping on the first change, all the recalculations are only called for ComputedValues 46 | * that will be tracked by derivation. That is because we assume that if the first x 47 | * dependencies of the derivation doesn't change then the derivation should run the same way 48 | * up until accessing x-th dependency. 49 | */ 50 | export declare function shouldCompute(derivation: IDerivation): boolean; 51 | export declare function isComputingDerivation(): boolean; 52 | export declare function checkIfStateModificationsAreAllowed(atom: IAtom): void; 53 | /** 54 | * Executes the provided function `f` and tracks which observables are being accessed. 55 | * The tracking information is stored on the `derivation` object and the derivation is registered 56 | * as observer of any of the accessed observables. 57 | */ 58 | export declare function trackDerivedFunction(derivation: IDerivation, f: () => T, context: any): any; 59 | export declare function clearObserving(derivation: IDerivation): void; 60 | export declare function untracked(action: () => T): T; 61 | export declare function untrackedStart(): IDerivation | null; 62 | export declare function untrackedEnd(prev: IDerivation | null): void; 63 | /** 64 | * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0 65 | * 66 | */ 67 | export declare function changeDependenciesStateTo0(derivation: IDerivation): void; 68 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/globalstate.d.ts: -------------------------------------------------------------------------------- 1 | import { IDerivation, IObservable, Reaction } from "../internal"; 2 | export declare type IUNCHANGED = {}; 3 | export declare class MobXGlobals { 4 | /** 5 | * MobXGlobals version. 6 | * MobX compatiblity with other versions loaded in memory as long as this version matches. 7 | * It indicates that the global state still stores similar information 8 | * 9 | * N.B: this version is unrelated to the package version of MobX, and is only the version of the 10 | * internal state storage of MobX, and can be the same across many different package versions 11 | */ 12 | version: number; 13 | /** 14 | * globally unique token to signal unchanged 15 | */ 16 | UNCHANGED: IUNCHANGED; 17 | /** 18 | * Currently running derivation 19 | */ 20 | trackingDerivation: IDerivation | null; 21 | /** 22 | * Are we running a computation currently? (not a reaction) 23 | */ 24 | computationDepth: number; 25 | /** 26 | * Each time a derivation is tracked, it is assigned a unique run-id 27 | */ 28 | runId: number; 29 | /** 30 | * 'guid' for general purpose. Will be persisted amongst resets. 31 | */ 32 | mobxGuid: number; 33 | /** 34 | * Are we in a batch block? (and how many of them) 35 | */ 36 | inBatch: number; 37 | /** 38 | * Observables that don't have observers anymore, and are about to be 39 | * suspended, unless somebody else accesses it in the same batch 40 | * 41 | * @type {IObservable[]} 42 | */ 43 | pendingUnobservations: IObservable[]; 44 | /** 45 | * List of scheduled, not yet executed, reactions. 46 | */ 47 | pendingReactions: Reaction[]; 48 | /** 49 | * Are we currently processing reactions? 50 | */ 51 | isRunningReactions: boolean; 52 | /** 53 | * Is it allowed to change observables at this point? 54 | * In general, MobX doesn't allow that when running computations and React.render. 55 | * To ensure that those functions stay pure. 56 | */ 57 | allowStateChanges: boolean; 58 | /** 59 | * If strict mode is enabled, state changes are by default not allowed 60 | */ 61 | enforceActions: boolean | "strict"; 62 | /** 63 | * Spy callbacks 64 | */ 65 | spyListeners: { 66 | (change: any): void; 67 | }[]; 68 | /** 69 | * Globally attached error handlers that react specifically to errors in reactions 70 | */ 71 | globalReactionErrorHandlers: ((error: any, derivation: IDerivation) => void)[]; 72 | /** 73 | * Warn if computed values are accessed outside a reactive context 74 | */ 75 | computedRequiresReaction: boolean; 76 | /** 77 | * Allows overwriting of computed properties, useful in tests but not prod as it can cause 78 | * memory leaks. See https://github.com/mobxjs/mobx/issues/1867 79 | */ 80 | computedConfigurable: boolean; 81 | disableErrorBoundaries: boolean; 82 | suppressReactionErrors: boolean; 83 | } 84 | export declare let globalState: MobXGlobals; 85 | export declare function isolateGlobalState(): void; 86 | export declare function getGlobalState(): any; 87 | /** 88 | * For testing purposes only; this will break the internal state of existing observables, 89 | * but can be used to get back at a stable state after throwing errors 90 | */ 91 | export declare function resetGlobalState(): void; 92 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/observable.d.ts: -------------------------------------------------------------------------------- 1 | import { IDerivation, IDerivationState } from "../internal"; 2 | export interface IDepTreeNode { 3 | name: string; 4 | observing?: IObservable[]; 5 | } 6 | export interface IObservable extends IDepTreeNode { 7 | diffValue: number; 8 | /** 9 | * Id of the derivation *run* that last accessed this observable. 10 | * If this id equals the *run* id of the current derivation, 11 | * the dependency is already established 12 | */ 13 | lastAccessedBy: number; 14 | isBeingObserved: boolean; 15 | lowestObserverState: IDerivationState; 16 | isPendingUnobservation: boolean; 17 | observers: IDerivation[]; 18 | observersIndexes: {}; 19 | onBecomeUnobserved(): void; 20 | onBecomeObserved(): void; 21 | } 22 | export declare function hasObservers(observable: IObservable): boolean; 23 | export declare function getObservers(observable: IObservable): IDerivation[]; 24 | export declare function addObserver(observable: IObservable, node: IDerivation): void; 25 | export declare function removeObserver(observable: IObservable, node: IDerivation): void; 26 | export declare function queueForUnobservation(observable: IObservable): void; 27 | /** 28 | * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does. 29 | * During a batch `onBecomeUnobserved` will be called at most once per observable. 30 | * Avoids unnecessary recalculations. 31 | */ 32 | export declare function startBatch(): void; 33 | export declare function endBatch(): void; 34 | export declare function reportObserved(observable: IObservable): boolean; 35 | /** 36 | * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly 37 | * It will propagate changes to observers from previous run 38 | * It's hard or maybe impossible (with reasonable perf) to get it right with current approach 39 | * Hopefully self reruning autoruns aren't a feature people should depend on 40 | * Also most basic use cases should be ok 41 | */ 42 | export declare function propagateChanged(observable: IObservable): void; 43 | export declare function propagateChangeConfirmed(observable: IObservable): void; 44 | export declare function propagateMaybeChanged(observable: IObservable): void; 45 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/reaction.d.ts: -------------------------------------------------------------------------------- 1 | import { IDerivation, IDerivationState, TraceMode, IObservable, Lambda } from "../internal"; 2 | /** 3 | * Reactions are a special kind of derivations. Several things distinguishes them from normal reactive computations 4 | * 5 | * 1) They will always run, whether they are used by other computations or not. 6 | * This means that they are very suitable for triggering side effects like logging, updating the DOM and making network requests. 7 | * 2) They are not observable themselves 8 | * 3) They will always run after any 'normal' derivations 9 | * 4) They are allowed to change the state and thereby triggering themselves again, as long as they make sure the state propagates to a stable state in a reasonable amount of iterations. 10 | * 11 | * The state machine of a Reaction is as follows: 12 | * 13 | * 1) after creating, the reaction should be started by calling `runReaction` or by scheduling it (see also `autorun`) 14 | * 2) the `onInvalidate` handler should somehow result in a call to `this.track(someFunction)` 15 | * 3) all observables accessed in `someFunction` will be observed by this reaction. 16 | * 4) as soon as some of the dependencies has changed the Reaction will be rescheduled for another run (after the current mutation or transaction). `isScheduled` will yield true once a dependency is stale and during this period 17 | * 5) `onInvalidate` will be called, and we are back at step 1. 18 | * 19 | */ 20 | export interface IReactionPublic { 21 | dispose(): void; 22 | trace(enterBreakPoint?: boolean): void; 23 | } 24 | export interface IReactionDisposer { 25 | (): void; 26 | $mobx: Reaction; 27 | } 28 | export declare class Reaction implements IDerivation, IReactionPublic { 29 | name: string; 30 | private onInvalidate; 31 | private errorHandler?; 32 | observing: IObservable[]; 33 | newObserving: IObservable[]; 34 | dependenciesState: IDerivationState; 35 | diffValue: number; 36 | runId: number; 37 | unboundDepsCount: number; 38 | __mapid: string; 39 | isDisposed: boolean; 40 | _isScheduled: boolean; 41 | _isTrackPending: boolean; 42 | _isRunning: boolean; 43 | isTracing: TraceMode; 44 | constructor(name: string, onInvalidate: () => void, errorHandler?: ((error: any, derivation: IDerivation) => void) | undefined); 45 | onBecomeStale(): void; 46 | schedule(): void; 47 | isScheduled(): boolean; 48 | /** 49 | * internal, use schedule() if you intend to kick off a reaction 50 | */ 51 | runReaction(): void; 52 | track(fn: () => void): void; 53 | reportExceptionInDerivation(error: any): void; 54 | dispose(): void; 55 | getDisposer(): IReactionDisposer; 56 | toString(): string; 57 | trace(enterBreakPoint?: boolean): void; 58 | } 59 | export declare function onReactionError(handler: (error: any, derivation: IDerivation) => void): Lambda; 60 | export declare function runReactions(): void; 61 | export declare const isReaction: (x: any) => x is Reaction; 62 | export declare function setReactionScheduler(fn: (f: () => void) => void): void; 63 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/core/spy.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda } from "../internal"; 2 | export declare function isSpyEnabled(): boolean; 3 | export declare function spyReport(event: any): void; 4 | export declare function spyReportStart(event: any): void; 5 | export declare function spyReportEnd(change?: any): void; 6 | export declare function spy(listener: (change: any) => void): Lambda; 7 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/internal.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./utils/utils"; 2 | export * from "./utils/iterable"; 3 | export * from "./core/atom"; 4 | export * from "./utils/comparer"; 5 | export * from "./utils/decorators2"; 6 | export * from "./types/modifiers"; 7 | export * from "./api/observabledecorator"; 8 | export * from "./api/observable"; 9 | export * from "./api/computed"; 10 | export * from "./core/action"; 11 | export * from "./types/observablevalue"; 12 | export * from "./core/computedvalue"; 13 | export * from "./core/derivation"; 14 | export * from "./core/globalstate"; 15 | export * from "./core/observable"; 16 | export * from "./core/reaction"; 17 | export * from "./core/spy"; 18 | export * from "./api/actiondecorator"; 19 | export * from "./api/action"; 20 | export * from "./api/autorun"; 21 | export * from "./api/become-observed"; 22 | export * from "./api/configure"; 23 | export * from "./api/decorate"; 24 | export * from "./api/extendobservable"; 25 | export * from "./api/extras"; 26 | export * from "./api/flow"; 27 | export * from "./api/intercept-read"; 28 | export * from "./api/intercept"; 29 | export * from "./api/iscomputed"; 30 | export * from "./api/isobservable"; 31 | export * from "./api/object-api"; 32 | export * from "./api/observe"; 33 | export * from "./api/tojs"; 34 | export * from "./api/trace"; 35 | export * from "./api/transaction"; 36 | export * from "./api/when"; 37 | export * from "./types/intercept-utils"; 38 | export * from "./types/listen-utils"; 39 | export * from "./types/observablearray"; 40 | export * from "./types/observablemap"; 41 | export * from "./types/observableset"; 42 | export * from "./types/observableobject"; 43 | export * from "./types/type-utils"; 44 | export * from "./utils/eq"; 45 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/mobx.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * (c) Michel Weststrate 2015 - 2019 3 | * MIT Licensed 4 | * 5 | * Welcome to the mobx sources! To get an global overview of how MobX internally works, 6 | * this is a good place to start: 7 | * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 8 | * 9 | * Source folders: 10 | * =============== 11 | * 12 | * - api/ Most of the public static methods exposed by the module can be found here. 13 | * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here. 14 | * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`. 15 | * - utils/ Utility stuff. 16 | * 17 | */ 18 | export { IObservable, IDepTreeNode, Reaction, IReactionPublic, IReactionDisposer, IDerivation, untracked, IDerivationState, IAtom, createAtom, IAction, spy, IComputedValue, IEqualsComparer, comparer, IEnhancer, IInterceptable, IInterceptor, IListenable, IObjectWillChange, IObjectDidChange, IObservableObject, isObservableObject, IValueDidChange, IValueWillChange, IObservableValue, isObservableValue as isBoxedObservable, IObservableArray, IArrayWillChange, IArrayWillSplice, IArrayChange, IArraySplice, isObservableArray, IKeyValueMap, ObservableMap, IMapEntries, IMapEntry, IMapWillChange, IMapDidChange, isObservableMap, IObservableMapInitialValues, ObservableSet, isObservableSet, ISetDidChange, ISetWillChange, IObservableSetInitialValues, transaction, observable, IObservableFactory, IObservableFactories, computed, IComputed, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, extendShallowObservable, observe, intercept, autorun, IAutorunOptions, reaction, IReactionOptions, when, IWhenOptions, action, isAction, runInAction, IActionFactory, keys, values, entries, set, remove, has, get, decorate, configure, onBecomeObserved, onBecomeUnobserved, flow, toJS, trace, IObserverTree, IDependencyTree, getDependencyTree, getObserverTree, resetGlobalState as _resetGlobalState, getGlobalState as _getGlobalState, getDebugName, getAtom, getAdministration as _getAdministration, allowStateChanges as _allowStateChanges, allowStateChangesInsideComputed as _allowStateChangesInsideComputed, Lambda, isArrayLike, isComputingDerivation as _isComputingDerivation, onReactionError, interceptReads as _interceptReads, IComputedValueOptions } from "./internal"; 19 | export declare const $mobx = "$mobx"; 20 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/intercept-utils.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda } from "../internal"; 2 | export declare type IInterceptor = (change: T) => T | null; 3 | export interface IInterceptable { 4 | interceptors: IInterceptor[] | undefined; 5 | intercept(handler: IInterceptor): Lambda; 6 | } 7 | export declare function hasInterceptors(interceptable: IInterceptable): boolean; 8 | export declare function registerInterceptor(interceptable: IInterceptable, handler: IInterceptor): Lambda; 9 | export declare function interceptChange(interceptable: IInterceptable, change: T | null): T | null; 10 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/listen-utils.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda } from "../internal"; 2 | export interface IListenable { 3 | changeListeners: Function[] | undefined; 4 | observe(handler: (change: any, oldValue?: any) => void, fireImmediately?: boolean): Lambda; 5 | } 6 | export declare function hasListeners(listenable: IListenable): boolean; 7 | export declare function registerListener(listenable: IListenable, handler: Function): Lambda; 8 | export declare function notifyListeners(listenable: IListenable, change: T): void; 9 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/modifiers.d.ts: -------------------------------------------------------------------------------- 1 | export interface IEnhancer { 2 | (newValue: T, oldValue: T | undefined, name: string): T; 3 | } 4 | export declare function deepEnhancer(v: any, _: any, name: any): any; 5 | export declare function shallowEnhancer(v: any, _: any, name: any): any; 6 | export declare function referenceEnhancer(newValue?: any): any; 7 | export declare function refStructEnhancer(v: any, oldValue: any, name: any): any; 8 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/observablearray.d.ts: -------------------------------------------------------------------------------- 1 | import { IInterceptor, Lambda, IEnhancer } from "../internal"; 2 | export interface IObservableArray extends Array { 3 | spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]; 4 | observe(listener: (changeData: IArrayChange | IArraySplice) => void, fireImmediately?: boolean): Lambda; 5 | intercept(handler: IInterceptor | IArrayWillSplice>): Lambda; 6 | clear(): T[]; 7 | peek(): T[]; 8 | replace(newItems: T[]): T[]; 9 | find(predicate: (item: T, index: number, array: IObservableArray) => boolean, thisArg?: any, fromIndex?: number): T | undefined; 10 | findIndex(predicate: (item: T, index: number, array: IObservableArray) => boolean, thisArg?: any, fromIndex?: number): number; 11 | remove(value: T): boolean; 12 | move(fromIndex: number, toIndex: number): void; 13 | toJS(): T[]; 14 | toJSON(): T[]; 15 | } 16 | export interface IArrayChange { 17 | type: "update"; 18 | object: IObservableArray; 19 | index: number; 20 | newValue: T; 21 | oldValue: T; 22 | } 23 | export interface IArraySplice { 24 | type: "splice"; 25 | object: IObservableArray; 26 | index: number; 27 | added: T[]; 28 | addedCount: number; 29 | removed: T[]; 30 | removedCount: number; 31 | } 32 | export interface IArrayWillChange { 33 | type: "update"; 34 | object: IObservableArray; 35 | index: number; 36 | newValue: T; 37 | } 38 | export interface IArrayWillSplice { 39 | type: "splice"; 40 | object: IObservableArray; 41 | index: number; 42 | added: T[]; 43 | removedCount: number; 44 | } 45 | export declare class StubArray { 46 | } 47 | export declare class ObservableArray extends StubArray { 48 | private $mobx; 49 | constructor(initialValues: T[] | undefined, enhancer: IEnhancer, name?: string, owned?: boolean); 50 | intercept(handler: IInterceptor | IArrayWillSplice>): Lambda; 51 | observe(listener: (changeData: IArrayChange | IArraySplice) => void, fireImmediately?: boolean): Lambda; 52 | clear(): T[]; 53 | concat(...arrays: T[][]): T[]; 54 | replace(newItems: T[]): T[]; 55 | /** 56 | * Converts this array back to a (shallow) javascript structure. 57 | * For a deep clone use mobx.toJS 58 | */ 59 | toJS(): T[]; 60 | toJSON(): T[]; 61 | peek(): T[]; 62 | find(predicate: (item: T, index: number, array: ObservableArray) => boolean, thisArg?: any, fromIndex?: number): T | undefined; 63 | findIndex(predicate: (item: T, index: number, array: ObservableArray) => boolean, thisArg?: any, fromIndex?: number): number; 64 | splice(index: number, deleteCount?: number, ...newItems: T[]): T[]; 65 | spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]; 66 | push(...items: T[]): number; 67 | pop(): T | undefined; 68 | shift(): T | undefined; 69 | unshift(...items: T[]): number; 70 | reverse(): T[]; 71 | sort(compareFn?: (a: T, b: T) => number): T[]; 72 | remove(value: T): boolean; 73 | move(fromIndex: number, toIndex: number): void; 74 | get(index: number): T | undefined; 75 | set(index: number, newValue: T): void; 76 | } 77 | export declare function reserveArrayBuffer(max: number): void; 78 | export declare function isObservableArray(thing: any): thing is IObservableArray; 79 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/observablemap.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda, IInterceptable, IListenable, IEnhancer, IInterceptor } from "../internal"; 2 | export interface IKeyValueMap { 3 | [key: string]: V; 4 | } 5 | export declare type IMapEntry = [K, V]; 6 | export declare type IMapEntries = IMapEntry[]; 7 | export declare type IMapDidChange = { 8 | object: ObservableMap; 9 | name: K; 10 | type: "update"; 11 | newValue: V; 12 | oldValue: V; 13 | } | { 14 | object: ObservableMap; 15 | name: K; 16 | type: "add"; 17 | newValue: V; 18 | } | { 19 | object: ObservableMap; 20 | name: K; 21 | type: "delete"; 22 | oldValue: V; 23 | }; 24 | export interface IMapWillChange { 25 | object: ObservableMap; 26 | type: "update" | "add" | "delete"; 27 | name: K; 28 | newValue?: V; 29 | } 30 | export declare type IObservableMapInitialValues = IMapEntries | IKeyValueMap | Map; 31 | export declare class ObservableMap implements Map, IInterceptable>, IListenable { 32 | enhancer: IEnhancer; 33 | name: string; 34 | $mobx: {}; 35 | private _data; 36 | private _hasMap; 37 | private _keys; 38 | interceptors: any; 39 | changeListeners: any; 40 | dehancer: any; 41 | [Symbol.iterator]: () => IterableIterator<[K, V]>; 42 | [Symbol.toStringTag]: "Map"; 43 | constructor(initialData?: IObservableMapInitialValues, enhancer?: IEnhancer, name?: string); 44 | private _has; 45 | has(key: K): boolean; 46 | set(key: K, value: V): this; 47 | delete(key: K): boolean; 48 | private _updateHasMapEntry; 49 | private _updateValue; 50 | private _addValue; 51 | get(key: K): V | undefined; 52 | private dehanceValue; 53 | keys(): IterableIterator; 54 | values(): IterableIterator; 55 | entries(): IterableIterator>; 56 | forEach(callback: (value: V, key: K, object: Map) => void, thisArg?: any): void; 57 | /** Merge another object into this object, returns this. */ 58 | merge(other: ObservableMap | IKeyValueMap | any): ObservableMap; 59 | clear(): void; 60 | replace(values: ObservableMap | IKeyValueMap | any): ObservableMap; 61 | readonly size: number; 62 | /** 63 | * Returns a plain object that represents this map. 64 | * Note that all the keys being stringified. 65 | * If there are duplicating keys after converting them to strings, behaviour is undetermined. 66 | */ 67 | toPOJO(): IKeyValueMap; 68 | /** 69 | * Returns a shallow non observable object clone of this map. 70 | * Note that the values migth still be observable. For a deep clone use mobx.toJS. 71 | */ 72 | toJS(): Map; 73 | toJSON(): IKeyValueMap; 74 | toString(): string; 75 | /** 76 | * Observes this object. Triggers for the events 'add', 'update' and 'delete'. 77 | * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe 78 | * for callback details 79 | */ 80 | observe(listener: (changes: IMapDidChange) => void, fireImmediately?: boolean): Lambda; 81 | intercept(handler: IInterceptor>): Lambda; 82 | } 83 | export declare const isObservableMap: (thing: any) => thing is ObservableMap; 84 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/observableobject.d.ts: -------------------------------------------------------------------------------- 1 | import { ObservableValue, IInterceptable, IListenable, ComputedValue, IObservableArray, IEnhancer, Lambda, IComputedValueOptions } from "../internal"; 2 | export interface IObservableObject { 3 | "observable-object": IObservableObject; 4 | } 5 | export declare type IObjectDidChange = { 6 | name: string; 7 | object: any; 8 | type: "add"; 9 | newValue: any; 10 | } | { 11 | name: string; 12 | object: any; 13 | type: "update"; 14 | oldValue: any; 15 | newValue: any; 16 | } | { 17 | name: string; 18 | object: any; 19 | type: "remove"; 20 | oldValue: any; 21 | }; 22 | export declare type IObjectWillChange = { 23 | object: any; 24 | type: "update" | "add"; 25 | name: string; 26 | newValue: any; 27 | } | { 28 | object: any; 29 | type: "remove"; 30 | name: string; 31 | }; 32 | export declare class ObservableObjectAdministration implements IInterceptable, IListenable { 33 | target: any; 34 | name: string; 35 | defaultEnhancer: IEnhancer; 36 | values: { 37 | [key: string]: ObservableValue | ComputedValue; 38 | }; 39 | keys: undefined | IObservableArray; 40 | changeListeners: any; 41 | interceptors: any; 42 | constructor(target: any, name: string, defaultEnhancer: IEnhancer); 43 | read(owner: any, key: string): any; 44 | write(owner: any, key: string, newValue: any): void; 45 | remove(key: string): void; 46 | illegalAccess(owner: any, propName: any): void; 47 | /** 48 | * Observes this object. Triggers for the events 'add', 'update' and 'delete'. 49 | * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe 50 | * for callback details 51 | */ 52 | observe(callback: (changes: IObjectDidChange) => void, fireImmediately?: boolean): Lambda; 53 | intercept(handler: any): Lambda; 54 | getKeys(): string[]; 55 | } 56 | export interface IIsObservableObject { 57 | $mobx: ObservableObjectAdministration; 58 | } 59 | export declare function asObservableObject(target: any, name?: string, defaultEnhancer?: IEnhancer): ObservableObjectAdministration; 60 | export declare function defineObservableProperty(target: any, propName: string, newValue: any, enhancer: IEnhancer): void; 61 | export declare function defineComputedProperty(target: any, // which objects holds the observable and provides `this` context? 62 | propName: string, options: IComputedValueOptions): void; 63 | export declare function generateObservablePropConfig(propName: any): any; 64 | export declare function generateComputedPropConfig(propName: any): any; 65 | export declare function isObservableObject(thing: any): thing is IObservableObject; 66 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/observableset.d.ts: -------------------------------------------------------------------------------- 1 | import { IEnhancer, IListenable, Lambda, IInterceptable, IInterceptor } from "../internal"; 2 | export declare type IObservableSetInitialValues = Set | T[]; 3 | export declare type ISetDidChange = { 4 | object: ObservableSet; 5 | type: "add"; 6 | newValue: T; 7 | } | { 8 | object: ObservableSet; 9 | type: "delete"; 10 | oldValue: T; 11 | }; 12 | export declare type ISetWillChange = { 13 | type: "delete"; 14 | object: ObservableSet; 15 | oldValue: T; 16 | } | { 17 | type: "add"; 18 | object: ObservableSet; 19 | newValue: T; 20 | }; 21 | export declare class ObservableSet implements Set, IInterceptable, IListenable { 22 | name: string; 23 | $mobx: {}; 24 | private _data; 25 | private _atom; 26 | changeListeners: any; 27 | interceptors: any; 28 | dehancer: any; 29 | enhancer: (newV: any, oldV: any | undefined) => any; 30 | [Symbol.iterator]: () => IterableIterator; 31 | [Symbol.toStringTag]: "Set"; 32 | constructor(initialData?: IObservableSetInitialValues, enhancer?: IEnhancer, name?: string); 33 | private dehanceValue; 34 | clear(): void; 35 | forEach(callbackFn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; 36 | readonly size: number; 37 | add(value: T): this; 38 | delete(value: any): boolean; 39 | has(value: any): boolean; 40 | entries(): IterableIterator<[T, T]>; 41 | keys(): IterableIterator; 42 | values(): IterableIterator; 43 | replace(other: ObservableSet | IObservableSetInitialValues): ObservableSet; 44 | observe(listener: (changes: ISetDidChange) => void, fireImmediately?: boolean): Lambda; 45 | intercept(handler: IInterceptor>): Lambda; 46 | toJS(): Set; 47 | toString(): string; 48 | } 49 | export declare const isObservableSet: (thing: any) => thing is ObservableSet; 50 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/observablevalue.d.ts: -------------------------------------------------------------------------------- 1 | import { Lambda, IInterceptor, Atom, IInterceptable, IListenable, IEnhancer, IEqualsComparer } from "../internal"; 2 | export interface IValueWillChange { 3 | object: any; 4 | type: "update"; 5 | newValue: T; 6 | } 7 | export interface IValueDidChange extends IValueWillChange { 8 | oldValue: T | undefined; 9 | } 10 | export interface IObservableValue { 11 | get(): T; 12 | set(value: T): void; 13 | intercept(handler: IInterceptor>): Lambda; 14 | observe(listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 15 | } 16 | export declare class ObservableValue extends Atom implements IObservableValue, IInterceptable>, IListenable { 17 | enhancer: IEnhancer; 18 | name: string; 19 | private equals; 20 | hasUnreportedChange: boolean; 21 | interceptors: any; 22 | changeListeners: any; 23 | value: any; 24 | dehancer: any; 25 | constructor(value: T, enhancer: IEnhancer, name?: string, notifySpy?: boolean, equals?: IEqualsComparer); 26 | private dehanceValue; 27 | set(newValue: T): void; 28 | private prepareNewValue; 29 | setNewValue(newValue: T): void; 30 | get(): T; 31 | intercept(handler: IInterceptor>): Lambda; 32 | observe(listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; 33 | toJSON(): T; 34 | toString(): string; 35 | valueOf(): T; 36 | } 37 | export declare const isObservableValue: (x: any) => x is IObservableValue; 38 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/types/type-utils.d.ts: -------------------------------------------------------------------------------- 1 | import { IDepTreeNode } from "../internal"; 2 | export declare function getAtom(thing: any, property?: string): IDepTreeNode; 3 | export declare function getAdministration(thing: any, property?: string): any; 4 | export declare function getDebugName(thing: any, property?: string): string; 5 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/utils/comparer.d.ts: -------------------------------------------------------------------------------- 1 | export interface IEqualsComparer { 2 | (a: T, b: T): boolean; 3 | } 4 | declare function identityComparer(a: any, b: any): boolean; 5 | declare function structuralComparer(a: any, b: any): boolean; 6 | declare function defaultComparer(a: any, b: any): boolean; 7 | export declare const comparer: { 8 | identity: typeof identityComparer; 9 | structural: typeof structuralComparer; 10 | default: typeof defaultComparer; 11 | }; 12 | export {}; 13 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/utils/decorators2.d.ts: -------------------------------------------------------------------------------- 1 | export declare type BabelDescriptor = PropertyDescriptor & { 2 | initializer?: () => any; 3 | }; 4 | export declare type PropertyCreator = (instance: any, propertyName: string, descriptor: BabelDescriptor | undefined, decoratorTarget: any, decoratorArgs: any[]) => void; 5 | export declare function initializeInstance(target: any): any; 6 | export declare function createPropDecorator(propertyInitiallyEnumerable: boolean, propertyCreator: PropertyCreator): Function; 7 | export declare function quacksLikeADecorator(args: IArguments): boolean; 8 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/utils/eq.d.ts: -------------------------------------------------------------------------------- 1 | export declare function deepEqual(a: any, b: any): boolean; 2 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/utils/iterable.d.ts: -------------------------------------------------------------------------------- 1 | export declare function iteratorSymbol(): any; 2 | export declare const IS_ITERATING_MARKER = "__$$iterating"; 3 | export declare function declareIterator(prototType: any, iteratorFactory: () => IterableIterator): void; 4 | export declare function makeIterable(iterator: Iterator): IterableIterator; 5 | export declare function toStringTagSymbol(): any; 6 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/node_modules/mobx-miniprogram/lib/utils/utils.d.ts: -------------------------------------------------------------------------------- 1 | import { ObservableMap, IObservableArray, IKeyValueMap } from "../internal"; 2 | export declare const OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is an production build."; 3 | export declare const EMPTY_ARRAY: never[]; 4 | export declare const EMPTY_OBJECT: {}; 5 | export declare function getGlobal(): any; 6 | export interface Lambda { 7 | (): void; 8 | name?: string; 9 | } 10 | export declare function getNextId(): number; 11 | export declare function fail(message: string | boolean): never; 12 | export declare function invariant(check: false, message: string | boolean): never; 13 | export declare function invariant(check: true, message: string | boolean): void; 14 | export declare function invariant(check: any, message: string | boolean): void; 15 | export declare function deprecated(msg: string): boolean; 16 | export declare function deprecated(thing: string, replacement: string): boolean; 17 | /** 18 | * Makes sure that the provided function is invoked at most once. 19 | */ 20 | export declare function once(func: Lambda): Lambda; 21 | export declare const noop: () => void; 22 | export declare function unique(list: T[]): T[]; 23 | export declare function isObject(value: any): boolean; 24 | export declare function isPlainObject(value: any): boolean; 25 | export declare function convertToMap(dataStructure: any): any; 26 | export declare function makeNonEnumerable(object: any, propNames: string[]): void; 27 | export declare function addHiddenProp(object: any, propName: PropertyKey, value: any): void; 28 | export declare function addHiddenFinalProp(object: any, propName: string, value: any): void; 29 | export declare function isPropertyConfigurable(object: any, prop: string): boolean; 30 | export declare function assertPropertyConfigurable(object: any, prop: string): void; 31 | export declare function createInstanceofPredicate(name: string, clazz: new (...args: any[]) => T): (x: any) => x is T; 32 | export declare function areBothNaN(a: any, b: any): boolean; 33 | /** 34 | * Returns whether the argument is an array, disregarding observability. 35 | */ 36 | export declare function isArrayLike(x: any): x is Array | IObservableArray; 37 | export declare function isES6Map(thing: any): boolean; 38 | export declare function isES6Set(thing: any): thing is Set; 39 | export declare function getMapLikeKeys(map: ObservableMap): ReadonlyArray; 40 | export declare function getMapLikeKeys(map: IKeyValueMap | any): ReadonlyArray; 41 | export declare function iteratorToArray(it: Iterator): Array; 42 | export declare function primitiveSymbol(): any; 43 | export declare function toPrimitive(value: any): any; 44 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "miniprogram", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "mobx-miniprogram": { 8 | "version": "4.13.2", 9 | "resolved": "https://registry.npm.taobao.org/mobx-miniprogram/download/mobx-miniprogram-4.13.2.tgz", 10 | "integrity": "sha1-tywD/VrR8bkCLEIvnIikfR5fiGg=" 11 | }, 12 | "mobx-miniprogram-bindings": { 13 | "version": "1.2.1", 14 | "resolved": "https://registry.npm.taobao.org/mobx-miniprogram-bindings/download/mobx-miniprogram-bindings-1.2.1.tgz", 15 | "integrity": "sha1-mWwFY7p0LrWDXZcr0+9FqZr4SBE=" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "miniprogram", 3 | "version": "1.0.0", 4 | "main": "app.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "author": "", 9 | "license": "ISC", 10 | "dependencies": { 11 | "mobx-miniprogram": "^4.13.2", 12 | "mobx-miniprogram-bindings": "^1.2.1" 13 | }, 14 | "devDependencies": {}, 15 | "description": "" 16 | } 17 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/about/about.js: -------------------------------------------------------------------------------- 1 | // pages/about/about.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | } 66 | }) -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/about/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/about/about.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 失忆的由来 4 | 5 | 6 | 7 |        灵感来自2020年5月31日,这几天我一直有一些事情等待完成,但是总会忘记,所有想到做一个备忘录。 8 | 9 |        当然了,市面上的备忘录太多了,比如我一直用来记东西的日事清,最简单的也有手机备忘录,我也去查看了一些已经存在的类似小程序。 10 | 11 | 12 |        虽然它们都很不错,但是我觉得太复杂了,用来起来太重了,我要做一个轻量级的备忘录。当然了还有一个原因就是我一直想学习一下小程序,就这么失忆备忘录诞生了。 13 | 14 | 15 | 16 | 17 | 失忆的目的 18 | 19 | 20 | 21 |        打造一个轻量级的备忘录,以最简单的方式,最少的代价记录你的日程。只提供当天的备忘录(也可以理解成当天的目标),新增一个任务之后不可以修改,并且点击完成之后,不可以再次回到未完成状态。 22 | 23 | 24 |        用户的数据(除了用户标识ID),其它数据存在Redis里面,每天凌晨会删除前一天的数据。 25 | 26 | 27 | 28 | 29 | 其它 30 | 31 | 32 | 33 |        失忆完全是一款没有经过调研、只经过个人简单的思考就开发出来的软件。只要我个人觉得有用就会一直维护下去,目前不考虑盈利。但如果觉得对你有帮助,可以进行少量的打赏,以激励我坚持维护下去。 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/about/about.wxss: -------------------------------------------------------------------------------- 1 | .explain_title{ 2 | padding-top: 25rpx; 3 | padding-bottom: 25rpx; 4 | font-size: 18px; 5 | font-weight: 700; 6 | text-align: center; 7 | 8 | border-bottom: 1px gainsboro solid; 9 | 10 | } 11 | .explain_desc{ 12 | font-size: 14px; 13 | color: gray; 14 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/author/author.js: -------------------------------------------------------------------------------- 1 | // pages/author/author.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | } 66 | }) -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/author/author.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/author/author.wxml: -------------------------------------------------------------------------------- 1 | 2 | 网名:小道仙 3 | 扣扣:1140459171 (有问题可以联系我) 4 | 一个喜欢观察世界的思考者,时常做一些莫名其妙的事情,对世界充满好奇,喜欢探索新的地方。你可以关注我的公众号和我一起学习、探索这个世界。\n公众号:小道仙97 5 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/author/author.wxss: -------------------------------------------------------------------------------- 1 | .main{ 2 | padding: 50rpx; 3 | } 4 | .title{ 5 | font-weight: 900; 6 | } 7 | .box{ 8 | padding-top: 20rpx; 9 | } 10 | .desc{ 11 | font-size: 14px; 12 | color: gray; 13 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/daily/daily.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/edition/edition.js: -------------------------------------------------------------------------------- 1 | // 同组件,页面要用的话也需要引入这两个 2 | import { 3 | createStoreBindings 4 | } from 'mobx-miniprogram-bindings' 5 | import { 6 | store 7 | } from '../../store' 8 | import api from '../../utils/api.js' 9 | 10 | Page({ 11 | data: { 12 | list: [] 13 | }, 14 | 15 | /** 16 | * 页面每次进入加载 17 | */ 18 | onShow: function () { 19 | const thus = this 20 | if (store.token == null || store.token == '') { 21 | wx.login({ 22 | success(res) { 23 | if (res.code) { 24 | api.login({ 25 | code: res.code 26 | }).then(res => { 27 | store.token = res.data.openId 28 | // 获取列表数据 29 | thus.getEditionList() 30 | }) 31 | } else { 32 | console.log('登录失败!' + res.errMsg) 33 | } 34 | } 35 | }) 36 | } else { 37 | thus.getEditionList() 38 | } 39 | }, 40 | /** 41 | * 生命周期函数--监听页面加载 42 | */ 43 | onLoad: function (options) { 44 | const thus = this 45 | // 做绑定操作 46 | this.storeBindings = createStoreBindings(this, { 47 | store, 48 | fields: [ 49 | 'token' 50 | ], 51 | actions: ['update'], // 同上,这里是方法名字 52 | }) 53 | }, 54 | onUnload() { 55 | // 记住,一定要在页面卸载前,销毁实例,否则会造成内存泄漏!! 56 | this.storeBindings.destroyStoreBindings() 57 | }, 58 | /** 59 | * 获取列表数据 使用的频率太大了直接提出来 60 | */ 61 | getEditionList() { 62 | api.edition().then(res => { 63 | if (res.data != null) { 64 | if (res.data.length > 0) { 65 | this.setData({ 66 | isempty: false, 67 | }) 68 | } else { 69 | this.setData({ 70 | isempty: true, 71 | }) 72 | } 73 | this.setData({ 74 | list: res.data 75 | }) 76 | } else if (res.success == false) { 77 | // 跳转到授权页面 78 | wx.switchTab({ 79 | url: '/pages/personal/personal' 80 | }) 81 | } 82 | }) 83 | }, 84 | }) -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/edition/edition.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/edition/edition.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{item.editionInfo}} 5 | 6 | 7 | 8 | {{item.editionInfo}} 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/edition/edition.wxss: -------------------------------------------------------------------------------- 1 | .main{ 2 | width: 80%; 3 | /* border: 1px red solid; */ 4 | margin-top: 20rpx; 5 | margin-left: 10%; 6 | } 7 | .box{ 8 | 9 | padding-top: 30rpx; 10 | 11 | } 12 | .title{ 13 | font-weight: 550; 14 | border-bottom: 1px gainsboro solid; 15 | padding-bottom: 5rpx; 16 | } 17 | .detail{ 18 | padding-left: 30rpx; 19 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/help/help.js: -------------------------------------------------------------------------------- 1 | // pages/help/help.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | mapUrl: "", 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | this.setData({ 16 | // mapUrl: "http://player.bilibili.com/player.html?aid=970135845&bvid=BV1Sp4y1k7Rn&cid=251608984&page=1" 17 | }) 18 | 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面初次渲染完成 23 | */ 24 | onReady: function () { 25 | 26 | }, 27 | 28 | /** 29 | * 生命周期函数--监听页面显示 30 | */ 31 | onShow: function () { 32 | 33 | }, 34 | 35 | /** 36 | * 生命周期函数--监听页面隐藏 37 | */ 38 | onHide: function () { 39 | 40 | }, 41 | 42 | /** 43 | * 生命周期函数--监听页面卸载 44 | */ 45 | onUnload: function () { 46 | 47 | }, 48 | 49 | /** 50 | * 页面相关事件处理函数--监听用户下拉动作 51 | */ 52 | onPullDownRefresh: function () { 53 | 54 | }, 55 | 56 | /** 57 | * 页面上拉触底事件的处理函数 58 | */ 59 | onReachBottom: function () { 60 | 61 | }, 62 | 63 | /** 64 | * 用户点击右上角分享 65 | */ 66 | onShareAppMessage: function () { 67 | 68 | } 69 | }) -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/help/help.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/help/help.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1、在今日任务页面的右下角有一个加号按钮,点击就可以添加任务。 5 | 6 | 7 | 8 | 9 | 10 | 2、在个人配置里面可以配置任务标签,每个用户最多可以配置4个标签。 11 | 12 | 13 | 14 | 15 | 16 | 3、对于已经完成的任务,我们只需要点击前面的单选框即可完成。 17 | 18 | 19 | 20 | 21 | 22 | 4、点击每个任务的标题,即可对任务进行修改。 23 | 24 | 25 | 26 | 27 | 28 | 5、点击右边的箭头可以在今日任务和任务总览里面来回切换。 29 | 30 | 31 | 32 | 33 | 34 | 6、拖动右边的排序按钮可以进行上下拖动排序。 35 | 36 | 37 | 38 | 39 | 40 | 7、每天未完成的今日任务会自动移动到总任务。 41 | 42 | 43 | 44 | 45 | 8、已完成的任务数据,第二天凌晨会自从删除。 46 | 47 | 48 | 49 | 50 | 9、标签可以选择是否显示,也可以拖动排序(添加的时候和任务总览的时候的排序与列表一致)。 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/help/help.wxss: -------------------------------------------------------------------------------- 1 | .box{ 2 | /* padding-top: 40rpx; */ 3 | /* padding-left: 11%; */ 4 | /* padding-right: 10%; */ 5 | /* display: flex; 6 | justify-content: center; */ 7 | } 8 | .content{ 9 | 10 | } 11 | .title1{ 12 | width: 90%; 13 | margin-left: 5%; 14 | font-size: 16px; 15 | } 16 | .title{ 17 | width: 90%; 18 | margin-left: 5%; 19 | font-size: 16px; 20 | margin-top: 100rpx; 21 | } 22 | .image{ 23 | margin-top: 30rpx; 24 | margin-left: 5%; 25 | width: 90%; 26 | height: 1200rpx; 27 | 28 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/label/label.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/label/label.wxss: -------------------------------------------------------------------------------- 1 | .table{ 2 | margin-left: 2%; 3 | margin-right: 2%; 4 | height: 500rpx; 5 | } 6 | .table_title { 7 | display: flex; 8 | justify-content: space-between; 9 | margin-bottom: 15rpx; 10 | /* font-size: 3rpx; */ 11 | font-weight: 700; 12 | width: 100%; 13 | } 14 | 15 | .list { 16 | display: flex; 17 | justify-content: space-between; 18 | margin-bottom: 15rpx; 19 | width: 100%; 20 | align-items: center; 21 | } 22 | 23 | .movable-area { 24 | position: absolute; 25 | top: 0; 26 | left: 0; 27 | z-index: 10; 28 | width: 100%; 29 | } 30 | 31 | .movable-row { 32 | box-shadow: #D9D9D9 0px 0px 20px; 33 | width: 100%; 34 | } 35 | 36 | .table_content { 37 | width: 100%; 38 | display: flex; 39 | justify-content: space-between; 40 | } 41 | 42 | switch { 43 | /* zoom:0.6 */ 44 | transform: scale(0.6); 45 | } 46 | .content_name{ 47 | margin-top: 15rpx; 48 | } 49 | 50 | .content_sort { 51 | margin-left: 15rpx; 52 | } 53 | 54 | .content_sort image{ 55 | margin-top: 7px; 56 | width: 40rpx; 57 | padding-left: 20rpx; 58 | height: 40rpx; 59 | } 60 | 61 | input { 62 | /* border: 1px gainsboro solid; */ 63 | width: 60rpx; 64 | text-align: center; 65 | } 66 | 67 | 68 | 69 | /* 添加按钮 */ 70 | .addButton image { 71 | position: fixed; 72 | bottom: 150px; 73 | right: 40px; 74 | width: 100rpx; 75 | height: 100rpx; 76 | } 77 | 78 | /* 添加窗口 */ 79 | .addWindow { 80 | background-color: white; 81 | position: fixed; 82 | height: 500px; 83 | width: 100%; 84 | bottom: -500px; 85 | padding-top: 10rpx; 86 | } 87 | 88 | .windowInput { 89 | background-color: white; 90 | border: 1px gainsboro solid; 91 | height: 70rpx; 92 | width: 100%; 93 | } 94 | 95 | /* 任务提交按钮 */ 96 | .taskSubmit { 97 | margin-top: 20rpx; 98 | display: flex; 99 | justify-content: flex-start; 100 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/label/label2.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 信息 4 | 详情 5 | 排序 6 | 7 | 8 | 10 | 16 | {{movableViewInfo.data.content}} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | {{item.content}} 30 | 31 | 35 | 36 | 37 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/label/label2.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | height: 100%; 3 | width: 100%; 4 | } 5 | 6 | .zhuti { 7 | height: 100%; 8 | width: 100%; 9 | 10 | position: relative; 11 | } 12 | 13 | .row { 14 | height: 47px; 15 | width: 100%; 16 | 17 | display: flex; 18 | justify-content: space-around; 19 | align-items: center; 20 | } 21 | 22 | .title-row { 23 | border-bottom: 1px solid #888888; 24 | 25 | color: #888888; 26 | } 27 | 28 | .list-row { 29 | padding: 8px 0px; 30 | border-bottom: 1px solid #D9D9D9; 31 | background-color: white; 32 | } 33 | 34 | .movable-area { 35 | position: absolute; 36 | top: 0; 37 | left: 0; 38 | z-index: 10; 39 | width: 100%; 40 | } 41 | 42 | .movable-row { 43 | box-shadow: #D9D9D9 0px 0px 20px; 44 | } 45 | 46 | .col1 { 47 | width: 60%; 48 | } 49 | .col2 { 50 | width: 10%; 51 | } 52 | .col3 { 53 | width: 10%; 54 | } 55 | 56 | .ready-place { 57 | background-color: #CCCCCC 58 | } 59 | 60 | .content { 61 | font-size: 17px; 62 | 63 | white-space: nowrap; 64 | overflow: hidden; 65 | text-overflow: ellipsis; 66 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/personal/personal.js: -------------------------------------------------------------------------------- 1 | // 同组件,页面要用的话也需要引入这两个 2 | import { createStoreBindings } from 'mobx-miniprogram-bindings' 3 | import { store } from '../../store' 4 | import api from '../../utils/api.js' 5 | Page({ 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | bgColor:['#fff','#fff','#fff','#fff'], 11 | userSort: -1 12 | }, 13 | inBox: function(e){ 14 | let index = e.currentTarget.dataset['index']; 15 | const thus = this 16 | var cur = 'bgColor[' + index + ']' 17 | this.setData({ 18 | [cur] : '#f8f8f8' 19 | })  20 | 21 | var timer = setTimeout(function(){ 22 | thus.setData({ 23 | [cur] : '#fff' 24 | })  25 | clearTimeout(timer) 26 | },1*100) 27 | }, 28 | onLoad() { 29 | const thus = this 30 | // 做绑定操作 31 | this.storeBindings = createStoreBindings(this, { 32 | store, 33 | fields: ['token'],// 这里取在store.js里的变量名,还是一样,用到什么取什么 34 | actions: [], // 同上,这里是方法名字 35 | }) 36 | api.userNumber({ 37 | }).then(res => { 38 | this.setData({ 39 | userSort: res.data, 40 | }) 41 | }) 42 | }, 43 | onUnload() { 44 | // 记住,一定要在页面卸载前,销毁实例,否则会造成内存泄漏!! 45 | this.storeBindings.destroyStoreBindings() 46 | }, 47 | }) -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/personal/personal.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/personal/personal.wxss: -------------------------------------------------------------------------------- 1 | .main { 2 | background-color: #f8f8f8; 3 | height: 100vh; 4 | } 5 | 6 | .head { 7 | height: 13vh; 8 | /* border: 1px red solid; */ 9 | background-color: #fff; 10 | display: flex; 11 | padding-top: 20px; 12 | justify-content: flex-start; 13 | margin-bottom: 20rpx; 14 | } 15 | 16 | .head_left { 17 | margin-left: 20rpx; 18 | width: 120rpx; 19 | height: 120rpx; 20 | } 21 | 22 | .head_left image { 23 | width: 120rpx; 24 | height: 120rpx; 25 | border-radius: 6px; 26 | } 27 | 28 | .head_right { 29 | width: 80%; 30 | height: 120rpx; 31 | /* border: 1px red solid; */ 32 | padding-left: 20rpx; 33 | } 34 | 35 | .head_right_1 { 36 | margin-top: 20rpx; 37 | height: 50rpx; 38 | font-size: 20px; 39 | font-weight: 800; 40 | } 41 | 42 | .head_right_2 { 43 | margin-top: 10rpx; 44 | height: 30rpx; 45 | font-size: 14px; 46 | color: gainsboro; 47 | } 48 | 49 | .box { 50 | height: 7vh; 51 | font-size: 14px; 52 | padding-left: 20px; 53 | border-bottom: 2rpx #f8f8f8 solid; 54 | background-color: white; 55 | display: flex; 56 | justify-content: space-between; 57 | align-items: center; 58 | 59 | } 60 | 61 | .box_2 { 62 | height: 7vh; 63 | font-size: 14px; 64 | padding-left: 20px; 65 | border-bottom: 2rpx #f8f8f8 solid; 66 | background-color: white; 67 | display: flex; 68 | justify-content: space-between; 69 | padding-left: 19px; 70 | } 71 | 72 | .box_left { 73 | display: flex; 74 | justify-content: flex-start; 75 | line-height: 7vh; 76 | /* align-items: center; */ 77 | 78 | } 79 | 80 | .box_left image { 81 | padding-top: 2.3vh; 82 | /* vertical-align: middle; */ 83 | /* top: 50%; */ 84 | margin-right: 12px; 85 | width: 34rpx; 86 | height: 34rpx; 87 | } 88 | 89 | .text { 90 | /* padding-top: 23rpx; */ 91 | /* line-height:7vh; */ 92 | } 93 | 94 | .box_icon image { 95 | /* padding-top: 30rpx; */ 96 | /* vertical-align: middle !important; */ 97 | width: 24rpx; 98 | height: 24rpx; 99 | margin-right: 12px; 100 | 101 | } 102 | 103 | .loginMain { 104 | background-color: #fff; 105 | height: 100vh; 106 | } 107 | 108 | .login { 109 | display: flex; 110 | justify-content: center; 111 | } 112 | 113 | .loginButton { 114 | margin-top: 200rpx; 115 | color: white; 116 | } 117 | 118 | .loginDesc { 119 | margin-top: 20rpx; 120 | /* border: 1px red solid; */ 121 | color: gray; 122 | text-align: center; 123 | } 124 | 125 | .edition { 126 | width: 100%; 127 | position: absolute; 128 | bottom: 12px; 129 | color: gray; 130 | text-align: center; 131 | opacity:0.6; 132 | } 133 | .prefix{ 134 | 135 | } 136 | .suffix{ 137 | font-size: 14px; 138 | padding-left: 1px; 139 | } 140 | 141 | /* button{ 142 | font-size: 14px; 143 | padding: 0; 144 | font-weight: 150; 145 | border: 1px white solid; 146 | } */ 147 | button:not([size='mini']) { 148 | 149 | /* background-color: black; */ 150 | /* border: 1px white solid; */ 151 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/task/task.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/pages/totalTask/totalTask.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/store.js: -------------------------------------------------------------------------------- 1 | import { 2 | configure, 3 | observable, 4 | action 5 | } from 'mobx-miniprogram' 6 | 7 | // 不允许在动作外部修改状态 8 | // configure({ 9 | // enforceActions: 'observed' 10 | // }); 11 | 12 | export const store = observable({ 13 | token: '', 14 | requestPrefix:'http://127.0.0.1:8080/api/', 15 | // actions 16 | update: action(function () { 17 | 18 | }) 19 | }) -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/utils/DataUtils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 日期相关的工具类 3 | * 4 | * 前面加了 export 表示把这个接口暴露出去 5 | * 6 | * @author 小道仙 7 | * @date 2019年11月27日 8 | */ 9 | 10 | let now = new Date(); //当前日期 11 | let nowDayOfWeek = now.getDay(); //今天本周的第几天 12 | let nowDay = now.getDate(); //当前日 13 | let nowMonth = now.getMonth(); //当前月 14 | let nowYear = now.getYear(); //当前年 15 | nowYear += (nowYear < 2000) ? 1900 : 0; // 16 | 17 | //格局化日期:yyyy-MM-dd 18 | function formatDate(date) { 19 | let myyear = date.getFullYear(); 20 | let mymonth = date.getMonth()+1; 21 | let myweekday = date.getDate(); 22 | if(mymonth < 10){ 23 | mymonth = "0" + mymonth; 24 | } 25 | if(myweekday < 10){ 26 | myweekday = "0" + myweekday; 27 | } 28 | return (myyear+"-"+mymonth + "-" + myweekday); 29 | } 30 | //获得某月的天数 31 | function getMonthDays(myMonth){ 32 | let monthStartDate = new Date(nowYear, myMonth, 1); 33 | let monthEndDate = new Date(nowYear, myMonth + 1, 1); 34 | let days = (monthEndDate - monthStartDate)/(1000 * 60 * 60 * 24); 35 | return days; 36 | } 37 | 38 | /** 39 | * 获取当前周起止时间 40 | * 41 | * eg: {weekStartDate: "2019-11-25", weekEndtDate: "2019-12-01"} 42 | * @return result 43 | */ 44 | export function getCurWeekStartAndEnd() { 45 | // nowDayOfWeek 等于 0 的时候,表示周日 46 | let curnowDayOfWeek = nowDayOfWeek == 0 ? 7 : nowDayOfWeek 47 | let weekStartDate = new Date(nowYear, nowMonth, nowDay - curnowDayOfWeek + 1) 48 | let weekEndtDate = new Date(nowYear, nowMonth, nowDay - curnowDayOfWeek + 7) 49 | let result = { 50 | weekStartDate : formatDate(weekStartDate), 51 | weekEndtDate : formatDate(weekEndtDate) 52 | } 53 | return result 54 | } 55 | 56 | /** 57 | * 获取当前月起止时间 58 | * 59 | * eg: {monthStartDate: "2019-11-01", monthEndtDate: "2019-12-30"} 60 | * @return result 61 | */ 62 | export function getCurMonthStartAndEnd() { 63 | let monthStartDate = new Date(nowYear, nowMonth, 1) 64 | let monthEndtDate = new Date(nowYear, nowMonth, getMonthDays(nowMonth)) 65 | let result = { 66 | monthStartDate : formatDate(monthStartDate), 67 | monthEndtDate : formatDate(monthEndtDate) 68 | } 69 | return result 70 | } 71 | 72 | /** 73 | * 获取当前年的起止日期 74 | * 75 | * eg 76 | */ 77 | export function getCurYearStartAndEnd() { 78 | let yearStartDate = new Date(nowYear, 0, 1) 79 | let yearEndtDate = new Date(nowYear, 11, 31) 80 | let result = { 81 | yearStartDate : formatDate(yearStartDate), 82 | yearEndtDate : formatDate(yearEndtDate) 83 | } 84 | return result 85 | } 86 | 87 | export const nowdDA = new Date() -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/utils/api.js: -------------------------------------------------------------------------------- 1 | import apiRequest from './request.js'; 2 | // const HOST = 'http://127.0.0.1:8082/api/'; 3 | // const HOST = 'https://tx.amnesia.xdx97.com:8082/api/'; 4 | // 真机测试需要用这个ip 5 | // const HOST = 'http://127.0.0.1:8082/api/' 6 | const HOST = 'http://192.168.2.5:8082/api/' 7 | 8 | import { 9 | store 10 | } from '../store' 11 | const API_LIST = { 12 | // 登录 13 | login: { 14 | method: 'GET', 15 | url: 'user/login' 16 | }, 17 | // 获取用户编号 18 | userNumber: { 19 | method: 'GET', 20 | url: 'user/userNumber' 21 | }, 22 | // 使用帮助已读 23 | completeHelpRead: { 24 | method: 'GET', 25 | url: 'user/completeHelpRead' 26 | }, 27 | // 获取任务列表数据 28 | taskList: { 29 | method: 'GET', 30 | url: 'task/list' 31 | }, 32 | // 新增任务 33 | addTask: { 34 | method: 'POST', 35 | url: 'task/add' 36 | }, 37 | // 更新任务 38 | updateTask: { 39 | method: 'POST', 40 | url: 'task/update' 41 | }, 42 | // 任务完成 43 | completeTask: { 44 | method: 'GET', 45 | url: 'task/complete' 46 | }, 47 | // 任务转移 48 | transfer: { 49 | method: 'GET', 50 | url: 'task/transfer' 51 | }, 52 | // 标签列表 53 | labelList: { 54 | method: 'POST', 55 | url: 'label/list' 56 | }, 57 | // 标签列表带统计 58 | labelListAll: { 59 | method: 'GET', 60 | url: 'label/listAll' 61 | }, 62 | // 添加标签 63 | addLabel: { 64 | method: 'POST', 65 | url: 'label/add' 66 | }, 67 | // 修改默认标签 68 | updateDefault: { 69 | method: 'POST', 70 | url: 'label/updateDefault' 71 | }, 72 | // 修改标签 73 | updateLabel: { 74 | method: 'POST', 75 | url: 'label/update' 76 | }, 77 | // 获取默认标签 78 | getDefaultLabel: { 79 | method: 'POST', 80 | url: 'label/getDefaultLabel' 81 | }, 82 | // 标签拖动排序 83 | labelSort: { 84 | method: 'POST', 85 | url: 'label/sort' 86 | }, 87 | // 每日任务拖动排序 88 | taskSort: { 89 | method: 'POST', 90 | url: 'task/sort' 91 | }, 92 | // 版本更新数据 93 | edition: { 94 | method: 'GET', 95 | url: 'other/editionInfo' 96 | }, 97 | // 日常任务新增 98 | copyAdd: { 99 | method: 'POST', 100 | url: 'tmp/add' 101 | }, 102 | // 日常任务列表显示 103 | copyTaskList: { 104 | method: 'GET', 105 | url: 'tmp/list' 106 | }, 107 | // 日常任务列表数据删除 108 | copyDel: { 109 | method: 'GET', 110 | url: 'tmp/del' 111 | }, 112 | // 日常任务列表复制 113 | copyTask: { 114 | method: 'POST', 115 | url: 'tmp/copy' 116 | }, 117 | // 日常任务拖动排序 118 | dailySort: { 119 | method: 'POST', 120 | url: 'tmp/sort' 121 | }, 122 | } 123 | 124 | /* 125 | 多参数合并 126 | */ 127 | function MyHttp(defaultParams, API_LIST) { 128 | 129 | let _build_url = HOST; 130 | let resource = {}; 131 | for (let actionName in API_LIST) { 132 | 133 | let _config = API_LIST[actionName]; 134 | resource[actionName] = (pdata) => { 135 | let _params_data = pdata; 136 | return apiRequest(_build_url + _config.url, _config.method, _params_data, { 137 | 'token': store.token 138 | }); 139 | } 140 | } 141 | return resource; 142 | } 143 | const Api = new MyHttp({}, API_LIST); 144 | export default Api; -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/utils/config.js: -------------------------------------------------------------------------------- 1 | let config = { 2 | //订阅消息的消息模板集合 3 | tmplIds: 'IAVbn0mLYfsBhfHfvyfYg-exlI0gFmWGilU0u85ghJE', 4 | } 5 | 6 | export default config; -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/utils/dateTimePicker.js: -------------------------------------------------------------------------------- 1 | function withData(param){ 2 | return param < 10 ? '0' + param : '' + param; 3 | } 4 | function getLoopArray(start,end){ 5 | var start = start || 0; 6 | var end = end || 1; 7 | var array = []; 8 | for (var i = start; i <= end; i++) { 9 | array.push(withData(i)); 10 | } 11 | return array; 12 | } 13 | function getMonthDay(year,month){ 14 | var flag = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0), array = null; 15 | 16 | switch (month) { 17 | case '01': 18 | case '03': 19 | case '05': 20 | case '07': 21 | case '08': 22 | case '10': 23 | case '12': 24 | array = getLoopArray(1, 31) 25 | break; 26 | case '04': 27 | case '06': 28 | case '09': 29 | case '11': 30 | array = getLoopArray(1, 30) 31 | break; 32 | case '02': 33 | array = flag ? getLoopArray(1, 29) : getLoopArray(1, 28) 34 | break; 35 | default: 36 | array = '月份格式不正确,请重新输入!' 37 | } 38 | return array; 39 | } 40 | function getNewDateArry(){ 41 | // 当前时间的处理 42 | var newDate = new Date(); 43 | var year = withData(newDate.getFullYear()), 44 | mont = withData(newDate.getMonth() + 1), 45 | date = withData(newDate.getDate()), 46 | hour = withData(newDate.getHours()), 47 | minu = withData(newDate.getMinutes()), 48 | seco = withData(newDate.getSeconds()); 49 | 50 | return [year, mont, date, hour, minu, seco]; 51 | } 52 | function dateTimePicker(startYear,endYear,date) { 53 | // 返回默认显示的数组和联动数组的声明 54 | var dateTime = [], dateTimeArray = [[],[],[],[],[],[]]; 55 | var start = startYear || 1978; 56 | var end = endYear || 2100; 57 | // 默认开始显示数据 58 | var defaultDate = date ? [...date.split(' ')[0].split('-'), ...date.split(' ')[1].split(':')] : getNewDateArry(); 59 | // 处理联动列表数据 60 | /*年月日 时分秒*/ 61 | dateTimeArray[0] = getLoopArray(start,end); 62 | dateTimeArray[1] = getLoopArray(1, 12); 63 | dateTimeArray[2] = getMonthDay(defaultDate[0], defaultDate[1]); 64 | dateTimeArray[3] = getLoopArray(0, 23); 65 | dateTimeArray[4] = getLoopArray(0, 59); 66 | dateTimeArray[5] = getLoopArray(0, 59); 67 | 68 | dateTimeArray.forEach((current,index) => { 69 | dateTime.push(current.indexOf(defaultDate[index])); 70 | }); 71 | 72 | return { 73 | dateTimeArray: dateTimeArray, 74 | dateTime: dateTime 75 | } 76 | } 77 | module.exports = { 78 | dateTimePicker: dateTimePicker, 79 | getMonthDay: getMonthDay 80 | } -------------------------------------------------------------------------------- /AmnesiaNotepad/miniprogram/utils/request.js: -------------------------------------------------------------------------------- 1 | //封装request 2 | let apiRequest = (url, method, data, header) => { //接收所需要的参数,如果不够还可以自己自定义参数 3 | let promise = new Promise(function (resolve, reject) { 4 | wx.showNavigationBarLoading() //在标题栏中显示加载 5 | wx.request({ 6 | url: url, 7 | data: data ? data : null, 8 | method: method, 9 | header: header ? header : { 'content-type': 'application/x-www-form-urlencoded' }, 10 | complete: function () { 11 | wx.hideNavigationBarLoading(); //完成停止加载 12 | wx.stopPullDownRefresh(); //停止下拉刷新 13 | }, 14 | success: function (res) { 15 | if(res.data.success == false){ 16 | wx.showToast({title: res.data.errDesc,icon: 'none',duration: 2000}) 17 | } 18 | //接口调用成功 19 | resolve(res.data); //根据业务需要resolve接口返回的json的数据 20 | }, 21 | fail: function (res) { 22 | wx.showModal({ 23 | showCancel: false, 24 | confirmColor: '#1d8f59', 25 | content: '数据加载失败,请检查您的网络,点击确定重新加载数据!', 26 | success: function (res) { 27 | if (res.confirm) { 28 | apiRequest(url, method, data, header); 29 | } 30 | } 31 | }); 32 | wx.hideLoading(); 33 | } 34 | }) 35 | }); 36 | return promise; //注意,这里返回的是promise对象 37 | } 38 | export default apiRequest; -------------------------------------------------------------------------------- /AmnesiaNotepad/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "miniprogram/", 3 | "cloudfunctionRoot": "cloudfunctions/", 4 | "setting": { 5 | "urlCheck": false, 6 | "es6": true, 7 | "enhance": true, 8 | "postcss": true, 9 | "preloadBackgroundData": false, 10 | "minified": true, 11 | "newFeature": true, 12 | "coverView": true, 13 | "nodeModules": true, 14 | "autoAudits": false, 15 | "showShadowRootInWxmlPanel": true, 16 | "scopeDataCheck": false, 17 | "uglifyFileName": false, 18 | "checkInvalidKey": true, 19 | "checkSiteMap": true, 20 | "uploadWithSourceMap": true, 21 | "compileHotReLoad": false, 22 | "useMultiFrameRuntime": true, 23 | "useApiHook": true, 24 | "babelSetting": { 25 | "ignore": [], 26 | "disablePlugins": [], 27 | "outputPath": "" 28 | }, 29 | "bundle": false, 30 | "useIsolateContext": true, 31 | "useCompilerModule": false, 32 | "userConfirmedUseCompilerModuleSwitch": false, 33 | "userConfirmedBundleSwitch": false, 34 | "packNpmManually": false, 35 | "packNpmRelationList": [], 36 | "minifyWXSS": true, 37 | "useApiHostProcess": false 38 | }, 39 | "appid": "wx1a39331e85e08267", 40 | "projectname": "AmnesiaNotepad", 41 | "libVersion": "2.8.1", 42 | "simulatorType": "wechat", 43 | "simulatorPluginLibVersion": {}, 44 | "condition": { 45 | "search": { 46 | "list": [] 47 | }, 48 | "conversation": { 49 | "list": [] 50 | }, 51 | "plugin": { 52 | "list": [] 53 | }, 54 | "game": { 55 | "list": [] 56 | }, 57 | "gamePlugin": { 58 | "list": [] 59 | }, 60 | "miniprogram": { 61 | "list": [ 62 | { 63 | "id": -1, 64 | "name": "db guide", 65 | "pathName": "pages/databaseGuide/databaseGuide", 66 | "query": "" 67 | }, 68 | { 69 | "id": -1, 70 | "name": "pages/personal/personal", 71 | "pathName": "pages/personal/personal", 72 | "query": "", 73 | "scene": null 74 | }, 75 | { 76 | "id": -1, 77 | "name": "pages/author/author", 78 | "pathName": "pages/author/author", 79 | "query": "", 80 | "scene": null 81 | }, 82 | { 83 | "id": -1, 84 | "name": "pages/about/about", 85 | "pathName": "pages/about/about", 86 | "query": "", 87 | "scene": null 88 | }, 89 | { 90 | "id": -1, 91 | "name": "pages/help/help", 92 | "pathName": "pages/help/help", 93 | "query": "", 94 | "scene": null 95 | }, 96 | { 97 | "id": -1, 98 | "name": "pages/totalTask/totalTask", 99 | "pathName": "pages/totalTask/totalTask", 100 | "query": "", 101 | "scene": null 102 | }, 103 | { 104 | "id": -1, 105 | "name": "pages/label/label", 106 | "pathName": "pages/label/label", 107 | "scene": null 108 | } 109 | ] 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **B站视频地址: https://www.bilibili.com/video/BV1q54y1U7vX** 2 | 3 | 做了文字校验,已经成功上线,有兴趣的小伙伴可以扫码体验: 4 | 5 | 可以微信搜索:失忆备忘录 6 | 7 | - ![avatar](./other/amnesia.jpg) 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 | 它的代码量很少,并且因为逻辑简单,代码少,所以代码相对来说比较整洁好理解,前端是小程序,后端是SpringBoot+MySql用来学习小程序或者后台开发当作入门Demo也是相当不错的

33 | 34 | ### 三、代码 35 | 36 | amnesia     Java代码
37 | AmnesiaNotepad    小程序代码
38 | 39 | 数据库文件存放在other文件夹 40 | 41 | clone下代码后,我们只需要在yml文件里面配置好自己的MySql,还有自己小程序的appid和secret
42 | 43 | 44 | 45 |


46 | 47 | **有疑问可以加我QQ:1140459171(备注GitHub)**
48 | 49 | **如果对你有帮助可以关注我的微信公众号:小道仙97** 50 | 51 | **一个不务正业的程序员,梦想成为家庭煮夫。【终生学习者】** 52 | 53 | - ![avatar](./other/preview.png) 54 | 55 |

56 | 57 | 58 | 59 | ### V1.3(2021年07月31日) 60 | 61 | - 新增定时提醒功能 62 | - 任务模板支持拖动排序 63 | 64 | 65 | 66 |
67 | 68 | ### V1.2 (2021年01月13日) 69 | - 新增版本更新 70 | - 新增任务模板 71 | - 标签个数新增至5个 72 | - 优化标题过长显示异常问题 73 | 74 |
75 | 76 | ### V1.1 (2020年11月14日) 77 | - 新增文字校验 78 | - 新增加载弹出框 79 | 80 |
81 | 82 | ### V1.0(2020年08月01日) 83 | - 首次上线 84 | 85 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/App.java: -------------------------------------------------------------------------------- 1 | package com.xdx; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableAsync; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableScheduling 10 | @EnableAsync 11 | public class App { 12 | public static void main(String[] args) { 13 | int i = 100_1000_00; 14 | SpringApplication.run(App.class,args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/common/AjaxResult.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.common; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | * 封装返回结果集 8 | * 9 | * @author 小道仙 10 | * @date 2020年5月5日 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class AjaxResult { 15 | /** 16 | * 返回状态码 17 | */ 18 | 19 | private Integer code; 20 | 21 | /** 22 | * 返回的数据 23 | */ 24 | 25 | private T data; 26 | 27 | /** 28 | * 总条数 29 | */ 30 | 31 | private Long total; 32 | 33 | /** 34 | * 成功与否 35 | */ 36 | 37 | private Boolean success; 38 | 39 | /** 40 | * 消息提示 41 | */ 42 | 43 | private String msg; 44 | 45 | /** 46 | * 错误描述 47 | */ 48 | 49 | private String errDesc; 50 | 51 | /** 52 | * 用户token 53 | */ 54 | 55 | private String token; 56 | 57 | public AjaxResult() { 58 | } 59 | 60 | /** 61 | * 操作失败 62 | * @param errDesc 错误信息 63 | * 64 | * @author 小道仙 65 | * @date 2020年2月17日 66 | */ 67 | public static AjaxResult failure(String errDesc) { 68 | return new AjaxResult<>().setErrDesc(errDesc).setSuccess(false).setCode(-1); 69 | } 70 | 71 | /** 72 | * 操作成功 73 | * @param msg 返回消息 74 | * @param total 总条数 75 | * @param data 返回的数据 76 | * 77 | * @author 小道仙 78 | * @date 2020年2月17日 79 | */ 80 | public static AjaxResult success(String msg,long total,T data){ 81 | AjaxResult result = new AjaxResult<>(); 82 | result.setSuccess(true) 83 | .setTotal(total) 84 | .setMsg(msg); 85 | return result; 86 | } 87 | 88 | /** 89 | * 操作成功 90 | * @param total 总条数 91 | * @param data 返回的数据 92 | * 93 | * @author 小道仙 94 | * @date 2020年2月17日 95 | */ 96 | public static AjaxResult success(T data,long total){ 97 | AjaxResult result = new AjaxResult<>(); 98 | result.setSuccess(true) 99 | .setTotal(total) 100 | .setMsg("操作成功") 101 | .setData(data); 102 | return result; 103 | } 104 | 105 | /** 106 | * 操作成功 107 | * @param data 返回的数据 108 | * 109 | * @author 小道仙 110 | * @date 2020年2月22日 111 | */ 112 | public static AjaxResult success(T data){ 113 | AjaxResult result = new AjaxResult<>(); 114 | result.setSuccess(true) 115 | .setMsg("操作成功") 116 | .setData(data); 117 | return result; 118 | } 119 | 120 | /** 121 | * 操作成功 122 | * @param msg 返回消息 123 | * 124 | * @author 小道仙 125 | * @date 2020年2月17日 126 | */ 127 | public static AjaxResult success(String msg){ 128 | return success(msg,0,null); 129 | } 130 | 131 | /** 132 | * 操作成功 133 | * @param msg 返回消息 134 | * @param total 总条数 135 | * 136 | * @author 小道仙 137 | * @date 2020年2月17日 138 | */ 139 | public static AjaxResult success(String msg,Integer total){ 140 | return success(msg,total,null); 141 | } 142 | 143 | /** 144 | * 操作成功 145 | * 146 | * @author 小道仙 147 | * @date 2020年2月17日 148 | */ 149 | public static AjaxResult success(){ 150 | return success("操作成功",0,null); 151 | } 152 | } -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/common/MyBaseMapper.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.common; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.Wrapper; 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 实现BaseMapper 对里面的一些方法进行重写以便更好的使用 11 | * @author 小道仙 12 | * @date 2020年2月26日 13 | */ 14 | public interface MyBaseMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper { 15 | 16 | /** 17 | * 查询列表 18 | * @param t 19 | */ 20 | default List selectList(T t) { 21 | QueryWrapper qw = new QueryWrapper<>(); 22 | qw.setEntity(t); 23 | return selectList(qw); 24 | } 25 | 26 | default List selectList(T t,String sort,String column) { 27 | QueryWrapper qw = new QueryWrapper<>(); 28 | qw.setEntity(t); 29 | if (sort != null){ 30 | if (sort.equals("asc")){ 31 | qw.orderByAsc(column); 32 | }else{ 33 | qw.orderByDesc(column); 34 | } 35 | } 36 | return selectList(qw); 37 | } 38 | 39 | /** 40 | * 查询一条记录 41 | */ 42 | default T selectOne(T t){ 43 | QueryWrapper qw = new QueryWrapper<>(); 44 | qw.setEntity(t); 45 | return selectOne(qw); 46 | } 47 | 48 | /** 49 | * 查询总数 50 | */ 51 | default Integer selectCount(T t){ 52 | QueryWrapper qw = new QueryWrapper<>(); 53 | qw.setEntity(t); 54 | return selectCount(qw); 55 | } 56 | 57 | /** 58 | * 更新数据 59 | * 60 | * @param entity 要更新的数据 61 | * @param update 更新的条件 62 | */ 63 | default int update(T entity,T update){ 64 | QueryWrapper qw = new QueryWrapper<>(); 65 | qw.setEntity(update); 66 | return update(entity,qw); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/common/MyCommonService.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.common; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.xdx.entitys.pojo.SyUser; 5 | import com.xdx.mapper.user.SyUserMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.context.request.RequestContextHolder; 9 | import org.springframework.web.context.request.ServletRequestAttributes; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | import java.util.concurrent.ConcurrentHashMap; 15 | 16 | /** 17 | * 这里面封装一些Service公用的方法 18 | */ 19 | @Component 20 | public class MyCommonService { 21 | 22 | @Autowired 23 | private SyUserMapper userMapper; 24 | 25 | private static Map userMap = new ConcurrentHashMap<>(1000); 26 | 27 | /** 28 | * 使用pageHelper 默认当前页 10 29 | * @param pageNum 30 | */ 31 | public void startPage(int pageNum){ 32 | startPage( pageNum, 10); 33 | } 34 | public void startPage(int pageNum, int pageSize){ 35 | PageHelper.startPage( pageNum, pageSize); 36 | } 37 | 38 | /** 39 | * 获取当前用户 40 | */ 41 | public SyUser getCurUser(){ 42 | SyUser user = userMap.get(getToken()); 43 | if (user == null){ 44 | user = userMapper.selectOne(new SyUser().setWxOpenId(getToken())); 45 | userMap.put(user.getWxOpenId(), user); 46 | } 47 | if (userMap.size() > 10000){ 48 | userMap.clear(); 49 | } 50 | return user; 51 | } 52 | 53 | /** 54 | * 获取token 55 | * 56 | * @return 获取Session 57 | * @author 小道仙 58 | * @date 2020年5月5日 59 | */ 60 | public String getToken(){ 61 | ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); 62 | HttpServletRequest request = servletRequestAttributes.getRequest(); 63 | String token = request.getHeader("token"); 64 | return token; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/config/WebAppConfig.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.config; 2 | 3 | import com.xdx.common.interceptor.LoginInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.HandlerInterceptor; 7 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 9 | 10 | /* 11 | *拦截器配置类 12 | */ 13 | @Configuration 14 | public class WebAppConfig implements WebMvcConfigurer { 15 | 16 | /** 17 | * 解决 拦截器里面不能注入userMapper 对象的问题 18 | */ 19 | @Bean 20 | public HandlerInterceptor getLoginInterceptor() { 21 | return new LoginInterceptor(); 22 | } 23 | 24 | // 多个拦截器组成一个拦截器链 25 | // addPathPatterns 用于添加拦截规则 26 | // excludePathPatterns 用户排除拦截 27 | @Override 28 | public void addInterceptors(InterceptorRegistry registry) { 29 | registry.addInterceptor(getLoginInterceptor()) 30 | .addPathPatterns("/**") 31 | .excludePathPatterns("/user/login", 32 | "/xdx/test", 33 | "/task/test", 34 | "/download"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/enums/IBaseEnum.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.enums; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * 枚举父类 10 | */ 11 | public interface IBaseEnum> { 12 | Map, Map> map = new LinkedHashMap(); 13 | 14 | default void initMap(K code, T t) { 15 | if (map.containsKey(t.getClass())) { 16 | Map tmp = (Map)map.get(t.getClass()); 17 | tmp.put(code, t); 18 | map.put(t.getClass(), tmp); 19 | } else { 20 | Map tmp = new LinkedHashMap(); 21 | tmp.put(code, t); 22 | map.put(t.getClass(), tmp); 23 | } 24 | 25 | } 26 | 27 | @JsonCreator 28 | static , K> T get(Class clazz, K code) { 29 | if (map.get(clazz) == null) { 30 | return null; 31 | } else { 32 | Object _code = code; 33 | if (code instanceof String) { 34 | _code = code.toString().trim(); 35 | } 36 | 37 | return (T) ((Map)map.get(clazz)).get(_code); 38 | } 39 | } 40 | 41 | K getCode(); 42 | 43 | V getMsg(); 44 | } 45 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/enums/TaskTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.enums; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | /** 7 | * 任务枚举 8 | */ 9 | public enum TaskTypeEnum implements IBaseEnum { 10 | TODAY(0, "今日任务"), 11 | TOTAL(1, "总任务"); 12 | 13 | private Integer code; 14 | private String msg; 15 | 16 | private TaskTypeEnum(Integer status, String msg) { 17 | this.code = status; 18 | this.msg = msg; 19 | this.initMap(status, this); 20 | } 21 | 22 | @Override 23 | public String getMsg() { 24 | return this.msg; 25 | } 26 | 27 | @JsonValue 28 | @Override 29 | public Integer getCode() { 30 | return this.code; 31 | } 32 | 33 | @JsonCreator 34 | public static TaskTypeEnum forValue(Integer code) { 35 | return (TaskTypeEnum)IBaseEnum.get(TaskTypeEnum.class, code); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/enums/YesOrNoStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.enums; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | /** 7 | * 是否枚举 8 | */ 9 | public enum YesOrNoStatusEnum implements IBaseEnum { 10 | NO(0, "否"), 11 | YES(1, "是"); 12 | 13 | private Integer code; 14 | private String msg; 15 | 16 | private YesOrNoStatusEnum(Integer status, String msg) { 17 | this.code = status; 18 | this.msg = msg; 19 | this.initMap(status, this); 20 | } 21 | 22 | @Override 23 | public String getMsg() { 24 | return this.msg; 25 | } 26 | 27 | @JsonValue 28 | @Override 29 | public Integer getCode() { 30 | return this.code; 31 | } 32 | 33 | @JsonCreator 34 | public static YesOrNoStatusEnum forValue(Integer code) { 35 | return (YesOrNoStatusEnum)IBaseEnum.get(YesOrNoStatusEnum.class, code); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/handler/BaseEnumTypeHandler.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.handler; 2 | 3 | import com.xdx.common.enums.IBaseEnum; 4 | import org.apache.ibatis.type.BaseTypeHandler; 5 | import org.apache.ibatis.type.JdbcType; 6 | 7 | import java.sql.CallableStatement; 8 | import java.sql.PreparedStatement; 9 | import java.sql.ResultSet; 10 | import java.sql.SQLException; 11 | 12 | /** 13 | * 1、枚举处理器,不配置会出现 IllegalArgumentException: No enum constant .... 异常 14 | * 2、yml 文件也需要配置 15 | * mybatis-plus: 16 | * type-handlers-package:com.xdx97.framework.handler # 处理器配置 17 | * 18 | * @author 小道仙 19 | * @date 2020年2月20日 20 | */ 21 | public class BaseEnumTypeHandler & IBaseEnum> extends BaseTypeHandler { 22 | 23 | private Class type; 24 | 25 | private final T[] enums; 26 | public BaseEnumTypeHandler() { 27 | enums = null; 28 | } 29 | 30 | /** 31 | * 设置配置文件设置的转换类以及枚举类内容,供其他方法更便捷高效的实现 32 | * 33 | * @param type 34 | * 配置文件中设置的转换类 35 | */ 36 | public BaseEnumTypeHandler(Class type) { 37 | if (type == null){ 38 | throw new IllegalArgumentException("【BaseEnumTypeHandler】Type argument cannot be null"); 39 | } 40 | this.type = type; 41 | this.enums = type.getEnumConstants(); 42 | if (this.enums == null){ 43 | throw new IllegalArgumentException(type.getSimpleName() + " does not represent an enum type."); 44 | } 45 | 46 | } 47 | 48 | @Override 49 | public T getNullableResult(ResultSet rs, String columnName) throws SQLException { 50 | // 根据数据库存储类型决定获取类型 51 | String i = rs.getString(columnName); 52 | if (rs.wasNull()) { 53 | return null; 54 | } else { 55 | // 根据数据库中的code值,定位Enum子类 56 | return locateEnumStatus(i); 57 | } 58 | } 59 | 60 | @Override 61 | public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException { 62 | // 根据数据库存储类型决定获取类型 63 | int i = rs.getInt(columnIndex); 64 | if (rs.wasNull()) { 65 | return null; 66 | } else { 67 | // 根据数据库中的code值,定位子类 68 | return locateEnumStatus(i); 69 | } 70 | } 71 | 72 | @Override 73 | public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { 74 | // 根据数据库存储类型决定获取类型 75 | int i = cs.getInt(columnIndex); 76 | if (cs.wasNull()) { 77 | return null; 78 | } else { 79 | // 根据数据库中的code值,定位EnumStatus子类 80 | return locateEnumStatus(i); 81 | } 82 | } 83 | 84 | @Override 85 | public void setNonNullParameter(PreparedStatement ps, int i, IBaseEnum parameter, JdbcType jdbcType) 86 | throws SQLException { 87 | JdbcType type = null; 88 | if (parameter.getCode() instanceof Integer){ 89 | type = JdbcType.TINYINT; 90 | } 91 | if (parameter.getCode() instanceof String){ 92 | type = JdbcType.VARCHAR; 93 | } 94 | // baseTypeHandler已经帮我们做了parameter的null判断 95 | ps.setObject(i, parameter.getCode(), type.TYPE_CODE); 96 | 97 | } 98 | 99 | /** 100 | * 枚举类型转换,由于构造函数获取了枚举的子类enums,让遍历更加高效快捷 101 | * 102 | * @param code 103 | * 数据库中存储的自定义code属性 104 | * @return code对应的枚举类 105 | */ 106 | private T locateEnumStatus(Object code) { 107 | for (T status : enums) { 108 | if (status.getCode().toString().trim().equals(code.toString().trim())) { 109 | return status; 110 | } 111 | } 112 | throw new IllegalArgumentException("未知的枚举类型:" + code + ",请核对" + type.getSimpleName()); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.interceptor; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.xdx.common.common.AjaxResult; 5 | import com.xdx.common.enums.YesOrNoStatusEnum; 6 | import com.xdx.entitys.pojo.SyUser; 7 | import com.xdx.mapper.user.SyUserMapper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Component; 10 | import org.springframework.web.servlet.HandlerInterceptor; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | /** 16 | * 登录拦截器 17 | * 18 | * 直接使用用户的openId当作登录验证的token 19 | * 20 | * @author 小道仙 21 | */ 22 | @Component 23 | public class LoginInterceptor implements HandlerInterceptor { 24 | 25 | @Autowired 26 | private SyUserMapper userMapper; 27 | 28 | @Override 29 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 30 | String token = request.getHeader("token"); 31 | if (token != null){ 32 | SyUser user = userMapper.selectOne(new SyUser().setWxOpenId(token) 33 | .setUserStatus(YesOrNoStatusEnum.YES)); 34 | if (user != null){ 35 | return true; 36 | } 37 | } 38 | response.setContentType("text/html;charset=utf-8"); 39 | response.getWriter().write(JSON.toJSONString(AjaxResult.failure("系统异常!"))); 40 | return false; 41 | // return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/AccessToken.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.Date; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * 获取 AccessToken 13 | * 14 | * @author 小道仙 15 | * @date 2020年10月18日 16 | */ 17 | @Component 18 | public class AccessToken { 19 | 20 | private static String accountToken = ""; 21 | 22 | private static Long expireDate; 23 | 24 | private static String grantType = "client_credential"; 25 | 26 | private static String appId; 27 | 28 | @Value("${wx.appid}") 29 | public void setAppId(String appId){ 30 | AccessToken.appId = appId; 31 | } 32 | 33 | private static String secret; 34 | 35 | @Value("${wx.secret}") 36 | public void setSecret(String secret){ 37 | AccessToken.secret = secret; 38 | } 39 | 40 | public static String getAccessToken(){ 41 | if (accountToken.equals("") || expireDate == null || expireDate < new Date().getTime()){ 42 | Map params = new HashMap<>(); 43 | params.put("grant_type", grantType); 44 | params.put("appid", appId); 45 | params.put("secret", secret); 46 | Object o = HttpClient.requestGet("https://api.weixin.qq.com/cgi-bin/token", params); 47 | JsonNode jsonNode = JsonUtils.stringToJsonNode(o.toString()); 48 | accountToken = jsonNode.get("access_token").toString().replace("\"",""); 49 | expireDate = new Date().getTime() + (Integer.parseInt(jsonNode.get("expires_in").toString()) * 1000); 50 | } 51 | return accountToken; 52 | } 53 | } -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/CheckParams.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 参数校验 9 | * 10 | * @author 小道仙 11 | * @date 2020年8月9日 12 | */ 13 | public class CheckParams { 14 | 15 | public static AjaxResult check(Map params,String ...checkParams){ 16 | AjaxResult result = AjaxResult.failure("参数为空"); 17 | try { 18 | if (params == null || params.isEmpty()){ 19 | return result; 20 | } 21 | for (String item : checkParams){ 22 | Object object = params.get(item); 23 | if (object == null || object.equals("")){ 24 | return result.setErrDesc("缺少必要参数 : "+ item); 25 | } 26 | } 27 | }catch (Exception e){ 28 | e.printStackTrace(); 29 | return result; 30 | } 31 | return AjaxResult.success("参数校验成功"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | import java.text.SimpleDateFormat; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | 9 | /** 10 | * 时间相关工具类 11 | */ 12 | public class DateUtils { 13 | 14 | /** 15 | * 获取当前年 16 | */ 17 | public static int getYear() { 18 | Calendar calendar = Calendar.getInstance(); 19 | return calendar.get(Calendar.YEAR); 20 | } 21 | /** 22 | * 获取当前月 23 | * 24 | * MONTH 是从0开始的 25 | */ 26 | public static int getMonth() { 27 | Calendar calendar = Calendar.getInstance(); 28 | return calendar.get(Calendar.MONTH) + 1; 29 | } 30 | 31 | /** 32 | * 获取当前日 33 | */ 34 | public static int getDay() { 35 | Calendar calendar = Calendar.getInstance(); 36 | return calendar.get(Calendar.DAY_OF_MONTH); 37 | } 38 | 39 | /** 40 | * 格式化日期 41 | */ 42 | public static String parseDate(Date date, String pattern) { 43 | Assert.notNull(date, "date must not be null"); 44 | SimpleDateFormat sdf = new SimpleDateFormat(pattern); 45 | return sdf.format(date); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import org.apache.commons.codec.digest.DigestUtils; 4 | 5 | public class PasswordUtils { 6 | /** 7 | * 加密盐 8 | */ 9 | private String salt; 10 | 11 | private PasswordUtils() { 12 | this.salt = ""; 13 | } 14 | 15 | private PasswordUtils(String salt) { 16 | this.salt = salt; 17 | } 18 | 19 | public static PasswordUtils salt() { 20 | return new PasswordUtils(); 21 | } 22 | 23 | public static PasswordUtils salt(String salt) { 24 | return new PasswordUtils(salt); 25 | } 26 | 27 | /** 28 | * 密码加密 29 | * 30 | * @param rawPass 31 | * @return 32 | * @author 苦酒 33 | * @date 2018年5月15日 34 | * @version 1.0 35 | */ 36 | public String encode(String rawPass) { 37 | String pwd = rawPass + salt; 38 | return DigestUtils.sha1Hex(pwd); 39 | } 40 | 41 | /** 42 | * 密码验证 43 | * @param pwd 44 | * @param oldPwd 45 | * @return 46 | * @author 苦酒 47 | * @date 2018年5月15日 48 | * @version 1.0 49 | */ 50 | public boolean valid(String pwd, String oldPwd) { 51 | return oldPwd.equals(encode(pwd)); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/SpringContextUtils.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * Spring Context 工具类 10 | * 11 | * @author 小道仙 12 | * @date 2020年2月26日 13 | */ 14 | @Component 15 | public class SpringContextUtils implements ApplicationContextAware { 16 | 17 | private static ApplicationContext applicationContext; 18 | 19 | @Override 20 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 21 | SpringContextUtils.applicationContext = applicationContext; 22 | } 23 | 24 | public static ApplicationContext getApplicationContext() { 25 | assertApplicationContext(); 26 | return applicationContext; 27 | } 28 | 29 | @SuppressWarnings("unchecked") 30 | public static T getBean(String beanName) { 31 | assertApplicationContext(); 32 | return (T) applicationContext.getBean(beanName); 33 | } 34 | 35 | public static T getBean(Class requiredType) { 36 | assertApplicationContext(); 37 | return applicationContext.getBean(requiredType); 38 | } 39 | 40 | private static void assertApplicationContext() { 41 | if (SpringContextUtils.applicationContext == null) { 42 | throw new RuntimeException("applicaitonContext属性为null,请检查是否注入了SpringContextHolder!"); 43 | } 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/Tools.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | public class Tools { 9 | 10 | 11 | /** 12 | * 文字校验 13 | */ 14 | public static boolean safeCheck(String content){ 15 | if (content == null || content.equals("")){ 16 | return true; 17 | } 18 | boolean result = false; 19 | try { 20 | Map params = new HashMap<>(); 21 | params.put("content", content); 22 | String data = HttpClient.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token="+AccessToken.getAccessToken(), params); 23 | JsonNode jsonNode = JsonUtils.stringToJsonNode(data); 24 | if (jsonNode.get("errmsg").toString().replace("\"","").equals("ok")){ 25 | result = true; 26 | } 27 | }catch (Exception e){ 28 | e.printStackTrace(); 29 | } 30 | return result; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/UUIDUtils.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * UUID工具类 7 | * 8 | * @author 小道仙 9 | * @date 2020年5月5日 10 | */ 11 | public class UUIDUtils { 12 | 13 | public static String[] chars = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 14 | "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", 15 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", 16 | "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", 17 | "Z" }; 18 | 19 | /** 20 | * 返回一个去-的UUID 21 | * 22 | * @author 小道仙 23 | * @date 2020年5月5日 24 | */ 25 | public static String getUUID(){ 26 | UUID uuid = UUID.randomUUID(); 27 | return uuid.toString().replaceAll("-",""); 28 | } 29 | 30 | /** 31 | * 生成相应数字的唯一码 32 | * 33 | * @param length 34 | * 生成的长度 35 | * @return 36 | * @author 小道仙 37 | * @date 2020年5月5日 38 | * @version 1.0 39 | */ 40 | public static String getUUID(Integer length) { 41 | StringBuffer sb = new StringBuffer(); 42 | for (int i = 1, l = length / 8; i <= l; i++) { 43 | sb.append(getShortUUID(8)); 44 | } 45 | sb.append(getShortUUID(length % 8)); 46 | return sb.toString(); 47 | } 48 | 49 | private static String getShortUUID(Integer length) { 50 | StringBuffer shortBuffer = new StringBuffer(); 51 | String uuid = UUID.randomUUID().toString().replace("-", ""); 52 | for (int i = 0; i < length; i++) { 53 | String str = uuid.substring(i * 4, i * 4 + 4); 54 | int x = Integer.parseInt(str, 16); 55 | shortBuffer.append(chars[x % 0x3E]); 56 | } 57 | return shortBuffer.toString(); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/wx/AccessToken.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils.wx; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.xdx.common.utils.HttpClient; 5 | import com.xdx.common.utils.JsonUtils; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * 获取 AccessToken 14 | * 15 | * @author 小道仙 16 | * @date 2020年10月18日 17 | */ 18 | @Component 19 | public class AccessToken { 20 | 21 | private static String accountToken = ""; 22 | 23 | private static Long expireDate; 24 | 25 | private static String grantType = "client_credential"; 26 | 27 | private static String appId; 28 | 29 | @Value("${wx.appid}") 30 | public void setAppId(String appId){ 31 | AccessToken.appId = appId; 32 | } 33 | 34 | private static String secret; 35 | 36 | @Value("${wx.secret}") 37 | public void setSecret(String secret){ 38 | AccessToken.secret = secret; 39 | } 40 | 41 | public static String getAccessToken(){ 42 | if (accountToken.equals("") || expireDate == null || expireDate < System.currentTimeMillis()){ 43 | Map params = new HashMap<>(); 44 | params.put("grant_type", grantType); 45 | params.put("appid", appId); 46 | params.put("secret", secret); 47 | Object o = HttpClient.requestGet("https://api.weixin.qq.com/cgi-bin/token", params); 48 | JsonNode jsonNode = JsonUtils.stringToJsonNode(o.toString()); 49 | accountToken = jsonNode.get("access_token").toString().replace("\"",""); 50 | expireDate = System.currentTimeMillis() + (Integer.parseInt(jsonNode.get("expires_in").toString()) * 1000); 51 | } 52 | return accountToken; 53 | } 54 | } -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/wx/Tools.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils.wx; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.xdx.common.utils.HttpClient; 5 | import com.xdx.common.utils.JsonUtils; 6 | import com.xdx.common.utils.wx.AccessToken; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class Tools { 12 | 13 | 14 | /** 15 | * 文字校验 16 | * 17 | * 调用腾讯的接口进行文字校验 18 | */ 19 | public static boolean safeCheck(String content){ 20 | if (content == null || content.equals("")){ 21 | return true; 22 | } 23 | boolean result = false; 24 | try { 25 | Map params = new HashMap<>(); 26 | params.put("content", content); 27 | String data = HttpClient.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token="+ AccessToken.getAccessToken(), params); 28 | JsonNode jsonNode = JsonUtils.stringToJsonNode(data); 29 | if (jsonNode.get("errmsg").toString().replace("\"","").equals("ok")){ 30 | result = true; 31 | } 32 | }catch (Exception e){ 33 | e.printStackTrace(); 34 | } 35 | return result; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/common/utils/wx/WxMsgUtils.java: -------------------------------------------------------------------------------- 1 | package com.xdx.common.utils.wx; 2 | 3 | import com.xdx.common.utils.HttpClient; 4 | import com.xdx.common.utils.JsonUtils; 5 | import com.xdx.common.utils.wx.AccessToken; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.util.StringUtils; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * 发送微信消息 14 | * 15 | * 文档地址: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/uniform-message/uniformMessage.send.html 16 | * @author 小道仙 17 | * @date 2021年4月19日 18 | */ 19 | @Slf4j 20 | public class WxMsgUtils { 21 | 22 | /** 23 | * 发送数据接口 24 | */ 25 | private static final String MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="; 26 | 27 | /** 28 | * 跳转页面地址 29 | */ 30 | private static final String DEFAULT_PAGE = "pages/task/task"; 31 | 32 | /** 33 | * 发送模板消息 34 | * 35 | * @param touser 接收者(用户)的 openid 36 | * @param template_id 所需下发的订阅模板id 37 | * @param page 点击模板卡片后的跳转页面,仅限本小程序内的页面。默认地址【DEFAULT_PAGE】,传递NO,表示不需要地址 38 | * @param miniprogram_state 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版 39 | * @param data 模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } } 40 | * 41 | * @return true 表示成功, false 表示失败 42 | */ 43 | public static String sendTmplMsg(String touser, String template_id, String page, String miniprogram_state,Map> data){ 44 | Map params = new HashMap<>(); 45 | params.put("access_token", AccessToken.getAccessToken()); 46 | params.put("touser", touser); 47 | params.put("template_id",template_id); 48 | params.put("data",data); 49 | if (miniprogram_state != null && !"".equals(miniprogram_state)){ 50 | params.put("miniprogram_state", miniprogram_state); 51 | } 52 | if (StringUtils.isEmpty(page)){ 53 | params.put("page",DEFAULT_PAGE); 54 | } 55 | try { 56 | String post = HttpClient.post2(MSG_SEND_URL+AccessToken.getAccessToken(), params); 57 | Map map = JsonUtils.jsonToMap(post); 58 | if (map != null && Integer.parseInt(map.get("errcode").toString()) != 0){ 59 | log.error("微信模板消息发送失败:" + map.get("errmsg")); 60 | } 61 | return map.get("errcode").toString(); 62 | }catch (Exception e){ 63 | log.error("微信模板消息发送异常", e); 64 | return "500"; 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/controller/label/SyLabelController.java: -------------------------------------------------------------------------------- 1 | package com.xdx.controller.label; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.xdx.common.common.AjaxResult; 5 | import com.xdx.common.utils.CheckParams; 6 | import com.xdx.common.utils.JsonUtils; 7 | import com.xdx.common.utils.wx.Tools; 8 | import com.xdx.entitys.pojo.SyLabel; 9 | import com.xdx.service.label.SyLabelService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.PostMapping; 13 | import org.springframework.web.bind.annotation.RequestBody; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * 标签管理 21 | * 22 | * @author 小道仙 23 | * @date 2020/8/8 24 | */ 25 | @RestController 26 | public class SyLabelController { 27 | 28 | @Autowired 29 | private SyLabelService syLabelService; 30 | 31 | /** 32 | * 新增标签 33 | */ 34 | @PostMapping("/label/add") 35 | public AjaxResult add(@RequestBody Map params){ 36 | 37 | AjaxResult check = CheckParams.check(params, "labelName"); 38 | if (!check.getSuccess()){ 39 | return check; 40 | } 41 | if(!Tools.safeCheck(params.get("labelName").toString())){ 42 | return AjaxResult.failure("存在非法字符,请重新输入"); 43 | } 44 | return syLabelService.add(params); 45 | } 46 | 47 | /** 48 | * 修改标签 49 | */ 50 | @PostMapping("/label/update") 51 | public AjaxResult update(@RequestBody SyLabel syLabel){ 52 | if (syLabel == null || syLabel.getLabelId() == null || syLabel.getLabelId().equals("")){ 53 | return AjaxResult.failure("缺少必要参数:labelId"); 54 | } 55 | if(!Tools.safeCheck(syLabel.getLabelName())){ 56 | return AjaxResult.failure("存在非法字符,请重新输入"); 57 | } 58 | return syLabelService.update(syLabel); 59 | } 60 | 61 | /** 62 | * 删除标签 63 | */ 64 | @PostMapping("/label/delete") 65 | public AjaxResult delete(@RequestBody Map params){ 66 | AjaxResult check = CheckParams.check(params, "labelId"); 67 | if (!check.getSuccess()){ 68 | return check; 69 | } 70 | return syLabelService.delete(params); 71 | } 72 | 73 | /** 74 | * 标签列表 75 | */ 76 | @PostMapping("/label/list") 77 | public AjaxResult list(){ 78 | return syLabelService.list(); 79 | } 80 | 81 | /** 82 | * 修改默认标签 83 | */ 84 | @PostMapping("/label/updateDefault") 85 | public AjaxResult updateDefault(@RequestBody Map params){ 86 | AjaxResult check = CheckParams.check(params, "userId","labelId","status"); 87 | if (!check.getSuccess()){ 88 | return check; 89 | } 90 | return syLabelService.updateDefault(params); 91 | } 92 | 93 | /** 94 | * 标签列表带统计 95 | */ 96 | @GetMapping("/label/listAll") 97 | public AjaxResult listAll(Integer flag){ 98 | return syLabelService.listAll(flag); 99 | } 100 | 101 | /** 102 | * 获取默认标签Id 103 | */ 104 | @PostMapping("/label/getDefaultLabel") 105 | public AjaxResult getDefaultLabel(){ 106 | return syLabelService.getDefaultLabel(); 107 | } 108 | 109 | /** 110 | * 标签排序 111 | */ 112 | @PostMapping("/label/sort") 113 | public AjaxResult sortLabel(@RequestBody Object sortList){ 114 | JsonNode jsonNode = JsonUtils.stringToJsonNode(JsonUtils.objectToJson(sortList)); 115 | List syLabels = JsonUtils.objectToList(jsonNode.get("sortList"), SyLabel.class); 116 | return syLabelService.sortLabel(syLabels); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/controller/other/OtherController.java: -------------------------------------------------------------------------------- 1 | package com.xdx.controller.other; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.common.utils.FileUtils; 5 | import com.xdx.service.other.OtherService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | import org.springframework.web.multipart.MultipartFile; 9 | 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | @RestController 13 | public class OtherController { 14 | 15 | @Autowired 16 | private OtherService otherService; 17 | 18 | @PostMapping("/upload") 19 | public String upload(@RequestBody MultipartFile file){ 20 | return FileUtils.upload(file); 21 | } 22 | 23 | @GetMapping("/download") 24 | public void download(@RequestParam String fileName, HttpServletResponse response){ 25 | FileUtils.download(fileName,response); 26 | } 27 | 28 | /** 29 | * 版本信息 30 | * 31 | * @author 小道仙 32 | * @date 2020年12月25日 33 | */ 34 | @GetMapping("/other/editionInfo") 35 | public AjaxResult editionInfo(){ 36 | return otherService.editionInfo(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/controller/task/SyTaskController.java: -------------------------------------------------------------------------------- 1 | package com.xdx.controller.task; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.xdx.common.common.AjaxResult; 5 | import com.xdx.common.utils.JsonUtils; 6 | import com.xdx.common.utils.wx.Tools; 7 | import com.xdx.entitys.pojo.SyTask; 8 | import com.xdx.service.task.SyTaskService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 用户相关操作 16 | */ 17 | @RestController 18 | public class SyTaskController { 19 | 20 | @Autowired 21 | private SyTaskService taskService; 22 | 23 | /** 24 | * 新增任务 25 | */ 26 | @PostMapping("/task/add") 27 | public AjaxResult add(@RequestBody SyTask task){ 28 | if(!Tools.safeCheck(task.getTaskTitle()) || !Tools.safeCheck(task.getTaskDesc())){ 29 | return AjaxResult.failure("存在非法字符,请重新输入"); 30 | } 31 | if (task == null || task.getTaskTitle() == null){ 32 | return AjaxResult.failure("参数不全"); 33 | } 34 | return taskService.add(task); 35 | } 36 | 37 | /** 38 | * 获取任务数据 39 | */ 40 | @GetMapping("/task/list") 41 | public AjaxResult> list(@RequestParam Integer taskType, Integer labelId){ 42 | 43 | return taskService.list(taskType,labelId); 44 | } 45 | 46 | /** 47 | * 更新任务 只更新任务标题和描述 48 | */ 49 | @PostMapping("/task/update") 50 | public AjaxResult update(@RequestBody SyTask task){ 51 | if(!Tools.safeCheck(task.getTaskTitle()) || !Tools.safeCheck(task.getTaskDesc())){ 52 | return AjaxResult.failure("存在非法字符,请重新输入"); 53 | } 54 | if (task == null || "".equals(task.getTaskId())){ 55 | return AjaxResult.failure("确少参数:taskId"); 56 | } 57 | return taskService.update(task); 58 | } 59 | 60 | /** 61 | * 任务完成 62 | */ 63 | @GetMapping("/task/complete") 64 | public AjaxResult complete(@RequestParam Integer taskId){ 65 | if (taskId == null || "".equals(taskId)){ 66 | return AjaxResult.failure("确少参数:taskId"); 67 | } 68 | return taskService.complete(taskId); 69 | } 70 | 71 | /** 72 | * 任务转移 73 | */ 74 | @GetMapping("/task/transfer") 75 | public AjaxResult transfer(@RequestParam Integer taskId){ 76 | if (taskId == null || "".equals(taskId)){ 77 | return AjaxResult.failure("确少参数:taskId"); 78 | } 79 | return taskService.transfer(taskId); 80 | } 81 | 82 | /** 83 | * 任务排序 84 | */ 85 | @PostMapping("/task/sort") 86 | public AjaxResult taskSort(@RequestBody Object sortList){ 87 | JsonNode jsonNode = JsonUtils.stringToJsonNode(JsonUtils.objectToJson(sortList)); 88 | List syTasks = JsonUtils.objectToList(jsonNode.get("sortList"), SyTask.class); 89 | return taskService.taskSort(syTasks); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/controller/template/TmpController.java: -------------------------------------------------------------------------------- 1 | package com.xdx.controller.template; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.xdx.common.common.AjaxResult; 5 | import com.xdx.common.utils.JsonUtils; 6 | import com.xdx.entitys.pojo.SyLabel; 7 | import com.xdx.entitys.pojo.SyTemplate; 8 | import com.xdx.service.tmplate.TmpService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 任务模板 16 | * 17 | * @author 小道仙 18 | * @date 2020年12月26日 19 | */ 20 | @RestController 21 | public class TmpController { 22 | 23 | @Autowired 24 | private TmpService tmpService; 25 | 26 | /** 27 | * 新增任务 28 | */ 29 | @PostMapping("/tmp/add") 30 | public AjaxResult add(@RequestBody SyTemplate tmp){ 31 | if (tmp == null){ 32 | return AjaxResult.failure("参数异常"); 33 | } 34 | if (tmp.getLabelId() == null){ 35 | return AjaxResult.failure("请选择标签"); 36 | } 37 | if (tmp.getTmpTitle() == null){ 38 | return AjaxResult.failure("请输入标题"); 39 | } 40 | return tmpService.add(tmp); 41 | } 42 | 43 | /** 44 | * 删除任务 45 | */ 46 | @GetMapping("/tmp/del") 47 | public AjaxResult del(@RequestParam Integer id){ 48 | if (id == null){ 49 | return AjaxResult.failure("请选择要删除的模板"); 50 | } 51 | return tmpService.del(id); 52 | } 53 | 54 | /** 55 | * 更新任务 56 | */ 57 | @PostMapping("/tmp/update") 58 | public AjaxResult update(@RequestBody SyTemplate tmp){ 59 | if (tmp == null){ 60 | return AjaxResult.failure("参数异常"); 61 | } 62 | if (tmp.getId() == null){ 63 | return AjaxResult.failure("请选择要更新的模板"); 64 | } 65 | return tmpService.update(tmp); 66 | } 67 | 68 | /** 69 | * 任务列表 70 | */ 71 | @GetMapping("/tmp/list") 72 | public AjaxResult list(@RequestParam Integer labelId){ 73 | if (labelId == null){ 74 | return AjaxResult.failure("参数异常"); 75 | } 76 | return tmpService.list(labelId); 77 | } 78 | 79 | /** 80 | * 复制 81 | */ 82 | @PostMapping("/tmp/copy") 83 | public AjaxResult copy(@RequestBody String id){ 84 | JsonNode jsonNode = JsonUtils.stringToJsonNode(id); 85 | List ids = JsonUtils.jsonToList(jsonNode.get("ids").toString(), String.class); 86 | if (ids == null || ids.isEmpty()){ 87 | return AjaxResult.failure("参数异常"); 88 | } 89 | return tmpService.copy(ids); 90 | } 91 | 92 | /** 93 | * 模板排序 94 | */ 95 | @PostMapping("/tmp/sort") 96 | public AjaxResult sort(@RequestBody Object sortList){ 97 | JsonNode jsonNode = JsonUtils.stringToJsonNode(JsonUtils.objectToJson(sortList)); 98 | List syTemplates = JsonUtils.objectToList(jsonNode.get("sortList"), SyTemplate.class); 99 | return tmpService.sort(syTemplates); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/controller/user/SyUserController.java: -------------------------------------------------------------------------------- 1 | package com.xdx.controller.user; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.service.user.SyUserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * 用户相关操作 12 | */ 13 | @RestController 14 | public class SyUserController { 15 | 16 | @Autowired 17 | private SyUserService syUserService; 18 | 19 | /** 20 | * 用户登录 21 | */ 22 | @GetMapping("/user/login") 23 | public AjaxResult login(@RequestParam String code){ 24 | if (code == null || code.equals("")){ 25 | return AjaxResult.failure("确少参数 code"); 26 | } 27 | return syUserService.login(code); 28 | } 29 | 30 | /** 31 | * 修改用户使用阅读 32 | */ 33 | @GetMapping("/user/completeHelpRead") 34 | public AjaxResult completeHelpRead(){ 35 | return syUserService.completeHelpRead(); 36 | } 37 | 38 | /** 39 | * 用户编号 40 | */ 41 | @GetMapping("/user/userNumber") 42 | public AjaxResult userNumber(){ 43 | return syUserService.userNumber(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/entitys/config/AppletConfig.java: -------------------------------------------------------------------------------- 1 | package com.xdx.entitys.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 小程序配置 9 | */ 10 | @Data 11 | @Component 12 | public class AppletConfig { 13 | 14 | @Value("${wx.appid}") 15 | private String appid; 16 | 17 | @Value("${wx.secret}") 18 | private String secret; 19 | 20 | @Value("${wx.grantType}") 21 | private String grantType; 22 | 23 | @Value("${wx.loginUrl}") 24 | private String loginUrl; 25 | } 26 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/entitys/pojo/SyEdition.java: -------------------------------------------------------------------------------- 1 | package com.xdx.entitys.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.xdx.common.enums.YesOrNoStatusEnum; 7 | import lombok.Data; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.util.Date; 11 | import java.util.List; 12 | 13 | /** 14 | * 版本信息 15 | */ 16 | @Data 17 | @Accessors(chain = true) 18 | public class SyEdition { 19 | 20 | @TableId(value = "id",type = IdType.AUTO) 21 | private Integer id; 22 | 23 | private YesOrNoStatusEnum editionMain; 24 | 25 | private String editionInfo; 26 | 27 | private Integer supId; 28 | 29 | private Date createTime; 30 | 31 | @TableField(exist = false) 32 | private List lists; 33 | } 34 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/entitys/pojo/SyLabel.java: -------------------------------------------------------------------------------- 1 | package com.xdx.entitys.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.xdx.common.enums.YesOrNoStatusEnum; 6 | import lombok.Data; 7 | import lombok.experimental.Accessors; 8 | /** 9 | * 标签实体 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class SyLabel { 14 | 15 | @TableId(value = "label_id",type = IdType.AUTO) 16 | private String labelId; 17 | 18 | private Integer userId; 19 | 20 | private String labelName; 21 | 22 | private Integer labelSort; 23 | 24 | private YesOrNoStatusEnum labelStatus; 25 | 26 | private YesOrNoStatusEnum labelDefault; 27 | } 28 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/entitys/pojo/SyTask.java: -------------------------------------------------------------------------------- 1 | package com.xdx.entitys.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import com.xdx.common.enums.TaskTypeEnum; 6 | import com.xdx.common.enums.YesOrNoStatusEnum; 7 | import lombok.Data; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.util.Date; 11 | 12 | import static com.baomidou.mybatisplus.annotation.IdType.AUTO; 13 | 14 | /** 15 | * 任务实体 16 | */ 17 | @Data 18 | @Accessors(chain = true) 19 | public class SyTask { 20 | 21 | /** 22 | * 任务id 23 | */ 24 | @TableId(type = AUTO) 25 | private Integer taskId; 26 | 27 | /** 28 | * 用户id 29 | */ 30 | private Integer userId; 31 | 32 | /** 33 | * 任务类型 34 | */ 35 | private Integer labelId; 36 | 37 | /** 38 | * 任务标题 39 | */ 40 | private String taskTitle; 41 | 42 | /** 43 | * 任务描述 44 | */ 45 | private String taskDesc; 46 | 47 | /** 48 | * 任务排序 49 | */ 50 | private Integer taskSort; 51 | 52 | /** 53 | * 任务状态 54 | */ 55 | private YesOrNoStatusEnum taskSts; 56 | 57 | /** 58 | * 任务类型 59 | */ 60 | private TaskTypeEnum taskType; 61 | 62 | /** 63 | * 是否删除 0 没有删除,1 已经删除 64 | */ 65 | private YesOrNoStatusEnum taskDel; 66 | 67 | /** 68 | * 创建时间 69 | */ 70 | private Date createTime; 71 | 72 | /** 73 | * 代办通知时间 74 | */ 75 | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8") 76 | private Date taskNoticeTime; 77 | 78 | /** 79 | * 通知状态(1 已通知) 80 | */ 81 | private Integer taskNoticeStatus; 82 | } 83 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/entitys/pojo/SyTemplate.java: -------------------------------------------------------------------------------- 1 | package com.xdx.entitys.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import lombok.Data; 6 | import lombok.ToString; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 任务模板 14 | * 15 | * @author 小道仙 16 | * @date 2020年12月26日 17 | */ 18 | @Data 19 | @Accessors(chain = true) 20 | @ToString 21 | public class SyTemplate implements Serializable { 22 | /** 23 | * id 24 | */ 25 | @TableId(value = "id",type = IdType.AUTO) 26 | private Integer id; 27 | 28 | /** 29 | * 用户id 30 | */ 31 | private Integer userId; 32 | 33 | /** 34 | * 标签id 35 | */ 36 | private Integer labelId; 37 | 38 | /** 39 | * 模板标题 40 | */ 41 | private String tmpTitle; 42 | 43 | /** 44 | * 模板描述 45 | */ 46 | private String tmpDesc; 47 | 48 | /** 49 | * 创建时间 50 | */ 51 | private Date createTime; 52 | 53 | /** 54 | * 修改时间 55 | */ 56 | private Date modifyTime; 57 | 58 | /** 59 | * 排序 60 | */ 61 | private Integer sort; 62 | 63 | private static final long serialVersionUID = 1L; 64 | } -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/entitys/pojo/SyUser.java: -------------------------------------------------------------------------------- 1 | package com.xdx.entitys.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.xdx.common.enums.YesOrNoStatusEnum; 6 | import lombok.Data; 7 | import lombok.ToString; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 用户实体 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | @ToString 18 | public class SyUser { 19 | /** 20 | * 用户id 21 | */ 22 | @TableId(value = "user_id",type = IdType.AUTO) 23 | private Integer userId; 24 | 25 | /** 26 | * 微信OpenId 27 | */ 28 | private String wxOpenId; 29 | 30 | /** 31 | * 用户状态:1启用0停用 32 | */ 33 | private YesOrNoStatusEnum userStatus; 34 | 35 | /** 36 | * 是否授权1已授权0未授权 37 | */ 38 | private YesOrNoStatusEnum isAuthorize; 39 | 40 | /** 41 | * 用户性别 0 未知、1 男性,2 女性 42 | */ 43 | private Integer gender; 44 | 45 | /** 46 | * 备注 47 | */ 48 | private String userRemarks; 49 | 50 | /** 51 | * 使用帮助是否阅读 1 已经阅读 52 | */ 53 | private Integer helpRead; 54 | 55 | /** 56 | * 通知管理 57 | */ 58 | private String msgNotice; 59 | 60 | } -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/mapper/label/SyLabelMapper.java: -------------------------------------------------------------------------------- 1 | package com.xdx.mapper.label; 2 | 3 | import com.xdx.common.common.MyBaseMapper; 4 | import com.xdx.entitys.pojo.SyLabel; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | @Mapper 12 | public interface SyLabelMapper extends MyBaseMapper { 13 | 14 | void addLabel(Map params); 15 | 16 | void deleteLabel(Map params); 17 | 18 | List list(@Param("userId") String userId); 19 | 20 | void updateDefault(@Param("userId") String userId,@Param("labelId") String labelId); 21 | 22 | List> listAll(@Param("userId") String userId); 23 | } 24 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/mapper/other/SyEditionMapper.java: -------------------------------------------------------------------------------- 1 | package com.xdx.mapper.other; 2 | 3 | import com.xdx.common.common.MyBaseMapper; 4 | import com.xdx.entitys.pojo.SyEdition; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface SyEditionMapper extends MyBaseMapper { 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/mapper/task/SyTaskMapper.java: -------------------------------------------------------------------------------- 1 | package com.xdx.mapper.task; 2 | 3 | import com.xdx.common.common.MyBaseMapper; 4 | import com.xdx.entitys.pojo.SyTask; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | @Mapper 12 | public interface SyTaskMapper extends MyBaseMapper { 13 | 14 | void updateByKey(SyTask update); 15 | 16 | /** 17 | * 找到最大的排序 18 | */ 19 | Integer selectMaxSort(@Param("userId") Integer userId); 20 | 21 | /** 22 | * 更新已完成的数据 23 | */ 24 | void updateCompleted(); 25 | 26 | /** 27 | * 移动任务 28 | */ 29 | void changeTask(); 30 | 31 | List> selectTodo(); 32 | 33 | /** 34 | * 更新通知时间和状态为 null 35 | * @param taskId 36 | */ 37 | void updateNoticeByNull(@Param("taskId") Integer taskId); 38 | } 39 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/mapper/template/SyTemplateMapper.java: -------------------------------------------------------------------------------- 1 | package com.xdx.mapper.template; 2 | 3 | import com.xdx.common.common.MyBaseMapper; 4 | import com.xdx.entitys.pojo.SyTask; 5 | import com.xdx.entitys.pojo.SyTemplate; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.List; 10 | 11 | @Mapper 12 | public interface SyTemplateMapper extends MyBaseMapper { 13 | 14 | /** 15 | * 根据ids查询 16 | */ 17 | List selectByIds(@Param("ids") List ids); 18 | } 19 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/mapper/user/SyUserMapper.java: -------------------------------------------------------------------------------- 1 | package com.xdx.mapper.user; 2 | 3 | import com.xdx.common.common.MyBaseMapper; 4 | import com.xdx.entitys.pojo.SyUser; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | @Mapper 9 | public interface SyUserMapper extends MyBaseMapper { 10 | 11 | int chechMsg(@Param("userId") String userId,@Param("msgId") String msgId); 12 | } 13 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/label/SyLabelService.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.label; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.entitys.pojo.SyLabel; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public interface SyLabelService { 10 | 11 | /** 12 | * 新增标签 13 | */ 14 | AjaxResult add(Map params); 15 | 16 | /** 17 | * 修改标签 18 | */ 19 | AjaxResult update(SyLabel syLabel); 20 | 21 | /** 22 | * 删除标签 23 | */ 24 | AjaxResult delete(Map params); 25 | 26 | /** 27 | * 标签列表 28 | */ 29 | AjaxResult list(); 30 | 31 | /** 32 | * 修改默认标签 33 | */ 34 | AjaxResult updateDefault(Map params); 35 | 36 | /** 37 | * 标签列表带统计 38 | */ 39 | AjaxResult listAll(Integer flag); 40 | 41 | /** 42 | * 获取默认标签Id 43 | */ 44 | AjaxResult getDefaultLabel(); 45 | 46 | /** 47 | * 标签排序 48 | */ 49 | AjaxResult sortLabel(List sortList); 50 | } 51 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/other/OtherService.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.other; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | 5 | public interface OtherService { 6 | 7 | /** 8 | * 版本信息 9 | */ 10 | AjaxResult editionInfo(); 11 | } 12 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/other/impl/OtherServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.other.impl; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.common.common.MyCommonService; 5 | import com.xdx.common.enums.YesOrNoStatusEnum; 6 | import com.xdx.entitys.pojo.SyEdition; 7 | import com.xdx.mapper.other.SyEditionMapper; 8 | import com.xdx.service.other.OtherService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 其它操作 16 | * 17 | * @author 小道仙 18 | * @date 2020年12月25日 19 | */ 20 | @Service 21 | public class OtherServiceImpl extends MyCommonService implements OtherService { 22 | 23 | @Autowired 24 | private SyEditionMapper editionMapper; 25 | 26 | /** 27 | * 版本信息 28 | */ 29 | @Override 30 | public AjaxResult editionInfo() { 31 | List main = editionMapper.selectList(new SyEdition().setEditionMain(YesOrNoStatusEnum.YES),"desc","id"); 32 | for (SyEdition item : main){ 33 | item.setLists(editionMapper.selectList(new SyEdition().setSupId(item.getId()),null,"id")); 34 | } 35 | return AjaxResult.success(main); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/task/SyTaskService.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.task; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.entitys.pojo.SyTask; 5 | 6 | import java.util.List; 7 | 8 | public interface SyTaskService { 9 | 10 | /** 11 | * 新增任务 12 | */ 13 | AjaxResult add(SyTask task); 14 | 15 | /** 16 | * 获取任务数据 17 | */ 18 | AjaxResult> list(Integer taskType,Integer labelId); 19 | 20 | /** 21 | * 更新任务 22 | */ 23 | AjaxResult update(SyTask task); 24 | 25 | /** 26 | * 更新完成 27 | */ 28 | AjaxResult complete(Integer taskId); 29 | 30 | /** 31 | * 任务转移 32 | */ 33 | AjaxResult transfer(Integer taskId); 34 | 35 | /** 36 | * 任务排序 37 | */ 38 | AjaxResult taskSort(List syTasks); 39 | } 40 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/timingtask/ChangeTask.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.timingtask; 2 | 3 | import com.xdx.mapper.task.SyTaskMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.Async; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.annotation.Scheduled; 9 | 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | 13 | @Configuration 14 | @Async 15 | @EnableAsync 16 | public class ChangeTask { 17 | 18 | @Autowired 19 | private SyTaskMapper taskMapper; 20 | 21 | /** 22 | * 把今日没有完成的任务移动到任务总览里面去 23 | * 24 | * 每天0点过1分执行 25 | */ 26 | @Scheduled(cron = "0 1 0 * * ?") 27 | public void change(){ 28 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 29 | System.out.println(df.format(new Date()) + " 定时移动任务数据"); 30 | taskMapper.changeTask(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/timingtask/RemoveTask.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.timingtask; 2 | 3 | import com.xdx.mapper.task.SyTaskMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.Async; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.annotation.Scheduled; 9 | 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | 13 | @Configuration 14 | @Async 15 | @EnableAsync 16 | public class RemoveTask { 17 | 18 | /** 19 | * 清除已经完成的任务 20 | * 21 | * 每天0点过5分清除数据 22 | */ 23 | @Autowired 24 | private SyTaskMapper taskMapper; 25 | @Scheduled(cron = "0 5 0 * * ?") 26 | public void remove(){ 27 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 28 | System.out.println(df.format(new Date()) + " 定时任务清空已完成数据"); 29 | taskMapper.updateCompleted(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/tmplate/TmpService.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.tmplate; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.entitys.pojo.SyLabel; 5 | import com.xdx.entitys.pojo.SyTemplate; 6 | 7 | import java.util.List; 8 | 9 | public interface TmpService { 10 | 11 | AjaxResult add(SyTemplate tmp); 12 | 13 | AjaxResult del(Integer id); 14 | 15 | AjaxResult update(SyTemplate tmp); 16 | 17 | AjaxResult list(Integer labelId); 18 | 19 | AjaxResult copy(List labelId); 20 | 21 | AjaxResult sort(List syTemplates); 22 | } 23 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/tmplate/impl/TmpServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.tmplate.impl; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | import com.xdx.common.common.MyCommonService; 5 | import com.xdx.common.enums.TaskTypeEnum; 6 | import com.xdx.common.enums.YesOrNoStatusEnum; 7 | import com.xdx.entitys.pojo.SyLabel; 8 | import com.xdx.entitys.pojo.SyTask; 9 | import com.xdx.entitys.pojo.SyTemplate; 10 | import com.xdx.mapper.task.SyTaskMapper; 11 | import com.xdx.mapper.template.SyTemplateMapper; 12 | import com.xdx.service.tmplate.TmpService; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.util.Date; 17 | import java.util.List; 18 | 19 | @Service 20 | public class TmpServiceImpl extends MyCommonService implements TmpService { 21 | 22 | @Autowired 23 | private SyTemplateMapper tmpMapper; 24 | 25 | @Autowired 26 | private SyTaskMapper taskMapper; 27 | 28 | @Override 29 | public AjaxResult add(SyTemplate tmp) { 30 | tmp.setCreateTime(new Date()); 31 | tmp.setUserId(getCurUser().getUserId()); 32 | tmpMapper.insert(tmp); 33 | return AjaxResult.success("新增成功"); 34 | } 35 | 36 | @Override 37 | public AjaxResult del(Integer id) { 38 | tmpMapper.deleteById(id); 39 | return AjaxResult.success("删除成功"); 40 | } 41 | 42 | @Override 43 | public AjaxResult update(SyTemplate tmp) { 44 | tmp.setModifyTime(new Date()); 45 | tmpMapper.updateById(tmp); 46 | return AjaxResult.success("更新成功"); 47 | } 48 | 49 | @Override 50 | public AjaxResult list(Integer labelId) { 51 | SyTemplate tmp = new SyTemplate(); 52 | tmp.setLabelId(labelId); 53 | List syTemplates = tmpMapper.selectList(tmp,"asc","sort"); 54 | return AjaxResult.success(syTemplates); 55 | } 56 | 57 | @Override 58 | public AjaxResult copy(List ids) { 59 | Integer userId = getCurUser().getUserId(); 60 | List templates = tmpMapper.selectByIds(ids); 61 | SyTask task = new SyTask(); 62 | task.setUserId(userId); 63 | Integer maxSort = 0; 64 | for (SyTemplate item : templates){ 65 | maxSort = taskMapper.selectMaxSort(task.getUserId()); 66 | if (maxSort == null){ 67 | maxSort = 0; 68 | } 69 | task.setLabelId(item.getLabelId()); 70 | task.setTaskSort(maxSort); 71 | task.setTaskDel(YesOrNoStatusEnum.NO); 72 | task.setCreateTime(new Date()); 73 | task.setTaskSts(YesOrNoStatusEnum.NO); 74 | task.setTaskType(TaskTypeEnum.TOTAL); 75 | task.setTaskTitle(item.getTmpTitle()); 76 | task.setTaskDesc(item.getTmpDesc()); 77 | taskMapper.insert(task); 78 | } 79 | return AjaxResult.success("复制成功"); 80 | } 81 | 82 | @Override 83 | public AjaxResult sort(List syTemplates) { 84 | 85 | SyTemplate update = new SyTemplate(); 86 | int i = 1; 87 | for (SyTemplate item : syTemplates){ 88 | update.setId(item.getId()); 89 | update.setSort(i++); 90 | tmpMapper.updateById(update); 91 | } 92 | return AjaxResult.success("操作完成"); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/user/SyUserService.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.user; 2 | 3 | import com.xdx.common.common.AjaxResult; 4 | 5 | public interface SyUserService { 6 | 7 | /** 8 | * 用户登录 9 | */ 10 | AjaxResult login(String code); 11 | 12 | /** 13 | * 用户编号 14 | */ 15 | AjaxResult userNumber(); 16 | 17 | AjaxResult completeHelpRead(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/service/user/impl/SyUserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xdx.service.user.impl; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.xdx.common.common.AjaxResult; 5 | import com.xdx.common.common.MyCommonService; 6 | import com.xdx.common.enums.YesOrNoStatusEnum; 7 | import com.xdx.common.utils.HttpClient; 8 | import com.xdx.entitys.config.AppletConfig; 9 | import com.xdx.entitys.pojo.SyUser; 10 | import com.xdx.mapper.user.SyUserMapper; 11 | import com.xdx.service.user.SyUserService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | @Service 19 | public class SyUserServiceImpl extends MyCommonService 20 | implements SyUserService { 21 | 22 | @Autowired 23 | private AppletConfig appletConfig; 24 | 25 | @Autowired 26 | private SyUserMapper syUserMapper; 27 | 28 | @Override 29 | public AjaxResult login(String code) { 30 | // 1、去获取用户的openid 31 | Map map = new HashMap<>(); 32 | map.put("appid", appletConfig.getAppid()); 33 | map.put("secret", appletConfig.getSecret()); 34 | map.put("grantType", appletConfig.getGrantType()); 35 | map.put("js_code", code); 36 | Object obj = HttpClient.requestGet(appletConfig.getLoginUrl(), map); 37 | JSONObject jsonObject = JSONObject.parseObject(obj.toString()); 38 | String openId = jsonObject.get("openid").toString(); 39 | 40 | // 2、判断用户是否存在 如果不存在就新增用户 41 | SyUser user = syUserMapper.selectOne(new SyUser().setWxOpenId(openId).setUserStatus(YesOrNoStatusEnum.YES)); 42 | if (user == null){ 43 | user = new SyUser(); 44 | user.setWxOpenId(openId) 45 | .setUserStatus(YesOrNoStatusEnum.YES) 46 | .setIsAuthorize(YesOrNoStatusEnum.NO) 47 | .setHelpRead(0); 48 | syUserMapper.insert(user); 49 | } 50 | // 3、返回登录openId 51 | Map result = new HashMap<>(); 52 | result.put("openId",openId); 53 | result.put("helpRead", user.getHelpRead()); 54 | return AjaxResult.success(result); 55 | } 56 | 57 | @Override 58 | public AjaxResult userNumber() { 59 | String token = getToken(); 60 | SyUser user = syUserMapper.selectOne(new SyUser().setWxOpenId(token)); 61 | if (user == null){ 62 | return AjaxResult.failure("系统异常"); 63 | } 64 | return AjaxResult.success(user.getUserId()); 65 | } 66 | 67 | @Override 68 | public AjaxResult completeHelpRead() { 69 | SyUser curUser = getCurUser(); 70 | curUser.setHelpRead(1); 71 | syUserMapper.updateById(curUser); 72 | return null; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/timingtask/ChangeTask.java: -------------------------------------------------------------------------------- 1 | package com.xdx.timingtask; 2 | 3 | import com.xdx.mapper.task.SyTaskMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.Async; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.annotation.Scheduled; 9 | 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | 13 | @Configuration 14 | @Async 15 | public class ChangeTask { 16 | 17 | @Autowired 18 | private SyTaskMapper taskMapper; 19 | 20 | /** 21 | * 把今日没有完成的任务移动到任务总览里面去 22 | * 23 | * 每天0点过1分执行 24 | */ 25 | @Scheduled(cron = "0 1 0 * * ?") 26 | public void change(){ 27 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 28 | System.out.println(df.format(new Date()) + " 定时移动任务数据"); 29 | taskMapper.changeTask(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/timingtask/RemoveTask.java: -------------------------------------------------------------------------------- 1 | package com.xdx.timingtask; 2 | 3 | import com.xdx.mapper.task.SyTaskMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.Async; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.annotation.Scheduled; 9 | 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | 13 | @Configuration 14 | @Async 15 | public class RemoveTask { 16 | 17 | /** 18 | * 清除已经完成的任务 19 | * 20 | * 每天0点过5分清除数据 21 | */ 22 | @Autowired 23 | private SyTaskMapper taskMapper; 24 | 25 | @Scheduled(cron = "0 5 0 * * ?") 26 | // @Scheduled(fixedRate = 1000 * 600) 27 | public void remove(){ 28 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 29 | System.out.println(df.format(new Date()) + " 定时任务清空已完成数据"); 30 | taskMapper.updateCompleted(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /amnesia/src/main/java/com/xdx/timingtask/TodoNoticeTask.java: -------------------------------------------------------------------------------- 1 | package com.xdx.timingtask; 2 | 3 | import com.xdx.common.utils.DateUtils; 4 | import com.xdx.common.utils.wx.WxMsgUtils; 5 | import com.xdx.entitys.pojo.SyTask; 6 | import com.xdx.entitys.pojo.SyUser; 7 | import com.xdx.mapper.task.SyTaskMapper; 8 | import com.xdx.mapper.user.SyUserMapper; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.beans.factory.annotation.Value; 12 | import org.springframework.context.annotation.Configuration; 13 | import org.springframework.scheduling.annotation.Async; 14 | import org.springframework.scheduling.annotation.Scheduled; 15 | 16 | import java.util.Date; 17 | import java.util.HashMap; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | /** 22 | * 代办消息提醒 23 | * 24 | * @author 小道仙 25 | * @date 2021年4月19日 26 | */ 27 | @Configuration 28 | @Async 29 | @Slf4j 30 | public class TodoNoticeTask { 31 | 32 | @Value("${msg-tmpl.todo}") 33 | private String msgTmplTodo; 34 | 35 | @Autowired 36 | private SyTaskMapper taskMapper; 37 | 38 | @Autowired 39 | private SyUserMapper userMapper; 40 | 41 | /** 42 | * 每30秒查询一次看看是否有需要发送代办消息的 43 | */ 44 | // @Scheduled(fixedRate = 1000 * 30) 45 | public void remove(){ 46 | List> syTasks = taskMapper.selectTodo(); 47 | if (syTasks != null && !syTasks.isEmpty()){ 48 | SyTask tmpUpdate = new SyTask(); 49 | String tmpTaskId = ""; 50 | for (Map item : syTasks){ 51 | try { 52 | tmpTaskId = ""+ item.get("taskId"); 53 | Map> data = new HashMap<>(); 54 | Map thing1 = new HashMap<>(); 55 | thing1.put("value", item.get("taskTitle")+""); 56 | data.put("thing1",thing1); 57 | Map time2 = new HashMap<>(); 58 | time2.put("value", DateUtils.parseDate(new Date(),"yyyy-MM-dd HH:mm:ss")); 59 | data.put("time2",time2); 60 | Map thing4 = new HashMap<>(); 61 | thing4.put("value", "点击前往办理"); 62 | data.put("thing4",thing4); 63 | // 发送消息 64 | String errCode = WxMsgUtils.sendTmplMsg(item.get("wxOpenId")+"", msgTmplTodo, "", "", data); 65 | 66 | // 更新消息发送状态为已发送 67 | tmpUpdate.setTaskId(Integer.parseInt(tmpTaskId)); 68 | tmpUpdate.setTaskNoticeStatus(1); 69 | // 用户取消提醒 70 | if ("43101".equals(errCode)){ 71 | SyUser user = userMapper.selectById(item.get("userId")+""); 72 | user.setMsgNotice(user.getMsgNotice().replace("1,","")); 73 | userMapper.updateById(user); 74 | } 75 | }catch (Exception e){ 76 | // 2 为发送失败 77 | tmpUpdate.setTaskNoticeStatus(2); 78 | log.error("发送失败taskId:"+tmpTaskId, e); 79 | }finally { 80 | // 更新消息发送状态 81 | taskMapper.updateById(tmpUpdate); 82 | } 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /amnesia/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | servlet: 4 | context-path: /api 5 | 6 | # https 配置 7 | # ssl: 8 | # key-store: /xdx/amnesia/amnesia.pfx 9 | # key-store-password: wqp355Bp 10 | # key-store-type: PKCS12 11 | 12 | 13 | mybatis: 14 | type-aliases-package: com.xdx.entitys # 所有Entity别名类所在包 15 | 16 | 17 | mybatis-plus: 18 | type-handlers-package: com.xdx.common.handler # 处理器配置 19 | mapper-locations: classpath:mappers/**/*Mapper.xml # mapper映射文件 - classpath:mybatis/mapper/**/*.xml 20 | 21 | 22 | spring: 23 | datasource: 24 | type: com.alibaba.druid.pool.DruidDataSource 25 | driver-class-name: com.mysql.cj.jdbc.Driver 26 | url: jdbc:mysql://127.0.0.1:3306/amnesia?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai 27 | username: root 28 | password: 123456 29 | dbcp2: 30 | min-idle: 5 # 数据库连接池最小维持连接数 31 | initial-size: 5 # 初始连接数 32 | max-total: 5 # 最大连接数 33 | max-wait-millis: 200 # 等待链接获取的最大超时时间 34 | main: 35 | allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册 36 | 37 | # 开启MyBatis打印日志 38 | logging: 39 | level: 40 | com.xdx.mapper: debug 41 | 42 | 43 | 44 | 45 | # 微信小程序数据 46 | wx: 47 | appid: wx1a39331e85e08267 48 | secret: c2799cc897a8bd8011474034fa20d685 49 | grantType: authorization_code 50 | loginUrl: https://api.weixin.qq.com/sns/jscode2session 51 | # 文字校验 52 | msgSecCheck: https://api.weixin.qq.com/wxa/msg_sec_check?access_token= 53 | 54 | # 微信消息模板 55 | msg-tmpl: 56 | # 代办提醒 57 | todo: IAVbn0mLYfsBhfHfvyfYg-exlI0gFmWGilU0u85ghJE 58 | 59 | -------------------------------------------------------------------------------- /amnesia/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: dev 4 | 5 | app: 6 | name: amesia -------------------------------------------------------------------------------- /amnesia/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 24 | 25 | 27 | 28 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 39 | ${logback_rolling_path}/${app.name}.log 40 | 41 | 42 | 43 | 44 | ${logback_rolling_path}/${app.name}.%d{yyyy-MM-dd}.%i.log 45 | 46 | 47 | 30 48 | 50 | 51 | ${logback_max_file_size} 52 | 53 | 54 | 55 | ${logback_pattern} 56 | UTF-8 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | ${logback_pattern} 70 | 71 | 72 | 73 | 74 | 75 | 76 | 79 | 80 | 81 | 82 | ${app.name} 83 | 84 | -------------------------------------------------------------------------------- /amnesia/src/main/resources/mappers/label/SyLabelMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ${base}.label_id, 16 | ${base}.user_id, 17 | ${base}.label_name, 18 | ${base}.label_sort, 19 | ${base}.label_status, 20 | ${base}.label_default 21 | 22 | 23 | 24 | INSERT INTO sy_label (user_id,label_name) VALUES (#{userId}, #{labelName}) 25 | 26 | 27 | 28 | DELETE FROM sy_label WHERE label_id # {labelId} 29 | 30 | 31 | 43 | 44 | 45 | 46 | 47 | UPDATE sy_label SET label_default = 1 WHERE label_id = #{labelId} 48 | 49 | 50 | UPDATE sy_label SET label_default = 0 WHERE user_id = #{userId} 51 | 52 | 53 | 54 | 55 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /amnesia/src/main/resources/mappers/other/SyEditionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | id, 15 | edition_main, 16 | edition_info, 17 | sup_id, 18 | create_time 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /amnesia/src/main/resources/mappers/template/SyTemplateMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | id, user_id, label_id, tmp_title, tmp_desc, create_time,modify_time,sort 17 | 18 | 19 | 27 | -------------------------------------------------------------------------------- /amnesia/src/main/resources/mappers/user/SyUserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | user_id, 18 | wx_open_id, 19 | user_status, 20 | is_authorize, 21 | gender, 22 | user_remarks, 23 | help_read, 24 | msg_notice 25 | 26 | 27 | 33 | -------------------------------------------------------------------------------- /other/amnesia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/other/amnesia.jpg -------------------------------------------------------------------------------- /other/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdxTao/amnesia/48024c27cd8b9cd3c0fa58d7ee71abf4597b83ce/other/preview.png --------------------------------------------------------------------------------