#1 bee3

Merged
yingying merged 3 commits from bee3 into master 1 year ago
  1. +4
    -0
      .gitignore
  2. +127
    -0
      LICENSE
  3. +188
    -1
      README.md
  4. +140
    -0
      app.js
  5. +115
    -0
      app.json
  6. +27
    -0
      app.wxss
  7. +1
    -0
      components/parser.20200731.min/libs/CssHandler.js
  8. +2
    -0
      components/parser.20200731.min/libs/MpHtmlParser.js
  9. +16
    -0
      components/parser.20200731.min/libs/config.js
  10. +2
    -0
      components/parser.20200731.min/parser.js
  11. +1
    -0
      components/parser.20200731.min/parser.json
  12. +1
    -0
      components/parser.20200731.min/parser.wxml
  13. +1
    -0
      components/parser.20200731.min/parser.wxss
  14. +1
    -0
      components/parser.20200731.min/trees/trees.js
  15. +1
    -0
      components/parser.20200731.min/trees/trees.json
  16. +1
    -0
      components/parser.20200731.min/trees/trees.wxml
  17. +1
    -0
      components/parser.20200731.min/trees/trees.wxss
  18. +6
    -0
      config.js
  19. BIN
      images/ad.png
  20. BIN
      images/cart.png
  21. BIN
      images/coupon.png
  22. BIN
      images/daohang.png
  23. BIN
      images/default.png
  24. BIN
      images/empty.png
  25. BIN
      images/friend.png
  26. BIN
      images/nav/index-off.png
  27. BIN
      images/nav/index-on.png
  28. BIN
      images/nav/my-off.png
  29. BIN
      images/nav/my-on.png
  30. BIN
      images/nav/qc-off.png
  31. BIN
      images/nav/qc-on.png
  32. BIN
      images/nav/qh-off.png
  33. BIN
      images/nav/qh-on.png
  34. BIN
      images/pay-pingtuan.png
  35. BIN
      images/pay.png
  36. BIN
      images/quhuo.png
  37. BIN
      images/tel.png
  38. BIN
      images/tuikuan.png
  39. BIN
      images/who.png
  40. BIN
      images/ziqu.png
  41. BIN
      images/zw.png
  42. +76
    -0
      miniprogram_npm/@vant/weapp/action-sheet/index.js
  43. +8
    -0
      miniprogram_npm/@vant/weapp/action-sheet/index.json
  44. +69
    -0
      miniprogram_npm/@vant/weapp/action-sheet/index.wxml
  45. +1
    -0
      miniprogram_npm/@vant/weapp/action-sheet/index.wxss
  46. +266
    -0
      miniprogram_npm/@vant/weapp/area/index.js
  47. +6
    -0
      miniprogram_npm/@vant/weapp/area/index.json
  48. +20
    -0
      miniprogram_npm/@vant/weapp/area/index.wxml
  49. +8
    -0
      miniprogram_npm/@vant/weapp/area/index.wxs
  50. +1
    -0
      miniprogram_npm/@vant/weapp/area/index.wxss
  51. +69
    -0
      miniprogram_npm/@vant/weapp/button/index.js
  52. +7
    -0
      miniprogram_npm/@vant/weapp/button/index.json
  53. +53
    -0
      miniprogram_npm/@vant/weapp/button/index.wxml
  54. +39
    -0
      miniprogram_npm/@vant/weapp/button/index.wxs
  55. +1
    -0
      miniprogram_npm/@vant/weapp/button/index.wxss
  56. +67
    -0
      miniprogram_npm/@vant/weapp/calendar/calendar.wxml
  57. +43
    -0
      miniprogram_npm/@vant/weapp/calendar/components/header/index.js
  58. +3
    -0
      miniprogram_npm/@vant/weapp/calendar/components/header/index.json
  59. +16
    -0
      miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml
  60. +1
    -0
      miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss
  61. +173
    -0
      miniprogram_npm/@vant/weapp/calendar/components/month/index.js
  62. +3
    -0
      miniprogram_npm/@vant/weapp/calendar/components/month/index.json
  63. +39
    -0
      miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml
  64. +71
    -0
      miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs
  65. +1
    -0
      miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss
  66. +335
    -0
      miniprogram_npm/@vant/weapp/calendar/index.js
  67. +10
    -0
      miniprogram_npm/@vant/weapp/calendar/index.json
  68. +25
    -0
      miniprogram_npm/@vant/weapp/calendar/index.wxml
  69. +37
    -0
      miniprogram_npm/@vant/weapp/calendar/index.wxs
  70. +1
    -0
      miniprogram_npm/@vant/weapp/calendar/index.wxss
  71. +91
    -0
      miniprogram_npm/@vant/weapp/calendar/utils.js
  72. +25
    -0
      miniprogram_npm/@vant/weapp/calendar/utils.wxs
  73. +51
    -0
      miniprogram_npm/@vant/weapp/card/index.js
  74. +6
    -0
      miniprogram_npm/@vant/weapp/card/index.json
  75. +56
    -0
      miniprogram_npm/@vant/weapp/card/index.wxml
  76. +1
    -0
      miniprogram_npm/@vant/weapp/card/index.wxss
  77. +12
    -0
      miniprogram_npm/@vant/weapp/cell-group/index.js
  78. +3
    -0
      miniprogram_npm/@vant/weapp/cell-group/index.json
  79. +9
    -0
      miniprogram_npm/@vant/weapp/cell-group/index.wxml
  80. +1
    -0
      miniprogram_npm/@vant/weapp/cell-group/index.wxss
  81. +40
    -0
      miniprogram_npm/@vant/weapp/cell/index.js
  82. +6
    -0
      miniprogram_npm/@vant/weapp/cell/index.json
  83. +47
    -0
      miniprogram_npm/@vant/weapp/cell/index.wxml
  84. +17
    -0
      miniprogram_npm/@vant/weapp/cell/index.wxs
  85. +1
    -0
      miniprogram_npm/@vant/weapp/cell/index.wxss
  86. +38
    -0
      miniprogram_npm/@vant/weapp/checkbox-group/index.js
  87. +3
    -0
      miniprogram_npm/@vant/weapp/checkbox-group/index.json
  88. +1
    -0
      miniprogram_npm/@vant/weapp/checkbox-group/index.wxml
  89. +1
    -0
      miniprogram_npm/@vant/weapp/checkbox-group/index.wxss
  90. +83
    -0
      miniprogram_npm/@vant/weapp/checkbox/index.js
  91. +6
    -0
      miniprogram_npm/@vant/weapp/checkbox/index.json
  92. +31
    -0
      miniprogram_npm/@vant/weapp/checkbox/index.wxml
  93. +20
    -0
      miniprogram_npm/@vant/weapp/checkbox/index.wxs
  94. +1
    -0
      miniprogram_npm/@vant/weapp/checkbox/index.wxss
  95. +47
    -0
      miniprogram_npm/@vant/weapp/circle/canvas.js
  96. +215
    -0
      miniprogram_npm/@vant/weapp/circle/index.js
  97. +3
    -0
      miniprogram_npm/@vant/weapp/circle/index.json
  98. +9
    -0
      miniprogram_npm/@vant/weapp/circle/index.wxml
  99. +1
    -0
      miniprogram_npm/@vant/weapp/circle/index.wxss
  100. +11
    -0
      miniprogram_npm/@vant/weapp/col/index.js

+ 4
- 0
.gitignore View File

@@ -0,0 +1,4 @@
dist/
package-lock.json
node_modules/
.DS_Store

+ 127
- 0
LICENSE View File

@@ -0,0 +1,127 @@
木兰宽松许可证, 第2版

木兰宽松许可证, 第2版
2020年1月 http://license.coscl.org.cn/MulanPSL2


您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:

0. 定义

“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。

“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。

“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。

“法人实体”是指提交贡献的机构及其“关联实体”。

“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。

1. 授予版权许可

每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。

2. 授予专利许可

每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。

3. 无商标许可

“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。

4. 分发限制

您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。

5. 免责声明与责任限制

“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。

6. 语言
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。

条款结束

如何将木兰宽松许可证,第2版,应用到您的软件
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:

1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;

2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;

3, 请将如下声明文本放入每个源文件的头部注释中。

Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.


Mulan Permissive Software License,Version 2

Mulan Permissive Software License,Version 2 (Mulan PSL v2)
January 2020 http://license.coscl.org.cn/MulanPSL2

Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
0. Definition
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
Contribution means the copyrightable work licensed by a particular Contributor under this License.
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
Legal Entity means the entity making a Contribution and all its Affiliates.
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.

1. Grant of Copyright License

Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.

2. Grant of Patent License

Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.

3. No Trademark License

No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.

4. Distribution Restriction

You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.

5. Disclaimer of Warranty and Limitation of Liability

THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

6. Language

THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.

END OF THE TERMS AND CONDITIONS

How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software

To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:

i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;

ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;

iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.


Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.

+ 188
- 1
README.md View File

@@ -1,2 +1,189 @@
# bee
# 微信小程序——餐饮点餐商城

微信小程序——餐饮点餐商城,是针对餐饮行业推出的一套完整的餐饮解决方案,实现了用户在线点餐下单、外卖、叫号排队、支付、配送等功能,完美的使餐饮行业更高效便捷!

大家如果在使用过程有什么问题,欢迎通过lssues与我们交流!

如果本项目对您有所帮助或者启发,请给我们 Star 吧,您的鼓励是我们最大对动力~

# 招募开发者

希望找一些志同道合的朋友一起来完善这个开源项目,持续更新下去,有兴趣的可以加入QQ群 ( 详见下面的QQ群 ) 联系管理员,期待您的加入!

# 加微信联系我

<img src="https://dcdn.it120.cc/2022/09/19/7b884d58-541a-404b-a805-457540d7f87f.jpeg" width="200px">

# 推荐一个订座取号的开源项目

最近经常有人咨询说需要订座和取号的功能,api工厂有一个基于 uni-app 的开源模板,可能大家没注意,再把地址贴一下,有需要的自取:

