lrf 1 year ago
commit
bf75c5adc5
100 changed files with 1670 additions and 0 deletions
  1. 31 0
      .eslintrc.js
  2. 32 0
      app.js
  3. 58 0
      app.json
  4. 12 0
      app.wxss
  5. 45 0
      commpents/mobile-frame/foot.js
  6. 4 0
      commpents/mobile-frame/foot.json
  7. 6 0
      commpents/mobile-frame/foot.wxml
  8. 6 0
      commpents/mobile-frame/foot.wxss
  9. 49 0
      commpents/mobile-frame/mobile-main.js
  10. 7 0
      commpents/mobile-frame/mobile-main.json
  11. 11 0
      commpents/mobile-frame/mobile-main.wxml
  12. 21 0
      commpents/mobile-frame/mobile-main.wxss
  13. 26 0
      commpents/mobile-frame/top.js
  14. 4 0
      commpents/mobile-frame/top.json
  15. 7 0
      commpents/mobile-frame/top.wxml
  16. 35 0
      commpents/mobile-frame/top.wxss
  17. 115 0
      icon/icon.wxss
  18. BIN
      image/back.png
  19. BIN
      image/background.png
  20. BIN
      image/icon_API.png
  21. BIN
      image/icon_API_HL.png
  22. BIN
      image/icon_component.png
  23. BIN
      image/icon_component_HL.png
  24. BIN
      image/logo.png
  25. 1 0
      miniprogram_npm/vant-weapp/action-sheet/index.d.ts
  26. 43 0
      miniprogram_npm/vant-weapp/action-sheet/index.js
  27. 8 0
      miniprogram_npm/vant-weapp/action-sheet/index.json
  28. 51 0
      miniprogram_npm/vant-weapp/action-sheet/index.wxml
  29. 1 0
      miniprogram_npm/vant-weapp/action-sheet/index.wxss
  30. 1 0
      miniprogram_npm/vant-weapp/area/index.d.ts
  31. 212 0
      miniprogram_npm/vant-weapp/area/index.js
  32. 6 0
      miniprogram_npm/vant-weapp/area/index.json
  33. 18 0
      miniprogram_npm/vant-weapp/area/index.wxml
  34. 1 0
      miniprogram_npm/vant-weapp/area/index.wxss
  35. 1 0
      miniprogram_npm/vant-weapp/badge-group/index.d.ts
  36. 43 0
      miniprogram_npm/vant-weapp/badge-group/index.js
  37. 3 0
      miniprogram_npm/vant-weapp/badge-group/index.json
  38. 3 0
      miniprogram_npm/vant-weapp/badge-group/index.wxml
  39. 1 0
      miniprogram_npm/vant-weapp/badge-group/index.wxss
  40. 1 0
      miniprogram_npm/vant-weapp/badge/index.d.ts
  41. 30 0
      miniprogram_npm/vant-weapp/badge/index.js
  42. 6 0
      miniprogram_npm/vant-weapp/badge/index.json
  43. 17 0
      miniprogram_npm/vant-weapp/badge/index.wxml
  44. 1 0
      miniprogram_npm/vant-weapp/badge/index.wxss
  45. 1 0
      miniprogram_npm/vant-weapp/button/index.d.ts
  46. 38 0
      miniprogram_npm/vant-weapp/button/index.js
  47. 7 0
      miniprogram_npm/vant-weapp/button/index.json
  48. 51 0
      miniprogram_npm/vant-weapp/button/index.wxml
  49. 1 0
      miniprogram_npm/vant-weapp/button/index.wxss
  50. 1 0
      miniprogram_npm/vant-weapp/card/index.d.ts
  51. 38 0
      miniprogram_npm/vant-weapp/card/index.js
  52. 6 0
      miniprogram_npm/vant-weapp/card/index.json
  53. 45 0
      miniprogram_npm/vant-weapp/card/index.wxml
  54. 1 0
      miniprogram_npm/vant-weapp/card/index.wxss
  55. 1 0
      miniprogram_npm/vant-weapp/cell-group/index.d.ts
  56. 10 0
      miniprogram_npm/vant-weapp/cell-group/index.js
  57. 3 0
      miniprogram_npm/vant-weapp/cell-group/index.json
  58. 9 0
      miniprogram_npm/vant-weapp/cell-group/index.wxml
  59. 1 0
      miniprogram_npm/vant-weapp/cell-group/index.wxss
  60. 1 0
      miniprogram_npm/vant-weapp/cell/index.d.ts
  61. 37 0
      miniprogram_npm/vant-weapp/cell/index.js
  62. 6 0
      miniprogram_npm/vant-weapp/cell/index.json
  63. 45 0
      miniprogram_npm/vant-weapp/cell/index.wxml
  64. 1 0
      miniprogram_npm/vant-weapp/cell/index.wxss
  65. 1 0
      miniprogram_npm/vant-weapp/checkbox-group/index.d.ts
  66. 39 0
      miniprogram_npm/vant-weapp/checkbox-group/index.js
  67. 3 0
      miniprogram_npm/vant-weapp/checkbox-group/index.json
  68. 1 0
      miniprogram_npm/vant-weapp/checkbox-group/index.wxml
  69. 1 0
      miniprogram_npm/vant-weapp/checkbox-group/index.wxss
  70. 1 0
      miniprogram_npm/vant-weapp/checkbox/index.d.ts
  71. 74 0
      miniprogram_npm/vant-weapp/checkbox/index.js
  72. 6 0
      miniprogram_npm/vant-weapp/checkbox/index.json
  73. 18 0
      miniprogram_npm/vant-weapp/checkbox/index.wxml
  74. 1 0
      miniprogram_npm/vant-weapp/checkbox/index.wxss
  75. 1 0
      miniprogram_npm/vant-weapp/col/index.d.ts
  76. 23 0
      miniprogram_npm/vant-weapp/col/index.js
  77. 3 0
      miniprogram_npm/vant-weapp/col/index.json
  78. 8 0
      miniprogram_npm/vant-weapp/col/index.wxml
  79. 1 0
      miniprogram_npm/vant-weapp/col/index.wxss
  80. 1 0
      miniprogram_npm/vant-weapp/collapse-item/index.d.ts
  81. 96 0
      miniprogram_npm/vant-weapp/collapse-item/index.js
  82. 6 0
      miniprogram_npm/vant-weapp/collapse-item/index.json
  83. 44 0
      miniprogram_npm/vant-weapp/collapse-item/index.wxml
  84. 1 0
      miniprogram_npm/vant-weapp/collapse-item/index.wxss
  85. 1 0
      miniprogram_npm/vant-weapp/collapse/index.d.ts
  86. 50 0
      miniprogram_npm/vant-weapp/collapse/index.js
  87. 3 0
      miniprogram_npm/vant-weapp/collapse/index.json
  88. 3 0
      miniprogram_npm/vant-weapp/collapse/index.wxml
  89. 1 0
      miniprogram_npm/vant-weapp/collapse/index.wxss
  90. 4 0
      miniprogram_npm/vant-weapp/common/color.d.ts
  91. 4 0
      miniprogram_npm/vant-weapp/common/color.js
  92. 3 0
      miniprogram_npm/vant-weapp/common/component.d.ts
  93. 48 0
      miniprogram_npm/vant-weapp/common/component.js
  94. 1 0
      miniprogram_npm/vant-weapp/common/index.wxss
  95. 1 0
      miniprogram_npm/vant-weapp/common/style/clearfix.wxss
  96. 1 0
      miniprogram_npm/vant-weapp/common/style/ellipsis.wxss
  97. 1 0
      miniprogram_npm/vant-weapp/common/style/hairline.wxss
  98. 0 0
      miniprogram_npm/vant-weapp/common/style/mixins/clearfix.wxss
  99. 0 0
      miniprogram_npm/vant-weapp/common/style/mixins/ellipsis.wxss
  100. 0 0
      miniprogram_npm/vant-weapp/common/style/mixins/hairline.wxss

