guhongwei 3 anni fa
commit
d462c60110
100 ha cambiato i file con 1395 aggiunte e 0 eliminazioni
  1. 31 0
      .eslintrc.js
  2. 14 0
      .gitignore
  3. 31 0
      app.js
  4. 63 0
      app.json
  5. 16 0
      app.wxss
  6. 74 0
      commpents/mobile-frame/foot.js
  7. 4 0
      commpents/mobile-frame/foot.json
  8. 29 0
      commpents/mobile-frame/foot.wxml
  9. 8 0
      commpents/mobile-frame/foot.wxss
  10. 50 0
      commpents/mobile-frame/mobile-main.js
  11. 7 0
      commpents/mobile-frame/mobile-main.json
  12. 11 0
      commpents/mobile-frame/mobile-main.wxml
  13. 22 0
      commpents/mobile-frame/mobile-main.wxss
  14. 26 0
      commpents/mobile-frame/top.js
  15. 4 0
      commpents/mobile-frame/top.json
  16. 7 0
      commpents/mobile-frame/top.wxml
  17. 35 0
      commpents/mobile-frame/top.wxss
  18. 40 0
      icon/icon.wxss
  19. BIN
      image/back.png
  20. BIN
      image/bisai.png
  21. BIN
      image/chuangjian.png
  22. BIN
      image/duiwu-01.png
  23. BIN
      image/duiwu.png
  24. BIN
      image/fen.jpg
  25. BIN
      image/head1.png
  26. BIN
      image/head2.png
  27. BIN
      image/hei.png
  28. BIN
      image/home.png
  29. BIN
      image/huang.png
  30. BIN
      image/icon_API.png
  31. BIN
      image/icon_API_HL.png
  32. BIN
      image/icon_component.png
  33. BIN
      image/icon_component_HL.png
  34. BIN
      image/logo.png
  35. BIN
      image/miaobiao-01.png
  36. BIN
      image/miaobiao.png
  37. BIN
      image/paiming.png
  38. BIN
      image/saishi-01.png
  39. BIN
      image/saishi.png
  40. BIN
      image/shenpi.png
  41. BIN
      image/shouye-01.png
  42. BIN
      image/shouye.png
  43. BIN
      image/team.png
  44. BIN
      image/tou.png
  45. BIN
      image/wodexiao-01.png
  46. BIN
      image/wodexiao.png
  47. 1 0
      miniprogram_npm/vant-weapp/action-sheet/index.d.ts
  48. 43 0
      miniprogram_npm/vant-weapp/action-sheet/index.js
  49. 8 0
      miniprogram_npm/vant-weapp/action-sheet/index.json
  50. 51 0
      miniprogram_npm/vant-weapp/action-sheet/index.wxml
  51. 1 0
      miniprogram_npm/vant-weapp/action-sheet/index.wxss
  52. 1 0
      miniprogram_npm/vant-weapp/area/index.d.ts
  53. 212 0
      miniprogram_npm/vant-weapp/area/index.js
  54. 6 0
      miniprogram_npm/vant-weapp/area/index.json
  55. 18 0
      miniprogram_npm/vant-weapp/area/index.wxml
  56. 1 0
      miniprogram_npm/vant-weapp/area/index.wxss
  57. 1 0
      miniprogram_npm/vant-weapp/badge-group/index.d.ts
  58. 43 0
      miniprogram_npm/vant-weapp/badge-group/index.js
  59. 3 0
      miniprogram_npm/vant-weapp/badge-group/index.json
  60. 3 0
      miniprogram_npm/vant-weapp/badge-group/index.wxml
  61. 1 0
      miniprogram_npm/vant-weapp/badge-group/index.wxss
  62. 1 0
      miniprogram_npm/vant-weapp/badge/index.d.ts
  63. 30 0
      miniprogram_npm/vant-weapp/badge/index.js
  64. 6 0
      miniprogram_npm/vant-weapp/badge/index.json
  65. 17 0
      miniprogram_npm/vant-weapp/badge/index.wxml
  66. 1 0
      miniprogram_npm/vant-weapp/badge/index.wxss
  67. 1 0
      miniprogram_npm/vant-weapp/button/index.d.ts
  68. 38 0
      miniprogram_npm/vant-weapp/button/index.js
  69. 7 0
      miniprogram_npm/vant-weapp/button/index.json
  70. 51 0
      miniprogram_npm/vant-weapp/button/index.wxml
  71. 1 0
      miniprogram_npm/vant-weapp/button/index.wxss
  72. 1 0
      miniprogram_npm/vant-weapp/card/index.d.ts
  73. 38 0
      miniprogram_npm/vant-weapp/card/index.js
  74. 6 0
      miniprogram_npm/vant-weapp/card/index.json
  75. 45 0
      miniprogram_npm/vant-weapp/card/index.wxml
  76. 1 0
      miniprogram_npm/vant-weapp/card/index.wxss
  77. 1 0
      miniprogram_npm/vant-weapp/cell-group/index.d.ts
  78. 10 0
      miniprogram_npm/vant-weapp/cell-group/index.js
  79. 3 0
      miniprogram_npm/vant-weapp/cell-group/index.json
  80. 9 0
      miniprogram_npm/vant-weapp/cell-group/index.wxml
  81. 1 0
      miniprogram_npm/vant-weapp/cell-group/index.wxss
  82. 1 0
      miniprogram_npm/vant-weapp/cell/index.d.ts
  83. 37 0
      miniprogram_npm/vant-weapp/cell/index.js
  84. 6 0
      miniprogram_npm/vant-weapp/cell/index.json
  85. 45 0
      miniprogram_npm/vant-weapp/cell/index.wxml
  86. 1 0
      miniprogram_npm/vant-weapp/cell/index.wxss
  87. 1 0
      miniprogram_npm/vant-weapp/checkbox-group/index.d.ts
  88. 39 0
      miniprogram_npm/vant-weapp/checkbox-group/index.js
  89. 3 0
      miniprogram_npm/vant-weapp/checkbox-group/index.json
  90. 1 0
      miniprogram_npm/vant-weapp/checkbox-group/index.wxml
  91. 1 0
      miniprogram_npm/vant-weapp/checkbox-group/index.wxss
  92. 1 0
      miniprogram_npm/vant-weapp/checkbox/index.d.ts
  93. 74 0
      miniprogram_npm/vant-weapp/checkbox/index.js
  94. 6 0
      miniprogram_npm/vant-weapp/checkbox/index.json
  95. 18 0
      miniprogram_npm/vant-weapp/checkbox/index.wxml
  96. 1 0
      miniprogram_npm/vant-weapp/checkbox/index.wxss
  97. 1 0
      miniprogram_npm/vant-weapp/col/index.d.ts
  98. 23 0
      miniprogram_npm/vant-weapp/col/index.js
  99. 3 0
      miniprogram_npm/vant-weapp/col/index.json
  100. 0 0
      miniprogram_npm/vant-weapp/col/index.wxml