- [仿海底捞订座排队 (uni-app)](https://github.com/gooking/dingzuopaidui)
- [码云镜像](https://gitee.com/javazj/dingzuopaidui)


# 自提/外卖 扫码体验

<img src="https://dcdn.it120.cc/2021/01/19/b388b014-7ae0-4b3a-9d6f-30c8b3082fe6.jpg" width="200px">


# 扫码点餐演示

| 座号A1 | 座号A2 | 座号A3 | 座号A4 | 座号A5 |
| :------: | :------: | :------: | :------: | :------: |
| <img src="https://dcdn.it120.cc/cuser/27/2021/09/26/cbb91217-47b1-4af1-a0e5-55df0efd3566.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/cbb30b43-15df-4564-87ef-3416f58ab0c8.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/150cd47b-e769-49fc-bca6-be8c5fe84f49.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/b5a44d1f-cea4-437f-802d-a36c728ff459.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/99c47ba3-50ba-4431-93c6-e10f527a5e28.png" width="200px"> |


| 座号A6 | 座号A7 | 座号A8 | 座号A9 | 座号A10 |
| :------: | :------: | :------: | :------: | :------: |
| <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/aca7a7fd-72c9-4d89-a903-d82e6b8b8f83.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/77f16752-656f-4218-99df-c82c5db1921a.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/e3be04c4-9c0f-41c8-9482-b645699d1df4.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/352c7e84-56ec-4961-9e7d-cc4e752cf154.png" width="200px"> | <img src="https://dcdn.it120.cc/cuser/27/2023/01/04/78adb196-231d-41b7-be8d-51febc022bac.png" width="200px"> |

## 桌号管理

登录后台,左侧菜单 “桌号管理”,添加并管理你的桌号信息,添加以后在列表你将可以看到 ID 和 密钥,这两个数据用来生成桌子的二维码

<img src="https://dcdn.it120.cc/2022/12/30/e76a0320-992a-4932-9d58-dec3fd6630b8.png">

## 生成桌子二维码

例如上面的ID为 308,密钥为 d3PiIY,那么现在去左侧菜单微信设置 -> 小程序设置 -> 获取小程序二维码(圆形码),即可获取小程序码:
填写信息如下:
- 页面路径: pages/index/index
- scene参数: shopId=12879,id=308,key=d3PiIY

其中 shopId 为你对应的门店ID,其他参数默认就可以了

<img src="https://dcdn.it120.cc/2022/12/30/6c807326-8db9-465a-912e-58847b28658c.png">


# QQ交流群

| 交流群4(276780260)|
| :------: |
| <img src="https://dcdn.it120.cc/2022/12/20/5e4d6d5b-1361-476d-912f-ee740f036ec6.jpeg" width="200px">|

| 交流群1(已满)(926321567) | 交流群2(已满)(671428068) | 交流群3(已满)(709136251) |
| :------: | :------: | :------: |
| <img src="https://dcdn.it120.cc/2020/07/27/e3d09fd2-ace0-4cf4-9d71-e0454591ff54.png" width="200px">| <img src="https://dcdn.it120.cc/2020/12/27/b709cceb-befc-405b-8c5a-c8f9e90a1a5b.png" width="150px">| <img src="https://dcdn.it120.cc/2021/09/13/751cb675-265e-4be1-8f2e-f26935f693d7.png" width="150px">|

# 本项目使用了下面的组件,在此鸣谢

- [vant-UI库](https://youzan.github.io/vant-weapp/)

- [小程序在线接口-SDK](https://github.com/gooking/apifm-wxapi)

- [api工厂](https://admin.it120.cc)

- [FMUI-轻松活泼-icon](https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=17041)

- [小程序HTML解析组件](https://github.com/jin-yufeng/Parser)

- [生成条码和二维码](https://github.com/alsey/wxbarcode)

# 使用教程
## 注册开通小程序账号
https://mp.weixin.qq.com/
根据自己的实际情况选择 “企业”、“个体工商户”身份,注册小程序账号,商城类小程序不支持个人用户上线,所以一定要选择企业或者个体户,获得你自己小程序的 appid 和 secret 信息,保存好,下面会用到:
- [如何查看小程序的AppID和AppSecret](https://jingyan.baidu.com/article/642c9d340305e3644a46f795.html)
你需要设置小程序的合法域名,否则开发工具上运行正常,手机访问的时候将看不到数据
- [设置合法服务器域名](https://www.it120.cc/help/tvpou9.html)
## 注册开通后台账号
https://admin.it120.cc/
免费注册开通新后台后登录,登录后的首页,请记下你的专属域名,后面会用到
左侧菜单 “工厂设置” --> “数据克隆” --> “将别人的数据克隆给我”
对方商户ID填写 27
点击 “立即克隆”,克隆成功后,F5 刷新一下后台
## 配置小程序APPID/SECRET
左侧菜单,微信设置,填写配置上一步获得的 appid 和 secret
这一步很重要!!!
如果没有正确配置,下面步骤中打开小程序将无法连接你的后台
## 配置微信支付
左侧菜单,系统设置 --> 在线支付配置,填写您自己的微信支付的信息
## 下载安装开发工具
https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
## 运行小程序看效果
双击运行第一步安装的小程序开发工具,打开看效果:

<img src="https://dcdn.it120.cc/yuque/0/2019/png/572726/1575349127431-00ff2059-dd5e-4e4b-99a7-e1d605db02c7.png?x-oss-process=image%2Fresize%2Cw_1500 " width="200px">

导入项目这里,目录选择你 “第二步” 中下载并加压的小程序代码所在目录

APPID 务必要改成你自己的小程序的 APPID
APPID 务必要改成你自己的小程序的 APPID
APPID 务必要改成你自己的小程序的 APPID

然后点击导入按钮

- [如何查看小程序的AppID和AppSecret](https://jingyan.baidu.com/article/642c9d340305e3644a46f795.html)

## 配置对接你自己的后台
在开发工具中 config.js 中的subDomain 改成你自己专属域名, ctrl + s 保存

<img src="https://dcdn.it120.cc/yuque/0/2020/png/572726/1581236703094-ce5c7f32-c60d-4e1b-bacb-21439e1d2721.png?x-oss-process=image%2Fresize%2Cw_1500 " width="200px">

- [如何查看自己的subDomain](https://www.it120.cc/help/qr6l4m.html)

## 用户自提的订单如何扫码核销

用户选择自提的订单,会在底部取餐菜单界面显示订单信息以及取餐码,商家可通过 “我的” --> “扫码核销” 菜单,点击以后调起手机相机,扫用户出示的取餐码完成核销

但是默认情况下,是看不见 “我的” --> “扫码核销” 菜单的,需要在后台 “系统设置” --> “系统参数” ,添加文本类型的参数:

- 参数名 order_hx_uids
- 参数值,具有核销权限的用户的用户编号,多个用户编号,使用英文的逗号分隔

重新进入小程序以后,就可以看见 “扫码核销” 的菜单了

# 配置说明

## 如何修改小程序首页标题

登录后台,左侧菜单 “系统设置” --> “系统参数” ,添加一个文本类型的参数: mallName (注意大小写),小程序即可显示你后台填的名称

## 根据选择的不同门店,区分显示商品(只显示当前门店的商品)

登录后台,左侧菜单 “系统设置” --> “系统参数” ,添加一个开关类型的参数: shop_goods_split,开启为区分,关闭为不区分

## 如何设置服务范围(多少公里)

后台 “商场管理” --> “门店管理” ,编辑门店,服务距离处,填写你希望配送的距离即可

## 如何显示销量

商品列表接口、商品详情接口,都会返回商品的销量数据,分别是 numberOrders 和 numberSells 两个字段,你可以在界面上任何希望显示销量的地方,进行展示即可

- numberOrders 订单数量
- numberSells 商品数量

假如说用户下了一个订单一次性购买10份这个商品,那么 numberOrders = 1 ,numberSells = 10

## 如何区分门店显示商品

后台左侧菜单“系统设置” -> “系统参数”,增加一个开关类型的参数: shop_goods_split

开启则只会显示当前门店的商品,关闭则显示所有门店的商品

## 在线订座如何配置

1. 左侧菜单 “预约报名” --> “项目设置” ,添加一个项目,添加完以后会得到一个编号
2. 左侧菜单 “系统设置” --> “系统参数”, 修改编号为 `zxdz` 的参数,将你的编号填进去即可

# 常见问题

## 无法登陆 / 无法获取 openid

1. 请检查 config.js 文件中的 subDomain 是否已经修改成你自己的专属域名了
[如何查看自己的subDomain](https://www.it120.cc/help/qr6l4m.html)

2. 确保下面3个地方的 appID 你填的是一样的

- 登录你的小程序商户后台(https://mp.weixin.qq.com)左侧菜单 “开发” --> “开发设置” 中的 appid
- 点击你的小程序开发工具 右上角 的“详情” --> “基本信息” 中的 appid
- 登录你的 api工厂 后台(https://admin.it120.cc),左侧菜单微信设置中的 appid

## 获取手机号码失败,提示没权限

https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html

官方文档有说明,获取手机号码的前提条件是:非个人开发者,且完成了认证的小程序开放(不包含海外主体)

+ 140
- 0
app.js View File

@@ -0,0 +1,140 @@
const WXAPI = require('apifm-wxapi')
const CONFIG = require('config.js')
const AUTH = require('utils/auth')
App({
onLaunch: function() {
WXAPI.init(CONFIG.subDomain)
const that = this;
// 检测新版本
const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
/**
* 初次加载判断网络情况
* 无网络状态下根据实际情况进行调整
*/
wx.getNetworkType({
success(res) {
const networkType = res.networkType
if (networkType === 'none') {
that.globalData.isConnected = false
wx.showToast({
title: '当前无网络',
icon: 'loading',
duration: 2000
})
}
}
});
/**
* 监听网络状态变化
* 可根据业务需求进行调整
*/
wx.onNetworkStatusChange(function(res) {
if (!res.isConnected) {
that.globalData.isConnected = false
wx.showToast({
title: '网络已断开',
icon: 'loading',
duration: 2000
})
} else {
that.globalData.isConnected = true
wx.hideToast()
}
})
WXAPI.queryConfigBatch('mallName,myBg,mapPos,order_hx_uids,subscribe_ids,share_profile,zxdz,admin_uids,shop_goods_split').then(res => {
if (res.code == 0) {
res.data.forEach(config => {
wx.setStorageSync(config.key, config.value);
})
if (this.configLoadOK) {
this.configLoadOK()
}
}
})
},
onShow (e) {
if (e && e.query && e.query.scene) {
const scene = decodeURIComponent(e.query.scene) // 处理扫码进商品详情页面的逻辑
if (scene && scene.split(',').length == 3) {
// 扫码点餐
} else {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.authorize()
}
})
}
} else {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.authorize()
}
})
}
// 保存邀请人
if (e && e.query && e.query.inviter_id) {
wx.setStorageSync('referrer', e.query.inviter_id)
if (e.shareTicket) {
wx.getShareInfo({
shareTicket: e.shareTicket,
success: res => {
console.log(res)
console.log({
referrer: e.query.inviter_id,
encryptedData: res.encryptedData,
iv: res.iv
})
wx.login({
success(loginRes) {
if (loginRes.code) {
WXAPI.shareGroupGetScore(
loginRes.code,
e.query.inviter_id,
res.encryptedData,
res.iv
).then(_res => {
console.log(_res)
}).catch(err => {
console.error(err)
})
} else {
console.error('登录失败!' + loginRes.errMsg)
}
}
})
}
})
}
}
this.refreshStorageShopInfo()
},
async refreshStorageShopInfo() {
// 刷新本地缓存的门店信息 https://www.yuque.com/apifm/nu0f75/cu4cfi
let shopInfo = wx.getStorageSync('shopInfo')
if (!shopInfo) {
return
}
const res = await WXAPI.shopSubdetail(shopInfo.id)
if (res.code == 0) {
const distance = shopInfo.distance
shopInfo = res.data.info
shopInfo.distance = distance
wx.setStorageSync('shopInfo', shopInfo)
}
},
globalData: {
isConnected: true
}
})

+ 115
- 0
app.json View File

@@ -0,0 +1,115 @@
{
"pages": [
"pages/index/index",
"pages/all-orders/index",
"pages/my/index",
"pages/my/feedback",
"pages/my/user-code",
"pages/ad/index",
"pages/pay/index",
"pages/shop/select",
"pages/shop/detail",
"pages/shop/join-apply",
"pages/youhui-pay/index",
"pages/member-center/index",
"pages/order-details/index",
"pages/order-details/scan-result",
"pages/order-details/doing",
"pages/about/index",
"pages/coupons/index",
"pages/booking/index",
"pages/asset/index",
"pages/asset/recharge-log",
"pages/asset/cash-log",
"pages/sign/index",
"pages/score/logs",
"pages/notice/detail",
"pages/queue/index",
"pages/cart/index",
"pages/cart/order",
"pages/goods-details/index"
],
"requiredPrivateInfos": [
"getLocation",
"chooseLocation",
"chooseAddress"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#6e6d6b",
"selectedColor": "#e64340",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/nav/index-off.png",
"selectedIconPath": "images/nav/index-on.png",
"text": "点餐"
},
{
"pagePath": "pages/queue/index",
"iconPath": "images/nav/qh-off.png",
"selectedIconPath": "images/nav/qh-on.png",
"text": "取号"
},
{
"pagePath": "pages/order-details/doing",
"iconPath": "images/nav/qc-off.png",
"selectedIconPath": "images/nav/qc-on.png",
"text": "取餐"
},
{
"pagePath": "pages/my/index",
"iconPath": "images/nav/my-off.png",
"selectedIconPath": "images/nav/my-on.png",
"text": "我的"
}
]
},
"permission": {
"scope.userLocation": {
"desc": "获取离你最近的门店"
}
},
"usingComponents": {
"parser":"/components/parser.20200731.min/parser",
"van-button": "@vant/weapp/button/index",
"van-sidebar": "@vant/weapp/sidebar/index",
"van-sidebar-item": "@vant/weapp/sidebar-item/index",
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
"van-card": "@vant/weapp/card/index",
"van-submit-bar": "@vant/weapp/submit-bar/index",
"van-popup": "@vant/weapp/popup/index",
"van-stepper": "@vant/weapp/stepper/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index",
"van-empty": "@vant/weapp/empty/index",
"van-field": "@vant/weapp/field/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-overlay": "@vant/weapp/overlay/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-notice-bar": "@vant/weapp/notice-bar/index",
"van-tabbar": "@vant/weapp/tabbar/index",
"van-tabbar-item": "@vant/weapp/tabbar-item/index",
"van-tag": "@vant/weapp/tag/index",
"van-goods-action": "@vant/weapp/goods-action/index",
"van-goods-action-icon": "@vant/weapp/goods-action-icon/index",
"van-goods-action-button": "@vant/weapp/goods-action-button/index",
"van-uploader": "@vant/weapp/uploader/index",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index"
},
"sitemapLocation": "sitemap.json"
}

+ 27
- 0
app.wxss View File

@@ -0,0 +1,27 @@
page {
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica,
Segoe UI, Arial, Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei',
sans-serif;
}
page,view,image,input {
display: block;
box-sizing: border-box;
}
.badge {
position: absolute;
top: 0;
right: 0;
box-sizing: border-box;
width: 38rpx;
height: 38rpx;
line-height: 38rpx;
color: #fff;
font-size: 20rpx;
text-align: center;
background-color: #e64340;
border: 1rpx solid #fff;
border-radius: 50%;
}
.block-btn {
padding: 0 32rpx;
}

+ 1
- 0
components/parser.20200731.min/libs/CssHandler.js View File

@@ -0,0 +1 @@
function t(t){var s=Object.assign(Object.create(null),i.userAgentStyles);for(var h in t)s[h]=(s[h]?s[h]+";":"")+t[h];this.styles=s}function s(t,s){this.data=t,this.floor=0,this.i=0,this.list=[],this.res=s,this.state=this.Space}var i=require("./config.js"),h=function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"};t.prototype.getStyle=function(t){this.styles=new s(t,this.styles).parse()},t.prototype.match=function(t,s){var i,h=(i=this.styles[t])?i+";":"";if(s.class)for(var e,a=s.class.split(" "),o=0;e=a[o];o++)(i=this.styles["."+e])&&(h+=i+";");return(i=this.styles["#"+s.id])&&(h+=i+";"),h},module.exports=t,s.prototype.parse=function(){for(var t;t=this.data[this.i];this.i++)this.state(t);return this.res},s.prototype.section=function(){return this.data.substring(this.start,this.i)},s.prototype.Space=function(t){"."==t||"#"==t||h(t)?(this.start=this.i,this.state=this.Name):"/"==t&&"*"==this.data[this.i+1]?this.Comment():i.blankChar[t]||";"==t||(this.state=this.Ignore)},s.prototype.Comment=function(){this.i=this.data.indexOf("*/",this.i)+1,this.i||(this.i=this.data.length),this.state=this.Space},s.prototype.Ignore=function(t){"{"==t?this.floor++:"}"!=t||--this.floor||(this.state=this.Space)},s.prototype.Name=function(t){i.blankChar[t]?(this.list.push(this.section()),this.state=this.NameSpace):"{"==t?(this.list.push(this.section()),this.Content()):","==t?(this.list.push(this.section()),this.Comma()):!h(t)&&(t<"0"||t>"9")&&"-"!=t&&"_"!=t&&(this.state=this.Ignore)},s.prototype.NameSpace=function(t){"{"==t?this.Content():","==t?this.Comma():i.blankChar[t]||(this.state=this.Ignore)},s.prototype.Comma=function(){for(;i.blankChar[this.data[++this.i]];);"{"==this.data[this.i]?this.Content():(this.start=this.i--,this.state=this.Name)},s.prototype.Content=function(){this.start=++this.i,-1==(this.i=this.data.indexOf("}",this.i))&&(this.i=this.data.length);for(var t,s=this.section(),i=0;t=this.list[i++];)this.res[t]?this.res[t]+=";"+s:this.res[t]=s;this.list=[],this.state=this.Space}

+ 2
- 0
components/parser.20200731.min/libs/MpHtmlParser.js
File diff suppressed because it is too large
View File


+ 16
- 0
components/parser.20200731.min/libs/config.js View File

@@ -0,0 +1,16 @@
function e(e){for(var t=Object.create(null),a=e.split(","),o=a.length;o--;)t[a[o]]=!0;return t}var t=wx.canIUse("editor");
module.exports={
errorImg:null,
filter:null,
highlight:null,
onText:null,
entities:{quot:'"',apos:"'",semi:";",nbsp:" ",ndash:"–",mdash:"—",middot:"·",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",hellip:"…"},
blankChar:e(' ,\xA0,\t,\r,\n,\f'),
boolAttrs:e('autoplay,autostart,controls,ignore,loop,muted'),
blockTags:e('address,article,aside,body,caption,center,cite,footer,header,html,nav,section'+(t?'':',pre')),
ignoreTags:e('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'+(t?',rp':'')),
richOnlyTags:e('a,colgroup,fieldset,legend,table'+(t?',bdi,bdo,rt,ruby':'')),
selfClosingTags:e('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
trustTags:e('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'+(t?',bdi,bdo,caption,pre,rt,ruby':'')),
userAgentStyles:{address:"font-style:italic",big:"display:inline;font-size:1.2em",blockquote:"background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre;overflow:scroll",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",u:"text-decoration:underline"}
}

+ 2
- 0
components/parser.20200731.min/parser.js View File

@@ -0,0 +1,2 @@
// 小程序富文本插件 https://github.com/jin-yufeng/Parser
var dom;var search;function t(t){for(var e=t.length,i=5381;e--;)i+=(i<<5)+t.charCodeAt(e);return i}var e={},i=require("./libs/MpHtmlParser.js"),n=wx.getFileSystemManager&&wx.getFileSystemManager();Component({options:{pureDataPattern:/^[acdgtu]|W/},data:{nodes:[]},properties:{html:{type:String,observer:function(t){this.setContent(t)}},autopause:{type:Boolean,value:!0},autoscroll:Boolean,autosetTitle:{type:Boolean,value:!0},compress:Number,domain:String,lazyLoad:Boolean,loadingImg:String,selectable:Boolean,tagStyle:Object,showWithAnimation:Boolean,useAnchor:Boolean,useCache:Boolean},relations:{"../parser-group/parser-group":{type:"ancestor"}},created:function(){var t=this;this.imgList=[],this.imgList.setItem=function(t,e){var i=this;if(t&&e){if(0==e.indexOf("http")&&this.includes(e)){for(var s,a="",o=0;(s=e[o])&&("/"!=s||"/"==e[o-1]||"/"==e[o+1]);o++)a+=Math.random()>.5?s.toUpperCase():s;return a+=e.substr(o),this[t]=a}if(this[t]=e,e.includes("data:image")){var r=e.match(/data:image\/(\S+?);(\S+?),(.+)/);if(!r)return;var l=wx.env.USER_DATA_PATH+"/"+Date.now()+"."+r[1];n&&n.writeFile({filePath:l,data:r[3],encoding:r[2],success:function(){return i[t]=l}})}}},this.imgList.each=function(t){for(var e=0,i=this.length;e<i;e++)this.setItem(e,t(this[e],e,this))},dom&&(this.document=new dom(this)),search&&(this.search=function(e){return search(t,e)})},detached:function(){this.imgList.each(function(t){t&&t.includes(wx.env.USER_DATA_PATH)&&n&&n.unlink({filePath:t})}),clearInterval(this._timer)},methods:{in:function(t){t.page&&t.selector&&t.scrollTop&&(this._in=t)},navigateTo:function(t){var e=this;if(!this.data.useAnchor)return t.fail&&t.fail("Anchor is disabled");var i=(this._in?this._in.page:this).createSelectorQuery().select((this._in?this._in.selector:".top")+(t.id?">>>#"+t.id:"")).boundingClientRect();this._in?i.select(this._in.selector).fields({rect:!0,scrollOffset:!0}):i.selectViewport().scrollOffset(),i.exec(function(i){if(!i[0])return e.group?e.group.navigateTo(e.i,t):t.fail&&t.fail("Label not found");var n=i[1].scrollTop+i[0].top-(i[1].top||0)+(t.offset||0);if(e._in){var s={};s[e._in.scrollTop]=n,e._in.page.setData(s)}else wx.pageScrollTo({scrollTop:n});t.success&&t.success()})},getText:function(){for(var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data.nodes,i="",n=0;t=e[n++];)if("text"==t.type)i+=t.text.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");else if("br"==t.type)i+="\n";else{var s="p"==t.name||"div"==t.name||"tr"==t.name||"li"==t.name||"h"==t.name[0]&&t.name[1]>"0"&&t.name[1]<"7";s&&i&&"\n"!=i[i.length-1]&&(i+="\n"),t.children&&(i+=this.getText(t.children)),s&&"\n"!=i[i.length-1]?i+="\n":"td"!=t.name&&"th"!=t.name||(i+="\t")}return i},getVideoContext:function(t){if(!t)return this.videoContexts;for(var e=this.videoContexts.length;e--;)if(this.videoContexts[e].id==t)return this.videoContexts[e]},setContent:function(n,s){var a,o=this,r=new i(n,this.data);if(this.data.useCache){var l=t(n);e[l]?a=e[l]:e[l]=a=r.parse()}else a=r.parse();this.triggerEvent("parse",a);var h={};if(s)for(var c=this.data.nodes.length,d=a.length;d--;)h["nodes["+(c+d)+"]"]=a[d];else h.nodes=a;this.showWithAnimation&&(h.showAm="animation: show .5s"),this.setData(h,function(){o.triggerEvent("load")}),a.title&&this.data.autosetTitle&&wx.setNavigationBarTitle({title:a.title}),this.imgList.length=0,this.videoContexts=[];for(var u,g=this.selectAllComponents(".top,.top>>>._node"),f=0;u=g[f++];){u.top=this;for(var m,p=0;m=u.data.nodes[p++];)if(!m.c)if("img"==m.name)this.imgList.setItem(m.attrs.i,m.attrs.src);else if("video"==m.name||"audio"==m.name){var v;v="video"==m.name?wx.createVideoContext(m.attrs.id,u):u.selectComponent("#"+m.attrs.id),v&&(v.id=m.attrs.id,this.videoContexts.push(v))}}var x;clearInterval(this._timer),this._timer=setInterval(function(){o.createSelectorQuery().select(".top").boundingClientRect(function(t){t&&(o.rect=t,t.height==x&&(o.triggerEvent("ready",t),clearInterval(o._timer)),x=t.height)}).exec()},350)}}})

+ 1
- 0
components/parser.20200731.min/parser.json View File

@@ -0,0 +1 @@
{"component":true,"usingComponents":{"trees":"./trees/trees"}}

+ 1
- 0
components/parser.20200731.min/parser.wxml View File

@@ -0,0 +1 @@
<slot wx:if="{{!nodes.length}}"/><trees class="top"style="{{selectable?'user-select:text;-webkit-user-select:text;':''}}{{showAm}}"lazy-load="{{lazyLoad}}"loading="{{loadingImg}}"nodes="{{nodes}}"/>

+ 1
- 0
components/parser.20200731.min/parser.wxss View File

@@ -0,0 +1 @@
:host{display:block;overflow:scroll;webkit-overflow-scrolling:touch}.top{display:inherit}@keyframes show{0%{opacity:0}100%{opacity:1}}

+ 1
- 0
components/parser.20200731.min/trees/trees.js View File

@@ -0,0 +1 @@
function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var t=require("../libs/config.js").errorImg;Component({data:{canIUse:!!wx.chooseMessageFile,placeholder:"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='225'/>",ctrl:[]},properties:{nodes:Array,lazyLoad:Boolean,loading:String},methods:{play:function(t){if(this.top.group&&this.top.group.pause(this.top.i),this.top.videoContexts.length>1&&this.top.data.autopause)for(var e=this.top.videoContexts.length;e--;)this.top.videoContexts[e].id!=t.currentTarget.id&&this.top.videoContexts[e].pause()},imgtap:function(t){var e=t.currentTarget.dataset.attrs;if(!e.ignore){var r=!0;if(this.top.triggerEvent("imgtap",{id:t.currentTarget.id,src:e.src,ignore:function(){return r=!1}}),r){if(this.top.group)return this.top.group.preview(this.top.i,e.i);var i=this.top.imgList,a=i[e.i]?i[e.i]:(i=[e.src],e.src);wx.previewImage({current:a,urls:i})}}},loadImg:function(t){var e=t.target.dataset.i;this.data.lazyLoad&&!this.data.ctrl[e]?this.setData(_defineProperty({},"ctrl["+e+"]",1)):this.data.loading&&2!=this.data.ctrl[e]&&this.setData(_defineProperty({},"ctrl["+e+"]",2))},linkpress:function(t){var e=!0,r=t.currentTarget.dataset.attrs;r.ignore=function(){return e=!1},this.top.triggerEvent("linkpress",r),e&&(r["app-id"]?wx.navigateToMiniProgram({appId:r["app-id"],path:r.path}):r.href&&("#"==r.href[0]?this.top.navigateTo({id:r.href.substring(1)}):0==r.href.indexOf("http")||0==r.href.indexOf("//")?wx.setClipboardData({data:r.href,success:function(){return wx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:r.href,fail:function(){wx.switchTab({url:r.href})}})))},error:function(e){var r=e.target.dataset.source,i=e.target.dataset.i,a=this.data.nodes[i];if("video"==r||"audio"==r){var s=(a.i||0)+1;if(s<a.attrs.source.length)return this.setData(_defineProperty({},"nodes["+i+"].i",s))}else"img"==r&&t&&(this.top.imgList.setItem(e.target.dataset.index,t),this.setData(_defineProperty({},"nodes["+i+"].attrs.src",t)));this.top&&this.top.triggerEvent("error",{source:r,target:e.target,errMsg:e.detail.errMsg})},loadVideo:function(t){this.setData(_defineProperty({},"nodes["+t.target.dataset.i+"].attrs.autoplay",!0))}}})

+ 1
- 0
components/parser.20200731.min/trees/trees.json View File

@@ -0,0 +1 @@
{"component":true,"usingComponents":{"trees":"./trees"}}

+ 1
- 0
components/parser.20200731.min/trees/trees.wxml View File

@@ -0,0 +1 @@
<wxs module="handler">var s={abbr:1,b:1,big:1,code:1,del:1,em:1,i:1,ins:1,label:1,q:1,small:1,span:1,strong:1,sub:1,sup:1};module.exports={visited:function(s,e){s.instance.hasClass("_visited")||s.instance.addClass("_visited"),e.callMethod("linkpress",s)},use:function(e){return!e.c&&!s[e.name]&&-1==(e.attrs.style||"").indexOf("display:inline")}}</wxs><block wx:for="{{nodes}}" wx:for-item="n" wx:for-index="i" wx:key="i"><view wx:if="{{n.name=='img'}}" id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{n.attrs.style}}" data-attrs="{{n.attrs}}" bindtap="imgtap"><rich-text nodes="{{[{attrs:{src:loading&&ctrl[i]!=2?loading:(lazyLoad&&!ctrl[i]?placeholder:n.attrs.src||''),alt:n.attrs.alt||'',width:n.attrs.width||'',style:'-webkit-touch-callout:none;max-width:100%;display:block'+(n.attrs.height?';height:'+n.attrs.height:'')},name:'img'}]}}"/><image class="_image" src="{{lazyLoad&&!ctrl[i]?placeholder:n.attrs.src}}" lazy-load="{{lazyLoad}}" show-menu-by-longpress="{{!n.attrs.ignore}}" data-i="{{i}}" data-index="{{n.attrs.i}}" data-source="img" bindload="loadImg" binderror="error"/></view><text wx:elif="{{n.type=='text'}}" decode>{{n.text}}</text><text wx:elif="{{n.name=='br'}}">\n</text><view wx:elif="{{n.name=='a'}}" id="{{n.attrs.id}}" class="_a {{n.attrs.class}}" hover-class="_hover" style="{{n.attrs.style}}" data-attrs="{{n.attrs}}" bindtap="{{canIUse?handler.visited:'linkpress'}}"><trees class="_node" nodes="{{n.children}}"/></view><block wx:elif="{{n.name=='video'}}"><view wx:if="{{n.lazyLoad&&!n.attrs.autoplay}}" id="{{n.attrs.id}}" class="_video {{n.attrs.class}}" style="{{n.attrs.style}}" data-i="{{i}}" bindtap="loadVideo"/><video wx:else id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" poster="{{n.attrs.poster}}" src="{{n.attrs.source[n.i||0]}}" unit-id="{{n.attrs['unit-id']}}" data-i="{{i}}" data-source="video" binderror="error" bindplay="play"/></block><audio wx:elif="{{n.name=='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.attrs.source[n.i||0]}}" data-i="{{i}}" data-source="audio" binderror="error" bindplay="play"/><ad wx:elif="{{n.name=='ad'}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" unit-id="{{n.attrs['unit-id']}}" data-source="ad" binderror="error"/><view wx:elif="{{n.name=='li'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}};display:flex"><view wx:if="{{n.type=='ol'}}" class="_ol-bef">{{n.num}}</view><view wx:else class="_ul-bef"><view wx:if="{{n.floor%3==0}}" class="_ul-p1">█</view><view wx:elif="{{n.floor%3==2}}" class="_ul-p2"/><view wx:else class="_ul-p1" style="border-radius:50%">█</view></view><trees class="_node _li" lazyLoad="{{lazyLoad}}" loading="{{loading}}" nodes="{{n.children}}"/></view><rich-text wx:elif="{{handler.use(n)}}" id="{{n.attrs.id}}" class="_p __{{n.name}}" nodes="{{[n]}}"/><trees wx:else id="{{n.attrs.id}}" class="_node _{{n.name}} {{n.attrs.class}}" style="{{n.attrs.style}}" lazyLoad="{{lazyLoad}}" loading="{{loading}}" nodes="{{n.children}}"/></block>

+ 1
- 0
components/parser.20200731.min/trees/trees.wxss View File

@@ -0,0 +1 @@
._a{display:inline;padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._visited{color:#551a8b}._img{display:inline-block;max-width:100%;overflow:hidden}:host{display:inline}._blockquote,._div,._p,._ul,._ol,._li{display:block}._b,._strong{font-weight:bold}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:bold}._image{display:block;width:100%;height:360px;margin-top:-360px;opacity:0}._ins{text-decoration:underline}._li{flex:1;width:0}._ol-bef{width:36px;margin-right:5px;text-align:right}._ul-bef{margin:0 12px 0 23px;line-height:normal}._ol-bef,._ul-bef{flex:none;user-select:none}._ul-p1{display:inline-block;width:.3em;height:.3em;overflow:hidden;line-height:.3em}._ul-p2{display:inline-block;width:.23em;height:.23em;border:.05em solid black;border-radius:50%}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}.__bdi,.__bdo,.__ruby,.__rt{display:inline-block}._video{position:relative;display:inline-block;width:300px;height:225px;background-color:black}._video::after{position:absolute;top:50%;left:50%;margin:-15px 0 0 -15px;content:'';border-color:transparent transparent transparent white;border-style:solid;border-width:15px 0 15px 30px}

+ 6
- 0
config.js View File

@@ -0,0 +1,6 @@
module.exports = {
version: "4.4.0",
note: '自取、外卖,后台可控制开启/关闭',
subDomain: "beeorder", // 根据教程 https://www.it120.cc/help/qr6l4m.html 查看并设置你自己的 subDomain
baiduMapKey: "TJ3BZ-6LVCF-C25JP-JOA3O-EWZFJ-5FBMI", // 百度地图开放平台去申请自己的key,用来计算配送距离
}

BIN
images/ad.png View File

Before After
Width: 200  |  Height: 200  |  Size: 54 KiB

BIN
images/cart.png View File

Before After
Width: 221  |  Height: 200  |  Size: 10 KiB

BIN
images/coupon.png View File

Before After
Width: 600  |  Height: 600  |  Size: 82 KiB

BIN
images/daohang.png View File

Before After
Width: 200  |  Height: 200  |  Size: 14 KiB

BIN
images/default.png View File

Before After
Width: 200  |  Height: 200  |  Size: 10 KiB

BIN
images/empty.png View File

Before After
Width: 200  |  Height: 200  |  Size: 4.7 KiB

BIN
images/friend.png View File

Before After
Width: 200  |  Height: 200  |  Size: 11 KiB

BIN
images/nav/index-off.png View File

Before After
Width: 200  |  Height: 200  |  Size: 8.4 KiB

BIN
images/nav/index-on.png View File

Before After
Width: 200  |  Height: 200  |  Size: 8.5 KiB

BIN
images/nav/my-off.png View File

Before After
Width: 200  |  Height: 200  |  Size: 9.6 KiB

BIN
images/nav/my-on.png View File

Before After
Width: 200  |  Height: 200  |  Size: 9.5 KiB

BIN
images/nav/qc-off.png View File

Before After
Width: 200  |  Height: 200  |  Size: 8.9 KiB

BIN
images/nav/qc-on.png View File

Before After
Width: 200  |  Height: 200  |  Size: 9.0 KiB

BIN
images/nav/qh-off.png View File

Before After
Width: 200  |  Height: 200  |  Size: 12 KiB

BIN
images/nav/qh-on.png View File

Before After
Width: 200  |  Height: 200  |  Size: 12 KiB

BIN
images/pay-pingtuan.png View File

Before After
Width: 200  |  Height: 200  |  Size: 36 KiB

BIN
images/pay.png View File

Before After
Width: 1082  |  Height: 1082  |  Size: 505 KiB

BIN
images/quhuo.png View File

Before After
Width: 200  |  Height: 200  |  Size: 11 KiB

BIN
images/tel.png View File

Before After
Width: 200  |  Height: 200  |  Size: 54 KiB

BIN
images/tuikuan.png View File

Before After
Width: 200  |  Height: 200  |  Size: 61 KiB

BIN
images/who.png View File

Before After
Width: 600  |  Height: 600  |  Size: 40 KiB

BIN
images/ziqu.png View File

Before After
Width: 200  |  Height: 200  |  Size: 36 KiB

BIN
images/zw.png View File

Before After
Width: 200  |  Height: 200  |  Size: 68 KiB

+ 76
- 0
miniprogram_npm/@vant/weapp/action-sheet/index.js View File

@@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../common/component');
var button_1 = require('../mixins/button');
component_1.VantComponent({
mixins: [button_1.button],
props: {
show: Boolean,
title: String,
cancelText: String,
description: String,
round: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 100,
},
actions: {
type: Array,
value: [],
},
overlay: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
closeOnClickAction: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
},
methods: {
onSelect: function (event) {
var _this = this;
var index = event.currentTarget.dataset.index;
var _a = this.data,
actions = _a.actions,
closeOnClickAction = _a.closeOnClickAction,
canIUseGetUserProfile = _a.canIUseGetUserProfile;
var item = actions[index];
if (item) {
this.$emit('select', item);
if (closeOnClickAction) {
this.onClose();
}
if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({
desc: item.getUserProfileDesc || ' ',
complete: function (userProfile) {
_this.$emit('getuserinfo', userProfile);
},
});
}
}
},
onCancel: function () {
this.$emit('cancel');
},
onClose: function () {
this.$emit('close');
},
onClickOverlay: function () {
this.$emit('click-overlay');
this.onClose();
},
},
});

+ 8
- 0
miniprogram_npm/@vant/weapp/action-sheet/index.json View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-popup": "../popup/index",
"van-loading": "../loading/index"
}
}

+ 69
- 0
miniprogram_npm/@vant/weapp/action-sheet/index.wxml View File

@@ -0,0 +1,69 @@
<wxs src="../wxs/utils.wxs" module="utils" />

<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">
{{ title }}
<van-icon
name="cross"
custom-class="van-action-sheet__close"
bind:click="onClose"
/>
</view>
<view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom">
{{ description }}
</view>
<view wx:if="{{ actions && actions.length }}">
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
<button
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"
bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}"
bindgetuserinfo="onGetUserInfo"
bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber"
binderror="onError"
bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting"
lang="{{ lang }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}"
>
<block wx:if="{{ !item.loading }}">
{{ item.name }}
<view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view>
</block>
<van-loading wx:else custom-class="van-action-sheet__loading" size="22px" />
</button>
</view>
<slot />
<block wx:if="{{ cancelText }}">
<view class="van-action-sheet__gap" />
<view
class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70"
bind:tap="onCancel"
>
{{ cancelText }}
</view>
</block>
</van-popup>

+ 1
- 0
miniprogram_npm/@vant/weapp/action-sheet/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{padding:14px 16px;text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:22px;line-height:var(--action-sheet-item-line-height,22px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:#646566;color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{display:block;height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-top:8px;margin-top:var(--padding-xs,8px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#969799;color:var(--action-sheet-subname-color,#969799);line-height:20px;line-height:var(--action-sheet-subname-line-height,20px)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:48px;line-height:var(--action-sheet-header-height,48px)}.van-action-sheet__description{text-align:center;padding:20px 16px;padding:20px var(--padding-md,16px);color:#969799;color:var(--action-sheet-description-color,#969799);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 16px;padding:var(--action-sheet-close-icon-padding,0 16px);font-size:22px!important;font-size:var(--action-sheet-close-icon-size,22px)!important;color:#c8c9cc;color:var(--action-sheet-close-icon-color,#c8c9cc)}.van-action-sheet__loading{display:-webkit-flex!important;display:flex!important}

+ 266
- 0
miniprogram_npm/@vant/weapp/area/index.js View File

@@ -0,0 +1,266 @@
'use strict';
var __assign =
(this && this.__assign) ||
function () {
__assign =
Object.assign ||
function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../common/component');
var shared_1 = require('../picker/shared');
var utils_1 = require('../common/utils');
var EMPTY_CODE = '000000';
component_1.VantComponent({
classes: ['active-class', 'toolbar-class', 'column-class'],
props: __assign(__assign({}, shared_1.pickerProps), {
value: {
type: String,
observer: function (value) {
this.code = value;
this.setValues();
},
},
areaList: {
type: Object,
value: {},
observer: 'setValues',
},
columnsNum: {
type: null,
value: 3,
},
columnsPlaceholder: {
type: Array,
observer: function (val) {
this.setData({
typeToColumnsPlaceholder: {
province: val[0] || '',
city: val[1] || '',
county: val[2] || '',
},
});
},
},
}),
data: {
columns: [{ values: [] }, { values: [] }, { values: [] }],
typeToColumnsPlaceholder: {},
},
mounted: function () {
var _this = this;
utils_1.requestAnimationFrame(function () {
_this.setValues();
});
},
methods: {
getPicker: function () {
if (this.picker == null) {
this.picker = this.selectComponent('.van-area__picker');
}
return this.picker;
},
onCancel: function (event) {
this.emit('cancel', event.detail);
},
onConfirm: function (event) {
var index = event.detail.index;
var value = event.detail.value;
value = this.parseValues(value);
this.emit('confirm', { value: value, index: index });
},
emit: function (type, detail) {
detail.values = detail.value;
delete detail.value;
this.$emit(type, detail);
},
parseValues: function (values) {
var columnsPlaceholder = this.data.columnsPlaceholder;
return values.map(function (value, index) {
if (
value &&
(!value.code || value.name === columnsPlaceholder[index])
) {
return __assign(__assign({}, value), { code: '', name: '' });
}
return value;
});
},
onChange: function (event) {
var _this = this;
var _a;
var _b = event.detail,
index = _b.index,
picker = _b.picker,
value = _b.value;
this.code = value[index].code;
(_a = this.setValues()) === null || _a === void 0
? void 0
: _a.then(function () {
_this.$emit('change', {
picker: picker,
values: _this.parseValues(picker.getValues()),
index: index,
});
});
},
getConfig: function (type) {
var areaList = this.data.areaList;
return (areaList && areaList[type + '_list']) || {};
},
getList: function (type, code) {
if (type !== 'province' && !code) {
return [];
}
var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder;
var list = this.getConfig(type);
var result = Object.keys(list).map(function (code) {
return {
code: code,
name: list[code],
};
});
if (code != null) {
// oversea code
if (code[0] === '9' && type === 'city') {
code = '9';
}
result = result.filter(function (item) {
return item.code.indexOf(code) === 0;
});
}
if (typeToColumnsPlaceholder[type] && result.length) {
// set columns placeholder
var codeFill =
type === 'province'
? ''
: type === 'city'
? EMPTY_CODE.slice(2, 4)
: EMPTY_CODE.slice(4, 6);
result.unshift({
code: '' + code + codeFill,
name: typeToColumnsPlaceholder[type],
});
}
return result;
},
getIndex: function (type, code) {
var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
var list = this.getList(type, code.slice(0, compareNum - 2));
// oversea code
if (code[0] === '9' && type === 'province') {
compareNum = 1;
}
code = code.slice(0, compareNum);
for (var i = 0; i < list.length; i++) {
if (list[i].code.slice(0, compareNum) === code) {
return i;
}
}
return 0;
},
setValues: function () {
var picker = this.getPicker();
if (!picker) {
return;
}
var code = this.code || this.getDefaultCode();
var provinceList = this.getList('province');
var cityList = this.getList('city', code.slice(0, 2));
var stack = [];
var indexes = [];
var columnsNum = this.data.columnsNum;
if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, provinceList, false));
indexes.push(this.getIndex('province', code));
}
if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, cityList, false));
indexes.push(this.getIndex('city', code));
if (cityList.length && code.slice(2, 4) === '00') {
code = cityList[0].code;
}
}
if (columnsNum === 3) {
stack.push(
picker.setColumnValues(
2,
this.getList('county', code.slice(0, 4)),
false
)
);
indexes.push(this.getIndex('county', code));
}
return Promise.all(stack)
.catch(function () {})
.then(function () {
return picker.setIndexes(indexes);
})
.catch(function () {});
},
getDefaultCode: function () {
var columnsPlaceholder = this.data.columnsPlaceholder;
if (columnsPlaceholder.length) {
return EMPTY_CODE;
}
var countyCodes = Object.keys(this.getConfig('county'));
if (countyCodes[0]) {
return countyCodes[0];
}
var cityCodes = Object.keys(this.getConfig('city'));
if (cityCodes[0]) {
return cityCodes[0];
}
return '';
},
getValues: function () {
var picker = this.getPicker();
if (!picker) {
return [];
}
return this.parseValues(
picker.getValues().filter(function (value) {
return !!value;
})
);
},
getDetail: function () {
var values = this.getValues();
var area = {
code: '',
country: '',
province: '',
city: '',
county: '',
};
if (!values.length) {
return area;
}
var names = values.map(function (item) {
return item.name;
});
area.code = values[values.length - 1].code;
if (area.code[0] === '9') {
area.country = names[1] || '';
area.province = names[2] || '';
} else {
area.province = names[0] || '';
area.city = names[1] || '';
area.county = names[2] || '';
}
return area;
},
reset: function (code) {
this.code = code || '';
return this.setValues();
},
},
});

+ 6
- 0
miniprogram_npm/@vant/weapp/area/index.json View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-picker": "../picker/index"
}
}

+ 20
- 0
miniprogram_npm/@vant/weapp/area/index.wxml View File

@@ -0,0 +1,20 @@
<wxs src="./index.wxs" module="computed" />

<van-picker
class="van-area__picker"
active-class="active-class"
toolbar-class="toolbar-class"
column-class="column-class"
show-toolbar
value-key="name"
title="{{ title }}"
loading="{{ loading }}"
columns="{{ computed.displayColumns(columns, columnsNum) }}"
item-height="{{ itemHeight }}"
visible-item-count="{{ visibleItemCount }}"
cancel-button-text="{{ cancelButtonText }}"
confirm-button-text="{{ confirmButtonText }}"
bind:change="onChange"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>

+ 8
- 0
miniprogram_npm/@vant/weapp/area/index.wxs View File

@@ -0,0 +1,8 @@
/* eslint-disable */
function displayColumns(columns, columnsNum) {
return columns.slice(0, +columnsNum);
}

module.exports = {
displayColumns: displayColumns,
};

+ 1
- 0
miniprogram_npm/@vant/weapp/area/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';

+ 69
- 0
miniprogram_npm/@vant/weapp/button/index.js View File

@@ -0,0 +1,69 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../common/component');
var button_1 = require('../mixins/button');
var version_1 = require('../common/version');
var mixins = [button_1.button];
if (version_1.canIUseFormFieldButton()) {
mixins.push('wx://form-field-button');
}
component_1.VantComponent({
mixins: mixins,
classes: ['hover-class', 'loading-class'],
data: {
baseStyle: '',
},
props: {
formType: String,
icon: String,
classPrefix: {
type: String,
value: 'van-icon',
},
plain: Boolean,
block: Boolean,
round: Boolean,
square: Boolean,
loading: Boolean,
hairline: Boolean,
disabled: Boolean,
loadingText: String,
customStyle: String,
loadingType: {
type: String,
value: 'circular',
},
type: {
type: String,
value: 'default',
},
dataset: null,
size: {
type: String,
value: 'normal',
},
loadingSize: {
type: String,
value: '20px',
},
color: String,
},
methods: {
onClick: function (event) {
var _this = this;
this.$emit('click', event);
var _a = this.data,
canIUseGetUserProfile = _a.canIUseGetUserProfile,
openType = _a.openType,
getUserProfileDesc = _a.getUserProfileDesc;
if (openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({
desc: getUserProfileDesc || ' ',
complete: function (userProfile) {
_this.$emit('getuserinfo', userProfile);
},
});
}
},
},
});

+ 7
- 0
miniprogram_npm/@vant/weapp/button/index.json View File

@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index"
}
}

+ 53
- 0
miniprogram_npm/@vant/weapp/button/index.wxml View File

@@ -0,0 +1,53 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />

<button
id="{{ id }}"
data-detail="{{ dataset }}"
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
hover-class="van-button--active hover-class"
lang="{{ lang }}"
form-type="{{ formType }}"
style="{{ computed.rootStyle({ plain, color, customStyle }) }}"
open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}"
aria-label="{{ ariaLabel }}"
bindtap="{{ disabled || loading ? '' : 'onClick' }}"
bindgetuserinfo="onGetUserInfo"
bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber"
binderror="onError"
bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting"
>
<block wx:if="{{ loading }}">
<van-loading
custom-class="loading-class"
size="{{ loadingSize }}"
type="{{ loadingType }}"
color="{{ computed.loadingColor({ type, color, plain }) }}"
/>
<view wx:if="{{ loadingText }}" class="van-button__loading-text">
{{ loadingText }}
</view>
</block>
<block wx:else>
<van-icon
wx:if="{{ icon }}"
size="1.2em"
name="{{ icon }}"
class-prefix="{{ classPrefix }}"
class="van-button__icon"
custom-style="line-height: inherit;"
/>
<view class="van-button__text">
<slot />
</view>
</block>
</button>

+ 39
- 0
miniprogram_npm/@vant/weapp/button/index.wxs View File

@@ -0,0 +1,39 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');

function rootStyle(data) {
if (!data.color) {
return data.customStyle;
}

var properties = {
color: data.plain ? data.color : '#fff',
background: data.plain ? null : data.color,
};

// hide border when color is linear-gradient
if (data.color.indexOf('gradient') !== -1) {
properties.border = 0;
} else {
properties['border-color'] = data.color;
}

return style([properties, data.customStyle]);
}

function loadingColor(data) {
if (data.plain) {
return data.color ? data.color : '#c9c9c9';
}

if (data.type === 'default') {
return '#c9c9c9';
}

return '#fff';
}

module.exports = {
rootStyle: rootStyle,
loadingColor: loadingColor,
};

+ 1
- 0
miniprogram_npm/@vant/weapp/button/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}

+ 67
- 0
miniprogram_npm/@vant/weapp/calendar/calendar.wxml View File

@@ -0,0 +1,67 @@
<view class="van-calendar">
<header
title="{{ title }}"
showTitle="{{ showTitle }}"
subtitle="{{ subtitle }}"
showSubtitle="{{ showSubtitle }}"
firstDayOfWeek="{{ firstDayOfWeek }}"
>
<slot name="title" slot="title"></slot>
</header>

<scroll-view
class="van-calendar__body"
scroll-y
scroll-into-view="{{ scrollIntoView }}"
>
<month
wx:for="{{ computed.getMonths(minDate, maxDate) }}"
wx:key="index"
id="month{{ index }}"
class="month"
data-date="{{ item }}"
date="{{ item }}"
type="{{ type }}"
color="{{ color }}"
minDate="{{ minDate }}"
maxDate="{{ maxDate }}"
showMark="{{ showMark }}"
formatter="{{ formatter }}"
rowHeight="{{ rowHeight }}"
currentDate="{{ currentDate }}"
showSubtitle="{{ showSubtitle }}"
allowSameDay="{{ allowSameDay }}"
showMonthTitle="{{ index !== 0 || !showSubtitle }}"
firstDayOfWeek="{{ firstDayOfWeek }}"
bind:click="onClickDay"
/>
</scroll-view>

<view
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
>
<slot name="footer"></slot>
</view>

<view
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
>
<van-button
wx:if="{{ showConfirm }}"
round
block
type="danger"
color="{{ color }}"
custom-class="van-calendar__confirm"
disabled="{{ computed.getButtonDisabled(type, currentDate) }}"
nativeType="text"
bind:click="onConfirm"
>
{{
computed.getButtonDisabled(type, currentDate)
? confirmDisabledText
: confirmText
}}
</van-button>
</view>
</view>

+ 43
- 0
miniprogram_npm/@vant/weapp/calendar/components/header/index.js View File

@@ -0,0 +1,43 @@
'use strict';
var __spreadArray =
(this && this.__spreadArray) ||
function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../../../common/component');
component_1.VantComponent({
props: {
title: {
type: String,
value: '日期选择',
},
subtitle: String,
showTitle: Boolean,
showSubtitle: Boolean,
firstDayOfWeek: {
type: Number,
observer: 'initWeekDay',
},
},
data: {
weekdays: [],
},
created: function () {
this.initWeekDay();
},
methods: {
initWeekDay: function () {
var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六'];
var firstDayOfWeek = this.data.firstDayOfWeek || 0;
this.setData({
weekdays: __spreadArray(
__spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7)),
defaultWeeks.slice(0, firstDayOfWeek)
),
});
},
},
});