+ 31 - 0
.eslintrc.js

@@ -0,0 +1,31 @@
+/*
+ * Eslint config file
+ * Documentation: https://eslint.org/docs/user-guide/configuring/
+ * Install the Eslint extension before using this feature.
+ */
+module.exports = {
+  env: {
+    es6: true,
+    browser: true,
+    node: true,
+  },
+  ecmaFeatures: {
+    modules: true,
+  },
+  parserOptions: {
+    ecmaVersion: 2018,
+    sourceType: 'module',
+  },
+  globals: {
+    wx: true,
+    App: true,
+    Page: true,
+    getCurrentPages: true,
+    getApp: true,
+    Component: true,
+    requirePlugin: true,
+    requireMiniProgram: true,
+  },
+  // extends: 'eslint:recommended',
+  rules: {},
+}

+ 32 - 0
app.js

@@ -0,0 +1,32 @@
+import login from './utils/login';
+import * as httpUtil from "./utils/httpUtil";
+const app = getApp();
+App({
+  onLaunch() {
+    // 展示本地存储能力
+    const logs = wx.getStorageSync('logs') || []
+    logs.unshift(Date.now())
+    wx.setStorageSync('logs', logs)
+    //获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度
+    wx.getSystemInfo({
+      success: (res) => {
+        let data = res;
+        data.getMenu = wx.getMenuButtonBoundingClientRect();
+        console.log(data);
+        // console.log(data.statusBarHeight + data.getMenu.height + (data.getMenu.top - data.statusBarHeight)*2);
+        this.globalData.client = data
+      }
+    })
+
+  },
+  globalData: {
+    userInfo: {},
+    // 微信用户openid,sessionKey
+    wxInfo: {},
+    client: {},
+    publicUrl: 'http://192.168.43.105:6200', //
+  },
+  // 微信openid回调
+  toLogin: login.toLogin,
+  ...httpUtil
+})

+ 58 - 0
app.json

@@ -0,0 +1,58 @@
+{
+  "pages": [
+    "pages/home/index",
+    "pages/transfer/index",
+    "pages/transfer/detail",
+    "pages/index/index",
+    "pages/login/index",
+    "pages/test/index"
+  ],
+  "usingComponents": {
+    "van-button": "/miniprogram_npm/vant-weapp/button/index",
+    "van-row": "/miniprogram_npm/vant-weapp/row/index",
+    "van-col": "/miniprogram_npm/vant-weapp/col/index",
+    "van-datetime-picker": "/miniprogram_npm/vant-weapp/datetime-picker/index",
+    "van-picker": "/miniprogram_npm/vant-weapp/picker/index",
+    "van-popup": "/miniprogram_npm/vant-weapp/popup/index",
+    "van-radio": "/miniprogram_npm/vant-weapp/radio/index",
+    "van-radio-group": "/miniprogram_npm/vant-weapp/radio-group/index",
+    "van-action-sheet": "/miniprogram_npm/vant-weapp/action-sheet/index",
+    "van-search": "/miniprogram_npm/vant-weapp/search/index",
+    "van-tree-select": "/miniprogram_npm/vant-weapp/tree-select/index",
+    "van-overlay": "/miniprogram_npm/vant-weapp/overlay/index",
+    "van-dialog": "/miniprogram_npm/vant-weapp/dialog/index",
+    "van-tab": "/miniprogram_npm/vant-weapp/tab/index",
+    "van-tabs": "/miniprogram_npm/vant-weapp/tabs/index",
+    "van-stepper": "/miniprogram_npm/vant-weapp/stepper/index",
+    "van-collapse": "/miniprogram_npm/vant-weapp/collapse/index",
+    "van-collapse-item": "/miniprogram_npm/vant-weapp/collapse-item/index",
+    "van-cell": "/miniprogram_npm/vant-weapp/cell/index",
+    "van-cell-group": "/miniprogram_npm/vant-weapp/cell-group/index",
+    "van-toast": "/miniprogram_npm/vant-weapp/toast/index",
+    "van-field": "/miniprogram_npm/vant-weapp/field/index",
+    "van-checkbox": "/miniprogram_npm/vant-weapp/checkbox/index",
+    "van-checkbox-group": "/miniprogram_npm/vant-weapp/checkbox-group/index",
+    "van-loading": "/miniprogram_npm/vant-weapp/loading/index",
+    "van-icon": "/miniprogram_npm/vant-weapp/icon/index",
+    "van-nav-bar": "/miniprogram_npm/vant-weapp/nav-bar/index",
+    "van-tabbar": "/miniprogram_npm/vant-weapp/tabbar/index",
+    "van-tabbar-item": "/miniprogram_npm/vant-weapp/tabbar-item/index",
+    "van-rate": "/miniprogram_npm/vant-weapp/rate/index"
+  },
+  "window": {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#fff",
+    "navigationBarTitleText": "精神障碍患者管理系统-监护人端",
+    "navigationBarTextStyle": "white",
+    "navigationStyle": "custom"
+  },
+  "requiredBackgroundModes": [
+    "location"
+  ],
+  "sitemapLocation": "sitemap.json",
+  "permission": {
+    "scope.userLocation": {
+      "desc": "你的位置信息将用于小程序位置接口的效果展示"
+    }
+  }
+}

