├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .idea └── vcs.xml ├── .prettierrc ├── .wepyignore ├── package-lock.json ├── package.json ├── project.config.json ├── readme.md ├── src ├── app.wpy ├── common │ └── eventHub.js ├── components │ ├── authorized-check.wpy │ ├── buttons │ │ ├── downvote-btn.js │ │ ├── downvote-btn.json │ │ ├── downvote-btn.wxml │ │ ├── downvote-btn.wxss │ │ ├── favorite-btn.js │ │ ├── favorite-btn.json │ │ ├── favorite-btn.wpy │ │ ├── favorite-btn.wxml │ │ ├── favorite-btn.wxss │ │ ├── like-btn.js │ │ ├── like-btn.json │ │ ├── like-btn.wpy │ │ ├── like-btn.wxml │ │ ├── like-btn.wxss │ │ ├── relation-btn.js │ │ ├── relation-btn.json │ │ ├── relation-btn.wpy │ │ ├── relation-btn.wxml │ │ ├── upvote-btn.js │ │ ├── upvote-btn.json │ │ ├── upvote-btn.wxml │ │ └── upvote-btn.wxss │ ├── comment.wpy │ ├── html2wxml │ │ ├── highlight-styles │ │ │ ├── darcula.wxss │ │ │ ├── default.wxss │ │ │ ├── dracula.wxss │ │ │ └── tomorrow.wxss │ │ ├── html2wxml-main.js │ │ ├── html2wxml.js │ │ ├── html2wxml.json │ │ ├── html2wxml.wxml │ │ ├── html2wxml.wxss │ │ └── images │ │ │ └── loading.png │ └── weui │ │ ├── badge │ │ ├── badge.js │ │ ├── badge.json │ │ ├── badge.wxml │ │ └── badge.wxss │ │ ├── cell │ │ ├── cell.js │ │ ├── cell.json │ │ ├── cell.wxml │ │ └── cell.wxss │ │ ├── cells │ │ ├── cells.js │ │ ├── cells.json │ │ └── cells.wxml │ │ ├── checkbox-group │ │ ├── checkbox-group.js │ │ ├── checkbox-group.json │ │ ├── checkbox-group.wxml │ │ └── checkbox-group.wxss │ │ ├── checkbox │ │ ├── checkbox.js │ │ ├── checkbox.json │ │ ├── checkbox.wxml │ │ └── checkbox.wxss │ │ ├── dialog │ │ ├── dialog.js │ │ ├── dialog.json │ │ ├── dialog.wxml │ │ └── dialog.wxss │ │ ├── form │ │ ├── form.js │ │ ├── form.json │ │ └── form.wxml │ │ ├── gallery │ │ ├── gallery.js │ │ ├── gallery.json │ │ ├── gallery.wxml │ │ └── gallery.wxss │ │ ├── loading │ │ ├── loading.js │ │ ├── loading.json │ │ ├── loading.wxml │ │ └── loading.wxss │ │ ├── msg │ │ ├── msg.js │ │ ├── msg.json │ │ ├── msg.wxml │ │ └── msg.wxss │ │ ├── navigation-bar │ │ ├── navigation-bar.js │ │ ├── navigation-bar.json │ │ ├── navigation-bar.wxml │ │ └── navigation-bar.wxss │ │ ├── searchbar │ │ ├── searchbar.js │ │ ├── searchbar.json │ │ ├── searchbar.wxml │ │ └── searchbar.wxss │ │ ├── slideview │ │ ├── slideview.js │ │ ├── slideview.json │ │ ├── slideview.wxml │ │ ├── slideview.wxs │ │ └── slideview.wxss │ │ ├── static │ │ └── icon │ │ │ ├── s-arrow-back.png │ │ │ └── s-arrow-back.svg │ │ ├── tabbar │ │ ├── tabbar.js │ │ ├── tabbar.json │ │ ├── tabbar.wxml │ │ └── tabbar.wxss │ │ ├── toptips │ │ ├── toptips.js │ │ ├── toptips.json │ │ ├── toptips.wxml │ │ └── toptips.wxss │ │ └── uploader │ │ ├── uploader.js │ │ ├── uploader.json │ │ ├── uploader.wxml │ │ └── uploader.wxss ├── libs │ └── weapp.socket.io.js ├── mixins │ ├── mapAuthState.js │ └── request.js ├── pages │ ├── account │ │ ├── center │ │ │ └── index.wpy │ │ ├── comments │ │ │ ├── index.wpy │ │ │ └── services.js │ │ ├── favorites │ │ │ ├── index.wpy │ │ │ └── services.js │ │ ├── likers │ │ │ ├── index.wpy │ │ │ └── services.js │ │ ├── notifications │ │ │ ├── components │ │ │ │ ├── comment-my-article.wpy │ │ │ │ ├── liked-my-article.wpy │ │ │ │ ├── mentioned-me.wpy │ │ │ │ ├── reply-my-comment.wpy │ │ │ │ └── up-voted-my-comment.wpy │ │ │ ├── index.wpy │ │ │ └── services.js │ │ └── settings │ │ │ ├── index.wpy │ │ │ └── services.js │ ├── articles │ │ ├── list │ │ │ ├── components │ │ │ │ ├── list-item.wpy │ │ │ │ ├── list-item1.wpy │ │ │ │ └── list-item2.wpy │ │ │ ├── index.wpy │ │ │ └── services.js │ │ └── show │ │ │ ├── comment.wpy │ │ │ ├── index.wpy │ │ │ └── services.js │ └── auth │ │ └── scan-login.wpy ├── services.js ├── static │ └── png │ │ ├── article_80x80.png │ │ ├── desktop_200x200.png │ │ ├── downvote_81x81.png │ │ ├── downvoted_81x81.png │ │ ├── favorite_81x81.png │ │ ├── favorited_81x81.png │ │ ├── like_81x81.png │ │ ├── liked_81x81.png │ │ ├── message_81x81.png │ │ ├── read_81x81.png │ │ ├── read_selected_81x81.png │ │ ├── tags_81x81.png │ │ ├── upvote_81x81.png │ │ ├── upvoted_81x81.png │ │ ├── user_81x81.png │ │ └── user_selected_81x81.png ├── utils │ ├── request.js │ └── utils.js └── vuex │ ├── auth.js │ ├── index.js │ └── plugin.js └── wepy.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | weapp/* 2 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | globals: { wx: true }, 4 | parser: 'babel-eslint', 5 | parserOptions: { 6 | sourceType: 'module' 7 | }, 8 | env: { 9 | browser: true 10 | }, 11 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style 12 | extends: 'standard', 13 | // required to lint *.wpy files 14 | plugins: [ 15 | 'html' 16 | ], 17 | settings: { 18 | 'html/html-extensions': ['.html', '.wpy'] 19 | }, 20 | // add your custom rules here 21 | 'rules': { 22 | // allow paren-less arrow functions 23 | 'arrow-parens': 0, 24 | // allow async-await 25 | 'generator-star-spacing': 0, 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 28 | 'space-before-function-paren': 0, 29 | 'semi': ['error', 'always'], 30 | 'comma-dangle': ['error', 'always-multiline'], 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | weapp 4 | .DS_Store 5 | .idea/* 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.wepyignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | weapp 3 | .DS_Store 4 | *.wpy___jb_tmp___ 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blog", 3 | "version": "0.0.2", 4 | "description": "平凡的博客", 5 | "main": "weapp/app.js", 6 | "scripts": { 7 | "dev": "./node_modules/.bin/wepy build --watch", 8 | "build": "cross-env NODE_ENV=production ./node_modules/.bin/wepy build --no-cache", 9 | "clean": "rm -rf weapp", 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "wepy": { 13 | "module-a": false, 14 | "./src/components/list": "./src/components/wepy-list.wpy" 15 | }, 16 | "author": "yanthink", 17 | "license": "MIT", 18 | "dependencies": { 19 | "@wepy/core": "^2.0.0-alpha.9", 20 | "@wepy/x": "^2.0.2", 21 | "laravel-echo": "^1.6.1", 22 | "lodash": "^4.17.15", 23 | "lodash-decorators": "^6.0.1", 24 | "moment": "^2.24.0", 25 | "qs": "^6.9.0" 26 | }, 27 | "devDependencies": { 28 | "@babel/core": "^7.1.0", 29 | "@babel/plugin-proposal-decorators": "^7.6.0", 30 | "@babel/preset-env": "^7.1.0", 31 | "@wepy/babel-plugin-import-regenerator": "0.0.2", 32 | "@wepy/cli": "^2.0.0-alpha.20", 33 | "@wepy/compiler-babel": "^2.0.1", 34 | "@wepy/compiler-less": "^2.0.1", 35 | "@wepy/plugin-define": "^2.0.1", 36 | "@wepy/plugin-uglifyjs": "0.0.2", 37 | "babel-eslint": "^7.2.1", 38 | "cross-env": "^5.1.3", 39 | "eslint": "^6.6.0", 40 | "eslint-config-standard": "^7.1.0", 41 | "eslint-friendly-formatter": "^2.0.7", 42 | "eslint-plugin-html": "^2.0.1", 43 | "eslint-plugin-promise": "^3.5.0", 44 | "eslint-plugin-standard": "^2.0.1", 45 | "less": "^3.8.1", 46 | "uglify-js": "^3.6.1", 47 | "wepy-eslint": "^1.5.3" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "平凡的博客", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": false, 6 | "postcss": false, 7 | "minified": false 8 | }, 9 | "compileType": "miniprogram", 10 | "appid": "wx2b051c6c4c45e924", 11 | "projectname": "blog", 12 | "miniprogramRoot": "weapp/", 13 | "simulatorType": "wechat", 14 | "simulatorPluginLibVersion": {}, 15 | "condition": {} 16 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | > 该项目以迁移至 https://github.com/yanthink/pingfan.blog ,今后不再维护 2 | 3 | ## 项目概述 4 | 5 | * 产品名称:小程序版个人博客 6 | * 项目代号:mpblog 7 | * 服务端源码:https://github.com/yanthink/blog-api 8 | 9 | 基于 [wepy2.0](https://github.com/Tencent/wepy) 开发。 10 | 11 | ### 安装 12 | 13 | #### 1. 克隆源代码 14 | 15 | git clone https://github.com/yanthink/mpblog.git 16 | 17 | #### 2. 安装依赖 18 | 19 | npm install 20 | 21 | #### 3. 运行编译 22 | 23 | npm run dev 24 | 25 | ### 参考文档 26 | 27 | - [wepy2.0开发文档](https://wepyjs.github.io/wepy-docs/2.x/#/) 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/app.wpy: -------------------------------------------------------------------------------- 1 | 17 | 18 | 56 | 57 | 58 | { 59 | pages: [ 60 | 'pages/articles/list/index', 61 | 'pages/account/center/index', 62 | 'pages/articles/show/index', 63 | 'pages/articles/show/comment', 64 | 'pages/account/favorites/index', 65 | 'pages/account/comments/index', 66 | 'pages/account/likers/index', 67 | 'pages/account/notifications/index', 68 | 'pages/account/settings/index', 69 | 'pages/auth/scan-login', 70 | ], 71 | window: { 72 | backgroundColor: '#F8F8F8', 73 | backgroundTextStyle: 'light', 74 | navigationBarBackgroundColor: '#F8F8F8', 75 | navigationBarTitleText: '平凡的博客', 76 | navigationBarTextStyle: 'black', 77 | }, 78 | tabBar: { 79 | color: '#595959', 80 | selectedColor: '#13C2C2', 81 | backgroundColor: '#ffffff', 82 | borderStyle: 'black', 83 | position: 'bottom', 84 | list: [ 85 | { 86 | pagePath: 'pages/articles/list/index', 87 | text: '博文', 88 | iconPath: './static/png/read_81x81.png', 89 | selectedIconPath: './static/png/read_selected_81x81.png', 90 | }, 91 | { 92 | pagePath: 'pages/account/center/index', 93 | text: '我的', 94 | iconPath: './static/png/user_81x81.png', 95 | selectedIconPath: './static/png/user_selected_81x81.png', 96 | }, 97 | ], 98 | }, 99 | } 100 | 101 | -------------------------------------------------------------------------------- /src/common/eventHub.js: -------------------------------------------------------------------------------- 1 | import wepy from '@wepy/core'; 2 | 3 | let eventHub = new wepy(); 4 | 5 | export default eventHub; 6 | -------------------------------------------------------------------------------- /src/components/authorized-check.wpy: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 58 | -------------------------------------------------------------------------------- /src/components/buttons/downvote-btn.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | properties: { 3 | relation: String, 4 | item: { 5 | type: Object, 6 | }, 7 | }, 8 | 9 | methods: { 10 | afterToggle (e) { 11 | const item = { ...this.data.item }; 12 | e.detail ? item.cache.down_voters_count++ : item.cache.down_voters_count--; 13 | this.setData({ item }); 14 | 15 | this.triggerEvent('after-toggle'); 16 | }, 17 | }, 18 | }); 19 | -------------------------------------------------------------------------------- /src/components/buttons/downvote-btn.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "relation-btn": "relation-btn" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/components/buttons/downvote-btn.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ item.cache.down_voters_count }} 5 | 6 | 7 | 8 | {{ item.cache.down_voters_count }} 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/components/buttons/downvote-btn.wxss: -------------------------------------------------------------------------------- 1 | .btn { 2 | display: flex; 3 | align-items: flex-end; 4 | margin: 0; 5 | } 6 | .btn image { 7 | margin: 0 !important; 8 | width: 16px; 9 | height: 16px; 10 | } 11 | .btn text { 12 | line-height: 1; 13 | } 14 | -------------------------------------------------------------------------------- /src/components/buttons/favorite-btn.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | properties: { 3 | relation: String, 4 | item: { 5 | type: Object, 6 | }, 7 | }, 8 | 9 | methods: { 10 | afterToggle (e) { 11 | const item = { ...this.data.item }; 12 | e.detail ? item.cache.favorites_count++ : item.cache.favorites_count--; 13 | this.setData({ item }); 14 | 15 | this.triggerEvent('after-toggle'); 16 | }, 17 | }, 18 | }); 19 | -------------------------------------------------------------------------------- /src/components/buttons/favorite-btn.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "relation-btn": "relation-btn" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/components/buttons/favorite-btn.wpy: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 52 | 53 | 54 | { 55 | usingComponents: { 56 | 'relation-btn': './relation-btn', 57 | }, 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/components/buttons/favorite-btn.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/components/buttons/favorite-btn.wxss: -------------------------------------------------------------------------------- 1 | .btn { 2 | display: flex; 3 | align-items: flex-end; 4 | margin: 0; 5 | } 6 | 7 | .btn image { 8 | margin: 0 !important; 9 | width: 16px; 10 | height: 16px; 11 | } 12 | 13 | .btn text { 14 | line-height: 1; 15 | } 16 | -------------------------------------------------------------------------------- /src/components/buttons/like-btn.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | properties: { 3 | relation: String, 4 | item: { 5 | type: Object, 6 | }, 7 | hideText: Boolean, 8 | }, 9 | 10 | methods: { 11 | afterToggle (e) { 12 | const item = { ...this.data.item }; 13 | e.detail ? item.cache.likes_count++ : item.cache.likes_count--; 14 | this.setData({ item }); 15 | 16 | this.triggerEvent('after-toggle'); 17 | }, 18 | }, 19 | }); 20 | -------------------------------------------------------------------------------- /src/components/buttons/like-btn.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "relation-btn": "relation-btn" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/components/buttons/like-btn.wpy: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | {{item.cache.likes_count}} 24 | 25 | 26 | 27 | {{item.cache.likes_count}} 28 | 29 | 30 | 31 | 32 | 56 | 57 | 58 | { 59 | usingComponents: { 60 | 'relation-btn': './relation-btn', 61 | }, 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/components/buttons/like-btn.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ item.cache.likes_count }} 5 | 6 | 7 | 8 | {{ item.cache.likes_count }} 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/components/buttons/like-btn.wxss: -------------------------------------------------------------------------------- 1 | .btn { 2 | display: flex; 3 | align-items: flex-end; 4 | margin: 0; 5 | } 6 | .btn image { 7 | margin: 0 !important; 8 | width: 16px; 9 | height: 16px; 10 | } 11 | .btn text { 12 | line-height: 1; 13 | } 14 | -------------------------------------------------------------------------------- /src/components/buttons/relation-btn.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | Component({ 4 | options: { 5 | multipleSlots: true, 6 | }, 7 | 8 | properties: { 9 | relation: String, 10 | action: String, 11 | item: Object, 12 | }, 13 | 14 | data: { 15 | types: { 16 | article: 'App\\Models\\Article', 17 | comment: 'App\\Models\\Comment', 18 | }, 19 | actions: { 20 | like: 'has_liked', 21 | favorite: 'has_favorited', 22 | upvote: 'has_up_voted', 23 | downvote: 'has_down_voted', 24 | }, 25 | }, 26 | 27 | methods: { 28 | async toggle () { 29 | await request(`relations/${this.data.action}`, { 30 | method: 'POST', 31 | data: { 32 | followable_type: this.data.types[this.data.relation], 33 | followable_id: this.data.item.id, 34 | }, 35 | }); 36 | 37 | const item = { ...this.data.item }; 38 | item[this.data.actions[this.data.action]] = !item[this.data.actions[this.data.action]]; 39 | 40 | this.triggerEvent('after-toggle', item[this.data.actions[this.data.action]]); 41 | 42 | this.setData({ item }); 43 | }, 44 | }, 45 | }); 46 | -------------------------------------------------------------------------------- /src/components/buttons/relation-btn.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } 5 | -------------------------------------------------------------------------------- /src/components/buttons/relation-btn.wpy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 67 | -------------------------------------------------------------------------------- /src/components/buttons/relation-btn.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/components/buttons/upvote-btn.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | properties: { 3 | relation: String, 4 | item: { 5 | type: Object, 6 | }, 7 | }, 8 | 9 | methods: { 10 | afterToggle (e) { 11 | const item = { ...this.data.item }; 12 | e.detail ? item.cache.up_voters_count++ : item.cache.up_voters_count--; 13 | this.setData({ item }); 14 | 15 | this.triggerEvent('after-toggle'); 16 | }, 17 | }, 18 | }); 19 | -------------------------------------------------------------------------------- /src/components/buttons/upvote-btn.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "relation-btn": "relation-btn" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/components/buttons/upvote-btn.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ item.cache.up_voters_count }} 5 | 6 | 7 | 8 | {{ item.cache.up_voters_count }} 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/components/buttons/upvote-btn.wxss: -------------------------------------------------------------------------------- 1 | .btn { 2 | display: flex; 3 | align-items: flex-end; 4 | margin: 0; 5 | } 6 | .btn image { 7 | margin: 0 !important; 8 | width: 16px; 9 | height: 16px; 10 | } 11 | .btn text { 12 | line-height: 1; 13 | } 14 | -------------------------------------------------------------------------------- /src/components/comment.wpy: -------------------------------------------------------------------------------- 1 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | {{comment.user.username}} 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 136 | 137 | 138 | 139 | 140 | 141 | {{ comment.created_at_timeago }} 142 | 143 | 144 | 147 | {{!comment.root_id && comment.cache.comments_count > 0 ? comment.cache.comments_count : ''}}回复 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 176 | 177 | 178 | { 179 | usingComponents: { 180 | htmltowxml: '~@/components/html2wxml/html2wxml', 181 | 'authorized-check': '~@/components/authorized-check', 182 | 'upvote-btn': '~@/components/buttons/upvote-btn', 183 | 'downvote-btn': '~@/components/buttons/downvote-btn', 184 | }, 185 | } 186 | 187 | -------------------------------------------------------------------------------- /src/components/html2wxml/highlight-styles/darcula.wxss: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Darcula color scheme from the JetBrains family of IDEs 4 | 5 | */ 6 | 7 | .hljs-style-darcula .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | background: #2b2b2b; 12 | } 13 | 14 | .hljs-style-darcula .hljs { 15 | color: #bababa; 16 | } 17 | 18 | .hljs-style-darcula .hljs-strong, 19 | .hljs-style-darcula .hljs-emphasis { 20 | color: #a8a8a2; 21 | } 22 | 23 | .hljs-style-darcula .hljs-bullet, 24 | .hljs-style-darcula .hljs-quote, 25 | .hljs-style-darcula .hljs-link, 26 | .hljs-style-darcula .hljs-number, 27 | .hljs-style-darcula .hljs-regexp, 28 | .hljs-style-darcula .hljs-literal { 29 | color: #6896ba; 30 | } 31 | 32 | .hljs-style-darcula .hljs-code 33 | .hljs-style-darcula .hljs-selector-class { 34 | color: #a6e22e; 35 | } 36 | 37 | .hljs-style-darcula .hljs-emphasis { 38 | font-style: italic; 39 | } 40 | 41 | .hljs-style-darcula .hljs-keyword, 42 | .hljs-style-darcula .hljs-selector-tag, 43 | .hljs-style-darcula .hljs-section, 44 | .hljs-style-darcula .hljs-attribute, 45 | .hljs-style-darcula .hljs-name, 46 | .hljs-style-darcula .hljs-variable { 47 | color: #cb7832; 48 | } 49 | 50 | .hljs-style-darcula .hljs-params { 51 | color: #b9b9b9; 52 | } 53 | 54 | .hljs-style-darcula .hljs-string { 55 | color: #6a8759; 56 | } 57 | 58 | .hljs-style-darcula .hljs-subst, 59 | .hljs-style-darcula .hljs-type, 60 | .hljs-style-darcula .hljs-built_in, 61 | .hljs-style-darcula .hljs-builtin-name, 62 | .hljs-style-darcula .hljs-symbol, 63 | .hljs-style-darcula .hljs-selector-id, 64 | .hljs-style-darcula .hljs-selector-attr, 65 | .hljs-style-darcula .hljs-selector-pseudo, 66 | .hljs-style-darcula .hljs-template-tag, 67 | .hljs-style-darcula .hljs-template-variable, 68 | .hljs-style-darcula .hljs-addition { 69 | color: #e0c46c; 70 | } 71 | 72 | .hljs-style-darcula .hljs-comment, 73 | .hljs-style-darcula .hljs-deletion, 74 | .hljs-style-darcula .hljs-meta { 75 | color: #7f7f7f; 76 | } 77 | -------------------------------------------------------------------------------- /src/components/html2wxml/highlight-styles/default.wxss: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original highlight.js style (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | .hljs-style-default .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | background: #fafafa; 12 | } 13 | 14 | /* Base color: saturation 0; */ 15 | 16 | .hljs-style-default .hljs, 17 | .hljs-style-default .hljs-subst { 18 | color: #444; 19 | } 20 | 21 | .hljs-style-default .hljs-comment { 22 | color: #888; 23 | } 24 | 25 | .hljs-style-default .hljs-keyword, 26 | .hljs-style-default .hljs-attribute, 27 | .hljs-style-default .hljs-selector-tag, 28 | .hljs-style-default .hljs-meta-keyword, 29 | .hljs-style-default .hljs-doctag, 30 | .hljs-style-default .hljs-name { 31 | font-weight: bold; 32 | } 33 | 34 | /* User color: hue: 0 */ 35 | 36 | .hljs-style-default .hljs-type, 37 | .hljs-style-default .hljs-string, 38 | .hljs-style-default .hljs-number, 39 | .hljs-style-default .hljs-selector-id, 40 | .hljs-style-default .hljs-selector-class, 41 | .hljs-style-default .hljs-quote, 42 | .hljs-style-default .hljs-template-tag, 43 | .hljs-style-default .hljs-deletion { 44 | color: #800; 45 | } 46 | 47 | .hljs-style-default .hljs-title, 48 | .hljs-style-default .hljs-section { 49 | color: #800; 50 | font-weight: bold; 51 | } 52 | 53 | .hljs-style-default .hljs-regexp, 54 | .hljs-style-default .hljs-symbol 55 | .hljs-style-default .hljs-variable, 56 | .hljs-style-default .hljs-template-variable 57 | .hljs-style-default .hljs-link, 58 | .hljs-style-default .hljs-selector-attr, 59 | .hljs-style-default .hljs-selector-pseudo { 60 | color: #bc6060; 61 | } 62 | 63 | /* Language color: hue: 90; */ 64 | 65 | .hljs-style-default .hljs-literal { 66 | color: #78a960; 67 | } 68 | 69 | .hljs-style-default .hljs-built_in, 70 | .hljs-style-default .hljs-bullet 71 | .hljs-style-default .hljs-code 72 | .hljs-style-default .hljs-addition { 73 | color: #397300; 74 | } 75 | 76 | /* Meta color: hue: 200 */ 77 | 78 | .hljs-style-default .hljs-meta { 79 | color: #1f7199; 80 | } 81 | 82 | .hljs-style-default .hljs-meta-string { 83 | color: #4d99bf; 84 | } 85 | 86 | /* Misc effects */ 87 | 88 | .hljs-style-default .hljs-emphasis { 89 | font-style: italic; 90 | } 91 | 92 | .hljs-style-default .hljs-strong { 93 | font-weight: bold; 94 | } 95 | -------------------------------------------------------------------------------- /src/components/html2wxml/highlight-styles/dracula.wxss: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Dracula Theme v1.2.0 4 | 5 | https://github.com/zenorocha/dracula-theme 6 | 7 | Copyright 2015, All rights reserved 8 | 9 | Code licensed under the MIT license 10 | http://zenorocha.mit-license.org 11 | 12 | @author Éverton Ribeiro 13 | @author Zeno Rocha 14 | 15 | */ 16 | 17 | .hljs-style-dracula .hljs { 18 | display: block; 19 | overflow-x: auto; 20 | padding: 0.5em; 21 | background: #282a36; 22 | } 23 | 24 | .hljs-style-dracula .hljs-keyword, 25 | .hljs-style-dracula .hljs-selector-tag, 26 | .hljs-style-dracula .hljs-literal, 27 | .hljs-style-dracula .hljs-section, 28 | .hljs-style-dracula .hljs-link { 29 | color: #8be9fd; 30 | } 31 | 32 | .hljs-style-dracula .hljs-function 33 | .hljs-style-dracula .hljs-keyword { 34 | color: #ff79c6; 35 | } 36 | 37 | .hljs-style-dracula .hljs, 38 | .hljs-style-dracula .hljs-subst { 39 | color: #f8f8f2; 40 | } 41 | 42 | .hljs-style-dracula .hljs-string, 43 | .hljs-style-dracula .hljs-title, 44 | .hljs-style-dracula .hljs-name, 45 | .hljs-style-dracula .hljs-type, 46 | .hljs-style-dracula .hljs-attribute, 47 | .hljs-style-dracula .hljs-symbol, 48 | .hljs-style-dracula .hljs-bullet, 49 | .hljs-style-dracula .hljs-addition, 50 | .hljs-style-dracula .hljs-variable, 51 | .hljs-style-dracula .hljs-template-tag, 52 | .hljs-style-dracula .hljs-template-variable { 53 | color: #f1fa8c; 54 | } 55 | 56 | .hljs-style-dracula .hljs-comment, 57 | .hljs-style-dracula .hljs-quote, 58 | .hljs-style-dracula .hljs-deletion, 59 | .hljs-style-dracula .hljs-meta { 60 | color: #6272a4; 61 | } 62 | 63 | .hljs-style-dracula .hljs-keyword, 64 | .hljs-style-dracula .hljs-selector-tag, 65 | .hljs-style-dracula .hljs-literal, 66 | .hljs-style-dracula .hljs-title, 67 | .hljs-style-dracula .hljs-section, 68 | .hljs-style-dracula .hljs-doctag, 69 | .hljs-style-dracula .hljs-type, 70 | .hljs-style-dracula .hljs-name, 71 | .hljs-style-dracula .hljs-strong { 72 | font-weight: bold; 73 | } 74 | 75 | .hljs-style-dracula .hljs-emphasis { 76 | font-style: italic; 77 | } 78 | -------------------------------------------------------------------------------- /src/components/html2wxml/highlight-styles/tomorrow.wxss: -------------------------------------------------------------------------------- 1 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 2 | 3 | /* Tomorrow Comment */ 4 | 5 | .hljs-style-tomorrow .hljs-comment, 6 | .hljs-style-tomorrow .hljs-quote { 7 | color: #8e908c; 8 | } 9 | 10 | /* Tomorrow Red */ 11 | 12 | .hljs-style-tomorrow .hljs-variable, 13 | .hljs-style-tomorrow .hljs-template-variable, 14 | .hljs-style-tomorrow .hljs-tag, 15 | .hljs-style-tomorrow .hljs-name, 16 | .hljs-style-tomorrow .hljs-selector-id, 17 | .hljs-style-tomorrow .hljs-selector-class, 18 | .hljs-style-tomorrow .hljs-regexp, 19 | .hljs-style-tomorrow .hljs-deletion { 20 | color: #c82829; 21 | } 22 | 23 | /* Tomorrow Orange */ 24 | 25 | .hljs-style-tomorrow .hljs-number, 26 | .hljs-style-tomorrow .hljs-built_in, 27 | .hljs-style-tomorrow .hljs-builtin-name, 28 | .hljs-style-tomorrow .hljs-literal, 29 | .hljs-style-tomorrow .hljs-type, 30 | .hljs-style-tomorrow .hljs-params, 31 | .hljs-style-tomorrow .hljs-meta, 32 | .hljs-style-tomorrow .hljs-link { 33 | color: #f5871f; 34 | } 35 | 36 | /* Tomorrow Yellow */ 37 | 38 | .hljs-style-tomorrow .hljs-attribute { 39 | color: #eab700; 40 | } 41 | 42 | /* Tomorrow Green */ 43 | 44 | .hljs-style-tomorrow .hljs-string, 45 | .hljs-style-tomorrow .hljs-symbol, 46 | .hljs-style-tomorrow .hljs-bullet, 47 | .hljs-style-tomorrow .hljs-addition { 48 | color: #718c00; 49 | } 50 | 51 | /* Tomorrow Blue */ 52 | 53 | .hljs-style-tomorrow .hljs-title, 54 | .hljs-style-tomorrow .hljs-section { 55 | color: #4271ae; 56 | } 57 | 58 | /* Tomorrow Purple */ 59 | 60 | .hljs-style-tomorrow .hljs-keyword, 61 | .hljs-style-tomorrow .hljs-selector-tag { 62 | color: #8959a8; 63 | } 64 | 65 | .hljs-style-tomorrow .hljs { 66 | display: block; 67 | overflow-x: auto; 68 | background: white; 69 | color: #4d4d4c; 70 | padding: 0.5em; 71 | } 72 | 73 | .hljs-style-tomorrow .hljs-emphasis { 74 | font-style: italic; 75 | } 76 | 77 | .hljs-style-tomorrow .hljs-strong { 78 | font-weight: bold; 79 | } 80 | -------------------------------------------------------------------------------- /src/components/html2wxml/html2wxml-main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Project: html2wxml 3 | * Description: 将HTML、Markdown转为微信小程序WXML 4 | * Author: 幻想小籽 5 | * Organization: QwqOffice (https://www.qwqoffice.com) 6 | */ 7 | 8 | /** 9 | * 配置及公有属性 10 | **/ 11 | var realWindowWidth = 0; 12 | var realWindowHeight = 0; 13 | wx.getSystemInfo({ 14 | success: function (res) { 15 | realWindowWidth = res.windowWidth 16 | realWindowHeight = res.windowHeight 17 | } 18 | }) 19 | /** 20 | * 主函数入口区 21 | **/ 22 | function html2wxml(data, target, imagePadding) { 23 | var that = target, 24 | images = []; 25 | 26 | if (that.data.images != undefined) { 27 | images = that.data.images; 28 | } 29 | 30 | data = { nodes: data, images: images }; 31 | data.view = {}; 32 | data.view.imagePadding = 0; 33 | if (typeof (imagePadding) != 'undefined') { 34 | data.view.imagePadding = imagePadding 35 | } 36 | 37 | that.setData(data); 38 | that.wxmlImgLoad = wxmlImgLoad; 39 | that.wxmlImgTap = wxmlImgTap; 40 | } 41 | // 图片点击事件 42 | function wxmlImgTap(e) { 43 | var that = this; 44 | var nowImgUrl = e.target.dataset.src; 45 | 46 | var imageUrls = that.data.imageUrls, 47 | newImageUrls = []; 48 | for (var i in imageUrls) { 49 | if (imageUrls[i] !== undefined) { 50 | newImageUrls.push(imageUrls[i]); 51 | } 52 | } 53 | if (newImageUrls.length > 0) { 54 | wx.previewImage({ 55 | current: nowImgUrl, 56 | urls: newImageUrls 57 | }) 58 | } 59 | } 60 | 61 | /** 62 | * 图片视觉宽高计算函数区 63 | **/ 64 | function wxmlImgLoad(e) { 65 | var that = this, 66 | idx = e.target.dataset.idx; 67 | 68 | calMoreImageInfo(e, idx, that); 69 | } 70 | // 假循环获取计算图片视觉最佳宽高 71 | function calMoreImageInfo(e, idx, that) { 72 | 73 | //因为无法获取view宽度 需要自定义padding进行计算 74 | var recal = wxAutoImageCal(e.detail.width, e.detail.height, that); 75 | that.setData({ 76 | ['images[' + idx + ']']: { width: recal.imageWidth, height: recal.imageHeight }, 77 | ['imageUrls[' + idx + ']']: e.currentTarget.dataset.src 78 | }) 79 | } 80 | 81 | // 计算视觉优先的图片宽高 82 | function wxAutoImageCal(originalWidth, originalHeight, that) { 83 | 84 | // 获取图片的原始长宽 85 | var windowWidth = 0, windowHeight = 0; 86 | var autoWidth = 0, autoHeight = 0; 87 | var results = {}; 88 | var padding = that.data.view.imagePadding; 89 | windowWidth = realWindowWidth - 2 * padding; 90 | windowHeight = realWindowHeight; 91 | 92 | // 判断按照那种方式进行缩放 93 | // 在图片width大于手机屏幕width时候 94 | if (originalWidth > windowWidth) { 95 | autoWidth = windowWidth; 96 | autoHeight = (autoWidth * originalHeight) / originalWidth; 97 | results.imageWidth = autoWidth; 98 | results.imageHeight = autoHeight; 99 | } 100 | // 否则展示原来的数据 101 | else { 102 | results.imageWidth = originalWidth; 103 | results.imageHeight = originalHeight; 104 | } 105 | return results; 106 | } 107 | 108 | module.exports = { 109 | html2wxml: html2wxml 110 | } -------------------------------------------------------------------------------- /src/components/html2wxml/html2wxml.js: -------------------------------------------------------------------------------- 1 | var html2wxml = require('./html2wxml-main.js'); 2 | 3 | Component({ 4 | data: {}, 5 | properties: { 6 | text: { 7 | type: String, 8 | value: null, 9 | observer: function(newVal, oldVal) { 10 | if (newVal == '') return; 11 | 12 | if (this.data.type == 'html' || this.data.type == 'markdown' || this.data.type == 'md') { 13 | var data = { 14 | text: this.data.text, 15 | type: this.data.type, 16 | highlight: this.data.highlight, 17 | linenums: this.data.linenums 18 | }; 19 | 20 | if (this.data.imghost != null) { 21 | data.imghost = this.data.imghost; 22 | } 23 | 24 | wx.request({ 25 | url: 'https://www.qwqoffice.com/html2wxml/', 26 | data: data, 27 | method: 'POST', 28 | header: { 29 | 'content-type': 'application/x-www-form-urlencoded' 30 | }, 31 | success: res => { 32 | html2wxml.html2wxml(res.data, this, this.data.padding); 33 | } 34 | }) 35 | } 36 | } 37 | }, 38 | json: { 39 | type: Object, 40 | value: {}, 41 | observer: function(newVal, oldVal) { 42 | html2wxml.html2wxml(this.data.json, this, this.data.padding); 43 | } 44 | }, 45 | type: { 46 | type: String, 47 | value: 'html' 48 | }, 49 | highlight: { 50 | type: Boolean, 51 | value: true, 52 | }, 53 | highlightStyle: { 54 | type: String, 55 | value: 'darcula' 56 | }, 57 | linenums: { 58 | type: Boolean, 59 | value: true, 60 | }, 61 | padding: { 62 | type: Number, 63 | value: 5 64 | }, 65 | imghost: { 66 | type: String, 67 | value: null 68 | }, 69 | showLoading: { 70 | type: Boolean, 71 | value: true 72 | } 73 | }, 74 | methods: { 75 | wxmlTagATap: function(e) { 76 | this.triggerEvent('WxmlTagATap', { 77 | src: e.currentTarget.dataset.src 78 | }); 79 | } 80 | }, 81 | attached: function() {} 82 | }) 83 | -------------------------------------------------------------------------------- /src/components/html2wxml/html2wxml.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } -------------------------------------------------------------------------------- /src/components/html2wxml/images/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/components/html2wxml/images/loading.png -------------------------------------------------------------------------------- /src/components/weui/badge/badge.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 10); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 10: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true 99 | }, 100 | properties: { 101 | extClass: { 102 | type: String, 103 | value: '' 104 | }, 105 | content: { 106 | type: String, 107 | value: '' 108 | } 109 | } 110 | }); 111 | 112 | /***/ }) 113 | 114 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/badge/badge.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /src/components/weui/badge/badge.wxml: -------------------------------------------------------------------------------- 1 | {{content}} -------------------------------------------------------------------------------- /src/components/weui/badge/badge.wxss: -------------------------------------------------------------------------------- 1 | .weui-badge{display:inline-block;padding:.15em .4em;min-width:8px;border-radius:18px;background-color:#FA5151;color:#FFFFFF;line-height:1.2;text-align:center;font-size:12px;vertical-align:middle}.weui-badge_dot{padding:.4em;min-width:0} -------------------------------------------------------------------------------- /src/components/weui/cell/cell.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 7); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 7: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true, 99 | multipleSlots: true 100 | }, 101 | properties: { 102 | hover: { 103 | type: Boolean, 104 | value: false 105 | }, 106 | link: { 107 | type: Boolean, 108 | value: false 109 | }, 110 | extClass: { 111 | type: String, 112 | value: '' 113 | }, 114 | iconClass: { 115 | type: String, 116 | value: '' 117 | }, 118 | icon: { 119 | type: String, 120 | value: '' 121 | }, 122 | title: { 123 | type: String, 124 | value: '' 125 | }, 126 | value: { 127 | type: String, 128 | value: '' 129 | }, 130 | showError: { 131 | type: Boolean, 132 | value: false 133 | }, 134 | prop: { 135 | type: String, 136 | value: '' 137 | }, 138 | url: { 139 | type: String, 140 | value: '' 141 | }, 142 | footerClass: { 143 | type: String, 144 | value: '' 145 | }, 146 | footer: { 147 | type: String, 148 | value: '' 149 | }, 150 | inline: { 151 | type: Boolean, 152 | value: true 153 | } 154 | }, 155 | relations: { 156 | '../form/form': { 157 | type: 'ancestor' 158 | }, 159 | '../cells/cells': { 160 | type: 'ancestor' 161 | } 162 | }, 163 | data: { 164 | inForm: false 165 | }, 166 | methods: { 167 | setError: function setError(error) { 168 | this.setData({ 169 | error: error || false 170 | }); 171 | }, 172 | setInForm: function setInForm() { 173 | this.setData({ 174 | inForm: true 175 | }); 176 | }, 177 | setOuterClass: function setOuterClass(className) { 178 | this.setData({ 179 | outerClass: className 180 | }); 181 | }, 182 | navigateTo: function navigateTo() { 183 | var _this = this; 184 | 185 | var data = this.data; 186 | if (data.url && data.link) { 187 | wx.navigateTo({ 188 | url: data.url, 189 | success: function success(res) { 190 | _this.triggerEvent('navigatesuccess', res, {}); 191 | }, 192 | fail: function fail(_fail) { 193 | _this.triggerEvent('navigateerror', _fail, {}); 194 | } 195 | }); 196 | } 197 | } 198 | } 199 | }); 200 | 201 | /***/ }) 202 | 203 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/cell/cell.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "mp-cells": "../cells/cells" 5 | } 6 | } -------------------------------------------------------------------------------- /src/components/weui/cell/cell.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{title}} 12 | 13 | 14 | 15 | 16 | 17 | {{title}} 18 | 19 | 20 | 21 | 22 | 23 | 24 | {{value}} 25 | 26 | 27 | 28 | 29 | 30 | {{footer}} 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {{title}} 48 | 49 | 50 | 51 | 52 | 53 | {{title}} 54 | 55 | 56 | 57 | 58 | 59 | 60 | {{value}} 61 | 62 | 63 | 64 | 65 | 66 | {{footer}} 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/components/weui/cell/cell.wxss: -------------------------------------------------------------------------------- 1 | .weui-cells{position:relative;margin-top:8px;background-color:#FFFFFF;line-height:1.41176471;font-size:17px}.weui-cells:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-cells:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-cells__title{margin-top:16px;margin-bottom:3px;padding-left:16px;padding-right:16px;color:rgba(0,0,0,0.5);font-size:14px}.weui-cells_after-title{margin-top:0}.weui-cells__tips{margin-top:3px;color:rgba(0,0,0,0.5);padding-left:16px;padding-right:16px;font-size:14px}.weui-cell{padding:16px;position:relative;display:flex;align-items:center}.weui-cell:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1);left:16px}.weui-cell:first-child:before{display:none}.weui-cell_active{background-color:#ECECEC}.weui-cell_primary{align-items:flex-start}.weui-cell__bd{flex:1}.weui-cell__ft{text-align:right;color:rgba(0,0,0,0.5)}.weui-cell_wxss.weui-cell_wxss:before{display:block}.weui-cell_label-block{display:block}.weui-cell_label-block .weui-label{width:auto;word-break:initial;-webkit-hyphens:auto;hyphens:auto}.weui-cell_vcode{padding-top:0;padding-right:0;padding-bottom:0}.weui-vcode-img{margin-left:5px;height:3.29411765em;vertical-align:middle}.weui-vcode-btn{display:inline-block;height:3.29411765em;margin-left:5px;padding:0 .6em 0 .7em;border-left:1rpx solid rgba(0,0,0,0.1);line-height:3.29411765em;vertical-align:middle;font-size:17px;color:#576B95;white-space:nowrap}.weui-vcode-btn:active{color:#767676} -------------------------------------------------------------------------------- /src/components/weui/cells/cells.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 6); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 6: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true, 99 | multipleSlots: true 100 | }, 101 | properties: { 102 | title: { 103 | type: String, 104 | value: '' 105 | }, 106 | extClass: { 107 | type: String, 108 | value: '' 109 | }, 110 | footer: { 111 | type: String, 112 | value: '' 113 | } 114 | }, 115 | data: { 116 | firstItem: null, 117 | checkboxCount: 0, 118 | checkboxIsMulti: false 119 | }, 120 | relations: { 121 | '../cell/cell': { 122 | type: 'descendant', 123 | linked: function linked(target) { 124 | if (!this.data.firstItem) { 125 | this.data.firstItem = target; 126 | } 127 | if (target !== this.data.firstItem) { 128 | target.setOuterClass('weui-cell_wxss'); 129 | } 130 | } 131 | }, 132 | '../checkbox-group/checkbox-group': { 133 | type: 'descendant', 134 | linked: function linked(target) { 135 | this.setData({ 136 | checkboxCount: this.data.checkboxCount + 1, 137 | checkboxIsMulti: target.data.multi 138 | }); 139 | }, 140 | unlinked: function unlinked(target) { 141 | this.setData({ 142 | checkboxCount: this.data.checkboxCount - 1, 143 | checkboxIsMulti: target.data.multi 144 | }); 145 | } 146 | } 147 | }, 148 | methods: { 149 | setCellMulti: function setCellMulti(multi) { 150 | this.setData({ 151 | checkboxIsMulti: multi 152 | }); 153 | } 154 | } 155 | }); 156 | 157 | /***/ }) 158 | 159 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/cells/cells.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/cells/cells.wxml: -------------------------------------------------------------------------------- 1 | 2 | {{title}} 3 | 4 | 5 | 6 | {{footer}} 7 | 8 | -------------------------------------------------------------------------------- /src/components/weui/checkbox-group/checkbox-group.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "mp-cells": "../cells/cells" 5 | } 6 | } -------------------------------------------------------------------------------- /src/components/weui/checkbox-group/checkbox-group.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/components/weui/checkbox-group/checkbox-group.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/components/weui/checkbox-group/checkbox-group.wxss -------------------------------------------------------------------------------- /src/components/weui/checkbox/checkbox.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 18); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 18: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true, 99 | multipleSlots: true 100 | }, 101 | properties: { 102 | multi: { 103 | type: Boolean, 104 | value: true 105 | }, 106 | checked: { 107 | type: Boolean, 108 | value: false 109 | }, 110 | value: { 111 | type: String, 112 | value: '' 113 | }, 114 | label: { 115 | type: String, 116 | value: 'label' 117 | }, 118 | extClass: { 119 | type: String, 120 | value: '' 121 | } 122 | }, 123 | data: {}, 124 | relations: { 125 | '../checkbox-group/checkbox-group': { 126 | type: 'ancestor', 127 | linked: function linked(target) { 128 | this.data.group = target; 129 | }, 130 | unlinked: function unlinked() { 131 | this.data.group = null; 132 | } 133 | } 134 | }, 135 | methods: { 136 | setMulti: function setMulti(multi) { 137 | this.setData({ 138 | multi: multi 139 | }); 140 | }, 141 | setOuterClass: function setOuterClass(className) { 142 | this.setData({ 143 | outerClass: className 144 | }); 145 | }, 146 | checkedChange: function checkedChange(e) { 147 | if (this.data.multi) { 148 | var checked = !this.data.checked; 149 | this.setData({ 150 | checked: checked 151 | }); 152 | if (this.data.group) { 153 | this.data.group.checkedChange(checked, this); 154 | } 155 | } else { 156 | var _checked = this.data.checked; 157 | if (_checked) return; 158 | this.setData({ 159 | checked: true 160 | }); 161 | if (this.data.group) { 162 | this.data.group.checkedChange(_checked, this); 163 | } 164 | } 165 | this.triggerEvent('change', { value: this.data.value, checked: this.data.checked }); 166 | } 167 | } 168 | }); 169 | 170 | /***/ }) 171 | 172 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/checkbox/checkbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "mp-cell": "../cell/cell", 5 | "mp-checkbox-group": "../checkbox-group/checkbox-group" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/components/weui/checkbox/checkbox.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{label}} 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/components/weui/checkbox/checkbox.wxss: -------------------------------------------------------------------------------- 1 | .weui-cells_checkbox .weui-check__label:before{left:55px}.weui-check__label:active{background-color:#ECECEC}.weui-check{position:absolute;left:-9999px}.weui-check__hd_in-checkbox{padding-right:16px}.weui-cell__ft_in-radio{padding-left:16px} -------------------------------------------------------------------------------- /src/components/weui/dialog/dialog.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 14); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 14: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | multipleSlots: true, 99 | addGlobalClass: true 100 | }, 101 | properties: { 102 | title: { 103 | type: String, 104 | value: '' 105 | }, 106 | extClass: { 107 | type: String, 108 | value: '' 109 | }, 110 | maskClosable: { 111 | type: Boolean, 112 | value: true 113 | }, 114 | mask: { 115 | type: Boolean, 116 | value: true 117 | }, 118 | show: { 119 | type: Boolean, 120 | value: false, 121 | observer: '_showChange' 122 | }, 123 | buttons: { 124 | type: Array, 125 | value: [] 126 | } 127 | }, 128 | data: { 129 | innerShow: false 130 | }, 131 | ready: function ready() { 132 | var buttons = this.data.buttons; 133 | var len = buttons.length; 134 | buttons.forEach(function (btn, index) { 135 | if (len === 1) { 136 | btn.className = 'weui-dialog__btn_primary'; 137 | } else if (index === 0) { 138 | btn.className = 'weui-dialog__btn_default'; 139 | } else { 140 | btn.className = 'weui-dialog__btn_primary'; 141 | } 142 | }); 143 | this.setData({ 144 | buttons: buttons 145 | }); 146 | }, 147 | 148 | methods: { 149 | buttonTap: function buttonTap(e) { 150 | var index = e.currentTarget.dataset.index; 151 | 152 | this.triggerEvent('buttontap', { index: index, item: this.data.buttons[index] }, {}); 153 | }, 154 | close: function close() { 155 | var data = this.data; 156 | if (!data.maskClosable) return; 157 | this.setData({ 158 | show: false 159 | }); 160 | this.triggerEvent('close', {}, {}); 161 | }, 162 | stopEvent: function stopEvent() {} 163 | } 164 | }); 165 | 166 | /***/ }) 167 | 168 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/dialog/dialog.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/dialog/dialog.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{title}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {{item.text}} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/components/weui/dialog/dialog.wxss: -------------------------------------------------------------------------------- 1 | .weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,0.6)}.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}.weui-dialog__wrp{position:fixed;z-index:5000;top:16px;bottom:16px;left:16px;right:16px;text-align:center;font-size:0;display:-webkit-box;display:-webkit-flex;display:flex;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.weui-dialog__wrp .weui-dialog{max-height:100%}.weui-dialog{background-color:#FFFFFF;text-align:center;border-radius:12px;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;max-height:90%}.weui-dialog__hd{padding:32px 24px 16px}.weui-dialog__title{font-weight:700;font-size:17px;line-height:1.4}.weui-dialog__bd{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:0 24px;margin-bottom:32px;min-height:40px;font-size:17px;line-height:1.4;overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;color:rgba(0,0,0,0.5)}.weui-dialog__bd:first-child{padding:32px 24px 0;font-weight:700;color:rgba(0,0,0,0.9);display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.weui-dialog__ft{position:relative;line-height:64px;min-height:64px;font-size:17px;display:flex}.weui-dialog__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-dialog__btn{display:block;flex:1;color:#576B95;font-weight:700;text-decoration:none;-webkit-tap-highlight-color:rgba(0,0,0,0);position:relative}.weui-dialog__btn:active{background-color:#ECECEC}.weui-dialog__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-dialog__btn:first-child:after{display:none}.weui-dialog__btn_default{color:rgba(0,0,0,0.9)}@media screen and (min-width:352px){.weui-dialog{width:320px;margin:0 auto}}.weui-dialog.weui-dialog_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-dialog{opacity:1;-webkit-transform:scale3d(1, 1, 1);transform:scale3d(1, 1, 1);transition:all .3s ease-in}.weui-mask.weui-mask_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-mask{opacity:1;transform:scale3d(1, 1, 1);transition:all .3s ease-in} -------------------------------------------------------------------------------- /src/components/weui/form/form.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/form/form.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/components/weui/gallery/gallery.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 15); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 15: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true 99 | }, 100 | properties: { 101 | imgUrls: { 102 | type: Array, 103 | value: [], 104 | observer: function observer(newVal, oldVal, changedPath) { 105 | this.setData({ currentImgs: newVal }); 106 | } 107 | }, 108 | delete: { 109 | type: Boolean, 110 | value: true 111 | }, 112 | show: { 113 | type: Boolean, 114 | value: true 115 | }, 116 | current: { 117 | type: Number, 118 | value: 0 119 | }, 120 | hideOnClick: { 121 | type: Boolean, 122 | value: true 123 | }, 124 | extClass: { 125 | type: Boolean, 126 | value: '' 127 | } 128 | }, 129 | data: { 130 | currentImgs: [] 131 | }, 132 | ready: function ready() { 133 | var data = this.data; 134 | this.setData({ currentImgs: data.imgUrls }); 135 | }, 136 | 137 | methods: { 138 | change: function change(e) { 139 | this.setData({ 140 | current: e.detail.current 141 | }); 142 | this.triggerEvent('change', { current: e.detail.current }, {}); 143 | }, 144 | deleteImg: function deleteImg() { 145 | var data = this.data; 146 | var imgs = data.currentImgs; 147 | var url = imgs.splice(data.current, 1); 148 | this.triggerEvent('delete', { url: url[0], index: data.current }, {}); 149 | if (imgs.length === 0) { 150 | this.hideGallery(); 151 | return; 152 | } 153 | this.setData({ 154 | current: 0, 155 | currentImgs: imgs 156 | }); 157 | }, 158 | hideGallery: function hideGallery() { 159 | var data = this.data; 160 | if (data.hideOnClick) { 161 | this.setData({ 162 | show: false 163 | }); 164 | this.triggerEvent('hide', {}, {}); 165 | } 166 | } 167 | } 168 | }); 169 | 170 | /***/ }) 171 | 172 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/gallery/gallery.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/gallery/gallery.wxml: -------------------------------------------------------------------------------- 1 | 2 | {{current+1}}/{{currentImgs.length}} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 删除 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/components/weui/gallery/gallery.wxss: -------------------------------------------------------------------------------- 1 | .weui-gallery{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000000;z-index:1000;-webkit-flex-direction:column;flex-direction:column;-webkit-flex-wrap:nowrap;flex-wrap:nowrap;opacity:0;visibility:hidden;transition:opacity .3s}.weui-gallery_show{display:-webkit-box;display:-webkit-flex;display:flex;visibility:visible;opacity:1}.weui-gallery__img__wrp{-webkit-box-flex:1;-webkit-flex:1;flex:1;position:relative;font-size:0}.weui-gallery__img{background:center center no-repeat;background-size:contain;position:absoulte;width:100%;height:100%}.weui-gallery__opr{background-color:#0D0D0D;color:#FFFFFF;line-height:60px;min-height:60px;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom);text-align:center}.weui-gallery__opr navigator{color:#FFFFFF}.weui-gallery__del{display:block}.weui-gallery__info{color:#FFFFFF;font-size:17px;line-height:60px;min-height:60px;text-align:center} -------------------------------------------------------------------------------- /src/components/weui/loading/loading.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 9); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 9: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true 99 | }, 100 | properties: { 101 | extClass: { 102 | type: String, 103 | value: '' 104 | }, 105 | show: { 106 | type: Boolean, 107 | value: true, 108 | observer: function observer(newValue) { 109 | this._computedStyle(newValue, this.data.animated); 110 | } 111 | }, 112 | animated: { 113 | type: Boolean, 114 | value: false, 115 | observer: function observer(newValue) { 116 | this._computedStyle(this.data.show, newValue); 117 | } 118 | }, 119 | duration: { 120 | type: Number, 121 | value: 350 122 | }, 123 | type: { 124 | type: String, 125 | value: 'dot-gray' 126 | }, 127 | tips: { 128 | type: String, 129 | value: '加载中' 130 | } 131 | }, 132 | data: { 133 | animationData: {}, 134 | animationInstance: {}, 135 | displayStyle: 'none' 136 | }, 137 | methods: { 138 | _computedStyle: function _computedStyle(show, animated) { 139 | if (!show) { 140 | if (!animated) { 141 | this.setData({ 142 | displayStyle: 'none' 143 | }); 144 | } else { 145 | this._startAnimation(); 146 | } 147 | } else { 148 | this.setData({ 149 | displayStyle: '' 150 | }); 151 | } 152 | }, 153 | _startAnimation: function _startAnimation() { 154 | var _this = this; 155 | 156 | setTimeout(function () { 157 | var data = _this.data; 158 | var animation = data.animationInstance; 159 | animation.height(0).step(); 160 | _this.setData({ 161 | animationData: animation.export() 162 | }); 163 | }, 0); 164 | } 165 | }, 166 | lifetimes: { 167 | attached: function attached() { 168 | var data = this.data; 169 | var animationInstance = wx.createAnimation({ 170 | duration: data.duration, 171 | timingFunction: 'ease' 172 | }); 173 | this.setData({ animationInstance: animationInstance }); 174 | this._computedStyle(this.data.show, this.data.animated); 175 | } 176 | } 177 | }); 178 | 179 | /***/ }) 180 | 181 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/loading/loading.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/loading/loading.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{tips}} 8 | 9 | -------------------------------------------------------------------------------- /src/components/weui/loading/loading.wxss: -------------------------------------------------------------------------------- 1 | .weui-loading{margin:0 5px;width:20px;height:20px;display:inline-block;vertical-align:middle;animation:weuiLoading 1s steps(12, end) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;background-size:100%}.weui-loading.weui-loading_transparent{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E")}@keyframes weuiLoading{0%{transform:rotate3d(0, 0, 1, 0deg)}100%{transform:rotate3d(0, 0, 1, 360deg)}}.weui-loadmore{width:65%;margin:1.5em auto;line-height:1.6em;font-size:14px;text-align:center}.weui-loadmore__tips{display:inline-block;vertical-align:middle}.weui-loadmore_line{border-top:1px solid rgba(0,0,0,0.1);margin-top:2.4em}.weui-loadmore__tips_in-line{position:relative;top:-0.9em;padding:0 .55em;background-color:#FFFFFF;color:rgba(0,0,0,0.5)}.weui-loadmore__tips_in-dot{position:relative;padding:0 .16em;width:4px;height:1.6em}.weui-loadmore__tips_in-dot:before{content:" ";position:absolute;top:50%;left:50%;margin-top:-1px;margin-left:-2px;width:4px;height:4px;border-radius:50%;background-color:rgba(0,0,0,0.1)}.wx_dot_loading,.wx_dot_loading:before,.wx_dot_loading:after{display:inline-block;vertical-align:middle;width:6px;height:6px;-webkit-border-radius:50%;border-radius:50%;background-color:rgba(0,0,0,0.3);font-size:0;animation:dot2 1.6s step-start infinite}.wx_dot_loading{position:relative}.wx_dot_loading:before{content:"";position:absolute;left:-12px;background-color:rgba(0,0,0,0.1);animation:dot1 1.6s step-start infinite}.wx_dot_loading:after{content:"";position:absolute;right:-12px;background-color:rgba(0,0,0,0.5);animation:dot3 1.6s step-start infinite}@keyframes dot1{0%,100%{background-color:rgba(0,0,0,0.1)}30%{background-color:rgba(0,0,0,0.5)}60%{background-color:rgba(0,0,0,0.3)}}@keyframes dot2{0%,100%{background-color:rgba(0,0,0,0.3)}30%{background-color:rgba(0,0,0,0.1)}60%{background-color:rgba(0,0,0,0.5)}}@keyframes dot3{0%,100%{background-color:rgba(0,0,0,0.5)}30%{background-color:rgba(0,0,0,0.3)}60%{background-color:rgba(0,0,0,0.1)}}.wx_dot_loading_white{background-color:rgba(255,255,255,0.3);animation:dotw2 1.6s step-start infinite}.wx_dot_loading_white:before{background-color:rgba(255,255,255,0.5);animation:dotw1 1.6s step-start infinite}.wx_dot_loading_white:after{background-color:rgba(255,255,255,0.1);animation:dotw3 1.6s step-start infinite}@keyframes dotw1{0%,100%{background-color:rgba(255,255,255,0.5)}30%{background-color:rgba(255,255,255,0.1)}60%{background-color:rgba(255,255,255,0.3)}}@keyframes dotw2{0%,100%{background-color:rgba(255,255,255,0.3)}30%{background-color:rgba(255,255,255,0.5)}60%{background-color:rgba(255,255,255,0.1)}}@keyframes dotw3{0%,100%{background-color:rgba(255,255,255,0.1)}30%{background-color:rgba(255,255,255,0.3)}60%{background-color:rgba(255,255,255,0.5)}}.wx_loading_view{display:flex;justify-content:center;align-items:center;overflow:hidden}.loading{color:rgba(255,255,255,0.9);font-size:17px;text-align:center}.loading_view_translation{transition:height .2s .3s ease} -------------------------------------------------------------------------------- /src/components/weui/msg/msg.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 13); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 13: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true, 99 | multipleSlots: true 100 | }, 101 | properties: { 102 | title: { 103 | type: String, 104 | value: '' 105 | }, 106 | type: { 107 | type: String, 108 | value: '' 109 | }, 110 | icon: { 111 | type: String, 112 | value: '' 113 | }, 114 | desc: { 115 | type: String, 116 | value: '' 117 | }, 118 | extClass: { 119 | type: String, 120 | value: '' 121 | }, 122 | size: { 123 | type: Number, 124 | value: 64 125 | } 126 | }, 127 | data: {} 128 | }); 129 | 130 | /***/ }) 131 | 132 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/msg/msg.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/msg/msg.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{title}} 8 | 9 | {{desc}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/components/weui/msg/msg.wxss: -------------------------------------------------------------------------------- 1 | .weui-msg{padding-top:36px;padding:calc(36px + constant(safe-area-inset-top)) constant(safe-area-inset-right) constant(safe-area-inset-bottom) constant(safe-area-inset-left);padding:calc(36px + env(safe-area-inset-top)) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);text-align:center;line-height:1.4;min-height:100%;box-sizing:border-box;display:flex;flex-direction:column;background-color:#FFFFFF}.weui-msg__link{color:#576B95;display:inline-block;vertical-align:baseline}.weui-msg__icon-area{margin-bottom:32px}.weui-msg__text-area{margin-bottom:32px;padding:0 32px;flex:1;line-height:1.6}.weui-msg__text-area:first-child{padding-top:96px}.weui-msg__title{margin-bottom:5px;font-weight:700;font-size:22px;word-wrap:break-word;word-break:break-all}.weui-msg__desc{font-size:17px;color:rgba(0,0,0,0.9);word-wrap:break-word;word-break:break-all;margin-bottom:16px}.weui-msg__desc-primary{font-size:14px;color:rgba(0,0,0,0.5);word-wrap:break-word;word-break:break-all;margin-bottom:16px}.weui-msg__opr-area{margin-bottom:16px}.weui-msg__opr-area .weui-btn-area{margin:0 16px}.weui-msg__opr-area .weui-btn+.weui-btn{margin-bottom:16px}.weui-msg__opr-area:last-child{margin-bottom:96px}.weui-msg__opr-area+.weui-msg__extra-area{margin-top:48px}.weui-msg__tips-area{margin-bottom:16px;padding:0 40px}.weui-msg__opr-area+.weui-msg__tips-area{margin-bottom:48px}.weui-msg__tips-area:last-child{margin-bottom:64px}.weui-msg__tips{font-size:12px;color:rgba(0,0,0,0.5)}.weui-msg__extra-area{position:static;margin-bottom:24px;font-size:12px;color:rgba(0,0,0,0.5)}.weui-msg__icon-area image{width:190rpx;height:190rpx} -------------------------------------------------------------------------------- /src/components/weui/navigation-bar/navigation-bar.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/navigation-bar/navigation-bar.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {{title}} 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/components/weui/navigation-bar/navigation-bar.wxss: -------------------------------------------------------------------------------- 1 | page{--height:44px;--right:190rpx}.weui-navigation-bar{overflow:hidden}.weui-navigation-bar .android{--height:48px;--right:222rpx}.weui-navigation-bar__inner{position:fixed;top:0;left:0;z-index:5001;height:var(--height);display:flex;align-items:center;padding-right:var(--right);width:calc(100% - var(--right))}.weui-navigation-bar__inner .weui-navigation-bar__left{position:relative;width:var(--right);padding-left:16px;display:-webkit-box;display:-webkit-flex;display:flex;align-items:center;-webkit-box-pack:center}.weui-navigation-bar__inner .weui-navigation-bar__left .weui-navigation-bar__btn{display:inline-block;vertical-align:middle;background-repeat:no-repeat}.weui-navigation-bar__inner .weui-navigation-bar__left .weui-navigation-bar__btn_goback{font-size:12px;width:1em;height:2em;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E");background-position:50% 50%;background-size:cover}.weui-navigation-bar__inner .weui-navigation-bar__left .weui-navigation-bar__btn_goback:active{opacity:.5}.weui-navigation-bar__inner .weui-navigation-bar__center{font-size:17px;text-align:center;position:relative;flex:1;display:-webkit-box;display:-webkit-flex;display:flex;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.weui-navigation-bar__inner .weui-navigation-bar__loading{font-size:0}.weui-navigation-bar__inner .weui-navigation-bar__loading .weui-loading{margin-left:0}.weui-navigation-bar__inner .weui-navigation-bar__right{margin-right:16px}.weui-navigation-bar__placeholder{height:var(--height);background:#F8F8F8;position:relative;z-index:50} -------------------------------------------------------------------------------- /src/components/weui/searchbar/searchbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "mp-cells": "../cells/cells", 5 | "mp-cell": "../cell/cell" 6 | } 7 | } -------------------------------------------------------------------------------- /src/components/weui/searchbar/searchbar.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 搜索 13 | 14 | 15 | {{cancelText}} 16 | 17 | 18 | 19 | {{item.text}} 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/components/weui/searchbar/searchbar.wxss: -------------------------------------------------------------------------------- 1 | .weui-search-bar{position:relative;padding:8px;display:flex;box-sizing:border-box;background-color:#EDEDED;-webkit-text-size-adjust:100%;align-items:center}.weui-icon-search{margin-right:8px;font-size:14px;vertical-align:top;margin-top:.64em;height:1em;line-height:1em}.weui-icon-search_in-box{position:absolute;left:12px;top:50%;margin-top:-8px}.weui-search-bar__text{display:inline-block;font-size:14px;vertical-align:top}.weui-search-bar__form{position:relative;flex:auto;border-radius:4px;background:#FFFFFF}.weui-search-bar__box{position:relative;padding-left:32px;padding-right:32px;width:100%;box-sizing:border-box;z-index:1}.weui-search-bar__input{height:32px;line-height:32px;font-size:14px;caret-color:#07C160}.weui-icon-clear{position:absolute;top:0;right:0;bottom:0;padding:0 12px;font-size:0}.weui-icon-clear:after{content:"";height:100%;vertical-align:middle;display:inline-block;width:0;overflow:hidden}.weui-search-bar__label{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;border-radius:4px;text-align:center;color:rgba(0,0,0,0.5);background:#FFFFFF;line-height:32px}.weui-search-bar__cancel-btn{margin-left:8px;line-height:32px;color:#576B95;white-space:nowrap} -------------------------------------------------------------------------------- /src/components/weui/slideview/slideview.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 12); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 12: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true, 99 | multipleSlots: true 100 | }, 101 | properties: { 102 | extClass: { 103 | type: String, 104 | value: '' 105 | }, 106 | buttons: { 107 | type: Array, 108 | value: [], 109 | observer: function observer(newVal) { 110 | this.addClassNameForButton(); 111 | } 112 | }, 113 | disable: { 114 | type: Boolean, 115 | value: false 116 | }, 117 | icon: { 118 | type: Boolean, 119 | value: false 120 | } 121 | }, 122 | data: { 123 | size: null 124 | }, 125 | ready: function ready() { 126 | this.updateRight(); 127 | this.addClassNameForButton(); 128 | }, 129 | 130 | methods: { 131 | updateRight: function updateRight() { 132 | var _this = this; 133 | 134 | var query = wx.createSelectorQuery().in(this); 135 | query.select('.left').boundingClientRect(function (res) { 136 | console.log('right res', res); 137 | var btnQuery = wx.createSelectorQuery().in(_this); 138 | btnQuery.selectAll('.btn').boundingClientRect(function (rects) { 139 | console.log('btn rects', rects); 140 | _this.setData({ 141 | size: { 142 | buttons: rects, 143 | button: res 144 | } 145 | }); 146 | }).exec(); 147 | }).exec(); 148 | }, 149 | addClassNameForButton: function addClassNameForButton() { 150 | var _data = this.data, 151 | buttons = _data.buttons, 152 | icon = _data.icon; 153 | 154 | buttons.forEach(function (btn) { 155 | if (icon) { 156 | btn.className = ''; 157 | } else if (btn.type === 'warn') { 158 | btn.className = 'weui-slideview__btn-group_warn'; 159 | } else { 160 | btn.className = 'weui-slideview__btn-group_default'; 161 | } 162 | }); 163 | this.setData({ 164 | buttons: buttons 165 | }); 166 | }, 167 | buttonTapByWxs: function buttonTapByWxs(data) { 168 | this.triggerEvent('buttontap', data, {}); 169 | }, 170 | hide: function hide() { 171 | this.triggerEvent('hide', {}, {}); 172 | }, 173 | show: function show() { 174 | this.triggerEvent('show', {}, {}); 175 | } 176 | } 177 | }); 178 | 179 | /***/ }) 180 | 181 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/slideview/slideview.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/slideview/slideview.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{item.text}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/components/weui/slideview/slideview.wxs: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | var touchstart = function(event, ownerInstance) { 3 | var ins = event.instance 4 | var st = ins.getState() 5 | if (st.disable) return // disable的逻辑 6 | // console.log('touchstart st', JSON.stringify(st)) 7 | if (!st.size) return 8 | // console.log('touchstart', JSON.stringify(event)) 9 | st.isMoving = true 10 | st.startX = event.touches[0].pageX 11 | } 12 | var touchmove = function(event, ownerInstance) { 13 | var ins = event.instance 14 | var st = ins.getState() 15 | if (!st.size || !st.isMoving) return 16 | // console.log('touchmove', JSON.stringify(event)) 17 | var pagex = event.touches[0].pageX - st.startX 18 | var movex = pagex > 0 ? Math.min(st.max, pagex) : Math.max(-st.max, pagex) 19 | // 往回滑动的情况 20 | if (st.out) { 21 | // 已经是划出来了,还要往左滑动,忽略 22 | if (movex < 0) return 23 | ins.setStyle({ 24 | 'transform': 'translateX(' + (st.transformx + movex) + 'px)', 25 | 'transition': '' 26 | }) 27 | var btns = ownerInstance.selectAllComponents('.btn') 28 | var transformTotal = 0 29 | var len = btns.length 30 | var i = len - 1; 31 | for (;i >= 0; i--) { 32 | var transform = st.size.buttons[i].width / st.max * movex 33 | var transformx = st.size.buttons[i].max - Math.min(st.size.buttons[i].max, transform + transformTotal) 34 | btns[i].setStyle({ 35 | 'transform': 'translateX(' + (-transformx) + 'px)', 36 | 'transition': '' 37 | }) 38 | transformTotal += transform 39 | } 40 | return 41 | } 42 | if (movex > 0) movex = 0 43 | ins.setStyle({ 44 | 'transform': 'translateX(' + movex + 'px)', 45 | 'transition': '' 46 | }) 47 | st.transformx = movex 48 | var btns = ownerInstance.selectAllComponents('.btn') 49 | var transformTotal = 0 50 | var len = btns.length 51 | var i = len - 1; 52 | for (;i >= 0; i--) { 53 | var transform = st.size.buttons[i].width / st.max * movex 54 | var transformx = Math.max(-st.size.buttons[i].max, transform + transformTotal) 55 | btns[i].setStyle({ 56 | 'transform': 'translateX(' + transformx + 'px)', 57 | 'transition': '' 58 | }) 59 | st.size.buttons[i].transformx = transformx 60 | transformTotal += transform 61 | } 62 | } 63 | var touchend = function(event, ownerInstance) { 64 | var ins = event.instance 65 | var st = ins.getState() 66 | if (!st.size || !st.isMoving) return 67 | st.isMoving = false 68 | // console.log('touchend', JSON.stringify(event)) 69 | var btns = ownerInstance.selectAllComponents('.btn') 70 | var len = btns.length 71 | var i = len - 1 72 | // console.log('len size', len) 73 | if (Math.abs(event.changedTouches[0].pageX - st.startX) < st.throttle || event.changedTouches[0].pageX - st.startX > 0) { // 方向也要控制 74 | st.out = false 75 | ins.setStyle({ 76 | 'transform': 'translate3d(0px, 0, 0)', 77 | 'transition': 'transform 0.4s' 78 | }) 79 | for (;i >= 0; i--) { 80 | btns[i].setStyle({ 81 | 'transform': 'translate3d(0px, 0, 0)', 82 | 'transition': 'transform 0.4s' 83 | }) 84 | } 85 | ownerInstance.callMethod('hide') 86 | return 87 | } 88 | var movex = st.max 89 | st.out = true 90 | ins.setStyle({ 91 | 'transform': 'translate3d(' + (-movex) + 'px, 0, 0)', 92 | 'transition': 'transform 0.4s' 93 | }) 94 | st.transformx = -movex 95 | var transformTotal = 0 96 | for (;i >= 0; i--) { 97 | var transform = st.size.buttons[i].width / st.max * movex 98 | var transformx = (-(transform + transformTotal)) 99 | btns[i].setStyle({ 100 | 'transform': 'translate3d(' + transformx + 'px, 0, 0)', 101 | 'transition': 'transform 0.4s' 102 | }) 103 | st.size.buttons[i].transformx = transformx 104 | transformTotal += transform 105 | } 106 | ownerInstance.callMethod('show') 107 | } 108 | var hideButton = function(event, ownerInstance) { 109 | var ins = ownerInstance.selectComponent('.left') 110 | var st = ins.getState() 111 | if (!st.size) return 112 | // console.log('hideButton', JSON.stringify(event)) 113 | var btns = ownerInstance.selectAllComponents('.btn') 114 | var len = btns.length 115 | var i = len - 1 116 | // console.log('len size', len) 117 | ins.setStyle({ 118 | 'transform': 'translate3d(0px, 0, 0)', 119 | 'transition': 'transform 0.4s' 120 | }) 121 | st.transformx = 0 122 | for (;i >= 0; i--) { 123 | btns[i].setStyle({ 124 | 'transform': 'translate3d(0px, 0, 0)', 125 | 'transition': 'transform 0.5s' 126 | }) 127 | st.size.buttons[i].transformx = 0 128 | } 129 | ownerInstance.callMethod('buttonTapByWxs', {index: event.currentTarget.dataset.index, data: event.currentTarget.dataset.data}) 130 | return false 131 | } 132 | var sizeReady = function(newVal, oldVal, ownerInstance, ins) { 133 | var st = ins.getState() 134 | // st.disable = newVal && newVal.disable 135 | if (newVal && newVal.button && newVal.buttons) { 136 | st.size = newVal 137 | st.transformx = 0 138 | // var min = newVal.button.width 139 | var max = 0 140 | var len = newVal.buttons.length 141 | var i = newVal.buttons.length - 1; 142 | var total = 0 143 | for (; i >= 0; i--) { 144 | max += newVal.buttons[i].width 145 | // if (min > newVal.buttons[i]) { 146 | // min = newVal.buttons[i].width 147 | // } 148 | total += newVal.buttons[i].width 149 | newVal.buttons[i].max = total 150 | newVal.buttons[i].transformx = 0 151 | } 152 | st.throttle = 40 // 固定值 153 | st.max = max 154 | ownerInstance.selectComponent('.right').setStyle({ 155 | 'line-height': newVal.button.height + 'px', 156 | left: (newVal.button.width) + 'px', 157 | width: max + 'px' 158 | }) 159 | // console.log('st size', JSON.stringify(newVal)) 160 | } 161 | } 162 | var disableChange = function(newVal, oldVal, ownerInstance, ins) { 163 | var st = ins.getState() 164 | st.disable = newVal 165 | } 166 | module.exports = { 167 | touchstart: touchstart, 168 | touchmove: touchmove, 169 | touchend: touchend, 170 | hideButton: hideButton, 171 | sizeReady: sizeReady, 172 | disableChange: disableChange 173 | } -------------------------------------------------------------------------------- /src/components/weui/slideview/slideview.wxss: -------------------------------------------------------------------------------- 1 | :host{width:100%}.weui-slideview{position:relative;overflow:hidden}.weui-slideview__left{position:relative;z-index:10}.weui-slideview__right{position:absolute;z-index:1;left:100%;top:0;height:100%}.weui-slideview__btn__wrp{position:absolute;left:0;bottom:0;text-align:center;min-width:69px;height:100%;white-space:nowrap}.weui-slideview__btn{color:#FFFFFF;padding:0 17px}.weui-slideview__btn-group_default .weui-slideview__btn{background:#C7C7CC}.weui-slideview__btn-group_default~.weui-slideview__btn-group_default:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #FFFFFF;color:#FFFFFF}.weui-slideview__btn-group_default:first-child:before{display:none}.weui-slideview__btn-group_warn .weui-slideview__btn{background:#FE3B30}.weui-slideview__btn-group_warn~.weui-slideview__btn-group_warn:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #FFFFFF;color:#FFFFFF}.weui-slideview__btn-group_warn:first-child:before{display:none}.weui-slideview_icon .weui-slideview__btn__wrp{background:transparent;font-size:0}.weui-slideview_icon .weui-slideview__btn__wrp:first-child{padding-left:16px}.weui-slideview_icon .weui-slideview__btn__wrp:last-child{padding-right:8px}.weui-slideview_icon .weui-slideview__btn{width:48px;height:48px;line-height:48px;padding:0;display:inline-block;vertical-align:middle;border-radius:50%;background-color:#FFFFFF}.weui-slideview_icon .weui-slideview__btn__icon{display:inline-block;vertical-align:middle;width:22px;height:22px} -------------------------------------------------------------------------------- /src/components/weui/static/icon/s-arrow-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/components/weui/static/icon/s-arrow-back.png -------------------------------------------------------------------------------- /src/components/weui/static/icon/s-arrow-back.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Icons/Filled/arrow Copy 2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/components/weui/tabbar/tabbar.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 11); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 11: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true 99 | }, 100 | properties: { 101 | extClass: { 102 | type: String, 103 | value: '' 104 | }, 105 | list: { 106 | type: Array, 107 | value: [] 108 | }, 109 | current: { 110 | type: Number, 111 | value: 0 112 | } 113 | }, 114 | methods: { 115 | tabChange: function tabChange(e) { 116 | var index = e.currentTarget.dataset.index; 117 | 118 | if (index === this.data.current) { 119 | return; 120 | } 121 | this.setData({ 122 | current: index 123 | }); 124 | this.triggerEvent('change', { index: index, item: this.data.list[index] }); 125 | } 126 | } 127 | }); 128 | 129 | /***/ }) 130 | 131 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/tabbar/tabbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "mp-badge": "../badge/badge" 5 | } 6 | } -------------------------------------------------------------------------------- /src/components/weui/tabbar/tabbar.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{item.text}} 9 | 10 | -------------------------------------------------------------------------------- /src/components/weui/tabbar/tabbar.wxss: -------------------------------------------------------------------------------- 1 | .weui-tabbar{display:flex;position:relative;z-index:500;background-color:#F7F7F7}.weui-tabbar:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-tabbar__item{display:block;flex:1;padding:8px 0 4px;padding-bottom:calc(8px + constant(safe-area-inset-bottom));padding-bottom:calc(8px + env(safe-area-inset-bottom));font-size:0;color:rgba(0,0,0,0.5);text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0)}.weui-tabbar__item:first-child{padding-left:constant(safe-area-inset-left);padding-left:env(safe-area-inset-left)}.weui-tabbar__item:last-child{padding-right:constant(safe-area-inset-right);padding-right:env(safe-area-inset-right)}.weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon,.weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon>i,.weui-tabbar__item.weui-bar__item_on .weui-tabbar__label{color:#07C160}.weui-tabbar__icon{display:inline-block;width:28px;height:28px;margin-bottom:2px}i.weui-tabbar__icon,.weui-tabbar__icon>i{font-size:24px;color:rgba(0,0,0,0.5)}.weui-tabbar__icon image{width:100%;height:100%}.weui-tabbar__label{color:rgba(0,0,0,0.9);font-size:10px;line-height:1.4} -------------------------------------------------------------------------------- /src/components/weui/toptips/toptips.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 | /******/ } 42 | /******/ }; 43 | /******/ 44 | /******/ // define __esModule on exports 45 | /******/ __webpack_require__.r = function(exports) { 46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 | /******/ } 49 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 | /******/ }; 51 | /******/ 52 | /******/ // create a fake namespace object 53 | /******/ // mode & 1: value is a module id, require it 54 | /******/ // mode & 2: merge all properties of value into the ns 55 | /******/ // mode & 4: return value when already ns object 56 | /******/ // mode & 8|1: behave like require 57 | /******/ __webpack_require__.t = function(value, mode) { 58 | /******/ if(mode & 1) value = __webpack_require__(value); 59 | /******/ if(mode & 8) return value; 60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 | /******/ var ns = Object.create(null); 62 | /******/ __webpack_require__.r(ns); 63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 | /******/ return ns; 66 | /******/ }; 67 | /******/ 68 | /******/ // getDefaultExport function for compatibility with non-harmony modules 69 | /******/ __webpack_require__.n = function(module) { 70 | /******/ var getter = module && module.__esModule ? 71 | /******/ function getDefault() { return module['default']; } : 72 | /******/ function getModuleExports() { return module; }; 73 | /******/ __webpack_require__.d(getter, 'a', getter); 74 | /******/ return getter; 75 | /******/ }; 76 | /******/ 77 | /******/ // Object.prototype.hasOwnProperty.call 78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 | /******/ 80 | /******/ // __webpack_public_path__ 81 | /******/ __webpack_require__.p = ""; 82 | /******/ 83 | /******/ 84 | /******/ // Load entry module and return exports 85 | /******/ return __webpack_require__(__webpack_require__.s = 8); 86 | /******/ }) 87 | /************************************************************************/ 88 | /******/ ({ 89 | 90 | /***/ 8: 91 | /***/ (function(module, exports, __webpack_require__) { 92 | 93 | "use strict"; 94 | 95 | 96 | Component({ 97 | options: { 98 | addGlobalClass: true 99 | }, 100 | properties: { 101 | type: { 102 | type: String, 103 | value: 'error', 104 | observer: '_typeChange' 105 | }, 106 | show: { 107 | type: Boolean, 108 | value: false, 109 | observer: '_showChange' 110 | }, 111 | msg: { 112 | type: String, 113 | value: '' 114 | }, 115 | delay: { 116 | type: Number, 117 | value: 2000 118 | }, 119 | extClass: { 120 | type: String, 121 | value: '' 122 | } 123 | }, 124 | data: { 125 | typeClassMap: { 126 | 'warn': 'weui-toptips_warn', 127 | 'info': 'weui-toptips_info', 128 | 'success': 'weui-toptips_success', 129 | 'error': 'weui-toptips_error' 130 | } 131 | }, 132 | attached: function attached() { 133 | var data = this.data; 134 | this.setData({ 135 | className: data.typeClassMap[data.type] || '' 136 | }); 137 | }, 138 | 139 | methods: { 140 | _typeChange: function _typeChange(newVal) { 141 | this.setData({ 142 | className: this.data.typeClassMap[newVal] || '' 143 | }); 144 | return newVal; 145 | }, 146 | _showChange: function _showChange(newVal) { 147 | this._showToptips(newVal); 148 | }, 149 | _showToptips: function _showToptips(newVal) { 150 | var _this = this; 151 | 152 | if (newVal && this.data.delay) { 153 | setTimeout(function () { 154 | _this.setData({ 155 | show: false 156 | }, function () { 157 | _this.triggerEvent('hide', {}, {}); 158 | }); 159 | }, this.data.delay); 160 | } 161 | this.setData({ 162 | show: newVal 163 | }); 164 | } 165 | } 166 | }); 167 | 168 | /***/ }) 169 | 170 | /******/ }); -------------------------------------------------------------------------------- /src/components/weui/toptips/toptips.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /src/components/weui/toptips/toptips.wxml: -------------------------------------------------------------------------------- 1 | 2 | {{msg}} 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/components/weui/toptips/toptips.wxss: -------------------------------------------------------------------------------- 1 | .weui-toptips{position:fixed;-webkit-transform:translateZ(0) translateY(calc(-100% - 8px));transform:translateZ(0) translateY(calc(-100% - 8px));text-align:center;top:8px;left:16px;right:16px;border-radius:4px;padding:8px;-webkit-border-radius:4px;color:rgba(255,255,255,0.9);font-size:17px;line-height:1.4;background:rgba(250,81,81,0.9);z-index:5000;word-wrap:break-word;word-break:break-all;-webkit-transition:all .4s ease-in-out;transition:all .4s ease-in-out}.weui-toptips_show{-webkit-transform:translateZ(0) translateY(0);transform:translateZ(0) translateY(0);opacity:1}.weui-toptips_warn{background-color:#FA5151}.weui-toptips_success{background-color:#09BB07}.weui-toptips_error{background-color:#FA5151}.weui-toptips_info{background-color:#10AEFF} -------------------------------------------------------------------------------- /src/components/weui/uploader/uploader.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "mp-gallery": "../gallery/gallery" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/components/weui/uploader/uploader.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{title}} 5 | {{currentFiles.length}}/{{maxCount}} 6 | 7 | 8 | {{tips}} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/components/weui/uploader/uploader.wxss: -------------------------------------------------------------------------------- 1 | .weui-uploader{flex:1}.weui-uploader__hd{padding-bottom:16px}.weui-uploader__overview{display:flex;align-items:center}.weui-uploader__title{flex:1}.weui-uploader__tips{color:rgba(0,0,0,0.3);font-size:14px;line-height:1.4;padding-top:4px}.weui-uploader__info{color:rgba(0,0,0,0.3)}.weui-uploader__bd{margin-bottom:-8px;margin-right:-8px;overflow:hidden}.weui-uploader__file{float:left;margin-right:8px;margin-bottom:8px}.weui-uploader__img{display:block;width:96px;height:96px}.weui-uploader__file_status{position:relative}.weui-uploader__file_status:before{content:" ";position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,0.5)}.weui-uploader__file-content{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);color:#FFFFFF}.weui-uploader__input-box{float:left;position:relative;margin-right:8px;margin-bottom:8px;width:96px;height:96px;box-sizing:border-box;background-color:#EDEDED}.weui-uploader__input-box:before,.weui-uploader__input-box:after{content:" ";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);background-color:#A3A3A3}.weui-uploader__input-box:before{width:2px;height:32px}.weui-uploader__input-box:after{width:32px;height:2px}.weui-uploader__input-box:active{border-color:#8b8b8b}.weui-uploader__input-box:active:before,.weui-uploader__input-box:active:after{background-color:#8b8b8b}.weui-uploader__input{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;opacity:0}.weui-loading{margin:0 5px;width:20px;height:20px;display:inline-block;vertical-align:middle;animation:weuiLoading 1s steps(12, end) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;background-size:100%}.weui-loading.weui-loading_transparent{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E")}@keyframes weuiLoading{0%{transform:rotate3d(0, 0, 1, 0deg)}100%{transform:rotate3d(0, 0, 1, 360deg)}} -------------------------------------------------------------------------------- /src/mixins/mapAuthState.js: -------------------------------------------------------------------------------- 1 | export default { 2 | computed: { 3 | token () { 4 | return this.$app.$store.state.auth.token; 5 | }, 6 | 7 | user () { 8 | return this.$app.$store.state.auth.user; 9 | }, 10 | 11 | unreadCount () { 12 | return this.$app.$store.state.auth.unread_count; 13 | }, 14 | 15 | authorized () { 16 | return !!this.token; 17 | }, 18 | 19 | isLogged () { 20 | return !!this.user.id; 21 | }, 22 | }, 23 | 24 | created () { 25 | ['token', 'user', 'unreadCount'].map(k => this.$watch(k, () => {})); 26 | }, 27 | 28 | onUnload () { 29 | this._watcher.teardown(); 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /src/mixins/request.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export default { 4 | methods: { 5 | request, 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/account/center/index.wpy: -------------------------------------------------------------------------------- 1 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | {{user.username}} 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 我的收藏 62 | 63 | 64 | 我的评论 65 | 66 | 67 | 我的点赞 68 | 69 | 70 | 71 | 72 | 73 | 消息通知 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 个人设置 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 110 | 111 | 112 | { 113 | usingComponents: { 114 | 'authorized-check': '~@/components/authorized-check', 115 | cell: '~@/components/weui/cell/cell', 116 | cells: '~@/components/weui/cells/cells', 117 | badge: '~@/components/weui/badge/badge', 118 | }, 119 | } 120 | 121 | -------------------------------------------------------------------------------- /src/pages/account/comments/services.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function queryComments (params) { 4 | return request('user/comments', { 5 | data: params, 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/account/favorites/index.wpy: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 加载完毕 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 159 | 160 | 161 | { 162 | backgroundTextStyle: 'dark', 163 | enablePullDownRefresh: true, 164 | navigationBarTitleText: '我的收藏', 165 | usingComponents: { 166 | loading: '~@/components/weui/loading/loading', 167 | 'list-item': '~@/pages/articles/list/components/list-item', 168 | 'list-item1': '~@/pages/articles/list/components/list-item1', 169 | 'list-item2': '~@/pages/articles/list/components/list-item2', 170 | }, 171 | } 172 | 173 | -------------------------------------------------------------------------------- /src/pages/account/favorites/services.js: -------------------------------------------------------------------------------- 1 | import stringify from 'qs/lib/stringify'; 2 | import request from '@/utils/request'; 3 | 4 | export async function queryFollowRelations (params) { 5 | return request(`user/follow_relations?${stringify(params)}`); 6 | } 7 | -------------------------------------------------------------------------------- /src/pages/account/likers/services.js: -------------------------------------------------------------------------------- 1 | import stringify from 'qs/lib/stringify'; 2 | import request from '@/utils/request'; 3 | 4 | export async function queryFollowRelations (params) { 5 | return request(`user/follow_relations?${stringify(params)}`); 6 | } 7 | -------------------------------------------------------------------------------- /src/pages/account/notifications/components/comment-my-article.wpy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{notification.data.username}} 10 | 11 | 12 | {{notification.data.content}} 13 | 14 | 15 | {{notification.created_at_timeago}} 16 | 17 | 18 | 19 | {{notification.data.article_title}} 20 | 21 | 22 | 23 | 24 | 25 | 53 | -------------------------------------------------------------------------------- /src/pages/account/notifications/components/liked-my-article.wpy: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {{notification.data.username}} 19 | 20 | 21 | 22 | 23 | 24 | {{notification.created_at_timeago}} 25 | 26 | 27 | 28 | {{notification.data.article_title}} 29 | 30 | 31 | 32 | 33 | 34 | 56 | -------------------------------------------------------------------------------- /src/pages/account/notifications/components/mentioned-me.wpy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{notification.data.username}} 10 | 11 | 12 | 提到了您 13 | 14 | 15 | {{notification.created_at_timeago}} 16 | 17 | 18 | 19 | {{notification.data.content}} 20 | 21 | 22 | 23 | 24 | 25 | 74 | -------------------------------------------------------------------------------- /src/pages/account/notifications/components/reply-my-comment.wpy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{notification.data.username}} 10 | 11 | 12 | {{notification.data.content}} 13 | 14 | 15 | {{notification.created_at_timeago}} 16 | 17 | 18 | 19 | {{notification.data.parent_content}} 20 | 21 | 22 | 23 | 24 | 25 | 55 | -------------------------------------------------------------------------------- /src/pages/account/notifications/components/up-voted-my-comment.wpy: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {{notification.data.username}} 19 | 20 | 21 | 22 | 23 | 24 | {{notification.created_at_timeago}} 25 | 26 | 27 | 28 | {{notification.data.content}} 29 | 30 | 31 | 32 | 33 | 34 | 75 | -------------------------------------------------------------------------------- /src/pages/account/notifications/index.wpy: -------------------------------------------------------------------------------- 1 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 84 | 88 | 89 | 93 | 94 | 98 | 99 | 103 | 104 | 108 | 109 | 110 | 111 | 112 | 113 | 加载完毕 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 201 | 202 | 203 | { 204 | backgroundTextStyle: 'dark', 205 | enablePullDownRefresh: true, 206 | navigationBarTitleText: '我的通知', 207 | usingComponents: { 208 | loading: '~@/components/weui/loading/loading', 209 | 'comment-my-article': './components/comment-my-article', 210 | 'liked-my-article': './components/liked-my-article', 211 | 'mentioned-me': './components/mentioned-me', 212 | 'reply-my-comment': './components/reply-my-comment', 213 | 'up-voted-my-comment': './components/up-voted-my-comment', 214 | }, 215 | } 216 | 217 | -------------------------------------------------------------------------------- /src/pages/account/notifications/services.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function queryNotifications (params) { 4 | return request(`user/notifications`, { 5 | data: params, 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/account/settings/services.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function updateBaseInfo (params) { 4 | return request('user/base_info', { 5 | method: 'POST', 6 | data: params, 7 | }); 8 | } 9 | 10 | export async function updateSettings (params) { 11 | return request('user/settings', { 12 | method: 'POST', 13 | data: params, 14 | }); 15 | } 16 | 17 | export async function updatePassword (params) { 18 | return request('user/password', { 19 | method: 'POST', 20 | data: params, 21 | }); 22 | } 23 | 24 | export async function sendEmailCode (email) { 25 | return request('user/send_email_code', { 26 | method: 'POST', 27 | data: { email }, 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /src/pages/articles/list/components/list-item.wpy: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | {{article.title}} 15 | {{desc}} 16 | 17 | {{ article.friendly_views_count }} 阅读 18 | {{ article.friendly_comments_count }} 评论 19 | {{ article.created_at_timeago }} 20 | 21 | 22 | 23 | 24 | 47 | -------------------------------------------------------------------------------- /src/pages/articles/list/components/list-item1.wpy: -------------------------------------------------------------------------------- 1 | 49 | 50 | 51 | 52 | 53 | {{article.title}} 54 | 55 | {{ article.friendly_views_count }} 阅读 56 | {{ article.friendly_comments_count }} 评论 57 | {{ article.created_at_timeago }} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 82 | -------------------------------------------------------------------------------- /src/pages/articles/list/components/list-item2.wpy: -------------------------------------------------------------------------------- 1 | 41 | 42 | 43 | 44 | 45 | {{article.title}} 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {{ article.friendly_views_count }} 阅读 55 | {{ article.friendly_comments_count }} 评论 56 | {{ article.created_at_timeago }} 57 | 58 | 59 | 60 | 61 | 62 | 78 | -------------------------------------------------------------------------------- /src/pages/articles/list/index.wpy: -------------------------------------------------------------------------------- 1 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 关于 “{{searchValue}}” 的搜索结果 39 | 40 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 加载完毕 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 177 | 178 | 179 | { 180 | backgroundTextStyle: 'dark', 181 | enablePullDownRefresh: true, 182 | usingComponents: { 183 | loading: '~@/components/weui/loading/loading', 184 | searchbar: '~@/components/weui/searchbar/searchbar', 185 | 'list-item': './components/list-item', 186 | 'list-item1': './components/list-item1', 187 | 'list-item2': './components/list-item2', 188 | }, 189 | } 190 | 191 | -------------------------------------------------------------------------------- /src/pages/articles/list/services.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function queryArticles (params) { 4 | return request('articles', { 5 | data: params, 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/articles/show/services.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function queryArticle (id, params) { 4 | return request(`articles/${id}`, { 5 | data: params, 6 | }); 7 | } 8 | 9 | export async function queryArticleComment (article_id, comment_id, params) { 10 | return request(`articles/${article_id}/comments/${comment_id}`, { 11 | data: params, 12 | }); 13 | } 14 | 15 | export async function queryArticleComments (article_id, params) { 16 | return request(`articles/${article_id}/comments`, { 17 | data: params, 18 | }); 19 | } 20 | 21 | export async function postArticleComment (article_id, params) { 22 | return request(`articles/${article_id}/comments`, { 23 | method: 'post', 24 | data: params, 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /src/pages/auth/scan-login.wpy: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | WEB 端登录确认 24 | 25 | 26 | 27 | 28 | 35 | 登录 36 | 37 | 38 | 取消登录 39 | 40 | 41 | 42 | 43 | 44 | 45 | 80 | 81 | -------------------------------------------------------------------------------- /src/services.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function login (code) { 4 | return request('auth/wechat_login', { 5 | method: 'POST', 6 | data: { code }, 7 | }); 8 | } 9 | 10 | export async function scanLogin (code, uuid) { 11 | return request('auth/wechat_scan_login', { 12 | method: 'POST', 13 | data: { code, uuid }, 14 | }); 15 | } 16 | 17 | export async function register (code, params) { 18 | return request('auth/wechat_register', { 19 | method: 'POST', 20 | data: { 21 | code, 22 | ...params, 23 | }, 24 | }); 25 | } 26 | 27 | export async function loadUserData () { 28 | return request('me'); 29 | } 30 | -------------------------------------------------------------------------------- /src/static/png/article_80x80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/article_80x80.png -------------------------------------------------------------------------------- /src/static/png/desktop_200x200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/desktop_200x200.png -------------------------------------------------------------------------------- /src/static/png/downvote_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/downvote_81x81.png -------------------------------------------------------------------------------- /src/static/png/downvoted_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/downvoted_81x81.png -------------------------------------------------------------------------------- /src/static/png/favorite_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/favorite_81x81.png -------------------------------------------------------------------------------- /src/static/png/favorited_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/favorited_81x81.png -------------------------------------------------------------------------------- /src/static/png/like_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/like_81x81.png -------------------------------------------------------------------------------- /src/static/png/liked_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/liked_81x81.png -------------------------------------------------------------------------------- /src/static/png/message_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/message_81x81.png -------------------------------------------------------------------------------- /src/static/png/read_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/read_81x81.png -------------------------------------------------------------------------------- /src/static/png/read_selected_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/read_selected_81x81.png -------------------------------------------------------------------------------- /src/static/png/tags_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/tags_81x81.png -------------------------------------------------------------------------------- /src/static/png/upvote_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/upvote_81x81.png -------------------------------------------------------------------------------- /src/static/png/upvoted_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/upvoted_81x81.png -------------------------------------------------------------------------------- /src/static/png/user_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/user_81x81.png -------------------------------------------------------------------------------- /src/static/png/user_selected_81x81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanthink/mpblog/b04a52fadafd6edc3410f39f987e4b9fed0c7cbe/src/static/png/user_selected_81x81.png -------------------------------------------------------------------------------- /src/utils/request.js: -------------------------------------------------------------------------------- 1 | import eventHub from '@/common/eventHub'; 2 | 3 | const codeMessage = { 4 | 200: '服务器成功返回请求的数据。', 5 | 201: '新建或修改数据成功。', 6 | 202: '一个请求已经进入后台排队(异步任务)。', 7 | 204: '删除数据成功。', 8 | 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。', 9 | 401: '用户没有权限(令牌、用户名、密码错误)。', 10 | 403: '用户得到授权,但是访问是被禁止的。', 11 | 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。', 12 | 406: '请求的格式不可得。', 13 | 410: '请求的资源被永久删除,且不会再得到的。', 14 | 422: '当创建一个对象时,发生一个验证错误。', 15 | 500: '服务器发生错误,请检查服务器。', 16 | 502: '网关错误。', 17 | 503: '服务不可用,服务器暂时过载或维护。', 18 | 504: '网关超时。', 19 | }; 20 | 21 | function checkStatus (res) { 22 | if (res.statusCode >= 200 && res.statusCode < 300) { 23 | return res; 24 | } 25 | 26 | const { data: { message }, statusCode } = res; 27 | const errorText = message || codeMessage[statusCode]; 28 | 29 | switch (res.statusCode) { 30 | case 400: 31 | case 403: 32 | case 404: 33 | case 422: 34 | case 429: 35 | wx.showToast({ 36 | title: errorText, 37 | icon: 'none', 38 | }); 39 | break; 40 | case 500: 41 | case 501: 42 | case 503: 43 | wx.showToast({ 44 | title: '服务器出了点小问题!', 45 | icon: 'none', 46 | }); 47 | } 48 | 49 | const error = new Error(errorText); 50 | error.response = res; 51 | 52 | eventHub.$emit('http-error', error); 53 | 54 | throw error; 55 | } 56 | 57 | function Http () { 58 | this.setToken = token => this.defaults.header.Authorization = `Bearer ${token}`; 59 | 60 | this.setSocketId = socketId => this.defaults.header['X-Socket-ID'] = socketId; 61 | 62 | this.request = async (url, options = {}) => { 63 | return new Promise((resolve, reject) => { 64 | const opts = { 65 | ...this.defaults, 66 | ...options, 67 | url: `${API_URL}${url}`, 68 | success (res) { 69 | try { 70 | checkStatus(res); 71 | } catch (e) { 72 | reject(e); 73 | } 74 | const { data, ...meta } = res.data; 75 | res.data = data; 76 | resolve({ ...res, ...meta }); 77 | }, 78 | fail (res) { 79 | reject(res); 80 | }, 81 | }; 82 | 83 | wx.request(opts); 84 | }); 85 | }; 86 | } 87 | 88 | Http.prototype.defaults = { 89 | method: 'GET', 90 | header: { 91 | Accept: 'application/json', 92 | 'Content-Type': 'application/json; charset=utf-8', 93 | 'X-Client': 'wechat', 94 | }, 95 | dataType: 'json', 96 | }; 97 | 98 | 99 | export const http = new Http(); 100 | export const setToken = http.setToken; 101 | export const setSocketId = http.setSocketId; 102 | export default http.request; 103 | -------------------------------------------------------------------------------- /src/utils/utils.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | 3 | export function diffForHumans (time) { 4 | const mtime = moment(time); 5 | const now = moment(); 6 | 7 | if (now.diff(mtime, 'day') > 15) { 8 | return mtime.year() === now.year() ? mtime.format('MM-DD HH:ss') : mtime.format('YYYY-MM-DD HH:ss'); 9 | } 10 | 11 | return mtime.fromNow(); 12 | } 13 | 14 | export function friendlyNumbers (n) { 15 | if (n >= 1000) { 16 | return Math.floor(n / 1000) + 'k'; 17 | } 18 | 19 | return String(n); 20 | } 21 | 22 | export function matchImages (markdown) { 23 | const image = /^!\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/; 24 | const label = /(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; 25 | const href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/; 26 | const title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; 27 | 28 | const edit = (regex, opt) => { 29 | regex = regex.source || regex; 30 | opt = opt || ''; 31 | return { 32 | replace: function (name, val) { 33 | val = val.source || val; 34 | val = val.replace(/(^|[^\[])\^/g, '$1'); 35 | regex = regex.replace(name, val); 36 | return this; 37 | }, 38 | getRegex: function () { 39 | return new RegExp(regex, opt); 40 | }, 41 | }; 42 | }; 43 | 44 | const imageReg = edit(image, 'gm') 45 | .replace('label', label) 46 | .replace('href', href) 47 | .replace('title', title) 48 | .getRegex(); 49 | 50 | const images = []; 51 | let matches; 52 | 53 | while ((matches = imageReg.exec(markdown))) { 54 | images.push(matches[2]); 55 | } 56 | console.info(); 57 | 58 | return images; 59 | } 60 | 61 | export function checkVersionUpdate () { 62 | const updateManager = wx.getUpdateManager(); 63 | 64 | updateManager.onCheckForUpdate(function (res) { 65 | console.log(res.hasUpdate); // 请求完新版本信息的回调 66 | }); 67 | 68 | updateManager.onUpdateReady(function () { 69 | wx.showModal({ 70 | title: '更新提示', 71 | content: '新版本已经准备好,是否重启应用?', 72 | success (res) { 73 | if (res.confirm) { 74 | // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 75 | updateManager.applyUpdate(); 76 | } 77 | }, 78 | }); 79 | }); 80 | 81 | updateManager.onUpdateFailed(function () { 82 | // 新版本下载失败 83 | }); 84 | } 85 | -------------------------------------------------------------------------------- /src/vuex/auth.js: -------------------------------------------------------------------------------- 1 | import isEmpty from 'lodash/isEmpty'; 2 | import * as services from '@/services'; 3 | 4 | export default { 5 | namespaced: true, 6 | 7 | state: { 8 | token: null, 9 | user: {}, 10 | unread_count: 0, 11 | }, 12 | 13 | actions: { 14 | async attemptLogin ({ dispatch }) { 15 | const { code } = await new Promise((resolve, reject) => { 16 | wx.login({ 17 | success (res) { 18 | resolve(res); 19 | }, 20 | fail (res) { 21 | reject(res); 22 | }, 23 | }); 24 | }); 25 | 26 | const { data } = await services.login(code); 27 | 28 | await dispatch('setToken', data.access_token); 29 | 30 | dispatch('loadUser'); 31 | }, 32 | 33 | async attemptScanLogin ({ dispatch, state }, uuid) { 34 | if (!state.token) { 35 | await dispatch('attemptRegister'); 36 | } 37 | 38 | const { code } = await new Promise((resolve, reject) => { 39 | wx.login({ 40 | success (res) { 41 | resolve(res); 42 | }, 43 | fail (res) { 44 | reject(res); 45 | }, 46 | }); 47 | }); 48 | 49 | await services.scanLogin(code, uuid); 50 | }, 51 | 52 | async attemptRegister ({ dispatch }) { 53 | const { code } = await new Promise((resolve, reject) => { 54 | wx.login({ 55 | success (res) { 56 | resolve(res); 57 | }, 58 | fail (res) { 59 | reject(res); 60 | }, 61 | }); 62 | }); 63 | 64 | const userInfo = await new Promise((resolve, reject) => { 65 | wx.getUserInfo({ 66 | withCredentials: true, 67 | success (res) { 68 | resolve(res); 69 | }, 70 | fail (res) { 71 | reject(res); 72 | }, 73 | }); 74 | }); 75 | 76 | const { data } = await services.register(code, userInfo); 77 | 78 | await dispatch('setToken', data.access_token); 79 | 80 | dispatch('loadUser'); 81 | }, 82 | 83 | async setToken ({ commit }, token) { 84 | commit('setToken', token); 85 | }, 86 | 87 | async setUser ({ commit }, user) { 88 | commit('setUser', user); 89 | commit('setUnreadCount', user.cache.unread_count); 90 | }, 91 | 92 | async checkUserToken ({ dispatch, state }) { 93 | if (!isEmpty(state.token)) { 94 | return state.token; 95 | } 96 | 97 | const token = wx.getStorageSync(USER_TOKEN_STORAGE_KEY); 98 | if (isEmpty(token)) { 99 | return dispatch('attemptLogin'); 100 | } 101 | 102 | await dispatch('setToken', token); 103 | 104 | dispatch('loadUser'); 105 | }, 106 | 107 | async loadUser ({ dispatch }) { 108 | const { data } = await services.loadUserData(); 109 | dispatch('setUser', data); 110 | }, 111 | }, 112 | 113 | mutations: { 114 | setToken (state, token) { 115 | state.token = token; 116 | }, 117 | setUser (state, user) { 118 | state.user = user; 119 | }, 120 | setUnreadCount (state, unreadCount) { 121 | state.unread_count = unreadCount; 122 | }, 123 | }, 124 | }; 125 | -------------------------------------------------------------------------------- /src/vuex/index.js: -------------------------------------------------------------------------------- 1 | import Vuex from '@wepy/x'; 2 | import auth from './auth'; 3 | import { setToken as setTokenPlugin, createWebSocketPlugin } from './plugin'; 4 | 5 | export default new Vuex.Store({ 6 | modules: { 7 | auth, 8 | }, 9 | 10 | plugins: [setTokenPlugin, createWebSocketPlugin], 11 | }); 12 | -------------------------------------------------------------------------------- /src/vuex/plugin.js: -------------------------------------------------------------------------------- 1 | import Echo from 'laravel-echo'; 2 | // https://github.com/10cella/weapp.socket.io/issues/46#issuecomment-541518603 3 | import io from '@/libs/weapp.socket.io'; 4 | import { 5 | setToken as httpSetToken, 6 | setSocketId as httpSetSocketId, 7 | } from '@/utils/request'; 8 | 9 | export function setToken (store) { 10 | store.subscribe((mutation, { auth }) => { 11 | if (mutation.type === 'auth/setToken') { 12 | httpSetToken(auth.token); 13 | 14 | wx.setStorageSync(USER_TOKEN_STORAGE_KEY, auth.token); 15 | } 16 | }); 17 | } 18 | 19 | export function createWebSocketPlugin (store) { 20 | let echo; 21 | 22 | store.subscribe((mutation, { auth }) => { 23 | if (mutation.type === 'auth/setUser') { 24 | 25 | if (echo) { 26 | httpSetSocketId(''); 27 | echo.disconnect(); 28 | } 29 | 30 | echo = new Echo({ 31 | client: io, 32 | transports: ['websocket'], 33 | broadcaster: 'socket.io', 34 | host: SOCKET_HOST, 35 | withoutInterceptors: true, 36 | auth: { 37 | headers: { 38 | Authorization: `Bearer ${auth.token}`, 39 | }, 40 | }, 41 | }); 42 | 43 | httpSetSocketId(echo.socketId()); 44 | 45 | echo.private(`App.Models.User.${auth.user.id}`) 46 | .listen('UnreadNotificationsChange', (data) => { 47 | store.commit('auth/setUnreadCount', data.unread_count); 48 | }) 49 | .notification(notification => { 50 | console.info(notification); 51 | }); 52 | } 53 | }); 54 | } 55 | -------------------------------------------------------------------------------- /wepy.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const DefinePlugin = require('@wepy/plugin-define'); 3 | const PluginUglifyjs = require('@wepy/plugin-uglifyjs'); 4 | const prod = process.env.NODE_ENV === 'production'; 5 | 6 | const plugins = [ 7 | DefinePlugin({ 8 | API_URL: !prod ? '"https://api.blog.test/api/"' : '"https://www.einsition.com/api/"', 9 | SOCKET_HOST: !prod ? '"https://api.blog.test"' : '"https://www.einsition.com"', 10 | USER_TOKEN_STORAGE_KEY: '"APP_USER_TOKEN"', 11 | }), 12 | ]; 13 | 14 | if (prod) { 15 | plugins.push(PluginUglifyjs({})); 16 | } 17 | 18 | module.exports = { 19 | wpyExt: '.wpy', 20 | eslint: true, 21 | cliLogs: !prod, 22 | build: {}, 23 | static: [ 24 | 'src/static', 25 | 'src/components/weui/weui-wxss', 26 | ], 27 | resolve: { 28 | alias: { 29 | '@': path.resolve(__dirname, 'src'), 30 | }, 31 | aliasFields: ['wepy', 'weapp'], 32 | modules: ['node_modules'], 33 | }, 34 | compilers: { 35 | less: { 36 | compress: prod, 37 | }, 38 | babel: { 39 | sourceMap: !prod, 40 | presets: [ 41 | '@babel/preset-env', 42 | ], 43 | plugins: [ 44 | '@wepy/babel-plugin-import-regenerator', 45 | [ 46 | '@babel/plugin-proposal-decorators', 47 | { legacy: true }, 48 | ], 49 | ], 50 | }, 51 | }, 52 | plugins, 53 | appConfig: { 54 | noPromiseAPI: ['createSelectorQuery'], 55 | }, 56 | }; 57 | 58 | --------------------------------------------------------------------------------