+ 3
- 0
miniprogram_npm/@vant/weapp/calendar/components/header/index.json View File

@@ -0,0 +1,3 @@
{
"component": true
}

+ 16
- 0
miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml View File

@@ -0,0 +1,16 @@
<view class="van-calendar__header">
<block wx:if="{{ showTitle }}">
<view class="van-calendar__header-title"><slot name="title"></slot></view>
<view class="van-calendar__header-title">{{ title }}</view>
</block>

<view wx:if="{{ showSubtitle }}" class="van-calendar__header-subtitle">
{{ subtitle }}
</view>

<view class="van-calendar__weekdays">
<view wx:for="{{ weekdays }}" wx:key="index" class="van-calendar__weekday">
{{ item }}
</view>
</view>
</view>

+ 1
- 0
miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss View File

@@ -0,0 +1 @@
@import '../../../common/index.wxss';.van-calendar__header{-webkit-flex-shrink:0;flex-shrink:0;box-shadow:0 2px 10px rgba(125,126,128,.16);box-shadow:var(--calendar-header-box-shadow,0 2px 10px rgba(125,126,128,.16))}.van-calendar__header-subtitle,.van-calendar__header-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:-webkit-flex;display:flex}.van-calendar__weekday{-webkit-flex:1;flex:1;text-align:center;font-size:12px;font-size:var(--calendar-weekdays-font-size,12px);line-height:30px;line-height:var(--calendar-weekdays-height,30px)}