+ 12 - 0
app.wxss

@@ -0,0 +1,12 @@
+/**app.wxss**/
+.container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  padding: 200rpx 0;
+  box-sizing: border-box;
+}
+
+@import "/icon/icon.wxss";

+ 45 - 0
commpents/mobile-frame/foot.js

@@ -0,0 +1,45 @@
+// commpents/mobile-frame/mobile-main.js
+const app = getApp()
+Component({
+  /**
+   * 组件的属性列表
+   */
+  options: { multipleSlots: true },
+  properties: {
+    tabSelectid: { type: 'string', value: '' }
+  },
+
+  // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+  attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
+  ready: function () { },
+  pageLifetimes: {
+    // 组件所在页面的生命周期函数
+    show: function () { this.search() },
+    hide: function () { },
+    resize: function () { },
+  },
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    active: '0'
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    // 返回上一级
+    tabPath(e) {
+      this.triggerEvent('tabPath', { index: e.detail })
+    },
+    search() {
+      let pages = getCurrentPages();
+      let currentPage = pages[pages.length - 1];
+      if (currentPage.route == 'pages/market/index') {
+        this.setData({ active: 0 })
+      } else {
+        this.setData({ active: 1 })
+      }
+    }
+  }
+})

+ 4 - 0
commpents/mobile-frame/foot.json

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

+ 6 - 0
commpents/mobile-frame/foot.wxml

@@ -0,0 +1,6 @@
+<view class="foot">
+  <van-tabbar active="{{ active }}" bind:change="tabPath">
+    <van-tabbar-item icon="cart-o">采购</van-tabbar-item>
+    <van-tabbar-item icon="manager-o">个人中心</van-tabbar-item>
+  </van-tabbar>
+</view>

+ 6 - 0
commpents/mobile-frame/foot.wxss

@@ -0,0 +1,6 @@
+.foot {
+  float: left;
+  width: 100%;
+  height: 48px;
+  border-top: 1px solid #666;
+}

+ 49 - 0
commpents/mobile-frame/mobile-main.js

@@ -0,0 +1,49 @@
+// commpents/mobile-frame/mobile-main.js
+const app = getApp()
+Component({
+  /**
+   * 组件的属性列表
+   */
+  options: { multipleSlots: true },
+  properties: {
+    frameStyle: { type: Object }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    infoHeight: ''
+  },
+  // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+  attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
+  ready: function () { },
+  pageLifetimes: {
+    // 组件所在页面的生命周期函数
+    show: function () { this.searchHeight() },
+    hide: function () { },
+    resize: function () { },
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    // 返回上一级
+    back() {
+      this.triggerEvent('back',)
+    },
+    tabPath(e) {
+      this.triggerEvent('tabPath', e)
+    },
+    searchHeight() {
+      let frameStyle = this.properties.frameStyle;
+      let client = app.globalData.client;
+      // 减去状态栏
+      let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+      // 是否减去底部菜单
+      if (frameStyle.useBar) infoHeight = infoHeight - 50;
+      if (infoHeight) this.setData({ infoHeight: infoHeight })
+    }
+  }
+})

+ 7 - 0
commpents/mobile-frame/mobile-main.json

@@ -0,0 +1,7 @@
+{
+  "component": true,
+  "usingComponents": {
+    "top": "./top",
+    "foot": "./foot"
+  }
+}

+ 11 - 0
commpents/mobile-frame/mobile-main.wxml

@@ -0,0 +1,11 @@
+<view class="main">
+  <view class="top" wx:if="{{frameStyle.useTop}}">
+    <top frameStyle="{{frameStyle}}" bind:back="back"></top>
+  </view>
+  <view class="info" style='height:{{infoHeight}}px'>
+    <slot name="info"></slot>
+  </view>
+  <view class="foot" wx:if="{{frameStyle.useBar}}">
+    <foot tabSelectid="{{frameStyle.tabSelectid}}" bind:tabPath="tabPath"></foot>
+  </view>
+</view>

+ 21 - 0
commpents/mobile-frame/mobile-main.wxss

@@ -0,0 +1,21 @@
+.main {
+  float: left;
+  width: 100%;
+}
+
+.main .one {
+  float: left;
+  width: 100%;
+}
+
+.main .info {
+  float: left;
+  width: 100%;
+  overflow-y: auto;
+  background-color: #f1f1f1;
+}
+
+.main .foot {
+  float: left;
+  width: 100%;
+}

+ 26 - 0
commpents/mobile-frame/top.js

@@ -0,0 +1,26 @@
+// commpents/mobile-frame/top.js
+const app = getApp()
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    frameStyle: { type: Object }
+  },
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    client: app.globalData.client
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    // 返回上一页面
+    _navback() {
+      this.triggerEvent('back')
+    }
+  }
+})

+ 4 - 0
commpents/mobile-frame/top.json

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

+ 7 - 0
commpents/mobile-frame/top.wxml

@@ -0,0 +1,7 @@
+<view class="top" style='height: {{client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight)*2}}px;'>
+  <view class="left" style='margin: {{client.getMenu.top}}px 0 0 0;'>
+    <cover-image src='/image/back.png' mode='aspectFill' class="back" bindtap='_navback' wx:if="{{frameStyle.leftArrow}}"></cover-image>
+  </view>
+  <view class="cen" style='margin: {{client.getMenu.top}}px 0 0 0;'>{{frameStyle.name}}</view>
+  <view class="right" style="display: none">右侧</view>
+</view>

+ 35 - 0
commpents/mobile-frame/top.wxss

@@ -0,0 +1,35 @@
+.top {
+  float: left;
+  width: 100%;
+  background-color: #409eff;
+}
+
+.top .left {
+  float: left;
+  width: 15%;
+  text-align: center;
+  overflow: hidden;
+}
+
+.top .left .back {
+  width: 40rpx;
+  height: 40rpx;
+  position: relative;
+  left: 15px;
+  width: 40rpx;
+  height: 40rpx;
+}
+
+.top .cen {
+  float: left;
+  width: 70%;
+  text-align: center;
+  font-size: 36rpx;
+  color: #ffffff;
+  font-weight: 600;
+}
+
+.top .right {
+  float: left;
+  width: 15%;
+}

+ 115 - 0
icon/icon.wxss