+ 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: {},
+}

+ 14 - 0
.gitignore

@@ -0,0 +1,14 @@
+# Windows
+[Dd]esktop.ini
+Thumbs.db
+$RECYCLE.BIN/
+
+# macOS
+.DS_Store
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+
+# Node.js
+node_modules/

+ 31 - 0
app.js

@@ -0,0 +1,31 @@
+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.statusBarHeight + data.getMenu.height + (data.getMenu.top - data.statusBarHeight)*2);
+        this.globalData.client = data
+      }
+    })
+
+  },
+  globalData: {
+    userInfo: {},
+    // 微信用户openid,sessionKey
+    wxInfo: {},
+    client: {},
+    publicUrl: '', //
+  },
+  // 微信openid回调
+  toLogin: login.toLogin,
+  ...httpUtil
+})

+ 63 - 0
app.json

@@ -0,0 +1,63 @@
+{
+  "pages": [
+    "pages/me/index",
+    "pages/login/index",
+    "pages/home/index",
+    "pages/search/index",
+    "pages/administration/index",
+    "pages/team/index",
+    
+    "pages/index/index",
+    "pages/register/index",
+    "pages/logs/logs"
+  ],
+  "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": "key赛场",
+    "navigationBarTextStyle": "black",
+    "navigationStyle": "custom"
+  },
+  "requiredBackgroundModes": [
+    "location"
+  ],
+  "style": "v2",
+  "sitemapLocation": "sitemap.json",
+  "permission": {
+    "scope.userLocation": {
+      "desc": "你的位置信息将用于小程序位置接口的效果展示"
+    }
+  }
+}

+ 16 - 0
app.wxss

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

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

@@ -0,0 +1,74 @@
+// 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,
+    one: {
+      normal: '/image/shouye.png',
+      active: '/image/shouye-01.png',
+    },
+    two: {
+      normal: '/image/saishi.png',
+      active: '/image/saishi-01.png',
+    },
+    three: {
+      normal: '/image/miaobiao.png',
+      active: '/image/miaobiao-01.png',
+    },
+    four: {
+      normal: '/image/duiwu.png',
+      active: '/image/duiwu-01.png',
+    },
+    five: {
+      normal: '/image/wodexiao.png',
+      active: '/image/wodexiao-01.png',
+    },
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    // 跳转
+    tabPath(e) {
+      this.setData({ active: e.detail })
+      let route = e.detail == 0 ? 'home' : e.detail == 1 ? 'search' : e.detail == '2' ? 'administration' : e.detail == '3' ? 'team' : e.detail == '4' ? 'me' : '';
+      this.triggerEvent('tabPath', route)
+    },
+    search() {
+      let pages = getCurrentPages();
+      let currentPage = pages[pages.length - 1];
+      if (currentPage.route == 'pages/home/index') {
+        this.setData({ active: 0 })
+      } else if (currentPage.route == 'pages/search/index') {
+        this.setData({ active: 1 })
+      } else if (currentPage.route == 'pages/administration/index') {
+        this.setData({ active: 2 })
+      } else if (currentPage.route == 'pages/team/index') {
+        this.setData({ active: 3 })
+      } else if (currentPage.route == 'pages/me/index') {
+        this.setData({ active: 4 })
+      }
+    }
+  }
+})
+

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

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

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