+ 173
- 0
miniprogram_npm/@vant/weapp/calendar/components/month/index.js View File

@@ -0,0 +1,173 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../../../common/component');
var utils_1 = require('../../utils');
component_1.VantComponent({
props: {
date: {
type: null,
observer: 'setDays',
},
type: {
type: String,
observer: 'setDays',
},
color: String,
minDate: {
type: null,
observer: 'setDays',
},
maxDate: {
type: null,
observer: 'setDays',
},
showMark: Boolean,
rowHeight: null,
formatter: {
type: null,
observer: 'setDays',
},
currentDate: {
type: null,
observer: 'setDays',
},
firstDayOfWeek: {
type: Number,
observer: 'setDays',
},
allowSameDay: Boolean,
showSubtitle: Boolean,
showMonthTitle: Boolean,
},
data: {
visible: true,
days: [],
},
methods: {
onClick: function (event) {
var index = event.currentTarget.dataset.index;
var item = this.data.days[index];
if (item.type !== 'disabled') {
this.$emit('click', item);
}
},
setDays: function () {
var days = [];
var startDate = new Date(this.data.date);
var year = startDate.getFullYear();
var month = startDate.getMonth();
var totalDay = utils_1.getMonthEndDay(
startDate.getFullYear(),
startDate.getMonth() + 1
);
for (var day = 1; day <= totalDay; day++) {
var date = new Date(year, month, day);
var type = this.getDayType(date);
var config = {
date: date,
type: type,
text: day,
bottomInfo: this.getBottomInfo(type),
};
if (this.data.formatter) {
config = this.data.formatter(config);
}
days.push(config);
}
this.setData({ days: days });
},
getMultipleDayType: function (day) {
var currentDate = this.data.currentDate;
if (!Array.isArray(currentDate)) {
return '';
}
var isSelected = function (date) {
return currentDate.some(function (item) {
return utils_1.compareDay(item, date) === 0;
});
};
if (isSelected(day)) {
var prevDay = utils_1.getPrevDay(day);
var nextDay = utils_1.getNextDay(day);
var prevSelected = isSelected(prevDay);
var nextSelected = isSelected(nextDay);
if (prevSelected && nextSelected) {
return 'multiple-middle';
}
if (prevSelected) {
return 'end';
}
return nextSelected ? 'start' : 'multiple-selected';
}
return '';
},
getRangeDayType: function (day) {
var _a = this.data,
currentDate = _a.currentDate,
allowSameDay = _a.allowSameDay;
if (!Array.isArray(currentDate)) {
return '';
}
var startDay = currentDate[0],
endDay = currentDate[1];
if (!startDay) {
return '';
}
var compareToStart = utils_1.compareDay(day, startDay);
if (!endDay) {
return compareToStart === 0 ? 'start' : '';
}
var compareToEnd = utils_1.compareDay(day, endDay);
if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) {
return 'start-end';
}
if (compareToStart === 0) {
return 'start';
}
if (compareToEnd === 0) {
return 'end';
}
if (compareToStart > 0 && compareToEnd < 0) {
return 'middle';
}
return '';
},
getDayType: function (day) {
var _a = this.data,
type = _a.type,
minDate = _a.minDate,
maxDate = _a.maxDate,
currentDate = _a.currentDate;
if (
utils_1.compareDay(day, minDate) < 0 ||
utils_1.compareDay(day, maxDate) > 0
) {
return 'disabled';
}
if (type === 'single') {
return utils_1.compareDay(day, currentDate) === 0 ? 'selected' : '';
}
if (type === 'multiple') {
return this.getMultipleDayType(day);
}
/* istanbul ignore else */
if (type === 'range') {
return this.getRangeDayType(day);
}
return '';
},
getBottomInfo: function (type) {
if (this.data.type === 'range') {
if (type === 'start') {
return '开始';
}
if (type === 'end') {
return '结束';
}
if (type === 'start-end') {
return '开始/结束';
}
}
},
},
});