@@ -0,0 +1,115 @@
+@font-face {
+  font-family: "iconfont";
+  /* Project id 3094003 */
+  src: url('//at.alicdn.com/t/font_3094003_xu5no0ebyg.woff2?t=1640938844892') format('woff2'),
+    url('//at.alicdn.com/t/font_3094003_xu5no0ebyg.woff?t=1640938844892') format('woff'),
+    url('//at.alicdn.com/t/font_3094003_xu5no0ebyg.ttf?t=1640938844892') format('truetype');
+}
+
+.iconfont {
+  font-family: "iconfont" !important;
+  font-size: 16px;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-jiucuo:before {
+  content: "\e614";
+}
+
+.icon-shijian:before {
+  content: "\e665";
+}
+
+.icon-dengji:before {
+  content: "\e6ab";
+}
+
+.icon-neirong2:before {
+  content: "\e889";
+}
+
+.icon-name:before {
+  content: "\e6b4";
+}
+
+.icon-jianjie:before {
+  content: "\e617";
+}
+
+.icon-bianhao:before {
+  content: "\e635";
+}
+
+.icon-shouye:before {
+  content: "\e621";
+}
+
+.icon-shangpinxinxi:before {
+  content: "\e691";
+}
+
+.icon-shanghuguanli:before {
+  content: "\e61d";
+}
+
+.icon-zhiwu:before {
+  content: "\e601";
+}
+
+.icon-kuaibananjian:before {
+  content: "\e61e";
+}
+
+.icon-dianhua:before {
+  content: "\e8ad";
+}
+
+.icon-dianziyouxiang1:before {
+  content: "\e616";
+}
+
+.icon-commpany:before {
+  content: "\e611";
+}
+
+.icon-xingming:before {
+  content: "\e62a";
+}
+
+.icon-bangongdianhua:before {
+  content: "\e67e";
+}
+
+.icon-dizhi:before {
+  content: "\e814";
+}
+
+.icon-quxiantongxunlu:before {
+  content: "\e612";
+}
+
+.icon-bangdingweixin:before {
+  content: "\e62b";
+}
+
+.icon-tuichudenglu:before {
+  content: "\e647";
+}
+
+.icon-xiugaimima:before {
+  content: "\e618";
+}
+
+.icon-weixin:before {
+  content: "\e607";
+}
+
+.icon-mima:before {
+  content: "\e600";
+}
+
+.icon-shenfenleibie:before {
+  content: "\e64c";
+}

BIN
image/back.png


BIN
image/background.png


BIN
image/icon_API.png


BIN
image/icon_API_HL.png


BIN
image/icon_component.png


BIN
image/icon_component_HL.png


BIN
image/logo.png


+ 1 - 0
miniprogram_npm/vant-weapp/action-sheet/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 43 - 0
miniprogram_npm/vant-weapp/action-sheet/index.js

@@ -0,0 +1,43 @@
+import { VantComponent } from '../common/component';
+import { safeArea } from '../mixins/safe-area';
+VantComponent({
+    mixins: [safeArea()],
+    props: {
+        show: Boolean,
+        title: String,
+        cancelText: String,
+        customStyle: String,
+        overlayStyle: String,
+        zIndex: {
+            type: Number,
+            value: 100
+        },
+        actions: {
+            type: Array,
+            value: []
+        },
+        overlay: {
+            type: Boolean,
+            value: true
+        },
+        closeOnClickOverlay: {
+            type: Boolean,
+            value: true
+        }
+    },
+    methods: {
+        onSelect(event) {
+            const { index } = event.currentTarget.dataset;
+            const item = this.data.actions[index];
+            if (item && !item.disabled && !item.loading) {
+                this.$emit('select', item);
+            }
+        },
+        onCancel() {
+            this.$emit('cancel');
+        },
+        onClose() {
+            this.$emit('close');
+        }
+    }
+});

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

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

+ 51 - 0
miniprogram_npm/vant-weapp/action-sheet/index.wxml

@@ -0,0 +1,51 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<van-popup
+  show="{{ show }}"
+  position="bottom"
+  z-index="{{ zIndex }}"
+  overlay="{{ overlay }}"
+  custom-style="{{ customStyle }}"
+  overlay-style="{{ overlayStyle }}"
+  custom-class="van-action-sheet"
+  safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
+  close-on-click-overlay="{{ closeOnClickOverlay }}"
+  bind:close="onClose"
+>
+  <view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
+    {{ title }}
+    <van-icon
+      name="close"
+      custom-class="van-action-sheet__close"
+      bind:click="onClose"
+    />
+  </view>
+  <view wx:if="{{ actions && actions.length }}">
+    <!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
+    <button
+      wx:for="{{ actions }}"
+      wx:key="index"
+      open-type="{{ item.openType }}"
+      class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
+      hover-class="van-action-sheet__item--hover"
+      data-index="{{ index }}"
+      bind:tap="onSelect"
+    >
+      <block wx:if="{{ !item.loading }}">
+        {{ item.name }}
+        <text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
+      </block>
+      <van-loading wx:else size="20px" />
+    </button>
+  </view>
+  <slot />
+  <view
+    wx:if="{{ cancelText }}"
+    class="van-action-sheet__cancel"
+    hover-class="van-action-sheet__cancel--hover"
+    hover-stay-time="70"
+    bind:tap="onCancel"
+  >
+    {{ cancelText }}
+  </view>
+</van-popup>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/action-sheet/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/area/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 212 - 0
miniprogram_npm/vant-weapp/area/index.js

@@ -0,0 +1,212 @@
+import { VantComponent } from '../common/component';
+import { pickerProps } from '../picker/shared';
+const COLUMNSPLACEHOLDERCODE = '000000';
+VantComponent({
+    classes: ['active-class', 'toolbar-class', 'column-class'],
+    props: Object.assign({}, pickerProps, { value: String, areaList: {
+            type: Object,
+            value: {}
+        }, columnsNum: {
+            type: [String, Number],
+            value: 3
+        }, columnsPlaceholder: {
+            type: Array,
+            observer(val) {
+                this.setData({
+                    typeToColumnsPlaceholder: {
+                        province: val[0] || '',
+                        city: val[1] || '',
+                        county: val[2] || '',
+                    }
+                });
+            }
+        } }),
+    data: {
+        columns: [{ values: [] }, { values: [] }, { values: [] }],
+        displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
+        typeToColumnsPlaceholder: {}
+    },
+    watch: {
+        value(value) {
+            this.code = value;
+            this.setValues();
+        },
+        areaList: 'setValues',
+        columnsNum(value) {
+            this.set({
+                displayColumns: this.data.columns.slice(0, +value)
+            });
+        }
+    },
+    mounted() {
+        setTimeout(() => {
+            this.setValues();
+        }, 0);
+    },
+    methods: {
+        getPicker() {
+            if (this.picker == null) {
+                this.picker = this.selectComponent('.van-area__picker');
+            }
+            return this.picker;
+        },
+        onCancel(event) {
+            this.emit('cancel', event.detail);
+        },
+        onConfirm(event) {
+            const { index } = event.detail;
+            let { value } = event.detail;
+            value = this.parseOutputValues(value);
+            this.emit('confirm', { value, index });
+        },
+        emit(type, detail) {
+            detail.values = detail.value;
+            delete detail.value;
+            this.$emit(type, detail);
+        },
+        // parse output columns data
+        parseOutputValues(values) {
+            const { columnsPlaceholder } = this.data;
+            return values.map((value, index) => {
+                // save undefined value
+                if (!value)
+                    return value;
+                value = JSON.parse(JSON.stringify(value));
+                if (!value.code || value.name === columnsPlaceholder[index]) {
+                    value.code = '';
+                    value.name = '';
+                }
+                return value;
+            });
+        },
+        onChange(event) {
+            const { index, picker, value } = event.detail;
+            this.code = value[index].code;
+            let getValues = picker.getValues();
+            getValues = this.parseOutputValues(getValues);
+            this.setValues().then(() => {
+                this.$emit('change', {
+                    picker,
+                    values: getValues,
+                    index
+                });
+            });
+        },
+        getConfig(type) {
+            const { areaList } = this.data;
+            return (areaList && areaList[`${type}_list`]) || {};
+        },
+        getList(type, code) {
+            const { typeToColumnsPlaceholder } = this.data;
+            let result = [];
+            if (type !== 'province' && !code) {
+                return result;
+            }
+            const list = this.getConfig(type);
+            result = Object.keys(list).map(code => ({
+                code,
+                name: list[code]
+            }));
+            if (code) {
+                // oversea code
+                if (code[0] === '9' && type === 'city') {
+                    code = '9';
+                }
+                result = result.filter(item => item.code.indexOf(code) === 0);
+            }
+            if (typeToColumnsPlaceholder[type] && result.length) {
+                // set columns placeholder
+                const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6);
+                result.unshift({
+                    code: `${code}${codeFill}`,
+                    name: typeToColumnsPlaceholder[type]
+                });
+            }
+            return result;
+        },
+        getIndex(type, code) {
+            let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
+            const 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 (let i = 0; i < list.length; i++) {
+                if (list[i].code.slice(0, compareNum) === code) {
+                    return i;
+                }
+            }
+            return 0;
+        },
+        setValues() {
+            const county = this.getConfig('county');
+            let { code } = this;
+            if (!code) {
+                if (this.data.columnsPlaceholder.length) {
+                    code = COLUMNSPLACEHOLDERCODE;
+                }
+                else if (Object.keys(county)[0]) {
+                    code = Object.keys(county)[0];
+                }
+                else {
+                    code = '';
+                }
+            }
+            const province = this.getList('province');
+            const city = this.getList('city', code.slice(0, 2));
+            const picker = this.getPicker();
+            if (!picker) {
+                return;
+            }
+            const stack = [];
+            stack.push(picker.setColumnValues(0, province, false));
+            stack.push(picker.setColumnValues(1, city, false));
+            if (city.length && code.slice(2, 4) === '00') {
+                [{ code }] = city;
+            }
+            stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
+            return Promise.all(stack)
+                .catch(() => { })
+                .then(() => picker.setIndexes([
+                this.getIndex('province', code),
+                this.getIndex('city', code),
+                this.getIndex('county', code)
+            ]))
+                .catch(() => { });
+        },
+        getValues() {
+            const picker = this.getPicker();
+            return picker ? picker.getValues().filter(value => !!value) : [];
+        },
+        getDetail() {
+            const values = this.getValues();
+            const area = {
+                code: '',
+                country: '',
+                province: '',
+                city: '',
+                county: ''
+            };
+            if (!values.length) {
+                return area;
+            }
+            const names = values.map((item) => 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() {
+            this.code = '';
+            return this.setValues();
+        }
+    }
+});

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

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

+ 18 - 0
miniprogram_npm/vant-weapp/area/index.wxml

@@ -0,0 +1,18 @@
+<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="{{ displayColumns }}"
+  item-height="{{ itemHeight }}"
+  visible-item-count="{{ visibleItemCount }}"
+  cancel-button-text="{{ cancelButtonText }}"
+  confirm-button-text="{{ confirmButtonText }}"
+  bind:change="onChange"
+  bind:confirm="onConfirm"
+  bind:cancel="onCancel"
+/>

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

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

+ 1 - 0
miniprogram_npm/vant-weapp/badge-group/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 43 - 0
miniprogram_npm/vant-weapp/badge-group/index.js

@@ -0,0 +1,43 @@
+import { VantComponent } from '../common/component';
+VantComponent({
+    relation: {
+        name: 'badge',
+        type: 'descendant',
+        linked(target) {
+            this.badges.push(target);
+            this.setActive(this.data.active);
+        },
+        unlinked(target) {
+            this.badges = this.badges.filter(item => item !== target);
+            this.setActive(this.data.active);
+        }
+    },
+    props: {
+        active: {
+            type: Number,
+            value: 0,
+            observer: 'setActive'
+        }
+    },
+    beforeCreate() {
+        this.badges = [];
+        this.currentActive = -1;
+    },
+    methods: {
+        setActive(active) {
+            const { badges, currentActive } = this;
+            if (!badges.length) {
+                return Promise.resolve();
+            }
+            this.currentActive = active;
+            const stack = [];
+            if (currentActive !== active && badges[currentActive]) {
+                stack.push(badges[currentActive].setActive(false));
+            }
+            if (badges[active]) {
+                stack.push(badges[active].setActive(true));
+            }
+            return Promise.all(stack);
+        }
+    }
+});

+ 3 - 0
miniprogram_npm/vant-weapp/badge-group/index.json

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

+ 3 - 0
miniprogram_npm/vant-weapp/badge-group/index.wxml

@@ -0,0 +1,3 @@
+<view class="van-badge-group van-hairline--top-bottom custom-class">
+  <slot />
+</view>

+ 1 - 0
miniprogram_npm/vant-weapp/badge-group/index.wxss

@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-badge-group{width:85px}

+ 1 - 0
miniprogram_npm/vant-weapp/badge/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 30 - 0
miniprogram_npm/vant-weapp/badge/index.js

@@ -0,0 +1,30 @@
+import { VantComponent } from '../common/component';
+VantComponent({
+    relation: {
+        type: 'ancestor',
+        name: 'badge-group',
+        linked(target) {
+            this.parent = target;
+        }
+    },
+    props: {
+        info: null,
+        title: String
+    },
+    methods: {
+        onClick() {
+            const { parent } = this;
+            if (!parent) {
+                return;
+            }
+            const index = parent.badges.indexOf(this);
+            parent.setActive(index).then(() => {
+                this.$emit('click', index);
+                parent.$emit('change', index);
+            });
+        },
+        setActive(active) {
+            return this.set({ active });
+        }
+    }
+});

+ 6 - 0
miniprogram_npm/vant-weapp/badge/index.json

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

+ 17 - 0
miniprogram_npm/vant-weapp/badge/index.wxml

@@ -0,0 +1,17 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<view
+  class="{{ utils.bem('badge', { active }) }} van-hairline custom-class"
+  hover-class="van-badge--hover"
+  hover-stay-time="70"
+  bind:tap="onClick"
+>
+  <view class="van-badge__text">
+    <van-info
+      wx:if="{{ info !== null }}"
+      info="{{ info }}"
+      custom-style="right: 4px"
+    />
+    {{ title }}
+  </view>
+</view>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/badge/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/button/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 38 - 0
miniprogram_npm/vant-weapp/button/index.js

@@ -0,0 +1,38 @@
+import { VantComponent } from '../common/component';
+import { button } from '../mixins/button';
+import { openType } from '../mixins/open-type';
+VantComponent({
+    mixins: [button, openType],
+    classes: ['hover-class', 'loading-class'],
+    props: {
+        icon: String,
+        color: String,
+        plain: Boolean,
+        block: Boolean,
+        round: Boolean,
+        square: Boolean,
+        loading: Boolean,
+        hairline: Boolean,
+        disabled: Boolean,
+        loadingText: String,
+        type: {
+            type: String,
+            value: 'default'
+        },
+        size: {
+            type: String,
+            value: 'normal'
+        },
+        loadingSize: {
+            type: String,
+            value: '20px'
+        }
+    },
+    methods: {
+        onClick() {
+            if (!this.data.disabled && !this.data.loading) {
+                this.$emit('click');
+            }
+        }
+    }
+});

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

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

+ 51 - 0
miniprogram_npm/vant-weapp/button/index.wxml

@@ -0,0 +1,51 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<button
+  id="{{ id }}"
+  class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
+  open-type="{{ openType }}"
+  hover-class="van-button--active hover-class"
+  style="{{ color ? 'border-color: ' + color + ';' + (plain ? 'color: ' + color : 'color: #fff; background-color: ' + color) : '' }}"
+  lang="{{ lang }}"
+  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="onClick"
+  bindgetuserinfo="bindGetUserInfo"
+  bindcontact="bindContact"
+  bindgetphonenumber="bindGetPhoneNumber"
+  binderror="bindError"
+  bindlaunchapp="bindLaunchApp"
+  bindopensetting="bindOpenSetting"
+>
+  <block wx:if="{{ loading }}">
+    <van-loading
+      custom-class="loading-class"
+      size="{{ loadingSize }}"
+      color="{{ type === 'default' ? '#c9c9c9' : '' }}"
+    />
+    <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="van-button__icon"
+      custom-style="line-height: inherit;"
+    />
+    <view class="van-button__text">
+      <slot />
+    </view>
+  </block>
+</button>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/button/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/card/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 38 - 0
miniprogram_npm/vant-weapp/card/index.js

@@ -0,0 +1,38 @@
+import { link } from '../mixins/link';
+import { VantComponent } from '../common/component';
+VantComponent({
+    classes: [
+        'num-class',
+        'desc-class',
+        'thumb-class',
+        'title-class',
+        'price-class',
+        'origin-price-class',
+    ],
+    mixins: [link],
+    props: {
+        tag: String,
+        num: String,
+        desc: String,
+        thumb: String,
+        title: String,
+        price: String,
+        centered: Boolean,
+        lazyLoad: Boolean,
+        thumbLink: String,
+        originPrice: String,
+        thumbMode: {
+            type: String,
+            value: 'aspectFit'
+        },
+        currency: {
+            type: String,
+            value: '¥'
+        }
+    },
+    methods: {
+        onClickThumb() {
+            this.jumpLink('thumbLink');
+        }
+    }
+});

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

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

+ 45 - 0
miniprogram_npm/vant-weapp/card/index.wxml

@@ -0,0 +1,45 @@
+<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 name="thumb" />
+      <van-tag
+        wx:if="{{ tag }}"
+        mark
+        type="danger"
+        custom-class="van-card__tag"
+      >
+        {{ tag }}
+      </van-tag>
+    </view>
+
+    <view class="van-card__content">
+      <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 class="van-card__bottom">
+        <view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
+        <view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
+        <view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
+        <slot name="bottom" />
+      </view>
+    </view>
+  </view>
+
+  <view class="van-card__footer">
+    <slot name="footer" />
+  </view>
+</view>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/card/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/cell-group/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 10 - 0
miniprogram_npm/vant-weapp/cell-group/index.js

@@ -0,0 +1,10 @@
+import { VantComponent } from '../common/component';
+VantComponent({
+    props: {
+        title: String,
+        border: {
+            type: Boolean,
+            value: true
+        }
+    }
+});

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

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

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

@@ -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

@@ -0,0 +1 @@
+@import '../common/index.wxss';.van-cell-group__title{font-size:14px;padding:15px 15px 5px;color:#999;line-height:16px}

+ 1 - 0
miniprogram_npm/vant-weapp/cell/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 37 - 0
miniprogram_npm/vant-weapp/cell/index.js

@@ -0,0 +1,37 @@
+import { link } from '../mixins/link';
+import { VantComponent } from '../common/component';
+VantComponent({
+    classes: [
+        'title-class',
+        'label-class',
+        'value-class',
+        'right-icon-class',
+        'hover-class'
+    ],
+    mixins: [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
+        }
+    },
+    methods: {
+        onClick(event) {
+            this.$emit('click', event.detail);
+            this.jumpLink();
+        }
+    }
+});

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

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

+ 45 - 0
miniprogram_npm/vant-weapp/cell/index.wxml

@@ -0,0 +1,45 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<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="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
+    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>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/cell/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/checkbox-group/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 39 - 0
miniprogram_npm/vant-weapp/checkbox-group/index.js

@@ -0,0 +1,39 @@
+import { VantComponent } from '../common/component';
+VantComponent({
+    field: true,
+    relation: {
+        name: 'checkbox',
+        type: 'descendant',
+        linked(target) {
+            this.children = this.children || [];
+            this.children.push(target);
+            this.updateChild(target);
+        },
+        unlinked(target) {
+            this.children = this.children.filter((child) => child !== target);
+        }
+    },
+    props: {
+        max: Number,
+        value: {
+            type: Array,
+            observer: 'updateChildren'
+        },
+        disabled: {
+            type: Boolean,
+            observer: 'updateChildren'
+        }
+    },
+    methods: {
+        updateChildren() {
+            (this.children || []).forEach((child) => this.updateChild(child));
+        },
+        updateChild(child) {
+            const { value, disabled } = this.data;
+            child.set({
+                value: value.indexOf(child.data.name) !== -1,
+                disabled: disabled || child.data.disabled
+            });
+        }
+    }
+});

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

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

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

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

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

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

+ 1 - 0
miniprogram_npm/vant-weapp/checkbox/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 74 - 0
miniprogram_npm/vant-weapp/checkbox/index.js

@@ -0,0 +1,74 @@
+import { VantComponent } from '../common/component';
+function emit(target, value) {
+    target.$emit('input', value);
+    target.$emit('change', value);
+}
+VantComponent({
+    field: true,
+    relation: {
+        name: 'checkbox-group',
+        type: 'ancestor',
+        linked(target) {
+            this.parent = target;
+        },
+        unlinked() {
+            this.parent = null;
+        }
+    },
+    classes: ['icon-class', 'label-class'],
+    props: {
+        value: Boolean,
+        disabled: Boolean,
+        useIconSlot: Boolean,
+        checkedColor: String,
+        labelPosition: String,
+        labelDisabled: Boolean,
+        shape: {
+            type: String,
+            value: 'round'
+        }
+    },
+    methods: {
+        emitChange(value) {
+            if (this.parent) {
+                this.setParentValue(this.parent, value);
+            }
+            else {
+                emit(this, value);
+            }
+        },
+        toggle() {
+            const { disabled, value } = this.data;
+            if (!disabled) {
+                this.emitChange(!value);
+            }
+        },
+        onClickLabel() {
+            const { labelDisabled, disabled, value } = this.data;
+            if (!disabled && !labelDisabled) {
+                this.emitChange(!value);
+            }
+        },
+        setParentValue(parent, value) {
+            const parentValue = parent.data.value.slice();
+            const { name } = this.data;
+            const { max } = parent.data;
+            if (value) {
+                if (max && parentValue.length >= max) {
+                    return;
+                }
+                if (parentValue.indexOf(name) === -1) {
+                    parentValue.push(name);
+                    emit(parent, parentValue);
+                }
+            }
+            else {
+                const index = parentValue.indexOf(name);
+                if (index !== -1) {
+                    parentValue.splice(index, 1);
+                    emit(parent, parentValue);
+                }
+            }
+        }
+    }
+});

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

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

+ 18 - 0
miniprogram_npm/vant-weapp/checkbox/index.wxml

@@ -0,0 +1,18 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<view class="van-checkbox custom-class">
+  <view class="van-checkbox__icon-wrap" bindtap="toggle">
+    <slot wx:if="{{ useIconSlot }}" name="icon" />
+    <van-icon
+      wx:else
+      name="success"
+      class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
+      style="{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
+      custom-class="icon-class"
+      custom-style="line-height: 20px;"
+    />
+  </view>
+  <view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
+    <slot />
+  </view>
+</view>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/checkbox/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/col/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 23 - 0
miniprogram_npm/vant-weapp/col/index.js

@@ -0,0 +1,23 @@
+import { VantComponent } from '../common/component';
+VantComponent({
+    relation: {
+        name: 'row',
+        type: 'ancestor'
+    },
+    props: {
+        span: Number,
+        offset: Number
+    },
+    data: {
+        style: ''
+    },
+    methods: {
+        setGutter(gutter) {
+            const padding = `${gutter / 2}px`;
+            const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : '';
+            if (style !== this.data.style) {
+                this.set({ style });
+            }
+        }
+    }
+});

+ 3 - 0
miniprogram_npm/vant-weapp/col/index.json

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

+ 8 - 0
miniprogram_npm/vant-weapp/col/index.wxml

@@ -0,0 +1,8 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<view
+  class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}"
+  style="{{ style }}"
+>
+  <slot />
+</view>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/col/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/collapse-item/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 96 - 0
miniprogram_npm/vant-weapp/collapse-item/index.js

@@ -0,0 +1,96 @@
+import { VantComponent } from '../common/component';
+const nextTick = () => new Promise(resolve => setTimeout(resolve, 20));
+VantComponent({
+    classes: ['title-class', 'content-class'],
+    relation: {
+        name: 'collapse',
+        type: 'ancestor',
+        linked(parent) {
+            this.parent = parent;
+        }
+    },
+    props: {
+        name: null,
+        title: null,
+        value: null,
+        icon: String,
+        label: String,
+        disabled: Boolean,
+        clickable: Boolean,
+        border: {
+            type: Boolean,
+            value: true
+        },
+        isLink: {
+            type: Boolean,
+            value: true
+        }
+    },
+    data: {
+        contentHeight: 0,
+        expanded: false,
+        transition: false
+    },
+    mounted() {
+        this.updateExpanded()
+            .then(nextTick)
+            .then(() => {
+            const data = { transition: true };
+            if (this.data.expanded) {
+                data.contentHeight = 'auto';
+            }
+            this.set(data);
+        });
+    },
+    methods: {
+        updateExpanded() {
+            if (!this.parent) {
+                return Promise.resolve();
+            }
+            const { value, accordion } = this.parent.data;
+            const { children = [] } = this.parent;
+            const { name } = this.data;
+            const index = children.indexOf(this);
+            const currentName = name == null ? index : name;
+            const expanded = accordion
+                ? value === currentName
+                : (value || []).some((name) => name === currentName);
+            const stack = [];
+            if (expanded !== this.data.expanded) {
+                stack.push(this.updateStyle(expanded));
+            }
+            stack.push(this.set({ index, expanded }));
+            return Promise.all(stack);
+        },
+        updateStyle(expanded) {
+            return this.getRect('.van-collapse-item__content')
+                .then((rect) => rect.height)
+                .then((height) => {
+                if (expanded) {
+                    return this.set({
+                        contentHeight: height ? `${height}px` : 'auto'
+                    });
+                }
+                return this.set({ contentHeight: `${height}px` })
+                    .then(nextTick)
+                    .then(() => this.set({ contentHeight: 0 }));
+            });
+        },
+        onClick() {
+            if (this.data.disabled) {
+                return;
+            }
+            const { name, expanded } = this.data;
+            const index = this.parent.children.indexOf(this);
+            const currentName = name == null ? index : name;
+            this.parent.switch(currentName, !expanded);
+        },
+        onTransitionEnd() {
+            if (this.data.expanded) {
+                this.set({
+                    contentHeight: 'auto'
+                });
+            }
+        }
+    }
+});

+ 6 - 0
miniprogram_npm/vant-weapp/collapse-item/index.json

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

+ 44 - 0
miniprogram_npm/vant-weapp/collapse-item/index.wxml

@@ -0,0 +1,44 @@
+<wxs src="../wxs/utils.wxs" module="utils" />
+
+<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
+  <van-cell
+    title="{{ title }}"
+    title-class="title-class"
+    icon="{{ icon }}"
+    value="{{ value }}"
+    label="{{ label }}"
+    is-link="{{ isLink }}"
+    clickable="{{ clickable }}"
+    border="{{ border && expanded }}"
+    class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}"
+    right-icon-class="van-cell__right-icon"
+    custom-class="van-cell"
+    hover-class="van-cell--hover"
+    bind:click="onClick"
+  >
+    <slot
+      name="title"
+      slot="title"
+    />
+    <slot
+      name="icon"
+      slot="icon"
+    />
+    <slot name="value" />
+    <slot
+      name="right-icon"
+      slot="right-icon"
+    />
+  </van-cell>
+  <view
+    class="{{ utils.bem('collapse-item__wrapper', { transition }) }}"
+    style="height: {{ contentHeight }};"
+    bind:transitionend="onTransitionEnd"
+  >
+    <view
+      class="van-collapse-item__content content-class"
+    >
+      <slot />
+    </view>
+  </view>
+</view>

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/collapse-item/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/collapse/index.d.ts