@@ -0,0 +1,29 @@
+<view class="foot">
+  <van-tabbar active="{{ active }}" bind:change="tabPath">
+    <van-tabbar-item>
+      <image slot="icon" src="{{ one.normal }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      <image slot="icon-active" src="{{ one.active }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      首页
+    </van-tabbar-item>
+    <van-tabbar-item>
+      <image slot="icon" src="{{ two.normal }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      <image slot="icon-active" src="{{ two.active }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      查询比赛
+    </van-tabbar-item>
+    <van-tabbar-item>
+      <image slot="icon" src="{{ three.normal }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      <image slot="icon-active" src="{{ three.active }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      比赛管理
+    </van-tabbar-item>
+    <van-tabbar-item>
+      <image slot="icon" src="{{ four.normal }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      <image slot="icon-active" src="{{ four.active }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      我的团队
+    </van-tabbar-item>
+    <van-tabbar-item>
+      <image slot="icon" src="{{ five.normal }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      <image slot="icon-active" src="{{ five.active }}" mode="aspectFit" style="width: 24px; height: 26px;" />
+      我的
+    </van-tabbar-item>
+  </van-tabbar>
+</view>

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

@@ -0,0 +1,8 @@
+.foot {
+  float: left;
+  width: 100%;
+  background-color: #ffffff;
+}
+.iocn{
+  text-align: center;
+}

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

@@ -0,0 +1,50 @@
+// 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', '1')
+    },
+    tabPath(e) {
+      this.triggerEvent('tabPath', e)
+    },
+    searchHeight() {
+      let frameStyle = this.data.frameStyle;
+      let client = app.globalData.client;
+      let infoHeight = client.windowHeight;
+      // 减去状态栏
+      if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+      // 减去菜单栏
+      if (frameStyle.useBar) infoHeight = infoHeight - 50;
+      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>

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

@@ -0,0 +1,22 @@
+.main {
+  float: left;
+  width: 100%;
+  background-color: #ffffff;
+}
+
+.main .one {
+  float: left;
+  width: 100%;
+}
+
+.main .info {
+  float: left;
+  width: 100%;
+  overflow-y: auto;
+  background-color: #ffffff;
+}
+
+.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: #ffffff;
+}
+
+.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: #000000;
+  font-weight: 600;
+}
+
+.top .right {
+  float: left;
+  width: 15%;
+}

+ 40 - 0
icon/icon.wxss

@@ -0,0 +1,40 @@
+@font-face {
+  font-family: "iconfont"; /* Project id 3244772 */
+  src: url('//at.alicdn.com/t/font_3244772_sq4yuxqz46.woff2?t=1647243918406') format('woff2'),
+       url('//at.alicdn.com/t/font_3244772_sq4yuxqz46.woff?t=1647243918406') format('woff'),
+       url('//at.alicdn.com/t/font_3244772_sq4yuxqz46.ttf?t=1647243918406') format('truetype');
+}
+
+.iconfont {
+  font-family: "iconfont" !important;
+  font-size: 16px;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-shenhe:before {
+  content: "\e61d";
+  font-size: 20px;
+}
+
+.icon-xiugaimima:before {
+  content: "\e681";
+  font-size: 22px;
+  margin-top: 10px;
+}
+
+.icon-ren_jiesantuandui_line:before {
+  content: "\e844";
+  font-size: 22px;
+}
+
+.icon-shangchuanzhaopian:before {
+  content: "\eb4f";
+  font-size: 17px;
+}
+
+.icon-qi:before {
+  content: "\e61f";
+  color: rgb(14, 176, 240);
+}

BIN
image/back.png


BIN
image/bisai.png


BIN
image/chuangjian.png


BIN
image/duiwu-01.png


BIN
image/duiwu.png


BIN
image/fen.jpg


BIN
image/head1.png


BIN
image/head2.png


BIN
image/hei.png


BIN
image/home.png


BIN
image/huang.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


BIN
image/miaobiao-01.png


BIN
image/miaobiao.png


BIN
image/paiming.png


BIN
image/saishi-01.png


BIN
image/saishi.png


BIN
image/shenpi.png


BIN
image/shouye-01.png


BIN
image/shouye.png


BIN
image/team.png


BIN
image/tou.png


BIN
image/wodexiao-01.png


BIN
image/wodexiao.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
+}

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


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