+ 3
- 0
miniprogram_npm/@vant/weapp/calendar/components/month/index.json View File

@@ -0,0 +1,3 @@
{
"component": true
}

+ 39
- 0
miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml View File

@@ -0,0 +1,39 @@
<wxs src="./index.wxs" module="computed"></wxs>
<wxs src="../../../wxs/utils.wxs" module="utils" />

<view class="van-calendar__month" style="{{ computed.getMonthStyle(visible, date, rowHeight) }}">
<view wx:if="{{ showMonthTitle }}" class="van-calendar__month-title">
{{ computed.formatMonthTitle(date) }}
</view>

<view wx:if="{{ visible }}" class="van-calendar__days">
<view wx:if="{{ showMark }}" class="van-calendar__month-mark">
{{ computed.getMark(date) }}
</view>

<view
wx:for="{{ days }}"
wx:key="index"
style="{{ computed.getDayStyle(item.type, index, date, rowHeight, color, firstDayOfWeek) }}"
class="{{ utils.bem('calendar__day', [item.type]) }} {{ item.className }}"
data-index="{{ index }}"
bindtap="onClick"
>
<view wx:if="{{ item.type === 'selected' }}" class="van-calendar__selected-day" style="background: {{ color }}">
<view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view>
{{ item.text }}
<view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info">
{{ item.bottomInfo }}
</view>
</view>