@@ -0,0 +1 @@
+export {};

+ 50 - 0
miniprogram_npm/vant-weapp/collapse/index.js

@@ -0,0 +1,50 @@
+import { VantComponent } from '../common/component';
+VantComponent({
+    relation: {
+        name: 'collapse-item',
+        type: 'descendant',
+        linked(child) {
+            this.children.push(child);
+        },
+        unlinked(child) {
+            this.children = this.children.filter((item) => item !== child);
+        }
+    },
+    props: {
+        value: {
+            type: null,
+            observer: 'updateExpanded'
+        },
+        accordion: {
+            type: Boolean,
+            observer: 'updateExpanded'
+        },
+        border: {
+            type: Boolean,
+            value: true
+        }
+    },
+    beforeCreate() {
+        this.children = [];
+    },
+    methods: {
+        updateExpanded() {
+            this.children.forEach((child) => {
+                child.updateExpanded();
+            });
+        },
+        switch(name, expanded) {
+            const { accordion, value } = this.data;
+            if (!accordion) {
+                name = expanded
+                    ? (value || []).concat(name)
+                    : (value || []).filter((activeName) => activeName !== name);
+            }
+            else {
+                name = expanded ? name : '';
+            }
+            this.$emit('change', name);
+            this.$emit('input', name);
+        }
+    }
+});

