├── AsyncAwait
├── app.wxss
├── pages
│ └── index
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ └── index.js
├── README.md
├── app.json
├── app.js
├── project.config.json
└── utils
│ └── runtime.js
├── GlobalReload
├── pages
│ ├── error
│ │ ├── error.json
│ │ ├── error.wxss
│ │ ├── error.wxml
│ │ └── error.js
│ ├── index
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ └── index.js
│ └── subIndex
│ │ ├── subIndex.json
│ │ ├── subIndex.wxss
│ │ ├── subIndex.wxml
│ │ └── subIndex.js
├── app.wxss
├── package
│ └── buy
│ │ └── buyDetail
│ │ ├── buyDetail.json
│ │ ├── buyDetail.wxss
│ │ ├── buyDetail.wxml
│ │ └── buyDetail.js
├── app.js
├── README.md
├── app.json
├── utils
│ ├── util.js
│ └── fetch.js
└── project.config.json
├── DatePicker
├── app.wxss
├── pages
│ ├── selectDate
│ │ ├── selectDate.json
│ │ ├── selectDate.wxss
│ │ ├── selectDate.wxml
│ │ └── selectDate.js
│ └── index
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ └── index.js
├── sitemap.json
├── app.json
├── app.js
├── project.config.json
└── utils
│ └── Moment.js
├── NavigationBar
├── pages
│ ├── end
│ │ ├── end.wxss
│ │ ├── end.json
│ │ ├── end.wxml
│ │ └── end.js
│ ├── index
│ │ ├── index.wxss
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.js
│ ├── fixed
│ │ ├── fixed.wxss
│ │ ├── fixed.json
│ │ ├── fixed.wxml
│ │ └── fixed.js
│ ├── subIndex
│ │ ├── subIndex.wxss
│ │ ├── subIndex.json
│ │ ├── subIndex.wxml
│ │ └── subIndex.js
│ ├── fixedSub
│ │ ├── fixedSub.wxss
│ │ ├── fixedSub.wxml
│ │ ├── fixedSub.json
│ │ └── fixedSub.js
│ └── thirdIndex
│ │ ├── thirdIndex.json
│ │ ├── thirdIndex.wxss
│ │ ├── thirdIndex.wxml
│ │ └── thirdIndex.js
├── components
│ ├── backHome
│ │ ├── backHome.json
│ │ ├── backHome.wxml
│ │ ├── backHome.wxss
│ │ └── backHome.js
│ └── navigationBar
│ │ ├── navigationBar.json
│ │ ├── navigationBar.wxml
│ │ ├── navigationBar.js
│ │ └── navigationBar.wxss
├── images
│ ├── back.png
│ └── home.png
├── sitemap.json
├── app.wxss
├── app.js
├── utils
│ └── util.js
├── app.json
├── README.md
└── project.config.json
├── DropdownView
├── pages
│ ├── index
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ └── index.js
│ └── logs
│ │ ├── logs.json
│ │ ├── logs.wxss
│ │ ├── logs.wxml
│ │ └── logs.js
├── app.js
├── app.wxss
├── app.json
├── utils
│ ├── util.js
│ └── city.js
└── project.config.json
├── Components
├── components
│ ├── topHint
│ │ ├── topHint.json
│ │ ├── topHint.wxml
│ │ ├── topHint.wxss
│ │ └── topHint.js
│ └── toastImageText
│ │ ├── toastImageText.json
│ │ ├── toastImageText.wxml
│ │ ├── toastImageText.js
│ │ └── toastImageText.wxss
├── pages
│ └── index
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
├── sitemap.json
├── app.js
├── app.wxss
├── app.json
├── utils
│ └── util.js
└── project.config.json
├── ShareImage
├── components
│ ├── shareView
│ │ ├── shareView.json
│ │ ├── shareView.wxml
│ │ ├── shareView.js
│ │ └── shareView.wxss
│ └── toastImage
│ │ ├── toastImage.json
│ │ ├── toastImage.wxml
│ │ ├── toastImage.wxss
│ │ └── toastImage.js
├── pages
│ └── index
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
├── app.wxss
├── app.json
├── utils
│ └── util.js
├── project.config.json
└── app.js
└── README.md
/AsyncAwait/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 |
--------------------------------------------------------------------------------
/AsyncAwait/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/GlobalReload/pages/error/error.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/GlobalReload/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/DatePicker/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 |
3 |
--------------------------------------------------------------------------------
/GlobalReload/pages/subIndex/subIndex.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/DatePicker/pages/selectDate/selectDate.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/GlobalReload/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 |
3 |
--------------------------------------------------------------------------------
/GlobalReload/package/buy/buyDetail/buyDetail.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/AsyncAwait/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/AsyncAwait/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 |
--------------------------------------------------------------------------------
/NavigationBar/pages/end/end.wxss:
--------------------------------------------------------------------------------
1 | /* pages/end/end.wxss */
--------------------------------------------------------------------------------
/NavigationBar/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 |
--------------------------------------------------------------------------------
/GlobalReload/pages/error/error.wxss:
--------------------------------------------------------------------------------
1 | /* pages/error/error.wxss */
--------------------------------------------------------------------------------
/DatePicker/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/NavigationBar/pages/fixed/fixed.wxss:
--------------------------------------------------------------------------------
1 | /* pages/fixed/fixed.wxss */
--------------------------------------------------------------------------------
/NavigationBar/pages/subIndex/subIndex.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subIndex.wxss */
--------------------------------------------------------------------------------
/DropdownView/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/NavigationBar/pages/fixed/fixed.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/NavigationBar/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/GlobalReload/pages/subIndex/subIndex.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subIndex/subIndex.wxss */
--------------------------------------------------------------------------------
/NavigationBar/pages/fixedSub/fixedSub.wxss:
--------------------------------------------------------------------------------
1 | /* pages/fixedSub/fixedSub.wxss */
--------------------------------------------------------------------------------
/NavigationBar/pages/subIndex/subIndex.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/GlobalReload/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | }
5 | })
--------------------------------------------------------------------------------
/NavigationBar/pages/thirdIndex/thirdIndex.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/DropdownView/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 |
5 | }
6 | })
--------------------------------------------------------------------------------
/NavigationBar/pages/thirdIndex/thirdIndex.wxss:
--------------------------------------------------------------------------------
1 | /* pages/thirdIndex/thirdIndex.wxss */
--------------------------------------------------------------------------------
/GlobalReload/README.md:
--------------------------------------------------------------------------------
1 | ###功能:
2 |
3 | 处理服务器报错后,跳转到错误页。
4 |
5 | 且可以点击重新加载,加载网络请求失败页。
6 |
--------------------------------------------------------------------------------
/GlobalReload/package/buy/buyDetail/buyDetail.wxss:
--------------------------------------------------------------------------------
1 | /* package/buy/buyDetail/buyDetail.wxss */
--------------------------------------------------------------------------------
/Components/components/topHint/topHint.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/NavigationBar/components/backHome/backHome.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/ShareImage/components/shareView/shareView.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/ShareImage/components/toastImage/toastImage.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/DropdownView/pages/logs/logs.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看启动日志",
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/Components/components/toastImageText/toastImageText.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/NavigationBar/components/navigationBar/navigationBar.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/NavigationBar/images/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smalldew/mp-openSource/HEAD/NavigationBar/images/back.png
--------------------------------------------------------------------------------
/NavigationBar/images/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smalldew/mp-openSource/HEAD/NavigationBar/images/home.png
--------------------------------------------------------------------------------
/AsyncAwait/README.md:
--------------------------------------------------------------------------------
1 | ###注意:
2 |
3 | 分别给index.js文件下的that.testAsync()或that.testSync()打开或关闭注释来测试“同步执行异步函数”或“异步执行异步函数”
4 |
--------------------------------------------------------------------------------
/NavigationBar/pages/fixed/fixed.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/GlobalReload/pages/subIndex/subIndex.wxml:
--------------------------------------------------------------------------------
1 |
2 | pages/subIndex/subIndex.wxml
3 |
--------------------------------------------------------------------------------
/NavigationBar/pages/fixedSub/fixedSub.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/NavigationBar/pages/fixedSub/fixedSub.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "backHome": "/components/backHome/backHome"
4 | }
5 | }
--------------------------------------------------------------------------------
/GlobalReload/package/buy/buyDetail/buyDetail.wxml:
--------------------------------------------------------------------------------
1 |
2 | package/buy/buyDetail/buyDetail.wxml
3 |
--------------------------------------------------------------------------------
/NavigationBar/components/backHome/backHome.wxml:
--------------------------------------------------------------------------------
1 |
2 | 返回首页
3 |
--------------------------------------------------------------------------------
/DropdownView/pages/logs/logs.wxss:
--------------------------------------------------------------------------------
1 | .log-list {
2 | display: flex;
3 | flex-direction: column;
4 | padding: 40rpx;
5 | }
6 | .log-item {
7 | margin: 10rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/NavigationBar/pages/end/end.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationStyle": "custom",
3 | "usingComponents": {
4 | "navigationBar": "/components/navigationBar/navigationBar"
5 | }
6 | }
--------------------------------------------------------------------------------
/Components/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "topHint": "/components/topHint/topHint",
4 | "toastView": "/components/toastImageText/toastImageText"
5 | }
6 | }
--------------------------------------------------------------------------------
/ShareImage/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "shareView": "/components/shareView/shareView",
4 | "toastImage": "/components/toastImage/toastImage"
5 | }
6 | }
--------------------------------------------------------------------------------
/GlobalReload/pages/error/error.wxml:
--------------------------------------------------------------------------------
1 |
2 | 服务器开小差了,请稍后再试
3 |
4 |
--------------------------------------------------------------------------------
/Components/components/topHint/topHint.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{content}}
3 |
4 |
--------------------------------------------------------------------------------
/Components/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/DatePicker/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/GlobalReload/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | pages/index/index.wxml
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/NavigationBar/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/DropdownView/pages/logs/logs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{index + 1}}. {{log}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Components/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | globalData: {
4 | systemInfo: null
5 | },
6 | onLaunch: function () {
7 | // 获取设备信息
8 | const res = wx.getSystemInfoSync()
9 | this.globalData.systemInfo = res
10 | }
11 | })
--------------------------------------------------------------------------------
/Components/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .tip {
3 | width: 100%;
4 | height: 100rpx;
5 | margin-top: 100rpx;
6 | text-align: center;
7 | line-height: 100rpx;
8 | color: white;
9 | background-color: #1EB4FF;
10 | }
--------------------------------------------------------------------------------
/Components/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/DropdownView/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/NavigationBar/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/ShareImage/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/AsyncAwait/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages":[
3 | "pages/index/index"
4 | ],
5 | "window":{
6 | "backgroundTextStyle":"light",
7 | "navigationBarBackgroundColor": "#fff",
8 | "navigationBarTitleText": "WeChat",
9 | "navigationBarTextStyle":"black"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ShareImage/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index"
4 | ],
5 | "window": {
6 | "backgroundTextStyle": "light",
7 | "navigationBarBackgroundColor": "#fff",
8 | "navigationBarTitleText": "WeChat",
9 | "navigationBarTextStyle": "black"
10 | }
11 | }
--------------------------------------------------------------------------------
/DropdownView/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages":[
3 | "pages/index/index",
4 | "pages/logs/logs"
5 | ],
6 | "window":{
7 | "backgroundTextStyle":"light",
8 | "navigationBarBackgroundColor": "#fff",
9 | "navigationBarTitleText": "WeChat",
10 | "navigationBarTextStyle":"black"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/NavigationBar/pages/thirdIndex/thirdIndex.wxml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 | 我是"{{nav.title}}"\n是否有返回按钮"{{nav.back}}"\n是否有home按钮"{{nav.home}}"
--------------------------------------------------------------------------------
/Components/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index"
4 | ],
5 | "window": {
6 | "backgroundTextStyle": "light",
7 | "navigationBarBackgroundColor": "#fff",
8 | "navigationBarTitleText": "WeChat",
9 | "navigationBarTextStyle": "black"
10 | },
11 | "style": "v2",
12 | "sitemapLocation": "sitemap.json"
13 | }
--------------------------------------------------------------------------------
/DatePicker/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index"
4 | ],
5 | "window": {
6 | "backgroundTextStyle": "light",
7 | "navigationBarBackgroundColor": "#fff",
8 | "navigationBarTitleText": "DatePicker",
9 | "navigationBarTextStyle": "black"
10 | },
11 | "style": "v2",
12 | "sitemapLocation": "sitemap.json"
13 | }
--------------------------------------------------------------------------------
/DropdownView/pages/logs/logs.js:
--------------------------------------------------------------------------------
1 | //logs.js
2 | const util = require('../../utils/util.js')
3 |
4 | Page({
5 | data: {
6 | logs: []
7 | },
8 | onLoad: function () {
9 | this.setData({
10 | logs: (wx.getStorageSync('logs') || []).map(log => {
11 | return util.formatTime(new Date(log))
12 | })
13 | })
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/NavigationBar/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | globalData: {
4 | userInfo: null,
5 | systemInfo: '',
6 | },
7 | onLaunch: function () {
8 | this.getSystemInfo()
9 | },
10 | getSystemInfo() {
11 | const res = wx.getSystemInfoSync()
12 | this.globalData.systemInfo = res
13 | console.log('systemInfo' + JSON.stringify(res))
14 | }
15 | })
--------------------------------------------------------------------------------
/NavigationBar/pages/subIndex/subIndex.wxml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 | 我是"{{nav.title}}"\n是否有返回按钮"{{nav.back}}"\n是否有home按钮"{{nav.home}}"
--------------------------------------------------------------------------------
/DatePicker/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 入住时间(今天)\n{{checkInDate}}
6 |
7 |
8 |
9 | 离店时间\n{{checkOutDate}}
10 |
11 |
12 |
--------------------------------------------------------------------------------
/NavigationBar/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ShareImage/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .userinfo {
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | }
7 |
8 | .userinfo-avatar {
9 | width: 128rpx;
10 | height: 128rpx;
11 | margin: 20rpx;
12 | border-radius: 50%;
13 | }
14 |
15 | .userinfo-nickname {
16 | color: #aaa;
17 | }
18 |
19 | .usermotto {
20 | margin-top: 200px;
21 | }
--------------------------------------------------------------------------------
/GlobalReload/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .userinfo {
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | }
7 |
8 | .userinfo-avatar {
9 | width: 128rpx;
10 | height: 128rpx;
11 | margin: 20rpx;
12 | border-radius: 50%;
13 | }
14 |
15 | .userinfo-nickname {
16 | color: #aaa;
17 | }
18 |
19 | .usermotto {
20 | margin-top: 200px;
21 | }
--------------------------------------------------------------------------------
/NavigationBar/pages/end/end.wxml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 | 测试此页面时:\n1.请将app.json里面的usingComponents删除掉\n2.请将app.json里面的window下面的navigationStyle改成default(为避免其他页面顶部UI错乱)
11 |
12 |
13 | 注意事项:\n1.需要调试基础库>=2.4.3\n2.需要微信客户端>=7.0.0
--------------------------------------------------------------------------------
/NavigationBar/components/backHome/backHome.wxss:
--------------------------------------------------------------------------------
1 | /* components/backHome/backHome.wxss */
2 | .backHome {
3 | width: 120rpx;
4 | height: 80rpx;
5 | position: fixed;
6 | top: 60%;
7 | right: 0;
8 | font-size: 24rpx;
9 | line-height: 80rpx;
10 | background: rgba(0, 0, 0, 0.4);
11 | padding-left: 30rpx;
12 | color: white;
13 | border-top-left-radius: 40rpx;
14 | border-bottom-left-radius: 40rpx;
15 | }
--------------------------------------------------------------------------------
/Components/components/topHint/topHint.wxss:
--------------------------------------------------------------------------------
1 | /* components/topHint/topHint.wxss */
2 | .bindFaild {
3 | width: 100%;
4 | height: 70rpx;
5 | position:absolute;
6 | top: -72rpx;
7 | text-align: center;
8 | font-size: 30rpx;
9 | font-weight: 400;
10 | line-height: 70rpx;
11 | color: white;
12 | z-index: 99;
13 | }
14 |
15 | @media (min-width: 750px) {
16 | .bindFaild {
17 | transform: scale(1, .7);
18 | }
19 | }
--------------------------------------------------------------------------------
/DatePicker/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 |
3 | .choosed-view {
4 | width: 100%;
5 | display: flex;
6 | flex-direction: row;
7 | color: white;
8 | background: #8995AB;
9 | }
10 | .choose-view {
11 | width: 40%;
12 | padding-left: 20rpx;
13 | }
14 | .today {
15 | font-size: 18rpx;
16 | }
17 | .date {
18 | width: 400rpx;
19 | height: 80rpx;
20 | margin-top: 10rpx;
21 | font-size: 24rpx;
22 | line-height: 30rpx;
23 | text-align: center;
24 | }
--------------------------------------------------------------------------------
/NavigationBar/components/backHome/backHome.js:
--------------------------------------------------------------------------------
1 | // components/backHome/backHome.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 |
8 | },
9 |
10 | /**
11 | * 组件的初始数据
12 | */
13 | data: {
14 |
15 | },
16 |
17 | /**
18 | * 组件的方法列表
19 | */
20 | methods: {
21 | clickBackHome(e) {
22 | let pages = getCurrentPages()
23 | wx.navigateBack({
24 | delta: pages.length
25 | })
26 | }
27 | }
28 | })
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## 项目功能
3 |
4 | **AsyncAwait**
5 |
6 | * 在小程序里使用ES7的async-await
7 |
8 | **GlobalReload**
9 |
10 | * 处理服务器返回失败后,加载失败页面以及点击重新加载,加载网络请求失败页
11 |
12 | **ShareImage**
13 |
14 | * 用于绘制图片,分享给好友或者是发送到朋友圈
15 |
16 | **NavigationBar**
17 |
18 | * 自定义导航栏,可用于全局跟单页面
19 |
20 | **DropdownView**
21 |
22 | * 自定义下拉三级展示菜单
23 |
24 | **Components(一些常用组件)**
25 |
26 | * topHint 当输入账号密码错误等情况下的错误提示
27 | * toastImageText 自定义弹窗
28 |
29 | **DatePicker**
30 |
31 | * 预定酒店日期选择器
32 |
33 |
--------------------------------------------------------------------------------
/GlobalReload/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/error/error",
5 | "pages/subIndex/subIndex"
6 | ],
7 | "subPackages": [
8 | {
9 | "root": "package/buy",
10 | "pages": [
11 | "buyDetail/buyDetail"
12 | ]
13 | }
14 | ],
15 | "window": {
16 | "backgroundTextStyle": "light",
17 | "navigationBarBackgroundColor": "#fff",
18 | "navigationBarTitleText": "WeChat",
19 | "navigationBarTextStyle": "black"
20 | }
21 | }
--------------------------------------------------------------------------------
/DatePicker/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 |
4 | /**
5 | * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
6 | */
7 | onLaunch: function () {
8 |
9 | },
10 |
11 | /**
12 | * 当小程序启动,或从后台进入前台显示,会触发 onShow
13 | */
14 | onShow: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 当小程序从前台进入后台,会触发 onHide
20 | */
21 | onHide: function () {
22 |
23 | },
24 |
25 | /**
26 | * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
27 | */
28 | onError: function (msg) {
29 |
30 | }
31 | })
32 |
--------------------------------------------------------------------------------
/AsyncAwait/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | globalData: {
4 | nickName: 'Lucien'
5 | },
6 | /**
7 | * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
8 | */
9 | onLaunch: function () {
10 |
11 | },
12 |
13 | /**
14 | * 当小程序启动,或从后台进入前台显示,会触发 onShow
15 | */
16 | onShow: function (options) {
17 |
18 | },
19 |
20 | /**
21 | * 当小程序从前台进入后台,会触发 onHide
22 | */
23 | onHide: function () {
24 |
25 | },
26 |
27 | /**
28 | * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
29 | */
30 | onError: function (msg) {
31 |
32 | }
33 | })
34 |
--------------------------------------------------------------------------------
/Components/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 |
--------------------------------------------------------------------------------
/ShareImage/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 |
--------------------------------------------------------------------------------
/DropdownView/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 |
--------------------------------------------------------------------------------
/NavigationBar/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 |
--------------------------------------------------------------------------------
/NavigationBar/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/subIndex/subIndex",
5 | "pages/thirdIndex/thirdIndex",
6 | "pages/end/end",
7 | "pages/fixed/fixed",
8 | "pages/fixedSub/fixedSub"
9 | ],
10 | "usingComponents": {
11 | "navigationBar": "/components/navigationBar/navigationBar"
12 | },
13 | "window": {
14 | "backgroundTextStyle": "light",
15 | "navigationBarBackgroundColor": "#fff",
16 | "navigationBarTitleText": "WeChat",
17 | "navigationBarTextStyle": "black",
18 | "navigationStyle": "custom"
19 | },
20 | "sitemapLocation": "sitemap.json"
21 | }
--------------------------------------------------------------------------------
/Components/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
17 |
18 |
19 |
20 | 点击出现带图片文字的弹窗
21 | 点击出现错误提示
22 |
--------------------------------------------------------------------------------
/GlobalReload/utils/util.js:
--------------------------------------------------------------------------------
1 |
2 | // 获取上个界面的实例
3 | function previousPageClass() {
4 | let pageData = getCurrentPages()
5 | if (pageData.length >= 2) {
6 | let len = pageData.length - 2
7 | let preClass = pageData[len]
8 | return preClass
9 | } else {
10 | return ''
11 | }
12 | }
13 |
14 | // 获取当前路径
15 | function currentPagePath() {
16 | let pageData = getCurrentPages()
17 | if (pageData.length >= 1) {
18 | let len = pageData.length - 1
19 | let data = pageData[len]
20 | return data.route
21 | } else {
22 | return ''
23 | }
24 | }
25 |
26 | module.exports = {
27 | currentPagePath,
28 | previousPageClass
29 | }
--------------------------------------------------------------------------------
/Components/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 | data: {
7 |
8 | },
9 | onLoad: function () {
10 |
11 | },
12 | onReady() {
13 | this.topHint = this.selectComponent("#topHint")
14 | this.toastView = this.selectComponent("#toastView")
15 | },
16 | /**
17 | * 组件事件
18 | */
19 | _clickConfirmEvent(e) {
20 | this.toastView.hide()
21 | },
22 | _clickCancelEvent(e) {
23 | this.toastView.hide()
24 | },
25 | /**
26 | * 点击事件
27 | */
28 | // 点击展示tip
29 | clickShowTip() {
30 | this.topHint.show()
31 | },
32 | // 点击展示view
33 | clickShowView() {
34 | this.toastView.show()
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/Components/components/toastImageText/toastImageText.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{title}}
6 |
7 |
8 | {{content}}
9 |
10 |
11 |
12 |
13 |
14 | {{cancelText}}
15 | {{confirmText}}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/NavigationBar/README.md:
--------------------------------------------------------------------------------
1 | # MP_NavigationBar
2 |
3 | 小程序自定义全局、单页面导航栏
4 |
5 |
6 | ### 按钮(点击跳转子页面)-全局
7 | * 调试基础库>=1.9.0
8 | * 微信客户端>=6.6.0
9 |
10 | ```
11 | // app.json
12 | {
13 | "usingComponents": {
14 | "navigationBar": "/components/navigationBar/navigationBar"
15 | },
16 | "window": {
17 | "navigationStyle": "custom"
18 | }
19 | }
20 | ```
21 |
22 | ### 按钮(点击跳转自定义页面)-单页面
23 | * 调试基础库>=2.4.3
24 | * 微信客户端版本>=7.0.0
25 |
26 | ```
27 | // app.json
28 | {
29 | "window": {
30 | "navigationStyle": "default"
31 | }
32 | }
33 | // end.json(自定义的页面)
34 | {
35 | "navigationStyle": "custom",
36 | "usingComponents": {
37 | "navigationBar": "/components/navigationBar/navigationBar"
38 | }
39 | }
40 |
41 | ```
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/AsyncAwait/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true
12 | },
13 | "compileType": "miniprogram",
14 | "libVersion": "2.1.1",
15 | "appid": "wxe16bf93e47ca25eb",
16 | "projectname": "async",
17 | "isGameTourist": false,
18 | "condition": {
19 | "search": {
20 | "current": -1,
21 | "list": []
22 | },
23 | "conversation": {
24 | "current": -1,
25 | "list": []
26 | },
27 | "plugin": {
28 | "current": -1,
29 | "list": []
30 | },
31 | "game": {
32 | "currentL": -1,
33 | "list": []
34 | },
35 | "miniprogram": {
36 | "current": -1,
37 | "list": []
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/GlobalReload/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true
12 | },
13 | "compileType": "miniprogram",
14 | "libVersion": "1.9.98",
15 | "appid": "wxc2f872cd38c98fcf",
16 | "projectname": "globleReload",
17 | "isGameTourist": false,
18 | "condition": {
19 | "search": {
20 | "current": -1,
21 | "list": []
22 | },
23 | "conversation": {
24 | "current": -1,
25 | "list": []
26 | },
27 | "plugin": {
28 | "current": -1,
29 | "list": []
30 | },
31 | "game": {
32 | "currentL": -1,
33 | "list": []
34 | },
35 | "miniprogram": {
36 | "current": -1,
37 | "list": []
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/DropdownView/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false
13 | },
14 | "compileType": "miniprogram",
15 | "libVersion": "2.6.0",
16 | "appid": "wxe16bf93e47ca25eb",
17 | "projectname": "DropdownView",
18 | "debugOptions": {
19 | "hidedInDevtools": []
20 | },
21 | "isGameTourist": false,
22 | "condition": {
23 | "search": {
24 | "current": -1,
25 | "list": []
26 | },
27 | "conversation": {
28 | "current": -1,
29 | "list": []
30 | },
31 | "game": {
32 | "currentL": -1,
33 | "list": []
34 | },
35 | "miniprogram": {
36 | "current": -1,
37 | "list": []
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/ShareImage/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false
13 | },
14 | "compileType": "miniprogram",
15 | "libVersion": "2.4.3",
16 | "appid": "wxe16bf93e47ca25eb",
17 | "projectname": "ShareImage",
18 | "debugOptions": {
19 | "hidedInDevtools": []
20 | },
21 | "isGameTourist": false,
22 | "condition": {
23 | "search": {
24 | "current": -1,
25 | "list": []
26 | },
27 | "conversation": {
28 | "current": -1,
29 | "list": []
30 | },
31 | "game": {
32 | "currentL": -1,
33 | "list": []
34 | },
35 | "miniprogram": {
36 | "current": -1,
37 | "list": []
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/NavigationBar/components/navigationBar/navigationBar.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | {{text}}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ShareImage/components/toastImage/toastImage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | 保存图片
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ShareImage/components/shareView/shareView.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}}
5 |
6 |
7 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | 取消
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ShareImage/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Components/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false,
13 | "coverView": true
14 | },
15 | "compileType": "miniprogram",
16 | "libVersion": "2.9.1",
17 | "appid": "wxf1d5208e99515e3c",
18 | "projectname": "Components",
19 | "debugOptions": {
20 | "hidedInDevtools": []
21 | },
22 | "isGameTourist": false,
23 | "simulatorType": "wechat",
24 | "simulatorPluginLibVersion": {},
25 | "condition": {
26 | "search": {
27 | "current": -1,
28 | "list": []
29 | },
30 | "conversation": {
31 | "current": -1,
32 | "list": []
33 | },
34 | "game": {
35 | "currentL": -1,
36 | "list": []
37 | },
38 | "miniprogram": {
39 | "current": -1,
40 | "list": []
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/NavigationBar/components/navigationBar/navigationBar.js:
--------------------------------------------------------------------------------
1 | // components/navigationBar/navigationBar.js
2 | const app = getApp()
3 | const statusBarHeight = app.globalData.systemInfo.statusBarHeight || 20
4 |
5 | Component({
6 |
7 | properties: {
8 | text: {
9 | type: String,
10 | value: 'Wechat'
11 | },
12 | back: {
13 | type: Boolean,
14 | value: false
15 | },
16 | home: {
17 | type: Boolean,
18 | value: false
19 | }
20 | },
21 | data: {
22 | statusBarHeight: statusBarHeight + 'px',
23 | navigationBarHeight: (statusBarHeight + 44) + 'px'
24 | },
25 |
26 | methods: {
27 | backHome: function () {
28 | let pages = getCurrentPages()
29 | wx.navigateBack({
30 | delta: pages.length
31 | })
32 | },
33 | back: function () {
34 | wx.navigateBack({
35 | delta: 1
36 | })
37 | }
38 | }
39 | })
--------------------------------------------------------------------------------
/NavigationBar/pages/fixedSub/fixedSub.js:
--------------------------------------------------------------------------------
1 | // pages/fixedSub/fixedSub.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/DatePicker/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false,
13 | "coverView": true,
14 | "showShadowRootInWxmlPanel": true,
15 | "scopeDataCheck": false
16 | },
17 | "compileType": "miniprogram",
18 | "libVersion": "2.9.3",
19 | "appid": "wxf1d5208e99515e3c",
20 | "projectname": "DatePicker",
21 | "debugOptions": {
22 | "hidedInDevtools": []
23 | },
24 | "isGameTourist": false,
25 | "simulatorType": "wechat",
26 | "simulatorPluginLibVersion": {},
27 | "condition": {
28 | "search": {
29 | "current": -1,
30 | "list": []
31 | },
32 | "conversation": {
33 | "current": -1,
34 | "list": []
35 | },
36 | "game": {
37 | "currentL": -1,
38 | "list": []
39 | },
40 | "miniprogram": {
41 | "current": -1,
42 | "list": []
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/GlobalReload/utils/fetch.js:
--------------------------------------------------------------------------------
1 | // 当前路径
2 | import { currentPagePath } from 'util.js'
3 |
4 | function fetch(url, method, header, data) {
5 | // 判断给服务端传递undefined的问题
6 | let fetchP = new Promise(function (resolve, reject) {
7 | wx.request({
8 | url: url,
9 | method: method ? method : 'GET',
10 | header: {
11 | 'content-type': 'application/json', // 默认值
12 | 'pagePath': currentPagePath()
13 | },
14 | data: data,
15 | success: function (res) {
16 | if (res.statusCode < 500) {
17 | resolve(res.data)
18 | } else {
19 | showError()
20 | reject(res.data)
21 | }
22 | },
23 | fail: function (err) {
24 | showError()
25 | reject(err)
26 | }
27 | })
28 | })
29 | return fetchP
30 | }
31 |
32 | // 服务器开小差了
33 | function showError() {
34 | wx.navigateTo({
35 | url: '/pages/error/error',
36 | })
37 | }
38 |
39 | module.exports = {
40 | fetch
41 | }
--------------------------------------------------------------------------------
/ShareImage/components/toastImage/toastImage.wxss:
--------------------------------------------------------------------------------
1 | /* components/toastImage/toastImage.wxss */
2 |
3 | .background {
4 | width: 100%;
5 | height: 100%;
6 | background: rgba(0, 0, 0, 0.6);
7 | z-index: 1000;
8 | position: absolute;
9 | display: flex;
10 | justify-content: center;
11 | align-items: center;
12 | }
13 | .foreground {
14 | width: 560rpx;
15 | background: white;
16 | display: flex;
17 | flex-direction: column;
18 | align-items: center;
19 | border-radius: 10rpx;
20 | position: relative;
21 | }
22 | .toastView_bg_image {
23 | width: 100%;
24 | height: 100%;
25 | position: relative;
26 | z-index: 99;
27 | }
28 | .image {
29 | width: 340rpx;
30 | height: 340rpx;
31 | position: absolute;
32 | top: 231rpx;
33 | }
34 | .close {
35 | width: 46rpx;
36 | height: 46rpx;
37 | position: absolute;
38 | top: 10rpx;
39 | right: 10rpx;
40 | z-index: 100;
41 | }
42 | .save {
43 | position: absolute;
44 | bottom: 30rpx;
45 | width: 440rpx;
46 | height: 70rpx;
47 | z-index: 99;
48 | }
49 |
--------------------------------------------------------------------------------
/NavigationBar/pages/end/end.js:
--------------------------------------------------------------------------------
1 | // pages/end/end.js
2 |
3 |
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | nav: {
11 | title: '单页-自定义nav-二级页面',
12 | back: true,
13 | home: true
14 | }
15 | },
16 |
17 | /**
18 | * 生命周期函数--监听页面加载
19 | */
20 | onLoad: function (options) {
21 |
22 | },
23 |
24 | /**
25 | * 生命周期函数--监听页面初次渲染完成
26 | */
27 | onReady: function () {
28 |
29 | },
30 |
31 | /**
32 | * 生命周期函数--监听页面显示
33 | */
34 | onShow: function () {
35 |
36 | },
37 |
38 | /**
39 | * 生命周期函数--监听页面隐藏
40 | */
41 | onHide: function () {
42 |
43 | },
44 |
45 | /**
46 | * 生命周期函数--监听页面卸载
47 | */
48 | onUnload: function () {
49 |
50 | },
51 |
52 | /**
53 | * 页面相关事件处理函数--监听用户下拉动作
54 | */
55 | onPullDownRefresh: function () {
56 |
57 | },
58 |
59 | /**
60 | * 页面上拉触底事件的处理函数
61 | */
62 | onReachBottom: function () {
63 |
64 | },
65 |
66 | /**
67 | * 用户点击右上角分享
68 | */
69 | onShareAppMessage: function () {
70 |
71 | }
72 | })
--------------------------------------------------------------------------------
/DatePicker/pages/selectDate/selectDate.wxss:
--------------------------------------------------------------------------------
1 | /* pages/dateSelect/dateSelect.wxss */
2 | page{
3 | font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", "\9ED1\4F53", Arial, sans-serif;
4 | color:#333;
5 | font-size: 28rpx;
6 | overflow-x: hidden;
7 | overflow-y: auto;
8 | }
9 | .layout-flex{
10 | display:flex;
11 | }
12 | .layout-flex .row{
13 | flex-direction: row;
14 | }
15 | .layout-flex .column{
16 | flex-direction: column;
17 | }
18 | .align-center{
19 | align-items:center;
20 | justify-content: center;
21 | }
22 |
23 | .date-day{
24 | display: flex;
25 | margin:5px;
26 | text-align:center;
27 | justify-content: center;
28 | align-items: center;
29 | }
30 | .date-day.active{
31 | background: #FF9C01;
32 | color:#FFF;
33 | border-radius: 100%;
34 | }
35 | .date-day.unavailable{
36 | color:#aaa;
37 | }
38 |
39 | .date-week{
40 | display: flex;
41 | justify-content: center;
42 | align-content: center;
43 | margin:5px;
44 | }
45 | .week{
46 | color:#FF9C01;
47 | }
48 |
--------------------------------------------------------------------------------
/NavigationBar/pages/thirdIndex/thirdIndex.js:
--------------------------------------------------------------------------------
1 | // pages/thirdIndex/thirdIndex.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | nav: {
9 | title: '全局-自定义nav-三级页面',
10 | back: true,
11 | home: true
12 | }
13 | },
14 |
15 | /**
16 | * 生命周期函数--监听页面加载
17 | */
18 | onLoad: function (options) {
19 |
20 | },
21 |
22 | /**
23 | * 生命周期函数--监听页面初次渲染完成
24 | */
25 | onReady: function () {
26 |
27 | },
28 |
29 | /**
30 | * 生命周期函数--监听页面显示
31 | */
32 | onShow: function () {
33 |
34 | },
35 |
36 | /**
37 | * 生命周期函数--监听页面隐藏
38 | */
39 | onHide: function () {
40 |
41 | },
42 |
43 | /**
44 | * 生命周期函数--监听页面卸载
45 | */
46 | onUnload: function () {
47 |
48 | },
49 |
50 | /**
51 | * 页面相关事件处理函数--监听用户下拉动作
52 | */
53 | onPullDownRefresh: function () {
54 |
55 | },
56 |
57 | /**
58 | * 页面上拉触底事件的处理函数
59 | */
60 | onReachBottom: function () {
61 |
62 | },
63 |
64 | /**
65 | * 用户点击右上角分享
66 | */
67 | onShareAppMessage: function () {
68 |
69 | }
70 | })
--------------------------------------------------------------------------------
/NavigationBar/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false
13 | },
14 | "compileType": "miniprogram",
15 | "libVersion": "1.9.2",
16 | "appid": "wxe16bf93e47ca25eb",
17 | "projectname": "NavigationBar",
18 | "debugOptions": {
19 | "hidedInDevtools": []
20 | },
21 | "isGameTourist": false,
22 | "simulatorType": "wechat",
23 | "simulatorPluginLibVersion": {},
24 | "condition": {
25 | "search": {
26 | "current": -1,
27 | "list": []
28 | },
29 | "conversation": {
30 | "current": -1,
31 | "list": []
32 | },
33 | "plugin": {
34 | "current": -1,
35 | "list": []
36 | },
37 | "game": {
38 | "currentL": -1,
39 | "list": []
40 | },
41 | "miniprogram": {
42 | "current": 0,
43 | "list": [
44 | {
45 | "id": -1,
46 | "name": "日志页面",
47 | "pathName": "pages/logs/logs"
48 | }
49 | ]
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/NavigationBar/pages/fixed/fixed.js:
--------------------------------------------------------------------------------
1 | // pages/fixed/fixed.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | },
66 | /**
67 | * 点击事件
68 | */
69 | // 跳转到子页面
70 | clickFixedSub(e) {
71 | wx.navigateTo({
72 | url: '../fixedSub/fixedSub',
73 | })
74 | }
75 | })
--------------------------------------------------------------------------------
/NavigationBar/pages/subIndex/subIndex.js:
--------------------------------------------------------------------------------
1 | // pages/subIndex.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | nav: {
9 | title: '全局-自定义nav-子页面',
10 | back: true,
11 | home: false
12 | }
13 | },
14 |
15 | /**
16 | * 生命周期函数--监听页面加载
17 | */
18 | onLoad: function (options) {
19 |
20 | },
21 |
22 | /**
23 | * 生命周期函数--监听页面初次渲染完成
24 | */
25 | onReady: function () {
26 |
27 | },
28 |
29 | /**
30 | * 生命周期函数--监听页面显示
31 | */
32 | onShow: function () {
33 |
34 | },
35 |
36 | /**
37 | * 生命周期函数--监听页面隐藏
38 | */
39 | onHide: function () {
40 |
41 | },
42 |
43 | /**
44 | * 生命周期函数--监听页面卸载
45 | */
46 | onUnload: function () {
47 |
48 | },
49 |
50 | /**
51 | * 页面相关事件处理函数--监听用户下拉动作
52 | */
53 | onPullDownRefresh: function () {
54 |
55 | },
56 |
57 | /**
58 | * 页面上拉触底事件的处理函数
59 | */
60 | onReachBottom: function () {
61 |
62 | },
63 |
64 | /**
65 | * 用户点击右上角分享
66 | */
67 | onShareAppMessage: function () {
68 |
69 | },
70 | /**
71 | * 点击事件
72 | */
73 | clickThirdIndex() {
74 | wx.navigateTo({
75 | url: '../thirdIndex/thirdIndex',
76 | })
77 | }
78 | })
--------------------------------------------------------------------------------
/DropdownView/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{grade}}、{{course}}、{{section}}
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{index}}
13 |
14 |
15 |
16 |
17 |
18 | {{index}}
19 |
20 |
21 |
22 |
23 |
24 | {{item}}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/NavigationBar/components/navigationBar/navigationBar.wxss:
--------------------------------------------------------------------------------
1 | /* components/navigationBar/navigationBar.wxss */
2 | .navbar {
3 | width: 100%;
4 | background-color: #1797eb;
5 | position: fixed;
6 | top: 0;
7 | left: 0;
8 | z-index: 999;
9 | }
10 |
11 | .title-container {
12 | height: 40px;
13 | display: flex;
14 | align-items: center;
15 | position: relative;
16 | }
17 |
18 | .capsule {
19 | margin-left: 10px;
20 | height: 30px;
21 | background: rgba(255, 255, 255, 0.6);
22 | border: 1px solid #fff;
23 | border-radius: 16px;
24 | display: flex;
25 | align-items: center;
26 | }
27 |
28 | .capsule > view {
29 | width: 45px;
30 | height: 60%;
31 | position: relative;
32 | }
33 |
34 | .capsule > view:nth-child(2) {
35 | border-left: 1px solid #fff;
36 | }
37 |
38 | .capsule image {
39 | width: 50%;
40 | height: 100%;
41 | position: absolute;
42 | left: 50%;
43 | top: 50%;
44 | transform: translate(-50%,-50%);
45 | }
46 |
47 | .title {
48 | color: white;
49 | position: absolute;
50 | top: 6px;
51 | left: 104px;
52 | right: 104px;
53 | height: 30px;
54 | line-height: 30px;
55 | font-size: 14px;
56 | text-align: center;
57 | overflow: hidden;
58 | text-overflow: ellipsis;
59 | white-space: nowrap;
60 | }
--------------------------------------------------------------------------------
/ShareImage/components/shareView/shareView.js:
--------------------------------------------------------------------------------
1 | // components/shareView.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | title: {
8 | type: String,
9 | value: ''
10 | },
11 | plantforms: {
12 | type: Array,
13 | value: ''
14 | }
15 | },
16 |
17 | /**
18 | * 组件的初始数据
19 | */
20 | data: {
21 | // 弹窗显示控制
22 | isShow: false
23 | },
24 |
25 | /**
26 | * 组件的方法列表
27 | */
28 | methods: {
29 | //隐藏弹框
30 | hide: function () {
31 | this.setData({
32 | isShow: !this.data.isShow
33 | })
34 | },
35 | //展示弹框
36 | show: function () {
37 | if (this.data.plantforms.length <= 0){
38 | wx.showModal({
39 | title: '提示',
40 | content: '当前没有可分享平台',
41 | showCancel: false
42 | })
43 | } else {
44 | this.setData({
45 | isShow: !this.data.isShow
46 | })
47 | }
48 | },
49 |
50 | // 点击某一个平台
51 | _clickShareViewPlatform: function (e) {
52 | this.triggerEvent("clickShareViewPlatform", e.currentTarget.dataset.name)
53 | },
54 | // 点击取消
55 | _clickShareViewCancel: function (e) {
56 | //触发成功回调
57 | this.triggerEvent("clickShareViewCancel")
58 | }
59 | }
60 | })
61 |
--------------------------------------------------------------------------------
/GlobalReload/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 |
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 |
10 | },
11 |
12 | /**
13 | * 生命周期函数--监听页面加载
14 | */
15 | onLoad: function (options) {
16 |
17 | },
18 |
19 | /**
20 | * 生命周期函数--监听页面初次渲染完成
21 | */
22 | onReady: function () {
23 |
24 | },
25 |
26 | /**
27 | * 生命周期函数--监听页面显示
28 | */
29 | onShow: function () {
30 |
31 | },
32 |
33 | /**
34 | * 生命周期函数--监听页面隐藏
35 | */
36 | onHide: function () {
37 |
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面卸载
42 | */
43 | onUnload: function () {
44 |
45 | },
46 |
47 | /**
48 | * 页面相关事件处理函数--监听用户下拉动作
49 | */
50 | onPullDownRefresh: function () {
51 |
52 | },
53 |
54 | /**
55 | * 页面上拉触底事件的处理函数
56 | */
57 | onReachBottom: function () {
58 |
59 | },
60 |
61 | /**
62 | * 用户点击右上角分享
63 | */
64 | onShareAppMessage: function () {
65 |
66 | },
67 | /**
68 | * 点击事件
69 | */
70 | clickJump: function (e) {
71 | wx.navigateTo({
72 | url: '../subIndex/subIndex' + '?userId=abcdef&gender=male',
73 | })
74 | },
75 | // 跳转到分包页
76 | clickJumpSubPackage: function (e) {
77 | wx.navigateTo({
78 | url: '/package/buy/buyDetail/buyDetail' + '?userId=uvwxyz&gender=female',
79 | })
80 | }
81 | })
82 |
--------------------------------------------------------------------------------
/Components/components/topHint/topHint.js:
--------------------------------------------------------------------------------
1 | // components/topHint/topHint.js
2 |
3 | // 获取应用实例
4 | const app = getApp()
5 |
6 | Component({
7 | /**
8 | * 组件的属性列表
9 | */
10 | properties: {
11 | // 提示内容
12 | content: {
13 | type: String,
14 | value: '信息有误'
15 | },
16 | // 背景颜色
17 | background: {
18 | type: String,
19 | value: '背景颜色'
20 | }
21 | },
22 |
23 | /**
24 | * 组件的初始数据
25 | */
26 | data: {
27 | // 动画
28 | animationData: null
29 | },
30 |
31 | /**
32 | * 组件的方法列表
33 | */
34 | methods: {
35 | //展示弹框
36 | show () {
37 | let res = app.globalData.systemInfo
38 | this.createAnimation(res.windowWidth / 750)
39 | },
40 | createAnimation (scale) {
41 | let animation = wx.createAnimation({
42 | duration: 800,
43 | timingFunction: 'ease',
44 | })
45 |
46 | this.animation = animation
47 |
48 | this.setData({
49 | animationData: animation.export()
50 | })
51 |
52 | setTimeout(() => {
53 | animation.translate(0, 70 * scale).step()
54 | this.setData({
55 | animationData: animation.export()
56 | })
57 | }, 0)
58 |
59 | setTimeout(() => {
60 | animation.translate(0, -70 * scale).step()
61 | this.setData({
62 | animationData: animation.export()
63 | })
64 | }, 5000)
65 | }
66 | }
67 | })
68 |
--------------------------------------------------------------------------------
/GlobalReload/pages/error/error.js:
--------------------------------------------------------------------------------
1 | // pages/error/error.js
2 | import { previousPageClass } from '../../utils/util.js'
3 |
4 | let isClickReload = false
5 |
6 | Page({
7 |
8 | /**
9 | * 页面的初始数据
10 | */
11 | data: {
12 |
13 | },
14 |
15 | /**
16 | * 生命周期函数--监听页面加载
17 | */
18 | onLoad: function (options) {
19 | isClickReload = false
20 | },
21 |
22 | /**
23 | * 生命周期函数--监听页面初次渲染完成
24 | */
25 | onReady: function () {
26 |
27 | },
28 |
29 | /**
30 | * 生命周期函数--监听页面显示
31 | */
32 | onShow: function () {
33 |
34 | },
35 |
36 | /**
37 | * 生命周期函数--监听页面隐藏
38 | */
39 | onHide: function () {
40 |
41 | },
42 |
43 | /**
44 | * 生命周期函数--监听页面卸载
45 | */
46 | onUnload: function () {
47 | if (!isClickReload) {
48 | this.callbackParams()
49 | }
50 | },
51 |
52 | /**
53 | * 页面相关事件处理函数--监听用户下拉动作
54 | */
55 | onPullDownRefresh: function () {
56 |
57 | },
58 |
59 | /**
60 | * 页面上拉触底事件的处理函数
61 | */
62 | onReachBottom: function () {
63 |
64 | },
65 |
66 | /**
67 | * 用户点击右上角分享
68 | */
69 | onShareAppMessage: function () {
70 |
71 | },
72 | /**
73 | * 点击事件
74 | */
75 | clickReload: function (e) {
76 | isClickReload = true
77 | wx.navigateBack()
78 | this.callbackParams()
79 | },
80 | // 点击返回,参数回传
81 | callbackParams: function () {
82 | let preOptions = previousPageClass().options
83 | previousPageClass().onLoad(preOptions)
84 | }
85 | })
--------------------------------------------------------------------------------
/GlobalReload/pages/subIndex/subIndex.js:
--------------------------------------------------------------------------------
1 | // pages/subIndex/subIndex.js
2 | import { fetch } from "../../utils/fetch.js"
3 |
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 |
11 | },
12 |
13 | /**
14 | * 生命周期函数--监听页面加载
15 | */
16 | onLoad: function (options) {
17 | // 加一个2秒延迟
18 | setTimeout(function() {
19 | fetch('https://api-test.xxx.com/111').then((res) => {
20 | console.log('pages/subIndex/subIndex--fetchSuccess')
21 | }).catch((err) => {
22 | console.log('pages/subIndex/subIndex--fetchFail')
23 | })
24 | }, 2000)
25 | console.log('pages/subIndex/subIndex--onLoad--options-->' + JSON.stringify(options))
26 | },
27 |
28 | /**
29 | * 生命周期函数--监听页面初次渲染完成
30 | */
31 | onReady: function () {
32 |
33 | },
34 |
35 | /**
36 | * 生命周期函数--监听页面显示
37 | */
38 | onShow: function (options) {
39 | console.log('pages/subIndex/subIndex--onShow')
40 | },
41 |
42 | /**
43 | * 生命周期函数--监听页面隐藏
44 | */
45 | onHide: function () {
46 |
47 | },
48 |
49 | /**
50 | * 生命周期函数--监听页面卸载
51 | */
52 | onUnload: function () {
53 |
54 | },
55 |
56 | /**
57 | * 页面相关事件处理函数--监听用户下拉动作
58 | */
59 | onPullDownRefresh: function () {
60 |
61 | },
62 |
63 | /**
64 | * 页面上拉触底事件的处理函数
65 | */
66 | onReachBottom: function () {
67 |
68 | },
69 |
70 | /**
71 | * 用户点击右上角分享
72 | */
73 | onShareAppMessage: function () {
74 |
75 | }
76 | })
--------------------------------------------------------------------------------
/ShareImage/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 |
3 | App({
4 | globalData: {
5 | userData: '',
6 | },
7 | onLaunch: function () {
8 |
9 | },
10 | // 把图片存到本地
11 | saveImageToAlbum: function (tempFilePath_image) {
12 | var that = this
13 | wx.getSetting({
14 | success(res) {
15 | if (!res.authSetting['scope.writePhotosAlbum']) {
16 | wx.authorize({
17 | scope: 'scope.writePhotosAlbum',
18 | success() {
19 | // 用户已经同意小程序使用相册
20 | that.saveImageToUserPhotosAlbum(tempFilePath_image)
21 | },
22 | fail() {
23 | wx.openSetting({
24 | success: (res) => { }
25 | })
26 | }
27 | })
28 | } else {
29 | // 用户已经同意小程序使用相册
30 | that.saveImageToUserPhotosAlbum(tempFilePath_image)
31 | }
32 | }
33 | })
34 | },
35 | // 把图片存储到用户手机相册里
36 | saveImageToUserPhotosAlbum: function (tempFilePath_image) {
37 | wx.saveImageToPhotosAlbum({
38 | filePath: tempFilePath_image,
39 | success: function (res) {
40 | wx.showToast({
41 | title: '保存图片成功',
42 | image: "https://wx-static.yangcong345.com/v_1_8_0_receiveVip_complete.png"
43 | })
44 | }, fail: function (err) {
45 | wx.showToast({
46 | title: '保存图片失败',
47 | image: "https://wx-static.yangcong345.com/v_1_8_0_receiveVip_close.png"
48 | })
49 | }
50 | })
51 | },
52 | })
--------------------------------------------------------------------------------
/GlobalReload/package/buy/buyDetail/buyDetail.js:
--------------------------------------------------------------------------------
1 | // package/buy/buyDetail/buyDetail.js
2 | import { fetch } from "../../../utils/fetch.js"
3 |
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 |
11 | },
12 |
13 | /**
14 | * 生命周期函数--监听页面加载
15 | */
16 | onLoad: function (options) {
17 | // 加一个2秒延迟
18 | setTimeout(function () {
19 | fetch('https://api-test.xxx.com/111').then((res) => {
20 | console.log('package/buy/buyDetail/buyDetail--fetchSuccess')
21 | }).catch((err) => {
22 | console.log('package/buy/buyDetail/buyDetail--fetchFail')
23 | })
24 | }, 2000)
25 | console.log('package/buy/buyDetail/buyDetail--onLoad--options-->' + JSON.stringify(options))
26 | },
27 |
28 | /**
29 | * 生命周期函数--监听页面初次渲染完成
30 | */
31 | onReady: function () {
32 |
33 | },
34 |
35 | /**
36 | * 生命周期函数--监听页面显示
37 | */
38 | onShow: function () {
39 | console.log('package/buy/buyDetail/buyDetail--onShow')
40 | },
41 |
42 | /**
43 | * 生命周期函数--监听页面隐藏
44 | */
45 | onHide: function () {
46 |
47 | },
48 |
49 | /**
50 | * 生命周期函数--监听页面卸载
51 | */
52 | onUnload: function () {
53 |
54 | },
55 |
56 | /**
57 | * 页面相关事件处理函数--监听用户下拉动作
58 | */
59 | onPullDownRefresh: function () {
60 |
61 | },
62 |
63 | /**
64 | * 页面上拉触底事件的处理函数
65 | */
66 | onReachBottom: function () {
67 |
68 | },
69 |
70 | /**
71 | * 用户点击右上角分享
72 | */
73 | onShareAppMessage: function () {
74 |
75 | }
76 | })
--------------------------------------------------------------------------------
/NavigationBar/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 |
7 | /**
8 | * 页面的初始数据
9 | */
10 | data: {
11 | nav: {
12 | title: '全局-自定义nav-主页-长名字',
13 | back: false,
14 | home: false
15 | }
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面加载
20 | */
21 | onLoad: function (options) {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面初次渲染完成
27 | */
28 | onReady: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面显示
34 | */
35 | onShow: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面隐藏
41 | */
42 | onHide: function () {
43 |
44 | },
45 |
46 | /**
47 | * 生命周期函数--监听页面卸载
48 | */
49 | onUnload: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面相关事件处理函数--监听用户下拉动作
55 | */
56 | onPullDownRefresh: function () {
57 |
58 | },
59 |
60 | /**
61 | * 页面上拉触底事件的处理函数
62 | */
63 | onReachBottom: function () {
64 |
65 | },
66 |
67 | /**
68 | * 用户点击右上角分享
69 | */
70 | onShareAppMessage: function () {
71 |
72 | },
73 | /**
74 | * 点击事件
75 | */
76 | // 跳转到子页面
77 | clickSubIndex() {
78 | wx.navigateTo({
79 | url: '../subIndex/subIndex',
80 | })
81 | },
82 | // 跳转自定义navigationBar页
83 | clickEnd() {
84 | wx.navigateTo({
85 | url: '../end/end',
86 | })
87 | },
88 | // 跳转到悬浮“返回首页”按钮
89 | clickBackHome(e) {
90 | wx.navigateTo({
91 | url: '../fixed/fixed',
92 | })
93 | }
94 | })
95 |
--------------------------------------------------------------------------------
/Components/components/toastImageText/toastImageText.js:
--------------------------------------------------------------------------------
1 | // components/toastImageText/toastImageText.js
2 | Component({
3 | options: {
4 | multipleSlots: true // 在组件定义时的选项中启用多slot支持
5 | },
6 | /**
7 | * 组件的属性列表
8 | */
9 | properties: {
10 | // 弹窗标题
11 | title: {
12 | type: String,
13 | value: '标题'
14 | },
15 | // 弹窗内容
16 | content: {
17 | type: String,
18 | value: '弹窗内容'
19 | },
20 | // 弹窗图片
21 | image: {
22 | type: String,
23 | value: '弹窗内容'
24 | },
25 | // 弹窗确认按钮文字
26 | confirmText: {
27 | type: String,
28 | value: '确定'
29 | },
30 | // 弹窗取消按钮文字
31 | cancelText: {
32 | type: String,
33 | value: '取消'
34 | }
35 |
36 | },
37 |
38 | /**
39 | * 组件的初始数据
40 | */
41 | data: {
42 | // 弹窗显示控制
43 | isShow: false
44 | },
45 |
46 | /**
47 | * 组件的方法列表
48 | */
49 | methods: {
50 | /*
51 | * 公有方法
52 | */
53 | //隐藏弹框
54 | hide: function () {
55 | this.setData({
56 | isShow: !this.data.isShow
57 | })
58 | },
59 | //展示弹框
60 | show: function () {
61 | this.setData({
62 | isShow: !this.data.isShow
63 | })
64 | },
65 | /*
66 | * 内部私有方法建议以下划线开头
67 | * triggerEvent 用于触发事件
68 | */
69 | _confirmEvent: function (e) {
70 | //触发成功回调
71 | this.triggerEvent("confirmEvent", e);
72 | },
73 | _cancelEvent: function (e) {
74 | this.triggerEvent("cancelEvent", e);
75 | }
76 | }
77 | })
78 |
--------------------------------------------------------------------------------
/ShareImage/components/shareView/shareView.wxss:
--------------------------------------------------------------------------------
1 | /* components/shareView.wxss */
2 | .background {
3 | width: 100%;
4 | height: 100%;
5 | background: rgba(0, 0, 0, 0.6);
6 | z-index: 1000;
7 | position: absolute;
8 | }
9 | .foreground {
10 | width: 100%;
11 | height: 432rpx;
12 | background: white;
13 | position: absolute;
14 | left: 0rpx;
15 | bottom: 0rpx;
16 | }
17 | .title {
18 | width: 100%;
19 | height: 110rpx;
20 | line-height: 110rpx;
21 | text-align: center;
22 | font-size: 36rpx;
23 | color: #6A6A6A;
24 | }
25 | .splitLine {
26 | width: 100%;
27 | height: 1rpx;
28 | background: rgba(0,0,0,0.10);
29 | }
30 | .sharePlatform {
31 | width: 100%;
32 | height: 210rpx;
33 | display: flex;
34 | justify-content: space-between;
35 | }
36 | .plantform {
37 | width: 33.3%;
38 | height: 210rpx;
39 | display: flex;
40 | flex-direction: column;
41 | justify-content: center;
42 | align-items: center;
43 | }
44 | .platform_img {
45 | display: flex;
46 | width: 100rpx;
47 | height: 100rpx;
48 | }
49 | .platform_text {
50 | display: flex;
51 | font-size: 28rpx;
52 | color: #6A6A6A;
53 | text-align: center;
54 | }
55 | .moments {
56 | height: 210rpx;
57 | /* background: yellow; */
58 | }
59 | .friends {
60 | height: 210rpx;
61 | /* background: blue; */
62 | }
63 | .faces {
64 | height: 210rpx;
65 | /* background: green; */
66 | }
67 | .splitBottomLine {
68 | width: 100%;
69 | height: 12rpx;
70 | background: #E5E5E5;
71 | }
72 | .cancel {
73 | width: 100%;
74 | height: 100rpx;
75 | font-size: 36rpx;
76 | line-height: 100rpx;
77 | color: #000000;
78 | text-align: center;
79 | }
--------------------------------------------------------------------------------
/Components/components/toastImageText/toastImageText.wxss:
--------------------------------------------------------------------------------
1 | /* components/toastImageText/toastImageText.wxss */
2 | .background {
3 | width: 100%;
4 | height: 100%;
5 | background: rgba(0, 0, 0, 0.6);
6 | z-index: 1000;
7 | position: absolute;
8 | top: 0;
9 | left: 0;
10 | display: flex;
11 | justify-content: center;
12 | align-items: center;
13 | }
14 | .foreground {
15 | width: 560rpx;
16 | height: auto;
17 | background: white;
18 | display: flex;
19 | flex-direction: column;
20 | align-items: center;
21 | border-radius: 8rpx;
22 | }
23 | .toastView_title {
24 | width: 100%;
25 | height: 50rpx;
26 | margin-top: 24rpx;
27 | font-size: 34rpx;
28 | color: #3B3B3B;
29 | line-height: 50rpx;
30 | font-weight: 500;
31 | text-align: center;
32 | }
33 | .toastView_content {
34 | width: 100%;
35 | height: auto;
36 | margin-top: 16rpx;
37 | margin-bottom: 0rpx;
38 | padding: 0 20rpx;
39 | box-sizing: border-box;
40 | font-size: 28rpx;
41 | line-height: 44rpx;
42 | color: #6A6A6A;
43 | }
44 | .toastView_image {
45 | width: 228rpx;
46 | margin-top: 16rpx;
47 | }
48 | .splitLine {
49 | width: 100%;
50 | height: 1rpx;
51 | background: #E8E8E8;
52 | }
53 | .toastView_bottom {
54 | width: 464rpx;
55 | height: 80rpx;
56 | margin-top: 32rpx;
57 | margin-bottom: 48rpx;
58 | display: flex;
59 | flex-direction: row;
60 | justify-content: space-between;
61 | font-size: 30rpx;
62 | }
63 | .toastView_confirm {
64 | width: 216rpx;
65 | height: 80rpx;
66 | background: #FBCF00;
67 | border-radius: 8rpx;
68 | color: #FFFFFF;
69 | line-height: 80rpx;
70 | text-align: center;
71 | }
72 | .toastView_cancel {
73 | width: 216rpx;
74 | height: 80rpx;
75 | background: #F3F3F3;
76 | border-radius: 8rpx;
77 | color: #888888;
78 | line-height: 80rpx;
79 | text-align: center;
80 | }
--------------------------------------------------------------------------------
/DatePicker/pages/selectDate/selectDate.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 开始时间
6 |
7 | {{checkInDate}}
8 |
9 |
10 |
11 | 结束时间
12 |
13 | {{checkOutDate}}
14 |
15 |
16 |
17 |
18 |
19 | {{item}}
20 | {{item}}
21 |
22 |
23 |
24 |
25 |
26 |
27 | {{dateItem.year}}年{{dateItem.month}}月
28 |
29 |
37 | {{item.day>0?item.day:''}}
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/DropdownView/utils/city.js:
--------------------------------------------------------------------------------
1 | var city_data =
2 | { "七年级上": { "人教版": ["有理数00", "整式的加减00", "一元一次方程00", "几何图形初步00"], "北师大版": ["有理数11", "整式的加减11", "一元一次方程11", "几何图形初步11","无理数11", "微积分11"], "华师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "湘教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "苏科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "鲁教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "沪科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"] }, "七年级下": { "人教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "北师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "华师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "湘教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "苏科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "鲁教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "沪科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"] }, "八年级上": { "人教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "北师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "华师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "湘教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "苏科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "鲁教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "沪科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"] }, "八年级下": { "人教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "北师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "华师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "湘教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "苏科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "鲁教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "沪科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"] }, "九年级上": { "人教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "北师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "华师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "湘教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "苏科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "鲁教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "沪科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"] }, "九年级下": { "人教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "北师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "华师大版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "湘教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "苏科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "鲁教版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"], "沪科版": ["有理数", "整式的加减", "一元一次方程", "几何图形初步"] } };
3 |
4 |
5 | function getCity() {
6 | return city_data;
7 | }
8 |
9 | module.exports = {
10 | getCity: getCity
11 | }
--------------------------------------------------------------------------------
/DropdownView/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .nav {
3 | width: 100%;
4 | height: 50px;
5 | position: relative;
6 | z-index: 99;
7 | text-align: center;
8 | font-size: 14px;
9 | border-top: 1px solid #d1d3d4;
10 | border-bottom: 1px solid #d1d3d4;
11 | background: #fff;
12 | display: flex;
13 | flex: 1;
14 | align-items:center;
15 | justify-content:center;
16 | }
17 |
18 | .content {
19 | display: inline-block;
20 | }
21 | .icon {
22 | display: inline-block;
23 | border: 4px solid transparent;
24 | border-top: 4px solid #9b9b9b;
25 | margin-left: 5px;
26 | }
27 |
28 | .nav.active .content {
29 | color: #61beff;
30 | }
31 | .nav.active .icon {
32 | border-bottom: 4px solid #61beff;
33 | border-top:0;
34 | }
35 |
36 |
37 | .quyu{
38 | position: relative;
39 | display: none;
40 | height: 450rpx;
41 | z-index: 5;
42 | }
43 | .quyu .qy{
44 | overflow-y: scroll;
45 | float: left;
46 | width: 33.33%;
47 | height: 450rpx;
48 | line-height: 80rpx;
49 | box-sizing: border-box;
50 | font-size: 14px;
51 | color: #717273;
52 | }
53 | .qy view{
54 | text-overflow: ellipsis;
55 | overflow: hidden;
56 | white-space:nowrap;
57 | padding-left: 15rpx;
58 | }
59 | .quyu-left{
60 | background: #c5c5c5;
61 | }
62 | .quyu-center{
63 | background: #e0e0e0;
64 | }
65 | .quyu-right{
66 | background: #F5F5F5;
67 | }
68 | .quyu-right view{
69 | border-bottom: 1px solid #c5c5c5;
70 | }
71 | .current{
72 | background: #d0d0d0;
73 | }
74 | .current2 {
75 | background: #f0f0f0;
76 | }
77 | .current3 {
78 | background: #fff;
79 | }
80 |
81 | .fullbg{
82 | position: fixed;
83 | top:0;
84 | z-index: 1;
85 | width: 100%;
86 | height: 100%;
87 | background: rgb(1, 1, 1);
88 | transition: all 2s;
89 | opacity: 0.5;
90 | }
91 |
92 |
93 | @keyframes slidown{
94 | from{
95 | transform: translateY(-100%);
96 | }
97 | to{
98 | transform: translateY(0%);
99 | }
100 | }
101 | .slidown{
102 | display: block;
103 | animation: slidown .7s ease-in both;
104 | }
105 | @keyframes slidup{
106 | from{
107 | transform: translateY(0%);
108 | }
109 | to{
110 | transform: translateY(-100%);
111 | }
112 | }
113 | .slidup{
114 | display: block;
115 | animation: slidup .7s ease-in both;
116 | }
117 | .disappear{
118 | display: none;
119 | }
120 |
--------------------------------------------------------------------------------
/DatePicker/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 |
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | checkInDate: '',
10 | checkOutDate: '',
11 | isToday: false,
12 | },
13 |
14 | /**
15 | * 生命周期函数--监听页面加载
16 | */
17 | onLoad: function (options) {
18 |
19 | },
20 |
21 | /**
22 | * 生命周期函数--监听页面初次渲染完成
23 | */
24 | onReady: function () {
25 |
26 | },
27 |
28 | /**
29 | * 生命周期函数--监听页面显示
30 | */
31 | onShow: function () {
32 | // 初始化时间
33 | this.initDate()
34 | },
35 |
36 | /**
37 | * 生命周期函数--监听页面隐藏
38 | */
39 | onHide: function () {
40 |
41 | },
42 |
43 | /**
44 | * 生命周期函数--监听页面卸载
45 | */
46 | onUnload: function () {
47 |
48 | },
49 |
50 | /**
51 | * 页面相关事件处理函数--监听用户下拉动作
52 | */
53 | onPullDownRefresh: function () {
54 |
55 | },
56 |
57 | /**
58 | * 页面上拉触底事件的处理函数
59 | */
60 | onReachBottom: function () {
61 |
62 | },
63 |
64 | /**
65 | * 用户点击右上角分享
66 | */
67 | onShareAppMessage: function () {
68 |
69 | },
70 | /**
71 | * 函数
72 | */
73 | // 初始化时间
74 | initDate() {
75 | var that = this
76 |
77 | var DATE_YEAR = new Date().getFullYear()
78 | var DATE_MONTH = new Date().getMonth() + 1
79 | var DATE_DAY = new Date().getDate()
80 | var TIME_NOW = DATE_YEAR + '-' + DATE_MONTH + '-' + DATE_DAY;
81 | var TIME_TOMORROW = DATE_YEAR + '-' + DATE_MONTH + '-' + (DATE_DAY + 1);
82 |
83 | wx.getStorage({
84 | key: 'ROOM_SOURCE_DATE',
85 | success: function (res) {
86 | if (TIME_NOW == res.data.checkInDate) {
87 | that.setData({
88 | isToday: true
89 | })
90 | } else {
91 | that.setData({
92 | isToday: false
93 | })
94 | }
95 | that.setData({
96 | checkInDate: res.data.checkInDate,
97 | checkOutDate: res.data.checkOutDate,
98 | })
99 | },
100 | fail: function (res) {
101 | wx.setStorage({
102 | key: 'ROOM_SOURCE_DATE',
103 | data: {
104 | checkInDate: TIME_NOW,
105 | checkOutDate: TIME_TOMORROW,
106 | totalDays: 1
107 | }
108 | });
109 |
110 | if (TIME_NOW) {
111 | that.setData({
112 | isToday: true
113 | })
114 | } else {
115 | that.setData({
116 | isToday: false
117 | })
118 | }
119 | that.setData({
120 | checkInDate: TIME_NOW,
121 | checkOutDate: TIME_TOMORROW,
122 | })
123 | }
124 | })
125 | },
126 | // 点击选择时间
127 | tapSelectDate: function (e) {
128 | wx.navigateTo({
129 | url: '/pages/selectDate/selectDate',
130 | })
131 | },
132 | })
--------------------------------------------------------------------------------
/AsyncAwait/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | import regeneratorRuntime from '../../utils/runtime.js'
3 | const moment = require('../../utils/mp-moment')
4 |
5 | //获取应用实例
6 | const app = getApp()
7 |
8 | Page({
9 |
10 | /**
11 | * 页面的初始数据
12 | */
13 | data: {
14 |
15 | },
16 |
17 | /**
18 | * 生命周期函数--监听页面加载
19 | */
20 | onLoad: function (options) {
21 | let that = this
22 | // 同步执行异步函数
23 | that.testAsync()
24 | // 异步执行异步函数
25 | // that.testSync()
26 | },
27 | async testAsync() {
28 | let that = this
29 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + ' testAsync start')
30 | console.log('show loading')
31 |
32 | let resultOne = await that.getValueOne();
33 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + resultOne)
34 | let resultTwo = await that.getValueTwo();
35 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + resultTwo)
36 | console.log('hide loading')
37 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + ' testAsync end')
38 | },
39 | async testSync() {
40 | let that = this
41 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + ' testSync start')
42 | console.log('show loading')
43 |
44 | let resultOne = that.getValueOne();
45 | let resultTwo = that.getValueTwo();
46 |
47 |
48 | let results = await Promise.all([resultOne, resultTwo])
49 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + results[0])
50 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + results[1])
51 |
52 | console.log('hide loading')
53 | console.log(moment(Date.now()).format('YYYY-MM-DD HH:mm:ss') + ' testSync end')
54 |
55 | },
56 | getValueOne() {
57 | let that = this
58 | let startTime = Date.now()
59 |
60 | return new Promise (function(resolve, reject) {
61 | setTimeout(function() {
62 | let endTime = Date.now()
63 | resolve(' 请求成功 one ' + moment(endTime - startTime) + 'ms')
64 | }, 1000)
65 | })
66 | },
67 | getValueTwo() {
68 | let that = this
69 | let startTime = Date.now()
70 |
71 | return new Promise(function (resolve, reject) {
72 | setTimeout(function () {
73 | let endTime = Date.now()
74 | resolve(' 请求成功 two ' + moment(endTime - startTime) + 'ms')
75 | }, 3000)
76 | })
77 | },
78 | /**
79 | * 生命周期函数--监听页面初次渲染完成
80 | */
81 | onReady: function () {
82 |
83 | },
84 |
85 | /**
86 | * 生命周期函数--监听页面显示
87 | */
88 | onShow: function () {
89 |
90 | },
91 |
92 | /**
93 | * 生命周期函数--监听页面隐藏
94 | */
95 | onHide: function () {
96 |
97 | },
98 |
99 | /**
100 | * 生命周期函数--监听页面卸载
101 | */
102 | onUnload: function () {
103 |
104 | },
105 |
106 | /**
107 | * 页面相关事件处理函数--监听用户下拉动作
108 | */
109 | onPullDownRefresh: function () {
110 |
111 | },
112 |
113 | /**
114 | * 页面上拉触底事件的处理函数
115 | */
116 | onReachBottom: function () {
117 |
118 | },
119 |
120 | /**
121 | * 用户点击右上角分享
122 | */
123 | onShareAppMessage: function () {
124 |
125 | }
126 | })
--------------------------------------------------------------------------------
/DropdownView/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 | var cityData = require('../../utils/city.js');
5 |
6 | Page({
7 | data: {
8 | cityleft: cityData.getCity(),
9 | qyshow: true,
10 | grade: '年级',
11 | course: '教材',
12 | section: '章节'
13 | },
14 | onLoad: function () {
15 |
16 | },
17 | selectleft: function (e) {
18 | this.setData({
19 | cityright: {},
20 | citycenter: this.data.cityleft[e.currentTarget.dataset.city],
21 | select1: e.target.dataset.city,
22 | select2: '',
23 | grade: e.currentTarget.dataset.city
24 | });
25 | },
26 | selectcenter: function (e) {
27 | this.setData({
28 | cityright: this.data.citycenter[e.currentTarget.dataset.city],
29 | select2: e.target.dataset.city,
30 | course: e.currentTarget.dataset.city
31 | });
32 | },
33 | selectright: function (e) {
34 | this.hidebg(e)
35 | this.setData({
36 | select3: e.target.dataset.city,
37 | section: this.data.cityright[e.currentTarget.dataset.city]
38 | })
39 | },
40 | hidebg: function (e) {
41 | this.setData({
42 | qyopen: false,
43 | nzopen: false,
44 | pxopen: false,
45 | nzshow: true,
46 | pxshow: true,
47 | qyshow: true,
48 | isfull: false,
49 | shownavindex: 0
50 | })
51 | },
52 | listqy: function (e) {
53 | if (this.data.qyopen) {
54 | this.setData({
55 | qyopen: false,
56 | nzopen: false,
57 | pxopen: false,
58 | nzshow: true,
59 | pxshow: true, // true
60 | qyshow: true, // false
61 | isfull: false,
62 | shownavindex: 0
63 | })
64 | } else {
65 | this.setData({
66 | qyopen: true,
67 | pxopen: false,
68 | nzopen: false,
69 | nzshow: true,
70 | pxshow: true,
71 | qyshow: false,
72 | isfull: true,
73 | shownavindex: e.currentTarget.dataset.nav
74 | })
75 | }
76 | },
77 | list: function (e) {
78 | if (this.data.nzopen) {
79 | this.setData({
80 | nzopen: false,
81 | pxopen: false,
82 | qyopen: false,
83 | nzshow: false,
84 | pxshow: true,
85 | qyshow: true,
86 | isfull: false,
87 | shownavindex: 0
88 | })
89 | } else {
90 | this.setData({
91 | nzopen: true,
92 | pxopen: false,
93 | qyopen: false,
94 | nzshow: false,
95 | pxshow: true,
96 | qyshow: true,
97 | isfull: true,
98 | shownavindex: e.currentTarget.dataset.nav
99 | })
100 | }
101 | },
102 | listpx: function (e) {
103 | if (this.data.pxopen) {
104 | this.setData({
105 | nzopen: false,
106 | pxopen: false,
107 | qyopen: false,
108 | nzshow: true,
109 | pxshow: false,
110 | qyshow: true,
111 | isfull: false,
112 | shownavindex: 0
113 | })
114 | } else {
115 | this.setData({
116 | nzopen: false,
117 | pxopen: true,
118 | qyopen: false,
119 | nzshow: true,
120 | pxshow: false,
121 | qyshow: true,
122 | isfull: true,
123 | shownavindex: e.currentTarget.dataset.nav
124 | })
125 | }
126 | },
127 | })
128 |
--------------------------------------------------------------------------------
/ShareImage/components/toastImage/toastImage.js:
--------------------------------------------------------------------------------
1 | // components/toastImage/toastImage.js
2 | var ctx = null
3 | var canvasToTempFilePath = null
4 | Component({
5 | /**
6 | * 组件的属性列表
7 | */
8 | properties: {
9 | // 图片背景地址
10 | bg_image: {
11 | type: String,
12 | value: ''
13 | },
14 | // 图片地址
15 | image: {
16 | type: String,
17 | value: ''
18 | },
19 | // 前景宽度
20 | toastImage_fg_width: {
21 | type: Number,
22 | value: 560
23 | },
24 | // 前景高度
25 | toastImage_fg_height: {
26 | type: Number,
27 | value: 800
28 | },
29 | // 是否显示按钮
30 | toastImage_showSaveButton: {
31 | type: Boolean,
32 | value: false
33 | }
34 | },
35 |
36 | /**
37 | * 组件的初始数据
38 | */
39 | data: {
40 | // 弹窗显示控制
41 | isShow: false
42 | },
43 | /**
44 | * 组件生命周期
45 | */
46 | detached: function () {
47 |
48 | },
49 | /**
50 | * 组件的方法列表
51 | */
52 | methods: {
53 | //隐藏弹框
54 | hide: function () {
55 | this.setData({
56 | isShow: !this.data.isShow
57 | })
58 | ctx = null
59 | },
60 | //展示弹框
61 | show: function () {
62 | let that = this
63 | if (!ctx) {
64 | wx.showLoading({
65 | title: '绘制中...',
66 | })
67 | var mpCodeP = new Promise(function (resolve) {
68 | wx.getImageInfo({
69 | src: that.data.image,
70 | success: function (res) {
71 | resolve(res.path)
72 | }
73 | })
74 | })
75 | var bgP = new Promise(function (resolve) {
76 | wx.getImageInfo({
77 | src: 'https://wx-static.yangcong345.com/v_1_8_0_assistVip_scan_moments.png',
78 | success: function (res) {
79 | resolve(res.path)
80 | }
81 | })
82 | })
83 | Promise.all([mpCodeP, bgP]).then(function (result) {
84 | ctx = wx.createCanvasContext('shareCanvas', that)
85 | // 小程序码
86 | const qrImgSize = 170
87 | ctx.drawImage(result[0], (that.data.toastImage_fg_height / 2 - qrImgSize) / 2 - 60, (that.data.toastImage_fg_width / 2 - qrImgSize) / 2 + 60, qrImgSize, qrImgSize)
88 | ctx.drawImage(result[1], 0, 0, 280, 375)
89 | ctx.stroke()
90 | ctx.draw()
91 | // 把canvas绘制的图片
92 | wx.canvasToTempFilePath({
93 | canvasId: 'shareCanvas',
94 | success: function (res) {
95 | canvasToTempFilePath = res.tempFilePath
96 | wx.showToast({
97 | title: '绘制成功',
98 | })
99 | },
100 | fail: function () {
101 | wx.showToast({
102 | title: '绘制失败',
103 | })
104 | },
105 | complete: function () {
106 | that.setData({
107 | isShow: !that.data.isShow
108 | })
109 | wx.hideLoading()
110 | wx.hideToast()
111 | }
112 | }, that)
113 | })
114 | }
115 | },
116 | // 点击关闭
117 | _clickToastImageClose: function (e) {
118 | //触发成功回调
119 | this.triggerEvent("clickToastImageClose")
120 | },
121 | // 点击保存图片到本地
122 | _clickToastImageSave: function (e) {
123 | this.triggerEvent("clickToastImageSave", canvasToTempFilePath)
124 | }
125 | }
126 | })
127 |
--------------------------------------------------------------------------------
/DatePicker/utils/Moment.js:
--------------------------------------------------------------------------------
1 | var Moment = function(date){
2 | var date;
3 | if(date)
4 | this.date = new Date(date);
5 | else
6 | this.date = new Date();
7 | return this;
8 | };
9 | /**
10 | * 对Date的扩展,将 Date 转化为指定格式的String
11 | * 月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) 可以用 1-2 个占位符
12 | * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
13 | * eg:
14 | * "yyyy-MM-dd hh:mm:ss.S" ==> 2006-07-02 08:09:04.423
15 | * "yyyy-M-d h:m:s.S" ==> 2006-7-2 8:9:4.18
16 | * "yyyy-MM-dd E HH:mm:ss" ==> 2009-03-10 二 20:09:04
17 | * "yyyy-MM-dd EE hh:mm:ss" ==> 2009-03-10 周二 08:09:04
18 | * "yyyy-MM-dd EEE hh:mm:ss" ==> 2009-03-10 星期二 08:09:04
19 | */
20 | Moment.prototype.format = function(format){
21 | var date = this.date;
22 | /*
23 | var r= /^(\d{4})-(\d{1,2})-(\d{1,2})$/; //正则表达式 匹配出生日期(简单匹配)
24 | r.exec('1985-10-15');
25 | s1=RegExp.$1;s2=RegExp.$2;s3=RegExp.$3;//结果为1985 10 15
26 | */
27 | if(typeof date === 'string')
28 | date = this.parse(date);
29 | var o = {
30 | "M+": date.getMonth() + 1, //月份
31 | "(d+|D+)": date.getDate(), //日
32 | "(h+|H+)": date.getHours(), //小时
33 | "m+": date.getMinutes(), //分
34 | "s+": date.getSeconds(), //秒
35 | "q+": Math.floor((date.getMonth() + 3) / 3), //季度
36 | "S": date.getMilliseconds() //毫秒
37 | };
38 | var week = {
39 | "0" : "/u65e5",
40 | "1" : "/u4e00",
41 | "2" : "/u4e8c",
42 | "3" : "/u4e09",
43 | "4" : "/u56db",
44 | "5" : "/u4e94",
45 | "6" : "/u516d"
46 | };
47 | if (/(y+|Y+)/.test(format))
48 | format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
49 | if(/(E+)/.test(format))
50 | format=format.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "/u661f/u671f" : "/u5468") : "")+week[date.getDay()+""]);
51 | for (var k in o){
52 | if (new RegExp("(" + k + ")").test(format))
53 | format = format.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
54 | }
55 | return format;
56 | }
57 |
58 | Moment.prototype.parse = function(){
59 | return this.date;
60 | }
61 | /**
62 | * 计算两个日期差差
63 | * return day
64 | */
65 | Moment.prototype.differ =function(date){
66 | var time1 = this.date.getTime();
67 | if(typeof date === 'string')
68 | date = new Date(date);
69 | var time1 = this.date.getTime();
70 | var time2 = date.getTime();
71 | var differ = Math.ceil((time1 - time2) / (1000*3600*24));//除不尽时,向上取整
72 | return differ;
73 | }
74 |
75 | Moment.prototype.add = function(num,optionType){
76 | var date = this.date;
77 | if('day' === optionType){
78 | date.setDate(date.getDate()+num);
79 | }
80 | if('month' === optionType){
81 | date.setMonth(date.getMonth()+num);
82 | }
83 | if('year' === optionType){
84 | date.setFullYear(date.getFullYear()+num);
85 | }
86 | this.date = date;
87 | return this;
88 | }
89 |
90 | Moment.prototype.before = function(date){
91 | return this.date.getTime() < new Date(date).getTime()
92 | }
93 | Moment.prototype.after = function(date){
94 | return this.date.getTime() > date.getTime()
95 | }
96 |
97 | module.exports = function(date){
98 | return new Moment(date);
99 | }
--------------------------------------------------------------------------------
/ShareImage/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 | let url_host = 'https://api-wx-test.yangcong345.com/'
5 | let url_downloadMpcode = 'parents/vipRewardHelp/mpCode.jpeg'
6 |
7 | Page({
8 | data: {
9 | toastImage_imageSrc: 'https://wx-static.yangcong345.com/v_1_8_0_assistVip_scan_group.png',
10 | xcxCode_tempFilePath: '',
11 | shareViewData: {
12 | title: '邀请好友助力,再多领7天会员',
13 | plantforms: [{
14 | 'name': 'shareToMoments',
15 | 'openType': '',
16 | 'image': 'https://wx-static.yangcong345.com/v_1_8_0_shareView_platform_timeline.png',
17 | 'text': '发送到朋友圈'
18 | },
19 | {
20 | 'name': 'shareToFriends',
21 | 'openType': 'share',
22 | 'image': 'https://wx-static.yangcong345.com/v_1_8_0_shareView_pltform_friend.png',
23 | 'text': '发送给好友'
24 | },
25 | {
26 | 'name': 'faceToFace',
27 | 'openType': '',
28 | 'image': 'https://wx-static.yangcong345.com/v_1_8_0_shareView_platform_face.png',
29 | 'text': '面对面扫一扫'
30 | },
31 | ],
32 | }
33 | },
34 | onReady: function () {
35 | let that = this
36 | that.toastImage = that.selectComponent("#toastImage")
37 | that.shareView = that.selectComponent("#shareView")
38 | },
39 | onLoad: function () {
40 | let that = this
41 | wx.downloadFile({
42 | url: 'https://api-wx-test.yangcong345.com/parents/vipRewardHelp/mpCode.jpeg?unionId=o8Xt4txUzphRXa4MUC8ROPl21dnM&pages/assistVip/assistVip',
43 | success(res) {
44 | that.setData({
45 | xcxCode_tempFilePath: res.tempFilePath
46 | })
47 | }
48 | })
49 | },
50 | /**
51 | * 点击事件
52 | */
53 | clickShare() {
54 | let that = this
55 | that.shareView.show()
56 | },
57 | /**
58 | * 分享组件
59 | */
60 | // 点击某一个分享平台
61 | _clickShareViewPlatform: function (e) {
62 | let that = this
63 | if (e.detail === 'shareToFriends') {
64 | that._clickShareViewFriends()
65 | } else if (e.detail === 'shareToMoments') {
66 | that._clickShareViewMoments()
67 | } else if (e.detail === 'faceToFace') {
68 | that._clickShareViewFaces()
69 | }
70 | },
71 | // 点击发送到朋友圈
72 | _clickShareViewMoments: function (e) {
73 | let that = this
74 | that._clickShareViewCancel()
75 | that.setData({
76 | toastImage_bg_imageSrc: 'https://wx-static.yangcong345.com/v_1_8_0_assistVip_scan_help.png',
77 | toastImage_imageSrc: that.data.xcxCode_tempFilePath,
78 | toastImage_fg_width: 560,
79 | toastImage_fg_height: 800,
80 | toastImage_showSaveButton: true
81 | })
82 | that.toastImage.show()
83 | },
84 | // 点击发送给好友
85 | _clickShareViewFriends: function (e) {
86 | let that = this
87 | that._clickShareViewCancel()
88 | console.log('点击发送给好友')
89 | },
90 | // 点击面对面扫一扫
91 | _clickShareViewFaces: function (e) {
92 | let that = this
93 | that._clickShareViewCancel()
94 | that.setData({
95 | toastImage_bg_imageSrc: 'https://wx-static.yangcong345.com/v_1_8_0_assistVip_scan_face.png',
96 | toastImage_imageSrc: that.data.xcxCode_tempFilePath,
97 | toastImage_fg_width: 560,
98 | toastImage_fg_height: 750,
99 | toastImage_showSaveButton: false
100 | })
101 | that.toastImage.show()
102 | },
103 | // 点击取消
104 | _clickShareViewCancel: function (e) {
105 | let that = this
106 | that.shareView.hide()
107 | },
108 | /**
109 | * 弹窗组件
110 | */
111 | // 点击关闭弹窗
112 | _clickToastImageClose: function (e) {
113 | var that = this
114 | that.toastImage.hide()
115 | },
116 | // 点击保存图片
117 | _clickToastImageSave: function (e) {
118 | app.saveImageToAlbum(e.detail)
119 | },
120 | })
121 |
--------------------------------------------------------------------------------
/DatePicker/pages/selectDate/selectDate.js:
--------------------------------------------------------------------------------
1 | // pages/dateSelect/dateSelect.js
2 |
3 | let Moment = require("../../utils/Moment.js");
4 |
5 | let DATE_LIST = [];
6 | let DATE_YEAR = new Date().getFullYear()
7 | let DATE_MONTH = new Date().getMonth() + 1
8 | let DATE_DAY = new Date().getDate()
9 |
10 | Page({
11 | data: {
12 | maxMonth: 6, //最多渲染月数
13 | dateList: [],
14 | systemInfo: {},
15 |
16 | weekStr: ['日', '一', '二', '三', '四', '五', '六'],
17 | checkInDate: Moment(new Date()).format('YYYY-MM-DD'),
18 | checkOutDate: Moment(new Date()).add(1, 'day').format('YYYY-MM-DD'),
19 | totalDays:'', //入住天数
20 | markcheckInDate: false, //标记开始时间是否已经选择
21 | markcheckOutDate: false //标记结束时间是否已经选择
22 | },
23 | onLoad: function (options) {
24 | // 页面初始化 options为页面跳转所带来的参数
25 | this.createDateListData();
26 | let _this = this;
27 | // 页面初始化 options为页面跳转所带来的参数
28 |
29 | let checkInDate = options.checkInDate ? options.checkInDate : Moment(new Date()).format('YYYY-MM-DD');
30 | let checkOutDate = options.checkOutDate ? options.checkOutDate : Moment(new Date()).add(1, 'day').format('YYYY-MM-DD');
31 |
32 | wx.getSystemInfo({
33 | success: function (res) {
34 | _this.setData({ systemInfo: res, checkInDate: checkInDate, checkOutDate: checkOutDate });
35 | }
36 | })
37 | },
38 | onReady: function () {
39 | // 页面渲染完成
40 | },
41 | onShow: function () {
42 | // 页面显示
43 |
44 | },
45 | onHide: function () {
46 | // 页面隐藏
47 | },
48 | onUnload: function () {
49 | // 页面关闭
50 | },
51 | createDateListData: function () {
52 | let dateList = [];
53 | let now = new Date();
54 | /*
55 | 设置日期为 年-月-01,否则可能会出现跨月的问题
56 | 比如:2017-01-31为now ,月份直接+1(now.setMonth(now.getMonth()+1)),则会直接跳到跳到2017-03-03月份.
57 | 原因是由于2月份没有31号,顺推下去变成了了03-03
58 | */
59 | now = new Date(now.getFullYear(), now.getMonth(), 1);
60 | for (let i = 0; i < this.data.maxMonth; i++) {
61 | let momentDate = Moment(now).add(this.data.maxMonth - (this.data.maxMonth - i), 'month').date;
62 | let year = momentDate.getFullYear();
63 | let month = momentDate.getMonth() + 1;
64 |
65 | let days = [];
66 | let totalDay = this.getTotalDayByMonth(year, month);
67 | let week = this.getWeek(year, month, 1);
68 | //-week是为了使当月第一天的日期可以正确的显示到对应的周几位置上,比如星期三(week = 2),
69 | //则当月的1号是从列的第三个位置开始渲染的,前面会占用-2,-1,0的位置,从1开正常渲染
70 | for (let j = -week + 1; j <= totalDay; j++) {
71 | let tempWeek = -1;
72 | if (j > 0)
73 | tempWeek = this.getWeek(year, month, j);
74 | let clazz = '';
75 | if (tempWeek == 0 || tempWeek == 6)
76 | clazz = 'week'
77 | if (j < DATE_DAY && year == DATE_YEAR && month == DATE_MONTH)
78 | //当天之前的日期不可用
79 | clazz = 'unavailable ' + clazz;
80 | else
81 | clazz = 'nostate ' + clazz
82 | days.push({ day: j, class: clazz })
83 | }
84 | let dateItem = {
85 | id: year + '-' + month,
86 | year: year,
87 | month: month,
88 | days: days
89 | }
90 |
91 | dateList.push(dateItem);
92 | }
93 | this.setData({
94 | dateList: dateList
95 | });
96 | DATE_LIST = dateList;
97 | },
98 | /*
99 | * 获取月的总天数
100 | */
101 | getTotalDayByMonth: function (year, month) {
102 | month = parseInt(month, 10);
103 | let d = new Date(year, month, 0);
104 | return d.getDate();
105 | },
106 | /*
107 | * 获取月的第一天是星期几
108 | */
109 | getWeek: function (year, month, day) {
110 | let d = new Date(year, month - 1, day);
111 | return d.getDay();
112 | },
113 | /**
114 | * 点击日期事件
115 | */
116 | onPressDate: function (e) {
117 | let { year, month, day } = e.target.dataset;
118 |
119 | //当前选择的日期为同一个月并小于今天,或者点击了空白处(即day<0),不执行
120 | if ((day < DATE_DAY && month == DATE_MONTH) || day <= 0) return;
121 |
122 | let tempMonth = month;
123 | let tempDay = day;
124 |
125 | if (month < 10) tempMonth = '0' + month
126 | if (day < 10) tempDay = '0' + day
127 |
128 | let date = year + '-' + tempMonth + '-' + tempDay;
129 |
130 | //如果点击选择的日期A小于入住时间,则重新渲染入住时间为A
131 | if ((this.data.markcheckInDate && Moment(date).before(this.data.checkInDate) || this.data.checkInDate === date)) {
132 | this.setData({
133 | markcheckInDate: false,
134 | markcheckOutDate: false,
135 | dateList: DATE_LIST.concat()
136 | });
137 | };
138 | if (!this.data.markcheckInDate) {
139 | this.setData({
140 | checkInDate: date,
141 | markcheckInDate: true,
142 | });
143 | } else if (!this.data.markcheckOutDate) {
144 | this.setData({
145 | checkOutDate: date,
146 | markcheckOutDate: true,
147 | });
148 | //设缓存,返回页面时,可在onShow时获取缓存起来的日期
149 | wx.setStorage({
150 | key: 'ROOM_SOURCE_DATE',
151 | data: {
152 | checkInDate: this.data.checkInDate,
153 | checkOutDate: this.data.checkOutDate,
154 | totalDays: Moment(date).differ(this.data.checkInDate)
155 | }
156 | });
157 | wx.navigateBack({});
158 | }
159 |
160 | this.renderPressStyle(year, month, day);
161 | },
162 | renderPressStyle: function (year, month, day) {
163 | let dateList = this.data.dateList;
164 | //渲染点击样式
165 | for (let i = 0; i < dateList.length; i++) {
166 | let dateItem = dateList[i];
167 | let id = dateItem.id;
168 | if (id === year + '-' + month) {
169 | let days = dateItem.days;
170 | for (let j = 0; j < days.length; j++) {
171 | let tempDay = days[j].day;
172 | if (tempDay == day) {
173 | days[j].class = days[j].class + ' active';
174 | break;
175 | }
176 | }
177 | break;
178 | }
179 | }
180 | this.setData({
181 | dateList: dateList
182 | });
183 | }
184 | })
--------------------------------------------------------------------------------
/AsyncAwait/utils/runtime.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | var regeneratorRuntime = (function (exports) {
9 | "use strict";
10 |
11 | var Op = Object.prototype;
12 | var hasOwn = Op.hasOwnProperty;
13 | var undefined; // More compressible than void 0.
14 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
15 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
16 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
17 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
18 |
19 | function wrap(innerFn, outerFn, self, tryLocsList) {
20 | // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
21 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
22 | var generator = Object.create(protoGenerator.prototype);
23 | var context = new Context(tryLocsList || []);
24 |
25 | // The ._invoke method unifies the implementations of the .next,
26 | // .throw, and .return methods.
27 | generator._invoke = makeInvokeMethod(innerFn, self, context);
28 |
29 | return generator;
30 | }
31 | exports.wrap = wrap;
32 |
33 | // Try/catch helper to minimize deoptimizations. Returns a completion
34 | // record like context.tryEntries[i].completion. This interface could
35 | // have been (and was previously) designed to take a closure to be
36 | // invoked without arguments, but in all the cases we care about we
37 | // already have an existing method we want to call, so there's no need
38 | // to create a new function object. We can even get away with assuming
39 | // the method takes exactly one argument, since that happens to be true
40 | // in every case, so we don't have to touch the arguments object. The
41 | // only additional allocation required is the completion record, which
42 | // has a stable shape and so hopefully should be cheap to allocate.
43 | function tryCatch(fn, obj, arg) {
44 | try {
45 | return { type: "normal", arg: fn.call(obj, arg) };
46 | } catch (err) {
47 | return { type: "throw", arg: err };
48 | }
49 | }
50 |
51 | var GenStateSuspendedStart = "suspendedStart";
52 | var GenStateSuspendedYield = "suspendedYield";
53 | var GenStateExecuting = "executing";
54 | var GenStateCompleted = "completed";
55 |
56 | // Returning this object from the innerFn has the same effect as
57 | // breaking out of the dispatch switch statement.
58 | var ContinueSentinel = {};
59 |
60 | // Dummy constructor functions that we use as the .constructor and
61 | // .constructor.prototype properties for functions that return Generator
62 | // objects. For full spec compliance, you may wish to configure your
63 | // minifier not to mangle the names of these two functions.
64 | function Generator() {}
65 | function GeneratorFunction() {}
66 | function GeneratorFunctionPrototype() {}
67 |
68 | // This is a polyfill for %IteratorPrototype% for environments that
69 | // don't natively support it.
70 | var IteratorPrototype = {};
71 | IteratorPrototype[iteratorSymbol] = function () {
72 | return this;
73 | };
74 |
75 | var getProto = Object.getPrototypeOf;
76 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
77 | if (NativeIteratorPrototype &&
78 | NativeIteratorPrototype !== Op &&
79 | hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
80 | // This environment has a native %IteratorPrototype%; use it instead
81 | // of the polyfill.
82 | IteratorPrototype = NativeIteratorPrototype;
83 | }
84 |
85 | var Gp = GeneratorFunctionPrototype.prototype =
86 | Generator.prototype = Object.create(IteratorPrototype);
87 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
88 | GeneratorFunctionPrototype.constructor = GeneratorFunction;
89 | GeneratorFunctionPrototype[toStringTagSymbol] =
90 | GeneratorFunction.displayName = "GeneratorFunction";
91 |
92 | // Helper for defining the .next, .throw, and .return methods of the
93 | // Iterator interface in terms of a single ._invoke method.
94 | function defineIteratorMethods(prototype) {
95 | ["next", "throw", "return"].forEach(function(method) {
96 | prototype[method] = function(arg) {
97 | return this._invoke(method, arg);
98 | };
99 | });
100 | }
101 |
102 | exports.isGeneratorFunction = function(genFun) {
103 | var ctor = typeof genFun === "function" && genFun.constructor;
104 | return ctor
105 | ? ctor === GeneratorFunction ||
106 | // For the native GeneratorFunction constructor, the best we can
107 | // do is to check its .name property.
108 | (ctor.displayName || ctor.name) === "GeneratorFunction"
109 | : false;
110 | };
111 |
112 | exports.mark = function(genFun) {
113 | if (Object.setPrototypeOf) {
114 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
115 | } else {
116 | genFun.__proto__ = GeneratorFunctionPrototype;
117 | if (!(toStringTagSymbol in genFun)) {
118 | genFun[toStringTagSymbol] = "GeneratorFunction";
119 | }
120 | }
121 | genFun.prototype = Object.create(Gp);
122 | return genFun;
123 | };
124 |
125 | // Within the body of any async function, `await x` is transformed to
126 | // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
127 | // `hasOwn.call(value, "__await")` to determine if the yielded value is
128 | // meant to be awaited.
129 | exports.awrap = function(arg) {
130 | return { __await: arg };
131 | };
132 |
133 | function AsyncIterator(generator) {
134 | function invoke(method, arg, resolve, reject) {
135 | var record = tryCatch(generator[method], generator, arg);
136 | if (record.type === "throw") {
137 | reject(record.arg);
138 | } else {
139 | var result = record.arg;
140 | var value = result.value;
141 | if (value &&
142 | typeof value === "object" &&
143 | hasOwn.call(value, "__await")) {
144 | return Promise.resolve(value.__await).then(function(value) {
145 | invoke("next", value, resolve, reject);
146 | }, function(err) {
147 | invoke("throw", err, resolve, reject);
148 | });
149 | }
150 |
151 | return Promise.resolve(value).then(function(unwrapped) {
152 | // When a yielded Promise is resolved, its final value becomes
153 | // the .value of the Promise<{value,done}> result for the
154 | // current iteration.
155 | result.value = unwrapped;
156 | resolve(result);
157 | }, function(error) {
158 | // If a rejected Promise was yielded, throw the rejection back
159 | // into the async generator function so it can be handled there.
160 | return invoke("throw", error, resolve, reject);
161 | });
162 | }
163 | }
164 |
165 | var previousPromise;
166 |
167 | function enqueue(method, arg) {
168 | function callInvokeWithMethodAndArg() {
169 | return new Promise(function(resolve, reject) {
170 | invoke(method, arg, resolve, reject);
171 | });
172 | }
173 |
174 | return previousPromise =
175 | // If enqueue has been called before, then we want to wait until
176 | // all previous Promises have been resolved before calling invoke,
177 | // so that results are always delivered in the correct order. If
178 | // enqueue has not been called before, then it is important to
179 | // call invoke immediately, without waiting on a callback to fire,
180 | // so that the async generator function has the opportunity to do
181 | // any necessary setup in a predictable way. This predictability
182 | // is why the Promise constructor synchronously invokes its
183 | // executor callback, and why async functions synchronously
184 | // execute code before the first await. Since we implement simple
185 | // async functions in terms of async generators, it is especially
186 | // important to get this right, even though it requires care.
187 | previousPromise ? previousPromise.then(
188 | callInvokeWithMethodAndArg,
189 | // Avoid propagating failures to Promises returned by later
190 | // invocations of the iterator.
191 | callInvokeWithMethodAndArg
192 | ) : callInvokeWithMethodAndArg();
193 | }
194 |
195 | // Define the unified helper method that is used to implement .next,
196 | // .throw, and .return (see defineIteratorMethods).
197 | this._invoke = enqueue;
198 | }
199 |
200 | defineIteratorMethods(AsyncIterator.prototype);
201 | AsyncIterator.prototype[asyncIteratorSymbol] = function () {
202 | return this;
203 | };
204 | exports.AsyncIterator = AsyncIterator;
205 |
206 | // Note that simple async functions are implemented on top of
207 | // AsyncIterator objects; they just return a Promise for the value of
208 | // the final result produced by the iterator.
209 | exports.async = function(innerFn, outerFn, self, tryLocsList) {
210 | var iter = new AsyncIterator(
211 | wrap(innerFn, outerFn, self, tryLocsList)
212 | );
213 |
214 | return exports.isGeneratorFunction(outerFn)
215 | ? iter // If outerFn is a generator, return the full iterator.
216 | : iter.next().then(function(result) {
217 | return result.done ? result.value : iter.next();
218 | });
219 | };
220 |
221 | function makeInvokeMethod(innerFn, self, context) {
222 | var state = GenStateSuspendedStart;
223 |
224 | return function invoke(method, arg) {
225 | if (state === GenStateExecuting) {
226 | throw new Error("Generator is already running");
227 | }
228 |
229 | if (state === GenStateCompleted) {
230 | if (method === "throw") {
231 | throw arg;
232 | }
233 |
234 | // Be forgiving, per 25.3.3.3.3 of the spec:
235 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
236 | return doneResult();
237 | }
238 |
239 | context.method = method;
240 | context.arg = arg;
241 |
242 | while (true) {
243 | var delegate = context.delegate;
244 | if (delegate) {
245 | var delegateResult = maybeInvokeDelegate(delegate, context);
246 | if (delegateResult) {
247 | if (delegateResult === ContinueSentinel) continue;
248 | return delegateResult;
249 | }
250 | }
251 |
252 | if (context.method === "next") {
253 | // Setting context._sent for legacy support of Babel's
254 | // function.sent implementation.
255 | context.sent = context._sent = context.arg;
256 |
257 | } else if (context.method === "throw") {
258 | if (state === GenStateSuspendedStart) {
259 | state = GenStateCompleted;
260 | throw context.arg;
261 | }
262 |
263 | context.dispatchException(context.arg);
264 |
265 | } else if (context.method === "return") {
266 | context.abrupt("return", context.arg);
267 | }
268 |
269 | state = GenStateExecuting;
270 |
271 | var record = tryCatch(innerFn, self, context);
272 | if (record.type === "normal") {
273 | // If an exception is thrown from innerFn, we leave state ===
274 | // GenStateExecuting and loop back for another invocation.
275 | state = context.done
276 | ? GenStateCompleted
277 | : GenStateSuspendedYield;
278 |
279 | if (record.arg === ContinueSentinel) {
280 | continue;
281 | }
282 |
283 | return {
284 | value: record.arg,
285 | done: context.done
286 | };
287 |
288 | } else if (record.type === "throw") {
289 | state = GenStateCompleted;
290 | // Dispatch the exception by looping back around to the
291 | // context.dispatchException(context.arg) call above.
292 | context.method = "throw";
293 | context.arg = record.arg;
294 | }
295 | }
296 | };
297 | }
298 |
299 | // Call delegate.iterator[context.method](context.arg) and handle the
300 | // result, either by returning a { value, done } result from the
301 | // delegate iterator, or by modifying context.method and context.arg,
302 | // setting context.delegate to null, and returning the ContinueSentinel.
303 | function maybeInvokeDelegate(delegate, context) {
304 | var method = delegate.iterator[context.method];
305 | if (method === undefined) {
306 | // A .throw or .return when the delegate iterator has no .throw
307 | // method always terminates the yield* loop.
308 | context.delegate = null;
309 |
310 | if (context.method === "throw") {
311 | if (delegate.iterator.return) {
312 | // If the delegate iterator has a return method, give it a
313 | // chance to clean up.
314 | context.method = "return";
315 | context.arg = undefined;
316 | maybeInvokeDelegate(delegate, context);
317 |
318 | if (context.method === "throw") {
319 | // If maybeInvokeDelegate(context) changed context.method from
320 | // "return" to "throw", let that override the TypeError below.
321 | return ContinueSentinel;
322 | }
323 | }
324 |
325 | context.method = "throw";
326 | context.arg = new TypeError(
327 | "The iterator does not provide a 'throw' method");
328 | }
329 |
330 | return ContinueSentinel;
331 | }
332 |
333 | var record = tryCatch(method, delegate.iterator, context.arg);
334 |
335 | if (record.type === "throw") {
336 | context.method = "throw";
337 | context.arg = record.arg;
338 | context.delegate = null;
339 | return ContinueSentinel;
340 | }
341 |
342 | var info = record.arg;
343 |
344 | if (! info) {
345 | context.method = "throw";
346 | context.arg = new TypeError("iterator result is not an object");
347 | context.delegate = null;
348 | return ContinueSentinel;
349 | }
350 |
351 | if (info.done) {
352 | // Assign the result of the finished delegate to the temporary
353 | // variable specified by delegate.resultName (see delegateYield).
354 | context[delegate.resultName] = info.value;
355 |
356 | // Resume execution at the desired location (see delegateYield).
357 | context.next = delegate.nextLoc;
358 |
359 | // If context.method was "throw" but the delegate handled the
360 | // exception, let the outer generator proceed normally. If
361 | // context.method was "next", forget context.arg since it has been
362 | // "consumed" by the delegate iterator. If context.method was
363 | // "return", allow the original .return call to continue in the
364 | // outer generator.
365 | if (context.method !== "return") {
366 | context.method = "next";
367 | context.arg = undefined;
368 | }
369 |
370 | } else {
371 | // Re-yield the result returned by the delegate method.
372 | return info;
373 | }
374 |
375 | // The delegate iterator is finished, so forget it and continue with
376 | // the outer generator.
377 | context.delegate = null;
378 | return ContinueSentinel;
379 | }
380 |
381 | // Define Generator.prototype.{next,throw,return} in terms of the
382 | // unified ._invoke helper method.
383 | defineIteratorMethods(Gp);
384 |
385 | Gp[toStringTagSymbol] = "Generator";
386 |
387 | // A Generator should always return itself as the iterator object when the
388 | // @@iterator function is called on it. Some browsers' implementations of the
389 | // iterator prototype chain incorrectly implement this, causing the Generator
390 | // object to not be returned from this call. This ensures that doesn't happen.
391 | // See https://github.com/facebook/regenerator/issues/274 for more details.
392 | Gp[iteratorSymbol] = function() {
393 | return this;
394 | };
395 |
396 | Gp.toString = function() {
397 | return "[object Generator]";
398 | };
399 |
400 | function pushTryEntry(locs) {
401 | var entry = { tryLoc: locs[0] };
402 |
403 | if (1 in locs) {
404 | entry.catchLoc = locs[1];
405 | }
406 |
407 | if (2 in locs) {
408 | entry.finallyLoc = locs[2];
409 | entry.afterLoc = locs[3];
410 | }
411 |
412 | this.tryEntries.push(entry);
413 | }
414 |
415 | function resetTryEntry(entry) {
416 | var record = entry.completion || {};
417 | record.type = "normal";
418 | delete record.arg;
419 | entry.completion = record;
420 | }
421 |
422 | function Context(tryLocsList) {
423 | // The root entry object (effectively a try statement without a catch
424 | // or a finally block) gives us a place to store values thrown from
425 | // locations where there is no enclosing try statement.
426 | this.tryEntries = [{ tryLoc: "root" }];
427 | tryLocsList.forEach(pushTryEntry, this);
428 | this.reset(true);
429 | }
430 |
431 | exports.keys = function(object) {
432 | var keys = [];
433 | for (var key in object) {
434 | keys.push(key);
435 | }
436 | keys.reverse();
437 |
438 | // Rather than returning an object with a next method, we keep
439 | // things simple and return the next function itself.
440 | return function next() {
441 | while (keys.length) {
442 | var key = keys.pop();
443 | if (key in object) {
444 | next.value = key;
445 | next.done = false;
446 | return next;
447 | }
448 | }
449 |
450 | // To avoid creating an additional object, we just hang the .value
451 | // and .done properties off the next function object itself. This
452 | // also ensures that the minifier will not anonymize the function.
453 | next.done = true;
454 | return next;
455 | };
456 | };
457 |
458 | function values(iterable) {
459 | if (iterable) {
460 | var iteratorMethod = iterable[iteratorSymbol];
461 | if (iteratorMethod) {
462 | return iteratorMethod.call(iterable);
463 | }
464 |
465 | if (typeof iterable.next === "function") {
466 | return iterable;
467 | }
468 |
469 | if (!isNaN(iterable.length)) {
470 | var i = -1, next = function next() {
471 | while (++i < iterable.length) {
472 | if (hasOwn.call(iterable, i)) {
473 | next.value = iterable[i];
474 | next.done = false;
475 | return next;
476 | }
477 | }
478 |
479 | next.value = undefined;
480 | next.done = true;
481 |
482 | return next;
483 | };
484 |
485 | return next.next = next;
486 | }
487 | }
488 |
489 | // Return an iterator with no values.
490 | return { next: doneResult };
491 | }
492 | exports.values = values;
493 |
494 | function doneResult() {
495 | return { value: undefined, done: true };
496 | }
497 |
498 | Context.prototype = {
499 | constructor: Context,
500 |
501 | reset: function(skipTempReset) {
502 | this.prev = 0;
503 | this.next = 0;
504 | // Resetting context._sent for legacy support of Babel's
505 | // function.sent implementation.
506 | this.sent = this._sent = undefined;
507 | this.done = false;
508 | this.delegate = null;
509 |
510 | this.method = "next";
511 | this.arg = undefined;
512 |
513 | this.tryEntries.forEach(resetTryEntry);
514 |
515 | if (!skipTempReset) {
516 | for (var name in this) {
517 | // Not sure about the optimal order of these conditions:
518 | if (name.charAt(0) === "t" &&
519 | hasOwn.call(this, name) &&
520 | !isNaN(+name.slice(1))) {
521 | this[name] = undefined;
522 | }
523 | }
524 | }
525 | },
526 |
527 | stop: function() {
528 | this.done = true;
529 |
530 | var rootEntry = this.tryEntries[0];
531 | var rootRecord = rootEntry.completion;
532 | if (rootRecord.type === "throw") {
533 | throw rootRecord.arg;
534 | }
535 |
536 | return this.rval;
537 | },
538 |
539 | dispatchException: function(exception) {
540 | if (this.done) {
541 | throw exception;
542 | }
543 |
544 | var context = this;
545 | function handle(loc, caught) {
546 | record.type = "throw";
547 | record.arg = exception;
548 | context.next = loc;
549 |
550 | if (caught) {
551 | // If the dispatched exception was caught by a catch block,
552 | // then let that catch block handle the exception normally.
553 | context.method = "next";
554 | context.arg = undefined;
555 | }
556 |
557 | return !! caught;
558 | }
559 |
560 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
561 | var entry = this.tryEntries[i];
562 | var record = entry.completion;
563 |
564 | if (entry.tryLoc === "root") {
565 | // Exception thrown outside of any try block that could handle
566 | // it, so set the completion value of the entire function to
567 | // throw the exception.
568 | return handle("end");
569 | }
570 |
571 | if (entry.tryLoc <= this.prev) {
572 | var hasCatch = hasOwn.call(entry, "catchLoc");
573 | var hasFinally = hasOwn.call(entry, "finallyLoc");
574 |
575 | if (hasCatch && hasFinally) {
576 | if (this.prev < entry.catchLoc) {
577 | return handle(entry.catchLoc, true);
578 | } else if (this.prev < entry.finallyLoc) {
579 | return handle(entry.finallyLoc);
580 | }
581 |
582 | } else if (hasCatch) {
583 | if (this.prev < entry.catchLoc) {
584 | return handle(entry.catchLoc, true);
585 | }
586 |
587 | } else if (hasFinally) {
588 | if (this.prev < entry.finallyLoc) {
589 | return handle(entry.finallyLoc);
590 | }
591 |
592 | } else {
593 | throw new Error("try statement without catch or finally");
594 | }
595 | }
596 | }
597 | },
598 |
599 | abrupt: function(type, arg) {
600 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
601 | var entry = this.tryEntries[i];
602 | if (entry.tryLoc <= this.prev &&
603 | hasOwn.call(entry, "finallyLoc") &&
604 | this.prev < entry.finallyLoc) {
605 | var finallyEntry = entry;
606 | break;
607 | }
608 | }
609 |
610 | if (finallyEntry &&
611 | (type === "break" ||
612 | type === "continue") &&
613 | finallyEntry.tryLoc <= arg &&
614 | arg <= finallyEntry.finallyLoc) {
615 | // Ignore the finally entry if control is not jumping to a
616 | // location outside the try/catch block.
617 | finallyEntry = null;
618 | }
619 |
620 | var record = finallyEntry ? finallyEntry.completion : {};
621 | record.type = type;
622 | record.arg = arg;
623 |
624 | if (finallyEntry) {
625 | this.method = "next";
626 | this.next = finallyEntry.finallyLoc;
627 | return ContinueSentinel;
628 | }
629 |
630 | return this.complete(record);
631 | },
632 |
633 | complete: function(record, afterLoc) {
634 | if (record.type === "throw") {
635 | throw record.arg;
636 | }
637 |
638 | if (record.type === "break" ||
639 | record.type === "continue") {
640 | this.next = record.arg;
641 | } else if (record.type === "return") {
642 | this.rval = this.arg = record.arg;
643 | this.method = "return";
644 | this.next = "end";
645 | } else if (record.type === "normal" && afterLoc) {
646 | this.next = afterLoc;
647 | }
648 |
649 | return ContinueSentinel;
650 | },
651 |
652 | finish: function(finallyLoc) {
653 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
654 | var entry = this.tryEntries[i];
655 | if (entry.finallyLoc === finallyLoc) {
656 | this.complete(entry.completion, entry.afterLoc);
657 | resetTryEntry(entry);
658 | return ContinueSentinel;
659 | }
660 | }
661 | },
662 |
663 | "catch": function(tryLoc) {
664 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
665 | var entry = this.tryEntries[i];
666 | if (entry.tryLoc === tryLoc) {
667 | var record = entry.completion;
668 | if (record.type === "throw") {
669 | var thrown = record.arg;
670 | resetTryEntry(entry);
671 | }
672 | return thrown;
673 | }
674 | }
675 |
676 | // The context.catch method must only be called with a location
677 | // argument that corresponds to a known catch block.
678 | throw new Error("illegal catch attempt");
679 | },
680 |
681 | delegateYield: function(iterable, resultName, nextLoc) {
682 | this.delegate = {
683 | iterator: values(iterable),
684 | resultName: resultName,
685 | nextLoc: nextLoc
686 | };
687 |
688 | if (this.method === "next") {
689 | // Deliberately forget the last sent value so that we don't
690 | // accidentally pass it on to the delegate.
691 | this.arg = undefined;
692 | }
693 |
694 | return ContinueSentinel;
695 | }
696 | };
697 |
698 | // Regardless of whether this script is executing as a CommonJS module
699 | // or not, return the runtime object so that we can declare the variable
700 | // regeneratorRuntime in the outer scope, which allows this module to be
701 | // injected easily by `bin/regenerator --include-runtime script.js`.
702 | return exports;
703 |
704 | }(
705 | // If this script is executing as a CommonJS module, use module.exports
706 | // as the regeneratorRuntime namespace. Otherwise create a new empty
707 | // object. Either way, the resulting object will be used to initialize
708 | // the regeneratorRuntime variable at the top of this file.
709 | typeof module === "object" ? module.exports : {}
710 | ));
711 |
--------------------------------------------------------------------------------