<view wx:else>
<view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view>
{{ item.text }}
<view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info">
{{ item.bottomInfo }}
</view>
</view>
</view>
</view>
</view>

+ 71
- 0
miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs View File

@@ -0,0 +1,71 @@
/* eslint-disable */
var utils = require('../../utils.wxs');

function getMark(date) {
return getDate(date).getMonth() + 1;
}

var ROW_HEIGHT = 64;

function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
var style = [];
var current = getDate(date).getDay() || 7;
var offset = current < firstDayOfWeek ? (7 - firstDayOfWeek + current) :
current === 7 && firstDayOfWeek === 0 ? 0 :
(current - firstDayOfWeek);

if (index === 0) {
style.push(['margin-left', (100 * offset) / 7 + '%']);
}

if (rowHeight !== ROW_HEIGHT) {
style.push(['height', rowHeight + 'px']);
}

if (color) {
if (
type === 'start' ||
type === 'end' ||
type === 'start-end' ||
type === 'multiple-selected' ||
type === 'multiple-middle'
) {
style.push(['background', color]);
} else if (type === 'middle') {
style.push(['color', color]);
}
}

return style
.map(function(item) {
return item.join(':');
})
.join(';');
}

function formatMonthTitle(date) {
date = getDate(date);
return date.getFullYear() + '年' + (date.getMonth() + 1) + '月';
}

function getMonthStyle(visible, date, rowHeight) {
if (!visible) {
date = getDate(date);

var totalDay = utils.getMonthEndDay(
date.getFullYear(),
date.getMonth() + 1
);
var offset = getDate(date).getDay();
var padding = Math.ceil((totalDay + offset) / 7) * rowHeight;

return 'padding-bottom:' + padding + 'px';
}
}

module.exports = {
getMark: getMark,
getDayStyle: getDayStyle,
formatMonthTitle: formatMonthTitle,
getMonthStyle: getMonthStyle
};

+ 1
- 0
miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss View File

@@ -0,0 +1 @@
@import '../../../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__month-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:14px;font-size:var(--calendar-month-title-font-size,14px);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__days{position:relative;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none;color:rgba(242,243,245,.8);color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:160px;font-size:var(--calendar-month-mark-font-size,160px)}.van-calendar__day,.van-calendar__selected-day{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;text-align:center}.van-calendar__day{position:relative;width:14.285%;height:64px;height:var(--calendar-day-height,64px);font-size:16px;font-size:var(--calendar-day-font-size,16px)}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{color:#fff;color:var(--calendar-range-edge-color,#fff);background-color:#ee0a24;background-color:var(--calendar-range-edge-background-color,#ee0a24)}.van-calendar__day--start{border-radius:4px 0 0 4px;border-radius:var(--border-radius-md,4px) 0 0 var(--border-radius-md,4px)}.van-calendar__day--end{border-radius:0 4px 4px 0;border-radius:0 var(--border-radius-md,4px) var(--border-radius-md,4px) 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px;border-radius:var(--border-radius-md,4px)}.van-calendar__day--middle{color:#ee0a24;color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{position:absolute;top:0;right:0;bottom:0;left:0;background-color:currentColor;content:"";opacity:.1;opacity:var(--calendar-range-middle-background-opacity,.1)}.van-calendar__day--disabled{cursor:default;color:#c8c9cc;color:var(--calendar-day-disabled-color,#c8c9cc)}.van-calendar__bottom-info,.van-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;font-size:var(--calendar-info-font-size,10px);line-height:14px;line-height:var(--calendar-info-line-height,14px)}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{width:54px;width:var(--calendar-selected-day-size,54px);height:54px;height:var(--calendar-selected-day-size,54px);color:#fff;color:var(--calendar-selected-day-color,#fff);background-color:#ee0a24;background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;border-radius:var(--border-radius-md,4px)}

+ 335
- 0
miniprogram_npm/@vant/weapp/calendar/index.js View File

@@ -0,0 +1,335 @@
'use strict';
var __spreadArray =
(this && this.__spreadArray) ||
function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../common/component');
var utils_1 = require('./utils');
var toast_1 = __importDefault(require('../toast/toast'));
var utils_2 = require('../common/utils');
component_1.VantComponent({
props: {
title: {
type: String,
value: '日期选择',
},
color: String,
show: {
type: Boolean,
observer: function (val) {
if (val) {
this.initRect();
this.scrollIntoView();
}
},
},
formatter: null,
confirmText: {
type: String,
value: '确定',
},
rangePrompt: String,
showRangePrompt: {
type: Boolean,
value: true,
},
defaultDate: {
type: null,
observer: function (val) {
this.setData({ currentDate: val });
this.scrollIntoView();
},
},
allowSameDay: Boolean,
confirmDisabledText: String,
type: {
type: String,
value: 'single',
observer: 'reset',
},
minDate: {
type: null,
value: Date.now(),
},
maxDate: {
type: null,
value: new Date(
new Date().getFullYear(),
new Date().getMonth() + 6,
new Date().getDate()
).getTime(),
},
position: {
type: String,
value: 'bottom',
},
rowHeight: {
type: null,
value: utils_1.ROW_HEIGHT,
},
round: {
type: Boolean,
value: true,
},
poppable: {
type: Boolean,
value: true,
},
showMark: {
type: Boolean,
value: true,
},
showTitle: {
type: Boolean,
value: true,
},
showConfirm: {
type: Boolean,
value: true,
},
showSubtitle: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
maxRange: {
type: null,
value: null,
},
firstDayOfWeek: {
type: Number,
value: 0,
},
},
data: {
subtitle: '',
currentDate: null,
scrollIntoView: '',
},
created: function () {
this.setData({
currentDate: this.getInitialDate(),
});
},
mounted: function () {
if (this.data.show || !this.data.poppable) {
this.initRect();
this.scrollIntoView();
}
},
methods: {
reset: function () {
this.setData({ currentDate: this.getInitialDate() });
this.scrollIntoView();
},
initRect: function () {
var _this = this;
if (this.contentObserver != null) {
this.contentObserver.disconnect();
}
var contentObserver = this.createIntersectionObserver({
thresholds: [0, 0.1, 0.9, 1],
observeAll: true,
});
this.contentObserver = contentObserver;
contentObserver.relativeTo('.van-calendar__body');
contentObserver.observe('.month', function (res) {
if (res.boundingClientRect.top <= res.relativeRect.top) {
// @ts-ignore
_this.setData({
subtitle: utils_1.formatMonthTitle(res.dataset.date),
});
}
});
},
getInitialDate: function () {
var _a = this.data,
type = _a.type,
defaultDate = _a.defaultDate,
minDate = _a.minDate;
if (type === 'range') {
var _b = defaultDate || [],
startDay = _b[0],
endDay = _b[1];
return [
startDay || minDate,
endDay || utils_1.getNextDay(new Date(minDate)).getTime(),
];
}
if (type === 'multiple') {
return defaultDate || [minDate];
}
return defaultDate || minDate;
},
scrollIntoView: function () {
var _this = this;
utils_2.requestAnimationFrame(function () {
var _a = _this.data,
currentDate = _a.currentDate,
type = _a.type,
show = _a.show,
poppable = _a.poppable,
minDate = _a.minDate,
maxDate = _a.maxDate;
// @ts-ignore
var targetDate = type === 'single' ? currentDate : currentDate[0];
var displayed = show || !poppable;
if (!targetDate || !displayed) {
return;
}
var months = utils_1.getMonths(minDate, maxDate);
months.some(function (month, index) {
if (utils_1.compareMonth(month, targetDate) === 0) {
_this.setData({ scrollIntoView: 'month' + index });
return true;
}
return false;
});
});
},
onOpen: function () {
this.$emit('open');
},
onOpened: function () {
this.$emit('opened');
},
onClose: function () {
this.$emit('close');
},
onClosed: function () {
this.$emit('closed');
},
onClickDay: function (event) {
var date = event.detail.date;
var _a = this.data,
type = _a.type,
currentDate = _a.currentDate,
allowSameDay = _a.allowSameDay;
if (type === 'range') {
// @ts-ignore
var startDay = currentDate[0],
endDay = currentDate[1];
if (startDay && !endDay) {
var compareToStart = utils_1.compareDay(date, startDay);
if (compareToStart === 1) {
this.select([startDay, date], true);
} else if (compareToStart === -1) {
this.select([date, null]);
} else if (allowSameDay) {
this.select([date, date]);
}
} else {
this.select([date, null]);
}
} else if (type === 'multiple') {
var selectedIndex_1;
// @ts-ignore
var selected = currentDate.some(function (dateItem, index) {
var equal = utils_1.compareDay(dateItem, date) === 0;
if (equal) {
selectedIndex_1 = index;
}
return equal;
});
if (selected) {
// @ts-ignore
var cancelDate = currentDate.splice(selectedIndex_1, 1);
this.setData({ currentDate: currentDate });
this.unselect(cancelDate);
} else {
// @ts-ignore
this.select(__spreadArray(__spreadArray([], currentDate), [date]));
}
} else {
this.select(date, true);
}
},
unselect: function (dateArray) {
var date = dateArray[0];
if (date) {
this.$emit('unselect', utils_1.copyDates(date));
}
},
select: function (date, complete) {
if (complete && this.data.type === 'range') {
var valid = this.checkRange(date);
if (!valid) {
// auto selected to max range if showConfirm
if (this.data.showConfirm) {
this.emit([
date[0],
utils_1.getDayByOffset(date[0], this.data.maxRange - 1),
]);
} else {
this.emit(date);
}
return;
}
}
this.emit(date);
if (complete && !this.data.showConfirm) {
this.onConfirm();
}
},
emit: function (date) {
var getTime = function (date) {
return date instanceof Date ? date.getTime() : date;
};
this.setData({
currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date),
});
this.$emit('select', utils_1.copyDates(date));
},
checkRange: function (date) {
var _a = this.data,
maxRange = _a.maxRange,
rangePrompt = _a.rangePrompt,
showRangePrompt = _a.showRangePrompt;
if (maxRange && utils_1.calcDateNum(date) > maxRange) {
if (showRangePrompt) {
toast_1.default({
duration: 0,
context: this,
message:
rangePrompt ||
'\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ' +
maxRange +
' \u5929',
});
}
this.$emit('over-range');
return false;
}
return true;
},
onConfirm: function () {
var _this = this;
if (
this.data.type === 'range' &&
!this.checkRange(this.data.currentDate)
) {
return;
}
wx.nextTick(function () {
// @ts-ignore
_this.$emit('confirm', utils_1.copyDates(_this.data.currentDate));
});
},
},
});