+ 3 - 0
miniprogram_npm/vant-weapp/collapse/index.json

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

+ 3 - 0
miniprogram_npm/vant-weapp/collapse/index.wxml

@@ -0,0 +1,3 @@
+<view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }}">
+  <slot />
+</view>

+ 1 - 0
miniprogram_npm/vant-weapp/collapse/index.wxss

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

+ 4 - 0
miniprogram_npm/vant-weapp/common/color.d.ts

@@ -0,0 +1,4 @@
+export declare const RED = "#f44";
+export declare const BLUE = "#1989fa";
+export declare const GREEN = "#07c160";
+export declare const ORANGE = "#ff976a";

+ 4 - 0
miniprogram_npm/vant-weapp/common/color.js

@@ -0,0 +1,4 @@
+export const RED = '#f44';
+export const BLUE = '#1989fa';
+export const GREEN = '#07c160';
+export const ORANGE = '#ff976a';

+ 3 - 0
miniprogram_npm/vant-weapp/common/component.d.ts

@@ -0,0 +1,3 @@
+import { VantComponentOptions, CombinedComponentInstance } from '../definitions/index';
+declare function VantComponent<Data, Props, Methods, Computed>(vantOptions?: VantComponentOptions<Data, Props, Methods, Computed, CombinedComponentInstance<Data, Props, Methods, Computed>>): void;
+export { VantComponent };

