├── .gitignore
├── miniprogram
├── miniprogram_npm
│ ├── mina-popups
│ │ ├── popup
│ │ │ ├── index.wxss
│ │ │ ├── func-visible
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.json
│ │ │ │ └── index.js
│ │ │ ├── border-position
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.js
│ │ │ │ └── index.wxss
│ │ │ ├── center-position
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.wxss
│ │ │ │ └── index.js
│ │ │ ├── fixed-position
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.wxml
│ │ │ │ └── index.js
│ │ │ ├── popup-backgroud
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.wxml
│ │ │ │ └── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.js
│ │ ├── popover
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ └── index.js
│ │ └── menu-popover
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ ├── mina-keyword-highlight
│ │ ├── index.wxss
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.js
│ ├── mina-tool
│ │ ├── components
│ │ │ ├── multi-picker
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ └── index.js
│ │ │ ├── data-status
│ │ │ │ ├── index.json
│ │ │ │ ├── index.js
│ │ │ │ ├── index.wxml
│ │ │ │ └── index.wxss
│ │ │ ├── error-img
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.wxml
│ │ │ │ └── index.js
│ │ │ ├── popup-fixed
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.wxml
│ │ │ │ └── index.js
│ │ │ └── popup-window
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.wxss
│ │ │ │ └── index.js
│ │ ├── style.wxss
│ │ ├── behaviors
│ │ │ └── listenPageEvent.js
│ │ ├── iconfont.wxss
│ │ └── wxs
│ │ │ └── format.wxs
│ ├── mitt
│ │ ├── index.js.map
│ │ └── index.js
│ ├── mina-countdown
│ │ ├── index.js.map
│ │ └── index.js
│ ├── tiny-timer
│ │ ├── index.js.map
│ │ └── index.js
│ └── mina-touch
│ │ └── index.js.map
├── .DS_Store
├── components
│ ├── collapse
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
│ ├── value-editor
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
│ ├── .DS_Store
│ ├── home-menu
│ │ ├── index.json
│ │ ├── index.js
│ │ ├── index.wxml
│ │ └── index.wxss
│ └── config-setter
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
├── pages
│ ├── mina-touch
│ │ ├── demo1
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ │ ├── demo2
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ │ ├── demo3
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ │ └── demo4
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ ├── mina-tool
│ │ ├── wxs
│ │ │ └── format
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.less
│ │ │ │ └── index.js
│ │ ├── wxss
│ │ │ └── common
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.less
│ │ │ │ └── index.js
│ │ ├── behavior
│ │ │ └── pageEvent
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.wxss
│ │ │ │ ├── index.less
│ │ │ │ └── index.js
│ │ └── components
│ │ │ ├── data-status
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ │ │ ├── error-img
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ │ │ ├── popup-window
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ └── index.js
│ │ │ └── multi-picker
│ │ │ ├── index.json
│ │ │ ├── index.wxss
│ │ │ ├── index.wxml
│ │ │ └── index.js
│ ├── mina-countdown
│ │ ├── demo1
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ └── index.js
│ │ └── demo2
│ │ │ ├── index.json
│ │ │ ├── index.wxss
│ │ │ ├── index.wxml
│ │ │ └── index.js
│ ├── mina-keyword-highlight
│ │ ├── demo1
│ │ │ ├── index.json
│ │ │ ├── index.js
│ │ │ ├── index.wxss
│ │ │ └── index.wxml
│ │ └── demo2
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ └── index.js
│ ├── mina-popups
│ │ ├── demo1
│ │ │ ├── index.json
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ ├── index.wxml
│ │ │ └── index.js
│ │ ├── demo4
│ │ │ ├── index.json
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ ├── index.wxml
│ │ │ └── index.js
│ │ ├── demo2
│ │ │ ├── index.json
│ │ │ ├── index.wxss
│ │ │ ├── index.less
│ │ │ ├── index.wxml
│ │ │ └── index.js
│ │ └── demo3
│ │ │ ├── index.json
│ │ │ ├── index.wxss
│ │ │ ├── index.wxml
│ │ │ ├── index.less
│ │ │ └── index.js
│ └── index
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
├── theme.wxss
├── app.wxss
├── sitemap.json
├── app.js
├── services
│ └── api.js
├── utils
│ ├── util.js
│ └── request.js
├── package.json
├── package-lock.json
├── app.json
├── globalStyle.wxss
├── yarn.lock
├── yarn-error.log
└── iconfont.wxss
├── .DS_Store
├── cloudfunctions
└── getQRCode
│ ├── config.json
│ ├── package.json
│ └── index.js
├── cloudfunctionTemplate
└── getQRCode.json
├── README.md
├── LICENSE
└── project.config.json
/.gitignore:
--------------------------------------------------------------------------------
1 | **/node_modules
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/index.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-keyword-highlight/index.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/func-visible/index.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/multi-picker/index.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Yrobot/mina-tools-client/HEAD/.DS_Store
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/style.wxss:
--------------------------------------------------------------------------------
1 | @import './iconfont.wxss';
--------------------------------------------------------------------------------
/miniprogram/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Yrobot/mina-tools-client/HEAD/miniprogram/.DS_Store
--------------------------------------------------------------------------------
/miniprogram/components/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/components/value-editor/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/multi-picker/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo1/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 多点操控"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo3/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 监听双击"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo4/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 监听长按"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxs/format/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxss/common/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/cloudfunctions/getQRCode/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "permissions": {
3 | "openapi": ["wxacode.createQRCode"]
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-keyword-highlight/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/behavior/pageEvent/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/components/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Yrobot/mina-tools-client/HEAD/miniprogram/components/.DS_Store
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/data-status/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/error-img/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/popup-window/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "mina-touch 普通滑动"
3 | }
4 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/func-visible/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo1/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarTitleText": "验证码发送倒计时"
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/border-position/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/center-position/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/fixed-position/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/func-visible/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/popup-backgroud/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/data-status/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/error-img/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-fixed/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
5 |
--------------------------------------------------------------------------------
/miniprogram/theme.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | --main-color: #2c2c2c;
3 | --tip-color: rgba(0, 0, 0, 0.45);
4 | --main-BG: #f8f8f8;
5 | }
6 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 |
4 | },
5 | "navigationBarTitleText": "时间结点倒计时"
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/error-img/index.wxss:
--------------------------------------------------------------------------------
1 | image{
2 | width: 100%;
3 | height: 100%;
4 | border-radius: inherit;
5 | }
--------------------------------------------------------------------------------
/miniprogram/components/home-menu/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "popover": "mina-popups/popover"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popover/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "popup": "../popup"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/components/config-setter/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "value-editor": "../value-editor"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/components/value-editor/index.wxss:
--------------------------------------------------------------------------------
1 | switch {
2 | transform-origin: right center;
3 | /* 32 * 0.75 = 24px */
4 | transform: scale(0.75);
5 | }
6 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/menu-popover/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "popover": "../popover"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/center-position/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-keyword-highlight/index.wxml:
--------------------------------------------------------------------------------
1 | {{item}}
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/border-position/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-window/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "popup-fixed": "../popup-fixed"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/cloudfunctionTemplate/getQRCode.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "qrcode",
4 | "value": {
5 | "page": "pages/mina-popups/demo3/index",
6 | "scene": "qrcode=1"
7 | }
8 | }
9 | ]
--------------------------------------------------------------------------------
/miniprogram/app.wxss:
--------------------------------------------------------------------------------
1 | @import './iconfont.wxss';
2 | @import './theme.wxss';
3 | @import './globalStyle.wxss';
4 |
5 | .reset-navigation-bar {
6 | position: relative;
7 | z-index: 99;
8 | }
9 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/fixed-position/index.wxss:
--------------------------------------------------------------------------------
1 | .popup-fixed-slot {
2 | position: fixed;
3 | z-index: 200;
4 | left: 0;
5 | top: 0;
6 | overflow: visible;
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo1/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "keyword-highlight": "mina-keyword-highlight"
4 | },
5 | "navigationBarTitleText": "文章关键词高亮"
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "keyword-highlight": "mina-keyword-highlight"
4 | },
5 | "navigationBarTitleText": "搜索结果关键词高亮"
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/popup-backgroud/index.wxss:
--------------------------------------------------------------------------------
1 | .popup-background {
2 | position: fixed;
3 | z-index: 100;
4 | left: 0;
5 | top: 0;
6 | right: 0;
7 | bottom: 0;
8 | }
9 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/error-img/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/miniprogram/components/collapse/index.wxss:
--------------------------------------------------------------------------------
1 | .collapse-holder {
2 | width: 100%;
3 | }
4 | .collapse-list-holder {
5 | width: 100%;
6 | /* transition 对于auto无效 */
7 | /* transition: height 0.2s; */
8 | }
9 |
--------------------------------------------------------------------------------
/miniprogram/components/config-setter/index.wxss:
--------------------------------------------------------------------------------
1 | /* components/config-setter/index.wxss */
2 | .config-line {
3 | width: 100%;
4 | min-height: 80rpx;
5 | padding: 10rpx 0;
6 | box-sizing: border-box;
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/center-position/index.wxss:
--------------------------------------------------------------------------------
1 | .center-position{
2 | position: fixed;
3 | z-index: 200;
4 | left: 50%;
5 | top: 50%;
6 | transform: translate(-50%,-50%);
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/fixed-position/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/multi-picker/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "multi-picker": "mina-tool/components/multi-picker"
4 | },
5 | "navigationBarTitleText": "多列选择组件 multi-picker"
6 | }
7 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/multi-picker/index.wxss:
--------------------------------------------------------------------------------
1 | /* pages/keyword-highlight/index.wxss */
2 | page {
3 | font-size: 14px;
4 | text-align: left;
5 | padding-top: 20rpx;
6 | padding-bottom: 20rpx;
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo1/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "popup组件展示",
3 | "usingComponents": {
4 | "popup": "mina-popups/popup",
5 | "config-setter": "../../../components/config-setter"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo4/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "popup组件展示",
3 | "usingComponents": {
4 | "popup": "mina-popups/popup",
5 | "config-setter": "../../../components/config-setter"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "popover组件展示",
3 | "usingComponents": {
4 | "popover": "mina-popups/popover",
5 | "config-setter": "../../../components/config-setter"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/menu-popover/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo3/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "menu-popover组件展示",
3 | "usingComponents": {
4 | "menu-popover": "mina-popups/menu-popover",
5 | "config-setter": "../../../components/config-setter"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/miniprogram/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {},
4 | globalData: {
5 | description: 'mina-tool是一个小程序开发工具库,对一些小程序原生开发过程中实用的逻辑进行封装。mina-tool包含4个维度:组件、wxs、behaviors、样式。mina-tool支持npm,安装使用简单方便。',
6 | shortDesc: 'mina-tool是一个小程序开发工具库',
7 | },
8 | });
9 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo1/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxs/format/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxss/common/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/multi-picker/index.wxml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/behavior/pageEvent/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/error-img/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/data-status/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/popup-window/index.wxml:
--------------------------------------------------------------------------------
1 |
3 | 左右滑动试试
4 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo4/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 | {{tip||'长按试试'}}
5 |
6 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/menu-popover/index.wxss:
--------------------------------------------------------------------------------
1 | .mine-mina-position {
2 | position: fixed;
3 | width: 1px;
4 | height: 1px;
5 | }
6 | .mine-mina-guide-holder .window {
7 | box-shadow: 0 0 8px 0px rgba(0, 0, 0, 0.16);
8 | }
9 | .mine-mina-guide-holder .position {
10 | z-index: 99;
11 | }
12 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo3/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 双击试试
5 |
6 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/menu-popover/index.less:
--------------------------------------------------------------------------------
1 | .mine-mina-position {
2 | position: fixed;
3 | width: 1px;
4 | height: 1px;
5 | }
6 |
7 | .mine-mina-guide-holder {
8 | .window {
9 | box-shadow: 0 0 8px 0px rgba(0, 0, 0, 0.16);
10 | }
11 | .position {
12 | z-index: 99;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationStyle": "custom",
3 | "enablePullDownRefresh": false,
4 | "usingComponents": {
5 | "mp-navigation-bar": "weui-miniprogram/navigation-bar/navigation-bar",
6 | "home-menu": "../../components/home-menu",
7 | "collapse": "../../components/collapse"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/miniprogram/components/collapse/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-fixed/index.wxss:
--------------------------------------------------------------------------------
1 | .popup-BG {
2 | position: fixed;
3 | z-index: 100;
4 | left: 0;
5 | top: 0;
6 | right: 0;
7 | bottom: 0;
8 | }
9 |
10 | .popup-fixed-slot {
11 | position: fixed;
12 | z-index: 200;
13 | left: 0;
14 | top: 0;
15 | overflow: visible;
16 | }
17 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo2/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 多指控制试试
5 |
6 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/center-position/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @description center-position
3 | * 渲染slot在屏幕中间位置
4 | * @author Yrobot
5 | * @date 22/01/2021
6 | */
7 | Component({
8 | properties: {},
9 | observers: {},
10 | data: {},
11 | lifetimes: {
12 | ready() {},
13 | },
14 | methods: {},
15 | });
16 |
--------------------------------------------------------------------------------
/cloudfunctions/getQRCode/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "login",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "wx-server-sdk": "~2.3.2"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "fixed-position": "./fixed-position",
5 | "center-position": "./center-position",
6 | "border-position": "./border-position",
7 | "func-visible": "./func-visible",
8 | "popup-backgroud": "./popup-backgroud"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo2/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/popup-backgroud/index.wxml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/data-status/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | options: {
3 | addGlobalClass: true,
4 | },
5 | properties: {
6 | minHeight: {
7 | type: String,
8 | value: '600rpx',
9 | },
10 | loading: {
11 | type: Boolean,
12 | value: false,
13 | },
14 | empty: {
15 | type: Boolean,
16 | value: false,
17 | },
18 | },
19 | });
20 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/border-position/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @description border-position
3 | * 渲染slot在屏幕边界
4 | * @author Yrobot
5 | * @date 20/02/2021
6 | */
7 | Component({
8 | properties: {
9 | border: {
10 | type: String,
11 | value: 'top', // top,right,bottom,left
12 | },
13 | },
14 | observers: {},
15 | data: {},
16 | lifetimes: {
17 | ready() {},
18 | },
19 | methods: {},
20 | });
21 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxs/format/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo1/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxss/common/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/behavior/pageEvent/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/error-img/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo1/index.js:
--------------------------------------------------------------------------------
1 | // pages/keyword-highlight/index.js
2 |
3 | const { description, shortDesc } = getApp().globalData;
4 | Page({
5 | data: {
6 | shortText: shortDesc,
7 | text: description,
8 | key: 'mina-tool',
9 | color: 'red',
10 | },
11 | onShareAppMessage(res) {
12 | return {
13 | title: '这个小程序开发工具很实用哦~',
14 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
15 | };
16 | },
17 | });
18 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/data-status/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/popup-window/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 | .box {
7 | position: relative;
8 | width: 300px;
9 | height: 100%;
10 | background-color: var(--main-color);
11 | }
12 | .box .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo2/index.wxss:
--------------------------------------------------------------------------------
1 | .countdown-box {
2 | width: 100%;
3 | height: 500rpx;
4 | line-height: 500rpx;
5 | font-size: 40px;
6 | font-weight: 600;
7 | color: var(--main-color);
8 | text-align: center;
9 | }
10 |
11 | .button-list {
12 | width: 100%;
13 | display: flex;
14 | flex-direction: column;
15 | align-items: center;
16 | justify-content: center;
17 | }
18 | .button {
19 | width: 200rpx;
20 | margin-bottom: 50rpx;
21 | }
22 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mitt/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["mitt.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA","file":"index.js","sourcesContent":["module.exports=function(n){return{all:n=n||new Map,on:function(e,t){var i=n.get(e);i&&i.push(t)||n.set(e,[t])},off:function(e,t){var i=n.get(e);i&&i.splice(i.indexOf(t)>>>0,1)},emit:function(e,t){(n.get(e)||[]).slice().map(function(n){n(t)}),(n.get(\"*\")||[]).slice().map(function(n){n(e,t)})}}};\n//# sourceMappingURL=mitt.js.map\n"]}
--------------------------------------------------------------------------------
/miniprogram/services/api.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Service 层
3 | */
4 | import request from '../utils/request';
5 |
6 | /**
7 | * 利用百度获取搜索关键词
8 | */
9 | export const getSearchSuggestion = (key = '') => {
10 | return request(`https://www.baidu.com/sugrec?prod=pc&wd=${key}`, {
11 | method: 'GET',
12 | })
13 | .then((res) => {
14 | return ((res && res.g) || []).map((v) => v.q);
15 | })
16 | .then((res) => {
17 | console.log(res)
18 | return res
19 | });
20 | };
21 |
--------------------------------------------------------------------------------
/miniprogram/components/value-editor/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{value}}
4 |
5 |
6 |
7 |
8 | {{value}}
9 |
10 |
11 |
12 | {{value}}
13 |
14 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/border-position/index.wxss:
--------------------------------------------------------------------------------
1 | .border-position {
2 | position: fixed;
3 | z-index: 200;
4 | min-height: 20px;
5 | min-width: 20px;
6 | }
7 |
8 | .left {
9 | left: 0;
10 | top: 0;
11 | height: 100%;
12 | }
13 |
14 | .right {
15 | right: 0;
16 | top: 0;
17 | height: 100%;
18 | }
19 |
20 | .top {
21 | left: 0;
22 | top: 0;
23 | width: 100%;
24 | }
25 |
26 | .bottom {
27 | left: 0;
28 | bottom: 0;
29 | width: 100%;
30 | }
31 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo1/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/data-status/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 暂时没有数据
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxs/format/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxss/common/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/behavior/pageEvent/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/data-status/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/error-img/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/components/config-setter/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{box.title}}
3 |
4 | {{item.name}}
5 |
7 |
8 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/popup-window/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | width: 100%;
3 | height: 100%;
4 | padding: 0;
5 | }
6 |
7 | .box {
8 | position: relative;
9 | width: 300px;
10 | height: 100%;
11 | background-color: var(--main-color);
12 | .tips {
13 | position: absolute;
14 | width: 100%;
15 | text-align: right;
16 | right: 20px;
17 | top: 50%;
18 | transform: translate(0, -50%);
19 | color: #fff;
20 | font-size: 16px;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo2/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{format.formatCountdown(countdown,'hh:mm:ss')}}
3 |
4 | 倒计时1小时
5 | 倒计时1分钟
6 | 倒计时3秒
7 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo3/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 | .bottom-area-size {
6 | width: 100%;
7 | height: 120rpx;
8 | box-sizing: content-box;
9 | padding-bottom: 30px;
10 | }
11 | .bottom-area-position {
12 | position: fixed;
13 | bottom: 0;
14 | left: 0;
15 | }
16 | .popover-inner .tip {
17 | padding: 0 8px;
18 | white-space: nowrap;
19 | }
20 | .popover-inner .close {
21 | width: 20px;
22 | height: 20px;
23 | line-height: 20px;
24 | text-align: center;
25 | color: #666;
26 | }
27 |
--------------------------------------------------------------------------------
/miniprogram/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | module.exports = {
18 | formatTime: formatTime
19 | }
20 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo3/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 打开menu-popover
6 |
7 |
8 |
9 |
10 | 点击 ...“添加到我的小程序”\n领币更方便
11 | X
12 |
13 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-fixed/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
9 |
--------------------------------------------------------------------------------
/miniprogram/components/config-setter/index.js:
--------------------------------------------------------------------------------
1 | // components/config-setter/index.js
2 | Component({
3 | options: {
4 | addGlobalClass: true,
5 | },
6 | /**
7 | * 组件的属性列表
8 | */
9 | properties: {
10 | config: Array,
11 | data: Object,
12 | },
13 |
14 | /**
15 | * 组件的初始数据
16 | */
17 | data: {},
18 |
19 | /**
20 | * 组件的方法列表
21 | */
22 | methods: {
23 | configChange(e) {
24 | const value = e.detail.value;
25 | const key = e.currentTarget.dataset.key;
26 | this.triggerEvent('change', {
27 | [key]: value,
28 | });
29 | },
30 | },
31 | });
32 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo3/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 |
6 | .bottom-area-size {
7 | width: 100%;
8 | height: 120rpx;
9 | box-sizing: content-box;
10 | padding-bottom: 30px;
11 | }
12 |
13 | .bottom-area-position {
14 | position: fixed;
15 | bottom: 0;
16 | left: 0;
17 | }
18 |
19 | .popover-inner {
20 | .tip {
21 | padding: 0 8px;
22 | white-space: nowrap;
23 | }
24 | .close {
25 | width: 20px;
26 | height: 20px;
27 | line-height: 20px;
28 | text-align: center;
29 | color: #666;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-window/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo2/index.wxss:
--------------------------------------------------------------------------------
1 | .background {
2 | position: relative;
3 | width: 100%;
4 | height: 100%;
5 | overflow: hidden;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | }
10 | .background .box {
11 | width: 300rpx;
12 | height: 500rpx;
13 | background-color: var(--main-color);
14 | }
15 | .background .box .tips {
16 | position: absolute;
17 | width: 100%;
18 | text-align: center;
19 | left: 50%;
20 | top: 50%;
21 | color: #fff;
22 | font-size: 16px;
23 | transform: translate(-50%, -50%);
24 | }
25 | page {
26 | width: 100%;
27 | height: 100%;
28 | padding: 0;
29 | }
30 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo3/index.wxss:
--------------------------------------------------------------------------------
1 | .background {
2 | position: relative;
3 | width: 100%;
4 | height: 100%;
5 | overflow: hidden;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | }
10 | .background .box {
11 | width: 300rpx;
12 | height: 500rpx;
13 | background-color: var(--main-color);
14 | }
15 | .background .box .tips {
16 | position: absolute;
17 | width: 100%;
18 | text-align: center;
19 | left: 50%;
20 | top: 50%;
21 | color: #fff;
22 | font-size: 16px;
23 | transform: translate(-50%, -50%);
24 | }
25 | page {
26 | width: 100%;
27 | height: 100%;
28 | padding: 0;
29 | }
30 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo4/index.wxss:
--------------------------------------------------------------------------------
1 | .background {
2 | position: relative;
3 | width: 100%;
4 | height: 100%;
5 | overflow: hidden;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | }
10 | .background .box {
11 | width: 300rpx;
12 | height: 500rpx;
13 | background-color: var(--main-color);
14 | }
15 | .background .box .tips {
16 | position: absolute;
17 | width: 100%;
18 | text-align: center;
19 | left: 50%;
20 | top: 50%;
21 | color: #fff;
22 | font-size: 16px;
23 | transform: translate(-50%, -50%);
24 | }
25 | page {
26 | width: 100%;
27 | height: 100%;
28 | padding: 0;
29 | }
30 |
--------------------------------------------------------------------------------
/miniprogram/components/home-menu/index.js:
--------------------------------------------------------------------------------
1 | const app = getApp();
2 |
3 | Component({
4 | behaviors: ['wx://component-export'],
5 | export() {
6 | this.popupWindow = this.selectComponent('#popup-window');
7 | return this.popupWindow;
8 | },
9 | options: {
10 | addGlobalClass: true,
11 | },
12 | properties: {
13 | selector: {
14 | type: String,
15 | value: '',
16 | },
17 | },
18 | observers: {},
19 | data: {},
20 | popupWindow: { open() {}, close() {} },
21 | lifetimes: {
22 | ready() {},
23 | },
24 | methods: {
25 | tapMenu() {
26 | // this.popupWindow.close();
27 | },
28 | },
29 | });
30 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo2/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding: 30rpx;
3 | }
4 |
5 | .search-input {
6 | width: 100%;
7 | height: 120rpx;
8 | line-height: 120rpx;
9 | background-color: #fff;
10 | box-sizing: border-box;
11 | padding: 0 20rpx;
12 | }
13 |
14 | .list-holder {
15 | width: 100%;
16 | padding: 0 20rpx;
17 | box-sizing: border-box;
18 | background-color: #fff;
19 | border-top: 1px solid rgba(0, 0, 0, 0.1);
20 | color: #666;
21 | }
22 |
23 | .item {
24 | width: 100%;
25 | height: 40px;
26 | line-height: 40px;
27 | overflow: hidden;
28 | white-space: nowrap;
29 | text-overflow: ellipsis;
30 | border-bottom: 1px solid rgba(0, 0, 0, 0.1);
31 | }
32 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo2/index.less:
--------------------------------------------------------------------------------
1 | .background {
2 | position: relative;
3 | width: 100%;
4 | height: 100%;
5 | overflow: hidden;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | .box {
10 | width: 300rpx;
11 | height: 500rpx;
12 | background-color: var(--main-color);
13 | .tips {
14 | position: absolute;
15 | width: 100%;
16 | text-align: center;
17 | left: 50%;
18 | top: 50%;
19 | color: #fff;
20 | font-size: 16px;
21 | transform: translate(-50%, -50%);
22 | }
23 | }
24 | }
25 |
26 | page {
27 | width: 100%;
28 | height: 100%;
29 | padding: 0;
30 | }
31 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo3/index.less:
--------------------------------------------------------------------------------
1 | .background {
2 | position: relative;
3 | width: 100%;
4 | height: 100%;
5 | overflow: hidden;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | .box {
10 | width: 300rpx;
11 | height: 500rpx;
12 | background-color: var(--main-color);
13 | .tips {
14 | position: absolute;
15 | width: 100%;
16 | text-align: center;
17 | left: 50%;
18 | top: 50%;
19 | color: #fff;
20 | font-size: 16px;
21 | transform: translate(-50%, -50%);
22 | }
23 | }
24 | }
25 |
26 | page {
27 | width: 100%;
28 | height: 100%;
29 | padding: 0;
30 | }
31 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo4/index.less:
--------------------------------------------------------------------------------
1 | .background {
2 | position: relative;
3 | width: 100%;
4 | height: 100%;
5 | overflow: hidden;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | .box {
10 | width: 300rpx;
11 | height: 500rpx;
12 | background-color: var(--main-color);
13 | .tips {
14 | position: absolute;
15 | width: 100%;
16 | text-align: center;
17 | left: 50%;
18 | top: 50%;
19 | color: #fff;
20 | font-size: 16px;
21 | transform: translate(-50%, -50%);
22 | }
23 | }
24 | }
25 |
26 | page {
27 | width: 100%;
28 | height: 100%;
29 | padding: 0;
30 | }
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # mina-tools-client
2 |
3 | 本代码库主要用于展示 Yrobot 开发的一些微信小程序三方库的效果和交互
4 |
5 | ## 小程序二维码
6 |
7 | 
8 |
9 | ## 三方库列表
10 |
11 | ### mina-touch
12 |
13 | **作用**:监听小程序原生的事件,分发复杂 touch 事件
14 | **GitHub**:[https://github.com/Yrobot/mina-touch](https://github.com/Yrobot/mina-touch)
15 |
16 | ### mina-tool
17 |
18 | **作用**:打包一些小程序开发中实用的组件和样式,区别于常见的小程序组件库,本库主要是打包一些不常见的组件,比如 float-popup、float-menu、data-status、_etc_
19 | **GitHub**:[https://github.com/Yrobot/mina-tool](https://github.com/Yrobot/mina-tool)
20 |
21 | ### mina-popups
22 |
23 | **作用**:一个原生、方便、轻量的小程序弹出组件集合
24 | **GitHub**:[https://github.com/Yrobot/mina-popups](https://github.com/Yrobot/mina-popups)
25 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popover/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/multi-picker/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | 使用原生picker
3 |
5 | 当前选择:{{multiArray[0][value[0]]}},{{multiArray[1][value[1]]}},{{multiArray[2][value[2]]}}
6 |
7 |
8 |
9 | 使用multi-picker
10 |
11 | 当前选择:{{multiPickerArray[0][multiValue[0]]}},{{multiPickerArray[1][multiValue[1]]}},{{multiPickerArray[2][multiValue[2]]}}
12 |
13 |
--------------------------------------------------------------------------------
/miniprogram/components/collapse/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | extClass: {
4 | type: String,
5 | value: '',
6 | },
7 | open: {
8 | type: Boolean,
9 | value: false,
10 | },
11 | },
12 | options: {
13 | addGlobalClass: true,
14 | multipleSlots: true, // 在组件定义时的选项中启用多slot支持
15 | },
16 | data: {
17 | _open: false,
18 | },
19 | observers: {
20 | open(open) {
21 | if (open !== undefined) {
22 | this.setData({
23 | _open: open,
24 | });
25 | }
26 | },
27 | },
28 | lifetimes: {},
29 | methods: {
30 | switchOpen() {
31 | this.setData({
32 | _open: !this.data._open,
33 | });
34 | },
35 | },
36 | });
37 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo1/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 | .fixed-selectors-holder {
6 | width: 100%;
7 | padding: 20rpx 0;
8 | }
9 | .fixed-selectors-holder .fixed-selector {
10 | background-color: var(--main-color);
11 | color: #fff;
12 | padding: 4px 6px;
13 | }
14 | .popup-inner {
15 | width: 100%;
16 | height: 100%;
17 | min-width: 200rpx;
18 | min-height: 120rpx;
19 | font-size: 30px;
20 | font-weight: 800;
21 | background-color: var(--main-color);
22 | color: #fff;
23 | }
24 | .bottom-area-size {
25 | width: 100%;
26 | height: 120rpx;
27 | box-sizing: content-box;
28 | padding-bottom: 30px;
29 | }
30 | .bottom-area-position {
31 | position: fixed;
32 | bottom: 0;
33 | left: 0;
34 | }
35 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo4/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 | .fixed-selectors-holder {
6 | width: 100%;
7 | padding: 20rpx 0;
8 | }
9 | .fixed-selectors-holder .fixed-selector {
10 | background-color: var(--main-color);
11 | color: #fff;
12 | padding: 4px 6px;
13 | }
14 | .popup-inner {
15 | width: 100%;
16 | height: 100%;
17 | min-width: 200rpx;
18 | min-height: 120rpx;
19 | font-size: 30px;
20 | font-weight: 800;
21 | background-color: var(--main-color);
22 | color: #fff;
23 | }
24 | .bottom-area-size {
25 | width: 100%;
26 | height: 120rpx;
27 | box-sizing: content-box;
28 | padding-bottom: 30px;
29 | }
30 | .bottom-area-position {
31 | position: fixed;
32 | bottom: 0;
33 | left: 0;
34 | }
35 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/func-visible/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @description func-visible
3 | * 支持使用 this.selectComponent 获取组件实例后,函数式控制visible
4 | * @author Yrobot
5 | * @date 22/01/2021
6 | */
7 | Component({
8 | behaviors: ['wx://component-export'],
9 | export() {
10 | return {
11 | open: this._open.bind(this),
12 | close: this._close.bind(this),
13 | };
14 | },
15 | options: {},
16 | properties: {},
17 | observers: {},
18 | data: {
19 | visible: false,
20 | },
21 | lifetimes: {
22 | ready() {},
23 | },
24 | methods: {
25 | _open() {
26 | this.setData({
27 | visible: true,
28 | });
29 | },
30 | _close() {
31 | this.setData({
32 | visible: false,
33 | });
34 | },
35 | },
36 | });
37 |
--------------------------------------------------------------------------------
/miniprogram/components/value-editor/index.js:
--------------------------------------------------------------------------------
1 | // components/value-editor/index.js
2 | Component({
3 | options: {
4 | addGlobalClass: true,
5 | },
6 | /**
7 | * 组件的属性列表
8 | */
9 | properties: {
10 | value: null,
11 | typeData: null,
12 | type: String,
13 | disable: Boolean,
14 | },
15 |
16 | /**
17 | * 组件的初始数据
18 | */
19 | data: {},
20 |
21 | /**
22 | * 组件的方法列表
23 | */
24 | methods: {
25 | change(e) {
26 | console.log(e.detail);
27 | const { type, typeData } = this.data;
28 | const _v = e.detail.value;
29 | var value = _v;
30 | switch (type) {
31 | case 'PICKER':
32 | value = typeData[_v];
33 | break;
34 | }
35 | this.triggerEvent('change', { value });
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/miniprogram/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mina-tools-client",
3 | "version": "1.0.0",
4 | "description": "mina-tools的小程序客户端代码,用于mina-tools的效果展示",
5 | "main": "app.js",
6 | "dependencies": {
7 | "mina-countdown": "^1.0.1",
8 | "mina-keyword-highlight": "^1.0.0",
9 | "mina-tool": "^1.0.0",
10 | "mina-popups": "^1.0.0",
11 | "mina-touch": "^1.0.1"
12 | },
13 | "devDependencies": {},
14 | "scripts": {},
15 | "repository": {
16 | "type": "git",
17 | "url": "git+https://github.com/Yrobot/mina-tools-client.git"
18 | },
19 | "keywords": [
20 | "Yrobot"
21 | ],
22 | "author": "Yrobot",
23 | "license": "ISC",
24 | "bugs": {
25 | "url": "https://github.com/Yrobot/mina-tools-client/issues"
26 | },
27 | "homepage": "https://github.com/Yrobot/mina-tools-client#readme"
28 | }
29 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo1/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 |
6 | .fixed-selectors-holder {
7 | width: 100%;
8 | padding: 20rpx 0;
9 | .fixed-selector {
10 | background-color: var(--main-color);
11 | color: #fff;
12 | padding: 4px 6px;
13 | }
14 | }
15 |
16 | .popup-inner {
17 | width: 100%;
18 | height: 100%;
19 | min-width: 200rpx;
20 | min-height: 120rpx;
21 | font-size: 30px;
22 | font-weight: 800;
23 | background-color: var(--main-color);
24 | color: #fff;
25 | }
26 |
27 | .bottom-area-size {
28 | width: 100%;
29 | height: 120rpx;
30 | box-sizing: content-box;
31 | padding-bottom: 30px;
32 | }
33 |
34 | .bottom-area-position {
35 | position: fixed;
36 | bottom: 0;
37 | left: 0;
38 | }
39 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo4/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 |
6 | .fixed-selectors-holder {
7 | width: 100%;
8 | padding: 20rpx 0;
9 | .fixed-selector {
10 | background-color: var(--main-color);
11 | color: #fff;
12 | padding: 4px 6px;
13 | }
14 | }
15 |
16 | .popup-inner {
17 | width: 100%;
18 | height: 100%;
19 | min-width: 200rpx;
20 | min-height: 120rpx;
21 | font-size: 30px;
22 | font-weight: 800;
23 | background-color: var(--main-color);
24 | color: #fff;
25 | }
26 |
27 | .bottom-area-size {
28 | width: 100%;
29 | height: 120rpx;
30 | box-sizing: content-box;
31 | padding-bottom: 30px;
32 | }
33 |
34 | .bottom-area-position {
35 | position: fixed;
36 | bottom: 0;
37 | left: 0;
38 | }
39 |
--------------------------------------------------------------------------------
/miniprogram/utils/request.js:
--------------------------------------------------------------------------------
1 | export default function request(url, options = {}) {
2 | return new Promise((resolve, reject) => {
3 | wx.request({
4 | url,
5 | method: options.method ? options.method : 'GET',
6 | data: options.body,
7 | header: {
8 | Accept: 'application/json',
9 | 'Content-Type': 'application/json',
10 | ...(options.header || {}),
11 | },
12 | success(res) {
13 | if (res.statusCode === 200) {
14 | resolve(res.data);
15 | } else {
16 | reject(res.data);
17 | }
18 | },
19 | fail(error) {
20 | reject(error.data);
21 | },
22 | });
23 | }).catch((err) => {
24 | console.error(err);
25 | wx.showToast({
26 | title: '哎呀,请求出错啦',
27 | icon: 'none',
28 | duration: 1000,
29 | });
30 | throw err;
31 | });
32 | }
33 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo1/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 |
11 | 获取验证码
12 | {{countdown}}秒后可重新发送
13 |
14 |
15 |
16 | 登录
17 |
18 |
--------------------------------------------------------------------------------
/miniprogram/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mina-tools-client",
3 | "version": "1.0.0",
4 | "lockfileVersion": 2,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "mina-tools-client",
9 | "version": "1.0.0",
10 | "license": "ISC",
11 | "dependencies": {
12 | "mina-touch": "^1.0.1"
13 | },
14 | "devDependencies": {}
15 | },
16 | "node_modules/mina-touch": {
17 | "version": "1.0.1",
18 | "resolved": "https://registry.npmjs.org/mina-touch/-/mina-touch-1.0.1.tgz",
19 | "integrity": "sha512-6TLG639zSDCUwmw1pZIdWRKiQGrSJzHmcIDgZhA6xujdJntY/q2IV/G2kRaVuOz/pjwEavfIEkWIMEQohOiHjA=="
20 | }
21 | },
22 | "dependencies": {
23 | "mina-touch": {
24 | "version": "1.0.1",
25 | "resolved": "https://registry.npmjs.org/mina-touch/-/mina-touch-1.0.1.tgz",
26 | "integrity": "sha512-6TLG639zSDCUwmw1pZIdWRKiQGrSJzHmcIDgZhA6xujdJntY/q2IV/G2kRaVuOz/pjwEavfIEkWIMEQohOiHjA=="
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/popup-backgroud/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @description popup-backgroud
3 | * 处理popup背景的逻辑:
4 | * 开启背景
5 | * 背景色
6 | * 阻塞滚动
7 | * 滚动关闭
8 | * 点击关闭
9 | * @author Yrobot
10 | * @date 22/01/2021
11 | */
12 | Component({
13 | options: {},
14 | properties: {
15 | color: {
16 | type: String,
17 | value: '',
18 | },
19 | tapClose: {
20 | type: Boolean,
21 | value: true,
22 | },
23 | scrollClose: {
24 | type: Boolean,
25 | value: false,
26 | },
27 | catchScroll: {
28 | type: Boolean,
29 | value: true,
30 | },
31 | },
32 | observers: {},
33 | data: {},
34 | lifetimes: {
35 | ready() {},
36 | },
37 | methods: {
38 | moveBG() {
39 | if (this.data.scrollClose) {
40 | this.triggerEvent('close');
41 | }
42 | },
43 | tapBG() {
44 | if (this.data.tapClose) {
45 | this.triggerEvent('close');
46 | }
47 | },
48 | },
49 | });
50 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo1/index.wxss:
--------------------------------------------------------------------------------
1 | /* pages/keyword-highlight/index.wxss */
2 | page {
3 | font-size: 14px;
4 | text-align: left;
5 | padding-top: 20rpx;
6 | padding-bottom: 20rpx;
7 | }
8 |
9 | .card .list > keyword-highlight {
10 | margin-top: 10px;
11 | }
12 |
13 | .one-line {
14 | display: block;
15 | width: 100%;
16 | overflow: hidden;
17 | white-space: nowrap;
18 | text-overflow: ellipsis;
19 | }
20 |
21 | .two-line {
22 | width: 100%;
23 |
24 | display: -webkit-box;
25 | overflow: hidden;
26 | text-overflow: ellipsis;
27 | word-break: break-all;
28 | -webkit-box-orient: vertical;
29 | -webkit-line-clamp: 2;
30 | }
31 |
32 | .width100p {
33 | display: block;
34 | width: 100%;
35 | }
36 |
37 | .font-big {
38 | font-size: 16px;
39 | }
40 | .font-color {
41 | color: green;
42 | }
43 | .font-align {
44 | text-align: right;
45 | }
46 | .font-weight {
47 | font-weight: bold;
48 | }
49 | .font-style {
50 | font-style: italic;
51 | }
52 |
--------------------------------------------------------------------------------
/cloudfunctions/getQRCode/index.js:
--------------------------------------------------------------------------------
1 | // 云函数模板
2 | // 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署”
3 |
4 | const cloud = require('wx-server-sdk');
5 |
6 | // 初始化 cloud
7 | cloud.init({
8 | // API 调用都保持和云函数当前所在环境一致
9 | env: cloud.DYNAMIC_CURRENT_ENV,
10 | });
11 |
12 | /**
13 | * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端
14 | *
15 | * event 参数包含小程序端调用传入的 data
16 | *
17 | */
18 | exports.main = async (event, context) => {
19 | const { page = 'pages/index/index', scene = 'qrcode=1', width = 430 } = event || {};
20 | const { buffer } = await cloud.openapi.wxacode.getUnlimited({
21 | page,
22 | scene,
23 | width,
24 | });
25 | const { fileID } = await cloud.uploadFile({
26 | cloudPath: `QRCode/${page.replace(/\//g, '-')}_${scene}.jpg`,
27 | fileContent: buffer,
28 | });
29 | const { fileList = [] } = await cloud.getTempFileURL({
30 | fileList: [
31 | {
32 | fileID: fileID,
33 | maxAge: 0,
34 | },
35 | ],
36 | });
37 | return {
38 | url: fileList[0].tempFileURL,
39 | };
40 | };
41 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo2/index.js:
--------------------------------------------------------------------------------
1 | import { getSearchSuggestion } from '../../../services/api';
2 |
3 | const THROTTLE = 300;
4 |
5 | Page({
6 | data: {
7 | list: [],
8 | keyword: '',
9 | initSearch: '小程序',
10 | },
11 | onLoad() {
12 | if (this.data.initSearch) this.getSuggestions(this.data.initSearch);
13 | },
14 | inputChage(e) {
15 | const value = e.detail.value;
16 | if (!value) return;
17 | if (this.lastSearch && Date.now() - this.lastSearch < THROTTLE) {
18 | return;
19 | }
20 | this.lastSearch = Date.now();
21 | this.timerId = setTimeout(() => {
22 | this.getSuggestions(value);
23 | }, THROTTLE);
24 | },
25 | getSuggestions(key) {
26 | getSearchSuggestion(key).then((list) => {
27 | this.setData({
28 | keyword: key,
29 | list,
30 | });
31 | });
32 | },
33 | onShareAppMessage(res) {
34 | return {
35 | title: '这个小程序开发工具很实用哦~',
36 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
37 | };
38 | },
39 | });
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Yrobot
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo3/index.js:
--------------------------------------------------------------------------------
1 | const CONFIG_INTRODUCTION = {
2 | title: 'menu-popover简介',
3 | list: [
4 | {
5 | name: 'menu-popover是自动定位到胶囊菜单下方的popover',
6 | tip: true,
7 | },
8 | {
9 | name: '主要应用场景是引导用户操作菜单,如:添加到我的小程序',
10 | tip: true,
11 | },
12 | {
13 | name: '自适应navigationStyle:custom页面,使用者无需手动适配',
14 | tip: true,
15 | },
16 | {
17 | name: '优化popover的z-index为99,保证在其他popup的mask(z-index:100)之下',
18 | tip: true,
19 | },
20 | ],
21 | };
22 |
23 | Component({
24 | data: {
25 | top_tip: [CONFIG_INTRODUCTION],
26 | show: true,
27 | },
28 | observers: {},
29 | onLoad: function (options) {},
30 | methods: {
31 | configChange(e) {},
32 | open() {
33 | this.setData({
34 | show: true,
35 | });
36 | },
37 | close() {
38 | this.setData({
39 | show: false,
40 | });
41 | },
42 | onShareAppMessage(res) {
43 | return {
44 | title: '这个小程序开发工具很实用哦~',
45 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
46 | };
47 | },
48 | },
49 | });
50 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-keyword-highlight/demo1/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | 支持单行文本溢出省略
3 |
4 |
5 |
6 | 支持多行文本溢出省略
7 |
8 |
9 |
10 | 支持高亮颜色修改
11 |
12 |
13 |
14 | 原文展示
15 |
16 |
17 |
18 | 支持外部文字样式继承
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/miniprogram/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/mina-tool/components/popup-window/index",
5 | "pages/mina-tool/components/data-status/index",
6 | "pages/mina-tool/components/multi-picker/index",
7 | "pages/mina-tool/components/error-img/index",
8 | "pages/mina-tool/wxs/format/index",
9 | "pages/mina-tool/wxss/common/index",
10 | "pages/mina-tool/behavior/pageEvent/index",
11 | "pages/mina-keyword-highlight/demo1/index",
12 | "pages/mina-keyword-highlight/demo2/index",
13 | "pages/mina-countdown/demo1/index",
14 | "pages/mina-countdown/demo2/index",
15 | "pages/mina-popups/demo1/index",
16 | "pages/mina-popups/demo2/index",
17 | "pages/mina-popups/demo3/index",
18 | "pages/mina-touch/demo1/index",
19 | "pages/mina-touch/demo2/index",
20 | "pages/mina-touch/demo3/index",
21 | "pages/mina-touch/demo4/index"
22 | ],
23 | "window": {
24 | "backgroundTextStyle": "light",
25 | "navigationBarBackgroundColor": "#fff",
26 | "navigationBarTitleText": "小程序实用库展示",
27 | "navigationBarTextStyle": "black"
28 | },
29 | "style": "v2",
30 | "sitemapLocation": "sitemap.json",
31 | "useExtendedLib": {
32 | "weui": true
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/miniprogram/components/home-menu/index.wxml:
--------------------------------------------------------------------------------
1 |
29 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo1/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | #lefttop
3 | #righttop
4 |
5 |
6 |
7 | #leftbottom
8 | #rightbottom
9 |
10 |
11 |
12 |
13 | 打开popup
14 |
15 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo4/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | #lefttop
3 | #righttop
4 |
5 |
6 |
7 | #leftbottom
8 | #rightbottom
9 |
10 |
11 |
12 |
13 | 打开popup
14 |
15 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/multi-picker/index.js:
--------------------------------------------------------------------------------
1 | const getRangeData = (arr) => {
2 | const LEN = 3;
3 | return [...arr].map((v, i) => {
4 | if (i == 0) {
5 | return [...Array(LEN)].map((v, i) => i + 1);
6 | } else {
7 | const pre = arr
8 | .slice(0, i)
9 | .map((v) => v + 1)
10 | .join('');
11 | return [...Array(LEN + i)].map((v, i) => pre + (i + 1));
12 | }
13 | });
14 | };
15 |
16 | Page({
17 | data: {
18 | multiArray: getRangeData([0, 0, 0]),
19 | value: [0, 0, 0],
20 | multiPickerArray: getRangeData([0, 0, 0]),
21 | multiValue: [0, 0, 0],
22 | getRanges: () => [],
23 | },
24 | onLoad() {
25 | this.setData({
26 | getRanges: getRangeData,
27 | });
28 | },
29 | onFilterChange(e) {
30 | this.setData({
31 | multiValue: e.detail.value,
32 | multiPickerArray: getRangeData(e.detail.value),
33 | });
34 | },
35 | bindMultiPickerChange(e) {
36 | this.setData({
37 | value: e.detail.value,
38 | });
39 | },
40 | bindMultiPickerColumnChange(e) {
41 | const { column, value } = e.detail;
42 | var newValue = [...this.data.value];
43 | newValue[column] = value;
44 | const multiArray = getRangeData(newValue);
45 | this.setData({
46 | multiArray,
47 | value: newValue,
48 | });
49 | },
50 | });
51 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo2/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 | .fixed-selectors-holder {
6 | width: 100%;
7 | padding: 20rpx 0;
8 | }
9 | .fixed-selectors-holder .fixed-selector {
10 | background-color: var(--main-color);
11 | color: #fff;
12 | padding: 4px 6px;
13 | }
14 | .fixed-popover-inner {
15 | white-space: nowrap;
16 | }
17 | .bottom-area-size {
18 | width: 100%;
19 | height: 120rpx;
20 | box-sizing: content-box;
21 | padding-bottom: 30px;
22 | }
23 | .bottom-area-position {
24 | position: fixed;
25 | bottom: 0;
26 | left: 0;
27 | }
28 | .popover {
29 | box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
30 | }
31 | .menu-demo {
32 | white-space: nowrap;
33 | }
34 | .menu-demo .menu-item-line {
35 | position: relative;
36 | width: 100%;
37 | height: 40px;
38 | font-size: 17px;
39 | font-weight: 400;
40 | text-align: left;
41 | display: flex;
42 | flex-direction: row;
43 | align-items: center;
44 | justify-content: flex-start;
45 | }
46 | .menu-demo .menu-item-line .icon-demo {
47 | flex: none;
48 | width: 22px;
49 | height: 22px;
50 | border-radius: 4px;
51 | background-color: var(--main-color);
52 | margin: 8px;
53 | }
54 | .menu-demo .dividing-line {
55 | width: 100%;
56 | border-top: 1px solid #ddd;
57 | }
58 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-keyword-highlight/index.js:
--------------------------------------------------------------------------------
1 | const splitText = (text, keyword) => {
2 | const result = [];
3 | const LEN = keyword.length;
4 | const dfs = (str) => {
5 | if (!str) return;
6 | const index = str.indexOf(keyword);
7 | if (index !== -1) {
8 | const pre = str.substr(0, index);
9 | const last = str.substr(index + LEN);
10 | if (pre) {
11 | result.push(pre);
12 | }
13 | result.push(keyword);
14 | dfs(last);
15 | } else {
16 | result.push(str);
17 | }
18 | };
19 | dfs(text);
20 | return result;
21 | };
22 |
23 | Component({
24 | properties: {
25 | text: {
26 | type: String,
27 | observer: '_doChange',
28 | },
29 | keyword: {
30 | type: String,
31 | observer: '_doChange',
32 | },
33 | color: {
34 | type: String,
35 | value: 'red',
36 | },
37 | },
38 | data: {
39 | textArray: [],
40 | },
41 | methods: {
42 | _doChange() {
43 | const { text, keyword } = this.data;
44 | let textArray = this.splitTextByKeyword(text, keyword);
45 | this.setData({
46 | textArray: textArray,
47 | });
48 | },
49 |
50 | splitTextByKeyword(text = '', keyword = '') {
51 | if (keyword && text) {
52 | return splitText(text, keyword);
53 | } else {
54 | return [text];
55 | }
56 | },
57 | },
58 | });
59 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo2/index.less:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | padding-bottom: 30rpx;
4 | }
5 |
6 | .fixed-selectors-holder {
7 | width: 100%;
8 | padding: 20rpx 0;
9 | .fixed-selector {
10 | background-color: var(--main-color);
11 | color: #fff;
12 | padding: 4px 6px;
13 | }
14 | }
15 |
16 | .fixed-popover-inner {
17 | white-space: nowrap;
18 | }
19 |
20 | .bottom-area-size {
21 | width: 100%;
22 | height: 120rpx;
23 | box-sizing: content-box;
24 | padding-bottom: 30px;
25 | }
26 |
27 | .bottom-area-position {
28 | position: fixed;
29 | bottom: 0;
30 | left: 0;
31 | }
32 |
33 | .popover {
34 | box-shadow: 0 3px 6px -4px rgb(0 0 0 / 12%), 0 6px 16px 0 rgb(0 0 0 / 8%), 0 9px 28px 8px rgb(0 0 0 / 5%);
35 | }
36 |
37 | .menu-demo {
38 | white-space: nowrap;
39 | .menu-item-line {
40 | position: relative;
41 | width: 100%;
42 | height: 40px;
43 | font-size: 17px;
44 | font-weight: 400;
45 | text-align: left;
46 | display: flex;
47 | flex-direction: row;
48 | align-items: center;
49 | justify-content: flex-start;
50 | .icon-demo {
51 | flex: none;
52 | width: 22px;
53 | height: 22px;
54 | border-radius: 4px;
55 | background-color: var(--main-color);
56 | margin: 8px;
57 | }
58 | }
59 | .dividing-line {
60 | width: 100%;
61 | border-top: 1px solid #ddd;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo2/index.js:
--------------------------------------------------------------------------------
1 | import Countdown from 'mina-countdown'; // 1. 引入mina-countdown
2 |
3 | Page({
4 | data: {
5 | countdown: 0,
6 | },
7 | onLoad: function (options) {
8 | // 会创建this.countdown指向实例对象
9 | new Countdown(this, 'countdown', {
10 | // 大多数情况只需要监听 tick 事件,更新 this.data.countdown 即可满足大部分场景
11 | tick: function (countdown) {
12 | // 更新 data.countdown 做渲染使用
13 | this.setData({
14 | countdown,
15 | });
16 | }.bind(this),
17 | done: function () {
18 | //在Countdown倒计时结束时触发
19 | wx.showToast({
20 | title: '倒计时结束',
21 | icon: 'none',
22 | duration: 2000,
23 | });
24 | },
25 | });
26 | this.startCountdown(60 * 60 * 1 + 3);
27 | },
28 | startCountdown: function (duration = 60) {
29 | this.countdown.start(duration); // 支持传入倒计时时间,单位:秒
30 | },
31 | pauseCountdown: function () {
32 | this.countdown.pause();
33 | },
34 | resumeCountdown: function () {
35 | this.countdown.resume();
36 | },
37 | stopCountdown: function () {
38 | this.countdown.stop();
39 | },
40 | newCountdown(e) {
41 | const { count = 3600 } = e.currentTarget.dataset || {};
42 | this.stopCountdown();
43 | this.startCountdown(count);
44 | },
45 | onShareAppMessage(res) {
46 | return {
47 | title: '这个小程序开发工具很实用哦~',
48 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
49 | };
50 | },
51 | });
52 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/multi-picker/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | options: {
3 | addGlobalClass: true,
4 | },
5 | properties: {
6 | getRanges: {
7 | type: Function,
8 | value: () => [],
9 | },
10 | rangeKey: String,
11 | value: { type: Array, value: [] },
12 | },
13 | observers: {
14 | value(value) {
15 | this.init();
16 | },
17 | getRanges() {
18 | this.value2Range(this._value);
19 | },
20 | },
21 | data: {
22 | range: [],
23 | _value: [],
24 | },
25 | lifetimes: {
26 | attached: function () {
27 | this._value = this._value || [];
28 | },
29 | },
30 | methods: {
31 | init() {
32 | this._value = [...(this.data.value || [])];
33 | this.setData({
34 | _value: this._value,
35 | });
36 | this.value2Range(this._value);
37 | },
38 | bindMultiPickerColumnChange(e) {
39 | const { column, value } = e.detail;
40 | this._value[column] = value;
41 | this.value2Range(this._value);
42 | },
43 | value2Range(res = []) {
44 | const result = res.map((v) => (!!v ? v : 0));
45 | const range = this.data.getRanges(result) || [];
46 | this.setData({
47 | range,
48 | });
49 | },
50 | bindChange(e) {
51 | this.triggerEvent('change', {
52 | value: e.detail.value,
53 | });
54 | },
55 | bindCancel() {
56 | this.init();
57 | this.triggerEvent('cancel', {});
58 | },
59 | },
60 | });
61 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/data-status/index.wxss:
--------------------------------------------------------------------------------
1 | .data-status {
2 | position: relative;
3 | width: 100%;
4 | }
5 |
6 | .data-status .data-status-empty {
7 | width: 100%;
8 | height: 100%;
9 | position: relative;
10 | display: flex;
11 | flex-direction: column;
12 | justify-content: center;
13 | align-items: center;
14 | color: rgba(0, 0, 0, 0.4);
15 | }
16 |
17 | .data-status .data-status-empty .icon-empty {
18 | font-size: 40rpx;
19 | }
20 | .data-status .data-status-empty span {
21 | margin-top: 10px;
22 | font-style: 14px;
23 | }
24 |
25 | .data-status .data-status-loading {
26 | position: absolute;
27 | width: 100%;
28 | height: 100%;
29 | left: 0;
30 | top: 0;
31 | background-color: rgba(0, 0, 0, 0.05);
32 | display: flex;
33 | justify-content: center;
34 | align-items: center;
35 | }
36 |
37 | .loading-icon {
38 | width: 100rpx;
39 | height: 100rpx;
40 | background-color: #fff;
41 | -webkit-animation: triangle-skew-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite;
42 | animation: triangle-skew-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite;
43 | }
44 |
45 | @keyframes triangle-skew-spin {
46 | 25% {
47 | transform: perspective(100px) rotateX(180deg) rotateY(0);
48 | }
49 | 50% {
50 | transform: perspective(100px) rotateX(180deg) rotateY(180deg);
51 | }
52 | 75% {
53 | transform: perspective(100px) rotateX(0) rotateY(180deg);
54 | }
55 | 100% {
56 | transform: perspective(100px) rotateX(0) rotateY(0);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | .navigation-bar-icon {
2 | text-align: center;
3 | width: 50rpx;
4 | height: 50rpx;
5 | line-height: 50rpx;
6 | font-size: 50rpx;
7 | }
8 |
9 | .logo-box {
10 | width: 100%;
11 | padding: 80rpx 50rpx;
12 | box-sizing: border-box;
13 | }
14 |
15 | .logo-box .tips {
16 | margin-top: 50rpx;
17 | width: 100%;
18 | text-align: center;
19 | font-size: 14px;
20 | }
21 |
22 | .collapse {
23 | background-color: #fff;
24 | border-radius: 2px;
25 | overflow: hidden;
26 | margin-bottom: 30rpx;
27 | }
28 |
29 | .collapse-card {
30 | width: 100%;
31 | padding: 20px;
32 | box-sizing: border-box;
33 | display: flex;
34 | flex-direction: row;
35 | justify-content: space-between;
36 | align-items: center;
37 | }
38 | .collapse-card .title {
39 | }
40 | .collapse-card .iconfont {
41 | flex: none;
42 | font-size: 16px;
43 | }
44 | .collapse-list {
45 | width: 100%;
46 | padding: 0 20px;
47 | box-sizing: border-box;
48 | }
49 | .item {
50 | height: 90rpx;
51 | display: flex;
52 | flex-direction: row;
53 | justify-content: space-between;
54 | align-items: center;
55 | border-top: 1rpx solid rgba(0, 0, 0, 0.1);
56 | }
57 | .item .title{
58 | flex: none;
59 | text-align: left;
60 | }
61 | .item .desc{
62 | flex: auto;
63 | text-align: right;
64 | font-size: 14px;
65 | color: gray;
66 | }
67 | .sub-list {
68 | width: 100%;
69 | box-sizing: border-box;
70 | padding-left: 20px;
71 | }
72 | .list > .item:first-child {
73 | border: 0;
74 | }
75 | .path-disable {
76 | color: gray;
77 | font-size: 14px;
78 | }
79 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo1/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | --head-height: 544rpx;
3 | --page-padding: 74rpx;
4 | padding: 0;
5 | }
6 | .head-box {
7 | position: relative;
8 | width: 100%;
9 | height: var(--head-height);
10 | background-color: var(--main-color);
11 | }
12 | .head-box .logo {
13 | position: absolute;
14 | left: 50%;
15 | top: 50%;
16 | transform: translate(-50%, -50%);
17 | width: 190rpx;
18 | height: 190rpx;
19 | font-size: 190rpx;
20 | text-align: center;
21 | line-height: 190rpx;
22 | }
23 | .main-box {
24 | position: relative;
25 | width: 100%;
26 | height: calc(100vh - var(--head-height));
27 | box-sizing: border-box;
28 | padding: 104rpx var(--page-padding) 0;
29 | }
30 | .main-box .input-area {
31 | width: 100%;
32 | height: 320rpx;
33 | }
34 | .main-box .item {
35 | margin-bottom: 24rpx;
36 | }
37 | .main-box input {
38 | border: 0;
39 | outline: none;
40 | width: 100%;
41 | height: 96rpx;
42 | padding: 0 38rpx;
43 | box-sizing: border-box;
44 | background: #edf1f1;
45 | border-radius: 20rpx;
46 | }
47 | .main-box .verification-box {
48 | position: relative;
49 | }
50 | .main-box .verification-box input {
51 | padding-right: 180rpx;
52 | }
53 | .main-box .verification-box .send-tip {
54 | position: absolute;
55 | top: 50%;
56 | right: 20rpx;
57 | transform: translate(0, -50%);
58 | font-size: 14px;
59 | color: var(--main-color);
60 | }
61 | .main-box .tips {
62 | font-size: 12px;
63 | color: #999999;
64 | }
65 | .main-box .bottun-box {
66 | display: flex;
67 | flex-direction: row;
68 | align-items: center;
69 | justify-content: flex-end;
70 | }
71 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popover/index.wxss:
--------------------------------------------------------------------------------
1 | .popup-window {
2 | --icon-height: 16rpx;
3 | position: absolute;
4 | transform: translate(0, 0) !important;
5 | left: calc(0rpx - var(--translate-value));
6 | right: calc(0rpx - var(--translate-value));
7 | top: var(--node-half-height);
8 | bottom: var(--node-half-height);
9 | margin: var(--icon-height) 0;
10 | box-sizing: border-box;
11 | padding: 14rpx 20rpx;
12 | border-radius: 6rpx;
13 | background-color: #fff;
14 | overflow: visible;
15 | }
16 |
17 | .float-left {
18 | right: auto !important;
19 | transform: translate(-50%, 0);
20 | }
21 | .float-right {
22 | left: auto !important;
23 | transform: translate(50%, 0);
24 | }
25 | .float-top {
26 | bottom: auto !important;
27 | }
28 | .float-bottom {
29 | top: auto !important;
30 | }
31 |
32 | .popup-window .triangle-up {
33 | position: absolute;
34 | top: calc(0rpx - var(--icon-height));
35 | left: var(--translate-value);
36 | right: var(--translate-value);
37 | width: 0;
38 | height: 0;
39 | border-left: 22rpx solid transparent;
40 | border-right: 22rpx solid transparent;
41 | border-bottom: 30rpx solid #fff;
42 | border-radius: 6rpx;
43 | }
44 |
45 | .popup-window .triangle-down {
46 | position: absolute;
47 | bottom: calc(0rpx - var(--icon-height));
48 | left: var(--translate-value);
49 | right: var(--translate-value);
50 | width: 0;
51 | height: 0;
52 | border-left: 22rpx solid transparent;
53 | border-right: 22rpx solid transparent;
54 | border-top: 30rpx solid #fff;
55 | border-radius: 6rpx;
56 | }
57 |
58 | .popup-window .window-inner {
59 | position: relative;
60 | }
61 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-window/index.wxss:
--------------------------------------------------------------------------------
1 | .popup-window {
2 | --icon-height: 16rpx;
3 | --icon-left: 30rpx;
4 | position: absolute;
5 | transform: translate(0, 0) !important;
6 | left: calc(0rpx - var(--icon-left));
7 | right: calc(0rpx - var(--icon-left));
8 | top: var(--node-half-height);
9 | bottom: var(--node-half-height);
10 | margin: var(--icon-height) 0;
11 | box-sizing: border-box;
12 | padding: 14rpx 20rpx;
13 | border-radius: 6rpx;
14 | background-color: #fff;
15 | overflow: visible;
16 | }
17 |
18 | .float-left {
19 | right: auto !important;
20 | transform: translate(-50%, 0);
21 | }
22 | .float-right {
23 | left: auto !important;
24 | transform: translate(50%, 0);
25 | }
26 | .float-top {
27 | bottom: auto !important;
28 | }
29 | .float-bottom {
30 | top: auto !important;
31 | }
32 |
33 | .popup-window .triangle-up {
34 | position: absolute;
35 | top: calc(0rpx - var(--icon-height));
36 | left: var(--icon-left);
37 | right: var(--icon-left);
38 | width: 0;
39 | height: 0;
40 | border-left: 22rpx solid transparent;
41 | border-right: 22rpx solid transparent;
42 | border-bottom: 30rpx solid #fff;
43 | border-radius: 6rpx;
44 | }
45 |
46 | .popup-window .triangle-down {
47 | position: absolute;
48 | bottom: calc(0rpx - var(--icon-height));
49 | left: var(--icon-left);
50 | right: var(--icon-left);
51 | width: 0;
52 | height: 0;
53 | border-left: 22rpx solid transparent;
54 | border-right: 22rpx solid transparent;
55 | border-top: 30rpx solid #fff;
56 | border-radius: 6rpx;
57 | }
58 |
59 | .popup-window .window-inner {
60 | position: relative;
61 | }
62 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo3/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | zoom: 1,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function (evt) {}, //一个手指以上触摸屏幕触发
16 | multipointEnd: function () {}, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
17 | tap: function () {}, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
18 | doubleTap: function () {
19 | this.setData({
20 | zoom: this.data.zoom === 1 ? 1.6 : 1,
21 | });
22 | }.bind(this), //双击屏幕触发
23 | longTap: function () {}, //长按屏幕750ms触发
24 | singleTap: function () {}, //单击屏幕触发,包括长按
25 | rotate: function (evt) {
26 | //evt.angle代表两个手指旋转的角度
27 | },
28 | pinch: function (evt) {
29 | //evt.zoom代表两个手指缩放的比例(多次缩放的累计值),evt.singleZoom代表单次回调中两个手指缩放的比例
30 | },
31 | pressMove: function (evt) {
32 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
33 | // console.log(evt.target);
34 | // console.log(evt.deltaX);
35 | // console.log(evt.deltaY);
36 | },
37 | swipe: function (evt) {
38 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
39 | // console.log("swipe:" + evt.direction);
40 | },
41 | });
42 | },
43 | onShareAppMessage(res) {
44 | return {
45 | title: '这个小程序开发工具很实用哦~',
46 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
47 | };
48 | },
49 | });
50 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/behaviors/listenPageEvent.js:
--------------------------------------------------------------------------------
1 | // 实用时必须在page声明需要用到的event,否则不会触发,很困惑!!
2 |
3 | const LISTEN_LIST_KEY = '__listenPageEvents';
4 |
5 | module.exports = Behavior({
6 | behaviors: [],
7 | properties: {},
8 | data: {},
9 | ready: function () {
10 | if (!this._listenPageEvents) {
11 | console.error(`listenPageEvents_behaviors 需要在 组件 内指定 _listenPageEvents 属性`);
12 | return;
13 | }
14 | const events = this._listenPageEvents;
15 | const _page = getCurrentPages()[getCurrentPages().length - 1];
16 | const _comp = this;
17 | events.map((name) => {
18 | if (this.configPageEvent(_page, name)) _page[name][LISTEN_LIST_KEY].push(_comp[name].bind(_comp));
19 | });
20 | },
21 | detached: function () {
22 | const _page = getCurrentPages()[getCurrentPages().length - 1];
23 | const _comp = this;
24 | const events = this._listenPageEvents;
25 | events.map((name) => {
26 | _page[name][LISTEN_LIST_KEY] = _page[name][LISTEN_LIST_KEY].filter((func) => func !== _comp[name].bind(_comp));
27 | });
28 | },
29 | methods: {
30 | configPageEvent(page, eventName) {
31 | if (!page[eventName]) {
32 | console.error(`page 没有指定${eventName}方法`);
33 | return;
34 | }
35 | if (typeof page[eventName][LISTEN_LIST_KEY] !== 'undefined') return true;
36 | const page_event = page[eventName] ? page[eventName].bind(page) : function () {};
37 | page[eventName] = function (...param) {
38 | page[eventName][LISTEN_LIST_KEY].map((listenFunc) => {
39 | listenFunc(...param);
40 | });
41 | return page_event(...param);
42 | }.bind(page);
43 | page[eventName][LISTEN_LIST_KEY] = [];
44 | return true;
45 | },
46 | },
47 | });
48 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mitt/index.js:
--------------------------------------------------------------------------------
1 | module.exports = (function() {
2 | var __MODS__ = {};
3 | var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
4 | var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
5 | var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
6 | var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
7 | __DEFINE__(1611728676539, function(require, module, exports) {
8 | module.exports=function(n){return{all:n=n||new Map,on:function(e,t){var i=n.get(e);i&&i.push(t)||n.set(e,[t])},off:function(e,t){var i=n.get(e);i&&i.splice(i.indexOf(t)>>>0,1)},emit:function(e,t){(n.get(e)||[]).slice().map(function(n){n(t)}),(n.get("*")||[]).slice().map(function(n){n(e,t)})}}};
9 | //# sourceMappingURL=mitt.js.map
10 |
11 | }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
12 | return __REQUIRE__(1611728676539);
13 | })()
14 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo4/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | tip: '',
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {
14 | this.setData({
15 | tip: '',
16 | });
17 | }.bind(this),
18 | touchCancel: function () {},
19 | multipointStart: function (evt) {}, //一个手指以上触摸屏幕触发
20 | multipointEnd: function () {}, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {}, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
22 | doubleTap: function () {}, //双击屏幕触发
23 | longTap: function () {
24 | this.setData({
25 | tip: '长按ing',
26 | });
27 | }.bind(this), //长按屏幕750ms触发
28 | singleTap: function () {}, //单击屏幕触发,包括长按
29 | rotate: function (evt) {
30 | //evt.angle代表两个手指旋转的角度
31 | },
32 | pinch: function (evt) {
33 | //evt.zoom代表两个手指缩放的比例(多次缩放的累计值),evt.singleZoom代表单次回调中两个手指缩放的比例
34 | },
35 | pressMove: function (evt) {
36 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
37 | // console.log(evt.target);
38 | // console.log(evt.deltaX);
39 | // console.log(evt.deltaY);
40 | },
41 | swipe: function (evt) {
42 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
43 | // console.log("swipe:" + evt.direction);
44 | },
45 | });
46 | },
47 | onShareAppMessage(res) {
48 | return {
49 | title: '这个小程序开发工具很实用哦~',
50 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
51 | };
52 | },
53 | });
54 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-countdown/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["mina-countdown.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var __TEMP__ = require('tiny-timer');var Timer = __REQUIRE_DEFAULT__(__TEMP__);\n\nconst DEFAULT_OPTIONS = {\n tick: function () {},\n done: function () {},\n statusChanged: function () {},\n};\n\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });class Countdown {\n constructor(_page, name, option = {}) {\n // init\n\n this._name = '';\n this._timer = new Timer({ interval: 1000 });\n this._option = { ...DEFAULT_OPTIONS, ...option };\n\n try {\n if (this._checkBeforeCreate(_page, name)) {\n this._name = name;\n _page[name] = this;\n }\n } catch (error) {\n console.error(error);\n }\n this._distributeHandlers();\n }\n _distributeHandlers() {\n this._timer.on('tick', (ms) => {\n this._option['tick'](Math.round(ms / 1000));\n });\n this._timer.on('done', this._option['done']);\n this._timer.on('statusChanged', this._option['statusChanged']);\n }\n _checkBeforeCreate(_page, name) {\n if (!_page || !name) {\n throw new Error('Countdown实例化时,必须传入page对象和引用名');\n }\n if (_page[name]) {\n throw new Error('Countdown实例化error: ' + name + ' 已经存在page中');\n }\n return true;\n }\n start(duration = 60) {\n this._timer.start(duration * 1000);\n }\n pause() {\n this._timer.pause();\n }\n resume() {\n this._timer.resume();\n }\n stop() {\n this._timer.stop();\n }\n};exports.default = Countdown\n"]}
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 本小程序主要用于展示一些在微信小程序开发中 实用的工具库
8 |
9 |
11 |
12 |
13 |
14 | {{box.title}}
15 |
16 |
17 | {{box.description}}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | {{item.title}}
27 |
28 | {{item.description}}
29 |
30 |
31 |
33 | {{subitem.title}}
34 | {{subitem.description}}
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/miniprogram/globalStyle.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding: 0 30rpx;
3 | box-sizing: border-box;
4 | background-color: var(--main-BG);
5 | color: var(--main-color);
6 | }
7 |
8 | .card {
9 | width: 100%;
10 | padding: 20px;
11 | box-sizing: border-box;
12 | background-color: #fff;
13 | border-radius: 2px;
14 | overflow: hidden;
15 | margin-top: 20rpx;
16 | margin-bottom: 20rpx;
17 | }
18 | .card .title {
19 | text-align: left;
20 | font-weight: 400;
21 | font-size: 14px;
22 | color: gray;
23 | margin-bottom: 10px;
24 | }
25 |
26 | .tips-color {
27 | color: rgb(117, 117, 117);
28 | }
29 |
30 | .logo {
31 | width: 140rpx;
32 | height: 140rpx;
33 | line-height: 140rpx;
34 | font-size: 94rpx;
35 | text-align: center;
36 | color: #fff;
37 | background-color: var(--main-color);
38 | border-radius: 50%;
39 | }
40 |
41 | .center-center {
42 | display: flex;
43 | justify-content: center;
44 | align-items: center;
45 | flex-direction: column;
46 | }
47 |
48 | .clear-hover-button {
49 | position: absolute;
50 | width: 100%;
51 | height: 100%;
52 | left: 0;
53 | top: 0;
54 | background-color: transparent;
55 | padding: 0;
56 | margin: 0;
57 | border: 0;
58 | border-radius: 0;
59 | color: transparent;
60 | }
61 | .clear-hover-button::after {
62 | display: none;
63 | }
64 |
65 | .button {
66 | padding: 0 100rpx;
67 | height: 84rpx;
68 | line-height: 84rpx;
69 | border-radius: 50rpx;
70 | overflow: hidden;
71 | text-align: center;
72 | color: #000;
73 | font-size: 14px;
74 | }
75 |
76 | .button-main {
77 | color: #fff;
78 | background-color: var(--main-color);
79 | box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.2);
80 | }
81 |
82 | .flex-between {
83 | display: flex;
84 | flex-direction: row;
85 | justify-content: space-between;
86 | align-items: center;
87 | }
88 |
89 | .disable-color {
90 | color: rgba(0, 0, 0, 0.25);
91 | }
92 |
--------------------------------------------------------------------------------
/miniprogram/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | mina-countdown@^1.0.1:
6 | version "1.0.1"
7 | resolved "https://registry.yarnpkg.com/mina-countdown/-/mina-countdown-1.0.1.tgz#ffe2b7b4eb7a021d81c51ebef5395f220ab37d79"
8 | integrity sha512-8S6R4d+7RalZ+l32CXJ6mQZg9bHvP5ulvVdxShZVLJfxMgzWLNS07HyKbbMdkQh2kYSLX6hbp/PyiJbbV1R/nQ==
9 | dependencies:
10 | tiny-timer "^1.6.0"
11 |
12 | mina-keyword-highlight@^1.0.0:
13 | version "1.0.0"
14 | resolved "https://registry.yarnpkg.com/mina-keyword-highlight/-/mina-keyword-highlight-1.0.0.tgz#09961c94a17421129f58503c57f4eb2c3a150798"
15 | integrity sha512-TJUzxeybBpT6jti/ZJmzZmDAEKrqtYEyMWiz4ynVfoed3A3ih5MEy0rkfemqliAD6erNGaNOnyykyEazhCAmYw==
16 |
17 | mina-tool@^1.0.0:
18 | version "1.0.0"
19 | resolved "https://registry.yarnpkg.com/mina-tool/-/mina-tool-1.0.0.tgz#a76843c016759f855df2414595c4d801ad3f0238"
20 | integrity sha512-5JS+S3O2kY3xyrX1qa0xkkPtSiST0iKMpdTg6622rEXEV+3POZ+Dc9gOsX9l5SLnBfwbrYsbGBAptH9/ZXfLfQ==
21 |
22 | mina-touch@^1.0.1:
23 | version "1.0.1"
24 | resolved "https://registry.yarnpkg.com/mina-touch/-/mina-touch-1.0.1.tgz#a4692a74bf59cb87576b3a03cfea049ab8b19fab"
25 | integrity sha512-6TLG639zSDCUwmw1pZIdWRKiQGrSJzHmcIDgZhA6xujdJntY/q2IV/G2kRaVuOz/pjwEavfIEkWIMEQohOiHjA==
26 |
27 | mitt@^2.1.0:
28 | version "2.1.0"
29 | resolved "https://registry.yarnpkg.com/mitt/-/mitt-2.1.0.tgz#f740577c23176c6205b121b2973514eade1b2230"
30 | integrity sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==
31 |
32 | tiny-timer@^1.6.0:
33 | version "1.6.0"
34 | resolved "https://registry.yarnpkg.com/tiny-timer/-/tiny-timer-1.6.0.tgz#bae5a112da9f0246b5a8676c86160718680aae68"
35 | integrity sha512-2ciJ4w+0EKDRmVihzj8aBxDw2da9L88aTwslhf1Clphwt2NV927N7xH90tqz/M02lziboDkx+IypnnWqzjnv9g==
36 | dependencies:
37 | mitt "^2.1.0"
38 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo2/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | var angle = 0,
4 | zoom = 1;
5 |
6 | Page({
7 | data: {
8 | angle: 0,
9 | zoom: 1,
10 | },
11 | onLoad: function (options) {
12 | const that = this;
13 | new MinaTouch(this, 'touch1', {
14 | //会创建this.touch1指向实例对象
15 | touchStart: function () {},
16 | touchMove: function () {
17 | that.setData({
18 | angle,
19 | zoom,
20 | });
21 | },
22 | touchEnd: function () {},
23 | touchCancel: function () {},
24 | multipointStart: function (evt) {}, //一个手指以上触摸屏幕触发
25 | multipointEnd: function () {}, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
26 | tap: function () {}, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
27 | doubleTap: function () {}, //双击屏幕触发
28 | longTap: function () {}, //长按屏幕750ms触发
29 | singleTap: function () {}, //单击屏幕触发,包括长按
30 | rotate: function (evt) {
31 | //evt.angle代表两个手指旋转的角度
32 | console.log(evt.angle);
33 | angle = that.data.angle + evt.angle;
34 | },
35 | pinch: function (evt) {
36 | //evt.zoom代表两个手指缩放的比例(多次缩放的累计值),evt.singleZoom代表单次回调中两个手指缩放的比例
37 | console.log('pinch:' + evt.zoom);
38 | zoom = evt.zoom;
39 | },
40 | pressMove: function (evt) {
41 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
42 | // console.log(evt.target);
43 | // console.log(evt.deltaX);
44 | // console.log(evt.deltaY);
45 | },
46 | swipe: function (evt) {
47 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
48 | // console.log("swipe:" + evt.direction);
49 | },
50 | });
51 | },
52 | onShareAppMessage(res) {
53 | return {
54 | title: '这个小程序开发工具很实用哦~',
55 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
56 | };
57 | },
58 | });
59 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/menu-popover/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | behaviors: ['wx://component-export'],
3 | export() {
4 | this.popover = this.selectComponent('#popover');
5 | return {
6 | open: this.openGuide.bind(this),
7 | close: this.closeGuide.bind(this),
8 | };
9 | },
10 | options: {},
11 | properties: {
12 | show: {
13 | type: Boolean,
14 | value: false,
15 | },
16 | },
17 | observers: {
18 | show(show) {
19 | console.log(show)
20 | if (show) {
21 | this.openGuide();
22 | } else {
23 | this.closeGuide();
24 | }
25 | },
26 | },
27 | data: {
28 | left: 0,
29 | top: 0,
30 | translateX: 15,
31 | },
32 | methods: {
33 | closeGuide() {
34 | this.popover.close();
35 | },
36 | openGuide() {
37 | if (this._ready) {
38 | this.popover.open();
39 | } else {
40 | this._open_when_ready = true;
41 | }
42 | },
43 | getGuidePosition() {
44 | return new Promise((resolve) => {
45 | const { bottom, left, width } = wx.getMenuButtonBoundingClientRect();
46 | const { screenHeight, windowHeight } = wx.getSystemInfoSync();
47 | const isCustom = screenHeight == windowHeight;
48 | this.setData(
49 | {
50 | left: left + width * 0.25,
51 | top: isCustom ? bottom + 4 : 0,
52 | translateX: width * 0.72,
53 | },
54 | () => {
55 | resolve();
56 | },
57 | );
58 | });
59 | },
60 | },
61 | lifetimes: {
62 | created: function () {
63 | this._ready = false;
64 | this._open_when_ready = false;
65 | this.popover = this.selectComponent('#popover');
66 | },
67 | ready: function () {
68 | this.getGuidePosition().then(() => {
69 | this._ready = true;
70 | if (this._open_when_ready) {
71 | this.openGuide();
72 | this._open_when_ready = false;
73 | }
74 | });
75 | },
76 | },
77 | });
78 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/iconfont.wxss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'mina-tool-iconfont';
3 | src: url('//at.alicdn.com/t/font_2281049_jkj6782qn9.eot?t=1608388846164'); /* IE9 */
4 | src: url('//at.alicdn.com/t/font_2281049_jkj6782qn9.eot?t=1608388846164#iefix') format('embedded-opentype'),
5 | /* IE6-IE8 */
6 | url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAL0AAsAAAAABrQAAAKnAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcAqBQIE2ATYCJAMICwYABCAFhG0HLxvbBcgOJU3BwIBFAABABN+P/W/Pla+WVKMnsSiaftJEKDQqXplOyRASTTR7CW/Qv7cUckriIflwfspJmABPHT2Lh+0832239vvEvdM/6rwLZL7zLse1N38MMA6kAPe0KJANUkDYML18QQN5mkCbUSG09vNKaoChQk8KxCORgAGGuaiisEKL0FSzsryNKVVLepoeAfA6/H38B1FhSFIz3XLykMuDjF/mpkTnSaPftU+IEdD6ioxlQCEuarNHdATj6mjL6poE9tUY/DLXaHy72OufJ5ro+g4wDKX3JHPyWxVPoNCbTcDhqPsi99pbC/rtzBy0zIYW7LE5Pwc63aTlD7E2py8uOqbeXLWZPnsXWh0e911/9dLZ+BIssEDHX1y1tz6+b4ZyUtW3HKgba2B3aD+AWq70baR+M3WocKtwMP3DZBpGOk24eDpl8vr51m1uvyoK7L75GGZ0Ovt+cfLt0i8yvamvKQIZgMaHpr8W6vT/yMv8bty7abdI+W9oUsBP3ch/obKfn5bT+YLfZq75LcSHUih0JhUgKeIkm4rb0bSJgAbQwT7fxxoH77EYWgzeqb/ZSIqsxTRZ2Muo2q2gSYsttFmSv75dP0JHlFYsGgEIPU6QdHmPrMcTWdjfUA35iyY9oYM2V2GzY7vZEBlnE8RQxEO2F4o4hRxbBzWOGquQoFPKkKwi5NUhohYlYGRYRLGQj+SIzDFH3SWIohRDTBQymAfOQ1KpAiqJQow4GiakVJkUHo7rbhTGKWTA2B4CYVAID2L1gkQ4CnLY70wZl75fBRHoJMUgLYxcsg5CqIn6hyKFiehB5mvlvRj3co1aF4EoFIVBGKEgA+UBNyI1WQVIWT9MDOFQYYQj0kpJwlE73Fcbtr5e9nW7oI02pTADsnovU9JeAAAA')
7 | format('woff2'),
8 | url('//at.alicdn.com/t/font_2281049_jkj6782qn9.woff?t=1608388846164') format('woff'),
9 | url('//at.alicdn.com/t/font_2281049_jkj6782qn9.ttf?t=1608388846164') format('truetype'),
10 | /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
11 | url('//at.alicdn.com/t/font_2281049_jkj6782qn9.svg?t=1608388846164#iconfont') format('svg'); /* iOS 4.1- */
12 | }
13 |
14 | .mina-tool-iconfont {
15 | font-family: 'mina-tool-iconfont' !important;
16 | font-size: 16px;
17 | font-style: normal;
18 | -webkit-font-smoothing: antialiased;
19 | -moz-osx-font-smoothing: grayscale;
20 | }
21 |
22 | .icon-empty:before {
23 | content: '\e60e';
24 | }
25 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-window/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | behaviors: ['wx://component-export'],
3 | export() {
4 | return this.getPopupFixed();
5 | },
6 | popupFixed: {
7 | open() {},
8 | close() {},
9 | },
10 | options: {
11 | addGlobalClass: true,
12 | },
13 | properties: {
14 | selector: {
15 | type: String,
16 | value: '',
17 | },
18 | tapBgClose: {
19 | type: Boolean,
20 | value: true,
21 | },
22 | scrollBgClose: {
23 | type: Boolean,
24 | value: false,
25 | },
26 | visible: {
27 | type: Boolean,
28 | value: undefined,
29 | },
30 | backgroundColor: {
31 | type: String,
32 | value: '',
33 | },
34 | catchScroll: {
35 | type: Boolean,
36 | value: true,
37 | },
38 | },
39 | observers: {
40 | visible(visible) {
41 | if (visible === undefined) return;
42 | // 利用setData保证this.popupFixed初始化完成
43 | this.setData({}, () => {
44 | if (visible) {
45 | this.popupFixed.open();
46 | } else {
47 | this.popupFixed.close();
48 | }
49 | });
50 | },
51 | },
52 | data: {
53 | isLeft: true,
54 | isTop: true,
55 | nodeHalfHeight: 0,
56 | },
57 | lifetimes: {
58 | ready() {
59 | // 防止外部不调用this.selectComponent导致getPopupFixed不触发
60 | this.getPopupFixed();
61 | },
62 | },
63 | methods: {
64 | getPopupFixed() {
65 | this.popupFixed = this.selectComponent('#popup-fixed');
66 | return this.popupFixed;
67 | },
68 | doDirection(e) {
69 | const { node, viewport } = e.detail || {};
70 | if (node && viewport) {
71 | const { left, top } = node;
72 | const isLeft = left < viewport.width / 2;
73 | const isTop = top < viewport.height / 2;
74 | this.setData({
75 | isLeft,
76 | isTop,
77 | nodeHalfHeight: node.height / 2,
78 | });
79 | } else {
80 | console.error('popup-window doDirection 还未获取到 nodeHalfHeight, left, top, viewport');
81 | }
82 | },
83 | },
84 | });
85 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-touch/demo1/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxs/format/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/wxss/common/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/behavior/pageEvent/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/data-status/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/error-img/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-tool/components/popup-window/index.js:
--------------------------------------------------------------------------------
1 | import MinaTouch from 'mina-touch'; //引入mina-touch
2 |
3 | Page({
4 | data: {
5 | translateX: 0,
6 | },
7 | onLoad: function (options) {
8 | const that = this;
9 | new MinaTouch(this, 'touch1', {
10 | //会创建this.touch1指向实例对象
11 | touchStart: function () {},
12 | touchMove: function () {},
13 | touchEnd: function () {},
14 | touchCancel: function () {},
15 | multipointStart: function () {
16 | console.log('multipointStart');
17 | }, //一个手指以上触摸屏幕触发
18 | multipointEnd: function () {
19 | console.log('multipointEnd');
20 | }, //当手指离开,屏幕只剩一个手指或零个手指触发(一开始只有一根手指也会触发)
21 | tap: function () {
22 | console.log('Tap');
23 | }, //点按触发,覆盖下方3个点击事件,doubleTap时触发2次
24 | doubleTap: function () {
25 | console.log('doubleTap');
26 | }, //双击屏幕触发
27 | longTap: function () {
28 | console.log('longTap');
29 | }, //长按屏幕750ms触发
30 | singleTap: function () {
31 | console.log('singleTap');
32 | }, //单击屏幕触发,包括长按
33 | rotate: function (evt) {
34 | //evt.angle代表两个手指旋转的角度
35 | console.log('rotate:' + evt.angle);
36 | },
37 | pinch: function (evt) {
38 | //evt.scale代表两个手指缩放的比例
39 | console.log('pinch:' + evt.zoom);
40 | },
41 | pressMove: function (evt) {
42 | //evt.deltaX和evt.deltaY代表在屏幕上移动的距离,evt.target可以用来判断点击的对象
43 | // console.log(evt.target);
44 | // console.log(evt.deltaX);
45 | // console.log(evt.deltaY);
46 | that.pressView(evt.deltaX);
47 | },
48 | swipe: function (evt) {
49 | //在touch结束触发,evt.direction代表滑动的方向 ['Up','Right','Down','Left']
50 | // console.log("swipe:" + evt.direction);
51 | },
52 | });
53 | },
54 | pressView(deltaX) {
55 | let translateX = this.data.translateX;
56 | translateX -= deltaX;
57 | if (translateX < 0) translateX = 0;
58 | if (translateX > 200) translateX = 200;
59 | this.setData({
60 | translateX,
61 | });
62 | },
63 | onShareAppMessage(res) {
64 | return {
65 | title: '这个小程序开发工具很实用哦~',
66 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
67 | };
68 | },
69 | });
70 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo2/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 打开文字提示气泡
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 打开fixed-popover
14 |
15 |
16 |
20 |
21 | 根据left、top定位popover
22 |
23 |
24 |
25 |
27 |
43 |
44 |
45 |
47 |
48 | tooltip
49 |
50 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/wxs/format.wxs:
--------------------------------------------------------------------------------
1 | var formatNumber = function (number) {
2 | var returnVal = '';
3 | var unit = '';
4 |
5 | if (number === null || number === undefined) {
6 | return '-';
7 | }
8 |
9 | if (typeof number === 'string') {
10 | number = parseInt(number);
11 | }
12 |
13 | if (Math.abs(number / 100000000) >= 1) {
14 | returnVal = parseFloat((number / 100000000).toFixed(2));
15 | unit = '亿';
16 | } else if (Math.abs(number / 10000) >= 1) {
17 | returnVal = parseFloat((number / 10000).toFixed(1));
18 | unit = '万';
19 | } else {
20 | returnVal = number;
21 | }
22 |
23 | return returnVal + unit;
24 | };
25 |
26 | var formatTime = function (unix, format = 'YYYY.MM.dd HH:mm:ss') {
27 | var time = getDate(unix);
28 | var fmt = format;
29 | var o = {
30 | 'M+': time.getMonth() + 1, //月份
31 | 'd+': time.getDate(), //日
32 | 'h+': time.getHours() % 12 == 0 ? 12 : time.getHours() % 12, //小时
33 | 'H+': time.getHours(), //小时
34 | 'Y+': time.getFullYear(), //年
35 | 'm+': time.getMinutes(), //分
36 | 's+': time.getSeconds(), //秒
37 | 'q+': Math.floor((time.getMonth() + 3) / 3), //季度
38 | 'S+': time.getMilliseconds(), //毫秒
39 | };
40 | var keys = ['M+', 'd+', 'h+', 'H+', 'Y+', 'm+', 's+', 'q+', 'S+'];
41 | keys.map(function (k) {
42 | var regexp = getRegExp(k, 'g');
43 | fmt = fmt.replace(regexp, function (replacement) {
44 | var preStr = '';
45 | for (var i = 0; i < replacement.length; i++) {
46 | preStr += '0';
47 | }
48 | return (preStr + o[k]).substring((preStr + o[k]).length - replacement.length);
49 | });
50 | });
51 | return fmt;
52 | };
53 |
54 | var formatCountdown = function (s, format = 'hh:mm:ss') {
55 | var fmt = format;
56 | var hour = parseInt((s / 60 / 60) % 24);
57 | var minute = parseInt((s / 60) % 60);
58 | var second = parseInt(s % 60);
59 | var o = {
60 | 'h+': hour, //小时
61 | 'm+': minute, //分钟
62 | 's+': second, //秒
63 | };
64 | var keys = ['h+', 'm+', 's+'];
65 | keys.map(function (k) {
66 | var regexp = getRegExp(k, 'g');
67 | fmt = fmt.replace(regexp, function (replacement) {
68 | var preStr = '';
69 | for (var i = 0; i < replacement.length; i++) {
70 | preStr += '0';
71 | }
72 | return (preStr + o[k]).substring((preStr + o[k]).length - replacement.length);
73 | });
74 | });
75 | return fmt;
76 | };
77 |
78 | module.exports.formatNumber = formatNumber;
79 | module.exports.formatTime = formatTime;
80 | module.exports.formatCountdown = formatCountdown;
81 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/error-img/index.js:
--------------------------------------------------------------------------------
1 | const err_base64 =
2 | 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFN0lEQVRoQ+1ZXWgcVRQ+584GNNiigWD7oGjxwbRUQQXbGHfnzCaVJA/WPERRQQVbtZUK6psPtg++qWCxVRPBCio2D7E+JEXTnTsbY61gBZVqH0IVfbASSEVlFbIzR06dlM1mZvbe3USIeGEIbL7z3fPN/Tn3foOwxhuu8fzhfwEygmNjY05HR4enlNqJiLcAwJU1j0B+XXyY+csoio7Nz8/7w8PDYaszoKUR8H1/ABGHAWAAADotk5kDgElmHvM8b9Iy9hK8KQFa6x4AeBIA7m2247q4owDwKhHN2PJZCZienu6MougFZt5l25EJHhFHlVLP5fN5GR2jZixAa+0CwCgA3GDE3DxoFgB2EVFgQmEkIAiCPcx8yIRwpTCIuNd13cON+BoKCILgHmYeb0RU+39m/hgATiPiV/I7M98MALci4g4bHkQccl33g6yYTAHlcrkriqJvbTqNouhAsVjcnxRTKpX2K6Wet+FTSm0uFArfpcWkCpicnFzf3t5+nJm7TTtUSl1bKBR+ysKXy+Vroij60ZQTEU9WKpX+gYGB35JiUgUEQTBis9sg4kHXdZ8ySSwIgleYeZ8JVjCyO7muu9tYQLzPf2LageCiKLqjWCyeNIkplUrdSqlPTbA1mDuT6kTiCGit37csUn8Q0TqbhLTWvwPAFRYxR4novnr8MgHx8WDCgligARGRTYzWWgOA1BbjxsyD9ceOZQK01u8AwAPGrP8ALxBRh02M1noeAK6yiQGAd4nowdqYJQK01jlm/gURrZIRwmq1elNfX983JglNTU1tzeVyX5tgazHMPI+IVxNRdfH3JQJ8378bEY/ZEsf414noCZNYrfVrAPC4CbYew8w7Pc/7ME3ACCI2fVBzHGdLPp/PLHzT09ObwzA800zyEsPMo57nXdpS66fQZwCwrVnyuINtnud9nsTh+/7tiHiqFX4AOEVE2xNHQGstJfvGFjuQmnDAcZwzzCwvRArR9jAMt9geI1LyOEtEXWkCfgaADa0KWOX480S0MU3AnwBw2Son0Cr9X0R0+X9WwJqfQq0s4hIifqSUkgPdBXnCMJS/4DiOVNyLTxRF3cx8FwAUm5xLmYvYdhudQUQ5dk8R0XmbhLTWGxCxj5llTxeXw7Slb6O+7x9CxD0mTIj4suu6z5hgG2GCIHiJmZ9uhIvrzGHP8/YmLuITJ070OY4j99msNouI+1zXPW7SoSkmCIJ+Zj7YyPUIw3BHb2/vVKIAsQg7OztlIae6bMz8mOd5I6aJ2eB839+NiG9kxMzNzc1trLUkk47TRwDgoRSS00R0m01Stlit9RfiYKTEvU1ED9f+z/ZCI/cWI8PJNvFFfGygyWVnWTO60EhUgytlFxGdbTbBrDittZzD0iwUsytlLEC2tdRLfVtb2/qenh65065Ym5mZWbewsJBoncSdmF/qJcDAVrmeiH5YCQVa6+sA4Ps0LmtbRYjEiQ7DUKpqlpn7CBHJom+6aa1lUb6VQTDrOE53mmOdaS1mLaiaDo8g4phtXYj3ffk4smRXSRCSuXGYmLumzrQUuPEoisZzudy5+jcmI1qtVjcppYaYeahRwRIhJg51QwHxerB2qAFAFvm5+I1uAgAr48vEmb4o0nTyilPNzG/amL2m3LU4MXMR8dEsR3oJ3qaT2LF+0cb0teGX3aZSqTyb5kQncRmPQG3wmv3IV/8GYh/1fmbut3XzYpdNvj+8969/Zq0XEluSgwAwiIhbG3zoFvtxAhEnai1Cm6nW9BpotpPVjGtqDaxmQrbca17A3+QmI09j67ERAAAAAElFTkSuQmCC';
3 |
4 | Component({
5 | properties: {
6 | err: {
7 | type: String,
8 | value: err_base64,
9 | },
10 | src: {
11 | type: String,
12 | value: '',
13 | },
14 | mode: {
15 | type: String,
16 | value: '',
17 | },
18 | lazyLoad: {
19 | type: Boolean,
20 | value: false,
21 | },
22 | showMenuByLongpress: {
23 | type: Boolean,
24 | value: false,
25 | },
26 | },
27 | options: {
28 | addGlobalClass: true,
29 | },
30 | data: {
31 | _src: '',
32 | },
33 | lifetimes: {},
34 | observers: {
35 | src(src) {
36 | if (src) {
37 | this.setData({
38 | _src: src,
39 | });
40 | }
41 | },
42 | },
43 | methods: {
44 | onError() {
45 | this.setData({
46 | _src: this.data.errUrl,
47 | });
48 | },
49 | },
50 | });
51 |
--------------------------------------------------------------------------------
/miniprogram/components/home-menu/index.wxss:
--------------------------------------------------------------------------------
1 | .user-menu {
2 | width: 500rpx;
3 | }
4 |
5 | .menu-line-padding {
6 | padding: 0 10rpx;
7 | box-sizing: border-box;
8 | }
9 |
10 | .color-gray{
11 | color: #dddddd;
12 | }
13 |
14 | .user-info-box {
15 | position: relative;
16 | width: 100%;
17 | height: 120rpx;
18 | display: flex;
19 | flex-direction: row;
20 | align-items: center;
21 | justify-content: space-between;
22 | }
23 | .user-info-box .avatar {
24 | flex: none;
25 | width: 80rpx;
26 | height: 80rpx;
27 | line-height: 80rpx;
28 | font-size: 80rpx;
29 | text-align: center;
30 | border-radius: 50%;
31 | overflow: hidden;
32 | }
33 | .user-info-box .name {
34 | flex: auto;
35 | font-size: 17px;
36 | font-weight: 400;
37 | text-align: left;
38 | margin-left: 20rpx;
39 | overflow: hidden;
40 | white-space: nowrap;
41 | text-overflow: ellipsis;
42 | }
43 | .user-info-box .vip-status {
44 | flex: none;
45 | position: relative;
46 | width: 140rpx;
47 | margin-left: 20rpx;
48 | overflow: visible;
49 | font-weight: 400;
50 | font-size: 12px;
51 | text-align: right;
52 | color: #dddddd;
53 | }
54 | .user-info-box .isVip {
55 | color: rgba(230, 22, 45, 1);
56 | }
57 | .user-info-box .vip-status .buttom-tips {
58 | position: absolute;
59 | right: 0;
60 | bottom: -24px;
61 | }
62 |
63 | .user-info-box .no-login {
64 | flex: auto;
65 | margin-left: 20rpx;
66 | }
67 |
68 | .user-info-box .icon-user-fill {
69 | color: #dddddd;
70 | }
71 |
72 | .user-info-box .no-login .line1 {
73 | height: 48rpx;
74 | display: flex;
75 | flex-direction: row;
76 | align-items: center;
77 | justify-content: space-between;
78 | }
79 |
80 | .user-info-box .no-login .line1 .login-button {
81 | margin: 0;
82 | border: 0;
83 | height: 48rpx;
84 | line-height: 48rpx;
85 | padding: 0 24rpx;
86 | background-color: rgb(24, 144, 255);
87 | color: #fff;
88 | font-size: 14px;
89 | border-radius: 4px;
90 | }
91 |
92 | .user-info-box .no-login .line1 .login-button::after {
93 | display: none;
94 | }
95 |
96 | .user-info-box .no-login .line2 {
97 | height: 48rpx;
98 | line-height: 48rpx;
99 | text-align: left;
100 | font-weight: 400;
101 | font-size: 12px;
102 | color: #dddddd;
103 | }
104 |
105 | .user-menu-dividing {
106 | margin: 10rpx 0;
107 | border-bottom: 1px dotted #dddddd;
108 | }
109 |
110 | .user-menu-item-line {
111 | position: relative;
112 | width: 100%;
113 | height: 90rpx;
114 | font-size: 17px;
115 | font-weight: 400;
116 | text-align: left;
117 | display: flex;
118 | flex-direction: row;
119 | align-items: center;
120 | justify-content: space-between;
121 | }
122 |
123 | .user-menu-item-line .iconfont {
124 | color: #dddddd;
125 | font-size: 16px;
126 | }
127 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/tiny-timer/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["tiny-timer.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var mitt = require('mitt');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);\n\nclass Timer {\n constructor({\n interval = 1000,\n stopwatch = false\n } = {}) {\n this._duration = 0;\n this._endTime = 0;\n this._pauseTime = 0;\n this._status = 'stopped';\n this._emitter = mitt__default['default']();\n\n this.tick = () => {\n if (this.status === 'paused') return;\n\n if (Date.now() >= this._endTime) {\n this.stop();\n\n this._emitter.emit('tick', this._stopwatch ? this._duration : 0);\n\n this._emitter.emit('done');\n } else {\n this._emitter.emit('tick', this.time);\n }\n };\n\n this._interval = interval;\n this._stopwatch = stopwatch;\n }\n\n start(duration, interval) {\n if (this.status !== 'stopped') return;\n\n if (duration == null) {\n throw new TypeError('Must provide duration parameter');\n }\n\n this._duration = duration;\n this._endTime = Date.now() + duration;\n\n this._changeStatus('running');\n\n this._emitter.emit('tick', this._stopwatch ? 0 : this._duration);\n\n this._timeoutID = setInterval(this.tick, interval || this._interval);\n }\n\n stop() {\n if (this._timeoutID) clearInterval(this._timeoutID);\n\n this._changeStatus('stopped');\n }\n\n pause() {\n if (this.status !== 'running') return;\n this._pauseTime = Date.now();\n\n this._changeStatus('paused');\n }\n\n resume() {\n if (this.status !== 'paused') return;\n this._endTime += Date.now() - this._pauseTime;\n this._pauseTime = 0;\n\n this._changeStatus('running');\n }\n\n _changeStatus(status) {\n this._status = status;\n\n this._emitter.emit('statusChanged', this.status);\n }\n\n get time() {\n if (this.status === 'stopped') return 0;\n const time = this.status === 'paused' ? this._pauseTime : Date.now();\n const left = this._endTime - time;\n return this._stopwatch ? this._duration - left : left;\n }\n\n get duration() {\n return this._duration;\n }\n\n get status() {\n return this._status;\n }\n\n on(eventName, handler) {\n this._emitter.on(eventName, handler);\n }\n\n off(eventName, handler) {\n this._emitter.off(eventName, handler);\n }\n\n}\n\nmodule.exports = Timer;\n//# sourceMappingURL=tiny-timer.js.map\n"]}
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popover/index.js:
--------------------------------------------------------------------------------
1 | // 基于fixed-position + popup-base 处理弹窗样式
2 | // 不考虑center-position
3 | Component({
4 | behaviors: ['wx://component-export'],
5 | export() {
6 | return {
7 | open: this.open.bind(this),
8 | close: this.close.bind(this),
9 | };
10 | },
11 | options: {
12 | addGlobalClass: true,
13 | },
14 | properties: {
15 | selector: {
16 | type: String,
17 | value: '',
18 | },
19 | left: {
20 | type: Number,
21 | value: 0,
22 | },
23 | top: {
24 | type: Number,
25 | value: 0,
26 | },
27 | unit: {
28 | type: String,
29 | value: 'px',
30 | },
31 | tapMaskClose: {
32 | type: Boolean,
33 | value: true,
34 | },
35 | scrollMaskClose: {
36 | type: Boolean,
37 | value: false,
38 | },
39 | show: {
40 | type: Boolean,
41 | value: false,
42 | },
43 | maskColor: {
44 | type: String,
45 | value: '',
46 | },
47 | catchScroll: {
48 | type: Boolean,
49 | value: true,
50 | },
51 | mask: {
52 | type: Boolean,
53 | value: true,
54 | },
55 | translateX: {
56 | type: Number,
57 | value: 15,
58 | },
59 | },
60 | observers: {
61 | show(show) {
62 | if (show) {
63 | if (this.popupBase) {
64 | this.open();
65 | } else {
66 | this._open_after_init = true;
67 | }
68 | } else {
69 | this.close();
70 | }
71 | },
72 | },
73 | data: {
74 | isLeft: true,
75 | isTop: true,
76 | nodeHalfHeight: 0,
77 | },
78 | lifetimes: {
79 | ready() {
80 | this.init();
81 | },
82 | },
83 | methods: {
84 | init() {
85 | this._init = true;
86 | this.getPopupBase();
87 | },
88 | getPopupBase() {
89 | this.popupBase = this.selectComponent('#popup-base');
90 | return this.popupBase;
91 | },
92 | open() {
93 | if (!this._init) {
94 | this.init();
95 | }
96 | this.popupBase.open();
97 | },
98 | close() {
99 | if (!this._init) {
100 | this.init();
101 | }
102 | this.popupBase.close();
103 | },
104 | doDirection(e) {
105 | const { left, top, node, viewport } = e.detail || {};
106 | if (left != undefined && top != undefined && viewport) {
107 | const isLeft = left < viewport.width / 2;
108 | const isTop = top < viewport.height / 2;
109 | this.setData(
110 | {
111 | isLeft,
112 | isTop,
113 | nodeHalfHeight: node ? node.height / 2 : 0,
114 | },
115 | () => {
116 | if (this._open_after_init) {
117 | this.open();
118 | }
119 | },
120 | );
121 | } else {
122 | console.error('popup-window doDirection 还未获取到 left, top, viewport');
123 | }
124 | },
125 | },
126 | });
127 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-countdown/index.js:
--------------------------------------------------------------------------------
1 | module.exports = (function() {
2 | var __MODS__ = {};
3 | var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
4 | var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
5 | var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
6 | var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
7 | __DEFINE__(1613215378483, function(require, module, exports) {
8 | var __TEMP__ = require('tiny-timer');var Timer = __REQUIRE_DEFAULT__(__TEMP__);
9 |
10 | const DEFAULT_OPTIONS = {
11 | tick: function () {},
12 | done: function () {},
13 | statusChanged: function () {},
14 | };
15 |
16 | if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });class Countdown {
17 | constructor(_page, name, option = {}) {
18 | // init
19 |
20 | this._name = '';
21 | this._timer = new Timer({ interval: 1000 });
22 | this._option = { ...DEFAULT_OPTIONS, ...option };
23 |
24 | try {
25 | if (this._checkBeforeCreate(_page, name)) {
26 | this._name = name;
27 | _page[name] = this;
28 | }
29 | } catch (error) {
30 | console.error(error);
31 | }
32 | this._distributeHandlers();
33 | }
34 | _distributeHandlers() {
35 | this._timer.on('tick', (ms) => {
36 | this._option['tick'](Math.round(ms / 1000));
37 | });
38 | this._timer.on('done', this._option['done']);
39 | this._timer.on('statusChanged', this._option['statusChanged']);
40 | }
41 | _checkBeforeCreate(_page, name) {
42 | if (!_page || !name) {
43 | throw new Error('Countdown实例化时,必须传入page对象和引用名');
44 | }
45 | if (_page[name]) {
46 | throw new Error('Countdown实例化error: ' + name + ' 已经存在page中');
47 | }
48 | return true;
49 | }
50 | start(duration = 60) {
51 | this._timer.start(duration * 1000);
52 | }
53 | pause() {
54 | this._timer.pause();
55 | }
56 | resume() {
57 | this._timer.resume();
58 | }
59 | stop() {
60 | this._timer.stop();
61 | }
62 | };exports.default = Countdown
63 |
64 | }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
65 | return __REQUIRE__(1613215378483);
66 | })()
67 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo1/index.js:
--------------------------------------------------------------------------------
1 | const CONFIG_POSITION = {
2 | title: '控制popup-position模式',
3 | list: [
4 | {
5 | name: 'position',
6 | type: 'PICKER',
7 | typeData: ['fixed', 'center', 'left', 'right', 'top', 'bottom'],
8 | },
9 | ],
10 | };
11 | const CONFIG_POPUP = {
12 | title: '控制popup主体',
13 | list: [
14 | {
15 | name: 'selector',
16 | type: 'PICKER',
17 | typeData: ['', '#lefttop', '#righttop', '#leftbottom', '#rightbottom'],
18 | },
19 | {
20 | name: 'left',
21 | type: 'PICKER',
22 | typeData: [0, 50, 100, 200],
23 | },
24 | {
25 | name: 'top',
26 | type: 'PICKER',
27 | typeData: [0, 50, 100, 500],
28 | },
29 | {
30 | name: 'unit',
31 | type: 'TEXT',
32 | disable: true,
33 | },
34 | ],
35 | };
36 | const CONFIG_MASK = {
37 | title: '控制mask',
38 | list: [
39 | {
40 | name: 'mask',
41 | type: 'SWITCH',
42 | },
43 | {
44 | name: 'catchScroll',
45 | type: 'SWITCH',
46 | },
47 | {
48 | name: 'tapMaskClose',
49 | type: 'SWITCH',
50 | },
51 | {
52 | name: 'scrollMaskClose',
53 | type: 'SWITCH',
54 | },
55 | {
56 | name: 'maskColor',
57 | type: 'TEXT',
58 | disable: true,
59 | },
60 | ],
61 | };
62 |
63 | Component({
64 | data: {
65 | config: [CONFIG_POSITION, CONFIG_POPUP, CONFIG_MASK],
66 | popup: {
67 | mask: true,
68 | catchScroll: true,
69 | tapMaskClose: true,
70 | scrollMaskClose: false,
71 | maskColor: 'rgba(0, 0, 0, 0.6)',
72 | selector: '',
73 | left: 0,
74 | top: 0,
75 | unit: 'px',
76 | position: 'fixed',
77 | },
78 | show: false,
79 | },
80 | observers: {
81 | 'popup.position': function (position) {
82 | if (position == 'fixed') {
83 | this.setData({
84 | config: [CONFIG_POSITION, CONFIG_POPUP, CONFIG_MASK],
85 | });
86 | } else {
87 | this.setData({
88 | config: [CONFIG_POSITION, CONFIG_MASK],
89 | });
90 | }
91 | },
92 | },
93 | onLoad: function (options) {},
94 | methods: {
95 | configChange(e) {
96 | this.setData({
97 | popup: {
98 | ...this.data.popup,
99 | ...e.detail,
100 | },
101 | });
102 | },
103 | open() {
104 | this.setData({
105 | show: true,
106 | });
107 | },
108 | close() {
109 | this.setData({
110 | show: false,
111 | });
112 | },
113 | tapFixedSelector(e) {
114 | const id = e.currentTarget.id;
115 | this.setData({
116 | popup: {
117 | ...this.data.popup,
118 | selector: `#${id}`,
119 | },
120 | });
121 | this.open();
122 | },
123 | onShareAppMessage(res) {
124 | return {
125 | title: '这个小程序开发工具很实用哦~',
126 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
127 | };
128 | },
129 | },
130 | });
131 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo4/index.js:
--------------------------------------------------------------------------------
1 | const CONFIG_POSITION = {
2 | title: '控制popup-position模式',
3 | list: [
4 | {
5 | name: 'position',
6 | type: 'PICKER',
7 | typeData: ['fixed', 'center', 'left', 'right', 'top', 'bottom'],
8 | },
9 | ],
10 | };
11 | const CONFIG_POPUP = {
12 | title: '控制popup主体',
13 | list: [
14 | {
15 | name: 'selector',
16 | type: 'PICKER',
17 | typeData: ['', '#lefttop', '#righttop', '#leftbottom', '#rightbottom'],
18 | },
19 | {
20 | name: 'left',
21 | type: 'PICKER',
22 | typeData: [0, 50, 100, 200],
23 | },
24 | {
25 | name: 'top',
26 | type: 'PICKER',
27 | typeData: [0, 50, 100, 500],
28 | },
29 | {
30 | name: 'unit',
31 | type: 'TEXT',
32 | disable: true,
33 | },
34 | ],
35 | };
36 | const CONFIG_MASK = {
37 | title: '控制mask',
38 | list: [
39 | {
40 | name: 'mask',
41 | type: 'SWITCH',
42 | },
43 | {
44 | name: 'catchScroll',
45 | type: 'SWITCH',
46 | },
47 | {
48 | name: 'tapMaskClose',
49 | type: 'SWITCH',
50 | },
51 | {
52 | name: 'scrollMaskClose',
53 | type: 'SWITCH',
54 | },
55 | {
56 | name: 'maskColor',
57 | type: 'TEXT',
58 | disable: true,
59 | },
60 | ],
61 | };
62 |
63 | Component({
64 | data: {
65 | config: [CONFIG_POSITION, CONFIG_POPUP, CONFIG_MASK],
66 | popup: {
67 | mask: true,
68 | catchScroll: true,
69 | tapMaskClose: true,
70 | scrollMaskClose: false,
71 | maskColor: 'rgba(0, 0, 0, 0.6)',
72 | selector: '#lefttop',
73 | left: 0,
74 | top: 0,
75 | unit: 'px',
76 | position: 'fixed',
77 | },
78 | show: false,
79 | },
80 | observers: {
81 | 'popup.position': function (position) {
82 | if (position == 'fixed') {
83 | this.setData({
84 | config: [CONFIG_POSITION, CONFIG_POPUP, CONFIG_MASK],
85 | });
86 | } else {
87 | this.setData({
88 | config: [CONFIG_POSITION, CONFIG_MASK],
89 | });
90 | }
91 | },
92 | },
93 | onLoad: function (options) {},
94 | methods: {
95 | configChange(e) {
96 | this.setData({
97 | popup: {
98 | ...this.data.popup,
99 | ...e.detail,
100 | },
101 | });
102 | },
103 | open() {
104 | this.setData({
105 | show: true,
106 | });
107 | },
108 | close() {
109 | this.setData({
110 | show: false,
111 | });
112 | },
113 | tapFixedSelector(e) {
114 | const id = e.currentTarget.id;
115 | this.setData({
116 | popup: {
117 | ...this.data.popup,
118 | selector: `#${id}`,
119 | },
120 | });
121 | this.open();
122 | },
123 | onShareAppMessage(res) {
124 | return {
125 | title: '这个小程序开发工具很实用哦~',
126 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
127 | };
128 | },
129 | },
130 | });
131 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-tool/components/popup-fixed/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | behaviors: ['wx://component-export'],
3 | export() {
4 | return {
5 | open: this._open.bind(this),
6 | close: this._close.bind(this),
7 | };
8 | },
9 | options: {
10 | addGlobalClass: true,
11 | },
12 | properties: {
13 | backgroundColor: {
14 | type: String,
15 | value: '',
16 | },
17 | selector: {
18 | type: String,
19 | value: '',
20 | },
21 | tapBgClose: {
22 | type: Boolean,
23 | value: true,
24 | },
25 | scrollBgClose: {
26 | type: Boolean,
27 | value: false,
28 | },
29 | catchScroll: {
30 | type: Boolean,
31 | value: true,
32 | },
33 | },
34 | observers: {},
35 | data: {
36 | node: {
37 | left: 0,
38 | top: 0,
39 | width: 0,
40 | height: 0,
41 | },
42 | viewport: {
43 | width: 0,
44 | height: 0,
45 | },
46 | visible: false,
47 | },
48 | lifetimes: {
49 | ready() {
50 | this.getViewport().then(({ viewport }) => {
51 | this.setData({ viewport });
52 | });
53 | },
54 | },
55 | methods: {
56 | touchMove() {
57 | if (this.data.scrollBgClose) {
58 | this._close();
59 | }
60 | },
61 | _open() {
62 | this.beforeOpen(this.data.selector).then(() => {
63 | this.setData({
64 | visible: true,
65 | });
66 | });
67 | },
68 | _close() {
69 | this.setData({
70 | visible: false,
71 | });
72 | },
73 | tapBG() {
74 | if (this.data.tapBgClose) {
75 | this._close();
76 | }
77 | },
78 | beforeOpen(selector) {
79 | const { width = 0 } = this.data.viewport;
80 | const needGetViewport = width === 0;
81 | return Promise.all(needGetViewport ? [this.getNode(selector), this.getViewport()] : [this.getNode(selector)])
82 | .then((res = []) => {
83 | var data = {};
84 | res.map((d) => {
85 | data = { ...data, ...d };
86 | });
87 | this.setData(data, () => {
88 | this.triggerEvent('position', {
89 | node: this.data.node,
90 | viewport: this.data.viewport,
91 | });
92 | });
93 | })
94 | .catch((err) => {
95 | console.error(err);
96 | });
97 | },
98 | getViewport() {
99 | return new Promise((resolve) => {
100 | const query = wx.createSelectorQuery();
101 | query
102 | .selectViewport()
103 | .boundingClientRect(({ height, width }) => {
104 | resolve({
105 | viewport: { height, width },
106 | });
107 | })
108 | .exec();
109 | });
110 | },
111 | getNode(selector) {
112 | return new Promise((resolve, reject) => {
113 | if (selector) {
114 | const query = wx.createSelectorQuery();
115 | query
116 | .select(selector)
117 | .boundingClientRect(({ left, top, height, width }) => {
118 | resolve({
119 | node: { left, top, height, width },
120 | });
121 | })
122 | .exec();
123 | } else {
124 | reject('getNode() 没有 selector');
125 | }
126 | });
127 | },
128 | },
129 | });
130 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @description popup
3 | * 整合popup的通用逻辑:初始位置,popup背景,主动控制展示
4 | * 属性:参看properties
5 | * 事件:
6 | * position(){} 动态获取位置之后的回调,在此之前fixed-selector模式的位置可能不正确
7 | * onOpen(){} 打开popup的回调
8 | * onClose(){} 关闭popup的回调
9 | * @author Yrobot
10 | * @date 22/01/2021
11 | */
12 | Component({
13 | behaviors: ['wx://component-export'],
14 | export() {
15 | return {
16 | open: this.open.bind(this),
17 | close: this.close.bind(this),
18 | };
19 | },
20 | options: {
21 | addGlobalClass: true,
22 | },
23 | properties: {
24 | // popup-backgroud
25 | mask: {
26 | // 是否显示 mask
27 | type: Boolean,
28 | value: true,
29 | },
30 | maskColor: {
31 | // mask的颜色,默认rgba(0, 0, 0, 0.6)
32 | type: String,
33 | value: 'rgba(0, 0, 0, 0.6)',
34 | },
35 | tapMaskClose: {
36 | // 点击mask是否关闭popup,先前条件是mask=true
37 | type: Boolean,
38 | value: true,
39 | },
40 | catchScroll: {
41 | // 滑动mask是联动page滑动,先前条件是mask=true
42 | type: Boolean,
43 | value: true,
44 | },
45 | scrollMaskClose: {
46 | // 滑动mask是否关闭popup,先前条件是mask=true
47 | type: Boolean,
48 | value: false,
49 | },
50 |
51 | // fixed-position
52 | selector: {
53 | // position=fixed时,使用selector来设置popup打开位置,默认为结点中心位置,具体数据会在position回调中返回
54 | type: String,
55 | value: '',
56 | },
57 | left: {
58 | // position=fixed时,直接使用left+top来控制popup的打开位置
59 | type: Number,
60 | value: 0,
61 | },
62 | top: {
63 | // position=fixed时,直接使用left+top来控制popup的打开位置
64 | type: Number,
65 | value: 0,
66 | },
67 | unit: {
68 | // position=fixed时,控制left、top的单位,默认px,注意selector模式会自动更新unit为px
69 | type: String,
70 | value: 'px',
71 | },
72 |
73 | // inner properties
74 | show: {
75 | // 是否显示popup
76 | type: Boolean,
77 | value: false,
78 | },
79 | position: {
80 | // popup的定位模式:fixed,center,left,right,top,bottom,默认fixed
81 | type: String,
82 | value: 'fixed', // fixed,center,left,right,top,bottom
83 | },
84 | },
85 | observers: {
86 | show(show) {
87 | if (show) {
88 | this.open();
89 | } else {
90 | this.close();
91 | }
92 | },
93 | position(position) {
94 | if (!['fixed', 'center', 'top', 'right', 'bottom', 'left'].includes(position)) {
95 | console.error(`popup position 不支持传入${position}`);
96 | }
97 | },
98 | },
99 | data: {},
100 | lifetimes: {
101 | ready() {
102 | this.init();
103 | },
104 | },
105 | methods: {
106 | init() {
107 | this._init = true;
108 | this.getFuncVisible();
109 | },
110 | getFixedPosition() {
111 | // this.fixedPosition = this.selectComponent('#fixed-position');
112 | // return this.fixedPosition;
113 | return this.selectComponent('#fixed-position');
114 | },
115 | getFuncVisible() {
116 | this.funcVisible = this.selectComponent('#func-visible');
117 | return this.funcVisible;
118 | },
119 | open(area) {
120 | if (!this._init) {
121 | this.init();
122 | }
123 | const { selector, position } = this.data;
124 | if (position == 'fixed') {
125 | this.getFixedPosition()
126 | .freshPosition(selector, area)
127 | .then((position) => {
128 | this.triggerEvent('position', position);
129 | this.funcVisible.open();
130 | });
131 | } else {
132 | this.funcVisible.open();
133 | }
134 | this.triggerEvent('onOpen', {});
135 | },
136 | close() {
137 | if (!this._init) {
138 | this.init();
139 | }
140 | this.funcVisible.close();
141 | this.triggerEvent('onClose', {});
142 | },
143 | },
144 | });
145 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-popups/demo2/index.js:
--------------------------------------------------------------------------------
1 | const CONFIG_INTRODUCTION = {
2 | title: 'popover简介',
3 | list: [
4 | {
5 | name: '在 popup 的基础上,完善气泡菜单的通用逻辑',
6 | tip: true,
7 | },
8 | {
9 | name: '使用者只需要在 slot 里添加提示或者菜单内容即可',
10 | tip: true,
11 | },
12 | {
13 | name: 'popover 会根据触发位置自动改变展示方向',
14 | tip: true,
15 | },
16 | ],
17 | };
18 | const CONFIG_DEMO_TIP = {
19 | title: '常见场景模拟',
20 | list: [
21 | {
22 | name: '下方是对两种最常用的场景的模拟',
23 | tip: true,
24 | },
25 | {
26 | name: '可以滑动页面,查看按钮的所在半屏位置改变后的窗体方向',
27 | tip: true,
28 | },
29 | {
30 | name: '本小程序首页左上角的用户菜单用的就是 气泡菜单 的手法',
31 | tip: true,
32 | },
33 | ],
34 | };
35 | const CONFIG_TIPS = {
36 | title: 'fixed-popover',
37 | list: [
38 | {
39 | name: 'popover不传selector时,会通过left、top来定位',
40 | tip: true,
41 | },
42 | {
43 | name: 'mina-popups/menu-popover原理就是,计算小程序胶囊位置,并通过left+top的方式来定位popover',
44 | tip: true,
45 | },
46 | ],
47 | };
48 | const CONFIG_MASK = {
49 | title: '设置fixed-popover的mask',
50 | list: [
51 | {
52 | name: 'mask',
53 | type: 'SWITCH',
54 | },
55 | {
56 | name: 'catchScroll',
57 | type: 'SWITCH',
58 | },
59 | {
60 | name: 'tapMaskClose',
61 | type: 'SWITCH',
62 | },
63 | {
64 | name: 'scrollMaskClose',
65 | type: 'SWITCH',
66 | },
67 | {
68 | name: 'maskColor',
69 | type: 'TEXT',
70 | disable: true,
71 | },
72 | ],
73 | };
74 |
75 | const CONFIG_FIXED = {
76 | title: '设置fixed-popover的窗体',
77 | list: [
78 | {
79 | name: 'translateX',
80 | type: 'PICKER',
81 | typeData: [5, 15, 30, 50],
82 | },
83 | {
84 | name: 'left',
85 | type: 'PICKER',
86 | typeData: [50, 100, 300],
87 | },
88 | {
89 | name: 'top',
90 | type: 'PICKER',
91 | typeData: [50, 100, 500],
92 | },
93 | {
94 | name: 'unit',
95 | type: 'TEXT',
96 | disable: true,
97 | },
98 | ],
99 | };
100 |
101 | Component({
102 | data: {
103 | top_tip: [CONFIG_INTRODUCTION],
104 | demo_tip: [CONFIG_DEMO_TIP],
105 | mask_config: [CONFIG_MASK],
106 | fixed_config: [CONFIG_FIXED],
107 | bottom_tip: [CONFIG_TIPS],
108 | popover: {
109 | mask: true,
110 | catchScroll: true,
111 | tapMaskClose: true,
112 | scrollMaskClose: false,
113 | maskColor: 'rgba(0, 0, 0, 0.6)',
114 | left: 50,
115 | top: 50,
116 | unit: 'px',
117 | translateX: 15,
118 | },
119 | fixed_show: false,
120 | popmenu_show: false,
121 | tooltip_show: false,
122 | },
123 | observers: {},
124 | onLoad: function (options) {},
125 | methods: {
126 | configChange(e) {
127 | this.setData({
128 | popover: {
129 | ...this.data.popover,
130 | ...e.detail,
131 | },
132 | });
133 | },
134 | open({ popupType = 'fixed' } = {}) {
135 | this.setData({
136 | [`${popupType}_show`]: true,
137 | });
138 | },
139 | close({ popupType = 'fixed' } = {}) {
140 | this.setData({
141 | [`${popupType}_show`]: false,
142 | });
143 | },
144 | tapFixedSelector(e) {
145 | const id = e.currentTarget.id;
146 | this.open({ popupType: id });
147 | },
148 | tapMenu() {
149 | wx.showToast({
150 | title: '点击菜单项',
151 | icon: 'none',
152 | duration: 1000,
153 | });
154 | this.close({ popupType: 'popmenu' });
155 | },
156 | onShareAppMessage(res) {
157 | return {
158 | title: '这个小程序开发工具很实用哦~',
159 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
160 | };
161 | },
162 | },
163 | });
164 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-popups/popup/fixed-position/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @description fixed-position
3 | * 根据传入参数,处理渲染位置
4 | * top, left: 直接根据top,left作为渲染位置,单位px
5 | * freshPosition(selector, area): 使用选择器获取展示位置
6 | * @author Yrobot
7 | * @date 22/01/2021
8 | */
9 | Component({
10 | behaviors: ['wx://component-export'],
11 | export() {
12 | return {
13 | freshPosition: this.freshPosition.bind(this),
14 | };
15 | },
16 | options: {},
17 | properties: {
18 | left: {
19 | type: Number,
20 | value: 0,
21 | },
22 | top: {
23 | type: Number,
24 | value: 0,
25 | },
26 | unit: {
27 | type: String,
28 | value: 'px',
29 | },
30 | },
31 | observers: {
32 | left(left) {
33 | this.setData({
34 | _left: left,
35 | });
36 | },
37 | top(top) {
38 | this.setData({
39 | _top: top,
40 | });
41 | },
42 | unit(unit) {
43 | this.setData({
44 | _unit: unit,
45 | });
46 | },
47 | },
48 | data: {
49 | _left: 0,
50 | _top: 0,
51 | _unit: 'px',
52 | node: {
53 | left: 0,
54 | top: 0,
55 | width: 0,
56 | height: 0,
57 | },
58 | viewport: {
59 | width: 0,
60 | height: 0,
61 | },
62 | },
63 | lifetimes: {
64 | ready() {
65 | this.getViewport().then(({ viewport }) => {
66 | this.setData({ viewport });
67 | });
68 | },
69 | },
70 | methods: {
71 | _node2position(node) {
72 | if (node) {
73 | return {
74 | _left: node.left + node.width / 2,
75 | _top: node.top + node.height / 2,
76 | _unit: 'px',
77 | };
78 | } else {
79 | return {
80 | _left: this.data.left,
81 | _top: this.data.top,
82 | _unit: this.data.unit,
83 | };
84 | }
85 | },
86 | freshPosition(selector, area) {
87 | const { viewport } = this.data;
88 |
89 | const needGetViewport = viewport.width === 0;
90 | const needGetNode = !!selector;
91 |
92 | const posmiseList = [];
93 | if (needGetViewport) {
94 | posmiseList.push(this.getViewport());
95 | }
96 | if (needGetNode) {
97 | posmiseList.push(this.getNode(selector, area));
98 | }
99 | return new Promise((resolve, reject) => {
100 | Promise.all(posmiseList)
101 | .then((res = []) => {
102 | var data = {};
103 | res.map((d) => {
104 | data = { ...data, ...d };
105 | });
106 | // 更新left, top
107 | data = { ...data, ...this._node2position(data.node) };
108 | this.setData(data, () => {
109 | resolve();
110 | });
111 | })
112 | .catch((err) => {
113 | reject(err);
114 | });
115 | })
116 | .then(() => {
117 | const { viewport, _left, _top, node } = this.data;
118 | return {
119 | viewport,
120 | node,
121 | left: _left,
122 | top: _top,
123 | };
124 | })
125 | .catch((err) => {
126 | console.error(err);
127 | });
128 | },
129 | getViewport() {
130 | return new Promise((resolve) => {
131 | const { windowWidth: width, windowHeight: height } = wx.getSystemInfoSync();
132 | resolve({
133 | viewport: { height, width },
134 | });
135 | });
136 | },
137 | getNode(selector, area) {
138 | return new Promise((resolve, reject) => {
139 | if (selector) {
140 | const query = wx.createSelectorQuery();
141 | if (area) {
142 | query.in(area);
143 | }
144 | query
145 | .select(selector)
146 | .boundingClientRect(({ left, top, height, width }) => {
147 | resolve({
148 | node: { left, top, height, width },
149 | });
150 | })
151 | .exec();
152 | } else {
153 | reject('getNode() 没有 selector');
154 | }
155 | });
156 | },
157 | },
158 | });
159 |
--------------------------------------------------------------------------------
/miniprogram/pages/mina-countdown/demo1/index.js:
--------------------------------------------------------------------------------
1 | import FormChecker from '../../../utils/formChecker';
2 | import Countdown from 'mina-countdown'; // 1. 引入mina-countdown
3 | const { description, shortDesc } = getApp().globalData;
4 | const form_config = {
5 | phone: {
6 | required: true,
7 | tel: true,
8 | },
9 | code: {
10 | required: true,
11 | },
12 | };
13 |
14 | const messages = {
15 | phone: {
16 | required: '请输入手机',
17 | tel: '手机号不符合规范',
18 | },
19 | code: {
20 | required: '请输入验证码',
21 | },
22 | };
23 | Page({
24 | data: {
25 | countdown: 0,
26 | formData: {
27 | phone: '15888888888',
28 | code: '',
29 | },
30 | },
31 | onLoad: function (options) {
32 | // 2. onload实例化mina-countdown
33 | // 会创建this.countdown指向实例对象
34 | new Countdown(this, 'countdown', {
35 | // 大多数情况只需要监听 tick 事件,更新 this.data.countdown 即可满足大部分场景
36 | tick: function (countdown) {
37 | // 在Countdown倒计时过程中触发,触发事件间隔为1s,参数单位:秒
38 | console.log('countdown:' + countdown);
39 | // 更新 data.countdown 做渲染使用
40 | this.setData({
41 | countdown,
42 | });
43 | }.bind(this),
44 | });
45 | },
46 | /**
47 | * @description 更新form数据
48 | * @author Yrobot
49 | * @date 27/01/2021
50 | * @param {*} e
51 | */
52 | inputChange(e) {
53 | const { formData } = this.data;
54 | const { detail = {}, target = {} } = e;
55 | const { value } = detail;
56 | const { type } = target.dataset || {};
57 | formData[type] = value;
58 | this.setData({
59 | formData,
60 | });
61 | },
62 | /**
63 | * @description 表单提交逻辑:检查后请求登录
64 | * @author Yrobot
65 | * @date 20/01/2021
66 | */ tapLogin() {
67 | const { formData } = this.data;
68 | const formChecker = new FormChecker(form_config, messages);
69 |
70 | // 传入表单数据,调用验证方法
71 | if (!formChecker.checkForm(formData)) {
72 | const { msg } = formChecker.errorList[0] || {};
73 | wx.showToast({
74 | title: msg,
75 | icon: 'none',
76 | duration: 1000,
77 | });
78 | } else {
79 | wx.showToast({
80 | title: `发起登录请求`,
81 | icon: 'none',
82 | duration: 1000,
83 | });
84 | }
85 | },
86 | /**
87 | * @description 检测手机号:1必填,2格式正确
88 | * @author Yrobot
89 | * @date 20/01/2021
90 | * @param {*} phone
91 | * @return {*}
92 | */ checkPhone(phone) {
93 | const phoneChecker = new FormChecker(
94 | {
95 | phone: {
96 | required: true,
97 | tel: true,
98 | },
99 | },
100 | {
101 | phone: {
102 | required: '请输入手机',
103 | tel: '手机号不符合规范',
104 | },
105 | },
106 | );
107 | if (!phoneChecker.checkForm({ phone })) {
108 | const { msg } = phoneChecker.errorList[0] || {};
109 | return {
110 | ok: false,
111 | msg,
112 | };
113 | } else {
114 | return {
115 | ok: true,
116 | msg: '',
117 | };
118 | }
119 | },
120 | /**
121 | * @description 发送验证码(包含手机号检查逻辑)
122 | * @author Yrobot
123 | * @date 20/01/2021
124 | */ sendVerificationCode() {
125 | const { formData = {} } = this.data;
126 | const { phone } = formData;
127 | const { ok, msg } = this.checkPhone(phone);
128 | if (!ok) {
129 | wx.showToast({
130 | title: msg,
131 | icon: 'none',
132 | duration: 1000,
133 | });
134 | } else {
135 | this.countdown.start(60); // run for 60 seconds
136 | wx.showToast({
137 | title: `验证码已发送`,
138 | icon: 'none',
139 | duration: 1000,
140 | });
141 | }
142 | },
143 | /**
144 | * @description 点击提示发送验证码倒计时
145 | * @author Yrobot
146 | * @date 20/01/2021
147 | */ showCountdownNotification() {
148 | wx.showToast({
149 | title: `${this.data.countdown}秒后可重新发送`,
150 | icon: 'none',
151 | duration: 1000,
152 | });
153 | },
154 | onShareAppMessage(res) {
155 | return {
156 | title: '这个小程序开发工具很实用哦~',
157 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
158 | };
159 | },
160 | });
161 |
--------------------------------------------------------------------------------
/miniprogram/yarn-error.log:
--------------------------------------------------------------------------------
1 | Arguments:
2 | /usr/local/bin/node /usr/local/Cellar/yarn/1.22.4/libexec/bin/yarn.js
3 |
4 | PATH:
5 | /usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/Users/yrobot/.oh-my-zsh/custom/plugins/git-open:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/Users/yrobot/.oh-my-zsh/custom/plugins/git-open:/usr/local/arc/arcanist/bin:/usr/local/arc/arcanist/bin
6 |
7 | Yarn version:
8 | 1.22.4
9 |
10 | Node version:
11 | 12.16.3
12 |
13 | Platform:
14 | darwin x64
15 |
16 | Trace:
17 | Error: https://registry.npm.taobao.org/mina-popups: Not found
18 | at Request.params.callback [as _callback] (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:66987:18)
19 | at Request.self.callback (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:140748:22)
20 | at Request.emit (events.js:310:20)
21 | at Request. (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:141720:10)
22 | at Request.emit (events.js:310:20)
23 | at IncomingMessage. (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:141642:12)
24 | at Object.onceWrapper (events.js:416:28)
25 | at IncomingMessage.emit (events.js:322:22)
26 | at endReadableNT (_stream_readable.js:1187:12)
27 | at processTicksAndRejections (internal/process/task_queues.js:84:21)
28 |
29 | npm manifest:
30 | {
31 | "name": "mina-tools-client",
32 | "version": "1.0.0",
33 | "description": "mina-tools的小程序客户端代码,用于mina-tools的效果展示",
34 | "main": "app.js",
35 | "dependencies": {
36 | "mina-countdown": "^1.0.1",
37 | "mina-keyword-highlight": "^1.0.0",
38 | "mina-tool": "^1.0.0",
39 | "mina-popups": "^1.0.0",
40 | "mina-touch": "^1.0.1"
41 | },
42 | "devDependencies": {},
43 | "scripts": {},
44 | "repository": {
45 | "type": "git",
46 | "url": "git+https://github.com/Yrobot/mina-tools-client.git"
47 | },
48 | "keywords": [
49 | "Yrobot"
50 | ],
51 | "author": "Yrobot",
52 | "license": "ISC",
53 | "bugs": {
54 | "url": "https://github.com/Yrobot/mina-tools-client/issues"
55 | },
56 | "homepage": "https://github.com/Yrobot/mina-tools-client#readme"
57 | }
58 |
59 | yarn manifest:
60 | No manifest
61 |
62 | Lockfile:
63 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
64 | # yarn lockfile v1
65 |
66 |
67 | mina-countdown@^1.0.1:
68 | version "1.0.1"
69 | resolved "https://registry.yarnpkg.com/mina-countdown/-/mina-countdown-1.0.1.tgz#ffe2b7b4eb7a021d81c51ebef5395f220ab37d79"
70 | integrity sha512-8S6R4d+7RalZ+l32CXJ6mQZg9bHvP5ulvVdxShZVLJfxMgzWLNS07HyKbbMdkQh2kYSLX6hbp/PyiJbbV1R/nQ==
71 | dependencies:
72 | tiny-timer "^1.6.0"
73 |
74 | mina-keyword-highlight@^1.0.0:
75 | version "1.0.0"
76 | resolved "https://registry.yarnpkg.com/mina-keyword-highlight/-/mina-keyword-highlight-1.0.0.tgz#09961c94a17421129f58503c57f4eb2c3a150798"
77 | integrity sha512-TJUzxeybBpT6jti/ZJmzZmDAEKrqtYEyMWiz4ynVfoed3A3ih5MEy0rkfemqliAD6erNGaNOnyykyEazhCAmYw==
78 |
79 | mina-tool@^1.0.0:
80 | version "1.0.0"
81 | resolved "https://registry.yarnpkg.com/mina-tool/-/mina-tool-1.0.0.tgz#a76843c016759f855df2414595c4d801ad3f0238"
82 | integrity sha512-5JS+S3O2kY3xyrX1qa0xkkPtSiST0iKMpdTg6622rEXEV+3POZ+Dc9gOsX9l5SLnBfwbrYsbGBAptH9/ZXfLfQ==
83 |
84 | mina-touch@^1.0.1:
85 | version "1.0.1"
86 | resolved "https://registry.yarnpkg.com/mina-touch/-/mina-touch-1.0.1.tgz#a4692a74bf59cb87576b3a03cfea049ab8b19fab"
87 | integrity sha512-6TLG639zSDCUwmw1pZIdWRKiQGrSJzHmcIDgZhA6xujdJntY/q2IV/G2kRaVuOz/pjwEavfIEkWIMEQohOiHjA==
88 |
89 | mitt@^2.1.0:
90 | version "2.1.0"
91 | resolved "https://registry.yarnpkg.com/mitt/-/mitt-2.1.0.tgz#f740577c23176c6205b121b2973514eade1b2230"
92 | integrity sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==
93 |
94 | tiny-timer@^1.6.0:
95 | version "1.6.0"
96 | resolved "https://registry.yarnpkg.com/tiny-timer/-/tiny-timer-1.6.0.tgz#bae5a112da9f0246b5a8676c86160718680aae68"
97 | integrity sha512-2ciJ4w+0EKDRmVihzj8aBxDw2da9L88aTwslhf1Clphwt2NV927N7xH90tqz/M02lziboDkx+IypnnWqzjnv9g==
98 | dependencies:
99 | mitt "^2.1.0"
100 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/tiny-timer/index.js:
--------------------------------------------------------------------------------
1 | module.exports = (function() {
2 | var __MODS__ = {};
3 | var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
4 | var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
5 | var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
6 | var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
7 | __DEFINE__(1611728676540, function(require, module, exports) {
8 | var mitt = require('mitt');
9 |
10 | function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11 |
12 | var mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);
13 |
14 | class Timer {
15 | constructor({
16 | interval = 1000,
17 | stopwatch = false
18 | } = {}) {
19 | this._duration = 0;
20 | this._endTime = 0;
21 | this._pauseTime = 0;
22 | this._status = 'stopped';
23 | this._emitter = mitt__default['default']();
24 |
25 | this.tick = () => {
26 | if (this.status === 'paused') return;
27 |
28 | if (Date.now() >= this._endTime) {
29 | this.stop();
30 |
31 | this._emitter.emit('tick', this._stopwatch ? this._duration : 0);
32 |
33 | this._emitter.emit('done');
34 | } else {
35 | this._emitter.emit('tick', this.time);
36 | }
37 | };
38 |
39 | this._interval = interval;
40 | this._stopwatch = stopwatch;
41 | }
42 |
43 | start(duration, interval) {
44 | if (this.status !== 'stopped') return;
45 |
46 | if (duration == null) {
47 | throw new TypeError('Must provide duration parameter');
48 | }
49 |
50 | this._duration = duration;
51 | this._endTime = Date.now() + duration;
52 |
53 | this._changeStatus('running');
54 |
55 | this._emitter.emit('tick', this._stopwatch ? 0 : this._duration);
56 |
57 | this._timeoutID = setInterval(this.tick, interval || this._interval);
58 | }
59 |
60 | stop() {
61 | if (this._timeoutID) clearInterval(this._timeoutID);
62 |
63 | this._changeStatus('stopped');
64 | }
65 |
66 | pause() {
67 | if (this.status !== 'running') return;
68 | this._pauseTime = Date.now();
69 |
70 | this._changeStatus('paused');
71 | }
72 |
73 | resume() {
74 | if (this.status !== 'paused') return;
75 | this._endTime += Date.now() - this._pauseTime;
76 | this._pauseTime = 0;
77 |
78 | this._changeStatus('running');
79 | }
80 |
81 | _changeStatus(status) {
82 | this._status = status;
83 |
84 | this._emitter.emit('statusChanged', this.status);
85 | }
86 |
87 | get time() {
88 | if (this.status === 'stopped') return 0;
89 | const time = this.status === 'paused' ? this._pauseTime : Date.now();
90 | const left = this._endTime - time;
91 | return this._stopwatch ? this._duration - left : left;
92 | }
93 |
94 | get duration() {
95 | return this._duration;
96 | }
97 |
98 | get status() {
99 | return this._status;
100 | }
101 |
102 | on(eventName, handler) {
103 | this._emitter.on(eventName, handler);
104 | }
105 |
106 | off(eventName, handler) {
107 | this._emitter.off(eventName, handler);
108 | }
109 |
110 | }
111 |
112 | module.exports = Timer;
113 | //# sourceMappingURL=tiny-timer.js.map
114 |
115 | }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
116 | return __REQUIRE__(1611728676540);
117 | })()
118 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "miniprogramRoot": "miniprogram/",
3 | "cloudfunctionRoot": "cloudfunctions/",
4 | "description": "项目配置文件",
5 | "packOptions": {
6 | "ignore": []
7 | },
8 | "setting": {
9 | "urlCheck": false,
10 | "es6": true,
11 | "enhance": false,
12 | "postcss": true,
13 | "preloadBackgroundData": false,
14 | "minified": true,
15 | "newFeature": false,
16 | "coverView": true,
17 | "nodeModules": false,
18 | "autoAudits": false,
19 | "showShadowRootInWxmlPanel": true,
20 | "scopeDataCheck": false,
21 | "uglifyFileName": false,
22 | "checkInvalidKey": true,
23 | "checkSiteMap": true,
24 | "uploadWithSourceMap": true,
25 | "compileHotReLoad": false,
26 | "useMultiFrameRuntime": true,
27 | "useApiHook": true,
28 | "useApiHostProcess": true,
29 | "babelSetting": {
30 | "ignore": [],
31 | "disablePlugins": [],
32 | "outputPath": ""
33 | },
34 | "enableEngineNative": false,
35 | "bundle": false,
36 | "useIsolateContext": true,
37 | "useCompilerModule": true,
38 | "userConfirmedUseCompilerModuleSwitch": false,
39 | "userConfirmedBundleSwitch": false,
40 | "packNpmManually": false,
41 | "packNpmRelationList": [],
42 | "minifyWXSS": true
43 | },
44 | "compileType": "miniprogram",
45 | "libVersion": "2.14.1",
46 | "appid": "wxe5c2e61483bc7682",
47 | "projectname": "mina-tools-client",
48 | "debugOptions": {
49 | "hidedInDevtools": []
50 | },
51 | "scripts": {},
52 | "isGameTourist": false,
53 | "simulatorType": "wechat",
54 | "simulatorPluginLibVersion": {},
55 | "cloudfunctionTemplateRoot": "cloudfunctionTemplate",
56 | "condition": {
57 | "plugin": {
58 | "list": []
59 | },
60 | "game": {
61 | "list": []
62 | },
63 | "gamePlugin": {
64 | "list": []
65 | },
66 | "miniprogram": {
67 | "list": [
68 | {
69 | "name": "pages/mina-touch/demo1/index",
70 | "pathName": "pages/mina-touch/demo1/index",
71 | "query": "",
72 | "scene": null
73 | },
74 | {
75 | "name": "pages/mina-touch/demo2/index",
76 | "pathName": "pages/mina-touch/demo2/index",
77 | "query": "",
78 | "scene": null
79 | },
80 | {
81 | "name": "pages/mina-touch/demo3/index",
82 | "pathName": "pages/mina-touch/demo3/index",
83 | "query": "",
84 | "scene": null
85 | },
86 | {
87 | "name": "pages/mina-touch/demo4/index",
88 | "pathName": "pages/mina-touch/demo4/index",
89 | "query": "",
90 | "scene": null
91 | },
92 | {
93 | "name": "pages/mina-tools/components/popup-window/index",
94 | "pathName": "pages/mina-tools/components/popup-window/index",
95 | "query": "",
96 | "scene": null
97 | },
98 | {
99 | "name": "pages/index/index",
100 | "pathName": "pages/index/index",
101 | "query": "main=mina-countdown",
102 | "scene": null
103 | },
104 | {
105 | "name": "pages/mina-tool/components/keyword-highlight/index",
106 | "pathName": "pages/mina-tool/components/keyword-highlight/index",
107 | "query": "",
108 | "scene": null
109 | },
110 | {
111 | "name": "multi-picker",
112 | "pathName": "pages/mina-tool/components/multi-picker/index",
113 | "query": "",
114 | "scene": null
115 | },
116 | {
117 | "name": "pages/mina-countdown/demo1/index",
118 | "pathName": "pages/mina-countdown/demo1/index",
119 | "query": "",
120 | "scene": null
121 | },
122 | {
123 | "name": "pages/mina-countdown/demo2/index",
124 | "pathName": "pages/mina-countdown/demo2/index",
125 | "query": "",
126 | "scene": null
127 | },
128 | {
129 | "name": "pages/mina-keyword-highlight/demo2/index",
130 | "pathName": "pages/mina-keyword-highlight/demo2/index",
131 | "query": "",
132 | "scene": null
133 | },
134 | {
135 | "name": "mina-popups/demo1",
136 | "pathName": "pages/mina-popups/demo1/index",
137 | "query": "",
138 | "scene": null
139 | },
140 | {
141 | "name": "popups/demo2",
142 | "pathName": "pages/mina-popups/demo2/index",
143 | "query": "",
144 | "scene": null
145 | },
146 | {
147 | "name": "mina-popups/demo3",
148 | "pathName": "pages/mina-popups/demo3/index",
149 | "query": "",
150 | "scene": null
151 | }
152 | ]
153 | }
154 | }
155 | }
--------------------------------------------------------------------------------
/miniprogram/iconfont.wxss:
--------------------------------------------------------------------------------
1 | @font-face {font-family: "iconfont";
2 | src: url('//at.alicdn.com/t/font_2269699_n9lwljss6k.eot?t=1613714359448'); /* IE9 */
3 | src: url('//at.alicdn.com/t/font_2269699_n9lwljss6k.eot?t=1613714359448#iefix') format('embedded-opentype'), /* IE6-IE8 */
4 | url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAogAAsAAAAAEpAAAAnSAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCEaAqVOJEKATYCJAM4Cx4ABCAFhG0HgVMbew9RlFBWB9kXBXbDslUY2iZs8zdIj7CJtW361Ejv9wONqOcI6Md+7RNENKl2r5YIybQRIft0QoQKyVIh60m8eP9yqt890dJxZ8KgroUmV+TX8ND7pHcWL8OFJagAtoAVFuf//zbtPiA2g3lErCZEqzTGQIgJVZp+ySmVoXWI+5mI1TRW0RXDmlVnVYCIXe30vchZioVZykfQpfn5+vzPtXqGeUguIRPKlUSIE/t/2737+DD3TKg0Qjvf0BNPt8ajESqUSm2o1CaBmfQwLy6/iX8CynVLzCzdPL3CsoxgwKoDZyQsB5rllKyg1FTMvJotl5vSeOKrwK31++GXpLAsoqIkFNDa1nUKZx+cTvoqkIrSScb6JJwskTAC5JP4zJqfgA+PnDnlGxkugFbb8t9U+hFfyavnLVSD6zH+u11Op8vFB0hH02NBqyPRBYpaf7lMlWJZVKpCpZKe/POKReErEfcwXcUHaBUU8YEqSHzQoKjgAaQMAh9kOcEbSDGEUCAZQgOg8sJ1VFDKJwOpsIQeVFDJL1cFJfx1dipHfLXxSicwAdIuQF4GiBsWiEKb+OJ154vWG6SHXL4pcq4Pl8HGomNwkZAvJMJQ9OcyeEymj5zBTAnislhIcAz5y31FYh/cy8CEztkQ5ui8nN6zgOP0gXdWcm685cvofbOkez6MSc1KaV1zOMu84G0YmZMBk7otBUbXTCjOKqNlazxQuJ4XaUEtXV0gNOrC1l4ZoSI0xMgtiUZXo560raqq3nnJZjBPkOMYBhaLymolAG87uCfkitsne6ZwHNntGptNjTDTpFGS9GxIXjAyA+R0SFYFwNGwXSN5RWPdYrUGBFQy2tSjF5FxKtxuR9t7LaueKR5svWvzQ9D31nLcPNZj7B7FMGQomajOvcZJDLv+pg+QXSPxniOEj01VkhOhOHRNmKe8Uf/bKzBq/HBXpOfWO/4FEMATFbRl9kCi6TCK1e2mcVJEqFpJVVsbiAPOSZMmIa4hatJ492RYg7tAyWhlLVbCas97x67uvnm7VzZjoQGbzW4vvtA4echsJS1NTOBmu9FmvaRCLNhPWnEcMJPNaJesW8rtX2psX6gtn6msn88pPrP4ZFq0WAp6Lt27Mdc3fRsbjMUJ/Kk9eNiW+cgSQPZno6p31jQ/vICbGwDiqDRkzUjDB7hkHAGODPXwRJ0LteOvLjMJW9dJ1rtjKnzsknf/66ZXfYC0rALeUGQD8VNvrOzAzRPS1nFhq5Cahr7XzG/4owH72nsZXdhAxhiSO7onqYmTRMyOiZ0YHe8UJbYGaAmA1U3f6cO2/N7ZZcyb8370gYWVrBtzvodN4wDkrHV0T/J8vHQKFyNknNyHka7QM3st5dhcU4GZUh5wQVtgUBcYL4Zt4UmauvtJxP5EbSN7O6o3/DUDthX7R+8i9G6dFjrHTXflyFarAvK2Ydu6o0ZqFYET09ZIYsIcrZky6m64ltbf2/jQHtQ+KlSp94CX3eInluxZSyAxplJXzZLr75jXaq6WbWJit4exJqD0LOUJjYMkeA56IllXkxsv+0A2z63GUi/hME5ctixm4O8wM3wtPgQTIuiKwWRMQZJxqzzA85NTHqQCSx6EKAAg18JRJEOk7Ibi6cbMzDNnanL/v1UlI6qrFxY0Twh5huGHzNyCgnf+On78/zzkXZdH7tZdQXmwJk3BTQ9I527TgbaiLjc8N8x4E7S6bT8u81/24/Kynz3WKzi8NkxXT2aW7d+C6SB1W43CPzKbL8wOt6Lath/SdFHRzOUH0yLsy/0zZSlL2TFJh+KjY3RpecqsVvBFWStVT48XZmRcFdzpor+zIdUdmin2+x9RnPqvfL+u51AU92W/X//LzaMSl4T66H02xVkKgqXYFw58sF8sdpVRlPi72O/cC2wrc4Jgwt1Zlin3q3rf/q9kypynOGp3kQdx4sQHYR/oC74PfS/MWUwLnGE9bN3vsSZnsOu90O8z0B1ojNv3td/XfVwj7h8cSCxzEo0dC1QhyMWn3ZpWo5NVklxh3obOLTHbIinhu6+JqMhtQ7vTR4brWOWbt1QwtctCC+WVO9YtS5mKnAIrkW84dlmtkT+dO71CqdzHrXA63nGpqIseueJ9cTpxPbg23WcAMO4LBKDv8+alDtMdDjq44SMOVlHv5BceZ644eLXRWikLyYE1qNwhlyuVQ0M7lBiLJ0frnsK91CnOawHH5dzFIaVS7p3iBs4COfeVpfVLEEAnXzICAhgK9/KIg/VUVL0ek++JeM1MaUGe8ozbxBdeNH1eMf/v2LgtOscyJdpZgjKYVT75nldTY5yrrP4tgX/hsYymz9XT/mLFbdY9T9gBuhKUGVUFCQ/IP44dX3TUhaUV4ofxQtONOsfi8WN/7M3I81qLUvPzU5FDxeABSl3rlZHn8Qzd4zq499BamD36MguJighuNa+PVx1IQB8QQzzwgWH5PdVruX9f9r/8TcA3C/4Lf28Q+EkbBfyNNd/AiQUgRawhoVz+jwjkvBtvkRyP9xJSf1kW6Fxx+dhHR85w5NHfnuU/PxKVNuO/SLKlmcFhLjUWmR7/J7E9MoXjyaLxTCkb1izWvvrq99l4yt07+g/HamrGPtQ7306EZ3346itJy5IKC4OXrdmgSJVP8poCfwo45lxLnDOePCgQHDQaz+uu/nAsgJsRXIQaGtIH6isqMC+alhavjbc70vlf8g6F6EIOhhyCE7NAC1wn6P/SScu8mARQYIo0qfrOnQzmfmlMXRLSC9oztJHVdB81AIXb6Vma8lAW/3Fd53GxrrhCIo36urZn7DFOSznr/kP+CB99J/jLIusl25tUKiIYaiK+nFFWpGj+s0+GWqrzndJMc15LwYX9/GEga+mqdvrtz2sLlIt7fC331fuVxabc1L+B2OQVRiW6QOLiekBG3EhhkQozoBhxs4Xlht2+XaFBMCfkKAz5QGFQ67MwqvYGEuK+QUbcT2GRZn9cMdLCXGG59SBws0JfcKtpASVjKvpj4RR5rbbxqr36GU1dyCAzB2fvGKIjLzrN9nv2Fj2GOhTiwHSZtdCBSnEjyWBRkKgCZai4aTFT9VotfVFsKiph1aIASWyUTgl94/qOQjz9MFuN/PwzZNQKUkg59FH/HQoi93Sho6mdQ3vL+1yH9mVjNGB0sSxpQtsZkJJwI0uoEFNEqHhbGaSwJltiotLTki/Teflm+2K51ZnP9SMovOqg0BgsDk8gksgUKo0OWydU1dWa3nnZcJvj4dFyjuMhhbRhnbGF5gWvVFLtOaWhX92Hmhshxv1FnfQmlfP7nM93Rk6SsujNqI7m/Il1e0N0OO+vL3VHi1oKfeJ5Pfp6tZVZplpZd5KKCAAA') format('woff2'),
5 | url('//at.alicdn.com/t/font_2269699_n9lwljss6k.woff?t=1613714359448') format('woff'),
6 | url('//at.alicdn.com/t/font_2269699_n9lwljss6k.ttf?t=1613714359448') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
7 | url('//at.alicdn.com/t/font_2269699_n9lwljss6k.svg?t=1613714359448#iconfont') format('svg'); /* iOS 4.1- */
8 | }
9 |
10 | .iconfont {
11 | font-family: "iconfont" !important;
12 | font-size: 16px;
13 | font-style: normal;
14 | -webkit-font-smoothing: antialiased;
15 | -moz-osx-font-smoothing: grayscale;
16 | }
17 |
18 | .icon-popup:before {
19 | content: "\e602";
20 | }
21 |
22 | .icon-mina-popups:before {
23 | content: "\e68f";
24 | }
25 |
26 | .icon-mina-keyword-highlight:before {
27 | content: "\e601";
28 | }
29 |
30 | .icon-countdown:before {
31 | content: "\e625";
32 | }
33 |
34 | .icon-left-right:before {
35 | content: "\e600";
36 | }
37 |
38 | .icon-fangda:before {
39 | content: "\e61b";
40 | }
41 |
42 | .icon-link:before {
43 | content: "\ebff";
44 | }
45 |
46 | .icon-xiaochengxushezhi:before {
47 | content: "\e6b4";
48 | }
49 |
50 | .icon-weixinxiaochengxu2x:before {
51 | content: "\e607";
52 | }
53 |
54 | .icon-Yorbot:before {
55 | content: "\eeee";
56 | }
57 |
58 | .icon-menu:before {
59 | content: "\e704";
60 | }
61 |
62 | .icon-mina-touch:before {
63 | content: "\e79b";
64 | }
65 |
66 | .icon-mina-tools:before {
67 | content: "\e612";
68 | }
69 |
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp();
4 |
5 | Page({
6 | data: {
7 | main: '',
8 | repositories: [
9 | {
10 | title: '监听交互手势',
11 | id: 'mina-touch',
12 | icon: 'icon-mina-touch',
13 | description: 'mina-touch',
14 | list: [
15 | {
16 | title: '普通滑动',
17 | description: '测试单点触控事件',
18 | path: '/pages/mina-touch/demo1/index',
19 | },
20 | {
21 | title: '多点操控',
22 | description: '测试多点触控事件',
23 | path: '/pages/mina-touch/demo2/index',
24 | },
25 | {
26 | title: '监听双击',
27 | description: '测试监听双击事件',
28 | path: '/pages/mina-touch/demo3/index',
29 | },
30 | {
31 | title: '监听长按',
32 | description: '测试监听长按事件',
33 | path: '/pages/mina-touch/demo4/index',
34 | },
35 | ],
36 | },
37 | {
38 | title: '关键词高亮',
39 | id: 'mina-keyword-highlight',
40 | icon: 'icon-mina-keyword-highlight',
41 | description: 'mina-keyword-highlight',
42 | list: [
43 | {
44 | title: '搜索高亮',
45 | description: '搜索结果关键词高亮',
46 | path: '/pages/mina-keyword-highlight/demo2/index',
47 | },
48 | {
49 | title: '文章关键词高亮',
50 | description: '支持外部文字样式继承',
51 | path: '/pages/mina-keyword-highlight/demo1/index',
52 | },
53 | ],
54 | },
55 | {
56 | title: '倒计时',
57 | id: 'mina-countdown',
58 | icon: 'icon-countdown',
59 | description: 'mina-countdown',
60 | list: [
61 | {
62 | title: '验证码发送',
63 | description: '快速实现验证码发送倒计时',
64 | path: '/pages/mina-countdown/demo1/index',
65 | },
66 | {
67 | title: '结点倒计时',
68 | description: '时间结点倒数',
69 | path: '/pages/mina-countdown/demo2/index',
70 | },
71 | ],
72 | },
73 | {
74 | title: '弹出组件集合',
75 | id: 'mina-popups',
76 | // icon: 'icon-popup',
77 | icon: 'icon-mina-popups',
78 | description: 'mina-popups',
79 | list: [
80 | {
81 | title: '基础弹出组件',
82 | description: 'popup组件展示',
83 | path: '/pages/mina-popups/demo1/index',
84 | },
85 | {
86 | title: '气泡卡片',
87 | description: 'popover组件展示',
88 | path: '/pages/mina-popups/demo2/index',
89 | },
90 | {
91 | title: '胶囊气泡卡片',
92 | description: 'menu-popover组件展示',
93 | path: '/pages/mina-popups/demo3/index',
94 | },
95 | ],
96 | },
97 | // {
98 | // title: 'mina-tool',
99 | // id: 'mina-tool',
100 | // icon: 'icon-mina-tools',
101 | // description: '',
102 | // list: [
103 | // {
104 | // title: '组件',
105 | // description: '',
106 | // list: [
107 | // {
108 | // title: 'popup-window',
109 | // description: '浮动弹窗',
110 | // path: '/pages/mina-tool/components/popup-window/index',
111 | // },
112 | // {
113 | // title: 'error-img',
114 | // description: '错图兜底',
115 | // path: '/pages/mina-tool/components/error-img/index',
116 | // },
117 | // {
118 | // title: 'data-status',
119 | // description: '状态展示',
120 | // path: '/pages/mina-tool/components/data-status/index',
121 | // },
122 | // ],
123 | // },
124 | // {
125 | // title: 'wxs',
126 | // description: '',
127 | // list: [
128 | // {
129 | // title: 'format',
130 | // description: '数据格式化',
131 | // path: '/pages/mina-tool/wxs/format/index',
132 | // },
133 | // ],
134 | // },
135 | // {
136 | // title: 'wxss',
137 | // description: '',
138 | // list: [
139 | // {
140 | // title: 'common',
141 | // description: '常用小程序样式',
142 | // path: '/pages/mina-tool/wxss/common/index',
143 | // },
144 | // ],
145 | // },
146 | // {
147 | // title: 'behavior',
148 | // description: '',
149 | // list: [
150 | // {
151 | // title: 'pageEvent',
152 | // description: '组件监听页面事件',
153 | // path: '/pages/mina-tool/behavior/pageEvent/index',
154 | // },
155 | // ],
156 | // },
157 | // ],
158 | // },
159 | ],
160 | },
161 | menu: {
162 | open() {},
163 | close() {},
164 | },
165 | onShareAppMessage(res) {
166 | return {
167 | title: '这个小程序开发工具很实用哦~',
168 | imageUrl: 'https://t.newscdn.cn/mina/Poster (1).png',
169 | };
170 | },
171 | onLoad(query) {
172 | const { main: pathMain = '', scene = '' } = query;
173 | const main = pathMain || decodeURIComponent(scene);
174 | if (main) {
175 | this.setData({
176 | main,
177 | repositories: this.data.repositories.sort((a, b) => (a.id == main ? -1 : 1)),
178 | });
179 | wx.pageScrollTo({
180 | selector: `#${main}`,
181 | duration: 300,
182 | });
183 | }
184 | this.menu = this.selectComponent('#home-menu');
185 | },
186 | tapMenu(e) {
187 | this.menu.open();
188 | },
189 | navigateTo(e) {
190 | const { path = '' } = e.currentTarget.dataset;
191 | if (path) {
192 | wx.navigateTo({ url: path });
193 | }
194 | },
195 | });
196 |
--------------------------------------------------------------------------------
/miniprogram/miniprogram_npm/mina-touch/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["mina-touch.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["const DEFAULT_OPTIONS = {\r\n touchStart: function () { },\r\n touchMove: function () { },\r\n touchEnd: function () { },\r\n touchCancel: function () { },\r\n multipointStart: function () { },\r\n multipointEnd: function () { },\r\n tap: function () { },\r\n doubleTap: function () { },\r\n longTap: function () { },\r\n singleTap: function () { },\r\n rotate: function () { },\r\n pinch: function () { },\r\n pressMove: function () { },\r\n swipe: function () { }\r\n}\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });class MinaTouch {\r\n constructor(_page, name, option = {}) {\r\n this.preV = { x: null, y: null };\r\n this.pinchStartLen = null;\r\n this.scale = 1;\r\n this.isDoubleTap = false;\r\n\r\n this.delta = null;\r\n this.last = null;\r\n this.now = null;\r\n this.tapTimeout = null;\r\n this.singleTapTimeout = null;\r\n this.longTapTimeout = null;\r\n this.swipeTimeout = null;\r\n this.x1 = this.x2 = this.y1 = this.y2 = null;\r\n this.preTapPosition = { x: null, y: null };\r\n\r\n this.lastZoom = 1;\r\n this.tempZoom = 1;\r\n\r\n try {\r\n if (this._checkBeforeCreate(_page, name)) {\r\n this._name = name\r\n this._option = { ...DEFAULT_OPTIONS, ...option }\r\n _page[name] = this\r\n this._bindFunc(_page)\r\n }\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n }\r\n _checkBeforeCreate(_page, name) {\r\n if (!_page || !name) {\r\n throw new Error('MinaTouch实例化时,必须传入page对象和引用名')\r\n }\r\n if (_page[name]) {\r\n throw new Error('MinaTouch实例化error: ' + name + ' 已经存在page中')\r\n }\r\n return true\r\n }\r\n _bindFunc(_page) {\r\n let funcNames = ['start', 'move', 'end', 'cancel']\r\n for (let funcName of funcNames)\r\n _page[this._name + '.' + funcName] = this[funcName].bind(this)\r\n }\r\n start(evt) {\r\n if (!evt.touches) return;\r\n this.now = Date.now();\r\n this.x1 = evt.touches[0].pageX == null ? evt.touches[0].x : evt.touches[0].pageX;\r\n this.y1 = evt.touches[0].pageY == null ? evt.touches[0].y : evt.touches[0].pageY;\r\n this.delta = this.now - (this.last || this.now);\r\n this._option.touchStart(evt);\r\n if (this.preTapPosition.x !== null) {\r\n this.isDoubleTap = (this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30);\r\n }\r\n this.preTapPosition.x = this.x1;\r\n this.preTapPosition.y = this.y1;\r\n this.last = this.now;\r\n let preV = this.preV,\r\n len = evt.touches.length;\r\n if (len > 1) {\r\n this._cancelLongTap();\r\n this._cancelSingleTap();\r\n let otx = evt.touches[1].pageX == null ? evt.touches[1].x : evt.touches[1].pageX;\r\n let oty = evt.touches[1].pageY == null ? evt.touches[1].y : evt.touches[1].pageY;\r\n let v = { x: otx - this.x1, y: oty - this.y1 };\r\n preV.x = v.x;\r\n preV.y = v.y;\r\n this.pinchStartLen = getLen(preV);\r\n this._option.multipointStart(evt);\r\n }\r\n this.longTapTimeout = setTimeout(function () {\r\n evt.type = \"longTap\";\r\n this._option.longTap(evt);\r\n }.bind(this), 750);\r\n }\r\n move(evt) {\r\n if (!evt.touches) return;\r\n let preV = this.preV,\r\n len = evt.touches.length,\r\n currentX = evt.touches[0].pageX == null ? evt.touches[0].x : evt.touches[0].pageX,\r\n currentY = evt.touches[0].pageY == null ? evt.touches[0].y : evt.touches[0].pageY;\r\n this.isDoubleTap = false;\r\n if (len > 1) {\r\n let otx = evt.touches[1].pageX == null ? evt.touches[1].x : evt.touches[1].pageX;\r\n let oty = evt.touches[1].pageY == null ? evt.touches[1].y : evt.touches[1].pageY;\r\n let v = { x: otx - currentX, y: oty - currentY };\r\n\r\n if (preV.x !== null) {\r\n if (this.pinchStartLen > 0) {\r\n evt.singleZoom = getLen(v) / this.pinchStartLen;\r\n evt.zoom = evt.singleZoom * this.lastZoom;\r\n this.tempZoom = evt.zoom;\r\n evt.type = \"pinch\";\r\n this._option.pinch(evt);\r\n }\r\n\r\n evt.angle = getRotateAngle(v, preV);\r\n evt.type = \"rotate\";\r\n this._option.rotate(evt);\r\n }\r\n preV.x = v.x;\r\n preV.y = v.y;\r\n } else {\r\n if (this.x2 !== null) {\r\n evt.deltaX = currentX - this.x2;\r\n evt.deltaY = currentY - this.y2;\r\n\r\n } else {\r\n evt.deltaX = 0;\r\n evt.deltaY = 0;\r\n }\r\n this._option.pressMove(evt);\r\n }\r\n\r\n this._option.touchMove(evt);\r\n\r\n this._cancelLongTap();\r\n this.x2 = currentX;\r\n this.y2 = currentY;\r\n if (len > 1) {\r\n // evt.preventDefault();\r\n }\r\n }\r\n end(evt) {\r\n if (!evt.changedTouches) return;\r\n this._cancelLongTap();\r\n let self = this;\r\n evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2); //在结束钩子都加入方向判断,但触发swipe瞬时必须位移大于30\r\n if (evt.touches.length < 2) {\r\n this.lastZoom = this.tempZoom;\r\n this._option.multipointEnd(evt);\r\n }\r\n this._option.touchEnd(evt);\r\n //swipe\r\n if ((this.x2 && Math.abs(this.x1 - this.x2) > 30) ||\r\n (this.y2 && Math.abs(this.y1 - this.y2) > 30)) {\r\n // evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2);\r\n this.swipeTimeout = setTimeout(function () {\r\n evt.type = \"swipe\";\r\n self._option.swipe(evt);\r\n\r\n }, 0)\r\n } else {\r\n this.tapTimeout = setTimeout(function () {\r\n evt.type = \"tap\";\r\n self._option.tap(evt);\r\n // trigger double tap immediately\r\n if (self.isDoubleTap) {\r\n evt.type = \"doubleTap\";\r\n self._option.doubleTap(evt);\r\n clearTimeout(self.singleTapTimeout);\r\n self.isDoubleTap = false;\r\n }\r\n }, 0)\r\n\r\n if (!self.isDoubleTap) {\r\n self.singleTapTimeout = setTimeout(function () {\r\n self._option.singleTap(evt);\r\n }, 250);\r\n }\r\n }\r\n\r\n this.preV.x = 0;\r\n this.preV.y = 0;\r\n this.scale = 1;\r\n this.pinchStartLen = null;\r\n this.x1 = this.x2 = this.y1 = this.y2 = null;\r\n }\r\n cancel(evt) {\r\n clearTimeout(this.singleTapTimeout);\r\n clearTimeout(this.tapTimeout);\r\n clearTimeout(this.longTapTimeout);\r\n clearTimeout(this.swipeTimeout);\r\n this._option.touchCancel(evt);\r\n }\r\n _cancelLongTap() {\r\n clearTimeout(this.longTapTimeout);\r\n }\r\n\r\n _cancelSingleTap() {\r\n clearTimeout(this.singleTapTimeout);\r\n }\r\n\r\n _swipeDirection(x1, x2, y1, y2) {\r\n return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')\r\n }\r\n destroy() {\r\n if (this.singleTapTimeout) clearTimeout(this.singleTapTimeout);\r\n if (this.tapTimeout) clearTimeout(this.tapTimeout);\r\n if (this.longTapTimeout) clearTimeout(this.longTapTimeout);\r\n if (this.swipeTimeout) clearTimeout(this.swipeTimeout);\r\n\r\n this._option.rotate = null;\r\n this._option.touchStart = null;\r\n this._option.multipointStart = null;\r\n this._option.multipointEnd = null;\r\n this._option.pinch = null;\r\n this._option.swipe = null;\r\n this._option.tap = null;\r\n this._option.doubleTap = null;\r\n this._option.longTap = null;\r\n this._option.singleTap = null;\r\n this._option.pressMove = null;\r\n this._option.touchMove = null;\r\n this._option.touchEnd = null;\r\n this._option.touchCancel = null;\r\n\r\n this.preV = this.pinchStartLen = this.scale = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = null;\r\n\r\n return null;\r\n }\r\n};exports.default = MinaTouch\r\n\r\nfunction getLen(v) {\r\n return Math.sqrt(v.x * v.x + v.y * v.y);\r\n}\r\n\r\nfunction dot(v1, v2) {\r\n return v1.x * v2.x + v1.y * v2.y;\r\n}\r\n\r\nfunction getAngle(v1, v2) {\r\n let mr = getLen(v1) * getLen(v2);\r\n if (mr === 0) return 0;\r\n let r = dot(v1, v2) / mr;\r\n if (r > 1) r = 1;\r\n return Math.acos(r);\r\n}\r\n\r\nfunction cross(v1, v2) {\r\n return v1.x * v2.y - v2.x * v1.y;\r\n}\r\n\r\nfunction getRotateAngle(v1, v2) {\r\n let angle = getAngle(v1, v2);\r\n if (cross(v1, v2) > 0) {\r\n angle *= -1;\r\n }\r\n\r\n return angle * 180 / Math.PI;\r\n}"]}
--------------------------------------------------------------------------------