+ 10
- 0
miniprogram_npm/@vant/weapp/calendar/index.json View File

@@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"header": "./components/header/index",
"month": "./components/month/index",
"van-button": "../button/index",
"van-popup": "../popup/index",
"van-toast": "../toast/index"
}
}

+ 25
- 0
miniprogram_npm/@vant/weapp/calendar/index.wxml View File

@@ -0,0 +1,25 @@
<wxs src="./index.wxs" module="computed" />
<wxs src="../wxs/utils.wxs" module="utils" />

<import src="./calendar.wxml" />

<van-popup
wx:if="{{ poppable }}"
custom-class="van-calendar__popup--{{ position }}"
close-icon-class="van-calendar__close-icon"
show="{{ show }}"
round="{{ round }}"
position="{{ position }}"
closeable="{{ showTitle || showSubtitle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:enter="onOpen"
bind:close="onClose"
bind:after-enter="onOpened"
bind:after-leave="onClosed"
>
<include src="calendar.wxml" />
</van-popup>

<include wx:else src="calendar.wxml" />

<van-toast id="van-toast" />

+ 37
- 0
miniprogram_npm/@vant/weapp/calendar/index.wxs View File

@@ -0,0 +1,37 @@
/* eslint-disable */
var utils = require('./utils.wxs');

function getMonths(minDate, maxDate) {
var months = [];
var cursor = getDate(minDate);

cursor.setDate(1);

do {
months.push(cursor.getTime());
cursor.setMonth(cursor.getMonth() + 1);
} while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);

return months;
}

function getButtonDisabled(type, currentDate) {
if (currentDate == null) {
return true;
}

if (type === 'range') {
return !currentDate[0] || !currentDate[1];
}

if (type === 'multiple') {
return !currentDate.length;
}

return !currentDate;
}

module.exports = {
getMonths: getMonths,
getButtonDisabled: getButtonDisabled
};

+ 1
- 0
miniprogram_npm/@vant/weapp/calendar/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;height:var(--calendar-height,100%);background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:80%;height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-flex:1;flex:1;overflow:auto;-webkit-overflow-scrolling:touch}.van-calendar__footer{-webkit-flex-shrink:0;flex-shrink:0;padding:0 16px;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:36px!important;height:var(--calendar-confirm-button-height,36px)!important;margin:7px 0!important;margin:var(--calendar-confirm-button-margin,7px 0)!important;line-height:34px!important;line-height:var(--calendar-confirm-button-line-height,34px)!important}

+ 91
- 0
miniprogram_npm/@vant/weapp/calendar/utils.js View File

@@ -0,0 +1,91 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
exports.ROW_HEIGHT = 64;
function formatMonthTitle(date) {
if (!(date instanceof Date)) {
date = new Date(date);
}
return date.getFullYear() + '\u5E74' + (date.getMonth() + 1) + '\u6708';
}
exports.formatMonthTitle = formatMonthTitle;
function compareMonth(date1, date2) {
if (!(date1 instanceof Date)) {
date1 = new Date(date1);
}
if (!(date2 instanceof Date)) {
date2 = new Date(date2);
}
var year1 = date1.getFullYear();
var year2 = date2.getFullYear();
var month1 = date1.getMonth();
var month2 = date2.getMonth();
if (year1 === year2) {
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
}
return year1 > year2 ? 1 : -1;
}
exports.compareMonth = compareMonth;
function compareDay(day1, day2) {
if (!(day1 instanceof Date)) {
day1 = new Date(day1);
}
if (!(day2 instanceof Date)) {
day2 = new Date(day2);
}
var compareMonthResult = compareMonth(day1, day2);
if (compareMonthResult === 0) {
var date1 = day1.getDate();
var date2 = day2.getDate();
return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
}
return compareMonthResult;
}
exports.compareDay = compareDay;
function getDayByOffset(date, offset) {
date = new Date(date);
date.setDate(date.getDate() + offset);
return date;
}
exports.getDayByOffset = getDayByOffset;
function getPrevDay(date) {
return getDayByOffset(date, -1);
}
exports.getPrevDay = getPrevDay;
function getNextDay(date) {
return getDayByOffset(date, 1);
}
exports.getNextDay = getNextDay;
function calcDateNum(date) {
var day1 = new Date(date[0]).getTime();
var day2 = new Date(date[1]).getTime();
return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
}
exports.calcDateNum = calcDateNum;
function copyDates(dates) {
if (Array.isArray(dates)) {
return dates.map(function (date) {
if (date === null) {
return date;
}
return new Date(date);
});
}
return new Date(dates);
}
exports.copyDates = copyDates;
function getMonthEndDay(year, month) {
return 32 - new Date(year, month - 1, 32).getDate();
}
exports.getMonthEndDay = getMonthEndDay;
function getMonths(minDate, maxDate) {
var months = [];
var cursor = new Date(minDate);
cursor.setDate(1);
do {
months.push(cursor.getTime());
cursor.setMonth(cursor.getMonth() + 1);
} while (compareMonth(cursor, maxDate) !== 1);
return months;
}
exports.getMonths = getMonths;

+ 25
- 0
miniprogram_npm/@vant/weapp/calendar/utils.wxs View File

@@ -0,0 +1,25 @@
/* eslint-disable */
function getMonthEndDay(year, month) {
return 32 - getDate(year, month - 1, 32).getDate();
}

function compareMonth(date1, date2) {
date1 = getDate(date1);
date2 = getDate(date2);

var year1 = date1.getFullYear();
var year2 = date2.getFullYear();
var month1 = date1.getMonth();
var month2 = date2.getMonth();

if (year1 === year2) {
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
}

return year1 > year2 ? 1 : -1;
}

module.exports = {
getMonthEndDay: getMonthEndDay,
compareMonth: compareMonth
};

+ 51
- 0
miniprogram_npm/@vant/weapp/card/index.js View File

@@ -0,0 +1,51 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var link_1 = require('../mixins/link');
var component_1 = require('../common/component');
component_1.VantComponent({
classes: [
'num-class',
'desc-class',
'thumb-class',
'title-class',
'price-class',
'origin-price-class',
],
mixins: [link_1.link],
props: {
tag: String,
num: String,
desc: String,
thumb: String,
title: String,
price: {
type: String,
observer: 'updatePrice',
},
centered: Boolean,
lazyLoad: Boolean,
thumbLink: String,
originPrice: String,
thumbMode: {
type: String,
value: 'aspectFit',
},
currency: {
type: String,
value: '¥',
},
},
methods: {
updatePrice: function () {
var price = this.data.price;
var priceArr = price.toString().split('.');
this.setData({
integerStr: priceArr[0],
decimalStr: priceArr[1] ? '.' + priceArr[1] : '',
});
},
onClickThumb: function () {
this.jumpLink('thumbLink');
},
},
});

+ 6
- 0
miniprogram_npm/@vant/weapp/card/index.json View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-tag": "../tag/index"
}
}

+ 56
- 0
miniprogram_npm/@vant/weapp/card/index.wxml View File

@@ -0,0 +1,56 @@
<wxs src="../wxs/utils.wxs" module="utils" />

<view class="custom-class van-card">
<view class="{{ utils.bem('card__header', { center: centered }) }}">
<view class="van-card__thumb" bind:tap="onClickThumb">
<image
wx:if="{{ thumb }}"
src="{{ thumb }}"
mode="{{ thumbMode }}"
lazy-load="{{ lazyLoad }}"
class="van-card__img thumb-class"
/>
<slot wx:else name="thumb" />
<van-tag
wx:if="{{ tag }}"
mark
type="danger"
custom-class="van-card__tag"
>
{{ tag }}
</van-tag>
<slot wx:else name="tag" />
</view>

<view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}">
<view>
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />

<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />

<slot name="tags" />
</view>

<view class="van-card__bottom">
<slot name="price-top" />
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">
<text>{{ currency }}</text>
<text class="van-card__price-integer">{{ integerStr }}</text>
<text class="van-card__price-decimal">{{ decimalStr }}</text>
</view>
<slot wx:else name="price" />
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
<slot wx:else name="origin-price" />
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
<slot wx:else name="num" />
<slot name="bottom" />
</view>
</view>
</view>

<view class="van-card__footer">
<slot name="footer" />
</view>
</view>

+ 1
- 0
miniprogram_npm/@vant/weapp/card/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:88px;width:var(--card-thumb-size,88px);height:88px;height:var(--card-thumb-size,88px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%;border-radius:8px;border-radius:var(--border-radius-lg,8px)}.van-card__content{position:relative;display:-webkit-flex;display:flex;-webkit-flex:1;flex:1;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:space-between;justify-content:space-between;min-width:0;min-height:88px;min-height:var(--card-thumb-size,88px)}.van-card__content--center{-webkit-justify-content:center;justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24);font-size:12px;font-size:var(--card-price-font-size,12px)}.van-card__price-integer{font-size:16px;font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute!important;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}

+ 12
- 0
miniprogram_npm/@vant/weapp/cell-group/index.js View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../common/component');
component_1.VantComponent({
props: {
title: String,
border: {
type: Boolean,
value: true,
},
},
});

+ 3
- 0
miniprogram_npm/@vant/weapp/cell-group/index.json View File

@@ -0,0 +1,3 @@
{
"component": true
}

+ 9
- 0
miniprogram_npm/@vant/weapp/cell-group/index.wxml View File

@@ -0,0 +1,9 @@
<view
wx:if="{{ title }}"
class="van-cell-group__title"
>
{{ title }}
</view>
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
<slot />
</view>

+ 1
- 0
miniprogram_npm/@vant/weapp/cell-group/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}

+ 40
- 0
miniprogram_npm/@vant/weapp/cell/index.js View File

@@ -0,0 +1,40 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var link_1 = require('../mixins/link');
var component_1 = require('../common/component');
component_1.VantComponent({
classes: [
'title-class',
'label-class',
'value-class',
'right-icon-class',
'hover-class',
],
mixins: [link_1.link],
props: {
title: null,
value: null,
icon: String,
size: String,
label: String,
center: Boolean,
isLink: Boolean,
required: Boolean,
clickable: Boolean,
titleWidth: String,
customStyle: String,
arrowDirection: String,
useLabelSlot: Boolean,
border: {
type: Boolean,
value: true,
},
titleStyle: String,
},
methods: {
onClick: function (event) {
this.$emit('click', event.detail);
this.jumpLink();
},
},
});

+ 6
- 0
miniprogram_npm/@vant/weapp/cell/index.json View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}

+ 47
- 0
miniprogram_npm/@vant/weapp/cell/index.wxml View File

@@ -0,0 +1,47 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />

<view
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
hover-class="van-cell--hover hover-class"
hover-stay-time="70"
style="{{ customStyle }}"
bind:tap="onClick"
>
<van-icon
wx:if="{{ icon }}"
name="{{ icon }}"
class="van-cell__left-icon-wrap"
custom-class="van-cell__left-icon"
/>
<slot wx:else name="icon" />

<view
style="{{ computed.titleStyle({ titleWidth, titleStyle }) }}"
class="van-cell__title title-class"
>

<block wx:if="{{ title }}">{{ title }}</block>
<slot wx:else name="title" />

<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
<slot wx:if="{{ useLabelSlot }}" name="label" />
<block wx:elif="{{ label }}">{{ label }}</block>
</view>
</view>

<view class="van-cell__value value-class">
<block wx:if="{{ value || value === 0 }}">{{ value }}</block>
<slot wx:else />
</view>