+ 48 - 0
miniprogram_npm/vant-weapp/common/component.js

@@ -0,0 +1,48 @@
+import { basic } from '../mixins/basic';
+import { observe } from '../mixins/observer/index';
+function mapKeys(source, target, map) {
+    Object.keys(map).forEach(key => {
+        if (source[key]) {
+            target[map[key]] = source[key];
+        }
+    });
+}
+function VantComponent(vantOptions = {}) {
+    const options = {};
+    mapKeys(vantOptions, options, {
+        data: 'data',
+        props: 'properties',
+        mixins: 'behaviors',
+        methods: 'methods',
+        beforeCreate: 'created',
+        created: 'attached',
+        mounted: 'ready',
+        relations: 'relations',
+        destroyed: 'detached',
+        classes: 'externalClasses'
+    });
+    const { relation } = vantOptions;
+    if (relation) {
+        options.relations = Object.assign(options.relations || {}, {
+            [`../${relation.name}/index`]: relation
+        });
+    }
+    // add default externalClasses
+    options.externalClasses = options.externalClasses || [];
+    options.externalClasses.push('custom-class');
+    // add default behaviors
+    options.behaviors = options.behaviors || [];
+    options.behaviors.push(basic);
+    // map field to form-field behavior
+    if (vantOptions.field) {
+        options.behaviors.push('wx://form-field');
+    }
+    // add default options
+    options.options = {
+        multipleSlots: true,
+        addGlobalClass: true
+    };
+    observe(vantOptions, options);
+    Component(options);
+}
+export { VantComponent };

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/common/index.wxss


+ 1 - 0
miniprogram_npm/vant-weapp/common/style/clearfix.wxss

@@ -0,0 +1 @@
+.van-clearfix:after{content:"";display:table;clear:both}

+ 1 - 0
miniprogram_npm/vant-weapp/common/style/ellipsis.wxss

@@ -0,0 +1 @@
+.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}

File diff suppressed because it is too large
+ 1 - 0
miniprogram_npm/vant-weapp/common/style/hairline.wxss


+ 0 - 0
miniprogram_npm/vant-weapp/common/style/mixins/clearfix.wxss


+ 0 - 0
miniprogram_npm/vant-weapp/common/style/mixins/ellipsis.wxss


+ 0 - 0
miniprogram_npm/vant-weapp/common/style/mixins/hairline.wxss


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