├── .gitignore
├── README.md
├── app.js
├── app.json
├── app.wxss
├── config
└── gql.js
├── dist
├── action-sheet
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── area
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── badge-group
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── badge
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── button
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── card
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── cell-group
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── cell
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── checkbox-group
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── checkbox
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── col
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── collapse-item
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── collapse
│ ├── index.js
│ ├── index.json
│ └── index.wxml
├── common
│ ├── color.js
│ ├── component.js
│ ├── index.wxss
│ ├── style
│ │ ├── clearfix.wxss
│ │ ├── ellipsis.wxss
│ │ ├── hairline.wxss
│ │ ├── mixins
│ │ │ ├── clearfix.wxss
│ │ │ ├── ellipsis.wxss
│ │ │ └── hairline.wxss
│ │ └── var.wxss
│ └── utils.js
├── datetime-picker
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── dialog
│ ├── dialog.js
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── field
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── goods-action-button
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── goods-action-icon
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── goods-action
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── icon
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── info
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── loading
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── mixins
│ ├── basic.js
│ ├── button.js
│ ├── iphonex.js
│ ├── link.js
│ ├── observer
│ │ ├── behavior.js
│ │ ├── index.js
│ │ └── props.js
│ ├── open-type.js
│ ├── touch.js
│ └── transition.js
├── nav-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── notice-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── notify
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ └── notify.js
├── overlay
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── panel
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── picker-column
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── picker
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── popup
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── progress
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── radio-group
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── radio
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── rate
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── row
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── search
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── slider
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── stepper
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── steps
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── submit-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── swipe-cell
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── switch-cell
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── switch
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tab
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tabbar-item
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tabbar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tabs
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tag
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── toast
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ └── toast.js
├── transition
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tree-select
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
└── wxs
│ ├── array.wxs
│ ├── bem.wxs
│ ├── memoize.wxs
│ ├── object.wxs
│ └── utils.wxs
├── images
├── home.png
├── home_s.png
├── home_s.svg
├── settings.png
├── settings_s.png
├── timeline.png
└── timeline_s.png
├── pages
├── home
│ ├── contact
│ │ ├── contact.js
│ │ ├── contact.json
│ │ ├── contact.wxml
│ │ └── contact.wxss
│ ├── home.js
│ ├── home.json
│ ├── home.wxml
│ ├── home.wxss
│ └── showMy
│ │ ├── showMy.js
│ │ ├── showMy.json
│ │ ├── showMy.wxml
│ │ └── showMy.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── manage
│ ├── allOrders
│ │ ├── allOrders.js
│ │ ├── allOrders.json
│ │ ├── allOrders.wxml
│ │ ├── allOrders.wxss
│ │ └── selectedOrders
│ │ │ ├── selectedOrders.js
│ │ │ ├── selectedOrders.json
│ │ │ ├── selectedOrders.wxml
│ │ │ └── selectedOrders.wxss
│ ├── manage.js
│ ├── manage.json
│ ├── manage.wxml
│ ├── manage.wxss
│ └── release
│ │ ├── release.js
│ │ ├── release.json
│ │ ├── release.wxml
│ │ ├── release.wxss
│ │ ├── serverAdd
│ │ ├── serverAdd.js
│ │ ├── serverAdd.json
│ │ ├── serverAdd.wxml
│ │ └── serverAdd.wxss
│ │ └── serviceShow
│ │ ├── serviceRelease
│ │ ├── serviceRelease.js
│ │ ├── serviceRelease.json
│ │ ├── serviceRelease.wxml
│ │ └── serviceRelease.wxss
│ │ ├── serviceShow.js
│ │ ├── serviceShow.json
│ │ ├── serviceShow.wxml
│ │ └── serviceShow.wxss
├── message
│ ├── message.js
│ ├── message.json
│ ├── message.wxml
│ └── message.wxss
├── server
│ ├── server.js
│ ├── server.json
│ ├── server.wxml
│ └── server.wxss
├── service
│ ├── service.js
│ ├── service.json
│ ├── service.wxml
│ └── service.wxss
└── vant
│ ├── vant.js
│ ├── vant.json
│ ├── vant.wxml
│ └── vant.wxss
├── project.config.json
└── utils
└── util.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows
2 | [Dd]esktop.ini
3 | Thumbs.db
4 | $RECYCLE.BIN/
5 |
6 | # macOS
7 | .DS_Store
8 | .fseventsd
9 | .Spotlight-V100
10 | .TemporaryItems
11 | .Trashes
12 |
13 | # Node.js
14 | node_modules/
15 |
16 | .idea
17 | package-lock.json
18 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | // 展示本地存储能力
5 | var logs = wx.getStorageSync('logs') || [];
6 | logs.unshift(Date.now());
7 | wx.setStorageSync('logs', logs);
8 |
9 | // 登录
10 | wx.login({
11 | success: res => {
12 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
13 | }
14 | });
15 | // 获取用户信息
16 | wx.getSetting({
17 | success: res => {
18 | if (res.authSetting['scope.userInfo']) {
19 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
20 | wx.getUserInfo({
21 | success: res => {
22 | // 可以将 res 发送给后台解码出 unionId
23 | this.globalData.userInfo = res.userInfo
24 |
25 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
26 | // 所以此处加入 callback 以防止这种情况
27 | if (this.userInfoReadyCallback) {
28 | this.userInfoReadyCallback(res)
29 | }
30 | }
31 | })
32 | }
33 | }
34 | })
35 | },
36 | globalData: {
37 | userID: 'handsome'
38 | }
39 | });
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/server/server",
4 | "pages/home/home",
5 | "pages/manage/manage",
6 | "pages/service/service",
7 | "pages/message/message",
8 | "pages/vant/vant"
9 | ],
10 | "window": {
11 | "backgroundTextStyle": "light",
12 | "navigationBarBackgroundColor": "#fff",
13 | "navigationBarTitleText": "WeChat",
14 | "navigationBarTextStyle": "black"
15 | },
16 | "tabBar": {
17 | "selectedColor": "#353535",
18 | "list": [
19 | {
20 | "pagePath": "pages/server/server",
21 | "text": "预约",
22 | "iconPath": "images/timeline.png",
23 | "selectedIconPath": "images/timeline_s.png"
24 | },
25 | {
26 | "pagePath": "pages/home/home",
27 | "text": "我的",
28 | "iconPath": "images/home.png",
29 | "selectedIconPath": "images/home_s.png"
30 | },
31 | {
32 | "pagePath": "pages/manage/manage",
33 | "text": "管理",
34 | "iconPath": "images/settings.png",
35 | "selectedIconPath": "images/settings_s.png"
36 | }
37 | ]
38 | }
39 | }
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/dist/action-sheet/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex],
5 | props: {
6 | show: Boolean,
7 | title: String,
8 | cancelText: String,
9 | zIndex: {
10 | type: Number,
11 | value: 100
12 | },
13 | actions: {
14 | type: Array,
15 | value: []
16 | },
17 | overlay: {
18 | type: Boolean,
19 | value: true
20 | },
21 | closeOnClickOverlay: {
22 | type: Boolean,
23 | value: true
24 | }
25 | },
26 | methods: {
27 | onSelect: function onSelect(event) {
28 | var index = event.currentTarget.dataset.index;
29 | var item = this.data.actions[index];
30 |
31 | if (item && !item.disabled && !item.loading) {
32 | this.$emit('select', item);
33 | }
34 | },
35 | onCancel: function onCancel() {
36 | this.$emit('cancel');
37 | },
38 | onClose: function onClose() {
39 | this.$emit('close');
40 | }
41 | }
42 | });
--------------------------------------------------------------------------------
/dist/action-sheet/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-popup": "../popup/index",
6 | "van-loading": "../loading/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/dist/action-sheet/index.wxml:
--------------------------------------------------------------------------------
1 |
11 |
19 |
20 |
21 |
35 |
36 |
41 | {{ cancelText }}
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/dist/action-sheet/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff}.van-action-sheet__cancel:active,.van-action-sheet__item:active{background-color:#e8e8e8}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel::before{display:block;content:' ';height:10px;background-color:#f8f8f8}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled:active{background-color:#fff}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80}.van-action-sheet__header{font-size:16px;font-weight:500;line-height:44px;text-align:center}.van-action-sheet__close{position:absolute!important;top:0;right:0;padding:0 15px;font-size:18px!important;line-height:inherit!important;color:#999}
--------------------------------------------------------------------------------
/dist/area/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../loading/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/area/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 取消
4 | {{ title }}
5 | 确定
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
27 | {{ item.name }}
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/dist/area/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker{-webkit-text-size-adjust:100%;position:relative;overflow:hidden;background-color:#fff;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;line-height:44px}.van-picker__cancel,.van-picker__confirm{color:#1989fa;padding:0 15px;font-size:14px}.van-picker__cancel:active,.van-picker__confirm:active{background-color:#e8e8e8}.van-picker__title{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-picker__columns{position:relative}.van-picker__loading{display:-webkit-flex;display:flex;z-index:4;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:rgba(255,255,255,.9)}.van-picker-column{-webkit-flex:1;flex:1;overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#333}.van-picker-column__item--selected{font-weight:500}.van-picker-column__item--disabled{opacity:.3}
--------------------------------------------------------------------------------
/dist/badge-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { isNumber } from '../common/utils';
3 | VantComponent({
4 | relation: {
5 | name: 'badge',
6 | type: 'descendant',
7 | linked: function linked(target) {
8 | this.badges.push(target);
9 | this.setActive();
10 | },
11 | unlinked: function unlinked(target) {
12 | this.badges = this.badges.filter(function (item) {
13 | return item !== target;
14 | });
15 | this.setActive();
16 | }
17 | },
18 | props: {
19 | active: {
20 | type: Number,
21 | value: 0
22 | }
23 | },
24 | watch: {
25 | active: 'setActive'
26 | },
27 | beforeCreate: function beforeCreate() {
28 | this.badges = [];
29 | this.currentActive = -1;
30 | },
31 | methods: {
32 | setActive: function setActive(badge) {
33 | var active = this.data.active;
34 | var badges = this.badges;
35 |
36 | if (badge && !isNumber(badge)) {
37 | active = badges.indexOf(badge);
38 | }
39 |
40 | if (active === this.currentActive) {
41 | return;
42 | }
43 |
44 | if (this.currentActive !== -1 && badges[this.currentActive]) {
45 | this.$emit('change', active);
46 | badges[this.currentActive].setActive(false);
47 | }
48 |
49 | if (badges[active]) {
50 | badges[active].setActive(true);
51 | this.currentActive = active;
52 | }
53 | }
54 | }
55 | });
--------------------------------------------------------------------------------
/dist/badge-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/badge-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/dist/badge-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-badge-group{width:85px}
--------------------------------------------------------------------------------
/dist/badge/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | type: 'ancestor',
5 | name: 'badge-group'
6 | },
7 | props: {
8 | info: null,
9 | title: String
10 | },
11 | methods: {
12 | onClick: function onClick() {
13 | var group = this.getRelationNodes('../badge-group/index')[0];
14 |
15 | if (group) {
16 | group.setActive(this);
17 | }
18 | },
19 | setActive: function setActive(active) {
20 | this.set({
21 | active: active
22 | });
23 | }
24 | }
25 | });
--------------------------------------------------------------------------------
/dist/badge/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-info": "../info/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/badge/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | {{ title }}
9 |
10 |
11 |
--------------------------------------------------------------------------------
/dist/badge/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-badge{display:block;overflow:hidden;font-size:14px;line-height:1.4;-webkit-user-select:none;user-select:none;color:#7d7e80;word-break:break-all;box-sizing:border-box;padding:20px 12px 20px 9px;background-color:#f8f8f8;border-left:3px solid transparent}.van-badge:active{background-color:#e8e8e8}.van-badge::after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active::after{border-right-width:1px}.van-badge--active,.van-badge--active:active{background-color:#fff}.van-badge__text{position:relative}
--------------------------------------------------------------------------------
/dist/button/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { button } from '../mixins/button';
3 | import { openType } from '../mixins/open-type';
4 | VantComponent({
5 | classes: ['loading-class'],
6 | mixins: [button, openType],
7 | props: {
8 | plain: Boolean,
9 | block: Boolean,
10 | round: Boolean,
11 | square: Boolean,
12 | loading: Boolean,
13 | disabled: Boolean,
14 | type: {
15 | type: String,
16 | value: 'default'
17 | },
18 | size: {
19 | type: String,
20 | value: 'normal'
21 | }
22 | },
23 | methods: {
24 | onClick: function onClick() {
25 | if (!this.data.disabled && !this.data.loading) {
26 | this.$emit('click');
27 | }
28 | }
29 | }
30 | });
--------------------------------------------------------------------------------
/dist/button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../loading/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/dist/button/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
29 |
--------------------------------------------------------------------------------
/dist/button/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-button{position:relative;padding:0;display:inline-block;height:44px;line-height:42px;border-radius:2px;box-sizing:border-box;font-size:16px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button::after{content:" ";position:absolute;top:50%;left:50%;opacity:0;width:100%;height:100%;border:inherit;border-color:#000;background-color:#000;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:active::after{opacity:.15}.van-button--unclickable::after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #eee}.van-button--primary{color:#fff;background-color:#4b0;border:1px solid #4b0}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#ff976a;border:1px solid #ff976a}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#4b0}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#ff976a}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;padding:0 8px;min-width:60px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;line-height:20px;font-size:10px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{width:100%;display:block}.van-button--round{border-radius:10em}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}
--------------------------------------------------------------------------------
/dist/card/index.js:
--------------------------------------------------------------------------------
1 | import { link } from '../mixins/link';
2 | import { VantComponent } from '../common/component';
3 | VantComponent({
4 | classes: ['num-class', 'desc-class', 'thumb-class', 'title-class', 'price-class', 'origin-price-class'],
5 | mixins: [link],
6 | props: {
7 | tag: String,
8 | num: String,
9 | desc: String,
10 | thumb: String,
11 | title: String,
12 | price: String,
13 | centered: Boolean,
14 | lazyLoad: Boolean,
15 | thumbLink: String,
16 | originPrice: String,
17 | thumbMode: {
18 | type: String,
19 | value: 'aspectFit'
20 | },
21 | currency: {
22 | type: String,
23 | value: '¥'
24 | }
25 | },
26 | methods: {
27 | onClickThumb: function onClickThumb() {
28 | this.jumpLink('thumbLink');
29 | }
30 | }
31 | });
--------------------------------------------------------------------------------
/dist/card/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-tag": "../tag/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/card/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
17 | {{ tag }}
18 |
19 |
20 |
21 |
22 | {{ title }}
23 |
24 |
25 | {{ desc }}
26 |
27 |
28 |
29 |
30 |
31 | {{ currency }} {{ price }}
32 | {{ currency }} {{ originPrice }}
33 | x {{ num }}
34 |
35 |
36 |
37 |
40 |
41 |
--------------------------------------------------------------------------------
/dist/card/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-card{position:relative;display:-webkit-flex;display:flex;padding:5px 15px;font-size:12px;color:#333;background:#fafafa;box-sizing:border-box;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-card--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;width:90px;height:90px;margin-right:10px;-webkit-flex:none;flex:none}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;height:90px;-webkit-flex:1;flex:1}.van-card__desc,.van-card__title{line-height:17px;word-break:break-all}.van-card__title{max-height:34px;font-weight:700}.van-card__desc{max-height:17px;color:#7d7e80}.van-card__bottom{position:absolute;bottom:0;left:0;width:100%;line-height:17px}.van-card__price{display:inline-block;font-weight:700;color:#f44}.van-card__origin-price{display:inline-block;margin-left:5px;font-size:10px;color:#7d7e80;text-decoration:line-through}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{width:100%;text-align:right;-webkit-flex:none;flex:none}
--------------------------------------------------------------------------------
/dist/cell-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | border: {
5 | type: Boolean,
6 | value: true
7 | }
8 | }
9 | });
--------------------------------------------------------------------------------
/dist/cell-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/cell-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/dist/cell-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/dist/cell/index.js:
--------------------------------------------------------------------------------
1 | import { link } from '../mixins/link';
2 | import { VantComponent } from '../common/component';
3 | VantComponent({
4 | classes: ['title-class', 'label-class', 'value-class', 'right-icon-class'],
5 | mixins: [link],
6 | props: {
7 | title: null,
8 | value: null,
9 | icon: String,
10 | size: String,
11 | label: String,
12 | center: Boolean,
13 | isLink: Boolean,
14 | required: Boolean,
15 | clickable: Boolean,
16 | titleWidth: String,
17 | customStyle: String,
18 | arrowDirection: String,
19 | border: {
20 | type: Boolean,
21 | value: true
22 | }
23 | },
24 | methods: {
25 | onClick: function onClick(event) {
26 | this.$emit('click', event.detail);
27 | this.jumpLink();
28 | }
29 | }
30 | });
--------------------------------------------------------------------------------
/dist/cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/dist/cell/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
14 |
15 |
16 |
20 |
21 | {{ title }}
22 | {{ label }}
23 |
24 |
25 |
26 |
27 |
28 | {{ value }}
29 |
30 |
31 |
32 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/dist/cell/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-cell{width:100%;display:-webkit-flex;display:flex;padding:10px 15px;box-sizing:border-box;line-height:24px;position:relative;background-color:#fff;color:#333;font-size:14px}.van-cell::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:auto;left:15px;right:0;bottom:0;-webkit-transform:scaleY(.5);transform:scaleY(.5);border-bottom:1px solid #eee}.van-cell--borderless::after{display:none}.van-cell-group{background-color:#fff}.van-cell__label{color:#999;font-size:12px;margin-top:3px;line-height:18px}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__value{color:#999;overflow:hidden;text-align:right;vertical-align:middle}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;font-size:16px}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#999}.van-cell__left-icon{line-height:24px;vertical-align:middle}.van-cell__right-icon{line-height:24px}.van-cell--clickable:active{background-color:#e8e8e8}.van-cell--required{overflow:visible}.van-cell--required::before{content:'*';position:absolute;left:7px;font-size:14px;color:#f44}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-bottom:12px}.van-cell--large .van-cell__title{font-size:16px}.van-cell--large .van-cell__label{font-size:14px}
--------------------------------------------------------------------------------
/dist/checkbox-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'checkbox',
6 | type: 'descendant',
7 | linked: function linked(target) {
8 | var _this$data = this.data,
9 | value = _this$data.value,
10 | disabled = _this$data.disabled;
11 | target.set({
12 | value: value.indexOf(target.data.name) !== -1,
13 | disabled: disabled || target.data.disabled
14 | });
15 | }
16 | },
17 | props: {
18 | max: Number,
19 | value: Array,
20 | disabled: Boolean
21 | },
22 | watch: {
23 | value: function value(_value) {
24 | var children = this.getRelationNodes('../checkbox/index');
25 | children.forEach(function (child) {
26 | child.set({
27 | value: _value.indexOf(child.data.name) !== -1
28 | });
29 | });
30 | },
31 | disabled: function disabled(_disabled) {
32 | var children = this.getRelationNodes('../checkbox/index');
33 | children.forEach(function (child) {
34 | child.set({
35 | disabled: _disabled || child.data.disabled
36 | });
37 | });
38 | }
39 | }
40 | });
--------------------------------------------------------------------------------
/dist/checkbox-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/checkbox-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/dist/checkbox-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/dist/checkbox/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'checkbox-group',
6 | type: 'ancestor'
7 | },
8 | classes: ['icon-class', 'label-class'],
9 | props: {
10 | value: null,
11 | disabled: Boolean,
12 | useIconSlot: Boolean,
13 | checkedColor: String,
14 | labelPosition: String,
15 | labelDisabled: Boolean,
16 | shape: {
17 | type: String,
18 | value: 'round'
19 | }
20 | },
21 | methods: {
22 | emitChange: function emitChange(value) {
23 | var parent = this.getRelationNodes('../checkbox-group/index')[0];
24 |
25 | if (parent) {
26 | this.setParentValue(parent, value);
27 | } else {
28 | this.$emit('input', value);
29 | this.$emit('change', value);
30 | }
31 | },
32 | toggle: function toggle() {
33 | if (!this.data.disabled) {
34 | this.emitChange(!this.data.value);
35 | }
36 | },
37 | onClickLabel: function onClickLabel() {
38 | if (!this.data.disabled && !this.data.labelDisabled) {
39 | this.emitChange(!this.data.value);
40 | }
41 | },
42 | setParentValue: function setParentValue(parent, value) {
43 | var parentValue = parent.data.value.slice();
44 | var name = this.data.name;
45 |
46 | if (value) {
47 | if (parent.data.max && parentValue.length >= parent.data.max) {
48 | return;
49 | }
50 | /* istanbul ignore else */
51 |
52 |
53 | if (parentValue.indexOf(name) === -1) {
54 | parentValue.push(name);
55 | parent.$emit('input', parentValue);
56 | parent.$emit('change', parentValue);
57 | }
58 | } else {
59 | var index = parentValue.indexOf(name);
60 | /* istanbul ignore else */
61 |
62 | if (index !== -1) {
63 | parentValue.splice(index, 1);
64 | parent.$emit('input', parentValue);
65 | parent.$emit('change', parentValue);
66 | }
67 | }
68 | }
69 | }
70 | });
--------------------------------------------------------------------------------
/dist/checkbox/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/checkbox/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/dist/checkbox/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-checkbox{overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{display:inline-block;line-height:20px;vertical-align:middle}.van-checkbox__icon{display:block;font-size:14px;width:20px;height:20px;color:transparent;text-align:center;box-sizing:border-box;border:1px solid #e5e5e5;transition:.2s}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;border-color:#1989fa;background-color:#1989fa}.van-checkbox__icon--disabled{border-color:#c9c9c9;background-color:#eee}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9}.van-checkbox__label{color:#333;margin-left:10px}.van-checkbox__label--left{float:left;margin:0 10px 0 0}.van-checkbox__label--disabled{color:#c9c9c9}.van-checkbox__label:empty{margin:0}
--------------------------------------------------------------------------------
/dist/col/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'row',
5 | type: 'ancestor'
6 | },
7 | props: {
8 | span: Number,
9 | offset: Number
10 | },
11 | data: {
12 | style: ''
13 | },
14 | methods: {
15 | setGutter: function setGutter(gutter) {
16 | var padding = gutter / 2 + "px";
17 | var style = gutter ? "padding-left: " + padding + "; padding-right: " + padding + ";" : '';
18 |
19 | if (style !== this.data.style) {
20 | this.set({
21 | style: style
22 | });
23 | }
24 | }
25 | }
26 | });
--------------------------------------------------------------------------------
/dist/col/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/col/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dist/col/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%}
--------------------------------------------------------------------------------
/dist/collapse-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/collapse-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
20 |
24 |
25 |
29 |
30 |
36 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/dist/collapse-item/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:.3s}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c9c9c9!important}.van-collapse-item__title--disabled .van-cell:active{background-color:#fff!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{color:#999;padding:15px;font-size:13px;line-height:1.5;background-color:#fff}
--------------------------------------------------------------------------------
/dist/collapse/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'collapse-item',
5 | type: 'descendant',
6 | linked: function linked(child) {
7 | this.set({
8 | items: this.data.items.concat([child])
9 | }, function () {
10 | child.updateExpanded();
11 | });
12 | }
13 | },
14 | props: {
15 | accordion: Boolean,
16 | value: null
17 | },
18 | data: {
19 | items: []
20 | },
21 | watch: {
22 | value: function value() {
23 | this.data.items.forEach(function (child) {
24 | child.updateExpanded();
25 | });
26 | },
27 | accordion: function accordion() {
28 | this.data.items.forEach(function (child) {
29 | child.updateExpanded();
30 | });
31 | }
32 | },
33 | methods: {
34 | switch: function _switch(name, expanded) {
35 | var _this$data = this.data,
36 | accordion = _this$data.accordion,
37 | value = _this$data.value;
38 |
39 | if (!accordion) {
40 | name = expanded ? value.concat(name) : value.filter(function (activeName) {
41 | return activeName !== name;
42 | });
43 | } else {
44 | name = expanded ? name : '';
45 | }
46 |
47 | this.$emit('change', name);
48 | this.$emit('input', name);
49 | }
50 | }
51 | });
--------------------------------------------------------------------------------
/dist/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/collapse/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/dist/common/color.js:
--------------------------------------------------------------------------------
1 | export var RED = '#f44';
2 | export var BLUE = '#1989fa';
3 | export var GREEN = '#4b0';
--------------------------------------------------------------------------------
/dist/common/component.js:
--------------------------------------------------------------------------------
1 | import { basic } from '../mixins/basic';
2 | import { observe } from '../mixins/observer/index';
3 |
4 | function mapKeys(source, target, map) {
5 | Object.keys(map).forEach(function (key) {
6 | if (source[key]) {
7 | target[map[key]] = source[key];
8 | }
9 | });
10 | }
11 |
12 | function VantComponent(vantOptions) {
13 | if (vantOptions === void 0) {
14 | vantOptions = {};
15 | }
16 |
17 | var options = {};
18 | mapKeys(vantOptions, options, {
19 | data: 'data',
20 | props: 'properties',
21 | mixins: 'behaviors',
22 | methods: 'methods',
23 | beforeCreate: 'created',
24 | created: 'attached',
25 | mounted: 'ready',
26 | relations: 'relations',
27 | destroyed: 'detached',
28 | classes: 'externalClasses'
29 | });
30 | var _vantOptions = vantOptions,
31 | relation = _vantOptions.relation;
32 |
33 | if (relation) {
34 | options.relations = Object.assign(options.relations || {}, {
35 | ["../" + relation.name + "/index"]: relation
36 | });
37 | } // add default externalClasses
38 |
39 |
40 | options.externalClasses = options.externalClasses || [];
41 | options.externalClasses.push('custom-class'); // add default behaviors
42 |
43 | options.behaviors = options.behaviors || [];
44 | options.behaviors.push(basic); // map field to form-field behavior
45 |
46 | if (vantOptions.field) {
47 | options.behaviors.push('wx://form-field');
48 | } // add default options
49 |
50 |
51 | options.options = {
52 | multipleSlots: true,
53 | addGlobalClass: true
54 | };
55 | observe(vantOptions, options);
56 | Component(options);
57 | }
58 |
59 | export { VantComponent };
--------------------------------------------------------------------------------
/dist/common/index.wxss:
--------------------------------------------------------------------------------
1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}
--------------------------------------------------------------------------------
/dist/common/style/clearfix.wxss:
--------------------------------------------------------------------------------
1 | .van-clearfix::after{content:'';display:table;clear:both}
--------------------------------------------------------------------------------
/dist/common/style/ellipsis.wxss:
--------------------------------------------------------------------------------
1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
--------------------------------------------------------------------------------
/dist/common/style/hairline.wxss:
--------------------------------------------------------------------------------
1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}
--------------------------------------------------------------------------------
/dist/common/style/mixins/clearfix.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/dist/common/style/mixins/clearfix.wxss
--------------------------------------------------------------------------------
/dist/common/style/mixins/ellipsis.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/dist/common/style/mixins/ellipsis.wxss
--------------------------------------------------------------------------------
/dist/common/style/mixins/hairline.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/dist/common/style/mixins/hairline.wxss
--------------------------------------------------------------------------------
/dist/common/style/var.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/dist/common/style/var.wxss
--------------------------------------------------------------------------------
/dist/common/utils.js:
--------------------------------------------------------------------------------
1 | function isDef(value) {
2 | return value !== undefined && value !== null;
3 | }
4 |
5 | function isObj(x) {
6 | var type = typeof x;
7 | return x !== null && (type === 'object' || type === 'function');
8 | }
9 |
10 | function isNumber(value) {
11 | return /^\d+$/.test(value);
12 | }
13 |
14 | function range(num, min, max) {
15 | return Math.min(Math.max(num, min), max);
16 | }
17 |
18 | export { isObj, isDef, isNumber, range };
--------------------------------------------------------------------------------
/dist/datetime-picker/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../loading/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/datetime-picker/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ cancelButtonText }}
4 | {{ title }}
5 | {{ confirmButtonText }}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
26 | {{ item }}
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/dist/datetime-picker/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker{-webkit-text-size-adjust:100%;position:relative;overflow:hidden;background-color:#fff;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;line-height:44px}.van-picker__cancel,.van-picker__confirm{color:#1989fa;padding:0 15px;font-size:14px}.van-picker__cancel:active,.van-picker__confirm:active{background-color:#e8e8e8}.van-picker__title{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-picker__columns{position:relative}.van-picker__loading{display:-webkit-flex;display:flex;z-index:4;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:rgba(255,255,255,.9)}.van-picker-column{-webkit-flex:1;flex:1;overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
--------------------------------------------------------------------------------
/dist/dialog/dialog.js:
--------------------------------------------------------------------------------
1 | function _extends() {
2 | _extends = Object.assign || function (target) {
3 | for (var i = 1; i < arguments.length; i++) {
4 | var source = arguments[i];
5 | for (var key in source) {
6 | if (Object.prototype.hasOwnProperty.call(source, key)) {
7 | target[key] = source[key];
8 | }
9 | }
10 | }
11 | return target;
12 | };
13 | return _extends.apply(this, arguments);
14 | }
15 |
16 | var queue = [];
17 |
18 | function getContext() {
19 | var pages = getCurrentPages();
20 | return pages[pages.length - 1];
21 | }
22 |
23 | var Dialog = function Dialog(options) {
24 | options = _extends({}, Dialog.currentOptions, options);
25 | return new Promise(function (resolve, reject) {
26 | var context = options.context || getContext();
27 | var dialog = context.selectComponent(options.selector);
28 | delete options.selector;
29 |
30 | if (dialog) {
31 | dialog.set(_extends({
32 | onCancel: reject,
33 | onConfirm: resolve
34 | }, options));
35 | queue.push(dialog);
36 | } else {
37 | console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
38 | }
39 | });
40 | };
41 |
42 | Dialog.defaultOptions = {
43 | show: true,
44 | title: '',
45 | message: '',
46 | zIndex: 100,
47 | overlay: true,
48 | asyncClose: false,
49 | messageAlign: '',
50 | transition: 'scale',
51 | selector: '#van-dialog',
52 | confirmButtonText: '确认',
53 | cancelButtonText: '取消',
54 | showConfirmButton: true,
55 | showCancelButton: false,
56 | closeOnClickOverlay: false,
57 | confirmButtonOpenType: ''
58 | };
59 | Dialog.alert = Dialog;
60 |
61 | Dialog.confirm = function (options) {
62 | return Dialog(_extends({
63 | showCancelButton: true
64 | }, options));
65 | };
66 |
67 | Dialog.close = function () {
68 | queue.forEach(function (dialog) {
69 | dialog.close();
70 | });
71 | queue = [];
72 | };
73 |
74 | Dialog.stopLoading = function () {
75 | queue.forEach(function (dialog) {
76 | dialog.stopLoading();
77 | });
78 | };
79 |
80 | Dialog.setDefaultOptions = function (options) {
81 | Object.assign(Dialog.currentOptions, options);
82 | };
83 |
84 | Dialog.resetDefaultOptions = function () {
85 | Dialog.currentOptions = _extends({}, Dialog.defaultOptions);
86 | };
87 |
88 | Dialog.resetDefaultOptions();
89 | export default Dialog;
--------------------------------------------------------------------------------
/dist/dialog/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { openType } from '../mixins/open-type';
3 | VantComponent({
4 | mixins: [openType],
5 | props: {
6 | show: Boolean,
7 | title: String,
8 | message: String,
9 | useSlot: Boolean,
10 | asyncClose: Boolean,
11 | messageAlign: String,
12 | showCancelButton: Boolean,
13 | closeOnClickOverlay: Boolean,
14 | confirmButtonOpenType: String,
15 | zIndex: {
16 | type: Number,
17 | value: 100
18 | },
19 | confirmButtonText: {
20 | type: String,
21 | value: '确认'
22 | },
23 | cancelButtonText: {
24 | type: String,
25 | value: '取消'
26 | },
27 | showConfirmButton: {
28 | type: Boolean,
29 | value: true
30 | },
31 | overlay: {
32 | type: Boolean,
33 | value: true
34 | },
35 | transition: {
36 | type: String,
37 | value: 'scale'
38 | }
39 | },
40 | data: {
41 | loading: {
42 | confirm: false,
43 | cancel: false
44 | }
45 | },
46 | watch: {
47 | show: function show(_show) {
48 | !_show && this.stopLoading();
49 | }
50 | },
51 | methods: {
52 | onConfirm: function onConfirm() {
53 | this.handleAction('confirm');
54 | },
55 | onCancel: function onCancel() {
56 | this.handleAction('cancel');
57 | },
58 | onClickOverlay: function onClickOverlay() {
59 | this.onClose('overlay');
60 | },
61 | handleAction: function handleAction(action) {
62 | if (this.data.asyncClose) {
63 | this.set({
64 | ["loading." + action]: true
65 | });
66 | }
67 |
68 | this.onClose(action);
69 | },
70 | close: function close() {
71 | this.set({
72 | show: false
73 | });
74 | },
75 | stopLoading: function stopLoading() {
76 | this.set({
77 | loading: {
78 | confirm: false,
79 | cancel: false
80 | }
81 | });
82 | },
83 | onClose: function onClose(action) {
84 | if (!this.data.asyncClose) {
85 | this.close();
86 | }
87 |
88 | this.$emit('close', action); //把 dialog 实例传递出去,可以通过 stopLoading() 在外部关闭按钮的 loading
89 |
90 | this.$emit(action, {
91 | dialog: this
92 | });
93 | var callback = this.data[action === 'confirm' ? 'onConfirm' : 'onCancel'];
94 |
95 | if (callback) {
96 | callback(this);
97 | }
98 | }
99 | }
100 | });
--------------------------------------------------------------------------------
/dist/dialog/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-popup": "../popup/index",
5 | "van-button": "../button/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/dialog/index.wxml:
--------------------------------------------------------------------------------
1 |
10 |
16 |
17 |
18 |
22 | {{ message }}
23 |
24 |
25 |
53 |
54 |
--------------------------------------------------------------------------------
/dist/dialog/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-dialog{width:85%;font-size:16px;overflow:hidden;border-radius:4px;background-color:#fff}.van-dialog__header{font-weight:500;padding-top:25px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{padding:25px;font-size:14px;line-height:1.5;max-height:60vh;overflow-y:auto;text-align:center;-webkit-overflow-scrolling:touch}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:-webkit-flex;display:flex}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog__confirm,.van-dialog__confirm:active{color:#1989fa!important}.van-dialog-bounce-enter{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9)}
--------------------------------------------------------------------------------
/dist/field/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index",
5 | "van-icon": "../icon/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/dist/field/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{border:0;margin:0;padding:0;width:100%;height:24px;resize:none;display:block;text-align:left;min-height:24px;color:#333;line-height:inherit;box-sizing:border-box;background-color:transparent}.van-field__input--disabled{opacity:1;color:#999;background-color:transparent}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__input--error{color:#f44}.van-field__placeholder{color:#999}.van-field__clear-root{height:24px}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;line-height:inherit;margin-right:-10px;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{color:#f44;font-size:12px;text-align:left}
--------------------------------------------------------------------------------
/dist/goods-action-button/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { link } from '../mixins/link';
3 | import { button } from '../mixins/button';
4 | import { openType } from '../mixins/open-type';
5 | VantComponent({
6 | mixins: [link, button, openType],
7 | props: {
8 | text: String,
9 | loading: Boolean,
10 | disabled: Boolean,
11 | type: {
12 | type: String,
13 | value: 'danger'
14 | }
15 | },
16 | methods: {
17 | onClick: function onClick(event) {
18 | this.$emit('click', event.detail);
19 | this.jumpLink();
20 | }
21 | }
22 | });
--------------------------------------------------------------------------------
/dist/goods-action-button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-button": "../button/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/goods-action-button/index.wxml:
--------------------------------------------------------------------------------
1 |
24 | {{ text }}
25 |
26 |
--------------------------------------------------------------------------------
/dist/goods-action-button/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';:host{-webkit-flex:1;flex:1}
--------------------------------------------------------------------------------
/dist/goods-action-icon/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { link } from '../mixins/link';
3 | import { button } from '../mixins/button';
4 | import { openType } from '../mixins/open-type';
5 | VantComponent({
6 | mixins: [link, button, openType],
7 | props: {
8 | text: String,
9 | info: String,
10 | icon: String
11 | },
12 | methods: {
13 | onClick: function onClick(event) {
14 | this.$emit('click', event.detail);
15 | this.jumpLink();
16 | }
17 | }
18 | });
--------------------------------------------------------------------------------
/dist/goods-action-icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-button": "../button/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/goods-action-icon/index.wxml:
--------------------------------------------------------------------------------
1 |
23 |
24 |
30 | {{ text }}
31 |
32 |
33 |
--------------------------------------------------------------------------------
/dist/goods-action-icon/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-goods-action-icon{width:50px!important;border:none!important}.van-goods-action-icon__content{height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:10px;color:#7d7e80;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-goods-action-icon__icon{margin-bottom:4px}
--------------------------------------------------------------------------------
/dist/goods-action/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex]
5 | });
--------------------------------------------------------------------------------
/dist/goods-action/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/goods-action/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dist/goods-action/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;background-color:#fff}.van-goods-action--safe{padding-bottom:34px}
--------------------------------------------------------------------------------
/dist/icon/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | info: null,
5 | name: String,
6 | size: String,
7 | color: String,
8 | customStyle: String,
9 | classPrefix: {
10 | type: String,
11 | value: 'van-icon'
12 | }
13 | },
14 | methods: {
15 | onClick: function onClick() {
16 | this.$emit('click');
17 | }
18 | }
19 | });
--------------------------------------------------------------------------------
/dist/icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-info": "../info/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/icon/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/dist/info/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | info: null,
5 | customStyle: String
6 | }
7 | });
--------------------------------------------------------------------------------
/dist/info/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/info/index.wxml:
--------------------------------------------------------------------------------
1 |
6 | {{ info }}
7 |
8 |
--------------------------------------------------------------------------------
/dist/info/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-info{position:absolute;right:0;top:-8px;color:#fff;font-size:12px;font-weight:500;font-family:PingFang SC,Helvetica Neue,Arial,sans-serif;text-align:center;box-sizing:border-box;padding:0 3px;min-width:16px;line-height:14px;border:1px solid #fff;border-radius:16px;background-color:#f44;-webkit-transform:translateX(50%);transform:translateX(50%);-webkit-transform-origin:100%;transform-origin:100%}
--------------------------------------------------------------------------------
/dist/loading/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | size: {
5 | type: String,
6 | value: '30px'
7 | },
8 | type: {
9 | type: String,
10 | value: 'circular'
11 | },
12 | color: {
13 | type: String,
14 | value: '#c9c9c9'
15 | }
16 | }
17 | });
--------------------------------------------------------------------------------
/dist/loading/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/loading/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
9 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/dist/mixins/basic.js:
--------------------------------------------------------------------------------
1 | export var basic = Behavior({
2 | methods: {
3 | $emit: function $emit() {
4 | this.triggerEvent.apply(this, arguments);
5 | },
6 | getRect: function getRect(selector, all) {
7 | var _this = this;
8 |
9 | return new Promise(function (resolve) {
10 | wx.createSelectorQuery().in(_this)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
11 | if (all && Array.isArray(rect) && rect.length) {
12 | resolve(rect);
13 | }
14 |
15 | if (!all && rect) {
16 | resolve(rect);
17 | }
18 | }).exec();
19 | });
20 | }
21 | }
22 | });
--------------------------------------------------------------------------------
/dist/mixins/button.js:
--------------------------------------------------------------------------------
1 | export var button = Behavior({
2 | properties: {
3 | id: String,
4 | sessionFrom: String,
5 | appParameter: String,
6 | sendMessageImg: String,
7 | sendMessagePath: String,
8 | showMessageCard: String,
9 | sendMessageTitle: String,
10 | lang: {
11 | type: String,
12 | value: 'en'
13 | }
14 | }
15 | });
--------------------------------------------------------------------------------
/dist/mixins/iphonex.js:
--------------------------------------------------------------------------------
1 | var isIPhoneX = null;
2 |
3 | function getIsIPhoneX() {
4 | return new Promise(function (resolve, reject) {
5 | if (isIPhoneX !== null) {
6 | resolve(isIPhoneX);
7 | } else {
8 | wx.getSystemInfo({
9 | success: function success(_ref) {
10 | var model = _ref.model,
11 | screenHeight = _ref.screenHeight;
12 | var iphoneX = /iphone x/i.test(model);
13 | var iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
14 | isIPhoneX = iphoneX || iphoneNew;
15 | resolve(isIPhoneX);
16 | },
17 | fail: reject
18 | });
19 | }
20 | });
21 | }
22 |
23 | export var iphonex = Behavior({
24 | properties: {
25 | safeAreaInsetBottom: {
26 | type: Boolean,
27 | value: true
28 | }
29 | },
30 | created: function created() {
31 | var _this = this;
32 |
33 | getIsIPhoneX().then(function (isIPhoneX) {
34 | _this.set({
35 | isIPhoneX: isIPhoneX
36 | });
37 | });
38 | }
39 | });
--------------------------------------------------------------------------------
/dist/mixins/link.js:
--------------------------------------------------------------------------------
1 | export var link = Behavior({
2 | properties: {
3 | url: String,
4 | linkType: {
5 | type: String,
6 | value: 'navigateTo'
7 | }
8 | },
9 | methods: {
10 | jumpLink: function jumpLink(urlKey) {
11 | if (urlKey === void 0) {
12 | urlKey = 'url';
13 | }
14 |
15 | var url = this.data[urlKey];
16 |
17 | if (url) {
18 | wx[this.data.linkType]({
19 | url: url
20 | });
21 | }
22 | }
23 | }
24 | });
--------------------------------------------------------------------------------
/dist/mixins/observer/behavior.js:
--------------------------------------------------------------------------------
1 | export var behavior = Behavior({
2 | created: function created() {
3 | var _this = this;
4 |
5 | if (!this.$options) {
6 | return;
7 | }
8 |
9 | var cache = {};
10 |
11 | var _this$$options = this.$options(),
12 | computed = _this$$options.computed;
13 |
14 | var keys = Object.keys(computed);
15 |
16 | this.calcComputed = function () {
17 | var needUpdate = {};
18 | keys.forEach(function (key) {
19 | var value = computed[key].call(_this);
20 |
21 | if (cache[key] !== value) {
22 | cache[key] = needUpdate[key] = value;
23 | }
24 | });
25 | return needUpdate;
26 | };
27 | },
28 | attached: function attached() {
29 | this.set();
30 | },
31 | methods: {
32 | // set data and set computed data
33 | set: function set(data, callback) {
34 | if (data) {
35 | this.setData(data, callback);
36 | }
37 |
38 | if (this.calcComputed) {
39 | this.setData(this.calcComputed());
40 | }
41 | }
42 | }
43 | });
--------------------------------------------------------------------------------
/dist/mixins/observer/index.js:
--------------------------------------------------------------------------------
1 | import { behavior } from './behavior';
2 | import { observeProps } from './props';
3 | export function observe(vantOptions, options) {
4 | var watch = vantOptions.watch,
5 | computed = vantOptions.computed;
6 | options.behaviors.push(behavior);
7 |
8 | if (watch) {
9 | var props = options.properties || {};
10 | Object.keys(watch).forEach(function (key) {
11 | if (key in props) {
12 | var prop = props[key];
13 |
14 | if (prop === null || !('type' in prop)) {
15 | prop = {
16 | type: prop
17 | };
18 | }
19 |
20 | prop.observer = watch[key];
21 | props[key] = prop;
22 | }
23 | });
24 | options.properties = props;
25 | }
26 |
27 | if (computed) {
28 | options.methods = options.methods || {};
29 |
30 | options.methods.$options = function () {
31 | return vantOptions;
32 | };
33 |
34 | if (options.properties) {
35 | observeProps(options.properties);
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/dist/mixins/observer/props.js:
--------------------------------------------------------------------------------
1 | export function observeProps(props) {
2 | if (!props) {
3 | return;
4 | }
5 |
6 | Object.keys(props).forEach(function (key) {
7 | var prop = props[key];
8 |
9 | if (prop === null || !('type' in prop)) {
10 | prop = {
11 | type: prop
12 | };
13 | }
14 |
15 | var _prop = prop,
16 | observer = _prop.observer;
17 |
18 | prop.observer = function () {
19 | if (observer) {
20 | if (typeof observer === 'string') {
21 | observer = this[observer];
22 | }
23 |
24 | observer.apply(this, arguments);
25 | }
26 |
27 | this.set();
28 | };
29 |
30 | props[key] = prop;
31 | });
32 | }
--------------------------------------------------------------------------------
/dist/mixins/open-type.js:
--------------------------------------------------------------------------------
1 | export var openType = Behavior({
2 | properties: {
3 | openType: String
4 | },
5 | methods: {
6 | bindGetUserInfo: function bindGetUserInfo(event) {
7 | this.$emit('getuserinfo', event.detail);
8 | },
9 | bindContact: function bindContact(event) {
10 | this.$emit('contact', event.detail);
11 | },
12 | bindGetPhoneNumber: function bindGetPhoneNumber(event) {
13 | this.$emit('getphonenumber', event.detail);
14 | },
15 | bindOpenSetting: function bindOpenSetting(event) {
16 | this.$emit('opensetting', event.detail);
17 | },
18 | bindError: function bindError(event) {
19 | this.$emit('error', event.detail);
20 | }
21 | }
22 | });
--------------------------------------------------------------------------------
/dist/mixins/touch.js:
--------------------------------------------------------------------------------
1 | export var touch = Behavior({
2 | methods: {
3 | touchStart: function touchStart(event) {
4 | this.direction = '';
5 | this.deltaX = 0;
6 | this.deltaY = 0;
7 | this.offsetX = 0;
8 | this.offsetY = 0;
9 | this.startX = event.touches[0].clientX;
10 | this.startY = event.touches[0].clientY;
11 | },
12 | touchMove: function touchMove(event) {
13 | var touch = event.touches[0];
14 | this.deltaX = touch.clientX - this.startX;
15 | this.deltaY = touch.clientY - this.startY;
16 | this.offsetX = Math.abs(this.deltaX);
17 | this.offsetY = Math.abs(this.deltaY);
18 | this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : '';
19 | }
20 | }
21 | });
--------------------------------------------------------------------------------
/dist/mixins/transition.js:
--------------------------------------------------------------------------------
1 | export var transition = function transition(showDefaultValue) {
2 | return Behavior({
3 | properties: {
4 | customStyle: String,
5 | show: {
6 | type: Boolean,
7 | value: showDefaultValue,
8 | observer: 'observeShow'
9 | },
10 | duration: {
11 | type: Number,
12 | value: 300
13 | }
14 | },
15 | data: {
16 | type: '',
17 | inited: false,
18 | display: false,
19 | supportAnimation: true
20 | },
21 | attached: function attached() {
22 | if (this.data.show) {
23 | this.show();
24 | }
25 |
26 | this.detectSupport();
27 | },
28 | methods: {
29 | detectSupport: function detectSupport() {
30 | var _this = this;
31 |
32 | wx.getSystemInfo({
33 | success: function success(info) {
34 | if (info && info.system && info.system.indexOf('iOS 8') === 0) {
35 | _this.set({
36 | supportAnimation: false
37 | });
38 | }
39 | }
40 | });
41 | },
42 | observeShow: function observeShow(value) {
43 | if (value) {
44 | this.show();
45 | } else {
46 | if (this.data.supportAnimation) {
47 | this.set({
48 | type: 'leave'
49 | });
50 | } else {
51 | this.set({
52 | display: false
53 | });
54 | }
55 | }
56 | },
57 | show: function show() {
58 | this.set({
59 | inited: true,
60 | display: true,
61 | type: 'enter'
62 | });
63 | },
64 | onAnimationEnd: function onAnimationEnd() {
65 | if (!this.data.show) {
66 | this.set({
67 | display: false
68 | });
69 | }
70 | }
71 | }
72 | });
73 | };
--------------------------------------------------------------------------------
/dist/nav-bar/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | classes: ['title-class'],
4 | props: {
5 | title: String,
6 | fixed: Boolean,
7 | leftText: String,
8 | rightText: String,
9 | leftArrow: Boolean,
10 | border: {
11 | type: Boolean,
12 | value: true
13 | },
14 | zIndex: {
15 | type: Number,
16 | value: 1
17 | }
18 | },
19 | methods: {
20 | onClickLeft: function onClickLeft() {
21 | this.$emit('click-left');
22 | },
23 | onClickRight: function onClickRight() {
24 | this.$emit('click-right');
25 | }
26 | }
27 | });
--------------------------------------------------------------------------------
/dist/nav-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/nav-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
13 | {{ leftText }}
14 |
15 |
16 |
17 |
18 | {{ title }}
19 |
20 |
21 |
22 | {{ rightText }}
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/dist/nav-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-nav-bar{height:46px;position:relative;-webkit-user-select:none;user-select:none;text-align:center;line-height:46px;background-color:#fff}.van-nav-bar__arrow{color:#1989fa;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{top:0;left:0;width:100%;position:fixed}.van-nav-bar__title{margin:0 auto;max-width:60%;font-size:16px;font-weight:500}.van-nav-bar__left,.van-nav-bar__right{bottom:0;font-size:14px;position:absolute}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}.van-nav-bar__text{color:#1989fa;margin:0 -15px;padding:0 15px;display:inline-block;vertical-align:middle}.van-nav-bar__text:active{background-color:#e8e8e8}
--------------------------------------------------------------------------------
/dist/notice-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/dist/notice-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | {{ text }}
13 |
14 |
15 |
16 |
17 |
23 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/dist/notice-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-notice-bar{display:-webkit-flex;display:flex;height:40px;padding:0 15px;font-size:14px;line-height:24px;-webkit-align-items:center;align-items:center}.van-notice-bar--within-icon{position:relative;padding-right:40px}.van-notice-bar__left-icon{height:18px;min-width:20px;box-sizing:border-box}.van-notice-bar__left-icon>image{width:16px;height:16px}.van-notice-bar__right-icon{position:absolute;top:10px;right:15px;font-size:16px}.van-notice-bar__content-wrap{-webkit-flex:1;flex:1;height:24px;overflow:hidden;position:relative}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%}
--------------------------------------------------------------------------------
/dist/notify/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { RED } from '../common/color';
3 | VantComponent({
4 | props: {
5 | text: String,
6 | color: {
7 | type: String,
8 | value: '#fff'
9 | },
10 | backgroundColor: {
11 | type: String,
12 | value: RED
13 | },
14 | duration: {
15 | type: Number,
16 | value: 3000
17 | }
18 | },
19 | methods: {
20 | show: function show() {
21 | var _this = this;
22 |
23 | var duration = this.data.duration;
24 | clearTimeout(this.timer);
25 | this.set({
26 | show: true
27 | });
28 |
29 | if (duration > 0 && duration !== Infinity) {
30 | this.timer = setTimeout(function () {
31 | _this.hide();
32 | }, duration);
33 | }
34 | },
35 | hide: function hide() {
36 | clearTimeout(this.timer);
37 | this.set({
38 | show: false
39 | });
40 | }
41 | }
42 | });
--------------------------------------------------------------------------------
/dist/notify/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-transition": "../transition/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/notify/index.wxml:
--------------------------------------------------------------------------------
1 |
7 | {{ text }}
8 |
9 |
--------------------------------------------------------------------------------
/dist/notify/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-notify{z-index:110;position:fixed;top:0;width:100%;text-align:center;box-sizing:border-box;padding:6px 15px;font-size:14px;line-height:20px}
--------------------------------------------------------------------------------
/dist/notify/notify.js:
--------------------------------------------------------------------------------
1 | import { isObj } from '../common/utils';
2 | var defaultOptions = {
3 | selector: '#van-notify',
4 | duration: 3000
5 | };
6 |
7 | function parseOptions(text) {
8 | return isObj(text) ? text : {
9 | text: text
10 | };
11 | }
12 |
13 | function getContext() {
14 | var pages = getCurrentPages();
15 | return pages[pages.length - 1];
16 | }
17 |
18 | export default function Notify(options) {
19 | if (options === void 0) {
20 | options = {};
21 | }
22 |
23 | options = Object.assign({}, defaultOptions, parseOptions(options));
24 | var context = options.context || getContext();
25 | var notify = context.selectComponent(options.selector);
26 | delete options.selector;
27 |
28 | if (notify) {
29 | notify.set(options);
30 | notify.show();
31 | } else {
32 | console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
33 | }
34 | }
--------------------------------------------------------------------------------
/dist/overlay/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | show: Boolean,
5 | mask: Boolean,
6 | customStyle: String,
7 | zIndex: {
8 | type: Number,
9 | value: 1
10 | }
11 | },
12 | methods: {
13 | onClick: function onClick() {
14 | this.$emit('click');
15 | },
16 | // for prevent touchmove
17 | noop: function noop() {}
18 | }
19 | });
--------------------------------------------------------------------------------
/dist/overlay/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-transition": "../transition/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/overlay/index.wxml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/dist/overlay/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-overlay{position:fixed;top:0;left:0;right:0;bottom:0}
--------------------------------------------------------------------------------
/dist/panel/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | classes: ['header-class', 'footer-class'],
4 | props: {
5 | desc: String,
6 | title: String,
7 | status: String,
8 | useFooterSlot: Boolean
9 | }
10 | });
--------------------------------------------------------------------------------
/dist/panel/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/panel/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/dist/panel/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-panel{background:#fff}.van-panel__header-value{color:#f44}.van-panel__footer{padding:10px 15px}
--------------------------------------------------------------------------------
/dist/picker-column/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/picker-column/index.wxml:
--------------------------------------------------------------------------------
1 |
9 |
10 | {{ getOptionText(option, valueKey) }}
19 |
20 |
21 |
22 |
23 | function isObj(x) {
24 | var type = typeof x;
25 | return x !== null && (type === 'object' || type === 'function');
26 | }
27 |
28 | module.exports = function (option, valueKey) {
29 | return isObj(option) && option[valueKey] ? option[valueKey] : option;
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/dist/picker-column/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
--------------------------------------------------------------------------------
/dist/picker/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "picker-column": "../picker-column/index",
5 | "loading": "../loading/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/picker/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | {{ cancelButtonText || '取消' }}
8 |
9 | {{ title }}
10 |
11 | {{ confirmButtonText || '确认' }}
12 |
13 |
14 |
15 |
16 |
17 |
22 |
36 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/dist/picker/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;background-color:#fff;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:-webkit-flex;display:flex;height:44px;line-height:44px;-webkit-justify-content:space-between;justify-content:space-between}.van-picker__cancel,.van-picker__confirm{padding:0 15px;font-size:14px;color:#1989fa}.van-picker__cancel:active,.van-picker__confirm:active{background-color:#e8e8e8}.van-picker__title{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-picker__columns{position:relative;display:-webkit-flex;display:flex}.van-picker__column{-webkit-flex:1;flex:1}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;display:-webkit-flex;display:flex;background-color:rgba(255,255,255,.9);-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;pointer-events:none;-webkit-transform:translateY(-50%);transform:translateY(-50%)}
--------------------------------------------------------------------------------
/dist/popup/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { transition } from '../mixins/transition';
3 | import { iphonex } from '../mixins/iphonex';
4 | VantComponent({
5 | mixins: [transition(false), iphonex],
6 | props: {
7 | transition: String,
8 | customStyle: String,
9 | overlayStyle: String,
10 | zIndex: {
11 | type: Number,
12 | value: 100
13 | },
14 | overlay: {
15 | type: Boolean,
16 | value: true
17 | },
18 | closeOnClickOverlay: {
19 | type: Boolean,
20 | value: true
21 | },
22 | position: {
23 | type: String,
24 | value: 'center'
25 | }
26 | },
27 | methods: {
28 | onClickOverlay: function onClickOverlay() {
29 | this.$emit('click-overlay');
30 |
31 | if (this.data.closeOnClickOverlay) {
32 | this.$emit('close');
33 | }
34 | }
35 | }
36 | });
--------------------------------------------------------------------------------
/dist/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-overlay": "../overlay/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/popup/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
19 |
--------------------------------------------------------------------------------
/dist/progress/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { BLUE } from '../common/color';
3 | VantComponent({
4 | props: {
5 | inactive: Boolean,
6 | percentage: Number,
7 | pivotText: String,
8 | pivotColor: String,
9 | showPivot: {
10 | type: Boolean,
11 | value: true
12 | },
13 | color: {
14 | type: String,
15 | value: BLUE
16 | },
17 | textColor: {
18 | type: String,
19 | value: '#fff'
20 | }
21 | },
22 | data: {
23 | pivotWidth: 0,
24 | progressWidth: 0
25 | },
26 | watch: {
27 | pivotText: 'getWidth',
28 | showPivot: 'getWidth'
29 | },
30 | computed: {
31 | portionStyle: function portionStyle() {
32 | var width = (this.data.progressWidth - this.data.pivotWidth) * this.data.percentage / 100 + 'px';
33 | var background = this.getCurrentColor();
34 | return "width: " + width + "; background: " + background + "; ";
35 | },
36 | pivotStyle: function pivotStyle() {
37 | var color = this.data.textColor;
38 | var background = this.data.pivotColor || this.getCurrentColor();
39 | return "color: " + color + "; background: " + background;
40 | },
41 | text: function text() {
42 | return this.data.pivotText || this.data.percentage + '%';
43 | }
44 | },
45 | mounted: function mounted() {
46 | this.getWidth();
47 | },
48 | methods: {
49 | getCurrentColor: function getCurrentColor() {
50 | return this.data.inactive ? '#cacaca' : this.data.color;
51 | },
52 | getWidth: function getWidth() {
53 | var _this = this;
54 |
55 | this.getRect('.van-progress').then(function (rect) {
56 | _this.set({
57 | progressWidth: rect.width
58 | });
59 | });
60 | this.getRect('.van-progress__pivot').then(function (rect) {
61 | _this.set({
62 | pivotWidth: rect.width || 0
63 | });
64 | });
65 | }
66 | }
67 | });
--------------------------------------------------------------------------------
/dist/progress/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/progress/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
11 | {{ text }}
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dist/progress/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-progress{height:4px;position:relative;border-radius:4px;background:#e5e5e5}.van-progress__portion{left:0;height:100%;position:absolute;border-radius:inherit}.van-progress__portion--with-pivot{border-top-right-radius:0;border-bottom-right-radius:0}.van-progress__pivot{top:50%;right:0;min-width:2em;padding:0 5px;font-size:10px;position:absolute;line-height:1.6;text-align:center;border-radius:1em;word-break:keep-all;box-sizing:border-box;background-color:#e5e5e5;-webkit-transform:translate(100%,-50%);transform:translate(100%,-50%)}
--------------------------------------------------------------------------------
/dist/radio-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'radio',
6 | type: 'descendant',
7 | linked: function linked(target) {
8 | var _this$data = this.data,
9 | value = _this$data.value,
10 | disabled = _this$data.disabled;
11 | target.set({
12 | value: value,
13 | disabled: disabled || target.data.disabled
14 | });
15 | }
16 | },
17 | props: {
18 | value: null,
19 | disabled: Boolean
20 | },
21 | watch: {
22 | value: function value(_value) {
23 | var children = this.getRelationNodes('../radio/index');
24 | children.forEach(function (child) {
25 | child.set({
26 | value: _value
27 | });
28 | });
29 | },
30 | disabled: function disabled(_disabled) {
31 | var children = this.getRelationNodes('../radio/index');
32 | children.forEach(function (child) {
33 | child.set({
34 | disabled: _disabled || child.data.disabled
35 | });
36 | });
37 | }
38 | }
39 | });
--------------------------------------------------------------------------------
/dist/radio-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/radio-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/dist/radio-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/dist/radio/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'radio-group',
6 | type: 'ancestor'
7 | },
8 | classes: ['icon-class', 'label-class'],
9 | props: {
10 | name: null,
11 | value: null,
12 | disabled: Boolean,
13 | labelDisabled: Boolean,
14 | labelPosition: String,
15 | checkedColor: String
16 | },
17 | methods: {
18 | emitChange: function emitChange(value) {
19 | var instance = this.getRelationNodes('../radio-group/index')[0] || this;
20 | instance.$emit('input', value);
21 | instance.$emit('change', value);
22 | },
23 | onChange: function onChange(event) {
24 | this.emitChange(event.detail.value);
25 | },
26 | onClickLabel: function onClickLabel() {
27 | if (!this.data.disabled && !this.data.labelDisabled) {
28 | this.emitChange(this.data.name);
29 | }
30 | }
31 | }
32 | });
--------------------------------------------------------------------------------
/dist/radio/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/radio/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
13 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/dist/radio/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-radio{overflow:hidden;line-height:1;-webkit-user-select:none;user-select:none}.van-radio__input,.van-radio__label{display:inline-block;vertical-align:middle}.van-radio__input{position:relative;font-size:20px}.van-radio__control{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0}.van-radio__label{margin-left:10px;color:#333;font-size:16px;line-height:20px}.van-radio__label--left{margin:0 10px 0 0;float:left}.van-radio__label:empty{margin:0}.van-radio__icon{pointer-events:none;display:block;line-height:0}.van-radio__icon--disabled{color:#e5e5e5}.van-radio__icon--checked{color:#1989fa}.van-radio__icon--check{color:#999}
--------------------------------------------------------------------------------
/dist/rate/index.js:
--------------------------------------------------------------------------------
1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2 |
3 | import { VantComponent } from '../common/component';
4 | VantComponent({
5 | field: true,
6 | classes: ['icon-class'],
7 | props: {
8 | readonly: Boolean,
9 | disabled: Boolean,
10 | size: {
11 | type: Number,
12 | value: 20
13 | },
14 | icon: {
15 | type: String,
16 | value: 'star'
17 | },
18 | voidIcon: {
19 | type: String,
20 | value: 'star-o'
21 | },
22 | color: {
23 | type: String,
24 | value: '#ffd21e'
25 | },
26 | voidColor: {
27 | type: String,
28 | value: '#c7c7c7'
29 | },
30 | disabledColor: {
31 | type: String,
32 | value: '#bdbdbd'
33 | },
34 | count: {
35 | type: Number,
36 | value: 5
37 | },
38 | value: {
39 | type: Number,
40 | value: 0
41 | }
42 | },
43 | data: {
44 | innerValue: 0
45 | },
46 | watch: {
47 | value: function value(_value) {
48 | if (_value !== this.data.innerValue) {
49 | this.set({
50 | innerValue: _value
51 | });
52 | }
53 | }
54 | },
55 | computed: {
56 | list: function list() {
57 | var _this$data = this.data,
58 | count = _this$data.count,
59 | innerValue = _this$data.innerValue;
60 | return Array.from({
61 | length: count
62 | }, function (_, index) {
63 | return index < innerValue;
64 | });
65 | }
66 | },
67 | methods: {
68 | onSelect: function onSelect(event) {
69 | var data = this.data;
70 | var index = event.currentTarget.dataset.index;
71 |
72 | if (!data.disabled && !data.readonly) {
73 | this.set({
74 | innerValue: index + 1
75 | });
76 | this.$emit('input', index + 1);
77 | this.$emit('change', index + 1);
78 | }
79 | },
80 | onTouchMove: function onTouchMove(event) {
81 | var _this = this;
82 |
83 | var _event$touches$ = event.touches[0],
84 | clientX = _event$touches$.clientX,
85 | clientY = _event$touches$.clientY;
86 | this.getRect('.van-rate__item', true).then(function (list) {
87 | var target = list.find(function (item) {
88 | return clientX >= item.left && clientX <= item.right && clientY >= item.top && clientY <= item.bottom;
89 | });
90 |
91 | if (target != null) {
92 | _this.onSelect(_extends({}, event, {
93 | currentTarget: target
94 | }));
95 | }
96 | });
97 | }
98 | }
99 | });
--------------------------------------------------------------------------------
/dist/rate/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/rate/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
16 |
17 |
--------------------------------------------------------------------------------
/dist/rate/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-rate{-webkit-user-select:none;user-select:none}.van-rate__item{width:1em;padding:0 2px;box-sizing:content-box}
--------------------------------------------------------------------------------
/dist/row/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'col',
5 | type: 'descendant',
6 | linked: function linked(target) {
7 | if (this.data.gutter) {
8 | target.setGutter(this.data.gutter);
9 | }
10 | }
11 | },
12 | props: {
13 | gutter: Number
14 | },
15 | watch: {
16 | gutter: 'setGutter'
17 | },
18 | mounted: function mounted() {
19 | if (this.data.gutter) {
20 | this.setGutter();
21 | }
22 | },
23 | methods: {
24 | setGutter: function setGutter() {
25 | var _this = this;
26 |
27 | var gutter = this.data.gutter;
28 | var margin = "-" + Number(gutter) / 2 + "px";
29 | var style = gutter ? "margin-right: " + margin + "; margin-left: " + margin + ";" : '';
30 | this.set({
31 | style: style
32 | });
33 | this.getRelationNodes('../col/index').forEach(function (col) {
34 | col.setGutter(_this.data.gutter);
35 | });
36 | }
37 | }
38 | });
--------------------------------------------------------------------------------
/dist/row/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/row/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/dist/row/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-row::after{content:"";display:table;clear:both}
--------------------------------------------------------------------------------
/dist/search/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | classes: ['field-class', 'input-class', 'cancel-class'],
5 | props: {
6 | focus: Boolean,
7 | error: Boolean,
8 | disabled: Boolean,
9 | readonly: Boolean,
10 | inputAlign: String,
11 | showAction: Boolean,
12 | useActionSlot: Boolean,
13 | placeholder: String,
14 | placeholderStyle: String,
15 | background: {
16 | type: String,
17 | value: '#f2f2f2'
18 | },
19 | maxlength: {
20 | type: Number,
21 | value: -1
22 | }
23 | },
24 | methods: {
25 | onChange: function onChange(event) {
26 | this.set({
27 | value: event.detail
28 | });
29 | this.$emit('change', event.detail);
30 | },
31 | onCancel: function onCancel() {
32 | this.set({
33 | value: ''
34 | });
35 | this.$emit('cancel');
36 | this.$emit('change', '');
37 | },
38 | onSearch: function onSearch() {
39 | this.$emit('search', this.data.value);
40 | },
41 | onFocus: function onFocus() {
42 | this.$emit('focus');
43 | },
44 | onBlur: function onBlur() {
45 | this.$emit('blur');
46 | },
47 | onClear: function onClear() {
48 | this.$emit('clear');
49 | }
50 | }
51 | });
--------------------------------------------------------------------------------
/dist/search/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-field": "../field/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/search/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
29 |
30 |
31 | 取消
32 |
33 |
34 |
--------------------------------------------------------------------------------
/dist/search/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-search{display:-webkit-flex;display:flex;padding:7px 15px;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search__field{overflow:hidden;border-radius:4px;-webkit-flex:1;flex:1}.van-search__field__left-icon{color:#999}.van-search--show-action{padding-right:0}.van-search input::-webkit-search-cancel-button,.van-search input::-webkit-search-decoration,.van-search input::-webkit-search-results-button,.van-search input::-webkit-search-results-decoration{display:none}.van-search__action{padding:0 10px;font-size:14px;line-height:30px;color:#7d7e80}.van-search__action:active{background-color:#e8e8e8}
--------------------------------------------------------------------------------
/dist/slider/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { touch } from '../mixins/touch';
3 | VantComponent({
4 | mixins: [touch],
5 | props: {
6 | disabled: Boolean,
7 | useButtonSlot: Boolean,
8 | activeColor: String,
9 | inactiveColor: String,
10 | max: {
11 | type: Number,
12 | value: 100
13 | },
14 | min: {
15 | type: Number,
16 | value: 0
17 | },
18 | step: {
19 | type: Number,
20 | value: 1
21 | },
22 | value: {
23 | type: Number,
24 | value: 0
25 | },
26 | barHeight: {
27 | type: String,
28 | value: '2px'
29 | }
30 | },
31 | watch: {
32 | value: function value(_value) {
33 | this.updateValue(_value, false);
34 | }
35 | },
36 | created: function created() {
37 | this.updateValue(this.data.value);
38 | },
39 | methods: {
40 | onTouchStart: function onTouchStart(event) {
41 | if (this.data.disabled) return;
42 | this.touchStart(event);
43 | this.startValue = this.format(this.data.value);
44 | },
45 | onTouchMove: function onTouchMove(event) {
46 | var _this = this;
47 |
48 | if (this.data.disabled) return;
49 | this.touchMove(event);
50 | this.getRect('.van-slider').then(function (rect) {
51 | var diff = _this.deltaX / rect.width * 100;
52 |
53 | _this.updateValue(_this.startValue + diff);
54 | });
55 | },
56 | onTouchEnd: function onTouchEnd() {
57 | if (this.data.disabled) return;
58 | this.updateValue(this.data.value, true);
59 | },
60 | onClick: function onClick(event) {
61 | var _this2 = this;
62 |
63 | if (this.data.disabled) return;
64 | this.getRect(function (rect) {
65 | var value = (event.detail.x - rect.left) / rect.width * 100;
66 |
67 | _this2.updateValue(value, true);
68 | });
69 | },
70 | updateValue: function updateValue(value, end) {
71 | value = this.format(value);
72 | this.set({
73 | value: value,
74 | barStyle: "width: " + value + "%; height: " + this.data.barHeight + ";"
75 | });
76 | this.$emit('drag', {
77 | value: value
78 | });
79 |
80 | if (end) {
81 | this.$emit('change', value);
82 | }
83 | },
84 | format: function format(value) {
85 | var _this$data = this.data,
86 | max = _this$data.max,
87 | min = _this$data.min,
88 | step = _this$data.step;
89 | return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
90 | }
91 | }
92 | });
--------------------------------------------------------------------------------
/dist/slider/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/slider/index.wxml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
17 |
21 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/dist/slider/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5}.van-slider__bar{position:relative;border-radius:inherit;background-color:#1989fa}.van-slider__button{width:20px;height:20px;border-radius:50%;background-color:#fff;box-shadow:0 1px 2px rgba(0,0,0,.5)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper::after{content:'';position:absolute;width:200%;height:200%;top:-50%;left:-50%}.van-slider--disabled{opacity:.3}
--------------------------------------------------------------------------------
/dist/stepper/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component'; // Note that the bitwise operators and shift operators operate on 32-bit ints
2 | // so in that case, the max safe integer is 2^31-1, or 2147483647
3 |
4 | var MAX = 2147483647;
5 | VantComponent({
6 | field: true,
7 | classes: ['input-class', 'plus-class', 'minus-class'],
8 | props: {
9 | value: null,
10 | integer: Boolean,
11 | disabled: Boolean,
12 | asyncChange: Boolean,
13 | disableInput: Boolean,
14 | min: {
15 | type: null,
16 | value: 1
17 | },
18 | max: {
19 | type: null,
20 | value: MAX
21 | },
22 | step: {
23 | type: null,
24 | value: 1
25 | }
26 | },
27 | computed: {
28 | minusDisabled: function minusDisabled() {
29 | return this.data.disabled || this.data.value <= this.data.min;
30 | },
31 | plusDisabled: function plusDisabled() {
32 | return this.data.disabled || this.data.value >= this.data.max;
33 | }
34 | },
35 | watch: {
36 | value: function value(_value) {
37 | if (_value !== '') {
38 | this.set({
39 | value: this.range(_value)
40 | });
41 | }
42 | }
43 | },
44 | data: {
45 | focus: false
46 | },
47 | created: function created() {
48 | this.set({
49 | value: this.range(this.data.value)
50 | });
51 | },
52 | methods: {
53 | onFocus: function onFocus() {
54 | this.setData({
55 | focus: true
56 | });
57 | },
58 | // limit value range
59 | range: function range(value) {
60 | return Math.max(Math.min(this.data.max, value), this.data.min);
61 | },
62 | onInput: function onInput(event) {
63 | var _ref = event.detail || {},
64 | _ref$value = _ref.value,
65 | value = _ref$value === void 0 ? '' : _ref$value;
66 |
67 | this.triggerInput(value);
68 | },
69 | onChange: function onChange(type) {
70 | if (this.data[type + "Disabled"]) {
71 | this.$emit('overlimit', type);
72 | return;
73 | }
74 |
75 | var diff = type === 'minus' ? -this.data.step : +this.data.step;
76 | var value = Math.round((this.data.value + diff) * 100) / 100;
77 | this.triggerInput(this.range(value));
78 | this.$emit(type);
79 | },
80 | onBlur: function onBlur(event) {
81 | var value = this.range(this.data.value);
82 | this.triggerInput(value);
83 | this.$emit('blur', event);
84 | },
85 | onMinus: function onMinus() {
86 | this.onChange('minus');
87 | },
88 | onPlus: function onPlus() {
89 | this.onChange('plus');
90 | },
91 | triggerInput: function triggerInput(value) {
92 | this.set({
93 | value: this.data.asyncChange ? this.data.value : value
94 | });
95 | this.$emit('change', value);
96 | }
97 | }
98 | });
--------------------------------------------------------------------------------
/dist/stepper/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/stepper/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/dist/stepper/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__input-wrapper,.van-stepper__minus,.van-stepper__plus{display:inline-block;vertical-align:middle;background-color:#fff}.van-stepper__minus,.van-stepper__plus{position:relative;width:40px;height:30px;padding:5px;border:1px solid #eee;box-sizing:border-box}.van-stepper__minus::before,.van-stepper__plus::before{width:9px;height:1px}.van-stepper__minus::after,.van-stepper__plus::after{width:1px;height:9px}.van-stepper__minus::after,.van-stepper__minus::before,.van-stepper__plus::after,.van-stepper__plus::before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:#7d7e80;content:''}.van-stepper__minus:active,.van-stepper__plus:active{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{background-color:#f8f8f8}.van-stepper__minus--disabled::after,.van-stepper__minus--disabled::before,.van-stepper__plus--disabled::after,.van-stepper__plus--disabled::before{background-color:#c9c9c9}.van-stepper__minus--disabled:active,.van-stepper__plus--disabled:active{background-color:#f8f8f8}.van-stepper__minus{border-radius:2px 0 0 2px}.van-stepper__minus::after{display:none}.van-stepper__plus{border-radius:0 2px 2px 0}.van-stepper__input-wrapper{position:relative;width:35px;height:30px;padding:1px;font-size:14px;color:#7d7e80;text-align:center;border:1px solid #eee;border-width:1px 0;border-radius:0;box-sizing:border-box}.van-stepper__input-wrapper--disabled{color:#c9c9c9;background-color:#f8f8f8}.van-stepper__input{position:absolute;top:50%;left:50%;width:100%;min-height:0;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-appearance:none;appearance:none}
--------------------------------------------------------------------------------
/dist/steps/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { GREEN } from '../common/color';
3 | VantComponent({
4 | props: {
5 | icon: String,
6 | steps: Array,
7 | active: Number,
8 | direction: {
9 | type: String,
10 | value: 'horizontal'
11 | },
12 | activeColor: {
13 | type: String,
14 | value: GREEN
15 | }
16 | },
17 | watch: {
18 | steps: 'formatSteps',
19 | active: 'formatSteps'
20 | },
21 | created: function created() {
22 | this.formatSteps();
23 | },
24 | methods: {
25 | formatSteps: function formatSteps() {
26 | var _this = this;
27 |
28 | var steps = this.data.steps;
29 | steps.forEach(function (step, index) {
30 | step.status = _this.getStatus(index);
31 | });
32 | this.set({
33 | steps: steps
34 | });
35 | },
36 | getStatus: function getStatus(index) {
37 | var active = this.data.active;
38 |
39 | if (index < active) {
40 | return 'finish';
41 | } else if (index === active) {
42 | return 'process';
43 | }
44 |
45 | return '';
46 | }
47 | }
48 | });
--------------------------------------------------------------------------------
/dist/steps/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/steps/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 | {{ item.text }}
11 | {{ item.desc }}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/dist/steps/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-steps{overflow:hidden;background-color:#fff}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{position:relative;display:-webkit-flex;display:flex;overflow:hidden}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{position:relative;-webkit-flex:1;flex:1;font-size:14px;color:#999}.van-step--finish{color:#333}.van-step__circle{width:5px;height:5px;border-radius:50%;background-color:#999}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{-webkit-transform:none;transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{-webkit-transform:none;transform:none;text-align:right}.van-step--horizontal:last-child .van-step__circle-container{right:0;padding:0 0 0 8px;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{position:absolute;bottom:6px;z-index:1;padding:0 8px;background-color:#fff;-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.van-step--horizontal .van-step__title{display:inline-block;font-size:12px;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{position:absolute;left:0;right:0;bottom:6px;height:1px;background-color:#eee;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:#333}.van-step--horizontal.van-step--process .van-step__active{display:block;font-size:12px;color:#4b0;line-height:1}.van-step--vertical{font-size:14px;line-height:18px;padding:10px 10px 10px 0}.van-step--vertical::after{border-bottom-width:1px}.van-step--vertical:last-child::after{border-bottom-width:none}.van-step--vertical:first-child::before{content:'';position:absolute;width:1px;height:20px;background-color:#fff;top:0;left:-15px;z-index:1}.van-step--vertical .van-step__active,.van-step--vertical .van-step__circle,.van-step--vertical .van-step__line{position:absolute;top:19px;left:-14px;z-index:2;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-step--vertical .van-step__active{font-size:12px;line-height:1}.van-step--vertical .van-step__line{z-index:1;width:1px;height:100%;background-color:#eee;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}
--------------------------------------------------------------------------------
/dist/submit-bar/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex],
5 | classes: ['bar-class', 'price-class', 'button-class'],
6 | props: {
7 | tip: null,
8 | type: Number,
9 | price: null,
10 | label: String,
11 | loading: Boolean,
12 | disabled: Boolean,
13 | buttonText: String,
14 | currency: {
15 | type: String,
16 | value: '¥'
17 | },
18 | buttonType: {
19 | type: String,
20 | value: 'danger'
21 | }
22 | },
23 | computed: {
24 | hasPrice: function hasPrice() {
25 | return typeof this.data.price === 'number';
26 | },
27 | priceStr: function priceStr() {
28 | return (this.data.price / 100).toFixed(2);
29 | },
30 | tipStr: function tipStr() {
31 | var tip = this.data.tip;
32 | return typeof tip === 'string' ? tip : '';
33 | }
34 | },
35 | methods: {
36 | onSubmit: function onSubmit(event) {
37 | this.$emit('submit', event.detail);
38 | }
39 | }
40 | });
--------------------------------------------------------------------------------
/dist/submit-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-button": "../button/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/submit-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{ tipStr }}
8 |
9 |
10 |
11 |
12 |
13 |
14 | {{ label || '合计:' }}
15 |
16 | {{ currency }} {{ priceStr }}
17 |
18 |
19 |
20 |
30 | {{ loading ? '' : buttonText }}
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/dist/submit-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-submit-bar{z-index:100;position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none}.van-submit-bar__tip{padding:10px;color:#f56723;font-size:12px;line-height:18px;background-color:#fff7cc}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:50px;background-color:#fff;font-size:14px}.van-submit-bar__bar--safe{padding-bottom:34px}.van-submit-bar__text{-webkit-flex:1;flex:1;color:#333;font-weight:500;text-align:right}.van-submit-bar__price{color:#f44;font-size:18px;padding-right:12px}.van-submit-bar__currency{font-size:14px}.van-submit-bar__button button{width:110px}
--------------------------------------------------------------------------------
/dist/swipe-cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/swipe-cell/index.wxml:
--------------------------------------------------------------------------------
1 |
10 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/dist/swipe-cell/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-swipe-cell{position:relative;overflow:hidden}.van-swipe-cell__left,.van-swipe-cell__right{position:absolute;top:0;height:100%}.van-swipe-cell__left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}
--------------------------------------------------------------------------------
/dist/switch-cell/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | props: {
5 | title: String,
6 | border: Boolean,
7 | checked: Boolean,
8 | loading: Boolean,
9 | disabled: Boolean,
10 | activeColor: String,
11 | inactiveColor: String,
12 | size: {
13 | type: String,
14 | value: '24px'
15 | }
16 | },
17 | watch: {
18 | checked: function checked(value) {
19 | this.set({
20 | value: value
21 | });
22 | }
23 | },
24 | created: function created() {
25 | this.set({
26 | value: this.data.checked
27 | });
28 | },
29 | methods: {
30 | onChange: function onChange(event) {
31 | this.$emit('change', event.detail);
32 | }
33 | }
34 | });
--------------------------------------------------------------------------------
/dist/switch-cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index",
5 | "van-switch": "../switch/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/switch-cell/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
17 |
18 |
--------------------------------------------------------------------------------
/dist/switch-cell/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-switch-cell{padding-top:9px;padding-bottom:9px}.van-switch-cell__switch{vertical-align:middle}
--------------------------------------------------------------------------------
/dist/switch/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | classes: ['node-class'],
5 | props: {
6 | checked: Boolean,
7 | loading: Boolean,
8 | disabled: Boolean,
9 | activeColor: String,
10 | inactiveColor: String,
11 | size: {
12 | type: String,
13 | value: '30px'
14 | }
15 | },
16 | watch: {
17 | checked: function checked(value) {
18 | this.set({
19 | value: value
20 | });
21 | }
22 | },
23 | created: function created() {
24 | this.set({
25 | value: this.data.checked
26 | });
27 | },
28 | methods: {
29 | onClick: function onClick() {
30 | if (!this.data.disabled && !this.data.loading) {
31 | var checked = !this.data.checked;
32 | this.$emit('input', checked);
33 | this.$emit('change', checked);
34 | }
35 | }
36 | }
37 | });
--------------------------------------------------------------------------------
/dist/switch/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../loading/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/dist/switch/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dist/switch/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-switch{display:inline-block;position:relative;width:2em;height:1em;border:1px solid rgba(0,0,0,.1);border-radius:1em;box-sizing:content-box;background-color:#fff;transition:background-color .3s}.van-switch__node{top:0;left:0;position:absolute;border-radius:100%;width:1em;height:1em;z-index:1;transition:.3s;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);background-color:#fff}.van-switch__loading{top:25%;left:25%;position:absolute!important}.van-switch--on{background-color:#1989fa}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em)}.van-switch--disabled{opacity:.4}
--------------------------------------------------------------------------------
/dist/tab/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'tabs',
5 | type: 'ancestor'
6 | },
7 | props: {
8 | title: String,
9 | disabled: Boolean
10 | },
11 | data: {
12 | inited: false,
13 | active: false,
14 | animated: false,
15 | width: null
16 | },
17 | watch: {
18 | title: 'update',
19 | disabled: 'update'
20 | },
21 | methods: {
22 | update: function update() {
23 | var parent = this.getRelationNodes('../tabs/index')[0];
24 |
25 | if (parent) {
26 | parent.updateTabs();
27 | }
28 | }
29 | }
30 | });
--------------------------------------------------------------------------------
/dist/tab/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/tab/index.wxml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/dist/tab/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tab__pane{box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
--------------------------------------------------------------------------------
/dist/tabbar-item/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | info: null,
5 | icon: String,
6 | dot: Boolean
7 | },
8 | relation: {
9 | name: 'tabbar',
10 | type: 'ancestor'
11 | },
12 | data: {
13 | active: false
14 | },
15 | methods: {
16 | onClick: function onClick() {
17 | var parent = this.getRelationNodes('../tabbar/index')[0];
18 |
19 | if (parent) {
20 | parent.onChange(this);
21 | }
22 |
23 | this.$emit('click');
24 | },
25 | setActive: function setActive(_ref) {
26 | var active = _ref.active,
27 | color = _ref.color;
28 |
29 | if (this.data.active !== active) {
30 | this.set({
31 | active: active,
32 | color: color
33 | });
34 | }
35 | }
36 | }
37 | });
--------------------------------------------------------------------------------
/dist/tabbar-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-info": "../info/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/tabbar-item/index.wxml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/dist/tabbar-item/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-tabbar-item{color:#7d7e80;height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:12px;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-tabbar-item__icon{font-size:18px;margin-bottom:5px;position:relative}.van-tabbar-item__icon--dot::after{top:0;right:-8px;width:8px;height:8px;content:' ';position:absolute;border-radius:100%;background-color:#f44}.van-tabbar-item__icon image{width:30px;height:18px;display:block}.van-tabbar-item--active{color:#1989fa}
--------------------------------------------------------------------------------
/dist/tabbar/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex],
5 | relation: {
6 | name: 'tabbar-item',
7 | type: 'descendant',
8 | linked: function linked(target) {
9 | var _this = this;
10 |
11 | this.data.items.push(target);
12 | setTimeout(function () {
13 | _this.setActiveItem();
14 | });
15 | },
16 | unlinked: function unlinked(target) {
17 | var _this2 = this;
18 |
19 | this.data.items = this.data.items.filter(function (item) {
20 | return item !== target;
21 | });
22 | setTimeout(function () {
23 | _this2.setActiveItem();
24 | });
25 | }
26 | },
27 | props: {
28 | active: Number,
29 | activeColor: String,
30 | fixed: {
31 | type: Boolean,
32 | value: true
33 | },
34 | zIndex: {
35 | type: Number,
36 | value: 1
37 | }
38 | },
39 | data: {
40 | items: [],
41 | currentActive: -1
42 | },
43 | watch: {
44 | active: function active(_active) {
45 | this.set({
46 | currentActive: _active
47 | });
48 | this.setActiveItem();
49 | }
50 | },
51 | created: function created() {
52 | this.set({
53 | currentActive: this.data.active
54 | });
55 | },
56 | methods: {
57 | setActiveItem: function setActiveItem() {
58 | var _this3 = this;
59 |
60 | this.data.items.forEach(function (item, index) {
61 | item.setActive({
62 | active: index === _this3.data.currentActive,
63 | color: _this3.data.activeColor
64 | });
65 | });
66 | },
67 | onChange: function onChange(child) {
68 | var active = this.data.items.indexOf(child);
69 |
70 | if (active !== this.data.currentActive && active !== -1) {
71 | this.$emit('change', active);
72 | this.set({
73 | currentActive: active
74 | });
75 | this.setActiveItem();
76 | }
77 | }
78 | }
79 | });
--------------------------------------------------------------------------------
/dist/tabbar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/dist/tabbar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dist/tabbar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:34px}
--------------------------------------------------------------------------------
/dist/tabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/tabs/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
20 |
21 | {{ item.title }}
22 |
23 |
24 |
25 |
26 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/dist/tabs/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{top:0;left:0;right:0;position:absolute}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border:1px solid #f44;border-radius:2px}.van-tabs__nav{display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none;position:relative;background-color:#fff}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px}.van-tabs__nav--card .van-tab{color:#f44;border-right:1px solid #f44;line-height:30px}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;background-color:#f44}.van-tabs__line{z-index:1;left:0;bottom:0;height:2px;position:absolute;background-color:#f44;border-radius:2px}.van-tabs--line{padding-top:44px}.van-tabs--line .van-tabs__wrap{height:44px}.van-tabs--card{padding-top:30px;margin:0 15px}.van-tabs--card .van-tabs__wrap{height:30px}.van-tabs__content{overflow:hidden}.van-tabs__track{position:relative}.van-tab{-webkit-flex:1;flex:1;cursor:pointer;padding:0 5px;font-size:14px;position:relative;color:#7d7e80;line-height:44px;text-align:center;box-sizing:border-box;background-color:#fff;min-width:0}.van-tab--active{font-weight:500;color:#333}.van-tab--disabled{color:#c9c9c9}
--------------------------------------------------------------------------------
/dist/tag/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { RED, BLUE, GREEN } from '../common/color';
3 | var DEFAULT_COLOR = '#999';
4 | var COLOR_MAP = {
5 | danger: RED,
6 | primary: BLUE,
7 | success: GREEN
8 | };
9 | VantComponent({
10 | props: {
11 | size: String,
12 | type: String,
13 | mark: Boolean,
14 | color: String,
15 | plain: Boolean,
16 | round: Boolean,
17 | textColor: String
18 | },
19 | computed: {
20 | style: function style() {
21 | var color = this.data.color || COLOR_MAP[this.data.type] || DEFAULT_COLOR;
22 | var key = this.data.plain ? 'color' : 'background-color';
23 | var style = {
24 | [key]: color
25 | };
26 |
27 | if (this.data.textColor) {
28 | style.color = this.data.textColor;
29 | }
30 |
31 | return Object.keys(style).map(function (key) {
32 | return key + ": " + style[key];
33 | }).join(';');
34 | }
35 | }
36 | });
--------------------------------------------------------------------------------
/dist/tag/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/tag/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dist/tag/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tag{color:#fff;font-size:10px;padding:.2em .5em;line-height:normal;border-radius:.2em;display:inline-block}.van-tag::after{border-color:currentColor;border-radius:.4em}.van-tag--mark{padding-right:.6em;border-radius:0 .8em .8em 0}.van-tag--mark::after{border-radius:0 1.6em 1.6em 0}.van-tag--round{border-radius:.8em}.van-tag--round::after{border-radius:1.6em}.van-tag--medium{font-size:12px}.van-tag--large{font-size:14px}
--------------------------------------------------------------------------------
/dist/toast/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | show: Boolean,
5 | mask: Boolean,
6 | message: String,
7 | forbidClick: Boolean,
8 | zIndex: {
9 | type: Number,
10 | value: 1000
11 | },
12 | type: {
13 | type: String,
14 | value: 'text'
15 | },
16 | loadingType: {
17 | type: String,
18 | value: 'circular'
19 | },
20 | position: {
21 | type: String,
22 | value: 'middle'
23 | }
24 | },
25 | methods: {
26 | clear: function clear() {
27 | this.set({
28 | show: false
29 | });
30 | },
31 | // for prevent touchmove
32 | noop: function noop() {}
33 | }
34 | });
--------------------------------------------------------------------------------
/dist/toast/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-loading": "../loading/index",
6 | "van-overlay": "../overlay/index",
7 | "van-transition": "../transition/index"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/dist/toast/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
16 |
17 | {{ message }}
18 |
19 |
20 |
21 |
27 |
28 | {{ message }}
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/dist/toast/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;color:#fff;font-size:14px;line-height:20px;border-radius:4px;word-break:break-all;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;box-sizing:content-box;background-color:rgba(0,0,0,.7)}.van-toast__container{position:fixed;top:50%;left:50%;max-width:70%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:8px 12px;min-width:96px}.van-toast--icon{width:90px;padding:15px;min-height:90px}.van-toast--icon .van-toast__icon{font-size:48px}.van-toast--icon .van-toast__text{padding-top:5px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)}
--------------------------------------------------------------------------------
/dist/toast/toast.js:
--------------------------------------------------------------------------------
1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2 |
3 | import { isObj } from '../common/utils';
4 | var defaultOptions = {
5 | type: 'text',
6 | mask: false,
7 | message: '',
8 | show: true,
9 | zIndex: 1000,
10 | duration: 3000,
11 | position: 'middle',
12 | forbidClick: false,
13 | loadingType: 'circular',
14 | selector: '#van-toast'
15 | };
16 | var queue = [];
17 |
18 | var currentOptions = _extends({}, defaultOptions);
19 |
20 | function parseOptions(message) {
21 | return isObj(message) ? message : {
22 | message: message
23 | };
24 | }
25 |
26 | function getContext() {
27 | var pages = getCurrentPages();
28 | return pages[pages.length - 1];
29 | }
30 |
31 | var Toast = function Toast(options) {
32 | if (options === void 0) {
33 | options = {};
34 | }
35 |
36 | options = _extends({}, currentOptions, parseOptions(options));
37 | var context = options.context || getContext();
38 | var toast = context.selectComponent(options.selector);
39 |
40 | if (!toast) {
41 | console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确');
42 | return;
43 | }
44 |
45 | delete options.context;
46 | delete options.selector;
47 | queue.push(toast);
48 | toast.set(options);
49 | clearTimeout(toast.timer);
50 |
51 | if (options.duration > 0) {
52 | toast.timer = setTimeout(function () {
53 | toast.clear();
54 | queue = queue.filter(function (item) {
55 | return item !== toast;
56 | });
57 | }, options.duration);
58 | }
59 |
60 | return toast;
61 | };
62 |
63 | var createMethod = function createMethod(type) {
64 | return function (options) {
65 | return Toast(_extends({
66 | type: type
67 | }, parseOptions(options)));
68 | };
69 | };
70 |
71 | ['loading', 'success', 'fail'].forEach(function (method) {
72 | Toast[method] = createMethod(method);
73 | });
74 |
75 | Toast.clear = function () {
76 | queue.forEach(function (toast) {
77 | toast.clear();
78 | });
79 | queue = [];
80 | };
81 |
82 | Toast.setDefaultOptions = function (options) {
83 | Object.assign(currentOptions, options);
84 | };
85 |
86 | Toast.resetDefaultOptions = function () {
87 | currentOptions = _extends({}, defaultOptions);
88 | };
89 |
90 | export default Toast;
--------------------------------------------------------------------------------
/dist/transition/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { transition } from '../mixins/transition';
3 | VantComponent({
4 | mixins: [transition(true)],
5 | props: {
6 | name: {
7 | type: String,
8 | value: 'fade'
9 | }
10 | }
11 | });
--------------------------------------------------------------------------------
/dist/transition/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/transition/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dist/tree-select/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | var ITEM_HEIGHT = 44;
3 | VantComponent({
4 | classes: ['main-item-class', 'content-item-class', 'main-active-class', 'content-active-class', 'main-disabled-class', 'content-disabled-class'],
5 | props: {
6 | items: Array,
7 | mainActiveIndex: {
8 | type: Number,
9 | value: 0
10 | },
11 | activeId: {
12 | type: [Number, String]
13 | },
14 | maxHeight: {
15 | type: Number,
16 | value: 300
17 | }
18 | },
19 | data: {
20 | subItems: [],
21 | mainHeight: 0,
22 | itemHeight: 0
23 | },
24 | watch: {
25 | items: function items() {
26 | this.updateSubItems();
27 | this.updateMainHeight();
28 | },
29 | maxHeight: function maxHeight() {
30 | this.updateItemHeight();
31 | this.updateMainHeight();
32 | },
33 | mainActiveIndex: 'updateSubItems'
34 | },
35 | methods: {
36 | // 当一个子项被选择时
37 | onSelectItem: function onSelectItem(event) {
38 | var item = event.currentTarget.dataset.item;
39 |
40 | if (!item.disabled) {
41 | this.$emit('click-item', item);
42 | }
43 | },
44 | // 当一个导航被点击时
45 | onClickNav: function onClickNav(event) {
46 | var index = event.currentTarget.dataset.index;
47 | var item = this.data.items[index];
48 |
49 | if (!item.disabled) {
50 | this.$emit('click-nav', {
51 | index: index
52 | });
53 | }
54 | },
55 | // 更新子项列表
56 | updateSubItems: function updateSubItems() {
57 | var selectedItem = this.data.items[this.data.mainActiveIndex] || {};
58 | this.set({
59 | subItems: selectedItem.children || []
60 | });
61 | this.updateItemHeight();
62 | },
63 | // 更新组件整体高度,根据最大高度和当前组件需要展示的高度来决定
64 | updateMainHeight: function updateMainHeight() {
65 | var maxHeight = Math.max(this.data.items.length * ITEM_HEIGHT, this.data.subItems.length * ITEM_HEIGHT);
66 | this.set({
67 | mainHeight: Math.min(maxHeight, this.data.maxHeight)
68 | });
69 | },
70 | // 更新子项列表高度,根据可展示的最大高度和当前子项列表的高度决定
71 | updateItemHeight: function updateItemHeight() {
72 | this.set({
73 | itemHeight: Math.min(this.data.subItems.length * ITEM_HEIGHT, this.data.maxHeight)
74 | });
75 | }
76 | }
77 | });
--------------------------------------------------------------------------------
/dist/tree-select/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-cell": "../cell/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/dist/tree-select/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
15 | {{ item.text }}
16 |
17 |
18 |
23 |
30 | {{ item.text }}
31 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/dist/tree-select/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tree-select{position:relative;font-size:14px;-webkit-user-select:none;user-select:none}.van-tree-select__nav{position:absolute;top:0;bottom:0;left:0;width:35%;min-width:120px;background-color:#fafafa}.van-tree-select__nitem{position:relative;padding:0 9px 0 15px;line-height:44px}.van-tree-select__nitem--active::after,.van-tree-select__nitem:active::after{position:absolute;top:0;bottom:0;left:0;width:3.6px;background-color:#f44;content:''}.van-tree-select__nitem--active{font-weight:700;background-color:#fff}.van-tree-select__nitem--disabled{color:#999}.van-tree-select__nitem--disabled:active::after{display:none}.van-tree-select__content{width:65%;padding-left:15px;margin-left:35%;background-color:#fff;box-sizing:border-box}.van-tree-select__item{position:relative;font-weight:700;line-height:44px}.van-tree-select__item--active,.van-tree-select__item:active{color:#f44}.van-tree-select__item--disabled,.van-tree-select__item--disabled:active{color:#999}.van-tree-select__selected{position:absolute;top:0;right:15px;bottom:0;height:24px;margin:auto 0;line-height:24px}
--------------------------------------------------------------------------------
/dist/wxs/array.wxs:
--------------------------------------------------------------------------------
1 | function isArray(array) {
2 | return array && array.constructor === 'Array';
3 | }
4 |
5 | module.exports.isArray = isArray;
6 |
--------------------------------------------------------------------------------
/dist/wxs/bem.wxs:
--------------------------------------------------------------------------------
1 | var array = require('./array.wxs');
2 | var object = require('./object.wxs');
3 | var PREFIX = 'van-';
4 |
5 | function join(name, mods) {
6 | name = PREFIX + name;
7 | mods = mods.map(function(mod) {
8 | return name + '--' + mod;
9 | });
10 | mods.unshift(name);
11 | return mods.join(' ');
12 | }
13 |
14 | function traversing(mods, conf) {
15 | if (!conf) {
16 | return;
17 | }
18 |
19 | if (typeof conf === 'string' || typeof conf === 'number') {
20 | mods.push(conf);
21 | } else if (array.isArray(conf)) {
22 | conf.forEach(function(item) {
23 | traversing(mods, item);
24 | });
25 | } else if (typeof conf === 'object') {
26 | object.keys(conf).forEach(function(key) {
27 | conf[key] && mods.push(key);
28 | });
29 | }
30 | }
31 |
32 | function bem(name, conf) {
33 | var mods = [];
34 | traversing(mods, conf);
35 | return join(name, mods);
36 | }
37 |
38 | module.exports.bem = bem;
39 |
--------------------------------------------------------------------------------
/dist/wxs/memoize.wxs:
--------------------------------------------------------------------------------
1 | /**
2 | * Simple memoize
3 | * wxs doesn't support fn.apply, so this memoize only support up to 2 args
4 | */
5 |
6 | function isPrimitive(value) {
7 | var type = typeof value;
8 | return (
9 | type === 'boolean' ||
10 | type === 'number' ||
11 | type === 'string' ||
12 | type === 'undefined' ||
13 | value === null
14 | );
15 | }
16 |
17 | // mock simple fn.call in wxs
18 | function call(fn, args) {
19 | if (args.length === 2) {
20 | return fn(args[0], args[1]);
21 | }
22 |
23 | if (args.length === 1) {
24 | return fn(args[0]);
25 | }
26 |
27 | return fn();
28 | }
29 |
30 | function serializer(args) {
31 | if (args.length === 1 && isPrimitive(args[0])) {
32 | return args[0];
33 | }
34 | var obj = {};
35 | for (var i = 0; i < args.length; i++) {
36 | obj['key' + i] = args[i];
37 | }
38 | return JSON.stringify(obj);
39 | }
40 |
41 | function memoize(fn) {
42 | var cache = {};
43 |
44 | return function() {
45 | var key = serializer(arguments);
46 | if (cache[key] === undefined) {
47 | cache[key] = call(fn, arguments);
48 | }
49 |
50 | return cache[key];
51 | };
52 | }
53 |
54 | module.exports.memoize = memoize;
55 |
--------------------------------------------------------------------------------
/dist/wxs/object.wxs:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | var REGEXP = getRegExp('{|}|"', 'g');
3 |
4 | function keys(obj) {
5 | return JSON.stringify(obj)
6 | .replace(REGEXP, '')
7 | .split(',')
8 | .map(function(item) {
9 | return item.split(':')[0];
10 | });
11 | }
12 |
13 | module.exports.keys = keys;
14 |
--------------------------------------------------------------------------------
/dist/wxs/utils.wxs:
--------------------------------------------------------------------------------
1 | var bem = require('./bem.wxs').bem;
2 | var memoize = require('./memoize.wxs').memoize;
3 |
4 | function isSrc(url) {
5 | return url.indexOf('http') === 0 || url.indexOf('data:image') === 0 || url.indexOf('//') === 0;
6 | }
7 |
8 | module.exports = {
9 | bem: memoize(bem),
10 | isSrc: isSrc,
11 | memoize: memoize
12 | };
13 |
--------------------------------------------------------------------------------
/images/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/images/home.png
--------------------------------------------------------------------------------
/images/home_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/images/home_s.png
--------------------------------------------------------------------------------
/images/home_s.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/images/settings.png
--------------------------------------------------------------------------------
/images/settings_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/images/settings_s.png
--------------------------------------------------------------------------------
/images/timeline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/images/timeline.png
--------------------------------------------------------------------------------
/images/timeline_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IooBot/appointment_miniprogram/8cc74b2d1aa2ab9ee1f3cca5bdd19af7a5cfa031/images/timeline_s.png
--------------------------------------------------------------------------------
/pages/home/contact/contact.js:
--------------------------------------------------------------------------------
1 | // import Notify from '../../dist/notify/notify';
2 | const { fetchGraphql } = require('../../../utils/util.js');
3 | const { userbyid, updateuser } = require('../../../config/gql.js');
4 | const app = getApp();
5 |
6 | Component({
7 | /**
8 | * 组件的属性列表
9 | */
10 | properties: {
11 |
12 | },
13 |
14 | lifetimes: {
15 | attached() {
16 | fetchGraphql(userbyid, { id: app.globalData.userID }, 'user', 'userbyid', this).then(user => {
17 | this.setData({
18 | phone: user.telephone,
19 | name: user.nickname,
20 | loading: false
21 | })
22 | });
23 | }
24 | },
25 |
26 | data: {
27 | loading: true,
28 | phone: '',
29 | name: ''
30 | },
31 |
32 | methods: {
33 | phoneInput: function (e) {
34 | this.setData({
35 | phone: e.detail
36 | })
37 | },
38 | nameInput: function (e) {
39 | this.setData({
40 | name: e.detail
41 | })
42 | },
43 |
44 | submit: function() {
45 | let {name, phone} = this.data;
46 | if(name && phone) {
47 | fetchGraphql(updateuser,
48 | {
49 | id: app.globalData.userID,
50 | telephone: phone,
51 | nickname: name,
52 | updatedAt: Date.now()
53 | },
54 | null,
55 | 'updateuser',
56 | null
57 | )
58 | .then(user => {
59 | console.log(user);
60 | wx.showToast({
61 | title: '修改成功',
62 | icon: 'success'
63 | });
64 | });
65 |
66 | } else {
67 | wx.showToast({
68 | title: '无效的姓名或联系方式',
69 | icon: 'none',
70 | duration: 1000
71 | })
72 | }
73 |
74 |
75 | },
76 | reset: function() {
77 | this.setData({
78 | name: '',
79 | phone: ''
80 | })
81 | }
82 | }
83 | });
84 |
--------------------------------------------------------------------------------
/pages/home/contact/contact.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../../../dist/loading/index",
5 | "van-cell-group": "../../dist/cell-group/index",
6 | "van-cell": "../../../dist/cell/index",
7 | "van-button": "../../../dist/button/index",
8 | "van-field": "../../dist/field/index",
9 | "van-notify": "../../dist/notify/index"
10 | }
11 | }
--------------------------------------------------------------------------------
/pages/home/contact/contact.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
21 |
22 |
23 |
24 | 提交
25 | 重置
26 |
27 |
--------------------------------------------------------------------------------
/pages/home/contact/contact.wxss:
--------------------------------------------------------------------------------
1 | /* pages/home/contact/contact.wxss */
2 | .loading {
3 | width: 180rpx;
4 | height: 180rpx;
5 | background-color: #7d7d7d;
6 | border-radius: 6rpx;
7 | margin: 350rpx auto;
8 | }
9 |
10 | .loading-spin {
11 | padding: 50rpx;
12 | }
13 |
14 | .button-group {
15 | float: right;
16 | margin-right: 20rpx;
17 | margin-top: 20rpx;
18 | }
19 | .button {
20 | margin-right: 10rpx;
21 | }
--------------------------------------------------------------------------------
/pages/home/home.js:
--------------------------------------------------------------------------------
1 | // pages/home/home.js
2 | Page({
3 | data: {
4 | activeTab: 0,
5 | kind: 'success',
6 | refresh: ''
7 | },
8 |
9 | onReady() {
10 | wx.setNavigationBarTitle({
11 | title: '我的信息'
12 | })
13 | },
14 |
15 | onPullDownRefresh: function () {
16 | console.log('home 下拉');
17 | this.setData({
18 | refresh: Date.now()
19 | })
20 | },
21 |
22 | switchTab(e) {
23 | switch(e.detail.index) {
24 | case 0:
25 | this.setData({
26 | kind: 'success',
27 | activeTab: 0
28 | });
29 | break;
30 | case 1:
31 | this.setData({
32 | kind: 'cancelled',
33 | activeTab: 1
34 | });
35 | break;
36 | case 2:
37 | this.setData({
38 | kind: '',
39 | activeTab: 2
40 | });
41 | break;
42 | defalut:
43 | break;
44 | }
45 | }
46 | });
47 |
--------------------------------------------------------------------------------
/pages/home/home.json:
--------------------------------------------------------------------------------
1 | {
2 | "enablePullDownRefresh": true,
3 | "usingComponents": {
4 | "van-tab": "../../dist/tab/index",
5 | "van-tabs": "../../dist/tabs/index",
6 | "showMy": "./showMy/showMy",
7 | "contact": "./contact/contact"
8 | },
9 | "backgroundTextStyle": "dark",
10 | "backgroundColor": "#ffffff"
11 | }
--------------------------------------------------------------------------------
/pages/home/home.wxml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/pages/home/home.wxss:
--------------------------------------------------------------------------------
1 | /* pages/home/home.wxss */
2 | .tabbar {
3 |
4 | }
--------------------------------------------------------------------------------
/pages/home/showMy/showMy.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../../../dist/loading/index",
5 | "van-card": "../../../dist/card/index",
6 | "van-button": "../../../dist/button/index",
7 | "van-dialog": "../../../dist/dialog/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/home/showMy/showMy.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 你还没有订单呢
6 |
7 |
8 |
19 |
20 |
29 | 取消
30 |
31 |
38 | 删除
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/pages/home/showMy/showMy.wxss:
--------------------------------------------------------------------------------
1 | /* pages/home/showMy/showMy.wxss */
2 | .loading {
3 | width: 180rpx;
4 | height: 180rpx;
5 | background-color: #7d7d7d;
6 | border-radius: 6rpx;
7 | margin: 350rpx auto;
8 | }
9 |
10 | .loading-spin {
11 | padding: 50rpx;
12 | }
13 |
14 | .no-order {
15 | margin: 50rpx 0 0 250rpx;
16 | color: #999999;
17 | font-size: 30rpx;
18 | }
19 |
20 | .title {
21 | color: black;
22 | font-size: 34rpx;
23 | font-weight: bold;
24 | margin-top: 10rpx;
25 | }
26 |
27 | .description {
28 | margin-top: 10rpx;
29 | color: #999999;
30 | font-size: 30rpx;
31 | }
32 |
33 | .count {
34 | font-size: 25rpx;
35 | }
36 |
37 | .price {
38 | font-size: 40rpx;
39 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 | data: {
7 | motto: 'Hello Wo-rld',
8 | userInfo: {},
9 | hasUserInfo: false,
10 | canIUse: wx.canIUse('button.open-type.getUserInfo')
11 | },
12 | //事件处理函数
13 | bindViewTap: function () {
14 | wx.navigateTo({
15 | url: '../logs/logs'
16 | })
17 | },
18 | onLoad: function () {
19 | if (app.globalData.userInfo) {
20 | this.setData({
21 | userInfo: app.globalData.userInfo,
22 | hasUserInfo: true
23 | })
24 | } else if (this.data.canIUse) {
25 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
26 | // 所以此处加入 callback 以防止这种情况
27 | app.userInfoReadyCallback = res => {
28 | this.setData({
29 | userInfo: res.userInfo,
30 | hasUserInfo: true
31 | })
32 | }
33 | } else {
34 | // 在没有 open-type=getUserInfo 版本的兼容处理
35 | wx.getUserInfo({
36 | success: res => {
37 | app.globalData.userInfo = res.userInfo
38 | this.setData({
39 | userInfo: res.userInfo,
40 | hasUserInfo: true
41 | })
42 | }
43 | })
44 | }
45 | },
46 | getUserInfo: function (e) {
47 | console.log(e)
48 | app.globalData.userInfo = e.detail.userInfo
49 | this.setData({
50 | userInfo: e.detail.userInfo,
51 | hasUserInfo: true
52 | })
53 | }
54 | })
55 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{userInfo.nickName}}
8 |
9 |
10 |
11 | {{motto}}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .userinfo {
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | }
7 |
8 | .userinfo-avatar {
9 | width: 128rpx;
10 | height: 128rpx;
11 | margin: 20rpx;
12 | border-radius: 50%;
13 | }
14 |
15 | .userinfo-nickname {
16 | color: #aaa;
17 | }
18 |
19 | .usermotto {
20 | margin-top: 200px;
21 | }
--------------------------------------------------------------------------------
/pages/manage/allOrders/allOrders.js:
--------------------------------------------------------------------------------
1 | // pages/manage/allOrders/allOrders.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {},
7 |
8 | /**
9 | * 组件的初始数据
10 | */
11 | data: {
12 | columns: ['成功', '已取消', '已删除', '全部'],
13 | showPopup: false,
14 | kind: 'success',
15 | kindType: '成功'
16 | },
17 |
18 | /**
19 | * 组件的方法列表
20 | */
21 | methods: {
22 | onConfirm(e) {
23 | const {value, index} = e.detail;
24 | switch (index) {
25 | case 0:
26 | this.setData({
27 | kind: 'success',
28 | kindType: value
29 | });
30 | break;
31 | case 1:
32 | this.setData({
33 | kind: 'cancelled',
34 | kindType: value
35 | });
36 | case 2:
37 | this.setData({
38 | kind: 'deleted',
39 | kindType: value
40 | });
41 | case 3:
42 | this.setData({
43 | kind: 'all',
44 | kindType: value
45 | });
46 | break;
47 | defalut:
48 | break;
49 | }
50 | this.setData({
51 | showPopup: false
52 | })
53 | },
54 |
55 | onCancel() {
56 | this.setData({
57 | showPopup: false
58 | })
59 | },
60 |
61 | selectType() {
62 | this.setData({
63 | showPopup: true
64 | })
65 | }
66 | }
67 | });
68 |
--------------------------------------------------------------------------------
/pages/manage/allOrders/allOrders.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-notice-bar": "../../../dist/notice-bar/index",
5 | "van-picker": "../../../dist/picker/index",
6 | "van-popup": "../../../dist/popup/index",
7 | "van-cell": "../../../dist/cell/index",
8 | "SelectedOrders": "./selectedOrders/selectedOrders"
9 | }
10 | }
--------------------------------------------------------------------------------
/pages/manage/allOrders/allOrders.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
14 |
15 |
19 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/pages/manage/allOrders/allOrders.wxss:
--------------------------------------------------------------------------------
1 | /* pages/manage/allOrders/allOrders.wxss */
--------------------------------------------------------------------------------
/pages/manage/allOrders/selectedOrders/selectedOrders.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../../../../dist/loading/index",
5 | "van-card": "../../../../dist/card/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/manage/allOrders/selectedOrders/selectedOrders.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 这里还没有订单呢
7 |
8 |
9 |
10 |
11 |
22 |
23 |
--------------------------------------------------------------------------------
/pages/manage/allOrders/selectedOrders/selectedOrders.wxss:
--------------------------------------------------------------------------------
1 | .loading {
2 | width: 180rpx;
3 | height: 180rpx;
4 | background-color: #7d7d7d;
5 | border-radius: 6rpx;
6 | margin: 350rpx auto;
7 | }
8 |
9 | .loading-spin {
10 | padding: 50rpx;
11 | }
12 |
13 | .no-order {
14 | margin: 50rpx 0 0 250rpx;
15 | color: #999999;
16 | font-size: 30rpx;
17 | }
18 |
19 | .title {
20 | color: black;
21 | font-size: 34rpx;
22 | font-weight: bold;
23 | margin-top: 10rpx;
24 | }
25 |
26 | .description {
27 | margin-top: 10rpx;
28 | color: #999999;
29 | font-size: 30rpx;
30 | }
31 |
32 | .count {
33 | font-size: 25rpx;
34 | }
35 |
36 | .price {
37 | font-size: 40rpx;
38 | }
--------------------------------------------------------------------------------
/pages/manage/manage.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | activeTab: 0,
4 | refresh: ''
5 | },
6 |
7 | onReady() {
8 | wx.setNavigationBarTitle({
9 | title: '店主管理'
10 | })
11 | },
12 |
13 | switchTab(e) {
14 | this.setData({
15 | activeTab: e.detail.index
16 | });
17 | },
18 |
19 | onPullDownRefresh: function () {
20 | console.log('manage 下拉');
21 | this.setData({
22 | refresh: Date.now()
23 | })
24 | },
25 | });
26 |
--------------------------------------------------------------------------------
/pages/manage/manage.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "van-notice-bar": "../../../dist/notice-bar/index",
4 | "van-picker": "../../../dist/picker/index",
5 | "van-popup": "../../../dist/popup/index",
6 | "van-cell": "../../../dist/cell/index",
7 | "van-tab": "../../../dist/tab/index",
8 | "van-tabs": "../../../dist/tabs/index",
9 | "AllOrders": "./allOrders/allOrders",
10 | "Release": "./release/release"
11 | },
12 | "enablePullDownRefresh": true,
13 | "backgroundTextStyle": "dark",
14 | "backgroundColor": "#ffffff"
15 | }
--------------------------------------------------------------------------------
/pages/manage/manage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/pages/manage/manage.wxss:
--------------------------------------------------------------------------------
1 | .picker {
2 | position: absolute;
3 | bottom: 0
4 | }
--------------------------------------------------------------------------------
/pages/manage/release/release.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-notice-bar": "../../../dist/notice-bar/index",
5 | "van-cell": "../../../dist/cell/index",
6 | "van-cell-group": "../../../dist/cell-group/index",
7 | "ServiceShow": "./serviceShow/serviceShow",
8 | "ServerAdd": "./serverAdd/serverAdd"
9 | }
10 | }
--------------------------------------------------------------------------------
/pages/manage/release/release.wxml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 | 没有服务
11 |
12 |
13 | 服务
14 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/pages/manage/release/release.wxss:
--------------------------------------------------------------------------------
1 | /* pages/manage/release/release.wxss */
2 | .loading {
3 | width: 180rpx;
4 | height: 180rpx;
5 | background-color: #7d7d7d;
6 | border-radius: 6rpx;
7 | position: absolute;
8 | top: 50%;
9 | left: 50%;
10 | transform: translate(-50%, -50%);
11 | }
12 |
13 | .loading-spin {
14 | padding: 50rpx;
15 | }
16 |
17 | .avatar {
18 | width: 60rpx;
19 | height: 60rpx;
20 | background-repeat: no-repeat;
21 | background-size: 100% 100%;
22 | border-radius: 10rpx;
23 | border: 1rpx solid #eee;
24 | overflow: hidden;
25 | margin-right: 15rpx;
26 | }
27 |
28 | .cell-title {
29 | color: #969799;
30 | font-weight: 400;
31 | font-size: 35rpx;
32 | padding: 40rpx 20rpx 20rpx;
33 | }
--------------------------------------------------------------------------------
/pages/manage/release/serverAdd/serverAdd.js:
--------------------------------------------------------------------------------
1 | import {idGen, fetchGraphql} from '../../../../utils/util';
2 | import {createserver} from '../../../../config/gql';
3 |
4 | Component({
5 | properties: {},
6 |
7 | data: {
8 | name: '',
9 | remark: ''
10 | },
11 |
12 | methods: {
13 | nameInput(e) {
14 | this.setData({
15 | name: e.detail
16 | })
17 | },
18 |
19 | remarkInput(e) {
20 | this.setData({
21 | remark: e.detail
22 | })
23 | },
24 |
25 | submit() {
26 | let {name, remark} = this.data;
27 | fetchGraphql(createserver,
28 | {
29 | id: idGen('server'),
30 | name,
31 | description: remark,
32 | img: '',
33 | createdAt: Date.now(),
34 | updatedAt: ''
35 | },
36 | null,
37 | 'createserver',
38 | null
39 | )
40 | .then(server => {
41 | wx.startPullDownRefresh();
42 | });
43 | },
44 |
45 | reset() {
46 | this.setData({
47 | name: '',
48 | remark: ''
49 | })
50 | }
51 | }
52 | });
53 |
--------------------------------------------------------------------------------
/pages/manage/release/serverAdd/serverAdd.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-button": "../../../../dist/button/index",
5 | "van-cell-group": "../../../../dist/cell-group/index",
6 | "van-field": "../../../../dist/field/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/manage/release/serverAdd/serverAdd.wxml:
--------------------------------------------------------------------------------
1 |
2 | 添加新的技师
3 |
4 |
10 |
11 |
20 |
21 |
22 |
23 | 提交
24 | 重置
25 |
26 |
--------------------------------------------------------------------------------
/pages/manage/release/serverAdd/serverAdd.wxss:
--------------------------------------------------------------------------------
1 | .loading {
2 | width: 180rpx;
3 | height: 180rpx;
4 | background-color: #7d7d7d;
5 | border-radius: 6rpx;
6 | position: absolute;
7 | top: 50%;
8 | left: 50%;
9 | transform: translate(-50%, -50%);
10 | }
11 |
12 | .loading-spin {
13 | padding: 50rpx;
14 | }
15 |
16 | .avatar {
17 | width: 60rpx;
18 | height: 60rpx;
19 | background-repeat: no-repeat;
20 | background-size: 100% 100%;
21 | border-radius: 10rpx;
22 | border: 1rpx solid #eee;
23 | overflow: hidden;
24 | margin-right: 15rpx;
25 | }
26 |
27 | .cell-title {
28 | color: #969799;
29 | font-weight: 400;
30 | font-size: 35rpx;
31 | padding: 40rpx 20rpx 20rpx;
32 | }
33 |
34 | .button-group {
35 | float: right;
36 | margin-right: 20rpx;
37 | margin-top: 20rpx;
38 | }
39 | .button {
40 | margin-right: 10rpx;
41 | }
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceRelease/serviceRelease.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-stepper": "../../../../../../dist/stepper/index",
5 | "van-field": "../../../../../../dist/field/index",
6 | "van-cell-group": "../../../../../../dist/cell-group/index",
7 | "van-cell": "../../../../../../dist/cell/index",
8 | "van-button": "../../../../../../dist/button/index"
9 | }
10 | }
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceRelease/serviceRelease.wxml:
--------------------------------------------------------------------------------
1 |
2 | 请输入服务项信息
3 |
9 |
10 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
30 | {{date}}
31 |
32 |
33 |
34 |
35 |
42 | {{startTime}}
43 |
44 |
45 |
46 |
53 | {{endTime}}
54 |
55 |
56 |
57 |
58 |
59 | 提交
60 | 重置
61 |
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceRelease/serviceRelease.wxss:
--------------------------------------------------------------------------------
1 |
2 | .cell-title {
3 | color: #969799;
4 | font-weight: 400;
5 | font-size: 35rpx;
6 | padding: 40rpx 20rpx 20rpx;
7 | }
8 |
9 | .button-group {
10 | float: right;
11 | margin-right: 20rpx;
12 | margin-top: 20rpx;
13 | margin-bottom: 20rpx;
14 | }
15 | .button {
16 | margin-right: 10rpx;
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceShow.js:
--------------------------------------------------------------------------------
1 | const {fetchGraphql} = require('../../../../utils/util.js');
2 | const {servicebyprops} = require('../../../../config/gql.js');
3 |
4 | Component({
5 | properties: {
6 | serverID: {
7 | type: String,
8 | observer(newVal) {
9 | this.setData({
10 | services: '',
11 | service: ''
12 | });
13 | if (newVal !== '') {
14 | fetchGraphql(servicebyprops,
15 | {server_id: newVal},
16 | 'services',
17 | 'servicebyprops',
18 | this
19 | )
20 | .then(services => {
21 | console.log(services);
22 | wx.hideLoading()
23 | })
24 | }
25 | }
26 | }
27 | },
28 |
29 | data: {
30 | services: '',
31 | service: ''
32 | },
33 |
34 | methods: {
35 | selectService(e) {
36 | let index = e.target.dataset.index;
37 | if(index === 'add') {
38 | this.setData({
39 | service: {id: 'add', server_id: {id: this.properties.serverID}}
40 | })
41 | } else {
42 | let service = this.data.services[index];
43 | delete service.server_id.img;
44 | this.setData({
45 | service
46 | });
47 | }
48 | }
49 | }
50 | });
51 |
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceShow.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../../../../dist/cell/index",
5 | "van-cell-group": "../../../../dist/cell-group/index",
6 | "ServiceRelease": "./serviceRelease/serviceRelease"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceShow.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | TA的服务项
7 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/pages/manage/release/serviceShow/serviceShow.wxss:
--------------------------------------------------------------------------------
1 |
2 | .cell-title {
3 | color: #969799;
4 | font-weight: 400;
5 | font-size: 35rpx;
6 | padding: 40rpx 20rpx 20rpx;
7 | }
8 |
--------------------------------------------------------------------------------
/pages/message/message.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "van-stepper": "../../dist/stepper/index",
4 | "van-field": "../../dist/field/index",
5 | "van-switch-cell": "../../dist/switch-cell/index",
6 | "van-cell-group": "../../dist/cell-group/index",
7 | "van-cell": "../../dist/cell/index",
8 | "van-button": "../../dist/button/index"
9 | }
10 | }
--------------------------------------------------------------------------------
/pages/message/message.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
37 |
38 |
39 |
40 |
41 | 提交
42 | 重置
43 |
44 |
45 |
46 | 名额已满
47 |
--------------------------------------------------------------------------------
/pages/message/message.wxss:
--------------------------------------------------------------------------------
1 | /* pages/message/message.wxss */
2 | .button-group {
3 | float: right;
4 | margin-right: 20rpx;
5 | margin-top: 20rpx;
6 | }
7 | .button {
8 | margin-right: 10rpx;
9 | }
--------------------------------------------------------------------------------
/pages/server/server.js:
--------------------------------------------------------------------------------
1 | // pages/display/display.js
2 | const {fetchGraphql} = require('../../utils/util.js');
3 | const {serverbyprops} = require('../../config/gql.js');
4 |
5 | Page({
6 | data: {
7 | servers: '',
8 | loading: true,
9 | imgUrls: [
10 | 'https://zos.alipayobjects.com/rmsportal/AiyWuByWklrrUDlFignR.png',
11 | 'https://zos.alipayobjects.com/rmsportal/TekJlZRVCjLFexlOCuWn.png',
12 | 'https://zos.alipayobjects.com/rmsportal/IJOtIlfsYdTyaDTRVrLI.png',
13 | ],
14 | indicatorDots: true,
15 | autoplay: true,
16 | interval: 5000,
17 | duration: 1000
18 | },
19 |
20 | useStorge() {
21 | const servers = wx.getStorageSync('servers');
22 | if (servers) {
23 | this.setData({
24 | servers,
25 | loading: false
26 | })
27 | } else {
28 | fetchGraphql(serverbyprops, {}, 'servers', 'serverbyprops', this).then(servers => {
29 | wx.setStorage({
30 | key: 'servers',
31 | data: servers
32 | });
33 | this.setData({
34 | loading: false
35 | })
36 | })
37 | }
38 | },
39 |
40 | noUserStorge() {
41 | fetchGraphql(serverbyprops, {}, 'servers', 'serverbyprops', this).then(servers => {
42 | this.setData({
43 | loading: false
44 | })
45 | })
46 | },
47 |
48 | onLoad() {
49 | this.noUserStorge();
50 | wx.setNavigationBarTitle({
51 | title: '选择一位技师'
52 | })
53 | },
54 |
55 | chooseMe(e) {
56 | wx.navigateTo({
57 | url: `../service/service?id=${e.target.id}`,
58 | })
59 | }
60 | });
61 |
--------------------------------------------------------------------------------
/pages/server/server.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "van-loading": "../../dist/loading/index",
4 | "van-row": "../../dist/row/index",
5 | "van-col": "../../dist/col/index",
6 | "van-button": "../../dist/button/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/server/server.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 没有技师为您服务
24 |
25 |
26 |
27 |
28 |
29 |
30 | {{server.name}}
31 | {{server.description}}
32 |
33 |
34 | 选我
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/pages/server/server.wxss:
--------------------------------------------------------------------------------
1 | /* pages/server/server.wxss */
2 | .loading {
3 | width: 180rpx;
4 | height: 180rpx;
5 | background-color: #7d7d7d;
6 | border-radius: 6rpx;
7 | position: absolute;
8 | top: 50%;
9 | left: 50%;
10 | transform: translate(-50%, -50%);
11 | }
12 |
13 | .loading-spin {
14 | padding: 50rpx;
15 | }
16 |
17 | .avatar {
18 | width: 70px;
19 | height: 70px;
20 | background-repeat: no-repeat;
21 | background-size: 100% 100%;
22 | border-radius: 50%;
23 | border: 3px solid #eee;
24 | overflow: hidden
25 | }
26 |
27 | .row {
28 | margin-top: 80rpx;
29 | }
30 |
31 | .server-name {
32 | color: black;
33 | font-size: larger;
34 | font-weight: bold;
35 | }
36 |
37 | .server-description {
38 | color: #999999;
39 | font-size: smaller;
40 | }
41 |
42 | .slide-image {
43 | width: 100%;
44 | height: 100%;
45 | }
46 |
47 | .slide-wrapper {
48 | text-align: center;
49 | }
--------------------------------------------------------------------------------
/pages/service/service.js:
--------------------------------------------------------------------------------
1 | // pages/service/service.js
2 | const {fetchGraphql, dateTime} = require('../../utils/util.js');
3 | const {servicebyprops} = require('../../config/gql.js');
4 |
5 | Page({
6 | data: {
7 | serverID: '',
8 | loading: true,
9 | services: ''
10 | },
11 |
12 | chooseThis(e) {
13 | wx.navigateTo({
14 | url: `../message/message?id=${e.target.id}&count=${e.target.dataset.count}&repertoryID=${e.target.dataset.repertoryid}`,
15 | })
16 | },
17 |
18 | onLoad: function (options) {
19 | this.setData({
20 | serverID: options.id
21 | });
22 | fetchGraphql(servicebyprops, {server_id: this.data.serverID}, null, 'servicebyprops', null).then(services => {
23 | services.forEach(service => {
24 | service.formatDate = dateTime(Number(service.startTime), true).date;
25 | service.formatStartTime = dateTime(Number(service.startTime), true).time;
26 | service.formatEndTime = dateTime(Number(service.startTime) + Number(service.lastTime), true).time;
27 | });
28 | this.setData({
29 | loading: false,
30 | services
31 | });
32 | });
33 | },
34 |
35 | onReady: function () {
36 | wx.setNavigationBarTitle({
37 | title: '选择TA的服务'
38 | })
39 | },
40 |
41 | onPullDownRefresh: function () {
42 |
43 | }
44 | });
--------------------------------------------------------------------------------
/pages/service/service.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "van-loading": "../../dist/loading/index",
4 | "van-card": "../../dist/card/index",
5 | "van-button": "../../dist/button/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/service/service.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 今日休息...
7 |
8 |
9 |
20 |
21 |
30 | 预约
31 |
32 | 名额已满
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/pages/service/service.wxss:
--------------------------------------------------------------------------------
1 | /* pages/service/service.wxss */
2 | .loading {
3 | width: 180rpx;
4 | height: 180rpx;
5 | background-color: #7d7d7d;
6 | border-radius: 6rpx;
7 | position: absolute;
8 | top: 50%;
9 | left: 50%;
10 | transform: translate(-50%, -50%);
11 | }
12 |
13 | .loading-spin {
14 | padding: 50rpx;
15 | }
16 |
17 | .rest {
18 | position: absolute;
19 | top: 50%;
20 | left: 50%;
21 | transform: translate(-50%, -50%);
22 | }
23 |
24 | .card {
25 | margin-bottom: 10rpx
26 | }
27 |
28 |
29 | .title {
30 | color: black;
31 | font-size: 34rpx;
32 | font-weight: bold;
33 | margin-top: 10rpx;
34 | }
35 |
36 | .description {
37 | margin-top: 10rpx;
38 | color: #999999;
39 | font-size: 30rpx;
40 | }
41 |
42 | .count {
43 | font-size: 25rpx;
44 | }
45 |
46 | .price {
47 | font-size: 40rpx;
48 | }
--------------------------------------------------------------------------------
/pages/vant/vant.js:
--------------------------------------------------------------------------------
1 | // pages/vant/vant.js
2 | import Dialog from '../../dist/dialog/dialog';
3 |
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 |
11 | },
12 |
13 | cancelThis() {
14 | console.log('函数是进的来的');
15 | Dialog.confirm({
16 | title: '您确定取消?',
17 | message: '取消后30分钟内不能再次执行',
18 |
19 | }).then(() => {
20 | // on confirm
21 | }).catch(() => {
22 | // on cancel
23 | });
24 | }
25 | });
--------------------------------------------------------------------------------
/pages/vant/vant.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "van-button": "../../dist/button/index",
4 | "van-dialog": "../../dist/dialog/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/vant/vant.wxml:
--------------------------------------------------------------------------------
1 |
2 | pages/vant/vant.wxml
3 |
4 | 取消
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/vant/vant.wxss:
--------------------------------------------------------------------------------
1 | /* pages/vant/vant.wxss */
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "nodeModules": true,
13 | "autoAudits": false,
14 | "uglifyFileName": false
15 | },
16 | "compileType": "miniprogram",
17 | "libVersion": "2.4.3",
18 | "appid": "wxfe9ef1cef7f84bf3",
19 | "projectname": "appointment-mp",
20 | "debugOptions": {
21 | "hidedInDevtools": []
22 | },
23 | "isGameTourist": false,
24 | "condition": {
25 | "search": {
26 | "current": -1,
27 | "list": []
28 | },
29 | "conversation": {
30 | "current": -1,
31 | "list": []
32 | },
33 | "game": {
34 | "currentL": -1,
35 | "list": []
36 | },
37 | "miniprogram": {
38 | "current": -1,
39 | "list": []
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const idGen = (kind) => {
2 | return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
3 | };
4 |
5 | const graphqlURL = 'https://order.szu.im/graphql';
6 |
7 | const fetchGraphql = (query, variables, dataName, dataBack, that) => {
8 | // 如果给了 databack,则返回对应的数据,没有则返回全部
9 | // 如果给了 dataName,则 setData
10 | return new Promise((resolve, reject) => {
11 | let _this = that;
12 | wx.request({
13 | url: graphqlURL,
14 | method: 'POST',
15 | data: JSON.stringify({
16 | query,
17 | variables
18 | }),
19 |
20 | success: function (res) {
21 | let data;
22 | if (dataBack) {
23 | data = res.data.data[dataBack];
24 | } else {
25 | data = res.data.data;
26 | }
27 |
28 | if (dataName) {
29 | _this.setData({
30 | [dataName]: data
31 | })
32 | }
33 | console.log('request success', res);
34 | resolve(data);
35 | },
36 |
37 | fail: function (err) {
38 | console.log('request err', err)
39 | }
40 | })
41 | })
42 | };
43 |
44 | const dateTime = (data, format) => {
45 | if (format) {
46 | let date = new Date(data);
47 | return {
48 | date: date.getFullYear() + '-' + (date.getMonth() < 10 ? '0' + (date.getMonth()+1) : (date.getMonth()+1)) + '-' + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()),
49 | time: (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) +':'+ (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes())
50 | }
51 | } else {
52 | return new Date((data.date + ' ' + data.time + ':00').replace(/-/g, '/')).getTime();
53 | }
54 | };
55 |
56 | module.exports = {
57 | idGen: idGen,
58 | fetchGraphql: fetchGraphql,
59 | dateTime: dateTime
60 | };
61 |
--------------------------------------------------------------------------------