<van-icon
wx:if="{{ isLink }}"
name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}"
class="van-cell__right-icon-wrap right-icon-class"
custom-class="van-cell__right-icon"
/>
<slot wx:else name="right-icon" />

<slot name="extra" />
</view>

+ 17
- 0
miniprogram_npm/@vant/weapp/cell/index.wxs View File

@@ -0,0 +1,17 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');

function titleStyle(data) {
return style([
{
'max-width': addUnit(data.titleWidth),
'min-width': addUnit(data.titleWidth),
},
data.titleStyle,
]);
}

module.exports = {
titleStyle: titleStyle,
};

+ 1
- 0
miniprogram_npm/@vant/weapp/cell/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:4px;margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{margin-left:4px;margin-left:var(--padding-base,4px);color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}

+ 38
- 0
miniprogram_npm/@vant/weapp/checkbox-group/index.js View File

@@ -0,0 +1,38 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var relation_1 = require('../common/relation');
var component_1 = require('../common/component');
component_1.VantComponent({
field: true,
relation: relation_1.useChildren('checkbox', function (target) {
this.updateChild(target);
}),
props: {
max: Number,
value: {
type: Array,
observer: 'updateChildren',
},
disabled: {
type: Boolean,
observer: 'updateChildren',
},
},
methods: {
updateChildren: function () {
var _this = this;
this.children.forEach(function (child) {
return _this.updateChild(child);
});
},
updateChild: function (child) {
var _a = this.data,
value = _a.value,
disabled = _a.disabled;
child.setData({
value: value.indexOf(child.data.name) !== -1,
parentDisabled: disabled,
});
},
},
});

+ 3
- 0
miniprogram_npm/@vant/weapp/checkbox-group/index.json View File

@@ -0,0 +1,3 @@
{
"component": true
}

+ 1
- 0
miniprogram_npm/@vant/weapp/checkbox-group/index.wxml View File

@@ -0,0 +1 @@
<slot />

+ 1
- 0
miniprogram_npm/@vant/weapp/checkbox-group/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';

+ 83
- 0
miniprogram_npm/@vant/weapp/checkbox/index.js View File

@@ -0,0 +1,83 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var relation_1 = require('../common/relation');
var component_1 = require('../common/component');
function emit(target, value) {
target.$emit('input', value);
target.$emit('change', value);
}
component_1.VantComponent({
field: true,
relation: relation_1.useParent('checkbox-group'),
classes: ['icon-class', 'label-class'],
props: {
value: Boolean,
disabled: Boolean,
useIconSlot: Boolean,
checkedColor: String,
labelPosition: {
type: String,
value: 'right',
},
labelDisabled: Boolean,
shape: {
type: String,
value: 'round',
},
iconSize: {
type: null,
value: 20,
},
},
data: {
parentDisabled: false,
},
methods: {
emitChange: function (value) {
if (this.parent) {
this.setParentValue(this.parent, value);
} else {
emit(this, value);
}
},
toggle: function () {
var _a = this.data,
parentDisabled = _a.parentDisabled,
disabled = _a.disabled,
value = _a.value;
if (!disabled && !parentDisabled) {
this.emitChange(!value);
}
},
onClickLabel: function () {
var _a = this.data,
labelDisabled = _a.labelDisabled,
parentDisabled = _a.parentDisabled,
disabled = _a.disabled,
value = _a.value;
if (!disabled && !labelDisabled && !parentDisabled) {
this.emitChange(!value);
}
},
setParentValue: function (parent, value) {
var parentValue = parent.data.value.slice();
var name = this.data.name;
var max = parent.data.max;
if (value) {
if (max && parentValue.length >= max) {
return;
}
if (parentValue.indexOf(name) === -1) {
parentValue.push(name);
emit(parent, parentValue);
}
} else {
var index = parentValue.indexOf(name);
if (index !== -1) {
parentValue.splice(index, 1);
emit(parent, parentValue);
}
}
},
},
});

+ 6
- 0
miniprogram_npm/@vant/weapp/checkbox/index.json View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}

+ 31
- 0
miniprogram_npm/@vant/weapp/checkbox/index.wxml View File

@@ -0,0 +1,31 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />

<view class="van-checkbox custom-class">
<view
wx:if="{{ labelPosition === 'left' }}"
class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
bindtap="onClickLabel"
>
<slot />
</view>
<view class="van-checkbox__icon-wrap" bindtap="toggle">
<slot wx:if="{{ useIconSlot }}" name="icon" />
<van-icon
wx:else
name="success"
size="0.8em"
class="{{ utils.bem('checkbox__icon', [shape, { disabled: disabled || parentDisabled, checked: value }]) }}"
style="{{ computed.iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) }}"
custom-class="icon-class"
custom-style="line-height: 1.25em;"
/>
</view>
<view
wx:if="{{ labelPosition === 'right' }}"
class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
bindtap="onClickLabel"
>
<slot />
</view>
</view>

+ 20
- 0
miniprogram_npm/@vant/weapp/checkbox/index.wxs View File

@@ -0,0 +1,20 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');

function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) {
var styles = {
'font-size': addUnit(iconSize),
};

if (checkedColor && value && !disabled && !parentDisabled) {
styles['border-color'] = checkedColor;
styles['background-color'] = checkedColor;
}

return style(styles);
}

module.exports = {
iconStyle: iconStyle,
};

+ 1
- 0
miniprogram_npm/@vant/weapp/checkbox/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0}

+ 47
- 0
miniprogram_npm/@vant/weapp/circle/canvas.js View File

@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.adaptor = void 0;
function adaptor(ctx) {
// @ts-ignore
return Object.assign(ctx, {
setStrokeStyle: function (val) {
ctx.strokeStyle = val;
},
setLineWidth: function (val) {
ctx.lineWidth = val;
},
setLineCap: function (val) {
ctx.lineCap = val;
},
setFillStyle: function (val) {
ctx.fillStyle = val;
},
setFontSize: function (val) {
ctx.font = String(val);
},
setGlobalAlpha: function (val) {
ctx.globalAlpha = val;
},
setLineJoin: function (val) {
ctx.lineJoin = val;
},
setTextAlign: function (val) {
ctx.textAlign = val;
},
setMiterLimit: function (val) {
ctx.miterLimit = val;
},
setShadow: function (offsetX, offsetY, blur, color) {
ctx.shadowOffsetX = offsetX;
ctx.shadowOffsetY = offsetY;
ctx.shadowBlur = blur;
ctx.shadowColor = color;
},
setTextBaseline: function (val) {
ctx.textBaseline = val;
},
createCircularGradient: function () {},
draw: function () {},
});
}
exports.adaptor = adaptor;

+ 215
- 0
miniprogram_npm/@vant/weapp/circle/index.js View File

@@ -0,0 +1,215 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var color_1 = require('../common/color');
var component_1 = require('../common/component');
var utils_1 = require('../common/utils');
var validator_1 = require('../common/validator');
var version_1 = require('../common/version');
var canvas_1 = require('./canvas');
function format(rate) {
return Math.min(Math.max(rate, 0), 100);
}
var PERIMETER = 2 * Math.PI;
var BEGIN_ANGLE = -Math.PI / 2;
var STEP = 1;
component_1.VantComponent({
props: {
text: String,
lineCap: {
type: String,
value: 'round',
},
value: {
type: Number,
value: 0,
observer: 'reRender',
},
speed: {
type: Number,
value: 50,
},
size: {
type: Number,
value: 100,
observer: function () {
this.drawCircle(this.currentValue);
},
},
fill: String,
layerColor: {
type: String,
value: color_1.WHITE,
},
color: {
type: null,
value: color_1.BLUE,
observer: function () {
var _this = this;
this.setHoverColor().then(function () {
_this.drawCircle(_this.currentValue);
});
},
},
type: {
type: String,
value: '',
},
strokeWidth: {
type: Number,
value: 4,
},
clockwise: {
type: Boolean,
value: true,
},
},
data: {
hoverColor: color_1.BLUE,
},
methods: {
getContext: function () {
var _this = this;
var _a = this.data,
type = _a.type,
size = _a.size;
if (type === '' || !version_1.canIUseCanvas2d()) {
var ctx = wx.createCanvasContext('van-circle', this);
return Promise.resolve(ctx);
}
var dpr = utils_1.getSystemInfoSync().pixelRatio;
return new Promise(function (resolve) {
wx.createSelectorQuery()
.in(_this)
.select('#van-circle')
.node()
.exec(function (res) {
var canvas = res[0].node;
var ctx = canvas.getContext(type);
if (!_this.inited) {
_this.inited = true;
canvas.width = size * dpr;
canvas.height = size * dpr;
ctx.scale(dpr, dpr);
}
resolve(canvas_1.adaptor(ctx));
});
});
},
setHoverColor: function () {
var _this = this;
var _a = this.data,
color = _a.color,
size = _a.size;
if (validator_1.isObj(color)) {
return this.getContext().then(function (context) {
var LinearColor = context.createLinearGradient(size, 0, 0, 0);
Object.keys(color)
.sort(function (a, b) {
return parseFloat(a) - parseFloat(b);
})
.map(function (key) {
return LinearColor.addColorStop(
parseFloat(key) / 100,
color[key]
);
});
_this.hoverColor = LinearColor;
});
}
this.hoverColor = color;
return Promise.resolve();
},
presetCanvas: function (context, strokeStyle, beginAngle, endAngle, fill) {
var _a = this.data,
strokeWidth = _a.strokeWidth,
lineCap = _a.lineCap,
clockwise = _a.clockwise,
size = _a.size;
var position = size / 2;
var radius = position - strokeWidth / 2;
context.setStrokeStyle(strokeStyle);
context.setLineWidth(strokeWidth);
context.setLineCap(lineCap);
context.beginPath();
context.arc(position, position, radius, beginAngle, endAngle, !clockwise);
context.stroke();
if (fill) {
context.setFillStyle(fill);
context.fill();
}
},
renderLayerCircle: function (context) {
var _a = this.data,
layerColor = _a.layerColor,
fill = _a.fill;
this.presetCanvas(context, layerColor, 0, PERIMETER, fill);
},
renderHoverCircle: function (context, formatValue) {
var clockwise = this.data.clockwise;
// 结束角度
var progress = PERIMETER * (formatValue / 100);
var endAngle = clockwise
? BEGIN_ANGLE + progress
: 3 * Math.PI - (BEGIN_ANGLE + progress);
this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle);
},
drawCircle: function (currentValue) {
var _this = this;
var size = this.data.size;
this.getContext().then(function (context) {
context.clearRect(0, 0, size, size);
_this.renderLayerCircle(context);
var formatValue = format(currentValue);
if (formatValue !== 0) {
_this.renderHoverCircle(context, formatValue);
}
context.draw();
});
},
reRender: function () {
var _this = this;
// tofector 动画暂时没有想到好的解决方案
var _a = this.data,
value = _a.value,
speed = _a.speed;
if (speed <= 0 || speed > 1000) {
this.drawCircle(value);
return;
}
this.clearInterval();
this.currentValue = this.currentValue || 0;
this.interval = setInterval(function () {
if (_this.currentValue !== value) {
if (Math.abs(_this.currentValue - value) < STEP) {
_this.currentValue = value;
} else {
if (_this.currentValue < value) {
_this.currentValue += STEP;
} else {
_this.currentValue -= STEP;
}
}
_this.drawCircle(_this.currentValue);
} else {
_this.clearInterval();
}
}, 1000 / speed);
},
clearInterval: function () {
if (this.interval) {
clearInterval(this.interval);
this.interval = null;
}
},
},
mounted: function () {
var _this = this;
this.currentValue = this.data.value;
this.setHoverColor().then(function () {
_this.drawCircle(_this.currentValue);
});
},
destroyed: function () {
this.clearInterval();
},
});

+ 3
- 0
miniprogram_npm/@vant/weapp/circle/index.json View File

@@ -0,0 +1,3 @@
{
"component": true
}

+ 9
- 0
miniprogram_npm/@vant/weapp/circle/index.wxml View File

@@ -0,0 +1,9 @@
<wxs src="../wxs/utils.wxs" module="utils" />

<view class="van-circle">
<canvas class="van-circle__canvas" type="{{ type }}" style="width: {{ utils.addUnit(size) }};height:{{ utils.addUnit(size) }}" id="van-circle" canvas-id="van-circle"></canvas>
<view wx:if="{{ !text }}" class="van-circle__text">
<slot></slot>
</view>
<cover-view wx:else class="van-circle__text">{{ text }}</cover-view>
</view>

+ 1
- 0
miniprogram_npm/@vant/weapp/circle/index.wxss View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-circle{position:relative;display:inline-block;text-align:center}.van-circle__text{position:absolute;top:50%;left:0;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:#323233;color:var(--circle-text-color,#323233)}

+ 11
- 0
miniprogram_npm/@vant/weapp/col/index.js View File

@@ -0,0 +1,11 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var relation_1 = require('../common/relation');
var component_1 = require('../common/component');
component_1.VantComponent({
relation: relation_1.useParent('row'),
props: {
span: Number,
offset: Number,
},
});

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save