From 888b4ee55cf1a3e380a7c4b922129d324695a049 Mon Sep 17 00:00:00 2001 From: asd <374367073@qq.com> Date: Mon, 23 Dec 2019 14:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=A2ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 144 ++-- app.js | 76 +- app.json | 102 +-- app.wxss | 714 +++++++++--------- components/addaddress/shuru/shuru.scss | 62 +- components/chooseaddr/addradd/addradd.wxss | 20 +- components/chooseaddr/address/address.scss | 156 ++-- components/classify/list/index.js | 26 +- components/classify/list/index.json | 10 +- components/classify/list/index.scss | 126 ++-- components/classify/list/index.wxml | 74 +- components/classify/list/index.wxss | 2 +- components/classify/navigation/index.js | 34 +- components/classify/navigation/index.json | 10 +- components/classify/navigation/index.scss | 38 +- components/classify/navigation/index.wxml | 20 +- components/classify/navigation/index.wxss | 2 +- components/index/list/commodity/index.js | 34 +- components/index/list/commodity/index.json | 4 +- components/index/list/commodity/index.scss | 116 +-- components/index/list/commodity/index.wxml | 26 +- components/index/list/commodity/index.wxss | 2 +- components/index/list/index.js | 16 +- components/index/list/index.json | 10 +- components/index/list/index.scss | 22 +- components/index/list/index.wxml | 6 +- components/index/list/index.wxss | 2 +- components/index/search/index.js | 14 +- components/index/search/index.json | 4 +- components/index/search/index.scss | 44 +- components/index/search/index.wxml | 6 +- components/index/search/index.wxss | 2 +- components/member/membershop/membershop.scss | 58 +- components/member/membershop/membershop.wxml | 10 +- components/member/membertop/membertop.scss | 16 +- components/order/commodity/index.js | 20 +- components/order/commodity/index.json | 10 +- components/order/commodity/index.scss | 160 ++-- components/order/commodity/index.wxml | 26 +- components/order/commodity/index.wxss | 2 +- components/order/message/index.js | 14 +- components/order/message/index.json | 4 +- components/order/message/index.scss | 78 +- components/order/message/index.wxml | 26 +- components/order/message/index.wxss | 2 +- components/order/tab/index.js | 14 +- components/order/tab/index.json | 14 +- components/order/tab/index.scss | 4 +- components/order/tab/index.wxml | 16 +- components/order/tab/index.wxss | 2 +- .../orderagreement/orderagreement.scss | 36 +- .../orderconfirm/orderbottom/orderbottom.scss | 40 +- .../orderchooseaddr/orderchooseaddr.scss | 64 +- .../orderchooseway/orderchooseway.scss | 58 +- .../ordershopinfo/ordershopinfo.scss | 82 +- .../ordershopinfo/ordershopinfo.wxml | 24 +- components/orderconfirm/orderyf/orderyf.scss | 32 +- components/particulars/content/index.js | 14 +- components/particulars/content/index.json | 10 +- components/particulars/content/index.scss | 74 +- components/particulars/content/index.wxml | 46 +- components/particulars/content/index.wxss | 2 +- components/particulars/logistics/index.js | 50 +- components/particulars/logistics/index.json | 10 +- components/particulars/logistics/index.scss | 32 +- components/particulars/logistics/index.wxml | 6 +- components/particulars/logistics/index.wxss | 2 +- .../particulars/orderchooseaddr/index.js | 14 +- .../particulars/orderchooseaddr/index.json | 4 +- .../particulars/orderchooseaddr/index.scss | 70 +- .../particulars/orderchooseaddr/index.wxml | 18 +- .../particulars/orderchooseaddr/index.wxss | 2 +- components/particulars/submit/index.js | 14 +- components/particulars/submit/index.json | 4 +- components/particulars/submit/index.scss | 56 +- components/particulars/submit/index.wxml | 12 +- components/particulars/submit/index.wxss | 2 +- components/search/hot/index.js | 14 +- components/search/hot/index.json | 4 +- components/search/hot/index.scss | 42 +- components/search/hot/index.wxml | 8 +- components/search/hot/index.wxss | 2 +- components/seles/merchandises/index.js | 14 +- components/seles/merchandises/index.json | 8 +- components/seles/merchandises/index.scss | 54 +- components/seles/merchandises/index.wxml | 14 +- components/seles/merchandises/index.wxss | 2 +- .../shopping/shoppingitem/shoppingitem.js | 136 ++-- .../shopping/shoppingitem/shoppingitem.wxml | 32 +- .../shopping/shoppingitem/shoppingitem.wxss | 194 ++--- components/yue/share/share.scss | 138 ++-- components/yue/share/share.wxml | 58 +- components/yue/yongjintop/yongjintop.scss | 110 +-- components/yue/yongjintop/yongjintop.wxml | 50 +- components/yue/yuedetail/yuedetail.scss | 44 +- components/yue/yuetitle/yuetitle.scss | 10 +- components/yue/yuetop/yuetop.scss | 44 +- doc/bin.md | 62 +- pages/accomplish/accomplish.js | 130 ++-- pages/accomplish/accomplish.json | 12 +- pages/accomplish/accomplish.scss | 6 +- pages/accomplish/accomplish.wxml | 8 +- pages/accomplish/accomplish.wxss | 2 +- pages/addaddress/addaddress.js | 121 ++- pages/addaddress/addaddress.scss | 32 +- pages/addaddress/addaddress.wxml | 18 +- pages/chooseaddr/chooseaddr.scss | 18 +- pages/classify/classify.js | 194 ++--- pages/classify/classify.json | 10 +- pages/classify/classify.scss | 12 +- pages/classify/classify.wxml | 6 +- pages/classify/classify.wxss | 2 +- pages/index/index.js | 44 +- pages/index/index.json | 10 +- pages/index/index.scss | 18 +- pages/index/index.wxml | 6 +- pages/index/index.wxss | 2 +- pages/login/login.js | 244 +++--- pages/login/login.json | 4 +- pages/login/login.wxml | 4 +- pages/member/member.scss | 20 +- pages/message/message.js | 130 ++-- pages/message/message.json | 4 +- pages/message/message.scss | 108 +-- pages/message/message.wxml | 56 +- pages/message/message.wxss | 2 +- pages/order/order.js | 130 ++-- pages/order/order.json | 8 +- pages/order/order.scss | 18 +- pages/order/order.wxml | 4 +- pages/order/order.wxss | 2 +- pages/orderconfirm/orderconfirm.scss | 12 +- pages/orderconfirm/orderconfirm.wxml | 20 +- pages/particulars/particulars.js | 130 ++-- pages/particulars/particulars.json | 14 +- pages/particulars/particulars.scss | 14 +- pages/particulars/particulars.wxml | 8 +- pages/particulars/particulars.wxss | 2 +- pages/personal/personal.js | 234 +++--- pages/personal/personal.json | 4 +- pages/personal/personal.scss | 104 +-- pages/personal/personal.wxml | 84 +-- pages/personal/personal.wxss | 2 +- pages/product/product.js | 218 +++--- pages/product/product.json | 4 +- pages/product/product.scss | 72 +- pages/product/product.wxml | 46 +- pages/product/product.wxss | 2 +- pages/receiving/receiving.js | 130 ++-- pages/receiving/receiving.json | 10 +- pages/receiving/receiving.scss | 14 +- pages/receiving/receiving.wxml | 6 +- pages/receiving/receiving.wxss | 2 +- pages/sales1/sales1.js | 130 ++-- pages/sales1/sales1.json | 8 +- pages/sales1/sales1.scss | 96 +-- pages/sales1/sales1.wxml | 30 +- pages/sales1/sales1.wxss | 2 +- pages/sales2/sales2.js | 130 ++-- pages/sales2/sales2.json | 4 +- pages/sales2/sales2.scss | 66 +- pages/sales2/sales2.wxml | 28 +- pages/sales2/sales2.wxss | 2 +- pages/search/search.js | 130 ++-- pages/search/search.json | 10 +- pages/search/search.scss | 14 +- pages/search/search.wxml | 6 +- pages/search/search.wxss | 2 +- pages/share/share.scss | 12 +- pages/shopping/shopping.js | 354 ++++----- pages/shopping/shopping.wxml | 48 +- pages/shopping/shopping.wxss | 108 +-- pages/status/status.js | 130 ++-- pages/status/status.json | 10 +- pages/status/status.scss | 22 +- pages/status/status.wxml | 12 +- pages/status/status.wxss | 2 +- pages/undetermined/undetermined.js | 148 ++-- pages/undetermined/undetermined.json | 10 +- pages/undetermined/undetermined.scss | 10 +- pages/undetermined/undetermined.wxml | 6 +- pages/undetermined/undetermined.wxss | 2 +- pages/yongjin/yongjin.scss | 12 +- pages/yue/yue.scss | 14 +- sitemap.json | 12 +- utils/bin.js | 112 +-- utils/dist/action-sheet/index.d.ts | 2 +- utils/dist/action-sheet/index.js | 118 +-- utils/dist/action-sheet/index.json | 16 +- utils/dist/action-sheet/index.wxml | 108 +-- utils/dist/area/index.d.ts | 2 +- utils/dist/area/index.js | 420 +++++------ utils/dist/area/index.json | 12 +- utils/dist/area/index.wxml | 36 +- utils/dist/button/index.d.ts | 2 +- utils/dist/button/index.js | 136 ++-- utils/dist/button/index.json | 14 +- utils/dist/button/index.wxml | 104 +-- utils/dist/card/index.d.ts | 2 +- utils/dist/card/index.js | 76 +- utils/dist/card/index.json | 12 +- utils/dist/card/index.wxml | 90 +-- utils/dist/cell-group/index.d.ts | 2 +- utils/dist/cell-group/index.js | 20 +- utils/dist/cell-group/index.json | 4 +- utils/dist/cell-group/index.wxml | 18 +- utils/dist/cell/index.d.ts | 2 +- utils/dist/cell/index.js | 74 +- utils/dist/cell/index.json | 10 +- utils/dist/cell/index.wxml | 90 +-- utils/dist/checkbox-group/index.d.ts | 2 +- utils/dist/checkbox-group/index.js | 78 +- utils/dist/checkbox-group/index.json | 6 +- utils/dist/checkbox-group/index.wxml | 2 +- utils/dist/checkbox/index.d.ts | 2 +- utils/dist/checkbox/index.js | 174 ++--- utils/dist/checkbox/index.json | 12 +- utils/dist/checkbox/index.wxml | 38 +- utils/dist/circle/index.d.ts | 2 +- utils/dist/circle/index.js | 316 ++++---- utils/dist/circle/index.json | 6 +- utils/dist/circle/index.wxml | 12 +- utils/dist/col/index.d.ts | 2 +- utils/dist/col/index.js | 46 +- utils/dist/col/index.json | 6 +- utils/dist/col/index.wxml | 16 +- utils/dist/collapse-item/index.d.ts | 2 +- utils/dist/collapse-item/index.js | 192 ++--- utils/dist/collapse-item/index.json | 12 +- utils/dist/collapse-item/index.wxml | 88 +-- utils/dist/collapse/index.d.ts | 2 +- utils/dist/collapse/index.js | 100 +-- utils/dist/collapse/index.json | 6 +- utils/dist/collapse/index.wxml | 6 +- utils/dist/common/color.d.ts | 14 +- utils/dist/common/color.js | 14 +- utils/dist/common/component.d.ts | 6 +- utils/dist/common/component.js | 96 +-- utils/dist/common/utils.d.ts | 16 +- utils/dist/common/utils.js | 64 +- utils/dist/count-down/index.d.ts | 2 +- utils/dist/count-down/index.js | 200 ++--- utils/dist/count-down/index.json | 6 +- utils/dist/count-down/index.wxml | 8 +- utils/dist/count-down/utils.d.ts | 20 +- utils/dist/count-down/utils.js | 114 +-- utils/dist/datetime-picker/index.d.ts | 2 +- utils/dist/datetime-picker/index.js | 594 +++++++-------- utils/dist/datetime-picker/index.json | 12 +- utils/dist/datetime-picker/index.wxml | 32 +- utils/dist/definitions/index.d.ts | 56 +- utils/dist/definitions/weapp.d.ts | 224 +++--- utils/dist/dialog/dialog.d.ts | 94 +-- utils/dist/dialog/dialog.js | 126 ++-- utils/dist/dialog/index.d.ts | 2 +- utils/dist/dialog/index.js | 238 +++--- utils/dist/dialog/index.json | 14 +- utils/dist/dialog/index.wxml | 138 ++-- utils/dist/divider/index.d.ts | 2 +- utils/dist/divider/index.js | 66 +- utils/dist/divider/index.json | 6 +- utils/dist/divider/index.wxml | 16 +- utils/dist/dropdown-item/index.d.ts | 2 +- utils/dist/dropdown-item/index.js | 208 ++--- utils/dist/dropdown-item/index.json | 16 +- utils/dist/dropdown-item/index.wxml | 88 +-- utils/dist/dropdown-menu/index.d.ts | 2 +- utils/dist/dropdown-menu/index.js | 242 +++--- utils/dist/dropdown-menu/index.json | 4 +- utils/dist/dropdown-menu/index.wxml | 46 +- utils/dist/dropdown-menu/index.wxs | 32 +- utils/dist/field/index.d.ts | 2 +- utils/dist/field/index.js | 216 +++--- utils/dist/field/index.json | 12 +- utils/dist/field/index.wxml | 186 ++--- utils/dist/goods-action-button/index.d.ts | 2 +- utils/dist/goods-action-button/index.js | 82 +- utils/dist/goods-action-button/index.json | 12 +- utils/dist/goods-action-button/index.wxml | 56 +- utils/dist/goods-action-icon/index.d.ts | 2 +- utils/dist/goods-action-icon/index.js | 44 +- utils/dist/goods-action-icon/index.json | 14 +- utils/dist/goods-action-icon/index.wxml | 76 +- utils/dist/goods-action/index.d.ts | 2 +- utils/dist/goods-action/index.js | 44 +- utils/dist/goods-action/index.json | 6 +- utils/dist/goods-action/index.wxml | 10 +- utils/dist/grid-item/index.d.ts | 2 +- utils/dist/grid-item/index.js | 136 ++-- utils/dist/grid-item/index.json | 12 +- utils/dist/grid-item/index.wxml | 44 +- utils/dist/grid/index.d.ts | 2 +- utils/dist/grid/index.js | 124 +-- utils/dist/grid/index.json | 6 +- utils/dist/grid/index.wxml | 6 +- utils/dist/icon/index.d.ts | 2 +- utils/dist/icon/index.js | 78 +- utils/dist/icon/index.json | 12 +- utils/dist/icon/index.wxml | 36 +- utils/dist/image/index.d.ts | 2 +- utils/dist/image/index.js | 196 ++--- utils/dist/image/index.json | 14 +- utils/dist/image/index.wxml | 66 +- utils/dist/index-anchor/index.d.ts | 2 +- utils/dist/index-anchor/index.js | 44 +- utils/dist/index-anchor/index.json | 6 +- utils/dist/index-anchor/index.wxml | 28 +- utils/dist/index-bar/index.d.ts | 2 +- utils/dist/index-bar/index.js | 480 ++++++------ utils/dist/index-bar/index.json | 6 +- utils/dist/index-bar/index.wxml | 44 +- utils/dist/info/index.d.ts | 2 +- utils/dist/info/index.js | 16 +- utils/dist/info/index.json | 6 +- utils/dist/info/index.wxml | 14 +- utils/dist/loading/index.d.ts | 2 +- utils/dist/loading/index.js | 64 +- utils/dist/loading/index.json | 4 +- utils/dist/loading/index.wxml | 32 +- utils/dist/mixins/basic.d.ts | 2 +- utils/dist/mixins/basic.js | 44 +- utils/dist/mixins/button.d.ts | 2 +- utils/dist/mixins/button.js | 36 +- utils/dist/mixins/link.d.ts | 2 +- utils/dist/mixins/link.js | 34 +- utils/dist/mixins/observer/behavior.d.ts | 2 +- utils/dist/mixins/observer/behavior.js | 28 +- utils/dist/mixins/observer/index.d.ts | 2 +- utils/dist/mixins/observer/index.js | 38 +- utils/dist/mixins/open-type.d.ts | 2 +- utils/dist/mixins/open-type.js | 50 +- utils/dist/mixins/touch.d.ts | 2 +- utils/dist/mixins/touch.js | 70 +- utils/dist/mixins/transition.d.ts | 2 +- utils/dist/mixins/transition.js | 240 +++--- utils/dist/nav-bar/index.d.ts | 2 +- utils/dist/nav-bar/index.js | 76 +- utils/dist/nav-bar/index.json | 12 +- utils/dist/nav-bar/index.wxml | 74 +- utils/dist/notice-bar/index.d.ts | 2 +- utils/dist/notice-bar/index.js | 246 +++--- utils/dist/notice-bar/index.json | 10 +- utils/dist/notice-bar/index.wxml | 74 +- utils/dist/notify/index.d.ts | 2 +- utils/dist/notify/index.js | 118 +-- utils/dist/notify/index.json | 12 +- utils/dist/notify/index.wxml | 30 +- utils/dist/notify/notify.d.ts | 38 +- utils/dist/notify/notify.js | 82 +- utils/dist/overlay/index.d.ts | 2 +- utils/dist/overlay/index.js | 44 +- utils/dist/overlay/index.json | 12 +- utils/dist/overlay/index.wxml | 20 +- utils/dist/panel/index.d.ts | 2 +- utils/dist/panel/index.js | 20 +- utils/dist/panel/index.json | 12 +- utils/dist/panel/index.wxml | 38 +- utils/dist/picker-column/index.d.ts | 2 +- utils/dist/picker-column/index.js | 238 +++--- utils/dist/picker-column/index.json | 4 +- utils/dist/picker-column/index.wxml | 44 +- utils/dist/picker-column/index.wxs | 16 +- utils/dist/picker/index.d.ts | 2 +- utils/dist/picker/index.js | 270 +++---- utils/dist/picker/index.json | 14 +- utils/dist/picker/index.wxml | 130 ++-- utils/dist/picker/shared.d.ts | 42 +- utils/dist/picker/shared.js | 42 +- utils/dist/popup/index.d.ts | 2 +- utils/dist/popup/index.js | 160 ++-- utils/dist/popup/index.json | 14 +- utils/dist/popup/index.wxml | 48 +- utils/dist/progress/index.d.ts | 2 +- utils/dist/progress/index.js | 76 +- utils/dist/progress/index.json | 6 +- utils/dist/progress/index.wxml | 38 +- utils/dist/progress/index.wxs | 10 +- utils/dist/radio-group/index.d.ts | 2 +- utils/dist/radio-group/index.js | 76 +- utils/dist/radio-group/index.json | 6 +- utils/dist/radio-group/index.wxml | 2 +- utils/dist/radio/index.d.ts | 2 +- utils/dist/radio/index.js | 120 +-- utils/dist/radio/index.json | 12 +- utils/dist/radio/index.wxml | 58 +- utils/dist/rate/index.d.ts | 2 +- utils/dist/rate/index.js | 190 ++--- utils/dist/rate/index.json | 12 +- utils/dist/rate/index.wxml | 68 +- utils/dist/row/index.d.ts | 2 +- utils/dist/row/index.js | 72 +- utils/dist/row/index.json | 6 +- utils/dist/row/index.wxml | 6 +- utils/dist/search/index.d.ts | 2 +- utils/dist/search/index.js | 146 ++-- utils/dist/search/index.json | 12 +- utils/dist/search/index.wxml | 100 +-- utils/dist/sidebar-item/index.d.ts | 2 +- utils/dist/sidebar-item/index.js | 72 +- utils/dist/sidebar-item/index.json | 12 +- utils/dist/sidebar-item/index.wxml | 36 +- utils/dist/sidebar/index.d.ts | 2 +- utils/dist/sidebar/index.js | 86 +-- utils/dist/sidebar/index.json | 6 +- utils/dist/sidebar/index.wxml | 6 +- utils/dist/skeleton/index.d.ts | 2 +- utils/dist/skeleton/index.js | 82 +- utils/dist/skeleton/index.json | 6 +- utils/dist/skeleton/index.wxml | 58 +- utils/dist/slider/index.d.ts | 2 +- utils/dist/slider/index.js | 214 +++--- utils/dist/slider/index.json | 6 +- utils/dist/slider/index.wxml | 58 +- utils/dist/stepper/index.d.ts | 2 +- utils/dist/stepper/index.js | 344 ++++----- utils/dist/stepper/index.json | 4 +- utils/dist/stepper/index.wxml | 74 +- utils/dist/steps/index.d.ts | 2 +- utils/dist/steps/index.js | 44 +- utils/dist/steps/index.json | 12 +- utils/dist/steps/index.wxml | 102 +-- utils/dist/sticky/index.d.ts | 2 +- utils/dist/sticky/index.js | 280 +++---- utils/dist/sticky/index.json | 6 +- utils/dist/sticky/index.wxml | 14 +- utils/dist/submit-bar/index.d.ts | 2 +- utils/dist/submit-bar/index.js | 114 +-- utils/dist/submit-bar/index.json | 14 +- utils/dist/submit-bar/index.wxml | 84 +-- utils/dist/swipe-cell/index.d.ts | 2 +- utils/dist/swipe-cell/index.js | 244 +++--- utils/dist/swipe-cell/index.json | 6 +- utils/dist/swipe-cell/index.wxml | 40 +- utils/dist/switch/index.d.ts | 2 +- utils/dist/switch/index.js | 102 +-- utils/dist/switch/index.json | 12 +- utils/dist/switch/index.wxml | 22 +- utils/dist/tab/index.d.ts | 2 +- utils/dist/tab/index.js | 112 +-- utils/dist/tab/index.json | 4 +- utils/dist/tab/index.wxml | 16 +- utils/dist/tabbar-item/index.d.ts | 2 +- utils/dist/tabbar-item/index.js | 94 +-- utils/dist/tabbar-item/index.json | 14 +- utils/dist/tabbar-item/index.wxml | 60 +- utils/dist/tabbar/index.d.ts | 2 +- utils/dist/tabbar/index.js | 130 ++-- utils/dist/tabbar/index.json | 6 +- utils/dist/tabbar/index.wxml | 16 +- utils/dist/tabs/index.d.ts | 2 +- utils/dist/tabs/index.js | 578 +++++++------- utils/dist/tabs/index.json | 14 +- utils/dist/tabs/index.wxml | 120 +-- utils/dist/tabs/index.wxs | 110 +-- utils/dist/tag/index.d.ts | 2 +- utils/dist/tag/index.js | 42 +- utils/dist/tag/index.json | 4 +- utils/dist/tag/index.wxml | 28 +- utils/dist/toast/index.d.ts | 2 +- utils/dist/toast/index.js | 58 +- utils/dist/toast/index.json | 18 +- utils/dist/toast/index.wxml | 66 +- utils/dist/toast/toast.d.ts | 52 +- utils/dist/toast/toast.js | 132 ++-- utils/dist/transition/index.d.ts | 2 +- utils/dist/transition/index.js | 26 +- utils/dist/transition/index.json | 4 +- utils/dist/transition/index.wxml | 16 +- utils/dist/tree-select/index.d.ts | 2 +- utils/dist/tree-select/index.js | 148 ++-- utils/dist/tree-select/index.json | 16 +- utils/dist/tree-select/index.wxml | 78 +- utils/dist/tree-select/index.wxs | 24 +- utils/dist/uploader/index.d.ts | 2 +- utils/dist/uploader/index.js | 302 ++++---- utils/dist/uploader/index.json | 12 +- utils/dist/uploader/index.wxml | 114 +-- utils/dist/uploader/utils.d.ts | 24 +- utils/dist/uploader/utils.js | 32 +- utils/dist/wxs/array.wxs | 10 +- utils/dist/wxs/bem.wxs | 76 +- utils/dist/wxs/memoize.wxs | 108 +-- utils/dist/wxs/object.wxs | 26 +- utils/dist/wxs/utils.wxs | 14 +- utils/util.js | 38 +- 485 files changed, 12277 insertions(+), 12196 deletions(-) diff --git a/README.md b/README.md index 26c9883..95ae4be 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,72 @@ -# 德国代购小程序 - -### 目录结构 -- commponents 组件 -- page 页面 -- utils 插件 - - [bin.js](./doc/bin.md) -- doc 文档存放 -## 页面路由 -- pages/index/index 首页
-- pages/shopping/shopping 购物车
- 组件 - - index/search 顶部搜索框 - - index/list 商品列表 - - index/lsit/commodity 商品单条 - - index/shopping/shoppingitem 购物车商品信息 -- pages/search/search 搜索页
- 组件 - - index/search 顶部搜索框 - - search/hot 热门上搜索列表 -- pages/classify/classify 分类页
- 组件 - - classify/list 右侧商品列表 - - classify/navigation 左侧导航列表 -- pages/product/product 商品页 -- pages/personal/personal 我的页面 -- pages/message/message 个人信息 -- pages/orderconfirm/orderconfirm 确认订单
- 组件 - - orderconfirm/agreement 同意协议 - - orderconfirm/bottom 订单确认底部 - - orderconfirm/chooseaddr 选择地址 - - orderconfirm/chooseway 选择方式 - - orderconfirm/ordershopinfo 顶部的商品信息 - - orderconfirm/orderyf 运费 -- pages/order/order 订单列表
- 组件 - - order/tab 切换列表 - - order/commodity 商品信息操作 - - order/message 商品信息 - -- pages/chooseaddr/chooseaddr 选择地址
- - chooseaddr/address 地址列表(单个) - - chooseaddr/addradd 添加按钮 - -- pages/addaddress/addaddress 添加地址
- - addaddress/shuru 添加地址的输入的每一项 -- pages/particulars/particulars 待付款
- - particulars/orderchooseaddr 地址 - - particulars/content 中间所有 - - particulars/submit 支付 -- pages/undetermined/undetermined 代发货
- - particulars/orderchooseaddr 地址 - - particulars/content 中间所有 -- pages/receiving/receiving 待收货
- - particulars/orderchooseaddr 地址 - - particulars/content 中间所有 -- pages/status/status 物流信息
- - order/message 商品信息 - - particulars/logistics 物流信息 -- pages/receiving/receiving 已完成
- - particulars/orderchooseaddr 地址 - - particulars/content 中间所有 - - particulars/logistics 物流信息 -- pages/sales1/sales1 退货1
- - sales/merchandises 商品信息 -- pages/sales2/sales2 退货3
- - sales/merchandises 商品信息 - -- pages/member/member 会员商品
- - member/membertop 会员商品顶部的字 - - member/membershop 单个商品 +# 德国代购小程序 + +### 目录结构 +- commponents 组件 +- page 页面 +- utils 插件 + - [bin.js](./doc/bin.md) +- doc 文档存放 +## 页面路由 +- pages/index/index 首页
+- pages/shopping/shopping 购物车
+ 组件 + - index/search 顶部搜索框 + - index/list 商品列表 + - index/lsit/commodity 商品单条 + - index/shopping/shoppingitem 购物车商品信息 +- pages/search/search 搜索页
+ 组件 + - index/search 顶部搜索框 + - search/hot 热门上搜索列表 +- pages/classify/classify 分类页
+ 组件 + - classify/list 右侧商品列表 + - classify/navigation 左侧导航列表 +- pages/product/product 商品页 +- pages/personal/personal 我的页面 +- pages/message/message 个人信息 +- pages/orderconfirm/orderconfirm 确认订单
+ 组件 + - orderconfirm/agreement 同意协议 + - orderconfirm/bottom 订单确认底部 + - orderconfirm/chooseaddr 选择地址 + - orderconfirm/chooseway 选择方式 + - orderconfirm/ordershopinfo 顶部的商品信息 + - orderconfirm/orderyf 运费 +- pages/order/order 订单列表
+ 组件 + - order/tab 切换列表 + - order/commodity 商品信息操作 + - order/message 商品信息 + +- pages/chooseaddr/chooseaddr 选择地址
+ - chooseaddr/address 地址列表(单个) + - chooseaddr/addradd 添加按钮 + +- pages/addaddress/addaddress 添加地址
+ - addaddress/shuru 添加地址的输入的每一项 +- pages/particulars/particulars 待付款
+ - particulars/orderchooseaddr 地址 + - particulars/content 中间所有 + - particulars/submit 支付 +- pages/undetermined/undetermined 代发货
+ - particulars/orderchooseaddr 地址 + - particulars/content 中间所有 +- pages/receiving/receiving 待收货
+ - particulars/orderchooseaddr 地址 + - particulars/content 中间所有 +- pages/status/status 物流信息
+ - order/message 商品信息 + - particulars/logistics 物流信息 +- pages/receiving/receiving 已完成
+ - particulars/orderchooseaddr 地址 + - particulars/content 中间所有 + - particulars/logistics 物流信息 +- pages/sales1/sales1 退货1
+ - sales/merchandises 商品信息 +- pages/sales2/sales2 退货3
+ - sales/merchandises 商品信息 + +- pages/member/member 会员商品
+ - member/membertop 会员商品顶部的字 + - member/membershop 单个商品 diff --git a/app.js b/app.js index b545190..404d452 100644 --- a/app.js +++ b/app.js @@ -1,39 +1,39 @@ -//app.js -App({ - onLaunch: function () { - // 展示本地存储能力 - var logs = wx.getStorageSync('logs') || [] - logs.unshift(Date.now()) - wx.setStorageSync('logs', logs) - - // 登录 - wx.login({ - success: res => { - // 发送 res.code 到后台换取 openId, sessionKey, unionId - } - }) - // 获取用户信息 - wx.getSetting({ - success: res => { - if (res.authSetting['scope.userInfo']) { - // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 - wx.getUserInfo({ - success: res => { - // 可以将 res 发送给后台解码出 unionId - this.globalData.userInfo = res.userInfo - - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 - // 所以此处加入 callback 以防止这种情况 - if (this.userInfoReadyCallback) { - this.userInfoReadyCallback(res) - } - } - }) - } - } - }) - }, - globalData: { - userInfo: null - } +//app.js +App({ + onLaunch: function () { + // 展示本地存储能力 + var logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + // 获取用户信息 + wx.getSetting({ + success: res => { + if (res.authSetting['scope.userInfo']) { + // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 + wx.getUserInfo({ + success: res => { + // 可以将 res 发送给后台解码出 unionId + this.globalData.userInfo = res.userInfo + + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 + // 所以此处加入 callback 以防止这种情况 + if (this.userInfoReadyCallback) { + this.userInfoReadyCallback(res) + } + } + }) + } + } + }) + }, + globalData: { + userInfo: null + } }) \ No newline at end of file diff --git a/app.json b/app.json index 221ebf0..7351910 100644 --- a/app.json +++ b/app.json @@ -1,52 +1,52 @@ -{ - "pages": [ - "pages/index/index", - "pages/login/login", - "pages/search/search", - "pages/shopping/shopping", - "pages/classify/classify", - "pages/product/product", - "pages/personal/personal", - "pages/message/message", - "pages/orderconfirm/orderconfirm", - "pages/order/order", - "pages/chooseaddr/chooseaddr", - "pages/addaddress/addaddress", - "pages/particulars/particulars", - "pages/undetermined/undetermined", - "pages/receiving/receiving", - "pages/status/status", - "pages/accomplish/accomplish", - "pages/sales1/sales1", - "pages/sales2/sales2", - "pages/member/member", - "pages/yue/yue", - - "pages/yongjin/yongjin", - - "pages/share/share" - ], - "window": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "WeChat", - "navigationBarTextStyle": "black" - }, - "tabBar": { - "list": [{ - "pagePath": "pages/index/index", - "text": "首页" - }, { - "pagePath": "pages/classify/classify", - "text": "分类" - }, { - "pagePath": "pages/shopping/shopping", - "text": "购物车" - }, { - "pagePath": "pages/personal/personal", - "text": "我的" - }] - }, - "style": "v2", - "sitemapLocation": "sitemap.json" +{ + "pages": [ + "pages/index/index", + "pages/login/login", + "pages/search/search", + "pages/shopping/shopping", + "pages/classify/classify", + "pages/product/product", + "pages/personal/personal", + "pages/message/message", + "pages/orderconfirm/orderconfirm", + "pages/order/order", + "pages/chooseaddr/chooseaddr", + "pages/addaddress/addaddress", + "pages/particulars/particulars", + "pages/undetermined/undetermined", + "pages/receiving/receiving", + "pages/status/status", + "pages/accomplish/accomplish", + "pages/sales1/sales1", + "pages/sales2/sales2", + "pages/member/member", + "pages/yue/yue", + + "pages/yongjin/yongjin", + + "pages/share/share" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "WeChat", + "navigationBarTextStyle": "black" + }, + "tabBar": { + "list": [{ + "pagePath": "pages/index/index", + "text": "首页" + }, { + "pagePath": "pages/classify/classify", + "text": "分类" + }, { + "pagePath": "pages/shopping/shopping", + "text": "购物车" + }, { + "pagePath": "pages/personal/personal", + "text": "我的" + }] + }, + "style": "v2", + "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/app.wxss b/app.wxss index 3906c42..2506ca4 100644 --- a/app.wxss +++ b/app.wxss @@ -1,357 +1,357 @@ - - -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ - -/* Document - ========================================================================== */ - -/** - * 1. Correct the line height in all browsers. - * 2. Prevent adjustments of font size after orientation changes in iOS. - */ - -html { - line-height: 1; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/* Sections - ========================================================================== */ - -/** - * Remove the margin in all browsers. - */ - -body { - margin: 0; -} - -/** - * Render the `main` element consistently in IE. - */ - -main { - display: block; -} - -/** - * Correct the font size and margin on `h1` elements within `section` and - * `article` contexts in Chrome, Firefox, and Safari. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/* Grouping content - ========================================================================== */ - -/** - * 1. Add the correct box sizing in Firefox. - * 2. Show the overflow in Edge and IE. - */ - -hr { - box-sizing: content-box; /* 1 */ - height: 0; /* 1 */ - overflow: visible; /* 2 */ -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -pre { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Remove the gray background on active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * 1. Remove the bottom border in Chrome 57- - * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. - */ - -abbr[title] { - border-bottom: none; /* 1 */ - text-decoration: underline; /* 2 */ - text-decoration: underline dotted; /* 2 */ -} - -/** - * Add the correct font weight in Chrome, Edge, and Safari. - */ - -b, -strong { - font-weight: bolder; -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -code, -kbd, -samp { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/** - * Add the correct font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` elements from affecting the line height in - * all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove the border on images inside links in IE 10. - */ - -img { - border-style: none; -} - -/* Forms - ========================================================================== */ - -/** - * 1. Change the font styles in all browsers. - * 2. Remove the margin in Firefox and Safari. - */ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1; /* 1 */ - margin: 0; /* 2 */ -} - -/** - * Show the overflow in IE. - * 1. Show the overflow in Edge. - */ - -button, -input { - /* 1 */ - overflow: visible; -} - -/** - * Remove the inheritance of text transform in Edge, Firefox, and IE. - * 1. Remove the inheritance of text transform in Firefox. - */ - -button, -select { - /* 1 */ - text-transform: none; -} - -/** - * Correct the inability to style clickable types in iOS and Safari. - */ - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -/** - * Remove the inner border and padding in Firefox. - */ - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - border-style: none; - padding: 0; -} - -/** - * Restore the focus styles unset by the previous rule. - */ - -button:-moz-focusring, -[type="button"]:-moz-focusring, -[type="reset"]:-moz-focusring, -[type="submit"]:-moz-focusring { - outline: 1px dotted ButtonText; -} - -/** - * Correct the padding in Firefox. - */ - -fieldset { - padding: 0.35em 0.75em 0.625em; -} - -/** - * 1. Correct the text wrapping in Edge and IE. - * 2. Correct the color inheritance from `fieldset` elements in IE. - * 3. Remove the padding so developers are not caught out when they zero out - * `fieldset` elements in all browsers. - */ - -legend { - box-sizing: border-box; /* 1 */ - color: inherit; /* 2 */ - display: table; /* 1 */ - max-width: 100%; /* 1 */ - padding: 0; /* 3 */ - white-space: normal; /* 1 */ -} - -/** - * Add the correct vertical alignment in Chrome, Firefox, and Opera. - */ - -progress { - vertical-align: baseline; -} - -/** - * Remove the default vertical scrollbar in IE 10+. - */ - -textarea { - overflow: auto; -} - -/** - * 1. Add the correct box sizing in IE 10. - * 2. Remove the padding in IE 10. - */ - -[type="checkbox"], -[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Correct the cursor style of increment and decrement buttons in Chrome. - */ - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Correct the odd appearance in Chrome and Safari. - * 2. Correct the outline style in Safari. - */ - -[type="search"] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} - -/** - * Remove the inner padding in Chrome and Safari on macOS. - */ - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * 1. Correct the inability to style clickable types in iOS and Safari. - * 2. Change font properties to `inherit` in Safari. - */ - -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} - -/* Interactive - ========================================================================== */ - -/* - * Add the correct display in Edge, IE 10+, and Firefox. - */ - -details { - display: block; -} - -/* - * Add the correct display in all browsers. - */ - -summary { - display: list-item; -} - -/* Misc - ========================================================================== */ - -/** - * Add the correct display in IE 10+. - */ - -template { - display: none; -} - -/** - * Add the correct display in IE 10. - */ - -[hidden] { - display: none; -} -image { - background-size: cover; - background-image: url("http://luyuan.tk/static/images/TIM%E5%9B%BE%E7%89%8720191214113605.jpg"); -} + + +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { + /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { + /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} +image { + background-size: cover; + background-image: url("http://luyuan.tk/static/images/TIM%E5%9B%BE%E7%89%8720191214113605.jpg"); +} diff --git a/components/addaddress/shuru/shuru.scss b/components/addaddress/shuru/shuru.scss index fc757f7..961ffbf 100644 --- a/components/addaddress/shuru/shuru.scss +++ b/components/addaddress/shuru/shuru.scss @@ -1,32 +1,32 @@ -.shuru { - width: 670rpx; - height: 100rpx; - border-bottom: 2rpx solid #E8E8E8; - margin: 0 auto; - display: flex; - justify-content: space-between; - line-height: 100rpx; - font-size: 28rpx; - .left { - color: #333333; - } - .right { - margin: auto 0; - display: flex; - .shuru1 { - width: 280rpx; - text-align: right; - } - .shurupla { - color: #999999; - font-size: 28rpx; - } - .arrow { - width: 14rpx; - height: 25rpx; - background-color: #999999; - margin: auto 0; - margin-left: 27rpx; - } - } +.shuru { + width: 670rpx; + height: 100rpx; + border-bottom: 2rpx solid #E8E8E8; + margin: 0 auto; + display: flex; + justify-content: space-between; + line-height: 100rpx; + font-size: 28rpx; + .left { + color: #333333; + } + .right { + margin: auto 0; + display: flex; + .shuru1 { + width: 280rpx; + text-align: right; + } + .shurupla { + color: #999999; + font-size: 28rpx; + } + .arrow { + width: 14rpx; + height: 25rpx; + background-color: #999999; + margin: auto 0; + margin-left: 27rpx; + } + } } \ No newline at end of file diff --git a/components/chooseaddr/addradd/addradd.wxss b/components/chooseaddr/addradd/addradd.wxss index fa3e6b6..f602ea9 100644 --- a/components/chooseaddr/addradd/addradd.wxss +++ b/components/chooseaddr/addradd/addradd.wxss @@ -1,11 +1,11 @@ -.btn { - width: 650rpx; - height: 98rpx; - background: #09BB07; - border-radius: 10rpx; - margin: 0 auto; - font-size: 36rpx; - color: white; - line-height: 98rpx; - text-align: center; +.btn { + width: 650rpx; + height: 98rpx; + background: #09BB07; + border-radius: 10rpx; + margin: 0 auto; + font-size: 36rpx; + color: white; + line-height: 98rpx; + text-align: center; } \ No newline at end of file diff --git a/components/chooseaddr/address/address.scss b/components/chooseaddr/address/address.scss index 5eb2c50..d067c14 100644 --- a/components/chooseaddr/address/address.scss +++ b/components/chooseaddr/address/address.scss @@ -1,79 +1,79 @@ -.address { - width: 690rpx; - height: 192rpx; - border-bottom: 2rpx solid #EAEAEA; - display: flex; - justify-content: space-between; - padding-bottom: 27rpx; - ; - .left { - width: 576rpx; - height: 119rpx; - .userinfo { - color: #333333; - font-size: 26rpx; - text-indent: 16xrpx; - margin-top: 41rpx; - display: flex; - justify-content: space-between; - .username{ - display: flex; - flex-wrap: nowrap; - .username1{ - width: 140rpx; - overflow: hidden; - } - .tel{ - margin-right: 6rpx; - - } - } - } - .addr { - color: #999999; - font-size: 24rpx; - text-indent: 30rpx; - margin-top: 32rpx; - width: 551rpx; - margin-left: 20rpx; - // display: flex; - .select { - width: 26rpx; - height: 26rpx; - margin: auto 0; - border-radius: 50%; - background-color: #EAEAEA; - float: left; - margin-right: -14rpx; - - } - .selected { - background-color: #47C877; - } - .default { - // margin-left: 12rpx; - font-size: 24rpx; - text-indent: 16rpx; - line-height: 60rpx; - float: left; - } - .path { - // float: left; - line-height: 25rpx; - } - } - } - .line { - width: 2rpx; - height: 75rpx; - background: rgba(211, 211, 211, 1); - margin: auto 0; - } - .right { - color: #666666; - font-size: 24rpx; - line-height: 192rpx; - margin-left: 30rpx; - margin-right: 21rpx; - } +.address { + width: 690rpx; + height: 192rpx; + border-bottom: 2rpx solid #EAEAEA; + display: flex; + justify-content: space-between; + padding-bottom: 27rpx; + ; + .left { + width: 576rpx; + height: 119rpx; + .userinfo { + color: #333333; + font-size: 26rpx; + text-indent: 16xrpx; + margin-top: 41rpx; + display: flex; + justify-content: space-between; + .username{ + display: flex; + flex-wrap: nowrap; + .username1{ + width: 140rpx; + overflow: hidden; + } + .tel{ + margin-right: 6rpx; + + } + } + } + .addr { + color: #999999; + font-size: 24rpx; + text-indent: 30rpx; + margin-top: 32rpx; + width: 551rpx; + margin-left: 20rpx; + // display: flex; + .select { + width: 26rpx; + height: 26rpx; + margin: auto 0; + border-radius: 50%; + background-color: #EAEAEA; + float: left; + margin-right: -14rpx; + + } + .selected { + background-color: #47C877; + } + .default { + // margin-left: 12rpx; + font-size: 24rpx; + text-indent: 16rpx; + line-height: 60rpx; + float: left; + } + .path { + // float: left; + line-height: 25rpx; + } + } + } + .line { + width: 2rpx; + height: 75rpx; + background: rgba(211, 211, 211, 1); + margin: auto 0; + } + .right { + color: #666666; + font-size: 24rpx; + line-height: 192rpx; + margin-left: 30rpx; + margin-right: 21rpx; + } } \ No newline at end of file diff --git a/components/classify/list/index.js b/components/classify/list/index.js index f4ed197..85211af 100644 --- a/components/classify/list/index.js +++ b/components/classify/list/index.js @@ -1,14 +1,14 @@ -Component({ - properties: { - list:Array - }, - data: {}, - methods: { - todetail(a) { - console.log(a) - wx.navigateTo({ - url: "/pages/product/product?shopid=" + a.currentTarget.dataset.id - }) - } - } +Component({ + properties: { + list:Array + }, + data: {}, + methods: { + todetail(a) { + console.log(a) + wx.navigateTo({ + url: "/pages/product/product?shopid=" + a.currentTarget.dataset.id + }) + } + } }) \ No newline at end of file diff --git a/components/classify/list/index.json b/components/classify/list/index.json index 8a8e987..289b9d9 100644 --- a/components/classify/list/index.json +++ b/components/classify/list/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - - } +{ + "component": true, + "usingComponents": { + + } } \ No newline at end of file diff --git a/components/classify/list/index.scss b/components/classify/list/index.scss index 7e93e1b..58cf53f 100644 --- a/components/classify/list/index.scss +++ b/components/classify/list/index.scss @@ -1,63 +1,63 @@ -.list { - padding-left: 20rpx; - width: 572rpx; - box-sizing: border-box; - height: 100vh; - .commodity { - width: 552rpx; - // height: 143rpx; - // margin-top: 32rpx; - display: flex; - align-items: center; - .content { - width: 552rpx; - height: 100%; - display: flex; - align-items: center; - // box-shadow: 0 0 24rpx 0 rgba(227, 227, 227, 0.4); - border-bottom: 2rpx solid #eaeaea; - padding: 30rpx 0; - .imgthumb { - width: 105rpx; - height: 105rpx; - margin-left: 40rpx; - background-color: #333; - } - .introduce { - width: 336rpx; - margin-left: 40rpx; - display: flex; - flex-direction: column; - .towline { - overflow: hidden; - - text-overflow: ellipsis; - - display: -webkit-box; - - -webkit-box-orient: vertical; - - -webkit-line-clamp: 2; - } - > text { - font-size: 22rpx; - color: #333; - margin-bottom: 22rpx; - } - > view { - display: flex; - align-items: center; - justify-content: space-between; - > text:first-child { - font-size: 30rpx; - color: #dec499; - } - > text:last-child { - font-size: 22rpx; - color: #999; - } - } - } - } - } -} +.list { + padding-left: 20rpx; + width: 572rpx; + box-sizing: border-box; + height: 100vh; + .commodity { + width: 552rpx; + // height: 143rpx; + // margin-top: 32rpx; + display: flex; + align-items: center; + .content { + width: 552rpx; + height: 100%; + display: flex; + align-items: center; + // box-shadow: 0 0 24rpx 0 rgba(227, 227, 227, 0.4); + border-bottom: 2rpx solid #eaeaea; + padding: 30rpx 0; + .imgthumb { + width: 105rpx; + height: 105rpx; + margin-left: 40rpx; + background-color: #333; + } + .introduce { + width: 336rpx; + margin-left: 40rpx; + display: flex; + flex-direction: column; + .towline { + overflow: hidden; + + text-overflow: ellipsis; + + display: -webkit-box; + + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; + } + > text { + font-size: 22rpx; + color: #333; + margin-bottom: 22rpx; + } + > view { + display: flex; + align-items: center; + justify-content: space-between; + > text:first-child { + font-size: 30rpx; + color: #dec499; + } + > text:last-child { + font-size: 22rpx; + color: #999; + } + } + } + } + } +} diff --git a/components/classify/list/index.wxml b/components/classify/list/index.wxml index 7e4a67b..0677ed2 100644 --- a/components/classify/list/index.wxml +++ b/components/classify/list/index.wxml @@ -1,38 +1,38 @@ - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - 加入购物车 - - - - - + + + + + + {{item.goods_name}} + + ¥{{item.shop_price}} + 加入购物车 + + + + + \ No newline at end of file diff --git a/components/classify/list/index.wxss b/components/classify/list/index.wxss index 895235c..9e742ec 100644 --- a/components/classify/list/index.wxss +++ b/components/classify/list/index.wxss @@ -1 +1 @@ -.list{padding-left:20rpx;width:572rpx;box-sizing:border-box;height:100vh}.list .commodity{width:552rpx;display:flex;align-items:center}.list .commodity .content{width:552rpx;height:100%;display:flex;align-items:center;border-bottom:2rpx solid #eaeaea;padding:30rpx 0}.list .commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.list .commodity .content .introduce{width:336rpx;margin-left:40rpx;display:flex;flex-direction:column}.list .commodity .content .introduce .towline{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list .commodity .content .introduce>text{font-size:22rpx;color:#333;margin-bottom:22rpx}.list .commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.list .commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.list .commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999} +.list{padding-left:20rpx;width:572rpx;box-sizing:border-box;height:100vh}.list .commodity{width:552rpx;display:flex;align-items:center}.list .commodity .content{width:552rpx;height:100%;display:flex;align-items:center;border-bottom:2rpx solid #eaeaea;padding:30rpx 0}.list .commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.list .commodity .content .introduce{width:336rpx;margin-left:40rpx;display:flex;flex-direction:column}.list .commodity .content .introduce .towline{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list .commodity .content .introduce>text{font-size:22rpx;color:#333;margin-bottom:22rpx}.list .commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.list .commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.list .commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999} diff --git a/components/classify/navigation/index.js b/components/classify/navigation/index.js index e036c8f..5be40b4 100644 --- a/components/classify/navigation/index.js +++ b/components/classify/navigation/index.js @@ -1,18 +1,18 @@ -Component({ - properties: { - types: Array - }, - data: { - id: 0 - }, - methods: { - select(a) { - // console.log(this.data.a.target.dataset.id) - // console.log(a.target.dataset.id) - this.setData({ - id: a.target.dataset.id - }) - this.triggerEvent("select",{id:a.target.dataset.id}) - } - } +Component({ + properties: { + types: Array + }, + data: { + id: 0 + }, + methods: { + select(a) { + // console.log(this.data.a.target.dataset.id) + // console.log(a.target.dataset.id) + this.setData({ + id: a.target.dataset.id + }) + this.triggerEvent("select",{id:a.target.dataset.id}) + } + } }) \ No newline at end of file diff --git a/components/classify/navigation/index.json b/components/classify/navigation/index.json index 8a8e987..289b9d9 100644 --- a/components/classify/navigation/index.json +++ b/components/classify/navigation/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - - } +{ + "component": true, + "usingComponents": { + + } } \ No newline at end of file diff --git a/components/classify/navigation/index.scss b/components/classify/navigation/index.scss index 10fbd9d..2d45484 100644 --- a/components/classify/navigation/index.scss +++ b/components/classify/navigation/index.scss @@ -1,20 +1,20 @@ -.navigation { - width: 188rpx; - // margin-right: 2rpx; - border-right: 2rpx solid #eaeaea; - max-height: 100vh; - view{ - height: 97rpx; - font-size: 28rpx; - color: #333; - border-bottom: 2rpx solid #eaeaea; - line-height: 97rpx; - font-weight: bold; - text-align: center; - box-sizing: border-box; - } - .on{ - border-left: 5rpx solid #56CC84; - color:#56CC84; - } +.navigation { + width: 188rpx; + // margin-right: 2rpx; + border-right: 2rpx solid #eaeaea; + max-height: 100vh; + view{ + height: 97rpx; + font-size: 28rpx; + color: #333; + border-bottom: 2rpx solid #eaeaea; + line-height: 97rpx; + font-weight: bold; + text-align: center; + box-sizing: border-box; + } + .on{ + border-left: 5rpx solid #56CC84; + color:#56CC84; + } } \ No newline at end of file diff --git a/components/classify/navigation/index.wxml b/components/classify/navigation/index.wxml index 1630e75..6e2d6f0 100644 --- a/components/classify/navigation/index.wxml +++ b/components/classify/navigation/index.wxml @@ -1,11 +1,11 @@ - - {{item.name}} - + + {{item.name}} + \ No newline at end of file diff --git a/components/classify/navigation/index.wxss b/components/classify/navigation/index.wxss index 9f520e4..a20b46f 100644 --- a/components/classify/navigation/index.wxss +++ b/components/classify/navigation/index.wxss @@ -1 +1 @@ -.navigation{width:188rpx;border-right:2rpx solid #eaeaea;max-height:100vh}.navigation view{height:97rpx;font-size:28rpx;color:#333;border-bottom:2rpx solid #eaeaea;line-height:97rpx;font-weight:bold;text-align:center;box-sizing:border-box}.navigation .on{border-left:5rpx solid #56CC84;color:#56CC84} +.navigation{width:188rpx;border-right:2rpx solid #eaeaea;max-height:100vh}.navigation view{height:97rpx;font-size:28rpx;color:#333;border-bottom:2rpx solid #eaeaea;line-height:97rpx;font-weight:bold;text-align:center;box-sizing:border-box}.navigation .on{border-left:5rpx solid #56CC84;color:#56CC84} diff --git a/components/index/list/commodity/index.js b/components/index/list/commodity/index.js index 24cbade..f5ca40a 100644 --- a/components/index/list/commodity/index.js +++ b/components/index/list/commodity/index.js @@ -1,18 +1,18 @@ -Component({ - properties: { - img:String, - title:String, - id:String, - price:String, - shopid:String - }, - data: {}, - methods: { - gotodetail(e) { - console.log(e.currentTarget.dataset.id) - wx.navigateTo({ - url: "/pages/product/product?shopid="+e.currentTarget.dataset.id - }) - } - } +Component({ + properties: { + img:String, + title:String, + id:String, + price:String, + shopid:String + }, + data: {}, + methods: { + gotodetail(e) { + console.log(e.currentTarget.dataset.id) + wx.navigateTo({ + url: "/pages/product/product?shopid="+e.currentTarget.dataset.id + }) + } + } }) \ No newline at end of file diff --git a/components/index/list/commodity/index.json b/components/index/list/commodity/index.json index fba482a..bd71109 100644 --- a/components/index/list/commodity/index.json +++ b/components/index/list/commodity/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/components/index/list/commodity/index.scss b/components/index/list/commodity/index.scss index 6c82ae4..5b5dc8c 100644 --- a/components/index/list/commodity/index.scss +++ b/components/index/list/commodity/index.scss @@ -1,58 +1,58 @@ -.commodity { - width: 623rpx; - height: 143rpx; - margin-top: 32rpx; - display: flex; - align-items: center; - .content { - width: 614rpx; - height: 100%; - display: flex; - align-items: center; - box-shadow: 0 0 24rpx 0 rgba(227, 227, 227, 0.4); - .imgthumb { - width: 105rpx; - height: 105rpx; - margin-left: 40rpx; - background-color: #333; - } - .introduce { - width: 410rpx; - margin-left: 40rpx; - display: flex; - flex-direction: column; - > text { - font-size: 26rpx; - color: #333; - margin-bottom: 22rpx; - overflow: hidden; - - text-overflow: ellipsis; - - display: -webkit-box; - - -webkit-box-orient: vertical; - - -webkit-line-clamp: 2; - } - > view { - display: flex; - align-items: center; - justify-content: space-between; - > text:first-child { - font-size: 30rpx; - color: #dec499; - } - > text:last-child { - font-size: 22rpx; - color: #999; - } - } - } - } - .decorate { - width: 9rpx; - height: 102rpx; - background-color: #3fb66e; - } -} +.commodity { + width: 623rpx; + height: 143rpx; + margin-top: 32rpx; + display: flex; + align-items: center; + .content { + width: 614rpx; + height: 100%; + display: flex; + align-items: center; + box-shadow: 0 0 24rpx 0 rgba(227, 227, 227, 0.4); + .imgthumb { + width: 105rpx; + height: 105rpx; + margin-left: 40rpx; + background-color: #333; + } + .introduce { + width: 410rpx; + margin-left: 40rpx; + display: flex; + flex-direction: column; + > text { + font-size: 26rpx; + color: #333; + margin-bottom: 22rpx; + overflow: hidden; + + text-overflow: ellipsis; + + display: -webkit-box; + + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; + } + > view { + display: flex; + align-items: center; + justify-content: space-between; + > text:first-child { + font-size: 30rpx; + color: #dec499; + } + > text:last-child { + font-size: 22rpx; + color: #999; + } + } + } + } + .decorate { + width: 9rpx; + height: 102rpx; + background-color: #3fb66e; + } +} diff --git a/components/index/list/commodity/index.wxml b/components/index/list/commodity/index.wxml index 8890d91..7f84e81 100644 --- a/components/index/list/commodity/index.wxml +++ b/components/index/list/commodity/index.wxml @@ -1,14 +1,14 @@ - - - - - {{title}} - - - ¥{{price}} - 加入购物车 - - - - + + + + + {{title}} + + + ¥{{price}} + 加入购物车 + + + + \ No newline at end of file diff --git a/components/index/list/commodity/index.wxss b/components/index/list/commodity/index.wxss index e358535..0d3c5f3 100644 --- a/components/index/list/commodity/index.wxss +++ b/components/index/list/commodity/index.wxss @@ -1 +1 @@ -.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e} +.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e} diff --git a/components/index/list/index.js b/components/index/list/index.js index 82a621a..ac32c19 100644 --- a/components/index/list/index.js +++ b/components/index/list/index.js @@ -1,9 +1,9 @@ -Component({ - properties: { - list:Array - }, - data: { - }, - methods: { - } +Component({ + properties: { + list:Array + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/index/list/index.json b/components/index/list/index.json index 7f8058e..463b976 100644 --- a/components/index/list/index.json +++ b/components/index/list/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "commodity":"./commodity/index" - } +{ + "component": true, + "usingComponents": { + "commodity":"./commodity/index" + } } \ No newline at end of file diff --git a/components/index/list/index.scss b/components/index/list/index.scss index aae32e5..dc22751 100644 --- a/components/index/list/index.scss +++ b/components/index/list/index.scss @@ -1,12 +1,12 @@ -.list { - width: 623rpx; - margin-top: 36rpx; - .title { - font-size: 30rpx; - color: #333; - font-weight: bold; - margin-left: 32rpx; - // margin-bottom: 32rpx; - } - +.list { + width: 623rpx; + margin-top: 36rpx; + .title { + font-size: 30rpx; + color: #333; + font-weight: bold; + margin-left: 32rpx; + // margin-bottom: 32rpx; + } + } \ No newline at end of file diff --git a/components/index/list/index.wxml b/components/index/list/index.wxml index e4ff091..c223504 100644 --- a/components/index/list/index.wxml +++ b/components/index/list/index.wxml @@ -1,4 +1,4 @@ - - 热门商品 - + + 热门商品 + \ No newline at end of file diff --git a/components/index/list/index.wxss b/components/index/list/index.wxss index 1704712..4ff91f5 100644 --- a/components/index/list/index.wxss +++ b/components/index/list/index.wxss @@ -1 +1 @@ -.list{width:623rpx;margin-top:36rpx}.list .title{font-size:30rpx;color:#333;font-weight:bold;margin-left:32rpx} +.list{width:623rpx;margin-top:36rpx}.list .title{font-size:30rpx;color:#333;font-weight:bold;margin-left:32rpx} diff --git a/components/index/search/index.js b/components/index/search/index.js index 035c745..3512440 100644 --- a/components/index/search/index.js +++ b/components/index/search/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/index/search/index.json b/components/index/search/index.json index 32640e0..1edff93 100644 --- a/components/index/search/index.json +++ b/components/index/search/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/components/index/search/index.scss b/components/index/search/index.scss index e1dee72..2b2eb3e 100644 --- a/components/index/search/index.scss +++ b/components/index/search/index.scss @@ -1,23 +1,23 @@ -.search{ - width: 613rpx; - height: 76rpx; - margin-top: 30rpx; - box-sizing: border-box; - border-radius: 15rpx; - display: flex; - border:1rpx solid rgba(198,198,198,1); - >image{ - width: 42rpx; - height: 42rpx; - background-color: #000; - margin-left: 40rpx; - margin-top: 17rpx; - } - >input{ - height: 30rpx; - width: 480rpx; - margin-top: 20rpx; - margin-left: 17rpx; - font-size: 30rpx; - } +.search{ + width: 613rpx; + height: 76rpx; + margin-top: 30rpx; + box-sizing: border-box; + border-radius: 15rpx; + display: flex; + border:1rpx solid rgba(198,198,198,1); + >image{ + width: 42rpx; + height: 42rpx; + background-color: #000; + margin-left: 40rpx; + margin-top: 17rpx; + } + >input{ + height: 30rpx; + width: 480rpx; + margin-top: 20rpx; + margin-left: 17rpx; + font-size: 30rpx; + } } \ No newline at end of file diff --git a/components/index/search/index.wxml b/components/index/search/index.wxml index 3129295..8583369 100644 --- a/components/index/search/index.wxml +++ b/components/index/search/index.wxml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/components/index/search/index.wxss b/components/index/search/index.wxss index e30d4e7..d688695 100644 --- a/components/index/search/index.wxss +++ b/components/index/search/index.wxss @@ -1 +1 @@ -.search{width:613rpx;height:76rpx;margin-top:30rpx;box-sizing:border-box;border-radius:15rpx;display:flex;border:1rpx solid #c6c6c6}.search>image{width:42rpx;height:42rpx;background-color:#000;margin-left:40rpx;margin-top:17rpx}.search>input{height:30rpx;width:480rpx;margin-top:20rpx;margin-left:17rpx;font-size:30rpx} +.search{width:613rpx;height:76rpx;margin-top:30rpx;box-sizing:border-box;border-radius:15rpx;display:flex;border:1rpx solid #c6c6c6}.search>image{width:42rpx;height:42rpx;background-color:#000;margin-left:40rpx;margin-top:17rpx}.search>input{height:30rpx;width:480rpx;margin-top:20rpx;margin-left:17rpx;font-size:30rpx} diff --git a/components/member/membershop/membershop.scss b/components/member/membershop/membershop.scss index 9cc74c5..4dddb12 100644 --- a/components/member/membershop/membershop.scss +++ b/components/member/membershop/membershop.scss @@ -1,30 +1,30 @@ -.membershop { - width: 373rpx; - height: 557rpx; - background-color: #FBFBFB; - .pic { - width: 113rpx; - height: 256rpx; - background-color: white; - margin: 0 auto; - position: relative; - top: 64rpx; - left: 121rpx; - } - .shopname { - width: 273rpx; - color: #333333; - font-size: 30rpx; - text-align: center; - position: relative; - top: 111rpx; - margin: 0 auto; - } - .pri { - position: relative; - top: 127rpx; - text-align: center; - font-size: 30rpx; - color: #09BB07; - } +.membershop { + width: 373rpx; + height: 557rpx; + background-color: #FBFBFB; + .pic { + width: 113rpx; + height: 256rpx; + background-color: white; + margin: 0 auto; + position: relative; + top: 64rpx; + left: 121rpx; + } + .shopname { + width: 273rpx; + color: #333333; + font-size: 30rpx; + text-align: center; + position: relative; + top: 111rpx; + margin: 0 auto; + } + .pri { + position: relative; + top: 127rpx; + text-align: center; + font-size: 30rpx; + color: #09BB07; + } } \ No newline at end of file diff --git a/components/member/membershop/membershop.wxml b/components/member/membershop/membershop.wxml index 6afcf67..eb83286 100644 --- a/components/member/membershop/membershop.wxml +++ b/components/member/membershop/membershop.wxml @@ -1,6 +1,6 @@ - - - 产品名产品名产品名 -产品名产品名 -$123 + + + 产品名产品名产品名 +产品名产品名 +$123 \ No newline at end of file diff --git a/components/member/membertop/membertop.scss b/components/member/membertop/membertop.scss index bbfb8a3..44d5fa4 100644 --- a/components/member/membertop/membertop.scss +++ b/components/member/membertop/membertop.scss @@ -1,9 +1,9 @@ -.membertop { - width: 100%; - height: 86rpx; - border-top: 2rpx solid #E8E8E8; - color: #999999; - font-size: 24rpx; - line-height: 86rpx; - text-indent: 30rpx; +.membertop { + width: 100%; + height: 86rpx; + border-top: 2rpx solid #E8E8E8; + color: #999999; + font-size: 24rpx; + line-height: 86rpx; + text-indent: 30rpx; } \ No newline at end of file diff --git a/components/order/commodity/index.js b/components/order/commodity/index.js index 8cd65c8..6f82273 100644 --- a/components/order/commodity/index.js +++ b/components/order/commodity/index.js @@ -1,11 +1,11 @@ -Component({ - properties: {}, - data: {}, - methods: { - todetail() { - wx.navigateTo({ - url: "/pages/undetermined/undetermined" - }) - } - } +Component({ + properties: {}, + data: {}, + methods: { + todetail() { + wx.navigateTo({ + url: "/pages/undetermined/undetermined" + }) + } + } }) \ No newline at end of file diff --git a/components/order/commodity/index.json b/components/order/commodity/index.json index 9800f6a..acd0b95 100644 --- a/components/order/commodity/index.json +++ b/components/order/commodity/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "message":"../message/index" - } +{ + "component": true, + "usingComponents": { + "message":"../message/index" + } } \ No newline at end of file diff --git a/components/order/commodity/index.scss b/components/order/commodity/index.scss index e558039..2ed9def 100644 --- a/components/order/commodity/index.scss +++ b/components/order/commodity/index.scss @@ -1,81 +1,81 @@ -.commodity { - margin-top: 20rpx; - background-color: #fff; - .message { - padding: 35rpx; - display: flex; - align-items: center; - border-bottom: 1rpx solid #F2F2F2; - .image { - width: 141rpx; - height: 150rpx; - background-color: #000; - margin-left: 34rpx; - } - .introduce { - margin-left: 32rpx; - height: 120rpx; - display: flex; - flex-direction: column; - justify-content: space-between; - width: 362rpx; - .title { - font-size: 28rpx; - color: #333; - } - .count { - font-size: 24rpx; - color: #999; - display: flex; - > view { - margin-right: 27rpx; - } - } - } - .parameter { - width: 150rpx; - height: 120rpx; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: flex-end; - } - } - .aggregate{ - display: flex; - box-sizing: border-box; - padding: 30rpx; - justify-content: flex-end; - font-size: 22rpx; - color: #999; - height: 78rpx; - border-bottom: 1rpx solid #F2F2F2; - - >text{ - color: #333; - margin: 0 5rpx; - } - } - .operation{ - height: 84rpx; - display: flex; - justify-content: flex-end; - padding:0 30rpx; - align-items: center; - .button{ - width: 133rpx; - height: 51rpx; - border:2rpx solid #999999; - border-radius: 26rpx; - text-align: center; - font-size: 22rpx; - color:#999999; - line-height: 51rpx; - margin-right: 8rpx; - } - .hlight{ - border:2rpx solid rgba(71,200,119,1); - color: #47C877; - } - } +.commodity { + margin-top: 20rpx; + background-color: #fff; + .message { + padding: 35rpx; + display: flex; + align-items: center; + border-bottom: 1rpx solid #F2F2F2; + .image { + width: 141rpx; + height: 150rpx; + background-color: #000; + margin-left: 34rpx; + } + .introduce { + margin-left: 32rpx; + height: 120rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + width: 362rpx; + .title { + font-size: 28rpx; + color: #333; + } + .count { + font-size: 24rpx; + color: #999; + display: flex; + > view { + margin-right: 27rpx; + } + } + } + .parameter { + width: 150rpx; + height: 120rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-end; + } + } + .aggregate{ + display: flex; + box-sizing: border-box; + padding: 30rpx; + justify-content: flex-end; + font-size: 22rpx; + color: #999; + height: 78rpx; + border-bottom: 1rpx solid #F2F2F2; + + >text{ + color: #333; + margin: 0 5rpx; + } + } + .operation{ + height: 84rpx; + display: flex; + justify-content: flex-end; + padding:0 30rpx; + align-items: center; + .button{ + width: 133rpx; + height: 51rpx; + border:2rpx solid #999999; + border-radius: 26rpx; + text-align: center; + font-size: 22rpx; + color:#999999; + line-height: 51rpx; + margin-right: 8rpx; + } + .hlight{ + border:2rpx solid rgba(71,200,119,1); + color: #47C877; + } + } } \ No newline at end of file diff --git a/components/order/commodity/index.wxml b/components/order/commodity/index.wxml index 1f117a5..37ed100 100644 --- a/components/order/commodity/index.wxml +++ b/components/order/commodity/index.wxml @@ -1,14 +1,14 @@ - - - - 共计1件商品 合计: - ¥29.80 - (含运费¥0.00) - - - 评价 - - 评价 - - + + + + 共计1件商品 合计: + ¥29.80 + (含运费¥0.00) + + + 评价 + + 评价 + + \ No newline at end of file diff --git a/components/order/commodity/index.wxss b/components/order/commodity/index.wxss index e025d4a..4aac7b7 100644 --- a/components/order/commodity/index.wxss +++ b/components/order/commodity/index.wxss @@ -1 +1 @@ -.commodity{margin-top:20rpx;background-color:#fff}.commodity .message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.commodity .message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.commodity .message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.commodity .message .introduce .title{font-size:28rpx;color:#333}.commodity .message .introduce .count{font-size:24rpx;color:#999;display:flex}.commodity .message .introduce .count>view{margin-right:27rpx}.commodity .message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.commodity .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #F2F2F2}.commodity .aggregate>text{color:#333;margin:0 5rpx}.commodity .operation{height:84rpx;display:flex;justify-content:flex-end;padding:0 30rpx;align-items:center}.commodity .operation .button{width:133rpx;height:51rpx;border:2rpx solid #999999;border-radius:26rpx;text-align:center;font-size:22rpx;color:#999999;line-height:51rpx;margin-right:8rpx}.commodity .operation .hlight{border:2rpx solid #47c877;color:#47C877} +.commodity{margin-top:20rpx;background-color:#fff}.commodity .message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.commodity .message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.commodity .message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.commodity .message .introduce .title{font-size:28rpx;color:#333}.commodity .message .introduce .count{font-size:24rpx;color:#999;display:flex}.commodity .message .introduce .count>view{margin-right:27rpx}.commodity .message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.commodity .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #F2F2F2}.commodity .aggregate>text{color:#333;margin:0 5rpx}.commodity .operation{height:84rpx;display:flex;justify-content:flex-end;padding:0 30rpx;align-items:center}.commodity .operation .button{width:133rpx;height:51rpx;border:2rpx solid #999999;border-radius:26rpx;text-align:center;font-size:22rpx;color:#999999;line-height:51rpx;margin-right:8rpx}.commodity .operation .hlight{border:2rpx solid #47c877;color:#47C877} diff --git a/components/order/message/index.js b/components/order/message/index.js index 9f59aa7..c0c906a 100644 --- a/components/order/message/index.js +++ b/components/order/message/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/order/message/index.json b/components/order/message/index.json index 32640e0..1edff93 100644 --- a/components/order/message/index.json +++ b/components/order/message/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/components/order/message/index.scss b/components/order/message/index.scss index cfa585f..33478f7 100644 --- a/components/order/message/index.scss +++ b/components/order/message/index.scss @@ -1,40 +1,40 @@ -.message { - padding: 35rpx; -display: flex; -align-items: center; -border-bottom: 1rpx solid #F2F2F2; -.image { - width: 141rpx; - height: 150rpx; - background-color: #000; - margin-left: 34rpx; -} -.introduce { - margin-left: 32rpx; - height: 120rpx; - display: flex; - flex-direction: column; - justify-content: space-between; - width: 362rpx; - .title { - font-size: 28rpx; - color: #333; - } - .count { - font-size: 24rpx; - color: #999; - display: flex; - > view { - margin-right: 27rpx; - } - } -} -.parameter { - width: 150rpx; - height: 120rpx; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: flex-end; -} +.message { + padding: 35rpx; +display: flex; +align-items: center; +border-bottom: 1rpx solid #F2F2F2; +.image { + width: 141rpx; + height: 150rpx; + background-color: #000; + margin-left: 34rpx; +} +.introduce { + margin-left: 32rpx; + height: 120rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + width: 362rpx; + .title { + font-size: 28rpx; + color: #333; + } + .count { + font-size: 24rpx; + color: #999; + display: flex; + > view { + margin-right: 27rpx; + } + } +} +.parameter { + width: 150rpx; + height: 120rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-end; +} } \ No newline at end of file diff --git a/components/order/message/index.wxml b/components/order/message/index.wxml index 055d05c..b8fe674 100644 --- a/components/order/message/index.wxml +++ b/components/order/message/index.wxml @@ -1,14 +1,14 @@ - - - - 001|德国双心药房版 胶原蛋白美容口服液养颜 - - 30只 - 1.0356kg - - - - ¥29.80 - x2 - + + + + 001|德国双心药房版 胶原蛋白美容口服液养颜 + + 30只 + 1.0356kg + + + + ¥29.80 + x2 + \ No newline at end of file diff --git a/components/order/message/index.wxss b/components/order/message/index.wxss index 6221a43..b190c1e 100644 --- a/components/order/message/index.wxss +++ b/components/order/message/index.wxss @@ -1 +1 @@ -.message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.message .introduce .title{font-size:28rpx;color:#333}.message .introduce .count{font-size:24rpx;color:#999;display:flex}.message .introduce .count>view{margin-right:27rpx}.message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end} +.message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.message .introduce .title{font-size:28rpx;color:#333}.message .introduce .count{font-size:24rpx;color:#999;display:flex}.message .introduce .count>view{margin-right:27rpx}.message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end} diff --git a/components/order/tab/index.js b/components/order/tab/index.js index 9f59aa7..c0c906a 100644 --- a/components/order/tab/index.js +++ b/components/order/tab/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/order/tab/index.json b/components/order/tab/index.json index e37cddb..7047382 100644 --- a/components/order/tab/index.json +++ b/components/order/tab/index.json @@ -1,8 +1,8 @@ -{ - "component": true, - "usingComponents": { - "commodity": "../commodity", - "van-tab": "../utils/dist/tab/index", - "van-tabs": "../utils/dist/tabs/index" - } +{ + "component": true, + "usingComponents": { + "commodity": "../commodity", + "van-tab": "../utils/dist/tab/index", + "van-tabs": "../utils/dist/tabs/index" + } } \ No newline at end of file diff --git a/components/order/tab/index.scss b/components/order/tab/index.scss index 5003c84..2ba65f7 100644 --- a/components/order/tab/index.scss +++ b/components/order/tab/index.scss @@ -1,3 +1,3 @@ -.tab { - width: 750rpx; +.tab { + width: 750rpx; } \ No newline at end of file diff --git a/components/order/tab/index.wxml b/components/order/tab/index.wxml index 332394c..9d5d671 100644 --- a/components/order/tab/index.wxml +++ b/components/order/tab/index.wxml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/components/order/tab/index.wxss b/components/order/tab/index.wxss index 77cc1ab..1b2c919 100644 --- a/components/order/tab/index.wxss +++ b/components/order/tab/index.wxss @@ -1 +1 @@ -.tab{width:750rpx} +.tab{width:750rpx} diff --git a/components/orderconfirm/orderagreement/orderagreement.scss b/components/orderconfirm/orderagreement/orderagreement.scss index c504b7f..d9afcaa 100644 --- a/components/orderconfirm/orderagreement/orderagreement.scss +++ b/components/orderconfirm/orderagreement/orderagreement.scss @@ -1,19 +1,19 @@ -.agree { - width: 690rpx; - // height: 96rpx; - line-height: 96rpx; - display: flex; - // border-bottom: 2rpx solid #EAEAEA; - margin: 0 auto; - color: #999999; - font-size: 26rpx; - .select { - width: 26rpx; - height: 26rpx; - margin: auto 0; - border-radius: 50%; - background-color: #EAEAEA; - margin-right: 25rpx; - margin-left: 31rpx; - } +.agree { + width: 690rpx; + // height: 96rpx; + line-height: 96rpx; + display: flex; + // border-bottom: 2rpx solid #EAEAEA; + margin: 0 auto; + color: #999999; + font-size: 26rpx; + .select { + width: 26rpx; + height: 26rpx; + margin: auto 0; + border-radius: 50%; + background-color: #EAEAEA; + margin-right: 25rpx; + margin-left: 31rpx; + } } \ No newline at end of file diff --git a/components/orderconfirm/orderbottom/orderbottom.scss b/components/orderconfirm/orderbottom/orderbottom.scss index 4dfedd2..ce55a30 100644 --- a/components/orderconfirm/orderbottom/orderbottom.scss +++ b/components/orderconfirm/orderbottom/orderbottom.scss @@ -1,21 +1,21 @@ -.bottom { - width: 100%; - height: 99rpx; - line-height: 99rpx; - display: flex; - justify-content: space-between; - border-top: 2rpx solid #EAEAEA; - font-size: 28rpx; - .left { - margin-left: 59rpx; - .pri { - color: #E0C79D; - font-size: 26rpx; - margin-left: 19rpx; - } - } - .right { - color: #4CC97D; - margin-right: 38rpx; - } +.bottom { + width: 100%; + height: 99rpx; + line-height: 99rpx; + display: flex; + justify-content: space-between; + border-top: 2rpx solid #EAEAEA; + font-size: 28rpx; + .left { + margin-left: 59rpx; + .pri { + color: #E0C79D; + font-size: 26rpx; + margin-left: 19rpx; + } + } + .right { + color: #4CC97D; + margin-right: 38rpx; + } } \ No newline at end of file diff --git a/components/orderconfirm/orderchooseaddr/orderchooseaddr.scss b/components/orderconfirm/orderchooseaddr/orderchooseaddr.scss index c1a73e4..8591980 100644 --- a/components/orderconfirm/orderchooseaddr/orderchooseaddr.scss +++ b/components/orderconfirm/orderchooseaddr/orderchooseaddr.scss @@ -1,33 +1,33 @@ -.orderchooseaddr { - width: 690rpx; - height: 148rpx; - margin: 0 auto; - border-bottom: 2rpx solid #EAEAEA; - display: flex; - justify-content: space-between; - .left { - width: 572rpx; - height: 80rpx; - .userinfo { - color: #333333; - font-size: 26rpx; - text-indent: 30rpx; - margin-top: 41rpx; - display: flex; - justify-content: space-between; - } - .addr { - color: #999999; - font-size: 24rpx; - text-indent: 30rpx; - margin-top: 32rpx; - } - } - .right { - width: 17rpx; - height: 30rpx; - background-color: #D3D3D3; - margin: auto 0; - margin-right: 19rpx; - } +.orderchooseaddr { + width: 690rpx; + height: 148rpx; + margin: 0 auto; + border-bottom: 2rpx solid #EAEAEA; + display: flex; + justify-content: space-between; + .left { + width: 572rpx; + height: 80rpx; + .userinfo { + color: #333333; + font-size: 26rpx; + text-indent: 30rpx; + margin-top: 41rpx; + display: flex; + justify-content: space-between; + } + .addr { + color: #999999; + font-size: 24rpx; + text-indent: 30rpx; + margin-top: 32rpx; + } + } + .right { + width: 17rpx; + height: 30rpx; + background-color: #D3D3D3; + margin: auto 0; + margin-right: 19rpx; + } } \ No newline at end of file diff --git a/components/orderconfirm/orderchooseway/orderchooseway.scss b/components/orderconfirm/orderchooseway/orderchooseway.scss index 505d799..e49c812 100644 --- a/components/orderconfirm/orderchooseway/orderchooseway.scss +++ b/components/orderconfirm/orderchooseway/orderchooseway.scss @@ -1,30 +1,30 @@ -.chooseway { - width: 690rpx; - height: 96rpx; - line-height: 96rpx; - display: flex; - border-bottom: 2rpx solid #EAEAEA; - margin: 0 auto; - .item { - display: flex; - margin-right: 90rpx; - .select { - width: 26rpx; - height: 26rpx; - margin: auto 0; - border-radius: 50%; - background-color: #EAEAEA; - } - .selected { - background-color: #47C877; - } - .way { - color: #333333; - font-size: 26rpx; - text-indent: 17rpx; - } - } - .item1 { - margin-left: 31rpx; - } +.chooseway { + width: 690rpx; + height: 96rpx; + line-height: 96rpx; + display: flex; + border-bottom: 2rpx solid #EAEAEA; + margin: 0 auto; + .item { + display: flex; + margin-right: 90rpx; + .select { + width: 26rpx; + height: 26rpx; + margin: auto 0; + border-radius: 50%; + background-color: #EAEAEA; + } + .selected { + background-color: #47C877; + } + .way { + color: #333333; + font-size: 26rpx; + text-indent: 17rpx; + } + } + .item1 { + margin-left: 31rpx; + } } \ No newline at end of file diff --git a/components/orderconfirm/ordershopinfo/ordershopinfo.scss b/components/orderconfirm/ordershopinfo/ordershopinfo.scss index 1e3c375..c74f0bb 100644 --- a/components/orderconfirm/ordershopinfo/ordershopinfo.scss +++ b/components/orderconfirm/ordershopinfo/ordershopinfo.scss @@ -1,42 +1,42 @@ -.shopinfo { - width: 690rpx; - height: 218rpx; - border-bottom: 2rpx solid #EAEAEA; - margin: 0 auto; - display: flex; - justify-content: center; - .pic { - width: 150rpx; - height: 163rpx; - background-color: #EAEAEA; - margin-right: 40rpx; - } - .right { - width: 402rpx; - display: flex; - flex-direction: column; - justify-content: space-between; - margin-top: 6rpx; - .shopname { - font-size: 28rpx; - font-weight: bold; - line-height: 39rpx; - } - .down { - margin-bottom: 50rpx; - display: flex; - justify-content: space-between; - .shopdesc { - color: #666666; - font-size: 24rpx; - .size { - margin-right: 20rpx; - } - } - .pri { - color: #E1C89F; - font-size: 28rpx; - } - } - } +.shopinfo { + width: 690rpx; + height: 218rpx; + border-bottom: 2rpx solid #EAEAEA; + margin: 0 auto; + display: flex; + justify-content: center; + .pic { + width: 150rpx; + height: 163rpx; + background-color: #EAEAEA; + margin-right: 40rpx; + } + .right { + width: 402rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + margin-top: 6rpx; + .shopname { + font-size: 28rpx; + font-weight: bold; + line-height: 39rpx; + } + .down { + margin-bottom: 50rpx; + display: flex; + justify-content: space-between; + .shopdesc { + color: #666666; + font-size: 24rpx; + .size { + margin-right: 20rpx; + } + } + .pri { + color: #E1C89F; + font-size: 28rpx; + } + } + } } \ No newline at end of file diff --git a/components/orderconfirm/ordershopinfo/ordershopinfo.wxml b/components/orderconfirm/ordershopinfo/ordershopinfo.wxml index 9e55863..2824bfb 100644 --- a/components/orderconfirm/ordershopinfo/ordershopinfo.wxml +++ b/components/orderconfirm/ordershopinfo/ordershopinfo.wxml @@ -1,13 +1,13 @@ - - - - 产品产品产品产品产品产品产品产品产品产品产品产品产品 - - - 规格10ml - 0.04kg - - ¥657 - - + + + + 产品产品产品产品产品产品产品产品产品产品产品产品产品 + + + 规格10ml + 0.04kg + + ¥657 + + \ No newline at end of file diff --git a/components/orderconfirm/orderyf/orderyf.scss b/components/orderconfirm/orderyf/orderyf.scss index 95c2833..5e3c2af 100644 --- a/components/orderconfirm/orderyf/orderyf.scss +++ b/components/orderconfirm/orderyf/orderyf.scss @@ -1,17 +1,17 @@ -.orderyf { - width: 690rpx; - height: 96rpx; - line-height: 96rpx; - display: flex; - border-bottom: 2rpx solid #EAEAEA; - margin: 0 auto; - justify-content: space-between; - font-size: 28rpx; - .left { - margin-left: 31rpx - } - .right { - margin-right: 20rpx; - ; - } +.orderyf { + width: 690rpx; + height: 96rpx; + line-height: 96rpx; + display: flex; + border-bottom: 2rpx solid #EAEAEA; + margin: 0 auto; + justify-content: space-between; + font-size: 28rpx; + .left { + margin-left: 31rpx + } + .right { + margin-right: 20rpx; + ; + } } \ No newline at end of file diff --git a/components/particulars/content/index.js b/components/particulars/content/index.js index 9f59aa7..c0c906a 100644 --- a/components/particulars/content/index.js +++ b/components/particulars/content/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/particulars/content/index.json b/components/particulars/content/index.json index 5be3fa1..40feb93 100644 --- a/components/particulars/content/index.json +++ b/components/particulars/content/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "message":"../../order/message/index" - } +{ + "component": true, + "usingComponents": { + "message":"../../order/message/index" + } } \ No newline at end of file diff --git a/components/particulars/content/index.scss b/components/particulars/content/index.scss index 37e2d83..ca3000e 100644 --- a/components/particulars/content/index.scss +++ b/components/particulars/content/index.scss @@ -1,38 +1,38 @@ -.content { - background-color: #fff; - width: 750rpx; - // height: ; - padding-bottom: 33rpx; - - .aggregate { - display: flex; - box-sizing: border-box; - padding: 30rpx; - justify-content: flex-end; - font-size: 22rpx; - color: #999; - height: 78rpx; - border-bottom: 1rpx solid #f2f2f2; - - > text { - color: #333; - margin: 0 5rpx; - } - } - .message { - display: flex; - padding: 0 30rpx; - justify-content: space-between; - font-size: 26rpx; - color: #333; - align-items: center; - height: 77rpx; - border-bottom: 1rpx solid #f2f2f2; - } - .leave { - display: flex; - height: 77rpx; - padding: 0 30rpx; - align-items: center; - } +.content { + background-color: #fff; + width: 750rpx; + // height: ; + padding-bottom: 33rpx; + + .aggregate { + display: flex; + box-sizing: border-box; + padding: 30rpx; + justify-content: flex-end; + font-size: 22rpx; + color: #999; + height: 78rpx; + border-bottom: 1rpx solid #f2f2f2; + + > text { + color: #333; + margin: 0 5rpx; + } + } + .message { + display: flex; + padding: 0 30rpx; + justify-content: space-between; + font-size: 26rpx; + color: #333; + align-items: center; + height: 77rpx; + border-bottom: 1rpx solid #f2f2f2; + } + .leave { + display: flex; + height: 77rpx; + padding: 0 30rpx; + align-items: center; + } } \ No newline at end of file diff --git a/components/particulars/content/index.wxml b/components/particulars/content/index.wxml index 308ea30..fbc9389 100644 --- a/components/particulars/content/index.wxml +++ b/components/particulars/content/index.wxml @@ -1,24 +1,24 @@ - - - - 共计1件商品 合计: - ¥29.80 - (含运费¥0.00) - - - 订单编号 - 123456789123456789 - - - 下单时间 - 2018-10-01 18:00:06 - - - 配送方式 - 快递 免邮 - - - 备注: - - + + + + 共计1件商品 合计: + ¥29.80 + (含运费¥0.00) + + + 订单编号 + 123456789123456789 + + + 下单时间 + 2018-10-01 18:00:06 + + + 配送方式 + 快递 免邮 + + + 备注: + + \ No newline at end of file diff --git a/components/particulars/content/index.wxss b/components/particulars/content/index.wxss index 63331d4..ecfa110 100644 --- a/components/particulars/content/index.wxss +++ b/components/particulars/content/index.wxss @@ -1 +1 @@ -.content{background-color:#fff;width:750rpx;padding-bottom:33rpx}.content .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #f2f2f2}.content .aggregate>text{color:#333;margin:0 5rpx}.content .message{display:flex;padding:0 30rpx;justify-content:space-between;font-size:26rpx;color:#333;align-items:center;height:77rpx;border-bottom:1rpx solid #f2f2f2}.content .leave{display:flex;height:77rpx;padding:0 30rpx;align-items:center} +.content{background-color:#fff;width:750rpx;padding-bottom:33rpx}.content .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #f2f2f2}.content .aggregate>text{color:#333;margin:0 5rpx}.content .message{display:flex;padding:0 30rpx;justify-content:space-between;font-size:26rpx;color:#333;align-items:center;height:77rpx;border-bottom:1rpx solid #f2f2f2}.content .leave{display:flex;height:77rpx;padding:0 30rpx;align-items:center} diff --git a/components/particulars/logistics/index.js b/components/particulars/logistics/index.js index ceed45d..f3dc1b4 100644 --- a/components/particulars/logistics/index.js +++ b/components/particulars/logistics/index.js @@ -1,26 +1,26 @@ -Component({ - properties: { - }, - data: { - steps: [ - { - text: '步骤一', - desc: '描述信息' - }, - { - text: '步骤二', - desc: '描述信息' - }, - { - text: '步骤三', - desc: '描述信息' - }, - { - text: '步骤四', - desc: '描述信息' - } - ] - }, - methods: { - } +Component({ + properties: { + }, + data: { + steps: [ + { + text: '步骤一', + desc: '描述信息' + }, + { + text: '步骤二', + desc: '描述信息' + }, + { + text: '步骤三', + desc: '描述信息' + }, + { + text: '步骤四', + desc: '描述信息' + } + ] + }, + methods: { + } }) \ No newline at end of file diff --git a/components/particulars/logistics/index.json b/components/particulars/logistics/index.json index 0cc7584..8b9e338 100644 --- a/components/particulars/logistics/index.json +++ b/components/particulars/logistics/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-steps": "../utils/dist/steps/index" - } +{ + "component": true, + "usingComponents": { + "van-steps": "../utils/dist/steps/index" + } } \ No newline at end of file diff --git a/components/particulars/logistics/index.scss b/components/particulars/logistics/index.scss index d8b2e1b..5e68c1c 100644 --- a/components/particulars/logistics/index.scss +++ b/components/particulars/logistics/index.scss @@ -1,17 +1,17 @@ -.logistics{ - margin-top: 20rpx; - background-color: #fff; - .title{ - height: 84rpx; - font-size: 28rpx; - color: #333; - line-height: 84rpx; - border-bottom: 2rpx solid #e5e5e5; - padding-left: 29rpx; - box-sizing: border-box; - } - .schedule{ - width: 650rpx; - margin-left: 50rpx; - } +.logistics{ + margin-top: 20rpx; + background-color: #fff; + .title{ + height: 84rpx; + font-size: 28rpx; + color: #333; + line-height: 84rpx; + border-bottom: 2rpx solid #e5e5e5; + padding-left: 29rpx; + box-sizing: border-box; + } + .schedule{ + width: 650rpx; + margin-left: 50rpx; + } } \ No newline at end of file diff --git a/components/particulars/logistics/index.wxml b/components/particulars/logistics/index.wxml index 78789dc..aae2b18 100644 --- a/components/particulars/logistics/index.wxml +++ b/components/particulars/logistics/index.wxml @@ -1,4 +1,4 @@ - - 物流追踪 - + + 物流追踪 + \ No newline at end of file diff --git a/components/particulars/logistics/index.wxss b/components/particulars/logistics/index.wxss index e10cfce..659d582 100644 --- a/components/particulars/logistics/index.wxss +++ b/components/particulars/logistics/index.wxss @@ -1 +1 @@ -.logistics{margin-top:20rpx;background-color:#fff}.logistics .title{height:84rpx;font-size:28rpx;color:#333;line-height:84rpx;border-bottom:2rpx solid #e5e5e5;padding-left:29rpx;box-sizing:border-box}.logistics .schedule{width:650rpx;margin-left:50rpx} +.logistics{margin-top:20rpx;background-color:#fff}.logistics .title{height:84rpx;font-size:28rpx;color:#333;line-height:84rpx;border-bottom:2rpx solid #e5e5e5;padding-left:29rpx;box-sizing:border-box}.logistics .schedule{width:650rpx;margin-left:50rpx} diff --git a/components/particulars/orderchooseaddr/index.js b/components/particulars/orderchooseaddr/index.js index 9f59aa7..c0c906a 100644 --- a/components/particulars/orderchooseaddr/index.js +++ b/components/particulars/orderchooseaddr/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/particulars/orderchooseaddr/index.json b/components/particulars/orderchooseaddr/index.json index 32640e0..1edff93 100644 --- a/components/particulars/orderchooseaddr/index.json +++ b/components/particulars/orderchooseaddr/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/components/particulars/orderchooseaddr/index.scss b/components/particulars/orderchooseaddr/index.scss index 55f825c..c50382c 100644 --- a/components/particulars/orderchooseaddr/index.scss +++ b/components/particulars/orderchooseaddr/index.scss @@ -1,35 +1,35 @@ -.orderchooseaddr { - background-color: #fff; - width: 750rpx; - height: 148rpx; - margin: 0 auto; - border-bottom: 20rpx solid #fbfbfb; - display: flex; - justify-content: space-between; - .left { - width: 572rpx; - height: 80rpx; - .userinfo { - color: #333333; - font-size: 26rpx; - text-indent: 30rpx; - margin-top: 41rpx; - display: flex; - justify-content: space-between; - } - .addr { - color: #999999; - font-size: 24rpx; - text-indent: 30rpx; - margin-top: 32rpx; - } - } - .right { - width: 17rpx; - height: 30rpx; - background-color: #d3d3d3; - margin: auto 0; - margin-right: 19rpx; - } -} - +.orderchooseaddr { + background-color: #fff; + width: 750rpx; + height: 148rpx; + margin: 0 auto; + border-bottom: 20rpx solid #fbfbfb; + display: flex; + justify-content: space-between; + .left { + width: 572rpx; + height: 80rpx; + .userinfo { + color: #333333; + font-size: 26rpx; + text-indent: 30rpx; + margin-top: 41rpx; + display: flex; + justify-content: space-between; + } + .addr { + color: #999999; + font-size: 24rpx; + text-indent: 30rpx; + margin-top: 32rpx; + } + } + .right { + width: 17rpx; + height: 30rpx; + background-color: #d3d3d3; + margin: auto 0; + margin-right: 19rpx; + } +} + diff --git a/components/particulars/orderchooseaddr/index.wxml b/components/particulars/orderchooseaddr/index.wxml index 02ae52f..2d66d94 100644 --- a/components/particulars/orderchooseaddr/index.wxml +++ b/components/particulars/orderchooseaddr/index.wxml @@ -1,10 +1,10 @@ - - - - 于于宇 15698857895 - - - 中国大陆 山东省 青岛市 即墨区 纯阳路 某某某小区 - - + + + + 于于宇 15698857895 + + + 中国大陆 山东省 青岛市 即墨区 纯阳路 某某某小区 + + \ No newline at end of file diff --git a/components/particulars/orderchooseaddr/index.wxss b/components/particulars/orderchooseaddr/index.wxss index 6c5abcf..420a108 100644 --- a/components/particulars/orderchooseaddr/index.wxss +++ b/components/particulars/orderchooseaddr/index.wxss @@ -1 +1 @@ -.orderchooseaddr{background-color:#fff;width:750rpx;height:148rpx;margin:0 auto;border-bottom:20rpx solid #fbfbfb;display:flex;justify-content:space-between}.orderchooseaddr .left{width:572rpx;height:80rpx}.orderchooseaddr .left .userinfo{color:#333333;font-size:26rpx;text-indent:30rpx;margin-top:41rpx;display:flex;justify-content:space-between}.orderchooseaddr .left .addr{color:#999999;font-size:24rpx;text-indent:30rpx;margin-top:32rpx}.orderchooseaddr .right{width:17rpx;height:30rpx;background-color:#d3d3d3;margin:auto 0;margin-right:19rpx} +.orderchooseaddr{background-color:#fff;width:750rpx;height:148rpx;margin:0 auto;border-bottom:20rpx solid #fbfbfb;display:flex;justify-content:space-between}.orderchooseaddr .left{width:572rpx;height:80rpx}.orderchooseaddr .left .userinfo{color:#333333;font-size:26rpx;text-indent:30rpx;margin-top:41rpx;display:flex;justify-content:space-between}.orderchooseaddr .left .addr{color:#999999;font-size:24rpx;text-indent:30rpx;margin-top:32rpx}.orderchooseaddr .right{width:17rpx;height:30rpx;background-color:#d3d3d3;margin:auto 0;margin-right:19rpx} diff --git a/components/particulars/submit/index.js b/components/particulars/submit/index.js index 9f59aa7..c0c906a 100644 --- a/components/particulars/submit/index.js +++ b/components/particulars/submit/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/particulars/submit/index.json b/components/particulars/submit/index.json index 32640e0..1edff93 100644 --- a/components/particulars/submit/index.json +++ b/components/particulars/submit/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/components/particulars/submit/index.scss b/components/particulars/submit/index.scss index c109a19..e4717f2 100644 --- a/components/particulars/submit/index.scss +++ b/components/particulars/submit/index.scss @@ -1,29 +1,29 @@ -.payment { - width: 750rpx; - height: 98rpx; - position: fixed; - bottom: 0; - display: flex; - justify-content: space-between; - background-color: #fff; - align-items: center; - .price { - font-size: 34rpx; - margin-left: 74rpx; - .title { - color: #333; - } - .counts{ - color: #ff3838; - } - } - .submit { - width: 250rpx; - height: 98rpx; - background-color: #47c877; - font-size: 30rpx; - color: #fff; - line-height: 98rpx; - text-align: center; - } +.payment { + width: 750rpx; + height: 98rpx; + position: fixed; + bottom: 0; + display: flex; + justify-content: space-between; + background-color: #fff; + align-items: center; + .price { + font-size: 34rpx; + margin-left: 74rpx; + .title { + color: #333; + } + .counts{ + color: #ff3838; + } + } + .submit { + width: 250rpx; + height: 98rpx; + background-color: #47c877; + font-size: 30rpx; + color: #fff; + line-height: 98rpx; + text-align: center; + } } \ No newline at end of file diff --git a/components/particulars/submit/index.wxml b/components/particulars/submit/index.wxml index 61671c9..cc01508 100644 --- a/components/particulars/submit/index.wxml +++ b/components/particulars/submit/index.wxml @@ -1,7 +1,7 @@ - - - 总付款: - ¥29 - - 立即支付 + + + 总付款: + ¥29 + + 立即支付 \ No newline at end of file diff --git a/components/particulars/submit/index.wxss b/components/particulars/submit/index.wxss index 7cf2990..45e3f87 100644 --- a/components/particulars/submit/index.wxss +++ b/components/particulars/submit/index.wxss @@ -1 +1 @@ -.payment{width:750rpx;height:98rpx;position:fixed;bottom:0;display:flex;justify-content:space-between;background-color:#fff;align-items:center}.payment .price{font-size:34rpx;margin-left:74rpx}.payment .price .title{color:#333}.payment .price .counts{color:#ff3838}.payment .submit{width:250rpx;height:98rpx;background-color:#47c877;font-size:30rpx;color:#fff;line-height:98rpx;text-align:center} +.payment{width:750rpx;height:98rpx;position:fixed;bottom:0;display:flex;justify-content:space-between;background-color:#fff;align-items:center}.payment .price{font-size:34rpx;margin-left:74rpx}.payment .price .title{color:#333}.payment .price .counts{color:#ff3838}.payment .submit{width:250rpx;height:98rpx;background-color:#47c877;font-size:30rpx;color:#fff;line-height:98rpx;text-align:center} diff --git a/components/search/hot/index.js b/components/search/hot/index.js index 9f59aa7..c0c906a 100644 --- a/components/search/hot/index.js +++ b/components/search/hot/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/search/hot/index.json b/components/search/hot/index.json index 32640e0..1edff93 100644 --- a/components/search/hot/index.json +++ b/components/search/hot/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/components/search/hot/index.scss b/components/search/hot/index.scss index f6b3ef9..2c0c06d 100644 --- a/components/search/hot/index.scss +++ b/components/search/hot/index.scss @@ -1,22 +1,22 @@ -.hot { - display: flex; - align-items: center; - flex-direction: column; - .title { - font-size: 34rpx; - color: #333; - font-weight: bold; - width: 415rpx; - height: 61rpx; - line-height: 61rpx; - text-align: center; - background-image: linear-gradient(to right, #fff, #ecfff8, #fff); - margin-top: 53rpx; - margin-bottom: 38rpx; - } - .word{ - font-size: 30rpx; - color: #999; - margin-bottom: 55rpx; - } +.hot { + display: flex; + align-items: center; + flex-direction: column; + .title { + font-size: 34rpx; + color: #333; + font-weight: bold; + width: 415rpx; + height: 61rpx; + line-height: 61rpx; + text-align: center; + background-image: linear-gradient(to right, #fff, #ecfff8, #fff); + margin-top: 53rpx; + margin-bottom: 38rpx; + } + .word{ + font-size: 30rpx; + color: #999; + margin-bottom: 55rpx; + } } \ No newline at end of file diff --git a/components/search/hot/index.wxml b/components/search/hot/index.wxml index 1842cb4..c2ed592 100644 --- a/components/search/hot/index.wxml +++ b/components/search/hot/index.wxml @@ -1,5 +1,5 @@ - - 热门搜索 - 化妆品 - 化妆品 + + 热门搜索 + 化妆品 + 化妆品 \ No newline at end of file diff --git a/components/search/hot/index.wxss b/components/search/hot/index.wxss index e142220..cea1c39 100644 --- a/components/search/hot/index.wxss +++ b/components/search/hot/index.wxss @@ -1 +1 @@ -.hot{display:flex;align-items:center;flex-direction:column}.hot .title{font-size:34rpx;color:#333;font-weight:bold;width:415rpx;height:61rpx;line-height:61rpx;text-align:center;background-image:linear-gradient(to right, #fff, #ecfff8, #fff);margin-top:53rpx;margin-bottom:38rpx}.hot .word{font-size:30rpx;color:#999;margin-bottom:55rpx} +.hot{display:flex;align-items:center;flex-direction:column}.hot .title{font-size:34rpx;color:#333;font-weight:bold;width:415rpx;height:61rpx;line-height:61rpx;text-align:center;background-image:linear-gradient(to right, #fff, #ecfff8, #fff);margin-top:53rpx;margin-bottom:38rpx}.hot .word{font-size:30rpx;color:#999;margin-bottom:55rpx} diff --git a/components/seles/merchandises/index.js b/components/seles/merchandises/index.js index 9f59aa7..c0c906a 100644 --- a/components/seles/merchandises/index.js +++ b/components/seles/merchandises/index.js @@ -1,8 +1,8 @@ -Component({ - properties: { - }, - data: { - }, - methods: { - } +Component({ + properties: { + }, + data: { + }, + methods: { + } }) \ No newline at end of file diff --git a/components/seles/merchandises/index.json b/components/seles/merchandises/index.json index 78013bd..de3af2d 100644 --- a/components/seles/merchandises/index.json +++ b/components/seles/merchandises/index.json @@ -1,5 +1,5 @@ -{ - "component": true, - "usingComponents": { - } +{ + "component": true, + "usingComponents": { + } } \ No newline at end of file diff --git a/components/seles/merchandises/index.scss b/components/seles/merchandises/index.scss index 145d073..0894589 100644 --- a/components/seles/merchandises/index.scss +++ b/components/seles/merchandises/index.scss @@ -1,28 +1,28 @@ -.merchandise { - padding: 46rpx 32rpx; - display: flex; - border-bottom: 20rpx solid #fbfbfb; - .image { - width: 171rpx; - height: 168rpx; - background-color: #000; - } - .message { - margin-left: 24rpx; - .title { - font-size: 26rpx; - color: #333; - width: 491rpx; - margin-bottom: 9rpx; - } - .brief { - font-size: 22rpx; - color: #999; - margin-bottom: 26rpx; - } - .price { - font-size: 28rpx; - color: #ff4e6c; - } - } +.merchandise { + padding: 46rpx 32rpx; + display: flex; + border-bottom: 20rpx solid #fbfbfb; + .image { + width: 171rpx; + height: 168rpx; + background-color: #000; + } + .message { + margin-left: 24rpx; + .title { + font-size: 26rpx; + color: #333; + width: 491rpx; + margin-bottom: 9rpx; + } + .brief { + font-size: 22rpx; + color: #999; + margin-bottom: 26rpx; + } + .price { + font-size: 28rpx; + color: #ff4e6c; + } + } } \ No newline at end of file diff --git a/components/seles/merchandises/index.wxml b/components/seles/merchandises/index.wxml index 2d0a289..195503f 100644 --- a/components/seles/merchandises/index.wxml +++ b/components/seles/merchandises/index.wxml @@ -1,8 +1,8 @@ - - - - 雅诗兰黛肌透修护密集精华眼膜 4对棕色瓶修护 真空眼膜 - 肌透眼膜4片 - ¥820.00 - + + + + 雅诗兰黛肌透修护密集精华眼膜 4对棕色瓶修护 真空眼膜 + 肌透眼膜4片 + ¥820.00 + \ No newline at end of file diff --git a/components/seles/merchandises/index.wxss b/components/seles/merchandises/index.wxss index 68b6821..e3b3802 100644 --- a/components/seles/merchandises/index.wxss +++ b/components/seles/merchandises/index.wxss @@ -1 +1 @@ -.merchandise{padding:46rpx 32rpx;display:flex;border-bottom:20rpx solid #fbfbfb}.merchandise .image{width:171rpx;height:168rpx;background-color:#000}.merchandise .message{margin-left:24rpx}.merchandise .message .title{font-size:26rpx;color:#333;width:491rpx;margin-bottom:9rpx}.merchandise .message .brief{font-size:22rpx;color:#999;margin-bottom:26rpx}.merchandise .message .price{font-size:28rpx;color:#ff4e6c} +.merchandise{padding:46rpx 32rpx;display:flex;border-bottom:20rpx solid #fbfbfb}.merchandise .image{width:171rpx;height:168rpx;background-color:#000}.merchandise .message{margin-left:24rpx}.merchandise .message .title{font-size:26rpx;color:#333;width:491rpx;margin-bottom:9rpx}.merchandise .message .brief{font-size:22rpx;color:#999;margin-bottom:26rpx}.merchandise .message .price{font-size:28rpx;color:#ff4e6c} diff --git a/components/shopping/shoppingitem/shoppingitem.js b/components/shopping/shoppingitem/shoppingitem.js index a04744f..8e3672a 100644 --- a/components/shopping/shoppingitem/shoppingitem.js +++ b/components/shopping/shoppingitem/shoppingitem.js @@ -1,69 +1,69 @@ -// components/shopping/shoppingitem/shoppingitem.js -import {request} from "../../../utils/bin" -Component({ - /** - * 组件的属性列表 - */ - properties: { - shopname: String, - shopdesc: String, - price: Number, - pic: String, - gid:Number, - num:Number, - select:Boolean, - index:Number - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - rm() { - - if (this.data.num == 0) { - - return - } else { - this.setData({ - num: this.data.num - 1 - }) - request({ - url:"Cart/updateNum", - urldata:{ - id:this.data.gid, - num:this.data.num - 1 - } - }).then((res)=>{ - - }) - - } - }, - add() { - this.setData({ - num: this.data.num + 1 - }) - request({ - url:"Cart/updateNum", - urldata:{ - id:this.data.gid, - num:this.data.num + 1 - } - }).then((res)=>{ - - }) - }, - sel(){ - this.triggerEvent('sel', {index:this.data.index,select:this.data.select}) - } - - } +// components/shopping/shoppingitem/shoppingitem.js +import {request} from "../../../utils/bin" +Component({ + /** + * 组件的属性列表 + */ + properties: { + shopname: String, + shopdesc: String, + price: Number, + pic: String, + gid:Number, + num:Number, + select:Boolean, + index:Number + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + rm() { + + if (this.data.num == 0) { + + return + } else { + this.setData({ + num: this.data.num - 1 + }) + request({ + url:"Cart/updateNum", + urldata:{ + id:this.data.gid, + num:this.data.num - 1 + } + }).then((res)=>{ + + }) + + } + }, + add() { + this.setData({ + num: this.data.num + 1 + }) + request({ + url:"Cart/updateNum", + urldata:{ + id:this.data.gid, + num:this.data.num + 1 + } + }).then((res)=>{ + + }) + }, + sel(){ + this.triggerEvent('sel', {index:this.data.index,select:this.data.select}) + } + + } }) \ No newline at end of file diff --git a/components/shopping/shoppingitem/shoppingitem.wxml b/components/shopping/shoppingitem/shoppingitem.wxml index 2003d55..24e4918 100644 --- a/components/shopping/shoppingitem/shoppingitem.wxml +++ b/components/shopping/shoppingitem/shoppingitem.wxml @@ -1,16 +1,16 @@ - - - - - - - {{shopname}} - {{shopdesc}} - ${{price}} - - - - - {{num}} - + - - + + + + + + + {{shopname}} + {{shopdesc}} + ${{price}} + + + - + {{num}} + + + + diff --git a/components/shopping/shoppingitem/shoppingitem.wxss b/components/shopping/shoppingitem/shoppingitem.wxss index ca6a41f..03fbea8 100644 --- a/components/shopping/shoppingitem/shoppingitem.wxss +++ b/components/shopping/shoppingitem/shoppingitem.wxss @@ -1,98 +1,98 @@ -.shoppingitem { - width: 639rpx; - height: 186rpx; - display: flex; - justify-content: space-between; -} - -.select { - width: 26rpx; - height: 26rpx; - background: rgba(234, 234, 234, 1); - border-radius: 50%; - margin: auto 0; -} -.selects{ - background-color: #45C778; -} -.pic { - /* width: 222rpx; - height: 222rpx; */ - width: 186rpx; - height: 186rpx; - background-color: bisque; -} - -.pic>image { - width: 100%; - height: 100%; -} - -.shopinfo { - width: 186rpx; -} - -.shopname { - color: #333333; - font-size: 26rpx; - font-weight: bold; - margin-bottom: 18rpx; - margin-top: 20rpx; - text-overflow: ellipsis; - overflow: hidden; - - display: -webkit-box; - - -webkit-box-orient: vertical; - - -webkit-line-clamp: 2; -} - -.shopdesc { - color: #666666; - font-size: 22rpx; - margin-bottom: 20rpx; -} - -.price { - color: #D1D1D1; - font-size: 32rpx; - font-weight: bold; - text-decoration: underline; -} - -.numberset { - width: 85rpx; - height: 186rpx; - border: 1px solid rgba(233, 233, 233, 1); - border-radius: 10px; - margin-top: 11rpx; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -.reverse { - width: 23rpx; - height: 23rpx; - /* background-color: #97DFB4; */ - margin: 0 auto; - margin-top: 20rpx; - line-height: 23rpx; - font-size: 46rpx; -} - -.num { - color: #242424; - font-size: 30rpx; - text-align: center; -} - -.add { - width: 23rpx; - height: 23rpx; - /* background-color: #242424; */ - margin: 0 auto; - margin-bottom: 17rpx; - line-height: 23rpx; +.shoppingitem { + width: 639rpx; + height: 186rpx; + display: flex; + justify-content: space-between; +} + +.select { + width: 26rpx; + height: 26rpx; + background: rgba(234, 234, 234, 1); + border-radius: 50%; + margin: auto 0; +} +.selects{ + background-color: #45C778; +} +.pic { + /* width: 222rpx; + height: 222rpx; */ + width: 186rpx; + height: 186rpx; + background-color: bisque; +} + +.pic>image { + width: 100%; + height: 100%; +} + +.shopinfo { + width: 186rpx; +} + +.shopname { + color: #333333; + font-size: 26rpx; + font-weight: bold; + margin-bottom: 18rpx; + margin-top: 20rpx; + text-overflow: ellipsis; + overflow: hidden; + + display: -webkit-box; + + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; +} + +.shopdesc { + color: #666666; + font-size: 22rpx; + margin-bottom: 20rpx; +} + +.price { + color: #D1D1D1; + font-size: 32rpx; + font-weight: bold; + text-decoration: underline; +} + +.numberset { + width: 85rpx; + height: 186rpx; + border: 1px solid rgba(233, 233, 233, 1); + border-radius: 10px; + margin-top: 11rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.reverse { + width: 23rpx; + height: 23rpx; + /* background-color: #97DFB4; */ + margin: 0 auto; + margin-top: 20rpx; + line-height: 23rpx; + font-size: 46rpx; +} + +.num { + color: #242424; + font-size: 30rpx; + text-align: center; +} + +.add { + width: 23rpx; + height: 23rpx; + /* background-color: #242424; */ + margin: 0 auto; + margin-bottom: 17rpx; + line-height: 23rpx; } \ No newline at end of file diff --git a/components/yue/share/share.scss b/components/yue/share/share.scss index c03a3b1..2e49bca 100644 --- a/components/yue/share/share.scss +++ b/components/yue/share/share.scss @@ -1,70 +1,70 @@ -.box { - width: 690rpx; - margin: 0 auto; - padding-bottom: 41rpx; - border-bottom: 2rpx solid #EEEEEE; - .img { - width: 40rpx; - height: 39rpx; - background-color: #999999; - float: right; - } - .yongjintop { - width: 317rpx; - // height: 196rpx; - margin-top: 71rpx; - margin-left: 30rpx; - display: flex; - .photo { - width: 130rpx; - height: 130rpx; - background-color: gold; - margin-bottom: 52rpx; - border-radius: 90%; - } - .tel { - color: #333333; - font-size: 28rpx; - margin-top: 33rpx; - margin-left: 35rpx; - .mingpian { - font-size: 24rpx; - color: #999999; - margin-top: 18rpx; - } - } - } -} - -.mid { - width: 100%; - height: 175rpx; - border-bottom: 20rpx solid #FBFBFB; - // justify-content: space-around; - color: #333333; - font-size: 28rpx; - text-align: center; - .midbox { - width: 478rpx; - height: 175rpx; - display: flex; - justify-content: space-between; - margin: 0 auto; - } - .way { - margin-top: 46rpx; - margin-bottom: 14rpx; - } - .money { - font-size: 24rpx; - } - .money1 { - color: #F81F1F; - } - .line { - width: 2rpx; - height: 60rpx; - margin: auto 0; - background-color: #EEEEEE; - } +.box { + width: 690rpx; + margin: 0 auto; + padding-bottom: 41rpx; + border-bottom: 2rpx solid #EEEEEE; + .img { + width: 40rpx; + height: 39rpx; + background-color: #999999; + float: right; + } + .yongjintop { + width: 317rpx; + // height: 196rpx; + margin-top: 71rpx; + margin-left: 30rpx; + display: flex; + .photo { + width: 130rpx; + height: 130rpx; + background-color: gold; + margin-bottom: 52rpx; + border-radius: 90%; + } + .tel { + color: #333333; + font-size: 28rpx; + margin-top: 33rpx; + margin-left: 35rpx; + .mingpian { + font-size: 24rpx; + color: #999999; + margin-top: 18rpx; + } + } + } +} + +.mid { + width: 100%; + height: 175rpx; + border-bottom: 20rpx solid #FBFBFB; + // justify-content: space-around; + color: #333333; + font-size: 28rpx; + text-align: center; + .midbox { + width: 478rpx; + height: 175rpx; + display: flex; + justify-content: space-between; + margin: 0 auto; + } + .way { + margin-top: 46rpx; + margin-bottom: 14rpx; + } + .money { + font-size: 24rpx; + } + .money1 { + color: #F81F1F; + } + .line { + width: 2rpx; + height: 60rpx; + margin: auto 0; + background-color: #EEEEEE; + } } \ No newline at end of file diff --git a/components/yue/share/share.wxml b/components/yue/share/share.wxml index 48259f2..9739c98 100644 --- a/components/yue/share/share.wxml +++ b/components/yue/share/share.wxml @@ -1,30 +1,30 @@ - - - - - - 156***578 - 我的名片 - - - - - - - 昨日收益 - - 657.00 - RMB - - - - - 昨日收益 - - 657.00 - RMB - - - - + + + + + + 156***578 + 我的名片 + + + + + + + 昨日收益 + + 657.00 + RMB + + + + + 昨日收益 + + 657.00 + RMB + + + + \ No newline at end of file diff --git a/components/yue/yongjintop/yongjintop.scss b/components/yue/yongjintop/yongjintop.scss index 237d90d..a7f3fa5 100644 --- a/components/yue/yongjintop/yongjintop.scss +++ b/components/yue/yongjintop/yongjintop.scss @@ -1,56 +1,56 @@ -.box { - width: 690rpx; - margin: 0 auto; - padding-bottom: 41rpx; - border-bottom: 2rpx solid #EEEEEE; - .yongjintop { - width: 152rpx; - height: 196rpx; - margin: 0 auto; - margin-top: 40rpx; - .photo { - width: 130rpx; - height: 130rpx; - background-color: gold; - margin-bottom: 44rpx; - border-radius: 90%; - } - .tel { - color: #333333; - font-size: 28rpx; - } - } -} - -.mid { - width: 100%; - height: 175rpx; - border-bottom: 20rpx solid #FBFBFB; - // justify-content: space-around; - color: #333333; - font-size: 28rpx; - text-align: center; - .midbox { - width: 478rpx; - height: 175rpx; - display: flex; - justify-content: space-between; - margin: 0 auto; - } - .way { - margin-top: 46rpx; - margin-bottom: 14rpx; - } - .money { - font-size: 24rpx; - } - .money1 { - color: #F81F1F; - } - .line { - width: 2rpx; - height: 60rpx; - margin: auto 0; - background-color: #EEEEEE; - } +.box { + width: 690rpx; + margin: 0 auto; + padding-bottom: 41rpx; + border-bottom: 2rpx solid #EEEEEE; + .yongjintop { + width: 152rpx; + height: 196rpx; + margin: 0 auto; + margin-top: 40rpx; + .photo { + width: 130rpx; + height: 130rpx; + background-color: gold; + margin-bottom: 44rpx; + border-radius: 90%; + } + .tel { + color: #333333; + font-size: 28rpx; + } + } +} + +.mid { + width: 100%; + height: 175rpx; + border-bottom: 20rpx solid #FBFBFB; + // justify-content: space-around; + color: #333333; + font-size: 28rpx; + text-align: center; + .midbox { + width: 478rpx; + height: 175rpx; + display: flex; + justify-content: space-between; + margin: 0 auto; + } + .way { + margin-top: 46rpx; + margin-bottom: 14rpx; + } + .money { + font-size: 24rpx; + } + .money1 { + color: #F81F1F; + } + .line { + width: 2rpx; + height: 60rpx; + margin: auto 0; + background-color: #EEEEEE; + } } \ No newline at end of file diff --git a/components/yue/yongjintop/yongjintop.wxml b/components/yue/yongjintop/yongjintop.wxml index 6a3d8ab..9d99fcc 100644 --- a/components/yue/yongjintop/yongjintop.wxml +++ b/components/yue/yongjintop/yongjintop.wxml @@ -1,26 +1,26 @@ - - - - 156***578 - - - - - - 昨日收益 - - 657.00 - RMB - - - - - 昨日收益 - - 657.00 - RMB - - - - + + + + 156***578 + + + + + + 昨日收益 + + 657.00 + RMB + + + + + 昨日收益 + + 657.00 + RMB + + + + \ No newline at end of file diff --git a/components/yue/yuedetail/yuedetail.scss b/components/yue/yuedetail/yuedetail.scss index 90c43e1..9f5bc4a 100644 --- a/components/yue/yuedetail/yuedetail.scss +++ b/components/yue/yuedetail/yuedetail.scss @@ -1,23 +1,23 @@ -.yuedetail { - width: 100%; - height: 100rpx; - border-bottom: 2rpx solid #EEEEEE; - display: flex; - justify-content: space-between; - .left { - font-size: 28rpx; - margin-left: 30rpx; - .date { - color: #666666; - } - .time { - color: #999999; - margin-top: 5rpx; - } - } - .right { - color: #333333; - font-size: 36rpx; - margin-right: 30rpx; - } +.yuedetail { + width: 100%; + height: 100rpx; + border-bottom: 2rpx solid #EEEEEE; + display: flex; + justify-content: space-between; + .left { + font-size: 28rpx; + margin-left: 30rpx; + .date { + color: #666666; + } + .time { + color: #999999; + margin-top: 5rpx; + } + } + .right { + color: #333333; + font-size: 36rpx; + margin-right: 30rpx; + } } \ No newline at end of file diff --git a/components/yue/yuetitle/yuetitle.scss b/components/yue/yuetitle/yuetitle.scss index 89aec91..9ab746f 100644 --- a/components/yue/yuetitle/yuetitle.scss +++ b/components/yue/yuetitle/yuetitle.scss @@ -1,6 +1,6 @@ -.yuetitle { - color: #333333; - font-size: 28rpx; - font-weight: bold; - margin-left: 31rpx; +.yuetitle { + color: #333333; + font-size: 28rpx; + font-weight: bold; + margin-left: 31rpx; } \ No newline at end of file diff --git a/components/yue/yuetop/yuetop.scss b/components/yue/yuetop/yuetop.scss index d893248..bb32b07 100644 --- a/components/yue/yuetop/yuetop.scss +++ b/components/yue/yuetop/yuetop.scss @@ -1,23 +1,23 @@ -.yuetop { - width: 690rpx; - // height: 189rpx; - margin: 0 auto; - border-bottom: 2rpx solid #EEEEEE; - .all { - color: #333333; - font-size: 28rpx; - padding-top: 63rpx; - padding-bottom: 25rpx; - } - .money { - color: #333333; - font-size: 48rpx; - font-weight: 500; - padding-bottom: 37rpx; - .chong { - color: #09BB07; - font-size: 26rpx; - margin-left: 35rpx; - } - } +.yuetop { + width: 690rpx; + // height: 189rpx; + margin: 0 auto; + border-bottom: 2rpx solid #EEEEEE; + .all { + color: #333333; + font-size: 28rpx; + padding-top: 63rpx; + padding-bottom: 25rpx; + } + .money { + color: #333333; + font-size: 48rpx; + font-weight: 500; + padding-bottom: 37rpx; + .chong { + color: #09BB07; + font-size: 26rpx; + margin-left: 35rpx; + } + } } \ No newline at end of file diff --git a/doc/bin.md b/doc/bin.md index 1501ae5..41a4777 100644 --- a/doc/bin.md +++ b/doc/bin.md @@ -1,31 +1,31 @@ -# bin.js -## 引入方式 -模块导入 -## request 方法 -对于wx.request()的简单封装 -request(object) -返回值类型 promise -除url必须 其余都为可选 详细参数查阅 [微信开发者文档](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html) -``` -object -{ - url,访问地址 必须 - method,请求方式 - header,附加header头 - dataType,返回类型 - responseType,类型 - complete 成功失败都执行的回调函数 -} -``` -``` -request({ - url:"https://api.luyaun.tk/getlist", - method:"GET" -}).then((res)=>{ - 请求成功执行方法 -},(rej)=>{ - 请求失败执行方法 -}).catch((ree)=>{ - 执行错误时调用方法 -}) -``` +# bin.js +## 引入方式 +模块导入 +## request 方法 +对于wx.request()的简单封装 +request(object) +返回值类型 promise +除url必须 其余都为可选 详细参数查阅 [微信开发者文档](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html) +``` +object +{ + url,访问地址 必须 + method,请求方式 + header,附加header头 + dataType,返回类型 + responseType,类型 + complete 成功失败都执行的回调函数 +} +``` +``` +request({ + url:"https://api.luyaun.tk/getlist", + method:"GET" +}).then((res)=>{ + 请求成功执行方法 +},(rej)=>{ + 请求失败执行方法 +}).catch((ree)=>{ + 执行错误时调用方法 +}) +``` diff --git a/pages/accomplish/accomplish.js b/pages/accomplish/accomplish.js index 0833aba..fb2723d 100644 --- a/pages/accomplish/accomplish.js +++ b/pages/accomplish/accomplish.js @@ -1,66 +1,66 @@ -// pages/accomplish/accomplish.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/accomplish/accomplish.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/accomplish/accomplish.json b/pages/accomplish/accomplish.json index ea4d400..2d8a9e4 100644 --- a/pages/accomplish/accomplish.json +++ b/pages/accomplish/accomplish.json @@ -1,7 +1,7 @@ -{ - "usingComponents": { - "content":"../components/particulars/content/index", - "orderchooseaddr":"../components/particulars/orderchooseaddr/index", - "logistics": "../components/particulars/logistics/index" - } +{ + "usingComponents": { + "content":"../components/particulars/content/index", + "orderchooseaddr":"../components/particulars/orderchooseaddr/index", + "logistics": "../components/particulars/logistics/index" + } } \ No newline at end of file diff --git a/pages/accomplish/accomplish.scss b/pages/accomplish/accomplish.scss index c3672b3..0f04cbf 100644 --- a/pages/accomplish/accomplish.scss +++ b/pages/accomplish/accomplish.scss @@ -1,4 +1,4 @@ -.box{} -page{ - background-color: #fbfbfb; +.box{} +page{ + background-color: #fbfbfb; } \ No newline at end of file diff --git a/pages/accomplish/accomplish.wxml b/pages/accomplish/accomplish.wxml index 5c088a4..2838701 100644 --- a/pages/accomplish/accomplish.wxml +++ b/pages/accomplish/accomplish.wxml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/pages/accomplish/accomplish.wxss b/pages/accomplish/accomplish.wxss index bfddcd9..9687673 100644 --- a/pages/accomplish/accomplish.wxss +++ b/pages/accomplish/accomplish.wxss @@ -1 +1 @@ -page{background-color:#fbfbfb} +page{background-color:#fbfbfb} diff --git a/pages/addaddress/addaddress.js b/pages/addaddress/addaddress.js index e59c6e7..8a34eb8 100644 --- a/pages/addaddress/addaddress.js +++ b/pages/addaddress/addaddress.js @@ -10,8 +10,13 @@ Page({ no: 0, userid:"", show: false, - arealist:[], - area:["请选择","请选择","请选择"] + arealist1:[], + arealist2:[], + arealist3:[], + area:["请选择","请选择","请选择"], + tagDis:[false,true,true], + active:0, + addressCity:"北京市 北京市 北京市" }, /** @@ -23,17 +28,18 @@ Page({ urldata:{ parent_id:0 }, + }).then((res)=>{ - console.log(res) + // console.log(res) this.setData({ - arealist:res.data.result + arealist1:res.data.result }) console.log(this.data.arealist) }) }, bindPickerChange(e) { - console.log(e) + // console.log(e) }, showPopup() { this.setData({ show: true }); @@ -43,7 +49,7 @@ Page({ this.setData({ show: false }); }, onMyEvent(e) { - console.log(e) + // console.log(e) for (let i = 0; i < 8; i++) { if (i == e.currentTarget.dataset.no) { this.data.canshu[i] = e.detail @@ -51,10 +57,10 @@ Page({ } - console.log(this.data.canshu) + // console.log(this.data.canshu) }, - choose(e){ - console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset) + choose1(e){ + // console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset) let type=parseInt(e.currentTarget.dataset.type) request({ url: "User/getArea", @@ -62,24 +68,99 @@ Page({ parent_id:e.currentTarget.dataset.id }, }).then((res)=>{ - console.log(res) - if(res.data.result.length){ + // console.log(res) this.setData({ - arealist1:res.data.result + arealist2:res.data.result, + active:1 }) // this.data.area[type]=e.currentTarget.dataset.name - - console.log(this.data.area,123) - - } + this.setData({ + tagDis:[false,false,true] + }) + // console.log(this.data.area,123) + this.data.area[0]=e.currentTarget.dataset.name // for(let i in this.data.area){ // if(i==type){ // this.data.area[i]=e.currentTarget.dataset.name // } // } - this.data.area[0]=e.currentTarget.dataset.name + this.setData({ + area:this.data.area + }) - console.log(this.data.area,this.data.arealist) + // console.log(this.data.area,this.data.arealist) + }) + }, + choose2(e){ + // console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset) + let type=parseInt(e.currentTarget.dataset.type) + request({ + url: "User/getArea", + urldata:{ + parent_id:e.currentTarget.dataset.id + }, + }).then((res)=>{ + + this.setData({ + arealist3:res.data.result, + active:2, + tagDis:[false,false,false] + }) + + // this.data.area[type]=e.currentTarget.dataset.name + + // console.log(this.data.area,123) + + this.data.area[1]=e.currentTarget.dataset.name + // for(let i in this.data.area){ + // if(i==type){ + // this.data.area[i]=e.currentTarget.dataset.name + // } + // } + + this.setData({ + area:this.data.area + }) + + // console.log(this.data.area,this.data.arealist) + console.log(this.data.arealist3+"001",this.data.active+"002",this.data.tagDis+"003") + }) + + + }, + choose3(e){ + // console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset) + let type=parseInt(e.currentTarget.dataset.type) + request({ + url: "User/getArea", + urldata:{ + parent_id:e.currentTarget.dataset.id + }, + }).then((res)=>{ + // console.log(res) + this.setData({ + arealist1:res.data.result, + tagDis:[false,false,false], + active:1 + }) + // this.data.area[type]=e.currentTarget.dataset.name + + // console.log(this.data.area,123) + + this.data.area[2]=e.currentTarget.dataset.name + // for(let i in this.data.area){ + // if(i==type){ + // this.data.area[i]=e.currentTarget.dataset.name + // } + // }} + console.log(93) + this.setData({ + area:this.data.area, + show: false, + addressCity:this.data.area[0]+this.data.area[1]+this.data.area[2] + }) + console.log(this.data.active,94) + // console.log(this.data.area,this.data.arealist) }) }, save() { @@ -89,7 +170,7 @@ Page({ request({ url: "User/validateOpenid", }).then((res)=>{ - console.log(res,1452) + // console.log(res,1452) this.setData({ userid:res.data.data.user_id }) @@ -113,7 +194,7 @@ Page({ zipcode: "271103", } }).then((res)=>{ - console.log(res) + // console.log(res) }) }) diff --git a/pages/addaddress/addaddress.scss b/pages/addaddress/addaddress.scss index 8838d9a..2e666c7 100644 --- a/pages/addaddress/addaddress.scss +++ b/pages/addaddress/addaddress.scss @@ -1,17 +1,17 @@ -.addaddress { - background-color: white; - .btn1 { - position: fixed; - bottom: 102rpx; - left: 50rpx; - } - .choose{ - width:100%; - height: 500rpx; - .item{ - text-indent: 15rpx; - line-height: 70rpx; - - } - } +.addaddress { + background-color: white; + .btn1 { + position: fixed; + bottom: 102rpx; + left: 50rpx; + } + .choose{ + width:100%; + height: 500rpx; + .item{ + text-indent: 15rpx; + line-height: 70rpx; + + } + } } \ No newline at end of file diff --git a/pages/addaddress/addaddress.wxml b/pages/addaddress/addaddress.wxml index de905ea..527092c 100644 --- a/pages/addaddress/addaddress.wxml +++ b/pages/addaddress/addaddress.wxml @@ -8,27 +8,27 @@ --> - + - - - + + + - + {{item.name}} - + - + {{item.name}} - + - + {{item.name}} diff --git a/pages/chooseaddr/chooseaddr.scss b/pages/chooseaddr/chooseaddr.scss index 3684fe8..1bd8a5c 100644 --- a/pages/chooseaddr/chooseaddr.scss +++ b/pages/chooseaddr/chooseaddr.scss @@ -1,10 +1,10 @@ -.chooseaddress { - .addr { - margin-left: 30rpx; - } - .btn1 { - position: fixed; - bottom: 149rpx; - left: 50rpx; - } +.chooseaddress { + .addr { + margin-left: 30rpx; + } + .btn1 { + position: fixed; + bottom: 149rpx; + left: 50rpx; + } } \ No newline at end of file diff --git a/pages/classify/classify.js b/pages/classify/classify.js index 20abaf0..b64786f 100644 --- a/pages/classify/classify.js +++ b/pages/classify/classify.js @@ -1,98 +1,98 @@ -// pages/classify/classify.js -import { request } from "../../utils/bin" -Page({ - - /** - * 页面的初始数据 - */ - data: { - type: [], - list:[] - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - request({ - url: "Goods/goodsCategoryList", - data: { - parent_id: 2 - } - }).then((res) => { - // console.log(res) - this.setData({ - type: res.data.result - }) - this.select({detail:{id:res.data.result[0].id}}) - console.log(this.data.type, 150) - }) - - }, - select(a){ - // console.log(a) - // a.detail.id - request({ - url:'Goods/goodsList', - urldata:{ - id:a.detail.id, - sort:'shop_price', - sort_asc:'desc', - p:0 - } - }).then((res)=>{ - console.log(res) - this.setData({ - list:res.data.result.goods_list - }) - }) - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } +// pages/classify/classify.js +import { request } from "../../utils/bin" +Page({ + + /** + * 页面的初始数据 + */ + data: { + type: [], + list:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + request({ + url: "Goods/goodsCategoryList", + data: { + parent_id: 2 + } + }).then((res) => { + // console.log(res) + this.setData({ + type: res.data.result + }) + this.select({detail:{id:res.data.result[0].id}}) + console.log(this.data.type, 150) + }) + + }, + select(a){ + // console.log(a) + // a.detail.id + request({ + url:'Goods/goodsList', + urldata:{ + id:a.detail.id, + sort:'shop_price', + sort_asc:'desc', + p:0 + } + }).then((res)=>{ + console.log(res) + this.setData({ + list:res.data.result.goods_list + }) + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } }) \ No newline at end of file diff --git a/pages/classify/classify.json b/pages/classify/classify.json index 0fa3766..5e3c39a 100644 --- a/pages/classify/classify.json +++ b/pages/classify/classify.json @@ -1,6 +1,6 @@ -{ - "usingComponents": { - "list":"../components/classify/list/index", - "navigation":"../components/classify/navigation/index" - } +{ + "usingComponents": { + "list":"../components/classify/list/index", + "navigation":"../components/classify/navigation/index" + } } \ No newline at end of file diff --git a/pages/classify/classify.scss b/pages/classify/classify.scss index 4b5efaf..4b27f83 100644 --- a/pages/classify/classify.scss +++ b/pages/classify/classify.scss @@ -1,7 +1,7 @@ -.box{ - width: 750rpx; - display: flex; - border-top: 1rpx solid #eaeaea; - - +.box{ + width: 750rpx; + display: flex; + border-top: 1rpx solid #eaeaea; + + } \ No newline at end of file diff --git a/pages/classify/classify.wxml b/pages/classify/classify.wxml index 9f392af..b25d1b3 100644 --- a/pages/classify/classify.wxml +++ b/pages/classify/classify.wxml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/pages/classify/classify.wxss b/pages/classify/classify.wxss index 7c22a73..11cded2 100644 --- a/pages/classify/classify.wxss +++ b/pages/classify/classify.wxss @@ -1 +1 @@ -.box{width:750rpx;display:flex;border-top:1rpx solid #eaeaea} +.box{width:750rpx;display:flex;border-top:1rpx solid #eaeaea} diff --git a/pages/index/index.js b/pages/index/index.js index f9e3444..b6af4a5 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,22 +1,22 @@ -import {request} from "../../utils/bin" -Page({ - data:{ - list:[] - }, - onLoad(){ - request({ - url:"Goods/hotGoodsList", - data:{ - page:0 - } - }).then((res)=>{ - console.log(res.data.result) - this.setData({ - list:res.data.result - }) - }) - }, - searchs(){ - console.log(10) - } -}) +import {request} from "../../utils/bin" +Page({ + data:{ + list:[] + }, + onLoad(){ + request({ + url:"Goods/hotGoodsList", + data:{ + page:0 + } + }).then((res)=>{ + console.log(res.data.result) + this.setData({ + list:res.data.result + }) + }) + }, + searchs(){ + console.log(10) + } +}) diff --git a/pages/index/index.json b/pages/index/index.json index bb6644d..030d548 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,6 +1,6 @@ -{ - "usingComponents": { - "search":"../components/index/search/index", - "list":"../components/index/list/index" - } +{ + "usingComponents": { + "search":"../components/index/search/index", + "list":"../components/index/list/index" + } } \ No newline at end of file diff --git a/pages/index/index.scss b/pages/index/index.scss index 912df96..56f5a7d 100644 --- a/pages/index/index.scss +++ b/pages/index/index.scss @@ -1,9 +1,9 @@ -.box { - border-top: #eaeaea solid 1rpx; - width: 750rpx; - // overflow: hidden; - display: flex; - align-items: center; - flex-direction: column; - -} +.box { + border-top: #eaeaea solid 1rpx; + width: 750rpx; + // overflow: hidden; + display: flex; + align-items: center; + flex-direction: column; + +} diff --git a/pages/index/index.wxml b/pages/index/index.wxml index bc7cb0c..358a9be 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 3b5be87..e33517d 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1 +1 @@ -.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column} +.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column} diff --git a/pages/login/login.js b/pages/login/login.js index aaa76bf..4e0a03d 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -1,123 +1,123 @@ -// pages/login/login.js -import {request} from "../../utils/bin" -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - getinfo(a){ - request({ - url:"User/validateOpenid" - }).then((res)=>{ - if(res.data.code == 400){ - request({ - url:"User/register", - data:{ - country:"", - gender:0, - nick_name:a.detail.userInfo.nickName, - province:"", - city:"", - head_pic:a.detail.userInfo.avatarUrl, - open_id: wx.getStorageSync("openid"), - - } - }).then((res)=>{ - if(res.data.code == 200){ - wx.switchTab({ - url:"/pages/index/index" - }) - } - }) - }else{ - wx.switchTab({ - url:"/pages/index/index" - }) - } - }) - }, - login(a){ - console.log(a) - let i = this - wx.login({ - success (res) { - if (res.code) { - //发起网络请求 - request({ - url:"User/getopenId", - data:{ - js_code:res.code - } - }).then((res)=>{ - console.log(res) - wx.setStorageSync("openid",res.data.openid) - i.getinfo(a) - wx.switchTab({ - url:"/pages/index/index" - }) - }) - } else { - console.log('登录失败!' + res.errMsg) - } - } - }) - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/login/login.js +import {request} from "../../utils/bin" +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + getinfo(a){ + request({ + url:"User/validateOpenid" + }).then((res)=>{ + if(res.data.code == 400){ + request({ + url:"User/register", + data:{ + country:"", + gender:0, + nick_name:a.detail.userInfo.nickName, + province:"", + city:"", + head_pic:a.detail.userInfo.avatarUrl, + open_id: wx.getStorageSync("openid"), + + } + }).then((res)=>{ + if(res.data.code == 200){ + wx.switchTab({ + url:"/pages/index/index" + }) + } + }) + }else{ + wx.switchTab({ + url:"/pages/index/index" + }) + } + }) + }, + login(a){ + console.log(a) + let i = this + wx.login({ + success (res) { + if (res.code) { + //发起网络请求 + request({ + url:"User/getopenId", + data:{ + js_code:res.code + } + }).then((res)=>{ + console.log(res) + wx.setStorageSync("openid",res.data.openid) + i.getinfo(a) + wx.switchTab({ + url:"/pages/index/index" + }) + }) + } else { + console.log('登录失败!' + res.errMsg) + } + } + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/login/login.json b/pages/login/login.json index 8835af0..6f5247b 100644 --- a/pages/login/login.json +++ b/pages/login/login.json @@ -1,3 +1,3 @@ -{ - "usingComponents": {} +{ + "usingComponents": {} } \ No newline at end of file diff --git a/pages/login/login.wxml b/pages/login/login.wxml index cd32bd7..810930d 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/pages/member/member.scss b/pages/member/member.scss index bb44bb1..9d3a92a 100644 --- a/pages/member/member.scss +++ b/pages/member/member.scss @@ -1,11 +1,11 @@ -.membershops { - display: flex; - flex-wrap: wrap; - .membershop { - // margin-right: 4rpx; - margin-bottom: 4rpx; - } - .membershop:nth-child(odd) { - margin-right: 4rpx; - } +.membershops { + display: flex; + flex-wrap: wrap; + .membershop { + // margin-right: 4rpx; + margin-bottom: 4rpx; + } + .membershop:nth-child(odd) { + margin-right: 4rpx; + } } \ No newline at end of file diff --git a/pages/message/message.js b/pages/message/message.js index cbe2eac..62c6826 100644 --- a/pages/message/message.js +++ b/pages/message/message.js @@ -1,66 +1,66 @@ -// pages/message/message.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/message/message.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/message/message.json b/pages/message/message.json index 8835af0..6f5247b 100644 --- a/pages/message/message.json +++ b/pages/message/message.json @@ -1,3 +1,3 @@ -{ - "usingComponents": {} +{ + "usingComponents": {} } \ No newline at end of file diff --git a/pages/message/message.scss b/pages/message/message.scss index 258f4c3..efd56df 100644 --- a/pages/message/message.scss +++ b/pages/message/message.scss @@ -1,54 +1,54 @@ -.box { - // border-top: 1rpx solid #eaeaea; - display: flex; - flex-direction: column; - align-items: center; - .list { - width: 650rpx; - .information { - margin-top: 43rpx; - display: flex; - flex-direction: column; - font-size: 28rpx; - color: #333; - border-bottom: 1rpx solid #eaeaea; - justify-content: space-between; - > input { - height: 28rpx; - font-size: 28rpx; - color: #333; - } - } - } - .upload{ - width: 650rpx; - margin-top: 42rpx; - .title{ - font-size: 26rpx; - color: #999; - } - .files{ - margin-top: 42rpx; - width: 195rpx; - height: 195rpx; - box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1); - >image{ - width: 50rpx; - height: 41rpx; - background-color: #000; - margin: 77rpx 73rpx; - } - } - } - .submit{ - margin-top: 295rpx; - width: 650rpx; - height: 98rpx; - background-color: #47C877; - border-radius: 49rpx; - font-size: 36rpx; - line-height: 98rpx; - text-align: center; - color: #fff; - } -} +.box { + // border-top: 1rpx solid #eaeaea; + display: flex; + flex-direction: column; + align-items: center; + .list { + width: 650rpx; + .information { + margin-top: 43rpx; + display: flex; + flex-direction: column; + font-size: 28rpx; + color: #333; + border-bottom: 1rpx solid #eaeaea; + justify-content: space-between; + > input { + height: 28rpx; + font-size: 28rpx; + color: #333; + } + } + } + .upload{ + width: 650rpx; + margin-top: 42rpx; + .title{ + font-size: 26rpx; + color: #999; + } + .files{ + margin-top: 42rpx; + width: 195rpx; + height: 195rpx; + box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1); + >image{ + width: 50rpx; + height: 41rpx; + background-color: #000; + margin: 77rpx 73rpx; + } + } + } + .submit{ + margin-top: 295rpx; + width: 650rpx; + height: 98rpx; + background-color: #47C877; + border-radius: 49rpx; + font-size: 36rpx; + line-height: 98rpx; + text-align: center; + color: #fff; + } +} diff --git a/pages/message/message.wxml b/pages/message/message.wxml index 0b6b3b0..c9d88db 100644 --- a/pages/message/message.wxml +++ b/pages/message/message.wxml @@ -1,29 +1,29 @@ - - - - 姓名 - - - - 联系电话 - - - - 邮箱 - - - - 护照奥马 - - - - - 护照正反面照片 - - - - - - 保存 - + + + + 姓名 + + + + 联系电话 + + + + 邮箱 + + + + 护照奥马 + + + + + 护照正反面照片 + + + + + + 保存 + \ No newline at end of file diff --git a/pages/message/message.wxss b/pages/message/message.wxss index ff10952..037e454 100644 --- a/pages/message/message.wxss +++ b/pages/message/message.wxss @@ -1 +1 @@ -.box{display:flex;flex-direction:column;align-items:center}.box .list{width:650rpx}.box .list .information{margin-top:43rpx;display:flex;flex-direction:column;font-size:28rpx;color:#333;border-bottom:1rpx solid #eaeaea;justify-content:space-between}.box .list .information>input{height:28rpx;font-size:28rpx;color:#333}.box .upload{width:650rpx;margin-top:42rpx}.box .upload .title{font-size:26rpx;color:#999}.box .upload .files{margin-top:42rpx;width:195rpx;height:195rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1)}.box .upload .files>image{width:50rpx;height:41rpx;background-color:#000;margin:77rpx 73rpx}.box .submit{margin-top:295rpx;width:650rpx;height:98rpx;background-color:#47C877;border-radius:49rpx;font-size:36rpx;line-height:98rpx;text-align:center;color:#fff} +.box{display:flex;flex-direction:column;align-items:center}.box .list{width:650rpx}.box .list .information{margin-top:43rpx;display:flex;flex-direction:column;font-size:28rpx;color:#333;border-bottom:1rpx solid #eaeaea;justify-content:space-between}.box .list .information>input{height:28rpx;font-size:28rpx;color:#333}.box .upload{width:650rpx;margin-top:42rpx}.box .upload .title{font-size:26rpx;color:#999}.box .upload .files{margin-top:42rpx;width:195rpx;height:195rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1)}.box .upload .files>image{width:50rpx;height:41rpx;background-color:#000;margin:77rpx 73rpx}.box .submit{margin-top:295rpx;width:650rpx;height:98rpx;background-color:#47C877;border-radius:49rpx;font-size:36rpx;line-height:98rpx;text-align:center;color:#fff} diff --git a/pages/order/order.js b/pages/order/order.js index 8e1eeab..33cc5c7 100644 --- a/pages/order/order.js +++ b/pages/order/order.js @@ -1,66 +1,66 @@ -// pages/order/order.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/order/order.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/order/order.json b/pages/order/order.json index f3c80a3..ebceb2d 100644 --- a/pages/order/order.json +++ b/pages/order/order.json @@ -1,5 +1,5 @@ -{ - "usingComponents": { - "tab":"../components/order/tab/index" - } +{ + "usingComponents": { + "tab":"../components/order/tab/index" + } } \ No newline at end of file diff --git a/pages/order/order.scss b/pages/order/order.scss index ffb81b1..8694a2b 100644 --- a/pages/order/order.scss +++ b/pages/order/order.scss @@ -1,9 +1,9 @@ -.box { - display: flex; - flex-direction: column; - align-items: center; - width: 100%; -} -page { - background-color: #efefef; -} +.box { + display: flex; + flex-direction: column; + align-items: center; + width: 100%; +} +page { + background-color: #efefef; +} diff --git a/pages/order/order.wxml b/pages/order/order.wxml index 388926d..e96e475 100644 --- a/pages/order/order.wxml +++ b/pages/order/order.wxml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/pages/order/order.wxss b/pages/order/order.wxss index 069fac9..0c99f82 100644 --- a/pages/order/order.wxss +++ b/pages/order/order.wxss @@ -1 +1 @@ -.box{display:flex;flex-direction:column;align-items:center;width:100%}page{background-color:#efefef} +.box{display:flex;flex-direction:column;align-items:center;width:100%}page{background-color:#efefef} diff --git a/pages/orderconfirm/orderconfirm.scss b/pages/orderconfirm/orderconfirm.scss index 711fb93..76c6434 100644 --- a/pages/orderconfirm/orderconfirm.scss +++ b/pages/orderconfirm/orderconfirm.scss @@ -1,7 +1,7 @@ -.orderconfirm { - .bottom { - width: 100%; - position: fixed; - bottom: 0; - } +.orderconfirm { + .bottom { + width: 100%; + position: fixed; + bottom: 0; + } } \ No newline at end of file diff --git a/pages/orderconfirm/orderconfirm.wxml b/pages/orderconfirm/orderconfirm.wxml index 22ec3be..a3442cb 100644 --- a/pages/orderconfirm/orderconfirm.wxml +++ b/pages/orderconfirm/orderconfirm.wxml @@ -1,11 +1,11 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/pages/particulars/particulars.js b/pages/particulars/particulars.js index 7fa2afd..59060ad 100644 --- a/pages/particulars/particulars.js +++ b/pages/particulars/particulars.js @@ -1,66 +1,66 @@ -// pages/particulars/particulars.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/particulars/particulars.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/particulars/particulars.json b/pages/particulars/particulars.json index 5c781d1..130cb91 100644 --- a/pages/particulars/particulars.json +++ b/pages/particulars/particulars.json @@ -1,8 +1,8 @@ -{ - "usingComponents": { - "content":"../components/particulars/content/index", - "orderchooseaddr":"../components/particulars/orderchooseaddr/index", - "submit":"../components/particulars/submit/index" - - } +{ + "usingComponents": { + "content":"../components/particulars/content/index", + "orderchooseaddr":"../components/particulars/orderchooseaddr/index", + "submit":"../components/particulars/submit/index" + + } } \ No newline at end of file diff --git a/pages/particulars/particulars.scss b/pages/particulars/particulars.scss index 2a0dd97..8844a8b 100644 --- a/pages/particulars/particulars.scss +++ b/pages/particulars/particulars.scss @@ -1,7 +1,7 @@ -.box { - - -} -page { - background-color: #fbfbfb; -} +.box { + + +} +page { + background-color: #fbfbfb; +} diff --git a/pages/particulars/particulars.wxml b/pages/particulars/particulars.wxml index 3e18fc5..b36f87b 100644 --- a/pages/particulars/particulars.wxml +++ b/pages/particulars/particulars.wxml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/pages/particulars/particulars.wxss b/pages/particulars/particulars.wxss index bfddcd9..9687673 100644 --- a/pages/particulars/particulars.wxss +++ b/pages/particulars/particulars.wxss @@ -1 +1 @@ -page{background-color:#fbfbfb} +page{background-color:#fbfbfb} diff --git a/pages/personal/personal.js b/pages/personal/personal.js index c4b67fa..1920bea 100644 --- a/pages/personal/personal.js +++ b/pages/personal/personal.js @@ -1,118 +1,118 @@ -// pages/personal/personal.js. -import {request} from "../../utils/bin" -Page({ - - /** - * 页面的初始数据 - */ - data: { - openid:"", - username:"啦啦啦" - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - - }, - toorder() { - wx.navigateTo({ - url: "/pages/order/order" - }) - }, - toaddress() { - wx.navigateTo({ - url: "/pages/chooseaddr/chooseaddr" - }) - }, - toserver() { - // wx.navigateTo({ - // url: "/pages/order/order" - // }) - }, - tomember() { - wx.navigateTo({ - url: "/pages/member/member" - }) - }, - toorder() { - wx.navigateTo({ - url: "/pages/order/order" - }) - }, - toyue() { - wx.navigateTo({ - url: "/pages/yue/yue" - }) - }, - - toyongjin() { - wx.navigateTo({ - url: "/pages/yongjin/yongjin" - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - login(){ - if(this.data.openid == ""){ - wx.navigateTo({ - url:"/pages/login/login" - }) - } - }, - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - this.setData({ - openid:wx.getStorageSync("openid") - }) - request({ - url:"User/validateOpenid" - }).then((res)=>{ - console.log(res) - }) - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } +// pages/personal/personal.js. +import {request} from "../../utils/bin" +Page({ + + /** + * 页面的初始数据 + */ + data: { + openid:"", + username:"啦啦啦" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + + }, + toorder() { + wx.navigateTo({ + url: "/pages/order/order" + }) + }, + toaddress() { + wx.navigateTo({ + url: "/pages/chooseaddr/chooseaddr" + }) + }, + toserver() { + // wx.navigateTo({ + // url: "/pages/order/order" + // }) + }, + tomember() { + wx.navigateTo({ + url: "/pages/member/member" + }) + }, + toorder() { + wx.navigateTo({ + url: "/pages/order/order" + }) + }, + toyue() { + wx.navigateTo({ + url: "/pages/yue/yue" + }) + }, + + toyongjin() { + wx.navigateTo({ + url: "/pages/yongjin/yongjin" + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + login(){ + if(this.data.openid == ""){ + wx.navigateTo({ + url:"/pages/login/login" + }) + } + }, + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + this.setData({ + openid:wx.getStorageSync("openid") + }) + request({ + url:"User/validateOpenid" + }).then((res)=>{ + console.log(res) + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } }) \ No newline at end of file diff --git a/pages/personal/personal.json b/pages/personal/personal.json index 8835af0..6f5247b 100644 --- a/pages/personal/personal.json +++ b/pages/personal/personal.json @@ -1,3 +1,3 @@ -{ - "usingComponents": {} +{ + "usingComponents": {} } \ No newline at end of file diff --git a/pages/personal/personal.scss b/pages/personal/personal.scss index de0dd3f..2b5563d 100644 --- a/pages/personal/personal.scss +++ b/pages/personal/personal.scss @@ -1,53 +1,53 @@ -.box{ - // border-top: 1rpx solid #eaeaea; - display: flex; - flex-direction: column; - align-items: center; - .card{ - width: 690rpx; - height: 313rpx; - background-color: #47C877; - display: flex; - box-sizing: border-box; - padding: 50rpx; - font-size: 30rpx; - flex-direction: column; - color: #fff; - margin-top: 20rpx; - .user{ - display: flex; - align-items: center; - .head{ - width: 80rpx; - height: 80rpx; - margin-right: 32rpx; - border-radius: 50%; - background-color: #fff; - } - } - .balance{ - display: flex; - flex-direction: column; - margin-top: 52rpx; - } - } - .list{ - display: flex; - width: 690rpx; - margin-top: 33rpx; - flex-direction: column; - .option{ - width: 100%; - height: 80rpx; - margin-bottom: 15rpx; - box-sizing: border-box; - padding: 0 30rpx; - box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1); - display: flex; - align-items: center; - justify-content: space-between; - } - } - - } +.box{ + // border-top: 1rpx solid #eaeaea; + display: flex; + flex-direction: column; + align-items: center; + .card{ + width: 690rpx; + height: 313rpx; + background-color: #47C877; + display: flex; + box-sizing: border-box; + padding: 50rpx; + font-size: 30rpx; + flex-direction: column; + color: #fff; + margin-top: 20rpx; + .user{ + display: flex; + align-items: center; + .head{ + width: 80rpx; + height: 80rpx; + margin-right: 32rpx; + border-radius: 50%; + background-color: #fff; + } + } + .balance{ + display: flex; + flex-direction: column; + margin-top: 52rpx; + } + } + .list{ + display: flex; + width: 690rpx; + margin-top: 33rpx; + flex-direction: column; + .option{ + width: 100%; + height: 80rpx; + margin-bottom: 15rpx; + box-sizing: border-box; + padding: 0 30rpx; + box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1); + display: flex; + align-items: center; + justify-content: space-between; + } + } + + } \ No newline at end of file diff --git a/pages/personal/personal.wxml b/pages/personal/personal.wxml index 9142488..1039351 100644 --- a/pages/personal/personal.wxml +++ b/pages/personal/personal.wxml @@ -1,43 +1,43 @@ - - - - - {{openid == ""?'点击登录':username}} - - - 账户余额 - 480.00 - - - - - 我的订单 - > - - - 地址管理 - > - - - 在线客服 - - - - 会员中心 - 非会员 > - - - 我的余额 - - - - 当前佣金 - - - - 分 享 - - - - + + + + + {{openid == ""?'点击登录':username}} + + + 账户余额 + 480.00 + + + + + 我的订单 + > + + + 地址管理 + > + + + 在线客服 + + + + 会员中心 + 非会员 > + + + 我的余额 + + + + 当前佣金 + + + + 分 享 + + + + \ No newline at end of file diff --git a/pages/personal/personal.wxss b/pages/personal/personal.wxss index 71b97dc..66d9668 100644 --- a/pages/personal/personal.wxss +++ b/pages/personal/personal.wxss @@ -1 +1 @@ -.box{display:flex;flex-direction:column;align-items:center}.box .card{width:690rpx;height:313rpx;background-color:#47C877;display:flex;box-sizing:border-box;padding:50rpx;font-size:30rpx;flex-direction:column;color:#fff;margin-top:20rpx}.box .card .user{display:flex;align-items:center}.box .card .user .head{width:80rpx;height:80rpx;margin-right:32rpx;border-radius:50%;background-color:#fff}.box .card .balance{display:flex;flex-direction:column;margin-top:52rpx}.box .list{display:flex;width:690rpx;margin-top:33rpx;flex-direction:column}.box .list .option{width:100%;height:80rpx;margin-bottom:15rpx;box-sizing:border-box;padding:0 30rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1);display:flex;align-items:center;justify-content:space-between} +.box{display:flex;flex-direction:column;align-items:center}.box .card{width:690rpx;height:313rpx;background-color:#47C877;display:flex;box-sizing:border-box;padding:50rpx;font-size:30rpx;flex-direction:column;color:#fff;margin-top:20rpx}.box .card .user{display:flex;align-items:center}.box .card .user .head{width:80rpx;height:80rpx;margin-right:32rpx;border-radius:50%;background-color:#fff}.box .card .balance{display:flex;flex-direction:column;margin-top:52rpx}.box .list{display:flex;width:690rpx;margin-top:33rpx;flex-direction:column}.box .list .option{width:100%;height:80rpx;margin-bottom:15rpx;box-sizing:border-box;padding:0 30rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1);display:flex;align-items:center;justify-content:space-between} diff --git a/pages/product/product.js b/pages/product/product.js index 27c8bdf..7d080ea 100644 --- a/pages/product/product.js +++ b/pages/product/product.js @@ -1,110 +1,110 @@ -// pages/product/product.js' -import { request } from "../../utils/bin" -Page({ - - /** - * 页面的初始数据 - */ - data: { - array: ['20粒', '30粒', '50粒', '100粒'], - userid:0 - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - console.log(options) - request({ - url: "Goods/goodsInfo", - data: { - id: options.shopid - } - }).then((res) => { - // console.log(res) - this.setData({ - info: res.data.result, - shopid:options.shopid, - }) - // console.log(this.data.type, 150) - }) - request({ - url:"User/validateOpenid" - }).then((res)=>{ - console.log(res) - this.setData({ - userid:res.data.data.user_id - }) - }) - }, - // goshop() { - - // }, - bindPickerChange(e) { - console.log(e.detail.value) - request({ - url: "Cart/addCart", - data: { - goods_id: this.data.shopid, - goods_num: 1, - goods_spec:"", - user_id:this.data.userid - }, - name:"session_id" - }).then((res)=>{ - console.log(res) - wx.switchTab({ - url: '/pages/shopping/shopping' - }) - }) - - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } +// pages/product/product.js' +import { request } from "../../utils/bin" +Page({ + + /** + * 页面的初始数据 + */ + data: { + array: ['20粒', '30粒', '50粒', '100粒'], + userid:0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + console.log(options) + request({ + url: "Goods/goodsInfo", + data: { + id: options.shopid + } + }).then((res) => { + // console.log(res) + this.setData({ + info: res.data.result, + shopid:options.shopid, + }) + // console.log(this.data.type, 150) + }) + request({ + url:"User/validateOpenid" + }).then((res)=>{ + console.log(res) + this.setData({ + userid:res.data.data.user_id + }) + }) + }, + // goshop() { + + // }, + bindPickerChange(e) { + console.log(e.detail.value) + request({ + url: "Cart/addCart", + data: { + goods_id: this.data.shopid, + goods_num: 1, + goods_spec:"", + user_id:this.data.userid + }, + name:"session_id" + }).then((res)=>{ + console.log(res) + wx.switchTab({ + url: '/pages/shopping/shopping' + }) + }) + + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } }) \ No newline at end of file diff --git a/pages/product/product.json b/pages/product/product.json index 8835af0..6f5247b 100644 --- a/pages/product/product.json +++ b/pages/product/product.json @@ -1,3 +1,3 @@ -{ - "usingComponents": {} +{ + "usingComponents": {} } \ No newline at end of file diff --git a/pages/product/product.scss b/pages/product/product.scss index 3476d77..2385c52 100644 --- a/pages/product/product.scss +++ b/pages/product/product.scss @@ -1,37 +1,37 @@ -.box{ - border-top: 1rpx solid #eaeaea; - display: flex; - flex-direction: column; - align-items: center; - .swiper{ - margin-top: 109rpx; - width: 389rpx; - height: 657rpx; - .image{ - width: 389rpx; - height: 549rpx; - background-color: #000; - } - } - .title{ - font-size: 32rpx; - color: #333; - margin-bottom: 34rpx; - width: 540rpx; - } - .menery{ - font-size: 34rpx; - color: #666; - margin-bottom: 70rpx; - } - .add{ - width: 308rpx; - height: 98rpx; - background-color: #50CA80; - border-radius: 49rpx; - line-height: 98rpx; - font-size: 34rpx; - color: #fff; - text-align: center; - } +.box{ + border-top: 1rpx solid #eaeaea; + display: flex; + flex-direction: column; + align-items: center; + .swiper{ + margin-top: 109rpx; + width: 389rpx; + height: 657rpx; + .image{ + width: 389rpx; + height: 549rpx; + background-color: #000; + } + } + .title{ + font-size: 32rpx; + color: #333; + margin-bottom: 34rpx; + width: 540rpx; + } + .menery{ + font-size: 34rpx; + color: #666; + margin-bottom: 70rpx; + } + .add{ + width: 308rpx; + height: 98rpx; + background-color: #50CA80; + border-radius: 49rpx; + line-height: 98rpx; + font-size: 34rpx; + color: #fff; + text-align: center; + } } \ No newline at end of file diff --git a/pages/product/product.wxml b/pages/product/product.wxml index d1cd287..7ef0d93 100644 --- a/pages/product/product.wxml +++ b/pages/product/product.wxml @@ -1,24 +1,24 @@ - - - - - - - - - - {{info.goods.goods_name}} - $ {{info.goods.shop_price}} - - 加入购物车 - + + + + + + + + + + {{info.goods.goods_name}} + $ {{info.goods.shop_price}} + + 加入购物车 + \ No newline at end of file diff --git a/pages/product/product.wxss b/pages/product/product.wxss index 51450d1..b394fc8 100644 --- a/pages/product/product.wxss +++ b/pages/product/product.wxss @@ -1 +1 @@ -.box{border-top:1rpx solid #eaeaea;display:flex;flex-direction:column;align-items:center}.box .swiper{margin-top:109rpx;width:389rpx;height:657rpx}.box .swiper .image{width:389rpx;height:549rpx;background-color:#000}.box .title{font-size:32rpx;color:#333;margin-bottom:34rpx;width:540rpx}.box .menery{font-size:34rpx;color:#666;margin-bottom:70rpx}.box .add{width:308rpx;height:98rpx;background-color:#50CA80;border-radius:49rpx;line-height:98rpx;font-size:34rpx;color:#fff;text-align:center} +.box{border-top:1rpx solid #eaeaea;display:flex;flex-direction:column;align-items:center}.box .swiper{margin-top:109rpx;width:389rpx;height:657rpx}.box .swiper .image{width:389rpx;height:549rpx;background-color:#000}.box .title{font-size:32rpx;color:#333;margin-bottom:34rpx;width:540rpx}.box .menery{font-size:34rpx;color:#666;margin-bottom:70rpx}.box .add{width:308rpx;height:98rpx;background-color:#50CA80;border-radius:49rpx;line-height:98rpx;font-size:34rpx;color:#fff;text-align:center} diff --git a/pages/receiving/receiving.js b/pages/receiving/receiving.js index 516f954..126d85c 100644 --- a/pages/receiving/receiving.js +++ b/pages/receiving/receiving.js @@ -1,66 +1,66 @@ -// pages/receiving/receiving.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/receiving/receiving.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/receiving/receiving.json b/pages/receiving/receiving.json index eb6cd86..c285b38 100644 --- a/pages/receiving/receiving.json +++ b/pages/receiving/receiving.json @@ -1,6 +1,6 @@ -{ - "usingComponents": { - "content":"../components/particulars/content/index", - "orderchooseaddr":"../components/particulars/orderchooseaddr/index" - } +{ + "usingComponents": { + "content":"../components/particulars/content/index", + "orderchooseaddr":"../components/particulars/orderchooseaddr/index" + } } \ No newline at end of file diff --git a/pages/receiving/receiving.scss b/pages/receiving/receiving.scss index 02c16ae..214c6a4 100644 --- a/pages/receiving/receiving.scss +++ b/pages/receiving/receiving.scss @@ -1,7 +1,7 @@ -.box { - - -} -page { - background-color: #fbfbfb; -} +.box { + + +} +page { + background-color: #fbfbfb; +} diff --git a/pages/receiving/receiving.wxml b/pages/receiving/receiving.wxml index f4dcfd5..8427953 100644 --- a/pages/receiving/receiving.wxml +++ b/pages/receiving/receiving.wxml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/pages/receiving/receiving.wxss b/pages/receiving/receiving.wxss index bfddcd9..9687673 100644 --- a/pages/receiving/receiving.wxss +++ b/pages/receiving/receiving.wxss @@ -1 +1 @@ -page{background-color:#fbfbfb} +page{background-color:#fbfbfb} diff --git a/pages/sales1/sales1.js b/pages/sales1/sales1.js index 75dcb4a..e92a7d4 100644 --- a/pages/sales1/sales1.js +++ b/pages/sales1/sales1.js @@ -1,66 +1,66 @@ -// pages/sales1/sales1.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/sales1/sales1.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/sales1/sales1.json b/pages/sales1/sales1.json index 0b4da0c..1fe5451 100644 --- a/pages/sales1/sales1.json +++ b/pages/sales1/sales1.json @@ -1,5 +1,5 @@ -{ - "usingComponents": { - "merchandise":"../components/seles/merchandises/index" - } +{ + "usingComponents": { + "merchandise":"../components/seles/merchandises/index" + } } \ No newline at end of file diff --git a/pages/sales1/sales1.scss b/pages/sales1/sales1.scss index c6e0514..e1e096b 100644 --- a/pages/sales1/sales1.scss +++ b/pages/sales1/sales1.scss @@ -1,48 +1,48 @@ -.box { - border-top: 1rpx solid #eee; - - .fill { - padding: 42rpx 30rpx; - box-sizing: border-box; - .cause { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 45rpx; - .title { - font-size: 26rpx; - color: #333; - } - .select { - font-size: 26rpx; - color: #999; - } - } - .upload { - .title { - font-size: 26rpx; - color: #333; - margin-bottom: 45rpx; - } - .img { - width: 187rpx; - height: 187rpx; - border: 1rpx solid rgba(229, 229, 229, 1); - border-radius: 6rpx; - } - } - - } - .submit{ - width: 650rpx; - height: 98rpx; - border-radius: 49rpx; - background-color: #47C877; - line-height: 98rpx; - text-align: center; - color: #fff; - font-size:36rpx; - margin-top: 67rpx; - margin-left: 50rpx; -} -} +.box { + border-top: 1rpx solid #eee; + + .fill { + padding: 42rpx 30rpx; + box-sizing: border-box; + .cause { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 45rpx; + .title { + font-size: 26rpx; + color: #333; + } + .select { + font-size: 26rpx; + color: #999; + } + } + .upload { + .title { + font-size: 26rpx; + color: #333; + margin-bottom: 45rpx; + } + .img { + width: 187rpx; + height: 187rpx; + border: 1rpx solid rgba(229, 229, 229, 1); + border-radius: 6rpx; + } + } + + } + .submit{ + width: 650rpx; + height: 98rpx; + border-radius: 49rpx; + background-color: #47C877; + line-height: 98rpx; + text-align: center; + color: #fff; + font-size:36rpx; + margin-top: 67rpx; + margin-left: 50rpx; +} +} diff --git a/pages/sales1/sales1.wxml b/pages/sales1/sales1.wxml index d51a15b..5451707 100644 --- a/pages/sales1/sales1.wxml +++ b/pages/sales1/sales1.wxml @@ -1,16 +1,16 @@ - - - - - 退货原因 - 请选择 > - - - 添加照片(选填) - - - - - - 提交 + + + + + 退货原因 + 请选择 > + + + 添加照片(选填) + + + + + + 提交 \ No newline at end of file diff --git a/pages/sales1/sales1.wxss b/pages/sales1/sales1.wxss index 89995a0..75f515b 100644 --- a/pages/sales1/sales1.wxss +++ b/pages/sales1/sales1.wxss @@ -1 +1 @@ -.box{border-top:1rpx solid #eee}.box .fill{padding:42rpx 30rpx;box-sizing:border-box}.box .fill .cause{display:flex;justify-content:space-between;align-items:center;margin-bottom:45rpx}.box .fill .cause .title{font-size:26rpx;color:#333}.box .fill .cause .select{font-size:26rpx;color:#999}.box .fill .upload .title{font-size:26rpx;color:#333;margin-bottom:45rpx}.box .fill .upload .img{width:187rpx;height:187rpx;border:1rpx solid #e5e5e5;border-radius:6rpx}.box .submit{width:650rpx;height:98rpx;border-radius:49rpx;background-color:#47C877;line-height:98rpx;text-align:center;color:#fff;font-size:36rpx;margin-top:67rpx;margin-left:50rpx} +.box{border-top:1rpx solid #eee}.box .fill{padding:42rpx 30rpx;box-sizing:border-box}.box .fill .cause{display:flex;justify-content:space-between;align-items:center;margin-bottom:45rpx}.box .fill .cause .title{font-size:26rpx;color:#333}.box .fill .cause .select{font-size:26rpx;color:#999}.box .fill .upload .title{font-size:26rpx;color:#333;margin-bottom:45rpx}.box .fill .upload .img{width:187rpx;height:187rpx;border:1rpx solid #e5e5e5;border-radius:6rpx}.box .submit{width:650rpx;height:98rpx;border-radius:49rpx;background-color:#47C877;line-height:98rpx;text-align:center;color:#fff;font-size:36rpx;margin-top:67rpx;margin-left:50rpx} diff --git a/pages/sales2/sales2.js b/pages/sales2/sales2.js index a6589fc..72c54ae 100644 --- a/pages/sales2/sales2.js +++ b/pages/sales2/sales2.js @@ -1,66 +1,66 @@ -// pages/sales2/sales2.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/sales2/sales2.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/sales2/sales2.json b/pages/sales2/sales2.json index dc1be96..a862459 100644 --- a/pages/sales2/sales2.json +++ b/pages/sales2/sales2.json @@ -1,3 +1,3 @@ -{ - "usingComponents": { "merchandise":"../components/seles/merchandises/index"} +{ + "usingComponents": { "merchandise":"../components/seles/merchandises/index"} } \ No newline at end of file diff --git a/pages/sales2/sales2.scss b/pages/sales2/sales2.scss index a30cc84..d2678c0 100644 --- a/pages/sales2/sales2.scss +++ b/pages/sales2/sales2.scss @@ -1,34 +1,34 @@ -.box{ - border-top: 1rpx solid #efefef; - .info{ - border-bottom: 1rpx solid #efefef; - padding: 29rpx; - box-sizing: border-box; - .title{ - font-size: 26rpx; - color: #333; - margin-bottom: 22rpx; - } - .msg{ - font-size: 24rpx; - color: #999; - } - } - .submit{ - display: flex; - margin-top: 36rpx; - padding: 0 30rpx; - justify-content: flex-end; - .button{ - width: 133rpx; - height: 51rpx; - border: 1rpx solid #47C877; - border-radius: 25rpx; - color: #47C877; - font-size: 22rpx; - line-height: 51rpx; - text-align: center; - margin-left: 8rpx; - } - } +.box{ + border-top: 1rpx solid #efefef; + .info{ + border-bottom: 1rpx solid #efefef; + padding: 29rpx; + box-sizing: border-box; + .title{ + font-size: 26rpx; + color: #333; + margin-bottom: 22rpx; + } + .msg{ + font-size: 24rpx; + color: #999; + } + } + .submit{ + display: flex; + margin-top: 36rpx; + padding: 0 30rpx; + justify-content: flex-end; + .button{ + width: 133rpx; + height: 51rpx; + border: 1rpx solid #47C877; + border-radius: 25rpx; + color: #47C877; + font-size: 22rpx; + line-height: 51rpx; + text-align: center; + margin-left: 8rpx; + } + } } \ No newline at end of file diff --git a/pages/sales2/sales2.wxml b/pages/sales2/sales2.wxml index a1aba57..ccd16e7 100644 --- a/pages/sales2/sales2.wxml +++ b/pages/sales2/sales2.wxml @@ -1,15 +1,15 @@ - - - 等待商家处理 - 请耐心等待 - - - - 退货原因: 拍多/多拍/不想要 - 申请时间:2019-07-21 11:23:21 - - - 修改申请 - 取消申请 - + + + 等待商家处理 + 请耐心等待 + + + + 退货原因: 拍多/多拍/不想要 + 申请时间:2019-07-21 11:23:21 + + + 修改申请 + 取消申请 + \ No newline at end of file diff --git a/pages/sales2/sales2.wxss b/pages/sales2/sales2.wxss index 0e1bda0..e05f2bf 100644 --- a/pages/sales2/sales2.wxss +++ b/pages/sales2/sales2.wxss @@ -1 +1 @@ -.box{border-top:1rpx solid #efefef}.box .info{border-bottom:1rpx solid #efefef;padding:29rpx;box-sizing:border-box}.box .info .title{font-size:26rpx;color:#333;margin-bottom:22rpx}.box .info .msg{font-size:24rpx;color:#999}.box .submit{display:flex;margin-top:36rpx;padding:0 30rpx;justify-content:flex-end}.box .submit .button{width:133rpx;height:51rpx;border:1rpx solid #47C877;border-radius:25rpx;color:#47C877;font-size:22rpx;line-height:51rpx;text-align:center;margin-left:8rpx} +.box{border-top:1rpx solid #efefef}.box .info{border-bottom:1rpx solid #efefef;padding:29rpx;box-sizing:border-box}.box .info .title{font-size:26rpx;color:#333;margin-bottom:22rpx}.box .info .msg{font-size:24rpx;color:#999}.box .submit{display:flex;margin-top:36rpx;padding:0 30rpx;justify-content:flex-end}.box .submit .button{width:133rpx;height:51rpx;border:1rpx solid #47C877;border-radius:25rpx;color:#47C877;font-size:22rpx;line-height:51rpx;text-align:center;margin-left:8rpx} diff --git a/pages/search/search.js b/pages/search/search.js index ede280c..ef3f5d3 100644 --- a/pages/search/search.js +++ b/pages/search/search.js @@ -1,66 +1,66 @@ -// pages/search/search.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/search/search.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/search/search.json b/pages/search/search.json index dd3996b..13d8b15 100644 --- a/pages/search/search.json +++ b/pages/search/search.json @@ -1,6 +1,6 @@ -{ - "usingComponents": { - "search":"../components/index/search/index", - "hot":"../components/search/hot/index" - } +{ + "usingComponents": { + "search":"../components/index/search/index", + "hot":"../components/search/hot/index" + } } \ No newline at end of file diff --git a/pages/search/search.scss b/pages/search/search.scss index 67cdbfa..e9b9146 100644 --- a/pages/search/search.scss +++ b/pages/search/search.scss @@ -1,7 +1,7 @@ -.box { - border-top: #eaeaea solid 1rpx; - width: 750rpx; - display: flex; - align-items: center; - flex-direction: column; -} +.box { + border-top: #eaeaea solid 1rpx; + width: 750rpx; + display: flex; + align-items: center; + flex-direction: column; +} diff --git a/pages/search/search.wxml b/pages/search/search.wxml index 10d31b6..f962047 100644 --- a/pages/search/search.wxml +++ b/pages/search/search.wxml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/pages/search/search.wxss b/pages/search/search.wxss index 3b5be87..e33517d 100644 --- a/pages/search/search.wxss +++ b/pages/search/search.wxss @@ -1 +1 @@ -.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column} +.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column} diff --git a/pages/share/share.scss b/pages/share/share.scss index 9c21f5f..0dc74fb 100644 --- a/pages/share/share.scss +++ b/pages/share/share.scss @@ -1,7 +1,7 @@ -.share { - background-color: white; -} - -.detail { - margin-top: 41rpx; +.share { + background-color: white; +} + +.detail { + margin-top: 41rpx; } \ No newline at end of file diff --git a/pages/shopping/shopping.js b/pages/shopping/shopping.js index 66d90fa..9def40c 100644 --- a/pages/shopping/shopping.js +++ b/pages/shopping/shopping.js @@ -1,178 +1,178 @@ -// pages/shopping/shopping.js -import { request } from "../../utils/bin" -Page({ - - /** - * 页面的初始数据 - */ - data: { - list: [], - select: [], - userid: 0, - price: "0.00" - }, - sel(a) { - console.log(a) - this.setData({ - [`select[${a.detail.index}]`]: !a.detail.select - }) - this.num(); - }, - - /** - * 生命周期函数--监听页面加载 - */ - getlist() { - request({ - url: "Cart/cartList/session_id/" + wx.getStorageSync('openid'), - data: { - user_id: this.data.userid - } - }).then((res) => { - console.log(res) - this.setData({ - list: res.data.result - }) - this.num() - - }) - }, - onLoad: function (options) { - request({ - url: "User/validateOpenid" - }).then((res) => { - console.log(res) - this.setData({ - userid: res.data.data.user_id - }) - this.getlist() - - }) - }, - sub() { - wx.navigateTo({ - url: "/pages/orderconfirm/orderconfirm" - }) - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - this.onLoad() - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, - num() { - let num = 0; - let sel = 0; - for (let i in this.data.select) { - console.log(i) - if (this.data.select[i]) { - num += parseFloat(this.data.list[i].goods_price) * 100 - sel++ - } - } - if (sel == this.data.list.length && this.data.list.length != 0) { - this.setData({ - all: true - }) - } else { - this.setData({ - all: false - }) - } - this.setData({ - price: num / 100 - }) - }, - call() { - let sel = 0; - let select = [] - for (let i in this.data.list) { - console.log(i) - if (this.data.select[i]) { - // num += parseFloat(this.data.list[i].goods_price)*100 - sel++ - } else { - select[i] = true - } - } - if (sel == this.data.list.length) { - this.setData({ - all: false, - select: [] - }) - } else { - this.setData({ - all: true, - select - }) - } - this.num() - - }, - del() { - for (let i in this.data.list) { - // console.log(i) - if (this.data.select[i]) { - // num += parseFloat(this.data.list[i].goods_price)*100 - // sel++ - request({ - url: "Cart/delCart", - urldata: { - id: this.data.list[i].id - } - }).then((res) => { - console.log('删除成功') - this.setData({ - list: [], - select: [], - userid: 0, - price: "0.00" - }) - this.onLoad() - }) - } - } - } +// pages/shopping/shopping.js +import { request } from "../../utils/bin" +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: [], + select: [], + userid: 0, + price: "0.00" + }, + sel(a) { + console.log(a) + this.setData({ + [`select[${a.detail.index}]`]: !a.detail.select + }) + this.num(); + }, + + /** + * 生命周期函数--监听页面加载 + */ + getlist() { + request({ + url: "Cart/cartList/session_id/" + wx.getStorageSync('openid'), + data: { + user_id: this.data.userid + } + }).then((res) => { + console.log(res) + this.setData({ + list: res.data.result + }) + this.num() + + }) + }, + onLoad: function (options) { + request({ + url: "User/validateOpenid" + }).then((res) => { + console.log(res) + this.setData({ + userid: res.data.data.user_id + }) + this.getlist() + + }) + }, + sub() { + wx.navigateTo({ + url: "/pages/orderconfirm/orderconfirm" + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.onLoad() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + num() { + let num = 0; + let sel = 0; + for (let i in this.data.select) { + console.log(i) + if (this.data.select[i]) { + num += parseFloat(this.data.list[i].goods_price) * 100 + sel++ + } + } + if (sel == this.data.list.length && this.data.list.length != 0) { + this.setData({ + all: true + }) + } else { + this.setData({ + all: false + }) + } + this.setData({ + price: num / 100 + }) + }, + call() { + let sel = 0; + let select = [] + for (let i in this.data.list) { + console.log(i) + if (this.data.select[i]) { + // num += parseFloat(this.data.list[i].goods_price)*100 + sel++ + } else { + select[i] = true + } + } + if (sel == this.data.list.length) { + this.setData({ + all: false, + select: [] + }) + } else { + this.setData({ + all: true, + select + }) + } + this.num() + + }, + del() { + for (let i in this.data.list) { + // console.log(i) + if (this.data.select[i]) { + // num += parseFloat(this.data.list[i].goods_price)*100 + // sel++ + request({ + url: "Cart/delCart", + urldata: { + id: this.data.list[i].id + } + }).then((res) => { + console.log('删除成功') + this.setData({ + list: [], + select: [], + userid: 0, + price: "0.00" + }) + this.onLoad() + }) + } + } + } }) \ No newline at end of file diff --git a/pages/shopping/shopping.wxml b/pages/shopping/shopping.wxml index 58f0a24..79d9208 100644 --- a/pages/shopping/shopping.wxml +++ b/pages/shopping/shopping.wxml @@ -1,25 +1,25 @@ - - - - - - - - - 全选 - ${{price}} - - - 删除 - 结算 - - + + + + + + + + + 全选 + ${{price}} + + + 删除 + 结算 + + \ No newline at end of file diff --git a/pages/shopping/shopping.wxss b/pages/shopping/shopping.wxss index ace9498..a627fcc 100644 --- a/pages/shopping/shopping.wxss +++ b/pages/shopping/shopping.wxss @@ -1,54 +1,54 @@ -.shopping { - padding-bottom: 128rpx; -} -.item { - height: 186rpx; - margin-left: 46rpx; - margin-top: 59rpx; -} - -.bottom { - width: 100%; - height: 98rpx; - position: fixed; - bottom: 0; - background: linear-gradient(2deg, rgba(250, 250, 250, 0.94), rgba(255, 255, 255, 0.94)); - display: flex; - justify-content: space-between; - font-size: 28rpx; - line-height: 98rpx; -} - -.left { - display: flex; - /* line-height: 26rpx; */ -} - -.select { - width: 26rpx; - height: 26rpx; - background: rgba(234, 234, 234, 1); - border-radius: 50%; - margin: auto 0; - margin-left: 46rpx; - margin-right: 24rpx; -} -.selects{ - background-color: #4cc97d; -} - -.pri { - color: #e0c79d; - font-size: 26rpx; - margin-left: 19rpx; -} - -.right { - color: #bbbbbb; - margin-right: 31rpx; -} - -.sub { - margin-left: 30rpx; - color: #4cc97d; -} +.shopping { + padding-bottom: 128rpx; +} +.item { + height: 186rpx; + margin-left: 46rpx; + margin-top: 59rpx; +} + +.bottom { + width: 100%; + height: 98rpx; + position: fixed; + bottom: 0; + background: linear-gradient(2deg, rgba(250, 250, 250, 0.94), rgba(255, 255, 255, 0.94)); + display: flex; + justify-content: space-between; + font-size: 28rpx; + line-height: 98rpx; +} + +.left { + display: flex; + /* line-height: 26rpx; */ +} + +.select { + width: 26rpx; + height: 26rpx; + background: rgba(234, 234, 234, 1); + border-radius: 50%; + margin: auto 0; + margin-left: 46rpx; + margin-right: 24rpx; +} +.selects{ + background-color: #4cc97d; +} + +.pri { + color: #e0c79d; + font-size: 26rpx; + margin-left: 19rpx; +} + +.right { + color: #bbbbbb; + margin-right: 31rpx; +} + +.sub { + margin-left: 30rpx; + color: #4cc97d; +} diff --git a/pages/status/status.js b/pages/status/status.js index 04ef804..090b0ea 100644 --- a/pages/status/status.js +++ b/pages/status/status.js @@ -1,66 +1,66 @@ -// pages/status/status.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// pages/status/status.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } }) \ No newline at end of file diff --git a/pages/status/status.json b/pages/status/status.json index 7ed5481..8e5e5a0 100644 --- a/pages/status/status.json +++ b/pages/status/status.json @@ -1,6 +1,6 @@ -{ - "usingComponents": { - "logistics": "../components/particulars/logistics/index", - "message":"../components/order/message/index" - } +{ + "usingComponents": { + "logistics": "../components/particulars/logistics/index", + "message":"../components/order/message/index" + } } \ No newline at end of file diff --git a/pages/status/status.scss b/pages/status/status.scss index abf7183..fb30cc0 100644 --- a/pages/status/status.scss +++ b/pages/status/status.scss @@ -1,11 +1,11 @@ -.box { - .reference { - font-size: 24rpx; - color: #999; - padding: 32rpx 20rpx; - background-color: #fff; - } -} -page { - background-color: #fbfbfb; -} +.box { + .reference { + font-size: 24rpx; + color: #999; + padding: 32rpx 20rpx; + background-color: #fff; + } +} +page { + background-color: #fbfbfb; +} diff --git a/pages/status/status.wxml b/pages/status/status.wxml index 9bf2740..f52a243 100644 --- a/pages/status/status.wxml +++ b/pages/status/status.wxml @@ -1,7 +1,7 @@ - - - 订单编号:1234567812345789 - - - + + + 订单编号:1234567812345789 + + + \ No newline at end of file diff --git a/pages/status/status.wxss b/pages/status/status.wxss index 69a5c9b..5cba288 100644 --- a/pages/status/status.wxss +++ b/pages/status/status.wxss @@ -1 +1 @@ -.box .reference{font-size:24rpx;color:#999;padding:32rpx 20rpx;background-color:#fff}page{background-color:#fbfbfb} +.box .reference{font-size:24rpx;color:#999;padding:32rpx 20rpx;background-color:#fff}page{background-color:#fbfbfb} diff --git a/pages/undetermined/undetermined.js b/pages/undetermined/undetermined.js index 291518d..21143b2 100644 --- a/pages/undetermined/undetermined.js +++ b/pages/undetermined/undetermined.js @@ -1,75 +1,75 @@ -// pages/undetermined/undetermined.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - - }, - chooseaddr() { - wx.navigateTo({ - url: "/pages/chooseaddr/chooseaddr" - }) - }, - todetail() { - wx.navigateTo({ - url: "/pages/product/product" - }) - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } +// pages/undetermined/undetermined.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + + }, + chooseaddr() { + wx.navigateTo({ + url: "/pages/chooseaddr/chooseaddr" + }) + }, + todetail() { + wx.navigateTo({ + url: "/pages/product/product" + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } }) \ No newline at end of file diff --git a/pages/undetermined/undetermined.json b/pages/undetermined/undetermined.json index eb6cd86..c285b38 100644 --- a/pages/undetermined/undetermined.json +++ b/pages/undetermined/undetermined.json @@ -1,6 +1,6 @@ -{ - "usingComponents": { - "content":"../components/particulars/content/index", - "orderchooseaddr":"../components/particulars/orderchooseaddr/index" - } +{ + "usingComponents": { + "content":"../components/particulars/content/index", + "orderchooseaddr":"../components/particulars/orderchooseaddr/index" + } } \ No newline at end of file diff --git a/pages/undetermined/undetermined.scss b/pages/undetermined/undetermined.scss index bc82d27..4ca84da 100644 --- a/pages/undetermined/undetermined.scss +++ b/pages/undetermined/undetermined.scss @@ -1,6 +1,6 @@ -page{ - background-color: #FBFBFB; -} -.box{ - +page{ + background-color: #FBFBFB; +} +.box{ + } \ No newline at end of file diff --git a/pages/undetermined/undetermined.wxml b/pages/undetermined/undetermined.wxml index 2102198..eb2aa95 100644 --- a/pages/undetermined/undetermined.wxml +++ b/pages/undetermined/undetermined.wxml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/pages/undetermined/undetermined.wxss b/pages/undetermined/undetermined.wxss index 51bc482..50e1501 100644 --- a/pages/undetermined/undetermined.wxss +++ b/pages/undetermined/undetermined.wxss @@ -1 +1 @@ -page{background-color:#FBFBFB} +page{background-color:#FBFBFB} diff --git a/pages/yongjin/yongjin.scss b/pages/yongjin/yongjin.scss index 54dacf5..20fda9b 100644 --- a/pages/yongjin/yongjin.scss +++ b/pages/yongjin/yongjin.scss @@ -1,7 +1,7 @@ -.detail { - margin-top: 41rpx; -} - -.title { - margin-top: 40rpx +.detail { + margin-top: 41rpx; +} + +.title { + margin-top: 40rpx } \ No newline at end of file diff --git a/pages/yue/yue.scss b/pages/yue/yue.scss index fffd040..d0e748b 100644 --- a/pages/yue/yue.scss +++ b/pages/yue/yue.scss @@ -1,8 +1,8 @@ -.yue { - .title { - margin-top: 40rpx - } - .detail { - margin-top: 41rpx; - } +.yue { + .title { + margin-top: 40rpx + } + .detail { + margin-top: 41rpx; + } } \ No newline at end of file diff --git a/sitemap.json b/sitemap.json index ca02add..bb97574 100644 --- a/sitemap.json +++ b/sitemap.json @@ -1,7 +1,7 @@ -{ - "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", - "rules": [{ - "action": "allow", - "page": "*" - }] +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] } \ No newline at end of file diff --git a/utils/bin.js b/utils/bin.js index f5daf4f..c569800 100644 --- a/utils/bin.js +++ b/utils/bin.js @@ -1,57 +1,57 @@ -//请求接口 -let request = function (obj){ - let { - url, - data, - method, - header, - dataType, - responseType, - complete, - name, - urldata - } = obj - url="http://daigou.sdbairui.com/index.php/WXAPI/" + url - let text = "" - for(let i in urldata){ - if(urldata[i] == undefined){ - text += `/${i}` - - }else{ - text += `/${i}/${urldata[i]}` - - } - } - url+=text - // if(method == "POST" || method == "post"){ - // if(header == undefined){ - // header ={} - // } - // header['content-type'] = "application/x-www-form-urlencoded" - // } - if(data == undefined){ - data = {} - } - data[name || 'openid'] = wx.getStorageSync("openid") - return new Promise((res,rej)=>{ - wx.request({ - url, - data, - method, - header, - dataType, - responseType, - success(data){ - res(data) - }, - fail(data){ - rej(data) - }, - complete - }) - }) -} - -module.exports = { - request +//请求接口 +let request = function (obj){ + let { + url, + data, + method, + header, + dataType, + responseType, + complete, + name, + urldata + } = obj + url="http://daigou.sdbairui.com/index.php/WXAPI/" + url + let text = "" + for(let i in urldata){ + if(urldata[i] == undefined){ + text += `/${i}` + + }else{ + text += `/${i}/${urldata[i]}` + + } + } + url+=text + // if(method == "POST" || method == "post"){ + // if(header == undefined){ + // header ={} + // } + // header['content-type'] = "application/x-www-form-urlencoded" + // } + if(data == undefined){ + data = {} + } + data[name || 'openid'] = wx.getStorageSync("openid") + return new Promise((res,rej)=>{ + wx.request({ + url, + data, + method, + header, + dataType, + responseType, + success(data){ + res(data) + }, + fail(data){ + rej(data) + }, + complete + }) + }) +} + +module.exports = { + request } \ No newline at end of file diff --git a/utils/dist/action-sheet/index.d.ts b/utils/dist/action-sheet/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/action-sheet/index.d.ts +++ b/utils/dist/action-sheet/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/action-sheet/index.js b/utils/dist/action-sheet/index.js index 8065c83..0234783 100644 --- a/utils/dist/action-sheet/index.js +++ b/utils/dist/action-sheet/index.js @@ -1,59 +1,59 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - show: Boolean, - title: String, - cancelText: String, - description: String, - round: { - type: Boolean, - value: true - }, - zIndex: { - type: Number, - value: 100 - }, - actions: { - type: Array, - value: [] - }, - overlay: { - type: Boolean, - value: true - }, - closeOnClickOverlay: { - type: Boolean, - value: true - }, - closeOnClickAction: { - type: Boolean, - value: true - }, - safeAreaInsetBottom: { - type: Boolean, - value: true - } - }, - methods: { - onSelect(event) { - const { index } = event.currentTarget.dataset; - const item = this.data.actions[index]; - if (item && !item.disabled && !item.loading) { - this.$emit('select', item); - if (this.data.closeOnClickAction) { - this.onClose(); - } - } - }, - onCancel() { - this.$emit('cancel'); - }, - onClose() { - this.$emit('close'); - }, - onClickOverlay() { - this.$emit('click-overlay'); - this.onClose(); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + show: Boolean, + title: String, + cancelText: String, + description: String, + round: { + type: Boolean, + value: true + }, + zIndex: { + type: Number, + value: 100 + }, + actions: { + type: Array, + value: [] + }, + overlay: { + type: Boolean, + value: true + }, + closeOnClickOverlay: { + type: Boolean, + value: true + }, + closeOnClickAction: { + type: Boolean, + value: true + }, + safeAreaInsetBottom: { + type: Boolean, + value: true + } + }, + methods: { + onSelect(event) { + const { index } = event.currentTarget.dataset; + const item = this.data.actions[index]; + if (item && !item.disabled && !item.loading) { + this.$emit('select', item); + if (this.data.closeOnClickAction) { + this.onClose(); + } + } + }, + onCancel() { + this.$emit('cancel'); + }, + onClose() { + this.$emit('close'); + }, + onClickOverlay() { + this.$emit('click-overlay'); + this.onClose(); + } + } +}); diff --git a/utils/dist/action-sheet/index.json b/utils/dist/action-sheet/index.json index 19bf989..b3548bd 100644 --- a/utils/dist/action-sheet/index.json +++ b/utils/dist/action-sheet/index.json @@ -1,8 +1,8 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-popup": "../popup/index", - "van-loading": "../loading/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" + } +} diff --git a/utils/dist/action-sheet/index.wxml b/utils/dist/action-sheet/index.wxml index bed9b06..90bc5fd 100644 --- a/utils/dist/action-sheet/index.wxml +++ b/utils/dist/action-sheet/index.wxml @@ -1,54 +1,54 @@ - - - - - {{ title }} - - - - {{ description }} - - - - - - - - {{ cancelText }} - - + + + + + {{ title }} + + + + {{ description }} + + + + + + + + {{ cancelText }} + + diff --git a/utils/dist/area/index.d.ts b/utils/dist/area/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/area/index.d.ts +++ b/utils/dist/area/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/area/index.js b/utils/dist/area/index.js index 5601d77..b90017d 100644 --- a/utils/dist/area/index.js +++ b/utils/dist/area/index.js @@ -1,210 +1,210 @@ -import { VantComponent } from '../common/component'; -import { pickerProps } from '../picker/shared'; -const COLUMNSPLACEHOLDERCODE = '000000'; -VantComponent({ - classes: ['active-class', 'toolbar-class', 'column-class'], - props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: { - type: Object, - value: {} - }, columnsNum: { - type: null, - value: 3 - }, columnsPlaceholder: { - type: Array, - observer(val) { - this.setData({ - typeToColumnsPlaceholder: { - province: val[0] || '', - city: val[1] || '', - county: val[2] || '', - } - }); - } - } }), - data: { - columns: [{ values: [] }, { values: [] }, { values: [] }], - displayColumns: [{ values: [] }, { values: [] }, { values: [] }], - typeToColumnsPlaceholder: {} - }, - watch: { - value(value) { - this.code = value; - this.setValues(); - }, - areaList: 'setValues', - columnsNum(value) { - this.setData({ - displayColumns: this.data.columns.slice(0, +value) - }); - } - }, - mounted() { - setTimeout(() => { - this.setValues(); - }, 0); - }, - methods: { - getPicker() { - if (this.picker == null) { - this.picker = this.selectComponent('.van-area__picker'); - } - return this.picker; - }, - onCancel(event) { - this.emit('cancel', event.detail); - }, - onConfirm(event) { - const { index } = event.detail; - let { value } = event.detail; - value = this.parseOutputValues(value); - this.emit('confirm', { value, index }); - }, - emit(type, detail) { - detail.values = detail.value; - delete detail.value; - this.$emit(type, detail); - }, - // parse output columns data - parseOutputValues(values) { - const { columnsPlaceholder } = this.data; - return values.map((value, index) => { - // save undefined value - if (!value) - return value; - value = JSON.parse(JSON.stringify(value)); - if (!value.code || value.name === columnsPlaceholder[index]) { - value.code = ''; - value.name = ''; - } - return value; - }); - }, - onChange(event) { - const { index, picker, value } = event.detail; - this.code = value[index].code; - this.setValues().then(() => { - this.$emit('change', { - picker, - values: this.parseOutputValues(picker.getValues()), - index - }); - }); - }, - getConfig(type) { - const { areaList } = this.data; - return (areaList && areaList[`${type}_list`]) || {}; - }, - getList(type, code) { - const { typeToColumnsPlaceholder } = this.data; - let result = []; - if (type !== 'province' && !code) { - return result; - } - const list = this.getConfig(type); - result = Object.keys(list).map(code => ({ - code, - name: list[code] - })); - if (code) { - // oversea code - if (code[0] === '9' && type === 'city') { - code = '9'; - } - result = result.filter(item => item.code.indexOf(code) === 0); - } - if (typeToColumnsPlaceholder[type] && result.length) { - // set columns placeholder - const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6); - result.unshift({ - code: `${code}${codeFill}`, - name: typeToColumnsPlaceholder[type] - }); - } - return result; - }, - getIndex(type, code) { - let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; - const list = this.getList(type, code.slice(0, compareNum - 2)); - // oversea code - if (code[0] === '9' && type === 'province') { - compareNum = 1; - } - code = code.slice(0, compareNum); - for (let i = 0; i < list.length; i++) { - if (list[i].code.slice(0, compareNum) === code) { - return i; - } - } - return 0; - }, - setValues() { - const county = this.getConfig('county'); - let { code } = this; - if (!code) { - if (this.data.columnsPlaceholder.length) { - code = COLUMNSPLACEHOLDERCODE; - } - else if (Object.keys(county)[0]) { - code = Object.keys(county)[0]; - } - else { - code = ''; - } - } - const province = this.getList('province'); - const city = this.getList('city', code.slice(0, 2)); - const picker = this.getPicker(); - if (!picker) { - return; - } - const stack = []; - stack.push(picker.setColumnValues(0, province, false)); - stack.push(picker.setColumnValues(1, city, false)); - if (city.length && code.slice(2, 4) === '00') { - [{ code }] = city; - } - stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false)); - return Promise.all(stack) - .catch(() => { }) - .then(() => picker.setIndexes([ - this.getIndex('province', code), - this.getIndex('city', code), - this.getIndex('county', code) - ])) - .catch(() => { }); - }, - getValues() { - const picker = this.getPicker(); - return picker ? picker.getValues().filter(value => !!value) : []; - }, - getDetail() { - const values = this.getValues(); - const area = { - code: '', - country: '', - province: '', - city: '', - county: '' - }; - if (!values.length) { - return area; - } - const names = values.map((item) => item.name); - area.code = values[values.length - 1].code; - if (area.code[0] === '9') { - area.country = names[1] || ''; - area.province = names[2] || ''; - } - else { - area.province = names[0] || ''; - area.city = names[1] || ''; - area.county = names[2] || ''; - } - return area; - }, - reset(code) { - this.code = code || ''; - return this.setValues(); - } - } -}); +import { VantComponent } from '../common/component'; +import { pickerProps } from '../picker/shared'; +const COLUMNSPLACEHOLDERCODE = '000000'; +VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: { + type: Object, + value: {} + }, columnsNum: { + type: null, + value: 3 + }, columnsPlaceholder: { + type: Array, + observer(val) { + this.setData({ + typeToColumnsPlaceholder: { + province: val[0] || '', + city: val[1] || '', + county: val[2] || '', + } + }); + } + } }), + data: { + columns: [{ values: [] }, { values: [] }, { values: [] }], + displayColumns: [{ values: [] }, { values: [] }, { values: [] }], + typeToColumnsPlaceholder: {} + }, + watch: { + value(value) { + this.code = value; + this.setValues(); + }, + areaList: 'setValues', + columnsNum(value) { + this.setData({ + displayColumns: this.data.columns.slice(0, +value) + }); + } + }, + mounted() { + setTimeout(() => { + this.setValues(); + }, 0); + }, + methods: { + getPicker() { + if (this.picker == null) { + this.picker = this.selectComponent('.van-area__picker'); + } + return this.picker; + }, + onCancel(event) { + this.emit('cancel', event.detail); + }, + onConfirm(event) { + const { index } = event.detail; + let { value } = event.detail; + value = this.parseOutputValues(value); + this.emit('confirm', { value, index }); + }, + emit(type, detail) { + detail.values = detail.value; + delete detail.value; + this.$emit(type, detail); + }, + // parse output columns data + parseOutputValues(values) { + const { columnsPlaceholder } = this.data; + return values.map((value, index) => { + // save undefined value + if (!value) + return value; + value = JSON.parse(JSON.stringify(value)); + if (!value.code || value.name === columnsPlaceholder[index]) { + value.code = ''; + value.name = ''; + } + return value; + }); + }, + onChange(event) { + const { index, picker, value } = event.detail; + this.code = value[index].code; + this.setValues().then(() => { + this.$emit('change', { + picker, + values: this.parseOutputValues(picker.getValues()), + index + }); + }); + }, + getConfig(type) { + const { areaList } = this.data; + return (areaList && areaList[`${type}_list`]) || {}; + }, + getList(type, code) { + const { typeToColumnsPlaceholder } = this.data; + let result = []; + if (type !== 'province' && !code) { + return result; + } + const list = this.getConfig(type); + result = Object.keys(list).map(code => ({ + code, + name: list[code] + })); + if (code) { + // oversea code + if (code[0] === '9' && type === 'city') { + code = '9'; + } + result = result.filter(item => item.code.indexOf(code) === 0); + } + if (typeToColumnsPlaceholder[type] && result.length) { + // set columns placeholder + const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6); + result.unshift({ + code: `${code}${codeFill}`, + name: typeToColumnsPlaceholder[type] + }); + } + return result; + }, + getIndex(type, code) { + let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; + const list = this.getList(type, code.slice(0, compareNum - 2)); + // oversea code + if (code[0] === '9' && type === 'province') { + compareNum = 1; + } + code = code.slice(0, compareNum); + for (let i = 0; i < list.length; i++) { + if (list[i].code.slice(0, compareNum) === code) { + return i; + } + } + return 0; + }, + setValues() { + const county = this.getConfig('county'); + let { code } = this; + if (!code) { + if (this.data.columnsPlaceholder.length) { + code = COLUMNSPLACEHOLDERCODE; + } + else if (Object.keys(county)[0]) { + code = Object.keys(county)[0]; + } + else { + code = ''; + } + } + const province = this.getList('province'); + const city = this.getList('city', code.slice(0, 2)); + const picker = this.getPicker(); + if (!picker) { + return; + } + const stack = []; + stack.push(picker.setColumnValues(0, province, false)); + stack.push(picker.setColumnValues(1, city, false)); + if (city.length && code.slice(2, 4) === '00') { + [{ code }] = city; + } + stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false)); + return Promise.all(stack) + .catch(() => { }) + .then(() => picker.setIndexes([ + this.getIndex('province', code), + this.getIndex('city', code), + this.getIndex('county', code) + ])) + .catch(() => { }); + }, + getValues() { + const picker = this.getPicker(); + return picker ? picker.getValues().filter(value => !!value) : []; + }, + getDetail() { + const values = this.getValues(); + const area = { + code: '', + country: '', + province: '', + city: '', + county: '' + }; + if (!values.length) { + return area; + } + const names = values.map((item) => item.name); + area.code = values[values.length - 1].code; + if (area.code[0] === '9') { + area.country = names[1] || ''; + area.province = names[2] || ''; + } + else { + area.province = names[0] || ''; + area.city = names[1] || ''; + area.county = names[2] || ''; + } + return area; + }, + reset(code) { + this.code = code || ''; + return this.setValues(); + } + } +}); diff --git a/utils/dist/area/index.json b/utils/dist/area/index.json index a778e91..9176008 100644 --- a/utils/dist/area/index.json +++ b/utils/dist/area/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-picker": "../picker/index" - } -} +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/utils/dist/area/index.wxml b/utils/dist/area/index.wxml index 6075794..6d5e11e 100644 --- a/utils/dist/area/index.wxml +++ b/utils/dist/area/index.wxml @@ -1,18 +1,18 @@ - + diff --git a/utils/dist/button/index.d.ts b/utils/dist/button/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/button/index.d.ts +++ b/utils/dist/button/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/button/index.js b/utils/dist/button/index.js index e32509e..5248eff 100644 --- a/utils/dist/button/index.js +++ b/utils/dist/button/index.js @@ -1,68 +1,68 @@ -import { VantComponent } from '../common/component'; -import { button } from '../mixins/button'; -import { openType } from '../mixins/open-type'; -VantComponent({ - mixins: [button, openType], - classes: ['hover-class', 'loading-class'], - data: { - style: '' - }, - props: { - icon: String, - plain: Boolean, - block: Boolean, - round: Boolean, - square: Boolean, - loading: Boolean, - hairline: Boolean, - disabled: Boolean, - loadingText: String, - customStyle: String, - loadingType: { - type: String, - value: 'circular' - }, - type: { - type: String, - value: 'default' - }, - size: { - type: String, - value: 'normal' - }, - loadingSize: { - type: String, - value: '20px' - }, - color: { - type: String, - observer(color) { - let style = ''; - if (color) { - style += `color: ${this.data.plain ? color : 'white'};`; - if (!this.data.plain) { - // Use background instead of backgroundColor to make linear-gradient work - style += `background: ${color};`; - } - // hide border when color is linear-gradient - if (color.indexOf('gradient') !== -1) { - style += 'border: 0;'; - } - else { - style += `border-color: ${color};`; - } - } - if (style !== this.data.style) { - this.setData({ style }); - } - } - } - }, - methods: { - onClick() { - if (!this.data.disabled && !this.data.loading) { - this.$emit('click'); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +VantComponent({ + mixins: [button, openType], + classes: ['hover-class', 'loading-class'], + data: { + style: '' + }, + props: { + icon: String, + plain: Boolean, + block: Boolean, + round: Boolean, + square: Boolean, + loading: Boolean, + hairline: Boolean, + disabled: Boolean, + loadingText: String, + customStyle: String, + loadingType: { + type: String, + value: 'circular' + }, + type: { + type: String, + value: 'default' + }, + size: { + type: String, + value: 'normal' + }, + loadingSize: { + type: String, + value: '20px' + }, + color: { + type: String, + observer(color) { + let style = ''; + if (color) { + style += `color: ${this.data.plain ? color : 'white'};`; + if (!this.data.plain) { + // Use background instead of backgroundColor to make linear-gradient work + style += `background: ${color};`; + } + // hide border when color is linear-gradient + if (color.indexOf('gradient') !== -1) { + style += 'border: 0;'; + } + else { + style += `border-color: ${color};`; + } + } + if (style !== this.data.style) { + this.setData({ style }); + } + } + } + }, + methods: { + onClick() { + if (!this.data.disabled && !this.data.loading) { + this.$emit('click'); + } + } + } +}); diff --git a/utils/dist/button/index.json b/utils/dist/button/index.json index e00a588..8e23ad6 100644 --- a/utils/dist/button/index.json +++ b/utils/dist/button/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-loading": "../loading/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/utils/dist/button/index.wxml b/utils/dist/button/index.wxml index 77b4942..7abf6a4 100644 --- a/utils/dist/button/index.wxml +++ b/utils/dist/button/index.wxml @@ -1,52 +1,52 @@ - - - + + + diff --git a/utils/dist/card/index.d.ts b/utils/dist/card/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/card/index.d.ts +++ b/utils/dist/card/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/card/index.js b/utils/dist/card/index.js index ae64151..290504b 100644 --- a/utils/dist/card/index.js +++ b/utils/dist/card/index.js @@ -1,38 +1,38 @@ -import { link } from '../mixins/link'; -import { VantComponent } from '../common/component'; -VantComponent({ - classes: [ - 'num-class', - 'desc-class', - 'thumb-class', - 'title-class', - 'price-class', - 'origin-price-class', - ], - mixins: [link], - props: { - tag: String, - num: String, - desc: String, - thumb: String, - title: String, - price: String, - centered: Boolean, - lazyLoad: Boolean, - thumbLink: String, - originPrice: String, - thumbMode: { - type: String, - value: 'aspectFit' - }, - currency: { - type: String, - value: '¥' - } - }, - methods: { - onClickThumb() { - this.jumpLink('thumbLink'); - } - } -}); +import { link } from '../mixins/link'; +import { VantComponent } from '../common/component'; +VantComponent({ + classes: [ + 'num-class', + 'desc-class', + 'thumb-class', + 'title-class', + 'price-class', + 'origin-price-class', + ], + mixins: [link], + props: { + tag: String, + num: String, + desc: String, + thumb: String, + title: String, + price: String, + centered: Boolean, + lazyLoad: Boolean, + thumbLink: String, + originPrice: String, + thumbMode: { + type: String, + value: 'aspectFit' + }, + currency: { + type: String, + value: '¥' + } + }, + methods: { + onClickThumb() { + this.jumpLink('thumbLink'); + } + } +}); diff --git a/utils/dist/card/index.json b/utils/dist/card/index.json index e917407..2b603f2 100644 --- a/utils/dist/card/index.json +++ b/utils/dist/card/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-tag": "../tag/index" - } -} +{ + "component": true, + "usingComponents": { + "van-tag": "../tag/index" + } +} diff --git a/utils/dist/card/index.wxml b/utils/dist/card/index.wxml index a17b1d6..adf8011 100644 --- a/utils/dist/card/index.wxml +++ b/utils/dist/card/index.wxml @@ -1,45 +1,45 @@ - - - - - - - - - {{ tag }} - - - - - {{ title }} - - - {{ desc }} - - - - - - {{ currency }} {{ price }} - {{ currency }} {{ originPrice }} - x {{ num }} - - - - - - - - - + + + + + + + + + {{ tag }} + + + + + {{ title }} + + + {{ desc }} + + + + + + {{ currency }} {{ price }} + {{ currency }} {{ originPrice }} + x {{ num }} + + + + + + + + + diff --git a/utils/dist/cell-group/index.d.ts b/utils/dist/cell-group/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/cell-group/index.d.ts +++ b/utils/dist/cell-group/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/cell-group/index.js b/utils/dist/cell-group/index.js index 3611e09..21e7cd3 100644 --- a/utils/dist/cell-group/index.js +++ b/utils/dist/cell-group/index.js @@ -1,10 +1,10 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - title: String, - border: { - type: Boolean, - value: true - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + title: String, + border: { + type: Boolean, + value: true + } + } +}); diff --git a/utils/dist/cell-group/index.json b/utils/dist/cell-group/index.json index 32640e0..1edff93 100644 --- a/utils/dist/cell-group/index.json +++ b/utils/dist/cell-group/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/cell-group/index.wxml b/utils/dist/cell-group/index.wxml index 6e0b471..88351a4 100644 --- a/utils/dist/cell-group/index.wxml +++ b/utils/dist/cell-group/index.wxml @@ -1,9 +1,9 @@ - - {{ title }} - - - - + + {{ title }} + + + + diff --git a/utils/dist/cell/index.d.ts b/utils/dist/cell/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/cell/index.d.ts +++ b/utils/dist/cell/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/cell/index.js b/utils/dist/cell/index.js index 11cd042..6f0688c 100644 --- a/utils/dist/cell/index.js +++ b/utils/dist/cell/index.js @@ -1,37 +1,37 @@ -import { link } from '../mixins/link'; -import { VantComponent } from '../common/component'; -VantComponent({ - classes: [ - 'title-class', - 'label-class', - 'value-class', - 'right-icon-class', - 'hover-class' - ], - mixins: [link], - props: { - title: null, - value: null, - icon: String, - size: String, - label: String, - center: Boolean, - isLink: Boolean, - required: Boolean, - clickable: Boolean, - titleWidth: String, - customStyle: String, - arrowDirection: String, - useLabelSlot: Boolean, - border: { - type: Boolean, - value: true - } - }, - methods: { - onClick(event) { - this.$emit('click', event.detail); - this.jumpLink(); - } - } -}); +import { link } from '../mixins/link'; +import { VantComponent } from '../common/component'; +VantComponent({ + classes: [ + 'title-class', + 'label-class', + 'value-class', + 'right-icon-class', + 'hover-class' + ], + mixins: [link], + props: { + title: null, + value: null, + icon: String, + size: String, + label: String, + center: Boolean, + isLink: Boolean, + required: Boolean, + clickable: Boolean, + titleWidth: String, + customStyle: String, + arrowDirection: String, + useLabelSlot: Boolean, + border: { + type: Boolean, + value: true + } + }, + methods: { + onClick(event) { + this.$emit('click', event.detail); + this.jumpLink(); + } + } +}); diff --git a/utils/dist/cell/index.json b/utils/dist/cell/index.json index a9ab393..d3b324f 100644 --- a/utils/dist/cell/index.json +++ b/utils/dist/cell/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } } \ No newline at end of file diff --git a/utils/dist/cell/index.wxml b/utils/dist/cell/index.wxml index afaaaf8..58eccb4 100644 --- a/utils/dist/cell/index.wxml +++ b/utils/dist/cell/index.wxml @@ -1,45 +1,45 @@ - - - - - - - - {{ title }} - - - - - {{ label }} - - - - - {{ value }} - - - - - - - - + + + + + + + + {{ title }} + + + + + {{ label }} + + + + + {{ value }} + + + + + + + + diff --git a/utils/dist/checkbox-group/index.d.ts b/utils/dist/checkbox-group/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/checkbox-group/index.d.ts +++ b/utils/dist/checkbox-group/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/checkbox-group/index.js b/utils/dist/checkbox-group/index.js index 92438e7..8190ce4 100644 --- a/utils/dist/checkbox-group/index.js +++ b/utils/dist/checkbox-group/index.js @@ -1,39 +1,39 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - field: true, - relation: { - name: 'checkbox', - type: 'descendant', - linked(target) { - this.children = this.children || []; - this.children.push(target); - this.updateChild(target); - }, - unlinked(target) { - this.children = this.children.filter((child) => child !== target); - } - }, - props: { - max: Number, - value: { - type: Array, - observer: 'updateChildren' - }, - disabled: { - type: Boolean, - observer: 'updateChildren' - } - }, - methods: { - updateChildren() { - (this.children || []).forEach((child) => this.updateChild(child)); - }, - updateChild(child) { - const { value, disabled } = this.data; - child.setData({ - value: value.indexOf(child.data.name) !== -1, - disabled: disabled || child.data.disabled - }); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + relation: { + name: 'checkbox', + type: 'descendant', + linked(target) { + this.children = this.children || []; + this.children.push(target); + this.updateChild(target); + }, + unlinked(target) { + this.children = this.children.filter((child) => child !== target); + } + }, + props: { + max: Number, + value: { + type: Array, + observer: 'updateChildren' + }, + disabled: { + type: Boolean, + observer: 'updateChildren' + } + }, + methods: { + updateChildren() { + (this.children || []).forEach((child) => this.updateChild(child)); + }, + updateChild(child) { + const { value, disabled } = this.data; + child.setData({ + value: value.indexOf(child.data.name) !== -1, + disabled: disabled || child.data.disabled + }); + } + } +}); diff --git a/utils/dist/checkbox-group/index.json b/utils/dist/checkbox-group/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/checkbox-group/index.json +++ b/utils/dist/checkbox-group/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/checkbox-group/index.wxml b/utils/dist/checkbox-group/index.wxml index 4fa864c..a8f3249 100644 --- a/utils/dist/checkbox-group/index.wxml +++ b/utils/dist/checkbox-group/index.wxml @@ -1 +1 @@ - + diff --git a/utils/dist/checkbox/index.d.ts b/utils/dist/checkbox/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/checkbox/index.d.ts +++ b/utils/dist/checkbox/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/checkbox/index.js b/utils/dist/checkbox/index.js index 4491e3b..a3acaa3 100644 --- a/utils/dist/checkbox/index.js +++ b/utils/dist/checkbox/index.js @@ -1,87 +1,87 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -function emit(target, value) { - target.$emit('input', value); - target.$emit('change', value); -} -VantComponent({ - field: true, - relation: { - name: 'checkbox-group', - type: 'ancestor', - linked(target) { - this.parent = target; - }, - unlinked() { - this.parent = null; - } - }, - classes: ['icon-class', 'label-class'], - props: { - value: Boolean, - disabled: Boolean, - useIconSlot: Boolean, - checkedColor: String, - labelPosition: String, - labelDisabled: Boolean, - shape: { - type: String, - value: 'round' - }, - iconSize: { - type: null, - observer: 'setSizeWithUnit' - } - }, - data: { - sizeWithUnit: '20px' - }, - methods: { - emitChange(value) { - if (this.parent) { - this.setParentValue(this.parent, value); - } - else { - emit(this, value); - } - }, - toggle() { - const { disabled, value } = this.data; - if (!disabled) { - this.emitChange(!value); - } - }, - onClickLabel() { - const { labelDisabled, disabled, value } = this.data; - if (!disabled && !labelDisabled) { - this.emitChange(!value); - } - }, - setParentValue(parent, value) { - const parentValue = parent.data.value.slice(); - const { name } = this.data; - const { max } = parent.data; - if (value) { - if (max && parentValue.length >= max) { - return; - } - if (parentValue.indexOf(name) === -1) { - parentValue.push(name); - emit(parent, parentValue); - } - } - else { - const index = parentValue.indexOf(name); - if (index !== -1) { - parentValue.splice(index, 1); - emit(parent, parentValue); - } - } - }, - setSizeWithUnit(size) { - this.set({ - sizeWithUnit: addUnit(size) - }); - }, - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +function emit(target, value) { + target.$emit('input', value); + target.$emit('change', value); +} +VantComponent({ + field: true, + relation: { + name: 'checkbox-group', + type: 'ancestor', + linked(target) { + this.parent = target; + }, + unlinked() { + this.parent = null; + } + }, + classes: ['icon-class', 'label-class'], + props: { + value: Boolean, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: String, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round' + }, + iconSize: { + type: null, + observer: 'setSizeWithUnit' + } + }, + data: { + sizeWithUnit: '20px' + }, + methods: { + emitChange(value) { + if (this.parent) { + this.setParentValue(this.parent, value); + } + else { + emit(this, value); + } + }, + toggle() { + const { disabled, value } = this.data; + if (!disabled) { + this.emitChange(!value); + } + }, + onClickLabel() { + const { labelDisabled, disabled, value } = this.data; + if (!disabled && !labelDisabled) { + this.emitChange(!value); + } + }, + setParentValue(parent, value) { + const parentValue = parent.data.value.slice(); + const { name } = this.data; + const { max } = parent.data; + if (value) { + if (max && parentValue.length >= max) { + return; + } + if (parentValue.indexOf(name) === -1) { + parentValue.push(name); + emit(parent, parentValue); + } + } + else { + const index = parentValue.indexOf(name); + if (index !== -1) { + parentValue.splice(index, 1); + emit(parent, parentValue); + } + } + }, + setSizeWithUnit(size) { + this.set({ + sizeWithUnit: addUnit(size) + }); + }, + } +}); diff --git a/utils/dist/checkbox/index.json b/utils/dist/checkbox/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/checkbox/index.json +++ b/utils/dist/checkbox/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/checkbox/index.wxml b/utils/dist/checkbox/index.wxml index 65124a1..0deadfe 100644 --- a/utils/dist/checkbox/index.wxml +++ b/utils/dist/checkbox/index.wxml @@ -1,19 +1,19 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/utils/dist/circle/index.d.ts b/utils/dist/circle/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/circle/index.d.ts +++ b/utils/dist/circle/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/circle/index.js b/utils/dist/circle/index.js index 08c7eb4..4f1f8a4 100644 --- a/utils/dist/circle/index.js +++ b/utils/dist/circle/index.js @@ -1,158 +1,158 @@ -import { VantComponent } from '../common/component'; -import { isObj } from '../common/utils'; -import { BLUE, WHITE } from '../common/color'; -function format(rate) { - return Math.min(Math.max(rate, 0), 100); -} -const PERIMETER = 2 * Math.PI; -const BEGIN_ANGLE = -Math.PI / 2; -const STEP = 1; -VantComponent({ - props: { - text: String, - lineCap: { - type: String, - value: 'round' - }, - value: { - type: Number, - value: 0, - observer: 'reRender' - }, - speed: { - type: Number, - value: 50 - }, - size: { - type: Number, - value: 100, - observer: 'setStyle' - }, - fill: String, - layerColor: { - type: String, - value: WHITE - }, - color: { - type: [String, Object], - value: BLUE, - observer: 'setHoverColor' - }, - strokeWidth: { - type: Number, - value: 4 - }, - clockwise: { - type: Boolean, - value: true - } - }, - data: { - style: 'width: 100px; height: 100px;', - hoverColor: BLUE - }, - methods: { - getContext() { - if (!this.ctx) { - this.ctx = wx.createCanvasContext('van-circle', this); - } - return this.ctx; - }, - setHoverColor() { - const context = this.getContext(); - const { color, size } = this.data; - let hoverColor = color; - if (isObj(color)) { - const LinearColor = context.createLinearGradient(size, 0, 0, 0); - Object.keys(color) - .sort((a, b) => parseFloat(a) - parseFloat(b)) - .map(key => LinearColor.addColorStop(parseFloat(key) / 100, color[key])); - hoverColor = LinearColor; - } - this.setData({ hoverColor }); - }, - setStyle() { - const { size } = this.data; - const style = `width: ${size}px; height: ${size}px;`; - this.setData({ style }); - }, - presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { - const { strokeWidth, lineCap, clockwise, size } = this.data; - const position = size / 2; - const radius = position - strokeWidth / 2; - context.setStrokeStyle(strokeStyle); - context.setLineWidth(strokeWidth); - context.setLineCap(lineCap); - context.beginPath(); - context.arc(position, position, radius, beginAngle, endAngle, !clockwise); - context.stroke(); - if (fill) { - context.setFillStyle(fill); - context.fill(); - } - }, - renderLayerCircle(context) { - const { layerColor, fill } = this.data; - this.presetCanvas(context, layerColor, 0, PERIMETER, fill); - }, - renderHoverCircle(context, formatValue) { - const { clockwise, hoverColor } = this.data; - // 结束角度 - const progress = PERIMETER * (formatValue / 100); - const endAngle = clockwise - ? BEGIN_ANGLE + progress - : 3 * Math.PI - (BEGIN_ANGLE + progress); - this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); - }, - drawCircle(currentValue) { - const context = this.getContext(); - const { size } = this.data; - context.clearRect(0, 0, size, size); - this.renderLayerCircle(context); - const formatValue = format(currentValue); - if (formatValue !== 0) { - this.renderHoverCircle(context, formatValue); - } - context.draw(); - }, - reRender() { - // tofector 动画暂时没有想到好的解决方案 - const { value, speed } = this.data; - if (speed <= 0 || speed > 1000) { - this.drawCircle(value); - return; - } - this.clearInterval(); - this.currentValue = this.currentValue || 0; - this.interval = setInterval(() => { - if (this.currentValue !== value) { - if (this.currentValue < value) { - this.currentValue += STEP; - } - else { - this.currentValue -= STEP; - } - this.drawCircle(this.currentValue); - } - else { - this.clearInterval(); - } - }, 1000 / speed); - }, - clearInterval() { - if (this.interval) { - clearInterval(this.interval); - this.interval = null; - } - } - }, - created() { - const { value } = this.data; - this.currentValue = value; - this.drawCircle(value); - }, - destroyed() { - this.ctx = null; - this.clearInterval(); - } -}); +import { VantComponent } from '../common/component'; +import { isObj } from '../common/utils'; +import { BLUE, WHITE } from '../common/color'; +function format(rate) { + return Math.min(Math.max(rate, 0), 100); +} +const PERIMETER = 2 * Math.PI; +const BEGIN_ANGLE = -Math.PI / 2; +const STEP = 1; +VantComponent({ + props: { + text: String, + lineCap: { + type: String, + value: 'round' + }, + value: { + type: Number, + value: 0, + observer: 'reRender' + }, + speed: { + type: Number, + value: 50 + }, + size: { + type: Number, + value: 100, + observer: 'setStyle' + }, + fill: String, + layerColor: { + type: String, + value: WHITE + }, + color: { + type: [String, Object], + value: BLUE, + observer: 'setHoverColor' + }, + strokeWidth: { + type: Number, + value: 4 + }, + clockwise: { + type: Boolean, + value: true + } + }, + data: { + style: 'width: 100px; height: 100px;', + hoverColor: BLUE + }, + methods: { + getContext() { + if (!this.ctx) { + this.ctx = wx.createCanvasContext('van-circle', this); + } + return this.ctx; + }, + setHoverColor() { + const context = this.getContext(); + const { color, size } = this.data; + let hoverColor = color; + if (isObj(color)) { + const LinearColor = context.createLinearGradient(size, 0, 0, 0); + Object.keys(color) + .sort((a, b) => parseFloat(a) - parseFloat(b)) + .map(key => LinearColor.addColorStop(parseFloat(key) / 100, color[key])); + hoverColor = LinearColor; + } + this.setData({ hoverColor }); + }, + setStyle() { + const { size } = this.data; + const style = `width: ${size}px; height: ${size}px;`; + this.setData({ style }); + }, + presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { + const { strokeWidth, lineCap, clockwise, size } = this.data; + const position = size / 2; + const radius = position - strokeWidth / 2; + context.setStrokeStyle(strokeStyle); + context.setLineWidth(strokeWidth); + context.setLineCap(lineCap); + context.beginPath(); + context.arc(position, position, radius, beginAngle, endAngle, !clockwise); + context.stroke(); + if (fill) { + context.setFillStyle(fill); + context.fill(); + } + }, + renderLayerCircle(context) { + const { layerColor, fill } = this.data; + this.presetCanvas(context, layerColor, 0, PERIMETER, fill); + }, + renderHoverCircle(context, formatValue) { + const { clockwise, hoverColor } = this.data; + // 结束角度 + const progress = PERIMETER * (formatValue / 100); + const endAngle = clockwise + ? BEGIN_ANGLE + progress + : 3 * Math.PI - (BEGIN_ANGLE + progress); + this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle); + }, + drawCircle(currentValue) { + const context = this.getContext(); + const { size } = this.data; + context.clearRect(0, 0, size, size); + this.renderLayerCircle(context); + const formatValue = format(currentValue); + if (formatValue !== 0) { + this.renderHoverCircle(context, formatValue); + } + context.draw(); + }, + reRender() { + // tofector 动画暂时没有想到好的解决方案 + const { value, speed } = this.data; + if (speed <= 0 || speed > 1000) { + this.drawCircle(value); + return; + } + this.clearInterval(); + this.currentValue = this.currentValue || 0; + this.interval = setInterval(() => { + if (this.currentValue !== value) { + if (this.currentValue < value) { + this.currentValue += STEP; + } + else { + this.currentValue -= STEP; + } + this.drawCircle(this.currentValue); + } + else { + this.clearInterval(); + } + }, 1000 / speed); + }, + clearInterval() { + if (this.interval) { + clearInterval(this.interval); + this.interval = null; + } + } + }, + created() { + const { value } = this.data; + this.currentValue = value; + this.drawCircle(value); + }, + destroyed() { + this.ctx = null; + this.clearInterval(); + } +}); diff --git a/utils/dist/circle/index.json b/utils/dist/circle/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/circle/index.json +++ b/utils/dist/circle/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/circle/index.wxml b/utils/dist/circle/index.wxml index 215122f..aff56c8 100644 --- a/utils/dist/circle/index.wxml +++ b/utils/dist/circle/index.wxml @@ -1,7 +1,7 @@ - - - - - - {{ text }} + + + + + + {{ text }} \ No newline at end of file diff --git a/utils/dist/col/index.d.ts b/utils/dist/col/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/col/index.d.ts +++ b/utils/dist/col/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/col/index.js b/utils/dist/col/index.js index 2d1d85e..79cf990 100644 --- a/utils/dist/col/index.js +++ b/utils/dist/col/index.js @@ -1,23 +1,23 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'row', - type: 'ancestor' - }, - props: { - span: Number, - offset: Number - }, - data: { - style: '' - }, - methods: { - setGutter(gutter) { - const padding = `${gutter / 2}px`; - const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : ''; - if (style !== this.data.style) { - this.setData({ style }); - } - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'row', + type: 'ancestor' + }, + props: { + span: Number, + offset: Number + }, + data: { + style: '' + }, + methods: { + setGutter(gutter) { + const padding = `${gutter / 2}px`; + const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : ''; + if (style !== this.data.style) { + this.setData({ style }); + } + } + } +}); diff --git a/utils/dist/col/index.json b/utils/dist/col/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/col/index.json +++ b/utils/dist/col/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/col/index.wxml b/utils/dist/col/index.wxml index a759aac..684e5e0 100644 --- a/utils/dist/col/index.wxml +++ b/utils/dist/col/index.wxml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/utils/dist/collapse-item/index.d.ts b/utils/dist/collapse-item/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/collapse-item/index.d.ts +++ b/utils/dist/collapse-item/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/collapse-item/index.js b/utils/dist/collapse-item/index.js index a869be0..1458215 100644 --- a/utils/dist/collapse-item/index.js +++ b/utils/dist/collapse-item/index.js @@ -1,96 +1,96 @@ -import { VantComponent } from '../common/component'; -const nextTick = () => new Promise(resolve => setTimeout(resolve, 20)); -VantComponent({ - classes: ['title-class', 'content-class'], - relation: { - name: 'collapse', - type: 'ancestor', - linked(parent) { - this.parent = parent; - } - }, - props: { - name: null, - title: null, - value: null, - icon: String, - label: String, - disabled: Boolean, - clickable: Boolean, - border: { - type: Boolean, - value: true - }, - isLink: { - type: Boolean, - value: true - } - }, - data: { - contentHeight: 0, - expanded: false, - transition: false - }, - mounted() { - this.updateExpanded() - .then(nextTick) - .then(() => { - const data = { transition: true }; - if (this.data.expanded) { - data.contentHeight = 'auto'; - } - this.setData(data); - }); - }, - methods: { - updateExpanded() { - if (!this.parent) { - return Promise.resolve(); - } - const { value, accordion } = this.parent.data; - const { children = [] } = this.parent; - const { name } = this.data; - const index = children.indexOf(this); - const currentName = name == null ? index : name; - const expanded = accordion - ? value === currentName - : (value || []).some((name) => name === currentName); - const stack = []; - if (expanded !== this.data.expanded) { - stack.push(this.updateStyle(expanded)); - } - stack.push(this.set({ index, expanded })); - return Promise.all(stack); - }, - updateStyle(expanded) { - return this.getRect('.van-collapse-item__content') - .then((rect) => rect.height) - .then((height) => { - if (expanded) { - return this.set({ - contentHeight: height ? `${height}px` : 'auto' - }); - } - return this.set({ contentHeight: `${height}px` }) - .then(nextTick) - .then(() => this.set({ contentHeight: 0 })); - }); - }, - onClick() { - if (this.data.disabled) { - return; - } - const { name, expanded } = this.data; - const index = this.parent.children.indexOf(this); - const currentName = name == null ? index : name; - this.parent.switch(currentName, !expanded); - }, - onTransitionEnd() { - if (this.data.expanded) { - this.setData({ - contentHeight: 'auto' - }); - } - } - } -}); +import { VantComponent } from '../common/component'; +const nextTick = () => new Promise(resolve => setTimeout(resolve, 20)); +VantComponent({ + classes: ['title-class', 'content-class'], + relation: { + name: 'collapse', + type: 'ancestor', + linked(parent) { + this.parent = parent; + } + }, + props: { + name: null, + title: null, + value: null, + icon: String, + label: String, + disabled: Boolean, + clickable: Boolean, + border: { + type: Boolean, + value: true + }, + isLink: { + type: Boolean, + value: true + } + }, + data: { + contentHeight: 0, + expanded: false, + transition: false + }, + mounted() { + this.updateExpanded() + .then(nextTick) + .then(() => { + const data = { transition: true }; + if (this.data.expanded) { + data.contentHeight = 'auto'; + } + this.setData(data); + }); + }, + methods: { + updateExpanded() { + if (!this.parent) { + return Promise.resolve(); + } + const { value, accordion } = this.parent.data; + const { children = [] } = this.parent; + const { name } = this.data; + const index = children.indexOf(this); + const currentName = name == null ? index : name; + const expanded = accordion + ? value === currentName + : (value || []).some((name) => name === currentName); + const stack = []; + if (expanded !== this.data.expanded) { + stack.push(this.updateStyle(expanded)); + } + stack.push(this.set({ index, expanded })); + return Promise.all(stack); + }, + updateStyle(expanded) { + return this.getRect('.van-collapse-item__content') + .then((rect) => rect.height) + .then((height) => { + if (expanded) { + return this.set({ + contentHeight: height ? `${height}px` : 'auto' + }); + } + return this.set({ contentHeight: `${height}px` }) + .then(nextTick) + .then(() => this.set({ contentHeight: 0 })); + }); + }, + onClick() { + if (this.data.disabled) { + return; + } + const { name, expanded } = this.data; + const index = this.parent.children.indexOf(this); + const currentName = name == null ? index : name; + this.parent.switch(currentName, !expanded); + }, + onTransitionEnd() { + if (this.data.expanded) { + this.setData({ + contentHeight: 'auto' + }); + } + } + } +}); diff --git a/utils/dist/collapse-item/index.json b/utils/dist/collapse-item/index.json index 0e5425c..7069216 100644 --- a/utils/dist/collapse-item/index.json +++ b/utils/dist/collapse-item/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-cell": "../cell/index" - } -} +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index" + } +} diff --git a/utils/dist/collapse-item/index.wxml b/utils/dist/collapse-item/index.wxml index 91afbc2..943d322 100644 --- a/utils/dist/collapse-item/index.wxml +++ b/utils/dist/collapse-item/index.wxml @@ -1,44 +1,44 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/utils/dist/collapse/index.d.ts b/utils/dist/collapse/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/collapse/index.d.ts +++ b/utils/dist/collapse/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/collapse/index.js b/utils/dist/collapse/index.js index c6efb6a..9567df0 100644 --- a/utils/dist/collapse/index.js +++ b/utils/dist/collapse/index.js @@ -1,50 +1,50 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'collapse-item', - type: 'descendant', - linked(child) { - this.children.push(child); - }, - unlinked(child) { - this.children = this.children.filter((item) => item !== child); - } - }, - props: { - value: { - type: null, - observer: 'updateExpanded' - }, - accordion: { - type: Boolean, - observer: 'updateExpanded' - }, - border: { - type: Boolean, - value: true - } - }, - beforeCreate() { - this.children = []; - }, - methods: { - updateExpanded() { - this.children.forEach((child) => { - child.updateExpanded(); - }); - }, - switch(name, expanded) { - const { accordion, value } = this.data; - if (!accordion) { - name = expanded - ? (value || []).concat(name) - : (value || []).filter((activeName) => activeName !== name); - } - else { - name = expanded ? name : ''; - } - this.$emit('change', name); - this.$emit('input', name); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'collapse-item', + type: 'descendant', + linked(child) { + this.children.push(child); + }, + unlinked(child) { + this.children = this.children.filter((item) => item !== child); + } + }, + props: { + value: { + type: null, + observer: 'updateExpanded' + }, + accordion: { + type: Boolean, + observer: 'updateExpanded' + }, + border: { + type: Boolean, + value: true + } + }, + beforeCreate() { + this.children = []; + }, + methods: { + updateExpanded() { + this.children.forEach((child) => { + child.updateExpanded(); + }); + }, + switch(name, expanded) { + const { accordion, value } = this.data; + if (!accordion) { + name = expanded + ? (value || []).concat(name) + : (value || []).filter((activeName) => activeName !== name); + } + else { + name = expanded ? name : ''; + } + this.$emit('change', name); + this.$emit('input', name); + } + } +}); diff --git a/utils/dist/collapse/index.json b/utils/dist/collapse/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/collapse/index.json +++ b/utils/dist/collapse/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/collapse/index.wxml b/utils/dist/collapse/index.wxml index fd4e171..f689405 100644 --- a/utils/dist/collapse/index.wxml +++ b/utils/dist/collapse/index.wxml @@ -1,3 +1,3 @@ - - - + + + diff --git a/utils/dist/common/color.d.ts b/utils/dist/common/color.d.ts index 386f307..6475dd2 100644 --- a/utils/dist/common/color.d.ts +++ b/utils/dist/common/color.d.ts @@ -1,7 +1,7 @@ -export declare const RED = "#ee0a24"; -export declare const BLUE = "#1989fa"; -export declare const WHITE = "#fff"; -export declare const GREEN = "#07c160"; -export declare const ORANGE = "#ff976a"; -export declare const GRAY = "#323233"; -export declare const GRAY_DARK = "#969799"; +export declare const RED = "#ee0a24"; +export declare const BLUE = "#1989fa"; +export declare const WHITE = "#fff"; +export declare const GREEN = "#07c160"; +export declare const ORANGE = "#ff976a"; +export declare const GRAY = "#323233"; +export declare const GRAY_DARK = "#969799"; diff --git a/utils/dist/common/color.js b/utils/dist/common/color.js index 6b285bd..9f9f265 100644 --- a/utils/dist/common/color.js +++ b/utils/dist/common/color.js @@ -1,7 +1,7 @@ -export const RED = '#ee0a24'; -export const BLUE = '#1989fa'; -export const WHITE = '#fff'; -export const GREEN = '#07c160'; -export const ORANGE = '#ff976a'; -export const GRAY = '#323233'; -export const GRAY_DARK = '#969799'; +export const RED = '#ee0a24'; +export const BLUE = '#1989fa'; +export const WHITE = '#fff'; +export const GREEN = '#07c160'; +export const ORANGE = '#ff976a'; +export const GRAY = '#323233'; +export const GRAY_DARK = '#969799'; diff --git a/utils/dist/common/component.d.ts b/utils/dist/common/component.d.ts index 307a96c..0195c84 100644 --- a/utils/dist/common/component.d.ts +++ b/utils/dist/common/component.d.ts @@ -1,3 +1,3 @@ -import { VantComponentOptions, CombinedComponentInstance } from '../definitions/index'; -declare function VantComponent(vantOptions?: VantComponentOptions>): void; -export { VantComponent }; +import { VantComponentOptions, CombinedComponentInstance } from '../definitions/index'; +declare function VantComponent(vantOptions?: VantComponentOptions>): void; +export { VantComponent }; diff --git a/utils/dist/common/component.js b/utils/dist/common/component.js index 63ef1a9..874e6d0 100644 --- a/utils/dist/common/component.js +++ b/utils/dist/common/component.js @@ -1,48 +1,48 @@ -import { basic } from '../mixins/basic'; -import { observe } from '../mixins/observer/index'; -function mapKeys(source, target, map) { - Object.keys(map).forEach(key => { - if (source[key]) { - target[map[key]] = source[key]; - } - }); -} -function VantComponent(vantOptions = {}) { - const options = {}; - mapKeys(vantOptions, options, { - data: 'data', - props: 'properties', - mixins: 'behaviors', - methods: 'methods', - beforeCreate: 'created', - created: 'attached', - mounted: 'ready', - relations: 'relations', - destroyed: 'detached', - classes: 'externalClasses' - }); - const { relation } = vantOptions; - if (relation) { - options.relations = Object.assign(options.relations || {}, { - [`../${relation.name}/index`]: relation - }); - } - // add default externalClasses - options.externalClasses = options.externalClasses || []; - options.externalClasses.push('custom-class'); - // add default behaviors - options.behaviors = options.behaviors || []; - options.behaviors.push(basic); - // map field to form-field behavior - if (vantOptions.field) { - options.behaviors.push('wx://form-field'); - } - // add default options - options.options = { - multipleSlots: true, - addGlobalClass: true - }; - observe(vantOptions, options); - Component(options); -} -export { VantComponent }; +import { basic } from '../mixins/basic'; +import { observe } from '../mixins/observer/index'; +function mapKeys(source, target, map) { + Object.keys(map).forEach(key => { + if (source[key]) { + target[map[key]] = source[key]; + } + }); +} +function VantComponent(vantOptions = {}) { + const options = {}; + mapKeys(vantOptions, options, { + data: 'data', + props: 'properties', + mixins: 'behaviors', + methods: 'methods', + beforeCreate: 'created', + created: 'attached', + mounted: 'ready', + relations: 'relations', + destroyed: 'detached', + classes: 'externalClasses' + }); + const { relation } = vantOptions; + if (relation) { + options.relations = Object.assign(options.relations || {}, { + [`../${relation.name}/index`]: relation + }); + } + // add default externalClasses + options.externalClasses = options.externalClasses || []; + options.externalClasses.push('custom-class'); + // add default behaviors + options.behaviors = options.behaviors || []; + options.behaviors.push(basic); + // map field to form-field behavior + if (vantOptions.field) { + options.behaviors.push('wx://form-field'); + } + // add default options + options.options = { + multipleSlots: true, + addGlobalClass: true + }; + observe(vantOptions, options); + Component(options); +} +export { VantComponent }; diff --git a/utils/dist/common/utils.d.ts b/utils/dist/common/utils.d.ts index 9fad27d..d222e08 100644 --- a/utils/dist/common/utils.d.ts +++ b/utils/dist/common/utils.d.ts @@ -1,8 +1,8 @@ -/// -export declare function isDef(value: any): boolean; -export declare function isObj(x: any): boolean; -export declare function isNumber(value: any): boolean; -export declare function range(num: number, min: number, max: number): number; -export declare function nextTick(fn: Function): void; -export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSuccessCallbackResult; -export declare function addUnit(value?: string | number): string | undefined; +/// +export declare function isDef(value: any): boolean; +export declare function isObj(x: any): boolean; +export declare function isNumber(value: any): boolean; +export declare function range(num: number, min: number, max: number): number; +export declare function nextTick(fn: Function): void; +export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSuccessCallbackResult; +export declare function addUnit(value?: string | number): string | undefined; diff --git a/utils/dist/common/utils.js b/utils/dist/common/utils.js index cc0f8f1..d1256aa 100644 --- a/utils/dist/common/utils.js +++ b/utils/dist/common/utils.js @@ -1,32 +1,32 @@ -export function isDef(value) { - return value !== undefined && value !== null; -} -export function isObj(x) { - const type = typeof x; - return x !== null && (type === 'object' || type === 'function'); -} -export function isNumber(value) { - return /^\d+(\.\d+)?$/.test(value); -} -export function range(num, min, max) { - return Math.min(Math.max(num, min), max); -} -export function nextTick(fn) { - setTimeout(() => { - fn(); - }, 1000 / 30); -} -let systemInfo = null; -export function getSystemInfoSync() { - if (systemInfo == null) { - systemInfo = wx.getSystemInfoSync(); - } - return systemInfo; -} -export function addUnit(value) { - if (!isDef(value)) { - return undefined; - } - value = String(value); - return isNumber(value) ? `${value}px` : value; -} +export function isDef(value) { + return value !== undefined && value !== null; +} +export function isObj(x) { + const type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} +export function isNumber(value) { + return /^\d+(\.\d+)?$/.test(value); +} +export function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +export function nextTick(fn) { + setTimeout(() => { + fn(); + }, 1000 / 30); +} +let systemInfo = null; +export function getSystemInfoSync() { + if (systemInfo == null) { + systemInfo = wx.getSystemInfoSync(); + } + return systemInfo; +} +export function addUnit(value) { + if (!isDef(value)) { + return undefined; + } + value = String(value); + return isNumber(value) ? `${value}px` : value; +} diff --git a/utils/dist/count-down/index.d.ts b/utils/dist/count-down/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/count-down/index.d.ts +++ b/utils/dist/count-down/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/count-down/index.js b/utils/dist/count-down/index.js index 54a01fe..520c7cc 100644 --- a/utils/dist/count-down/index.js +++ b/utils/dist/count-down/index.js @@ -1,100 +1,100 @@ -import { VantComponent } from '../common/component'; -import { isSameSecond, parseFormat, parseTimeData } from './utils'; -function simpleTick(fn) { - return setTimeout(fn, 30); -} -VantComponent({ - props: { - useSlot: Boolean, - millisecond: Boolean, - time: { - type: Number, - observer: 'reset' - }, - format: { - type: String, - value: 'HH:mm:ss' - }, - autoStart: { - type: Boolean, - value: true - } - }, - data: { - timeData: parseTimeData(0), - formattedTime: '0' - }, - destroyed() { - clearTimeout(this.tid); - this.tid = null; - }, - methods: { - // 开始 - start() { - if (this.counting) { - return; - } - this.counting = true; - this.endTime = Date.now() + this.remain; - this.tick(); - }, - // 暂停 - pause() { - this.counting = false; - clearTimeout(this.tid); - }, - // 重置 - reset() { - this.pause(); - this.remain = this.data.time; - this.setRemain(this.remain); - if (this.data.autoStart) { - this.start(); - } - }, - tick() { - if (this.data.millisecond) { - this.microTick(); - } - else { - this.macroTick(); - } - }, - microTick() { - this.tid = simpleTick(() => { - this.setRemain(this.getRemain()); - if (this.remain !== 0) { - this.microTick(); - } - }); - }, - macroTick() { - this.tid = simpleTick(() => { - const remain = this.getRemain(); - if (!isSameSecond(remain, this.remain) || remain === 0) { - this.setRemain(remain); - } - if (this.remain !== 0) { - this.macroTick(); - } - }); - }, - getRemain() { - return Math.max(this.endTime - Date.now(), 0); - }, - setRemain(remain) { - this.remain = remain; - const timeData = parseTimeData(remain); - if (this.data.useSlot) { - this.$emit('change', timeData); - } - this.setData({ - formattedTime: parseFormat(this.data.format, timeData) - }); - if (remain === 0) { - this.pause(); - this.$emit('finish'); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { isSameSecond, parseFormat, parseTimeData } from './utils'; +function simpleTick(fn) { + return setTimeout(fn, 30); +} +VantComponent({ + props: { + useSlot: Boolean, + millisecond: Boolean, + time: { + type: Number, + observer: 'reset' + }, + format: { + type: String, + value: 'HH:mm:ss' + }, + autoStart: { + type: Boolean, + value: true + } + }, + data: { + timeData: parseTimeData(0), + formattedTime: '0' + }, + destroyed() { + clearTimeout(this.tid); + this.tid = null; + }, + methods: { + // 开始 + start() { + if (this.counting) { + return; + } + this.counting = true; + this.endTime = Date.now() + this.remain; + this.tick(); + }, + // 暂停 + pause() { + this.counting = false; + clearTimeout(this.tid); + }, + // 重置 + reset() { + this.pause(); + this.remain = this.data.time; + this.setRemain(this.remain); + if (this.data.autoStart) { + this.start(); + } + }, + tick() { + if (this.data.millisecond) { + this.microTick(); + } + else { + this.macroTick(); + } + }, + microTick() { + this.tid = simpleTick(() => { + this.setRemain(this.getRemain()); + if (this.remain !== 0) { + this.microTick(); + } + }); + }, + macroTick() { + this.tid = simpleTick(() => { + const remain = this.getRemain(); + if (!isSameSecond(remain, this.remain) || remain === 0) { + this.setRemain(remain); + } + if (this.remain !== 0) { + this.macroTick(); + } + }); + }, + getRemain() { + return Math.max(this.endTime - Date.now(), 0); + }, + setRemain(remain) { + this.remain = remain; + const timeData = parseTimeData(remain); + if (this.data.useSlot) { + this.$emit('change', timeData); + } + this.setData({ + formattedTime: parseFormat(this.data.format, timeData) + }); + if (remain === 0) { + this.pause(); + this.$emit('finish'); + } + } + } +}); diff --git a/utils/dist/count-down/index.json b/utils/dist/count-down/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/count-down/index.json +++ b/utils/dist/count-down/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/count-down/index.wxml b/utils/dist/count-down/index.wxml index e206e16..49c4db2 100644 --- a/utils/dist/count-down/index.wxml +++ b/utils/dist/count-down/index.wxml @@ -1,4 +1,4 @@ - - - {{ formattedTime }} - + + + {{ formattedTime }} + diff --git a/utils/dist/count-down/utils.d.ts b/utils/dist/count-down/utils.d.ts index e4a58dd..a45a5cf 100644 --- a/utils/dist/count-down/utils.d.ts +++ b/utils/dist/count-down/utils.d.ts @@ -1,10 +1,10 @@ -export declare type TimeData = { - days: number; - hours: number; - minutes: number; - seconds: number; - milliseconds: number; -}; -export declare function parseTimeData(time: number): TimeData; -export declare function parseFormat(format: string, timeData: TimeData): string; -export declare function isSameSecond(time1: number, time2: number): boolean; +export declare type TimeData = { + days: number; + hours: number; + minutes: number; + seconds: number; + milliseconds: number; +}; +export declare function parseTimeData(time: number): TimeData; +export declare function parseFormat(format: string, timeData: TimeData): string; +export declare function isSameSecond(time1: number, time2: number): boolean; diff --git a/utils/dist/count-down/utils.js b/utils/dist/count-down/utils.js index 3237988..c89f261 100644 --- a/utils/dist/count-down/utils.js +++ b/utils/dist/count-down/utils.js @@ -1,57 +1,57 @@ -function padZero(num, targetLength = 2) { - let str = num + ''; - while (str.length < targetLength) { - str = '0' + str; - } - return str; -} -const SECOND = 1000; -const MINUTE = 60 * SECOND; -const HOUR = 60 * MINUTE; -const DAY = 24 * HOUR; -export function parseTimeData(time) { - const days = Math.floor(time / DAY); - const hours = Math.floor((time % DAY) / HOUR); - const minutes = Math.floor((time % HOUR) / MINUTE); - const seconds = Math.floor((time % MINUTE) / SECOND); - const milliseconds = Math.floor(time % SECOND); - return { - days, - hours, - minutes, - seconds, - milliseconds - }; -} -export function parseFormat(format, timeData) { - const { days } = timeData; - let { hours, minutes, seconds, milliseconds } = timeData; - if (format.indexOf('DD') === -1) { - hours += days * 24; - } - else { - format = format.replace('DD', padZero(days)); - } - if (format.indexOf('HH') === -1) { - minutes += hours * 60; - } - else { - format = format.replace('HH', padZero(hours)); - } - if (format.indexOf('mm') === -1) { - seconds += minutes * 60; - } - else { - format = format.replace('mm', padZero(minutes)); - } - if (format.indexOf('ss') === -1) { - milliseconds += seconds * 1000; - } - else { - format = format.replace('ss', padZero(seconds)); - } - return format.replace('SSS', padZero(milliseconds, 3)); -} -export function isSameSecond(time1, time2) { - return Math.floor(time1 / 1000) === Math.floor(time2 / 1000); -} +function padZero(num, targetLength = 2) { + let str = num + ''; + while (str.length < targetLength) { + str = '0' + str; + } + return str; +} +const SECOND = 1000; +const MINUTE = 60 * SECOND; +const HOUR = 60 * MINUTE; +const DAY = 24 * HOUR; +export function parseTimeData(time) { + const days = Math.floor(time / DAY); + const hours = Math.floor((time % DAY) / HOUR); + const minutes = Math.floor((time % HOUR) / MINUTE); + const seconds = Math.floor((time % MINUTE) / SECOND); + const milliseconds = Math.floor(time % SECOND); + return { + days, + hours, + minutes, + seconds, + milliseconds + }; +} +export function parseFormat(format, timeData) { + const { days } = timeData; + let { hours, minutes, seconds, milliseconds } = timeData; + if (format.indexOf('DD') === -1) { + hours += days * 24; + } + else { + format = format.replace('DD', padZero(days)); + } + if (format.indexOf('HH') === -1) { + minutes += hours * 60; + } + else { + format = format.replace('HH', padZero(hours)); + } + if (format.indexOf('mm') === -1) { + seconds += minutes * 60; + } + else { + format = format.replace('mm', padZero(minutes)); + } + if (format.indexOf('ss') === -1) { + milliseconds += seconds * 1000; + } + else { + format = format.replace('ss', padZero(seconds)); + } + return format.replace('SSS', padZero(milliseconds, 3)); +} +export function isSameSecond(time1, time2) { + return Math.floor(time1 / 1000) === Math.floor(time2 / 1000); +} diff --git a/utils/dist/datetime-picker/index.d.ts b/utils/dist/datetime-picker/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/datetime-picker/index.d.ts +++ b/utils/dist/datetime-picker/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/datetime-picker/index.js b/utils/dist/datetime-picker/index.js index d350d11..836b49f 100644 --- a/utils/dist/datetime-picker/index.js +++ b/utils/dist/datetime-picker/index.js @@ -1,297 +1,297 @@ -import { VantComponent } from '../common/component'; -import { isDef } from '../common/utils'; -import { pickerProps } from '../picker/shared'; -const currentYear = new Date().getFullYear(); -function isValidDate(date) { - return isDef(date) && !isNaN(new Date(date).getTime()); -} -function range(num, min, max) { - return Math.min(Math.max(num, min), max); -} -function padZero(val) { - return `00${val}`.slice(-2); -} -function times(n, iteratee) { - let index = -1; - const result = Array(n < 0 ? 0 : n); - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} -function getTrueValue(formattedValue) { - if (!formattedValue) - return; - while (isNaN(parseInt(formattedValue, 10))) { - formattedValue = formattedValue.slice(1); - } - return parseInt(formattedValue, 10); -} -function getMonthEndDay(year, month) { - return 32 - new Date(year, month - 1, 32).getDate(); -} -const defaultFormatter = (_, value) => value; -VantComponent({ - classes: ['active-class', 'toolbar-class', 'column-class'], - props: Object.assign(Object.assign({}, pickerProps), { value: null, filter: null, type: { - type: String, - value: 'datetime' - }, showToolbar: { - type: Boolean, - value: true - }, formatter: { - type: null, - value: defaultFormatter - }, minDate: { - type: Number, - value: new Date(currentYear - 10, 0, 1).getTime() - }, maxDate: { - type: Number, - value: new Date(currentYear + 10, 11, 31).getTime() - }, minHour: { - type: Number, - value: 0 - }, maxHour: { - type: Number, - value: 23 - }, minMinute: { - type: Number, - value: 0 - }, maxMinute: { - type: Number, - value: 59 - } }), - data: { - innerValue: Date.now(), - columns: [] - }, - watch: { - value: 'updateValue', - type: 'updateValue', - minDate: 'updateValue', - maxDate: 'updateValue', - minHour: 'updateValue', - maxHour: 'updateValue', - minMinute: 'updateValue', - maxMinute: 'updateValue' - }, - methods: { - updateValue() { - const { data } = this; - const val = this.correctValue(this.data.value); - const isEqual = val === data.innerValue; - if (!isEqual) { - this.updateColumnValue(val).then(() => { - this.$emit('input', val); - }); - } - else { - this.updateColumns(); - } - }, - getPicker() { - if (this.picker == null) { - this.picker = this.selectComponent('.van-datetime-picker'); - const { picker } = this; - const { setColumnValues } = picker; - picker.setColumnValues = (...args) => setColumnValues.apply(picker, [...args, false]); - } - return this.picker; - }, - updateColumns() { - const { formatter = defaultFormatter } = this.data; - const results = this.getOriginColumns().map(column => ({ - values: column.values.map(value => formatter(column.type, value)) - })); - return this.set({ columns: results }); - }, - getOriginColumns() { - const { filter } = this.data; - const results = this.getRanges().map(({ type, range }) => { - let values = times(range[1] - range[0] + 1, index => { - let value = range[0] + index; - value = type === 'year' ? `${value}` : padZero(value); - return value; - }); - if (filter) { - values = filter(type, values); - } - return { type, values }; - }); - return results; - }, - getRanges() { - const { data } = this; - if (data.type === 'time') { - return [ - { - type: 'hour', - range: [data.minHour, data.maxHour] - }, - { - type: 'minute', - range: [data.minMinute, data.maxMinute] - } - ]; - } - const { maxYear, maxDate, maxMonth, maxHour, maxMinute } = this.getBoundary('max', data.innerValue); - const { minYear, minDate, minMonth, minHour, minMinute } = this.getBoundary('min', data.innerValue); - const result = [ - { - type: 'year', - range: [minYear, maxYear] - }, - { - type: 'month', - range: [minMonth, maxMonth] - }, - { - type: 'day', - range: [minDate, maxDate] - }, - { - type: 'hour', - range: [minHour, maxHour] - }, - { - type: 'minute', - range: [minMinute, maxMinute] - } - ]; - if (data.type === 'date') - result.splice(3, 2); - if (data.type === 'year-month') - result.splice(2, 3); - return result; - }, - correctValue(value) { - const { data } = this; - // validate value - const isDateType = data.type !== 'time'; - if (isDateType && !isValidDate(value)) { - value = data.minDate; - } - else if (!isDateType && !value) { - const { minHour } = data; - value = `${padZero(minHour)}:00`; - } - // time type - if (!isDateType) { - let [hour, minute] = value.split(':'); - hour = padZero(range(hour, data.minHour, data.maxHour)); - minute = padZero(range(minute, data.minMinute, data.maxMinute)); - return `${hour}:${minute}`; - } - // date type - value = Math.max(value, data.minDate); - value = Math.min(value, data.maxDate); - return value; - }, - getBoundary(type, innerValue) { - const value = new Date(innerValue); - const boundary = new Date(this.data[`${type}Date`]); - const year = boundary.getFullYear(); - let month = 1; - let date = 1; - let hour = 0; - let minute = 0; - if (type === 'max') { - month = 12; - date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1); - hour = 23; - minute = 59; - } - if (value.getFullYear() === year) { - month = boundary.getMonth() + 1; - if (value.getMonth() + 1 === month) { - date = boundary.getDate(); - if (value.getDate() === date) { - hour = boundary.getHours(); - if (value.getHours() === hour) { - minute = boundary.getMinutes(); - } - } - } - } - return { - [`${type}Year`]: year, - [`${type}Month`]: month, - [`${type}Date`]: date, - [`${type}Hour`]: hour, - [`${type}Minute`]: minute - }; - }, - onCancel() { - this.$emit('cancel'); - }, - onConfirm() { - this.$emit('confirm', this.data.innerValue); - }, - onChange() { - const { data } = this; - let value; - const picker = this.getPicker(); - if (data.type === 'time') { - const indexes = picker.getIndexes(); - value = `${+data.columns[0].values[indexes[0]]}:${+data.columns[1].values[indexes[1]]}`; - } - else { - const values = picker.getValues(); - const year = getTrueValue(values[0]); - const month = getTrueValue(values[1]); - const maxDate = getMonthEndDay(year, month); - let date = getTrueValue(values[2]); - if (data.type === 'year-month') { - date = 1; - } - date = date > maxDate ? maxDate : date; - let hour = 0; - let minute = 0; - if (data.type === 'datetime') { - hour = getTrueValue(values[3]); - minute = getTrueValue(values[4]); - } - value = new Date(year, month - 1, date, hour, minute); - } - value = this.correctValue(value); - this.updateColumnValue(value).then(() => { - this.$emit('input', value); - this.$emit('change', picker); - }); - }, - updateColumnValue(value) { - let values = []; - const { type, formatter = defaultFormatter } = this.data; - const picker = this.getPicker(); - if (type === 'time') { - const pair = value.split(':'); - values = [ - formatter('hour', pair[0]), - formatter('minute', pair[1]) - ]; - } - else { - const date = new Date(value); - values = [ - formatter('year', `${date.getFullYear()}`), - formatter('month', padZero(date.getMonth() + 1)) - ]; - if (type === 'date') { - values.push(formatter('day', padZero(date.getDate()))); - } - if (type === 'datetime') { - values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes()))); - } - } - return this.set({ innerValue: value }) - .then(() => this.updateColumns()) - .then(() => picker.setValues(values)); - } - }, - created() { - const innerValue = this.correctValue(this.data.value); - this.updateColumnValue(innerValue).then(() => { - this.$emit('input', innerValue); - }); - } -}); +import { VantComponent } from '../common/component'; +import { isDef } from '../common/utils'; +import { pickerProps } from '../picker/shared'; +const currentYear = new Date().getFullYear(); +function isValidDate(date) { + return isDef(date) && !isNaN(new Date(date).getTime()); +} +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +function padZero(val) { + return `00${val}`.slice(-2); +} +function times(n, iteratee) { + let index = -1; + const result = Array(n < 0 ? 0 : n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +function getTrueValue(formattedValue) { + if (!formattedValue) + return; + while (isNaN(parseInt(formattedValue, 10))) { + formattedValue = formattedValue.slice(1); + } + return parseInt(formattedValue, 10); +} +function getMonthEndDay(year, month) { + return 32 - new Date(year, month - 1, 32).getDate(); +} +const defaultFormatter = (_, value) => value; +VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: Object.assign(Object.assign({}, pickerProps), { value: null, filter: null, type: { + type: String, + value: 'datetime' + }, showToolbar: { + type: Boolean, + value: true + }, formatter: { + type: null, + value: defaultFormatter + }, minDate: { + type: Number, + value: new Date(currentYear - 10, 0, 1).getTime() + }, maxDate: { + type: Number, + value: new Date(currentYear + 10, 11, 31).getTime() + }, minHour: { + type: Number, + value: 0 + }, maxHour: { + type: Number, + value: 23 + }, minMinute: { + type: Number, + value: 0 + }, maxMinute: { + type: Number, + value: 59 + } }), + data: { + innerValue: Date.now(), + columns: [] + }, + watch: { + value: 'updateValue', + type: 'updateValue', + minDate: 'updateValue', + maxDate: 'updateValue', + minHour: 'updateValue', + maxHour: 'updateValue', + minMinute: 'updateValue', + maxMinute: 'updateValue' + }, + methods: { + updateValue() { + const { data } = this; + const val = this.correctValue(this.data.value); + const isEqual = val === data.innerValue; + if (!isEqual) { + this.updateColumnValue(val).then(() => { + this.$emit('input', val); + }); + } + else { + this.updateColumns(); + } + }, + getPicker() { + if (this.picker == null) { + this.picker = this.selectComponent('.van-datetime-picker'); + const { picker } = this; + const { setColumnValues } = picker; + picker.setColumnValues = (...args) => setColumnValues.apply(picker, [...args, false]); + } + return this.picker; + }, + updateColumns() { + const { formatter = defaultFormatter } = this.data; + const results = this.getOriginColumns().map(column => ({ + values: column.values.map(value => formatter(column.type, value)) + })); + return this.set({ columns: results }); + }, + getOriginColumns() { + const { filter } = this.data; + const results = this.getRanges().map(({ type, range }) => { + let values = times(range[1] - range[0] + 1, index => { + let value = range[0] + index; + value = type === 'year' ? `${value}` : padZero(value); + return value; + }); + if (filter) { + values = filter(type, values); + } + return { type, values }; + }); + return results; + }, + getRanges() { + const { data } = this; + if (data.type === 'time') { + return [ + { + type: 'hour', + range: [data.minHour, data.maxHour] + }, + { + type: 'minute', + range: [data.minMinute, data.maxMinute] + } + ]; + } + const { maxYear, maxDate, maxMonth, maxHour, maxMinute } = this.getBoundary('max', data.innerValue); + const { minYear, minDate, minMonth, minHour, minMinute } = this.getBoundary('min', data.innerValue); + const result = [ + { + type: 'year', + range: [minYear, maxYear] + }, + { + type: 'month', + range: [minMonth, maxMonth] + }, + { + type: 'day', + range: [minDate, maxDate] + }, + { + type: 'hour', + range: [minHour, maxHour] + }, + { + type: 'minute', + range: [minMinute, maxMinute] + } + ]; + if (data.type === 'date') + result.splice(3, 2); + if (data.type === 'year-month') + result.splice(2, 3); + return result; + }, + correctValue(value) { + const { data } = this; + // validate value + const isDateType = data.type !== 'time'; + if (isDateType && !isValidDate(value)) { + value = data.minDate; + } + else if (!isDateType && !value) { + const { minHour } = data; + value = `${padZero(minHour)}:00`; + } + // time type + if (!isDateType) { + let [hour, minute] = value.split(':'); + hour = padZero(range(hour, data.minHour, data.maxHour)); + minute = padZero(range(minute, data.minMinute, data.maxMinute)); + return `${hour}:${minute}`; + } + // date type + value = Math.max(value, data.minDate); + value = Math.min(value, data.maxDate); + return value; + }, + getBoundary(type, innerValue) { + const value = new Date(innerValue); + const boundary = new Date(this.data[`${type}Date`]); + const year = boundary.getFullYear(); + let month = 1; + let date = 1; + let hour = 0; + let minute = 0; + if (type === 'max') { + month = 12; + date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1); + hour = 23; + minute = 59; + } + if (value.getFullYear() === year) { + month = boundary.getMonth() + 1; + if (value.getMonth() + 1 === month) { + date = boundary.getDate(); + if (value.getDate() === date) { + hour = boundary.getHours(); + if (value.getHours() === hour) { + minute = boundary.getMinutes(); + } + } + } + } + return { + [`${type}Year`]: year, + [`${type}Month`]: month, + [`${type}Date`]: date, + [`${type}Hour`]: hour, + [`${type}Minute`]: minute + }; + }, + onCancel() { + this.$emit('cancel'); + }, + onConfirm() { + this.$emit('confirm', this.data.innerValue); + }, + onChange() { + const { data } = this; + let value; + const picker = this.getPicker(); + if (data.type === 'time') { + const indexes = picker.getIndexes(); + value = `${+data.columns[0].values[indexes[0]]}:${+data.columns[1].values[indexes[1]]}`; + } + else { + const values = picker.getValues(); + const year = getTrueValue(values[0]); + const month = getTrueValue(values[1]); + const maxDate = getMonthEndDay(year, month); + let date = getTrueValue(values[2]); + if (data.type === 'year-month') { + date = 1; + } + date = date > maxDate ? maxDate : date; + let hour = 0; + let minute = 0; + if (data.type === 'datetime') { + hour = getTrueValue(values[3]); + minute = getTrueValue(values[4]); + } + value = new Date(year, month - 1, date, hour, minute); + } + value = this.correctValue(value); + this.updateColumnValue(value).then(() => { + this.$emit('input', value); + this.$emit('change', picker); + }); + }, + updateColumnValue(value) { + let values = []; + const { type, formatter = defaultFormatter } = this.data; + const picker = this.getPicker(); + if (type === 'time') { + const pair = value.split(':'); + values = [ + formatter('hour', pair[0]), + formatter('minute', pair[1]) + ]; + } + else { + const date = new Date(value); + values = [ + formatter('year', `${date.getFullYear()}`), + formatter('month', padZero(date.getMonth() + 1)) + ]; + if (type === 'date') { + values.push(formatter('day', padZero(date.getDate()))); + } + if (type === 'datetime') { + values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes()))); + } + } + return this.set({ innerValue: value }) + .then(() => this.updateColumns()) + .then(() => picker.setValues(values)); + } + }, + created() { + const innerValue = this.correctValue(this.data.value); + this.updateColumnValue(innerValue).then(() => { + this.$emit('input', innerValue); + }); + } +}); diff --git a/utils/dist/datetime-picker/index.json b/utils/dist/datetime-picker/index.json index a778e91..9176008 100644 --- a/utils/dist/datetime-picker/index.json +++ b/utils/dist/datetime-picker/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-picker": "../picker/index" - } -} +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/utils/dist/datetime-picker/index.wxml b/utils/dist/datetime-picker/index.wxml index ade2202..33659f2 100644 --- a/utils/dist/datetime-picker/index.wxml +++ b/utils/dist/datetime-picker/index.wxml @@ -1,16 +1,16 @@ - + diff --git a/utils/dist/definitions/index.d.ts b/utils/dist/definitions/index.d.ts index 3a8fc16..5623f88 100644 --- a/utils/dist/definitions/index.d.ts +++ b/utils/dist/definitions/index.d.ts @@ -1,28 +1,28 @@ -/// -import { Weapp } from './weapp'; -declare type RecordToAny = { - [K in keyof T]: any; -}; -export declare type CombinedComponentInstance = Methods & WechatMiniprogram.Component.TrivialInstance & Weapp.FormField & { - data: Data & RecordToAny; -}; -export interface VantComponentOptions { - data?: Data; - field?: boolean; - classes?: string[]; - mixins?: string[]; - props?: Props & Weapp.PropertyOption; - watch?: Weapp.WatchOption; - relation?: Weapp.RelationOption & { - name: string; - }; - relations?: { - [componentName: string]: Weapp.RelationOption; - }; - methods?: Methods & Weapp.MethodOption; - beforeCreate?: (this: Instance) => void; - created?: (this: Instance) => void; - mounted?: (this: Instance) => void; - destroyed?: (this: Instance) => void; -} -export {}; +/// +import { Weapp } from './weapp'; +declare type RecordToAny = { + [K in keyof T]: any; +}; +export declare type CombinedComponentInstance = Methods & WechatMiniprogram.Component.TrivialInstance & Weapp.FormField & { + data: Data & RecordToAny; +}; +export interface VantComponentOptions { + data?: Data; + field?: boolean; + classes?: string[]; + mixins?: string[]; + props?: Props & Weapp.PropertyOption; + watch?: Weapp.WatchOption; + relation?: Weapp.RelationOption & { + name: string; + }; + relations?: { + [componentName: string]: Weapp.RelationOption; + }; + methods?: Methods & Weapp.MethodOption; + beforeCreate?: (this: Instance) => void; + created?: (this: Instance) => void; + mounted?: (this: Instance) => void; + destroyed?: (this: Instance) => void; +} +export {}; diff --git a/utils/dist/definitions/weapp.d.ts b/utils/dist/definitions/weapp.d.ts index 5fb0060..a395fca 100644 --- a/utils/dist/definitions/weapp.d.ts +++ b/utils/dist/definitions/weapp.d.ts @@ -1,112 +1,112 @@ -/// -export declare namespace Weapp { - export interface FormField { - data: { - name: string; - value: any; - }; - } - interface Target { - id: string; - tagName: string; - dataset: { - [key: string]: any; - }; - } - export interface Event { - /** - * 代表事件的类型。 - */ - type: string; - /** - * 页面打开到触发事件所经过的毫秒数。 - */ - timeStamp: number; - /** - * 触发事件的源组件。 - */ - target: Target; - /** - * 事件绑定的当前组件。 - */ - currentTarget: Target; - /** - * 额外的信息 - */ - detail: any; - } - interface Touch { - /** - * 触摸点的标识符 - */ - identifier: number; - /** - * 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴 - */ - pageX: number; - /** - * 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴 - */ - pageY: number; - /** - * 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴 - */ - clientX: number; - /** - * 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴 - */ - clientY: number; - } - export interface TouchEvent extends Event { - touches: Array; - changedTouches: Array; - } - /** - * relation定义,miniprogram-api-typings缺少this定义 - */ - export interface RelationOption { - /** 目标组件的相对关系 */ - type: 'parent' | 'child' | 'ancestor' | 'descendant'; - /** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */ - linked?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void; - /** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */ - linkChanged?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void; - /** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */ - unlinked?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void; - /** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */ - target?: string; - } - /** - * obverser定义,miniprogram-api-typings缺少this定义 - */ - type Observer = (this: Instance, newVal: T, oldVal: T, changedPath: Array) => void; - /** - * watch定义 - */ - export interface WatchOption { - [name: string]: string | Observer; - } - /** - * methods定义,miniprogram-api-typings缺少this定义 - */ - export interface MethodOption { - [name: string]: (this: Instance, ...args: any[]) => any; - } - export interface ComputedOption { - [name: string]: (this: Instance) => any; - } - type PropertyType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | FunctionConstructor | null; - export interface PropertyOption { - [name: string]: PropertyType | PropertyType[] | { - /** 属性类型 */ - type: PropertyType | PropertyType[]; - /** 属性初始值 */ - value?: any; - /** 属性值被更改时的响应函数 */ - observer?: string | Observer; - /** 属性的类型(可以指定多个) */ - optionalTypes?: PropertyType[]; - }; - } - export {}; -} +/// +export declare namespace Weapp { + export interface FormField { + data: { + name: string; + value: any; + }; + } + interface Target { + id: string; + tagName: string; + dataset: { + [key: string]: any; + }; + } + export interface Event { + /** + * 代表事件的类型。 + */ + type: string; + /** + * 页面打开到触发事件所经过的毫秒数。 + */ + timeStamp: number; + /** + * 触发事件的源组件。 + */ + target: Target; + /** + * 事件绑定的当前组件。 + */ + currentTarget: Target; + /** + * 额外的信息 + */ + detail: any; + } + interface Touch { + /** + * 触摸点的标识符 + */ + identifier: number; + /** + * 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴 + */ + pageX: number; + /** + * 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴 + */ + pageY: number; + /** + * 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴 + */ + clientX: number; + /** + * 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴 + */ + clientY: number; + } + export interface TouchEvent extends Event { + touches: Array; + changedTouches: Array; + } + /** + * relation定义,miniprogram-api-typings缺少this定义 + */ + export interface RelationOption { + /** 目标组件的相对关系 */ + type: 'parent' | 'child' | 'ancestor' | 'descendant'; + /** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */ + linked?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void; + /** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */ + linkChanged?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void; + /** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */ + unlinked?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void; + /** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */ + target?: string; + } + /** + * obverser定义,miniprogram-api-typings缺少this定义 + */ + type Observer = (this: Instance, newVal: T, oldVal: T, changedPath: Array) => void; + /** + * watch定义 + */ + export interface WatchOption { + [name: string]: string | Observer; + } + /** + * methods定义,miniprogram-api-typings缺少this定义 + */ + export interface MethodOption { + [name: string]: (this: Instance, ...args: any[]) => any; + } + export interface ComputedOption { + [name: string]: (this: Instance) => any; + } + type PropertyType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | FunctionConstructor | null; + export interface PropertyOption { + [name: string]: PropertyType | PropertyType[] | { + /** 属性类型 */ + type: PropertyType | PropertyType[]; + /** 属性初始值 */ + value?: any; + /** 属性值被更改时的响应函数 */ + observer?: string | Observer; + /** 属性的类型(可以指定多个) */ + optionalTypes?: PropertyType[]; + }; + } + export {}; +} diff --git a/utils/dist/dialog/dialog.d.ts b/utils/dist/dialog/dialog.d.ts index 66769a6..0b679ad 100644 --- a/utils/dist/dialog/dialog.d.ts +++ b/utils/dist/dialog/dialog.d.ts @@ -1,47 +1,47 @@ -/// -declare type DialogAction = 'confirm' | 'cancel'; -declare type DialogOptions = { - lang?: string; - show?: boolean; - title?: string; - width?: string | number; - zIndex?: number; - context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance; - message?: string; - overlay?: boolean; - selector?: string; - ariaLabel?: string; - className?: string; - customStyle?: string; - transition?: string; - asyncClose?: boolean; - businessId?: number; - sessionFrom?: string; - overlayStyle?: string; - appParameter?: string; - messageAlign?: string; - sendMessageImg?: string; - showMessageCard?: boolean; - sendMessagePath?: string; - sendMessageTitle?: string; - confirmButtonText?: string; - cancelButtonText?: string; - showConfirmButton?: boolean; - showCancelButton?: boolean; - closeOnClickOverlay?: boolean; - confirmButtonOpenType?: string; -}; -interface Dialog { - (options: DialogOptions): Promise; - alert?: (options: DialogOptions) => Promise; - confirm?: (options: DialogOptions) => Promise; - close?: () => void; - stopLoading?: () => void; - install?: () => void; - setDefaultOptions?: (options: DialogOptions) => void; - resetDefaultOptions?: () => void; - defaultOptions?: DialogOptions; - currentOptions?: DialogOptions; -} -declare const Dialog: Dialog; -export default Dialog; +/// +declare type DialogAction = 'confirm' | 'cancel'; +declare type DialogOptions = { + lang?: string; + show?: boolean; + title?: string; + width?: string | number; + zIndex?: number; + context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance; + message?: string; + overlay?: boolean; + selector?: string; + ariaLabel?: string; + className?: string; + customStyle?: string; + transition?: string; + asyncClose?: boolean; + businessId?: number; + sessionFrom?: string; + overlayStyle?: string; + appParameter?: string; + messageAlign?: string; + sendMessageImg?: string; + showMessageCard?: boolean; + sendMessagePath?: string; + sendMessageTitle?: string; + confirmButtonText?: string; + cancelButtonText?: string; + showConfirmButton?: boolean; + showCancelButton?: boolean; + closeOnClickOverlay?: boolean; + confirmButtonOpenType?: string; +}; +interface Dialog { + (options: DialogOptions): Promise; + alert?: (options: DialogOptions) => Promise; + confirm?: (options: DialogOptions) => Promise; + close?: () => void; + stopLoading?: () => void; + install?: () => void; + setDefaultOptions?: (options: DialogOptions) => void; + resetDefaultOptions?: () => void; + defaultOptions?: DialogOptions; + currentOptions?: DialogOptions; +} +declare const Dialog: Dialog; +export default Dialog; diff --git a/utils/dist/dialog/dialog.js b/utils/dist/dialog/dialog.js index 4c4f7e4..78dd249 100644 --- a/utils/dist/dialog/dialog.js +++ b/utils/dist/dialog/dialog.js @@ -1,63 +1,63 @@ -let queue = []; -function getContext() { - const pages = getCurrentPages(); - return pages[pages.length - 1]; -} -const Dialog = options => { - options = Object.assign(Object.assign({}, Dialog.currentOptions), options); - return new Promise((resolve, reject) => { - const context = options.context || getContext(); - const dialog = context.selectComponent(options.selector); - delete options.context; - delete options.selector; - if (dialog) { - dialog.setData(Object.assign({ onCancel: reject, onConfirm: resolve }, options)); - queue.push(dialog); - } - else { - console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确'); - } - }); -}; -Dialog.defaultOptions = { - show: true, - title: '', - width: null, - message: '', - zIndex: 100, - overlay: true, - selector: '#van-dialog', - className: '', - asyncClose: false, - transition: 'scale', - customStyle: '', - messageAlign: '', - overlayStyle: '', - confirmButtonText: '确认', - cancelButtonText: '取消', - showConfirmButton: true, - showCancelButton: false, - closeOnClickOverlay: false, - confirmButtonOpenType: '' -}; -Dialog.alert = Dialog; -Dialog.confirm = options => Dialog(Object.assign({ showCancelButton: true }, options)); -Dialog.close = () => { - queue.forEach(dialog => { - dialog.close(); - }); - queue = []; -}; -Dialog.stopLoading = () => { - queue.forEach(dialog => { - dialog.stopLoading(); - }); -}; -Dialog.setDefaultOptions = options => { - Object.assign(Dialog.currentOptions, options); -}; -Dialog.resetDefaultOptions = () => { - Dialog.currentOptions = Object.assign({}, Dialog.defaultOptions); -}; -Dialog.resetDefaultOptions(); -export default Dialog; +let queue = []; +function getContext() { + const pages = getCurrentPages(); + return pages[pages.length - 1]; +} +const Dialog = options => { + options = Object.assign(Object.assign({}, Dialog.currentOptions), options); + return new Promise((resolve, reject) => { + const context = options.context || getContext(); + const dialog = context.selectComponent(options.selector); + delete options.context; + delete options.selector; + if (dialog) { + dialog.setData(Object.assign({ onCancel: reject, onConfirm: resolve }, options)); + queue.push(dialog); + } + else { + console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确'); + } + }); +}; +Dialog.defaultOptions = { + show: true, + title: '', + width: null, + message: '', + zIndex: 100, + overlay: true, + selector: '#van-dialog', + className: '', + asyncClose: false, + transition: 'scale', + customStyle: '', + messageAlign: '', + overlayStyle: '', + confirmButtonText: '确认', + cancelButtonText: '取消', + showConfirmButton: true, + showCancelButton: false, + closeOnClickOverlay: false, + confirmButtonOpenType: '' +}; +Dialog.alert = Dialog; +Dialog.confirm = options => Dialog(Object.assign({ showCancelButton: true }, options)); +Dialog.close = () => { + queue.forEach(dialog => { + dialog.close(); + }); + queue = []; +}; +Dialog.stopLoading = () => { + queue.forEach(dialog => { + dialog.stopLoading(); + }); +}; +Dialog.setDefaultOptions = options => { + Object.assign(Dialog.currentOptions, options); +}; +Dialog.resetDefaultOptions = () => { + Dialog.currentOptions = Object.assign({}, Dialog.defaultOptions); +}; +Dialog.resetDefaultOptions(); +export default Dialog; diff --git a/utils/dist/dialog/index.d.ts b/utils/dist/dialog/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/dialog/index.d.ts +++ b/utils/dist/dialog/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/dialog/index.js b/utils/dist/dialog/index.js index 85d6c3c..21ea880 100644 --- a/utils/dist/dialog/index.js +++ b/utils/dist/dialog/index.js @@ -1,119 +1,119 @@ -import { VantComponent } from '../common/component'; -import { button } from '../mixins/button'; -import { openType } from '../mixins/open-type'; -import { addUnit } from '../common/utils'; -import { GRAY, BLUE } from '../common/color'; -VantComponent({ - mixins: [button, openType], - props: { - show: Boolean, - title: String, - message: String, - useSlot: Boolean, - className: String, - customStyle: String, - asyncClose: Boolean, - messageAlign: String, - overlayStyle: String, - useTitleSlot: Boolean, - showCancelButton: Boolean, - closeOnClickOverlay: Boolean, - confirmButtonOpenType: String, - width: { - type: null, - observer: 'setWidthWithUnit' - }, - zIndex: { - type: Number, - value: 2000 - }, - confirmButtonText: { - type: String, - value: '确认' - }, - cancelButtonText: { - type: String, - value: '取消' - }, - confirmButtonColor: { - type: String, - value: BLUE - }, - cancelButtonColor: { - type: String, - value: GRAY - }, - showConfirmButton: { - type: Boolean, - value: true - }, - overlay: { - type: Boolean, - value: true - }, - transition: { - type: String, - value: 'scale' - } - }, - data: { - loading: { - confirm: false, - cancel: false - } - }, - watch: { - show(show) { - !show && this.stopLoading(); - } - }, - methods: { - onConfirm() { - this.handleAction('confirm'); - }, - onCancel() { - this.handleAction('cancel'); - }, - onClickOverlay() { - this.onClose('overlay'); - }, - handleAction(action) { - if (this.data.asyncClose) { - this.setData({ - [`loading.${action}`]: true - }); - } - this.onClose(action); - }, - close() { - this.setData({ - show: false - }); - }, - stopLoading() { - this.setData({ - loading: { - confirm: false, - cancel: false - } - }); - }, - onClose(action) { - if (!this.data.asyncClose) { - this.close(); - } - this.$emit('close', action); - // 把 dialog 实例传递出去,可以通过 stopLoading() 在外部关闭按钮的 loading - this.$emit(action, { dialog: this }); - const callback = this.data[action === 'confirm' ? 'onConfirm' : 'onCancel']; - if (callback) { - callback(this); - } - }, - setWidthWithUnit(val) { - this.setData({ - widthWithUnit: addUnit(val) - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +import { addUnit } from '../common/utils'; +import { GRAY, BLUE } from '../common/color'; +VantComponent({ + mixins: [button, openType], + props: { + show: Boolean, + title: String, + message: String, + useSlot: Boolean, + className: String, + customStyle: String, + asyncClose: Boolean, + messageAlign: String, + overlayStyle: String, + useTitleSlot: Boolean, + showCancelButton: Boolean, + closeOnClickOverlay: Boolean, + confirmButtonOpenType: String, + width: { + type: null, + observer: 'setWidthWithUnit' + }, + zIndex: { + type: Number, + value: 2000 + }, + confirmButtonText: { + type: String, + value: '确认' + }, + cancelButtonText: { + type: String, + value: '取消' + }, + confirmButtonColor: { + type: String, + value: BLUE + }, + cancelButtonColor: { + type: String, + value: GRAY + }, + showConfirmButton: { + type: Boolean, + value: true + }, + overlay: { + type: Boolean, + value: true + }, + transition: { + type: String, + value: 'scale' + } + }, + data: { + loading: { + confirm: false, + cancel: false + } + }, + watch: { + show(show) { + !show && this.stopLoading(); + } + }, + methods: { + onConfirm() { + this.handleAction('confirm'); + }, + onCancel() { + this.handleAction('cancel'); + }, + onClickOverlay() { + this.onClose('overlay'); + }, + handleAction(action) { + if (this.data.asyncClose) { + this.setData({ + [`loading.${action}`]: true + }); + } + this.onClose(action); + }, + close() { + this.setData({ + show: false + }); + }, + stopLoading() { + this.setData({ + loading: { + confirm: false, + cancel: false + } + }); + }, + onClose(action) { + if (!this.data.asyncClose) { + this.close(); + } + this.$emit('close', action); + // 把 dialog 实例传递出去,可以通过 stopLoading() 在外部关闭按钮的 loading + this.$emit(action, { dialog: this }); + const callback = this.data[action === 'confirm' ? 'onConfirm' : 'onCancel']; + if (callback) { + callback(this); + } + }, + setWidthWithUnit(val) { + this.setData({ + widthWithUnit: addUnit(val) + }); + } + } +}); diff --git a/utils/dist/dialog/index.json b/utils/dist/dialog/index.json index e2ee09a..75feee2 100644 --- a/utils/dist/dialog/index.json +++ b/utils/dist/dialog/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-popup": "../popup/index", - "van-button": "../button/index" - } -} +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-button": "../button/index" + } +} diff --git a/utils/dist/dialog/index.wxml b/utils/dist/dialog/index.wxml index 854e8a1..fec27b0 100644 --- a/utils/dist/dialog/index.wxml +++ b/utils/dist/dialog/index.wxml @@ -1,69 +1,69 @@ - - - - {{ title }} - - - - - {{ message }} - - - - - {{ cancelButtonText }} - - - {{ confirmButtonText }} - - - + + + + {{ title }} + + + + + {{ message }} + + + + + {{ cancelButtonText }} + + + {{ confirmButtonText }} + + + diff --git a/utils/dist/divider/index.d.ts b/utils/dist/divider/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/divider/index.d.ts +++ b/utils/dist/divider/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/divider/index.js b/utils/dist/divider/index.js index 73f833d..8b68f89 100644 --- a/utils/dist/divider/index.js +++ b/utils/dist/divider/index.js @@ -1,33 +1,33 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - dashed: { - type: Boolean, - value: false - }, - hairline: { - type: Boolean, - value: false - }, - contentPosition: { - type: String, - value: '' - }, - fontSize: { - type: Number, - value: '' - }, - borderColor: { - type: String, - value: '' - }, - textColor: { - type: String, - value: '' - }, - customStyle: { - type: String, - value: '' - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + dashed: { + type: Boolean, + value: false + }, + hairline: { + type: Boolean, + value: false + }, + contentPosition: { + type: String, + value: '' + }, + fontSize: { + type: Number, + value: '' + }, + borderColor: { + type: String, + value: '' + }, + textColor: { + type: String, + value: '' + }, + customStyle: { + type: String, + value: '' + } + } +}); diff --git a/utils/dist/divider/index.json b/utils/dist/divider/index.json index e8cfaaf..011372e 100644 --- a/utils/dist/divider/index.json +++ b/utils/dist/divider/index.json @@ -1,4 +1,4 @@ -{ - "component": true, - "usingComponents": {} +{ + "component": true, + "usingComponents": {} } \ No newline at end of file diff --git a/utils/dist/divider/index.wxml b/utils/dist/divider/index.wxml index 412e73f..b1d8ba4 100644 --- a/utils/dist/divider/index.wxml +++ b/utils/dist/divider/index.wxml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/utils/dist/dropdown-item/index.d.ts b/utils/dist/dropdown-item/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/dropdown-item/index.d.ts +++ b/utils/dist/dropdown-item/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/dropdown-item/index.js b/utils/dist/dropdown-item/index.js index f2b6c48..0ec7f7f 100644 --- a/utils/dist/dropdown-item/index.js +++ b/utils/dist/dropdown-item/index.js @@ -1,104 +1,104 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - field: true, - relation: { - name: 'dropdown-menu', - type: 'ancestor', - linked(target) { - this.parent = target; - this.updateDataFromParent(); - }, - unlinked() { - this.parent = null; - } - }, - props: { - value: { - type: null, - observer: 'rerender' - }, - title: { - type: String, - observer: 'rerender' - }, - disabled: Boolean, - titleClass: { - type: String, - observer: 'rerender' - }, - options: { - type: Array, - value: [], - observer: 'rerender' - } - }, - data: { - transition: true, - showPopup: false, - showWrapper: false, - displayTitle: '' - }, - methods: { - rerender() { - wx.nextTick(() => { - this.parent && this.parent.updateItemListData(); - }); - }, - updateDataFromParent() { - if (this.parent) { - const { overlay, duration, activeColor, closeOnClickOverlay, direction } = this.parent.data; - this.setData({ - overlay, - duration, - activeColor, - closeOnClickOverlay, - direction - }); - } - }, - onClickOverlay() { - this.toggle(); - this.$emit('close'); - }, - onOptionTap(event) { - const { option } = event.currentTarget.dataset; - const { value } = option; - const shouldEmitChange = this.data.value !== value; - this.setData({ showPopup: false, value }); - setTimeout(() => { - this.setData({ showWrapper: false }); - }, this.data.duration || 0); - this.rerender(); - if (shouldEmitChange) { - this.$emit('change', value); - } - }, - toggle(show, options = {}) { - const { showPopup, duration } = this.data; - if (show == null) { - show = !showPopup; - } - if (show === showPopup) { - return; - } - if (!show) { - const time = options.immediate ? 0 : duration; - this.setData({ transition: !options.immediate, showPopup: show }); - setTimeout(() => { - this.setData({ showWrapper: false }); - }, time); - this.rerender(); - return; - } - this.parent.getChildWrapperStyle().then((wrapperStyle = '') => { - this.setData({ - transition: !options.immediate, - showPopup: show, - wrapperStyle, - showWrapper: true - }); - this.rerender(); - }); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + relation: { + name: 'dropdown-menu', + type: 'ancestor', + linked(target) { + this.parent = target; + this.updateDataFromParent(); + }, + unlinked() { + this.parent = null; + } + }, + props: { + value: { + type: null, + observer: 'rerender' + }, + title: { + type: String, + observer: 'rerender' + }, + disabled: Boolean, + titleClass: { + type: String, + observer: 'rerender' + }, + options: { + type: Array, + value: [], + observer: 'rerender' + } + }, + data: { + transition: true, + showPopup: false, + showWrapper: false, + displayTitle: '' + }, + methods: { + rerender() { + wx.nextTick(() => { + this.parent && this.parent.updateItemListData(); + }); + }, + updateDataFromParent() { + if (this.parent) { + const { overlay, duration, activeColor, closeOnClickOverlay, direction } = this.parent.data; + this.setData({ + overlay, + duration, + activeColor, + closeOnClickOverlay, + direction + }); + } + }, + onClickOverlay() { + this.toggle(); + this.$emit('close'); + }, + onOptionTap(event) { + const { option } = event.currentTarget.dataset; + const { value } = option; + const shouldEmitChange = this.data.value !== value; + this.setData({ showPopup: false, value }); + setTimeout(() => { + this.setData({ showWrapper: false }); + }, this.data.duration || 0); + this.rerender(); + if (shouldEmitChange) { + this.$emit('change', value); + } + }, + toggle(show, options = {}) { + const { showPopup, duration } = this.data; + if (show == null) { + show = !showPopup; + } + if (show === showPopup) { + return; + } + if (!show) { + const time = options.immediate ? 0 : duration; + this.setData({ transition: !options.immediate, showPopup: show }); + setTimeout(() => { + this.setData({ showWrapper: false }); + }, time); + this.rerender(); + return; + } + this.parent.getChildWrapperStyle().then((wrapperStyle = '') => { + this.setData({ + transition: !options.immediate, + showPopup: show, + wrapperStyle, + showWrapper: true + }); + this.rerender(); + }); + } + } +}); diff --git a/utils/dist/dropdown-item/index.json b/utils/dist/dropdown-item/index.json index 88d5409..b30d74b 100644 --- a/utils/dist/dropdown-item/index.json +++ b/utils/dist/dropdown-item/index.json @@ -1,8 +1,8 @@ -{ - "component": true, - "usingComponents": { - "van-popup": "../popup/index", - "van-cell": "../cell/index", - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/dropdown-item/index.wxml b/utils/dist/dropdown-item/index.wxml index 07bca8d..be8fd06 100644 --- a/utils/dist/dropdown-item/index.wxml +++ b/utils/dist/dropdown-item/index.wxml @@ -1,44 +1,44 @@ - - - - - - - {{ item.text }} - - - - - - - + + + + + + + {{ item.text }} + + + + + + + diff --git a/utils/dist/dropdown-menu/index.d.ts b/utils/dist/dropdown-menu/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/dropdown-menu/index.d.ts +++ b/utils/dist/dropdown-menu/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/dropdown-menu/index.js b/utils/dist/dropdown-menu/index.js index 889387b..9b1ddab 100644 --- a/utils/dist/dropdown-menu/index.js +++ b/utils/dist/dropdown-menu/index.js @@ -1,121 +1,121 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -let ARRAY = []; -VantComponent({ - field: true, - relation: { - name: 'dropdown-item', - type: 'descendant', - linked(target) { - this.children.push(target); - this.updateItemListData(); - }, - unlinked(target) { - this.children = this.children.filter((child) => child !== target); - this.updateItemListData(); - } - }, - props: { - activeColor: { - type: String, - observer: 'updateChildrenData' - }, - overlay: { - type: Boolean, - value: true, - observer: 'updateChildrenData' - }, - zIndex: { - type: Number, - value: 10 - }, - duration: { - type: Number, - value: 200, - observer: 'updateChildrenData' - }, - direction: { - type: String, - value: 'down', - observer: 'updateChildrenData' - }, - closeOnClickOverlay: { - type: Boolean, - value: true, - observer: 'updateChildrenData' - }, - closeOnClickOutside: { - type: Boolean, - value: true - } - }, - data: { - itemListData: [] - }, - beforeCreate() { - const { windowHeight } = wx.getSystemInfoSync(); - this.windowHeight = windowHeight; - this.children = []; - ARRAY.push(this); - }, - destroyed() { - ARRAY = ARRAY.filter(item => item !== this); - }, - methods: { - updateItemListData() { - this.setData({ - itemListData: this.children.map((child) => child.data) - }); - }, - updateChildrenData() { - this.children.forEach((child) => { - child.updateDataFromParent(); - }); - }, - toggleItem(active) { - this.children.forEach((item, index) => { - const { showPopup } = item.data; - if (index === active) { - item.toggle(); - } - else if (showPopup) { - item.toggle(false, { immediate: true }); - } - }); - }, - close() { - this.children.forEach((child) => { - child.toggle(false, { immediate: true }); - }); - }, - getChildWrapperStyle() { - const { zIndex, direction } = this.data; - return this.getRect('.van-dropdown-menu').then((rect) => { - const { top = 0, bottom = 0 } = rect; - const offset = direction === 'down' ? bottom : this.windowHeight - top; - let wrapperStyle = `z-index: ${zIndex};`; - if (direction === 'down') { - wrapperStyle += `top: ${addUnit(offset)};`; - } - else { - wrapperStyle += `bottom: ${addUnit(offset)};`; - } - return wrapperStyle; - }); - }, - onTitleTap(event) { - const { index } = event.currentTarget.dataset; - const child = this.children[index]; - if (!child.data.disabled) { - ARRAY.forEach(menuItem => { - if (menuItem && - menuItem.data.closeOnClickOutside && - menuItem !== this) { - menuItem.close(); - } - }); - this.toggleItem(index); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +let ARRAY = []; +VantComponent({ + field: true, + relation: { + name: 'dropdown-item', + type: 'descendant', + linked(target) { + this.children.push(target); + this.updateItemListData(); + }, + unlinked(target) { + this.children = this.children.filter((child) => child !== target); + this.updateItemListData(); + } + }, + props: { + activeColor: { + type: String, + observer: 'updateChildrenData' + }, + overlay: { + type: Boolean, + value: true, + observer: 'updateChildrenData' + }, + zIndex: { + type: Number, + value: 10 + }, + duration: { + type: Number, + value: 200, + observer: 'updateChildrenData' + }, + direction: { + type: String, + value: 'down', + observer: 'updateChildrenData' + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + observer: 'updateChildrenData' + }, + closeOnClickOutside: { + type: Boolean, + value: true + } + }, + data: { + itemListData: [] + }, + beforeCreate() { + const { windowHeight } = wx.getSystemInfoSync(); + this.windowHeight = windowHeight; + this.children = []; + ARRAY.push(this); + }, + destroyed() { + ARRAY = ARRAY.filter(item => item !== this); + }, + methods: { + updateItemListData() { + this.setData({ + itemListData: this.children.map((child) => child.data) + }); + }, + updateChildrenData() { + this.children.forEach((child) => { + child.updateDataFromParent(); + }); + }, + toggleItem(active) { + this.children.forEach((item, index) => { + const { showPopup } = item.data; + if (index === active) { + item.toggle(); + } + else if (showPopup) { + item.toggle(false, { immediate: true }); + } + }); + }, + close() { + this.children.forEach((child) => { + child.toggle(false, { immediate: true }); + }); + }, + getChildWrapperStyle() { + const { zIndex, direction } = this.data; + return this.getRect('.van-dropdown-menu').then((rect) => { + const { top = 0, bottom = 0 } = rect; + const offset = direction === 'down' ? bottom : this.windowHeight - top; + let wrapperStyle = `z-index: ${zIndex};`; + if (direction === 'down') { + wrapperStyle += `top: ${addUnit(offset)};`; + } + else { + wrapperStyle += `bottom: ${addUnit(offset)};`; + } + return wrapperStyle; + }); + }, + onTitleTap(event) { + const { index } = event.currentTarget.dataset; + const child = this.children[index]; + if (!child.data.disabled) { + ARRAY.forEach(menuItem => { + if (menuItem && + menuItem.data.closeOnClickOutside && + menuItem !== this) { + menuItem.close(); + } + }); + this.toggleItem(index); + } + } + } +}); diff --git a/utils/dist/dropdown-menu/index.json b/utils/dist/dropdown-menu/index.json index 32640e0..1edff93 100644 --- a/utils/dist/dropdown-menu/index.json +++ b/utils/dist/dropdown-menu/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/dropdown-menu/index.wxml b/utils/dist/dropdown-menu/index.wxml index 037ac3b..2d3451f 100644 --- a/utils/dist/dropdown-menu/index.wxml +++ b/utils/dist/dropdown-menu/index.wxml @@ -1,23 +1,23 @@ - - - - - - - - {{ computed.displayTitle(item) }} - - - - - - + + + + + + + + {{ computed.displayTitle(item) }} + + + + + + diff --git a/utils/dist/dropdown-menu/index.wxs b/utils/dist/dropdown-menu/index.wxs index 6538854..ffa262f 100644 --- a/utils/dist/dropdown-menu/index.wxs +++ b/utils/dist/dropdown-menu/index.wxs @@ -1,16 +1,16 @@ -/* eslint-disable */ -function displayTitle(item) { - if (item.title) { - return item.title; - } - - var match = item.options.filter(function(option) { - return option.value === item.value; - }); - var displayTitle = match.length ? match[0].text : ''; - return displayTitle; -} - -module.exports = { - displayTitle: displayTitle -}; +/* eslint-disable */ +function displayTitle(item) { + if (item.title) { + return item.title; + } + + var match = item.options.filter(function(option) { + return option.value === item.value; + }); + var displayTitle = match.length ? match[0].text : ''; + return displayTitle; +} + +module.exports = { + displayTitle: displayTitle +}; diff --git a/utils/dist/field/index.d.ts b/utils/dist/field/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/field/index.d.ts +++ b/utils/dist/field/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/field/index.js b/utils/dist/field/index.js index 35dc34c..8fb3c6e 100644 --- a/utils/dist/field/index.js +++ b/utils/dist/field/index.js @@ -1,108 +1,108 @@ -import { VantComponent } from '../common/component'; -import { getSystemInfoSync } from '../common/utils'; -VantComponent({ - field: true, - classes: ['input-class', 'right-icon-class'], - props: { - size: String, - icon: String, - label: String, - error: Boolean, - fixed: Boolean, - focus: Boolean, - center: Boolean, - isLink: Boolean, - leftIcon: String, - rightIcon: String, - disabled: Boolean, - autosize: Boolean, - readonly: Boolean, - required: Boolean, - password: Boolean, - iconClass: String, - clearable: Boolean, - clickable: Boolean, - inputAlign: String, - placeholder: String, - customStyle: String, - confirmType: String, - confirmHold: Boolean, - holdKeyboard: Boolean, - errorMessage: String, - arrowDirection: String, - placeholderStyle: String, - errorMessageAlign: String, - selectionEnd: { - type: Number, - value: -1 - }, - selectionStart: { - type: Number, - value: -1 - }, - showConfirmBar: { - type: Boolean, - value: true - }, - adjustPosition: { - type: Boolean, - value: true - }, - cursorSpacing: { - type: Number, - value: 50 - }, - maxlength: { - type: Number, - value: -1 - }, - type: { - type: String, - value: 'text' - }, - border: { - type: Boolean, - value: true - }, - titleWidth: { - type: String, - value: '90px' - } - }, - data: { - focused: false, - system: getSystemInfoSync().system.split(' ').shift().toLowerCase() - }, - methods: { - onInput(event) { - const { value = '' } = event.detail || {}; - this.setData({ value }, () => { - this.emitChange(value); - }); - }, - onFocus(event) { - this.setData({ focused: true }); - this.$emit('focus', event.detail); - }, - onBlur(event) { - this.setData({ focused: false }); - this.$emit('blur', event.detail); - }, - onClickIcon() { - this.$emit('click-icon'); - }, - onClear() { - this.setData({ value: '' }, () => { - this.emitChange(''); - this.$emit('clear', ''); - }); - }, - onConfirm() { - this.$emit('confirm', this.data.value); - }, - emitChange(value) { - this.$emit('input', value); - this.$emit('change', value); - } - } -}); +import { VantComponent } from '../common/component'; +import { getSystemInfoSync } from '../common/utils'; +VantComponent({ + field: true, + classes: ['input-class', 'right-icon-class'], + props: { + size: String, + icon: String, + label: String, + error: Boolean, + fixed: Boolean, + focus: Boolean, + center: Boolean, + isLink: Boolean, + leftIcon: String, + rightIcon: String, + disabled: Boolean, + autosize: Boolean, + readonly: Boolean, + required: Boolean, + password: Boolean, + iconClass: String, + clearable: Boolean, + clickable: Boolean, + inputAlign: String, + placeholder: String, + customStyle: String, + confirmType: String, + confirmHold: Boolean, + holdKeyboard: Boolean, + errorMessage: String, + arrowDirection: String, + placeholderStyle: String, + errorMessageAlign: String, + selectionEnd: { + type: Number, + value: -1 + }, + selectionStart: { + type: Number, + value: -1 + }, + showConfirmBar: { + type: Boolean, + value: true + }, + adjustPosition: { + type: Boolean, + value: true + }, + cursorSpacing: { + type: Number, + value: 50 + }, + maxlength: { + type: Number, + value: -1 + }, + type: { + type: String, + value: 'text' + }, + border: { + type: Boolean, + value: true + }, + titleWidth: { + type: String, + value: '90px' + } + }, + data: { + focused: false, + system: getSystemInfoSync().system.split(' ').shift().toLowerCase() + }, + methods: { + onInput(event) { + const { value = '' } = event.detail || {}; + this.setData({ value }, () => { + this.emitChange(value); + }); + }, + onFocus(event) { + this.setData({ focused: true }); + this.$emit('focus', event.detail); + }, + onBlur(event) { + this.setData({ focused: false }); + this.$emit('blur', event.detail); + }, + onClickIcon() { + this.$emit('click-icon'); + }, + onClear() { + this.setData({ value: '' }, () => { + this.emitChange(''); + this.$emit('clear', ''); + }); + }, + onConfirm() { + this.$emit('confirm', this.data.value); + }, + emitChange(value) { + this.$emit('input', value); + this.$emit('change', value); + } + } +}); diff --git a/utils/dist/field/index.json b/utils/dist/field/index.json index 8809c46..6de6ddc 100644 --- a/utils/dist/field/index.json +++ b/utils/dist/field/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-cell": "../cell/index", - "van-icon": "../icon/index" - } +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } } \ No newline at end of file diff --git a/utils/dist/field/index.wxml b/utils/dist/field/index.wxml index 6490178..d8a80cf 100644 --- a/utils/dist/field/index.wxml +++ b/utils/dist/field/index.wxml @@ -1,93 +1,93 @@ - - - - - - - - - - - - - - - - - - - - {{ errorMessage }} - - + + + + + + + + + + + + + + + + + + + + {{ errorMessage }} + + diff --git a/utils/dist/goods-action-button/index.d.ts b/utils/dist/goods-action-button/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/goods-action-button/index.d.ts +++ b/utils/dist/goods-action-button/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/goods-action-button/index.js b/utils/dist/goods-action-button/index.js index 8eed4a3..dc24af9 100644 --- a/utils/dist/goods-action-button/index.js +++ b/utils/dist/goods-action-button/index.js @@ -1,41 +1,41 @@ -import { VantComponent } from '../common/component'; -import { link } from '../mixins/link'; -import { button } from '../mixins/button'; -import { openType } from '../mixins/open-type'; -VantComponent({ - mixins: [link, button, openType], - relation: { - type: 'ancestor', - name: 'goods-action', - linked(parent) { - this.parent = parent; - } - }, - props: { - text: String, - color: String, - loading: Boolean, - disabled: Boolean, - type: { - type: String, - value: 'danger' - } - }, - mounted() { - this.updateStyle(); - }, - methods: { - onClick(event) { - this.$emit('click', event.detail); - this.jumpLink(); - }, - updateStyle() { - const { children = [] } = this.parent; - const index = children.indexOf(this); - this.setData({ - isFirst: index === 0, - isLast: index === children.length - 1 - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { link } from '../mixins/link'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +VantComponent({ + mixins: [link, button, openType], + relation: { + type: 'ancestor', + name: 'goods-action', + linked(parent) { + this.parent = parent; + } + }, + props: { + text: String, + color: String, + loading: Boolean, + disabled: Boolean, + type: { + type: String, + value: 'danger' + } + }, + mounted() { + this.updateStyle(); + }, + methods: { + onClick(event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + updateStyle() { + const { children = [] } = this.parent; + const index = children.indexOf(this); + this.setData({ + isFirst: index === 0, + isLast: index === children.length - 1 + }); + } + } +}); diff --git a/utils/dist/goods-action-button/index.json b/utils/dist/goods-action-button/index.json index b567686..79baa71 100644 --- a/utils/dist/goods-action-button/index.json +++ b/utils/dist/goods-action-button/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-button": "../button/index" - } -} +{ + "component": true, + "usingComponents": { + "van-button": "../button/index" + } +} diff --git a/utils/dist/goods-action-button/index.wxml b/utils/dist/goods-action-button/index.wxml index d6d2daa..6adea8f 100644 --- a/utils/dist/goods-action-button/index.wxml +++ b/utils/dist/goods-action-button/index.wxml @@ -1,28 +1,28 @@ - - - {{ text }} - + + + {{ text }} + diff --git a/utils/dist/goods-action-icon/index.d.ts b/utils/dist/goods-action-icon/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/goods-action-icon/index.d.ts +++ b/utils/dist/goods-action-icon/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/goods-action-icon/index.js b/utils/dist/goods-action-icon/index.js index 5a32e70..267dbef 100644 --- a/utils/dist/goods-action-icon/index.js +++ b/utils/dist/goods-action-icon/index.js @@ -1,22 +1,22 @@ -import { VantComponent } from '../common/component'; -import { link } from '../mixins/link'; -import { button } from '../mixins/button'; -import { openType } from '../mixins/open-type'; -VantComponent({ - classes: ['icon-class', 'text-class'], - mixins: [link, button, openType], - props: { - text: String, - dot: Boolean, - info: String, - icon: String, - disabled: Boolean, - loading: Boolean - }, - methods: { - onClick(event) { - this.$emit('click', event.detail); - this.jumpLink(); - } - } -}); +import { VantComponent } from '../common/component'; +import { link } from '../mixins/link'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +VantComponent({ + classes: ['icon-class', 'text-class'], + mixins: [link, button, openType], + props: { + text: String, + dot: Boolean, + info: String, + icon: String, + disabled: Boolean, + loading: Boolean + }, + methods: { + onClick(event) { + this.$emit('click', event.detail); + this.jumpLink(); + } + } +}); diff --git a/utils/dist/goods-action-icon/index.json b/utils/dist/goods-action-icon/index.json index 93bfe8a..0d8373d 100644 --- a/utils/dist/goods-action-icon/index.json +++ b/utils/dist/goods-action-icon/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-button": "../button/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-button": "../button/index" + } +} diff --git a/utils/dist/goods-action-icon/index.wxml b/utils/dist/goods-action-icon/index.wxml index f3f0052..85933db 100644 --- a/utils/dist/goods-action-icon/index.wxml +++ b/utils/dist/goods-action-icon/index.wxml @@ -1,38 +1,38 @@ - - - - - {{ text }} - - + + + + + {{ text }} + + diff --git a/utils/dist/goods-action/index.d.ts b/utils/dist/goods-action/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/goods-action/index.d.ts +++ b/utils/dist/goods-action/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/goods-action/index.js b/utils/dist/goods-action/index.js index 4a07ba8..11cb033 100644 --- a/utils/dist/goods-action/index.js +++ b/utils/dist/goods-action/index.js @@ -1,22 +1,22 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - type: 'descendant', - name: 'goods-action-button', - linked(child) { - this.children.push(child); - }, - unlinked(child) { - this.children = this.children.filter((item) => item !== child); - } - }, - beforeCreate() { - this.children = []; - }, - props: { - safeAreaInsetBottom: { - type: Boolean, - value: true - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + type: 'descendant', + name: 'goods-action-button', + linked(child) { + this.children.push(child); + }, + unlinked(child) { + this.children = this.children.filter((item) => item !== child); + } + }, + beforeCreate() { + this.children = []; + }, + props: { + safeAreaInsetBottom: { + type: Boolean, + value: true + } + } +}); diff --git a/utils/dist/goods-action/index.json b/utils/dist/goods-action/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/goods-action/index.json +++ b/utils/dist/goods-action/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/goods-action/index.wxml b/utils/dist/goods-action/index.wxml index 569450c..c9bc8c7 100644 --- a/utils/dist/goods-action/index.wxml +++ b/utils/dist/goods-action/index.wxml @@ -1,5 +1,5 @@ - - - - - + + + + + diff --git a/utils/dist/grid-item/index.d.ts b/utils/dist/grid-item/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/grid-item/index.d.ts +++ b/utils/dist/grid-item/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/grid-item/index.js b/utils/dist/grid-item/index.js index 756996c..2c6910a 100644 --- a/utils/dist/grid-item/index.js +++ b/utils/dist/grid-item/index.js @@ -1,68 +1,68 @@ -import { link } from '../mixins/link'; -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - relation: { - name: 'grid', - type: 'ancestor', - linked(parent) { - this.parent = parent; - } - }, - mixins: [link], - props: { - icon: String, - dot: Boolean, - info: null, - text: String, - useSlot: Boolean - }, - mounted() { - this.updateStyle(); - }, - methods: { - updateStyle() { - if (!this.parent) { - return; - } - const { data, children } = this.parent; - const { columnNum, border, square, gutter, clickable, center } = data; - const width = `${100 / columnNum}%`; - const styleWrapper = []; - styleWrapper.push(`width: ${width}`); - if (square) { - styleWrapper.push(`padding-top: ${width}`); - } - if (gutter) { - const gutterValue = addUnit(gutter); - styleWrapper.push(`padding-right: ${gutterValue}`); - const index = children.indexOf(this); - if (index >= columnNum) { - styleWrapper.push(`margin-top: ${gutterValue}`); - } - } - let contentStyle = ''; - if (square && gutter) { - const gutterValue = addUnit(gutter); - contentStyle = ` - right: ${gutterValue}; - bottom: ${gutterValue}; - height: auto; - `; - } - this.setData({ - style: styleWrapper.join('; '), - contentStyle, - center, - border, - square, - gutter, - clickable - }); - }, - onClick() { - this.$emit('click'); - this.jumpLink(); - } - } -}); +import { link } from '../mixins/link'; +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + relation: { + name: 'grid', + type: 'ancestor', + linked(parent) { + this.parent = parent; + } + }, + mixins: [link], + props: { + icon: String, + dot: Boolean, + info: null, + text: String, + useSlot: Boolean + }, + mounted() { + this.updateStyle(); + }, + methods: { + updateStyle() { + if (!this.parent) { + return; + } + const { data, children } = this.parent; + const { columnNum, border, square, gutter, clickable, center } = data; + const width = `${100 / columnNum}%`; + const styleWrapper = []; + styleWrapper.push(`width: ${width}`); + if (square) { + styleWrapper.push(`padding-top: ${width}`); + } + if (gutter) { + const gutterValue = addUnit(gutter); + styleWrapper.push(`padding-right: ${gutterValue}`); + const index = children.indexOf(this); + if (index >= columnNum) { + styleWrapper.push(`margin-top: ${gutterValue}`); + } + } + let contentStyle = ''; + if (square && gutter) { + const gutterValue = addUnit(gutter); + contentStyle = ` + right: ${gutterValue}; + bottom: ${gutterValue}; + height: auto; + `; + } + this.setData({ + style: styleWrapper.join('; '), + contentStyle, + center, + border, + square, + gutter, + clickable + }); + }, + onClick() { + this.$emit('click'); + this.jumpLink(); + } + } +}); diff --git a/utils/dist/grid-item/index.json b/utils/dist/grid-item/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/grid-item/index.json +++ b/utils/dist/grid-item/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/grid-item/index.wxml b/utils/dist/grid-item/index.wxml index 2fb189b..a86fa29 100644 --- a/utils/dist/grid-item/index.wxml +++ b/utils/dist/grid-item/index.wxml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - {{ text }} - - - - - + + + + + + + + + + + + + + {{ text }} + + + + + diff --git a/utils/dist/grid/index.d.ts b/utils/dist/grid/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/grid/index.d.ts +++ b/utils/dist/grid/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/grid/index.js b/utils/dist/grid/index.js index 97f3eb0..1c780dd 100644 --- a/utils/dist/grid/index.js +++ b/utils/dist/grid/index.js @@ -1,62 +1,62 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - relation: { - name: 'grid-item', - type: 'descendant', - linked(child) { - this.children.push(child); - }, - unlinked(child) { - this.children = this.children.filter((item) => item !== child); - } - }, - props: { - square: { - type: Boolean, - observer: 'updateChildren' - }, - gutter: { - type: [Number, String], - value: 0, - observer: 'updateChildren' - }, - clickable: { - type: Boolean, - observer: 'updateChildren' - }, - columnNum: { - type: Number, - value: 4, - observer: 'updateChildren' - }, - center: { - type: Boolean, - value: true, - observer: 'updateChildren' - }, - border: { - type: Boolean, - value: true, - observer: 'updateChildren' - } - }, - beforeCreate() { - this.children = []; - }, - created() { - const { gutter } = this.data; - if (gutter) { - this.setData({ - style: `padding-left: ${addUnit(gutter)}` - }); - } - }, - methods: { - updateChildren() { - this.children.forEach((child) => { - child.updateStyle(); - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + relation: { + name: 'grid-item', + type: 'descendant', + linked(child) { + this.children.push(child); + }, + unlinked(child) { + this.children = this.children.filter((item) => item !== child); + } + }, + props: { + square: { + type: Boolean, + observer: 'updateChildren' + }, + gutter: { + type: [Number, String], + value: 0, + observer: 'updateChildren' + }, + clickable: { + type: Boolean, + observer: 'updateChildren' + }, + columnNum: { + type: Number, + value: 4, + observer: 'updateChildren' + }, + center: { + type: Boolean, + value: true, + observer: 'updateChildren' + }, + border: { + type: Boolean, + value: true, + observer: 'updateChildren' + } + }, + beforeCreate() { + this.children = []; + }, + created() { + const { gutter } = this.data; + if (gutter) { + this.setData({ + style: `padding-left: ${addUnit(gutter)}` + }); + } + }, + methods: { + updateChildren() { + this.children.forEach((child) => { + child.updateStyle(); + }); + } + } +}); diff --git a/utils/dist/grid/index.json b/utils/dist/grid/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/grid/index.json +++ b/utils/dist/grid/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/grid/index.wxml b/utils/dist/grid/index.wxml index fc76cc3..dc8a364 100644 --- a/utils/dist/grid/index.wxml +++ b/utils/dist/grid/index.wxml @@ -1,3 +1,3 @@ - - - + + + diff --git a/utils/dist/icon/index.d.ts b/utils/dist/icon/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/icon/index.d.ts +++ b/utils/dist/icon/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/icon/index.js b/utils/dist/icon/index.js index 8d83ff1..587ace9 100644 --- a/utils/dist/icon/index.js +++ b/utils/dist/icon/index.js @@ -1,39 +1,39 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - props: { - dot: Boolean, - info: null, - size: { - type: null, - observer: 'setSizeWithUnit' - }, - color: String, - customStyle: String, - classPrefix: { - type: String, - value: 'van-icon' - }, - name: { - type: String, - observer(val) { - this.setData({ - isImageName: val.indexOf('/') !== -1 - }); - } - } - }, - data: { - sizeWithUnit: null, - }, - methods: { - onClick() { - this.$emit('click'); - }, - setSizeWithUnit(size) { - this.setData({ - sizeWithUnit: addUnit(size) - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + props: { + dot: Boolean, + info: null, + size: { + type: null, + observer: 'setSizeWithUnit' + }, + color: String, + customStyle: String, + classPrefix: { + type: String, + value: 'van-icon' + }, + name: { + type: String, + observer(val) { + this.setData({ + isImageName: val.indexOf('/') !== -1 + }); + } + } + }, + data: { + sizeWithUnit: null, + }, + methods: { + onClick() { + this.$emit('click'); + }, + setSizeWithUnit(size) { + this.setData({ + sizeWithUnit: addUnit(size) + }); + } + } +}); diff --git a/utils/dist/icon/index.json b/utils/dist/icon/index.json index bf0ebe0..82369bf 100644 --- a/utils/dist/icon/index.json +++ b/utils/dist/icon/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-info": "../info/index" - } -} +{ + "component": true, + "usingComponents": { + "van-info": "../info/index" + } +} diff --git a/utils/dist/icon/index.wxml b/utils/dist/icon/index.wxml index c568b58..6b4c609 100644 --- a/utils/dist/icon/index.wxml +++ b/utils/dist/icon/index.wxml @@ -1,18 +1,18 @@ - - - - + + + + diff --git a/utils/dist/image/index.d.ts b/utils/dist/image/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/image/index.d.ts +++ b/utils/dist/image/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/image/index.js b/utils/dist/image/index.js index 95650f7..b13a566 100644 --- a/utils/dist/image/index.js +++ b/utils/dist/image/index.js @@ -1,98 +1,98 @@ -import { addUnit, isDef } from '../common/utils'; -import { VantComponent } from '../common/component'; -import { button } from '../mixins/button'; -import { openType } from '../mixins/open-type'; -const FIT_MODE_MAP = { - none: 'center', - fill: 'scaleToFill', - cover: 'aspectFill', - contain: 'aspectFit' -}; -VantComponent({ - mixins: [button, openType], - classes: ['custom-class', 'loading-class', 'error-class', 'image-class'], - props: { - src: String, - round: Boolean, - width: { - type: null, - observer: 'setStyle' - }, - height: { - type: null, - observer: 'setStyle' - }, - radius: null, - lazyLoad: Boolean, - useErrorSlot: Boolean, - useLoadingSlot: Boolean, - showMenuByLongpress: Boolean, - fit: { - type: String, - value: 'fill', - observer: 'setMode' - }, - showError: { - type: Boolean, - value: true - }, - showLoading: { - type: Boolean, - value: true - } - }, - data: { - error: false, - loading: true - }, - watch: { - src() { - this.setData({ - error: false, - loading: true - }); - } - }, - mounted() { - this.setMode(); - this.setStyle(); - }, - methods: { - setMode() { - this.setData({ - mode: FIT_MODE_MAP[this.data.fit], - }); - }, - setStyle() { - const { width, height, radius } = this.data; - let style = ''; - if (isDef(width)) { - style += `width: ${addUnit(width)};`; - } - if (isDef(height)) { - style += `height: ${addUnit(height)};`; - } - if (isDef(radius)) { - style += 'overflow: hidden;'; - style += `border-radius: ${addUnit(radius)};`; - } - this.setData({ style }); - }, - onLoad(event) { - this.setData({ - loading: false - }); - this.$emit('load', event.detail); - }, - onError(event) { - this.setData({ - loading: false, - error: true - }); - this.$emit('error', event.detail); - }, - onClick(event) { - this.$emit('click', event.detail); - } - } -}); +import { addUnit, isDef } from '../common/utils'; +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +const FIT_MODE_MAP = { + none: 'center', + fill: 'scaleToFill', + cover: 'aspectFill', + contain: 'aspectFit' +}; +VantComponent({ + mixins: [button, openType], + classes: ['custom-class', 'loading-class', 'error-class', 'image-class'], + props: { + src: String, + round: Boolean, + width: { + type: null, + observer: 'setStyle' + }, + height: { + type: null, + observer: 'setStyle' + }, + radius: null, + lazyLoad: Boolean, + useErrorSlot: Boolean, + useLoadingSlot: Boolean, + showMenuByLongpress: Boolean, + fit: { + type: String, + value: 'fill', + observer: 'setMode' + }, + showError: { + type: Boolean, + value: true + }, + showLoading: { + type: Boolean, + value: true + } + }, + data: { + error: false, + loading: true + }, + watch: { + src() { + this.setData({ + error: false, + loading: true + }); + } + }, + mounted() { + this.setMode(); + this.setStyle(); + }, + methods: { + setMode() { + this.setData({ + mode: FIT_MODE_MAP[this.data.fit], + }); + }, + setStyle() { + const { width, height, radius } = this.data; + let style = ''; + if (isDef(width)) { + style += `width: ${addUnit(width)};`; + } + if (isDef(height)) { + style += `height: ${addUnit(height)};`; + } + if (isDef(radius)) { + style += 'overflow: hidden;'; + style += `border-radius: ${addUnit(radius)};`; + } + this.setData({ style }); + }, + onLoad(event) { + this.setData({ + loading: false + }); + this.$emit('load', event.detail); + }, + onError(event) { + this.setData({ + loading: false, + error: true + }); + this.$emit('error', event.detail); + }, + onClick(event) { + this.$emit('click', event.detail); + } + } +}); diff --git a/utils/dist/image/index.json b/utils/dist/image/index.json index e00a588..8e23ad6 100644 --- a/utils/dist/image/index.json +++ b/utils/dist/image/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-loading": "../loading/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/utils/dist/image/index.wxml b/utils/dist/image/index.wxml index 4724ca2..f6cef6e 100644 --- a/utils/dist/image/index.wxml +++ b/utils/dist/image/index.wxml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/utils/dist/index-anchor/index.d.ts b/utils/dist/index-anchor/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/index-anchor/index.d.ts +++ b/utils/dist/index-anchor/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/index-anchor/index.js b/utils/dist/index-anchor/index.js index caaf191..c847364 100644 --- a/utils/dist/index-anchor/index.js +++ b/utils/dist/index-anchor/index.js @@ -1,22 +1,22 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'index-bar', - type: 'ancestor', - linked(target) { - this.parent = target; - }, - unlinked() { - this.parent = null; - } - }, - props: { - useSlot: Boolean, - index: null - }, - data: { - active: false, - wrapperStyle: '', - anchorStyle: '' - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'index-bar', + type: 'ancestor', + linked(target) { + this.parent = target; + }, + unlinked() { + this.parent = null; + } + }, + props: { + useSlot: Boolean, + index: null + }, + data: { + active: false, + wrapperStyle: '', + anchorStyle: '' + } +}); diff --git a/utils/dist/index-anchor/index.json b/utils/dist/index-anchor/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/index-anchor/index.json +++ b/utils/dist/index-anchor/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/index-anchor/index.wxml b/utils/dist/index-anchor/index.wxml index 49affa7..6304f1f 100644 --- a/utils/dist/index-anchor/index.wxml +++ b/utils/dist/index-anchor/index.wxml @@ -1,14 +1,14 @@ - - - - - {{ index }} - - - + + + + + {{ index }} + + + diff --git a/utils/dist/index-bar/index.d.ts b/utils/dist/index-bar/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/index-bar/index.d.ts +++ b/utils/dist/index-bar/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/index-bar/index.js b/utils/dist/index-bar/index.js index ec8e8e7..637ddc1 100644 --- a/utils/dist/index-bar/index.js +++ b/utils/dist/index-bar/index.js @@ -1,240 +1,240 @@ -import { VantComponent } from '../common/component'; -import { GREEN } from '../common/color'; -const indexList = () => { - const indexList = []; - const charCodeOfA = 'A'.charCodeAt(0); - for (let i = 0; i < 26; i++) { - indexList.push(String.fromCharCode(charCodeOfA + i)); - } - return indexList; -}; -VantComponent({ - relation: { - name: 'index-anchor', - type: 'descendant', - linked() { - this.updateData(); - }, - linkChanged() { - this.updateData(); - }, - unlinked() { - this.updateData(); - } - }, - props: { - sticky: { - type: Boolean, - value: true - }, - zIndex: { - type: Number, - value: 1 - }, - highlightColor: { - type: String, - value: GREEN - }, - scrollTop: { - type: Number, - value: 0, - observer: 'onScroll' - }, - stickyOffsetTop: { - type: Number, - value: 0 - }, - indexList: { - type: Array, - value: indexList() - } - }, - data: { - activeAnchorIndex: null, - showSidebar: false - }, - methods: { - updateData() { - this.timer && clearTimeout(this.timer); - this.timer = setTimeout(() => { - this.children = this.getRelationNodes('../index-anchor/index'); - this.setData({ - showSidebar: !!this.children.length - }); - this.setRect().then(() => { - this.onScroll(); - }); - }, 0); - }, - setRect() { - return Promise.all([ - this.setAnchorsRect(), - this.setListRect(), - this.setSiderbarRect() - ]); - }, - setAnchorsRect() { - return Promise.all(this.children.map(anchor => (anchor.getRect('.van-index-anchor-wrapper').then((rect) => { - Object.assign(anchor, { - height: rect.height, - top: rect.top + this.data.scrollTop - }); - })))); - }, - setListRect() { - return this.getRect('.van-index-bar').then((rect) => { - Object.assign(this, { - height: rect.height, - top: rect.top + this.data.scrollTop - }); - }); - }, - setSiderbarRect() { - return this.getRect('.van-index-bar__sidebar').then(res => { - this.sidebar = { - height: res.height, - top: res.top - }; - }); - }, - setDiffData({ target, data }) { - const diffData = {}; - Object.keys(data).forEach(key => { - if (target.data[key] !== data[key]) { - diffData[key] = data[key]; - } - }); - if (Object.keys(diffData).length) { - target.setData(diffData); - } - }, - getAnchorRect(anchor) { - return anchor.getRect('.van-index-anchor-wrapper').then((rect) => ({ - height: rect.height, - top: rect.top - })); - }, - getActiveAnchorIndex() { - const { children } = this; - const { sticky, scrollTop, stickyOffsetTop } = this.data; - for (let i = this.children.length - 1; i >= 0; i--) { - const preAnchorHeight = i > 0 ? children[i - 1].height : 0; - const reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0; - if (reachTop + scrollTop >= children[i].top) { - return i; - } - } - return -1; - }, - onScroll() { - const { children = [] } = this; - if (!children.length) { - return; - } - const { sticky, stickyOffsetTop, zIndex, highlightColor, scrollTop } = this.data; - const active = this.getActiveAnchorIndex(); - this.setDiffData({ - target: this, - data: { - activeAnchorIndex: active - } - }); - if (sticky) { - let isActiveAnchorSticky = false; - if (active !== -1) { - isActiveAnchorSticky = children[active].top <= stickyOffsetTop + scrollTop; - } - children.forEach((item, index) => { - if (index === active) { - let wrapperStyle = ''; - let anchorStyle = ` - color: ${highlightColor}; - `; - if (isActiveAnchorSticky) { - wrapperStyle = ` - height: ${children[index].height}px; - `; - anchorStyle = ` - position: fixed; - top: ${stickyOffsetTop}px; - z-index: ${zIndex}; - color: ${highlightColor}; - `; - } - this.setDiffData({ - target: item, - data: { - active: true, - anchorStyle, - wrapperStyle - } - }); - } - else if (index === active - 1) { - const currentAnchor = children[index]; - const currentOffsetTop = currentAnchor.top; - const targetOffsetTop = index === children.length - 1 - ? this.top - : children[index + 1].top; - const parentOffsetHeight = targetOffsetTop - currentOffsetTop; - const translateY = parentOffsetHeight - currentAnchor.height; - const anchorStyle = ` - position: relative; - transform: translate3d(0, ${translateY}px, 0); - z-index: ${zIndex}; - color: ${highlightColor}; - `; - this.setDiffData({ - target: item, - data: { - active: true, - anchorStyle - } - }); - } - else { - this.setDiffData({ - target: item, - data: { - active: false, - anchorStyle: '', - wrapperStyle: '', - } - }); - } - }); - } - }, - onClick(event) { - this.scrollToAnchor(event.target.dataset.index); - }, - onTouchMove(event) { - const sidebarLength = this.children.length; - const touch = event.touches[0]; - const itemHeight = this.sidebar.height / sidebarLength; - let index = Math.floor((touch.clientY - this.sidebar.top) / itemHeight); - if (index < 0) { - index = 0; - } - else if (index > sidebarLength - 1) { - index = sidebarLength - 1; - } - this.scrollToAnchor(index); - }, - onTouchStop() { - this.scrollToAnchorIndex = null; - }, - scrollToAnchor(index) { - if (typeof index !== 'number' || this.scrollToAnchorIndex === index) { - return; - } - this.scrollToAnchorIndex = index; - const anchor = this.children.filter(item => item.data.index === this.data.indexList[index])[0]; - this.$emit('select', anchor.data.index); - anchor && wx.pageScrollTo({ - duration: 0, - scrollTop: anchor.top - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { GREEN } from '../common/color'; +const indexList = () => { + const indexList = []; + const charCodeOfA = 'A'.charCodeAt(0); + for (let i = 0; i < 26; i++) { + indexList.push(String.fromCharCode(charCodeOfA + i)); + } + return indexList; +}; +VantComponent({ + relation: { + name: 'index-anchor', + type: 'descendant', + linked() { + this.updateData(); + }, + linkChanged() { + this.updateData(); + }, + unlinked() { + this.updateData(); + } + }, + props: { + sticky: { + type: Boolean, + value: true + }, + zIndex: { + type: Number, + value: 1 + }, + highlightColor: { + type: String, + value: GREEN + }, + scrollTop: { + type: Number, + value: 0, + observer: 'onScroll' + }, + stickyOffsetTop: { + type: Number, + value: 0 + }, + indexList: { + type: Array, + value: indexList() + } + }, + data: { + activeAnchorIndex: null, + showSidebar: false + }, + methods: { + updateData() { + this.timer && clearTimeout(this.timer); + this.timer = setTimeout(() => { + this.children = this.getRelationNodes('../index-anchor/index'); + this.setData({ + showSidebar: !!this.children.length + }); + this.setRect().then(() => { + this.onScroll(); + }); + }, 0); + }, + setRect() { + return Promise.all([ + this.setAnchorsRect(), + this.setListRect(), + this.setSiderbarRect() + ]); + }, + setAnchorsRect() { + return Promise.all(this.children.map(anchor => (anchor.getRect('.van-index-anchor-wrapper').then((rect) => { + Object.assign(anchor, { + height: rect.height, + top: rect.top + this.data.scrollTop + }); + })))); + }, + setListRect() { + return this.getRect('.van-index-bar').then((rect) => { + Object.assign(this, { + height: rect.height, + top: rect.top + this.data.scrollTop + }); + }); + }, + setSiderbarRect() { + return this.getRect('.van-index-bar__sidebar').then(res => { + this.sidebar = { + height: res.height, + top: res.top + }; + }); + }, + setDiffData({ target, data }) { + const diffData = {}; + Object.keys(data).forEach(key => { + if (target.data[key] !== data[key]) { + diffData[key] = data[key]; + } + }); + if (Object.keys(diffData).length) { + target.setData(diffData); + } + }, + getAnchorRect(anchor) { + return anchor.getRect('.van-index-anchor-wrapper').then((rect) => ({ + height: rect.height, + top: rect.top + })); + }, + getActiveAnchorIndex() { + const { children } = this; + const { sticky, scrollTop, stickyOffsetTop } = this.data; + for (let i = this.children.length - 1; i >= 0; i--) { + const preAnchorHeight = i > 0 ? children[i - 1].height : 0; + const reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0; + if (reachTop + scrollTop >= children[i].top) { + return i; + } + } + return -1; + }, + onScroll() { + const { children = [] } = this; + if (!children.length) { + return; + } + const { sticky, stickyOffsetTop, zIndex, highlightColor, scrollTop } = this.data; + const active = this.getActiveAnchorIndex(); + this.setDiffData({ + target: this, + data: { + activeAnchorIndex: active + } + }); + if (sticky) { + let isActiveAnchorSticky = false; + if (active !== -1) { + isActiveAnchorSticky = children[active].top <= stickyOffsetTop + scrollTop; + } + children.forEach((item, index) => { + if (index === active) { + let wrapperStyle = ''; + let anchorStyle = ` + color: ${highlightColor}; + `; + if (isActiveAnchorSticky) { + wrapperStyle = ` + height: ${children[index].height}px; + `; + anchorStyle = ` + position: fixed; + top: ${stickyOffsetTop}px; + z-index: ${zIndex}; + color: ${highlightColor}; + `; + } + this.setDiffData({ + target: item, + data: { + active: true, + anchorStyle, + wrapperStyle + } + }); + } + else if (index === active - 1) { + const currentAnchor = children[index]; + const currentOffsetTop = currentAnchor.top; + const targetOffsetTop = index === children.length - 1 + ? this.top + : children[index + 1].top; + const parentOffsetHeight = targetOffsetTop - currentOffsetTop; + const translateY = parentOffsetHeight - currentAnchor.height; + const anchorStyle = ` + position: relative; + transform: translate3d(0, ${translateY}px, 0); + z-index: ${zIndex}; + color: ${highlightColor}; + `; + this.setDiffData({ + target: item, + data: { + active: true, + anchorStyle + } + }); + } + else { + this.setDiffData({ + target: item, + data: { + active: false, + anchorStyle: '', + wrapperStyle: '', + } + }); + } + }); + } + }, + onClick(event) { + this.scrollToAnchor(event.target.dataset.index); + }, + onTouchMove(event) { + const sidebarLength = this.children.length; + const touch = event.touches[0]; + const itemHeight = this.sidebar.height / sidebarLength; + let index = Math.floor((touch.clientY - this.sidebar.top) / itemHeight); + if (index < 0) { + index = 0; + } + else if (index > sidebarLength - 1) { + index = sidebarLength - 1; + } + this.scrollToAnchor(index); + }, + onTouchStop() { + this.scrollToAnchorIndex = null; + }, + scrollToAnchor(index) { + if (typeof index !== 'number' || this.scrollToAnchorIndex === index) { + return; + } + this.scrollToAnchorIndex = index; + const anchor = this.children.filter(item => item.data.index === this.data.indexList[index])[0]; + this.$emit('select', anchor.data.index); + anchor && wx.pageScrollTo({ + duration: 0, + scrollTop: anchor.top + }); + } + } +}); diff --git a/utils/dist/index-bar/index.json b/utils/dist/index-bar/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/index-bar/index.json +++ b/utils/dist/index-bar/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/index-bar/index.wxml b/utils/dist/index-bar/index.wxml index 19a59cf..019e256 100644 --- a/utils/dist/index-bar/index.wxml +++ b/utils/dist/index-bar/index.wxml @@ -1,22 +1,22 @@ - - - - - - {{ item }} - - - + + + + + + {{ item }} + + + diff --git a/utils/dist/info/index.d.ts b/utils/dist/info/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/info/index.d.ts +++ b/utils/dist/info/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/info/index.js b/utils/dist/info/index.js index 8e34c0f..7c91e72 100644 --- a/utils/dist/info/index.js +++ b/utils/dist/info/index.js @@ -1,8 +1,8 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - dot: Boolean, - info: null, - customStyle: String - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + dot: Boolean, + info: null, + customStyle: String + } +}); diff --git a/utils/dist/info/index.json b/utils/dist/info/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/info/index.json +++ b/utils/dist/info/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/info/index.wxml b/utils/dist/info/index.wxml index 3112dfc..ea2d23b 100644 --- a/utils/dist/info/index.wxml +++ b/utils/dist/info/index.wxml @@ -1,7 +1,7 @@ - - -{{ dot ? '' : info }} + + +{{ dot ? '' : info }} diff --git a/utils/dist/loading/index.d.ts b/utils/dist/loading/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/loading/index.d.ts +++ b/utils/dist/loading/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/loading/index.js b/utils/dist/loading/index.js index af510c8..e4ff431 100644 --- a/utils/dist/loading/index.js +++ b/utils/dist/loading/index.js @@ -1,32 +1,32 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - props: { - color: String, - vertical: Boolean, - type: { - type: String, - value: 'circular' - }, - size: { - type: String, - observer: 'setSizeWithUnit' - }, - textSize: { - type: String, - observer: 'setTextSizeWithUnit' - } - }, - methods: { - setSizeWithUnit(size) { - this.setData({ - sizeWithUnit: addUnit(size) - }); - }, - setTextSizeWithUnit(size) { - this.set({ - textSizeWithUnit: addUnit(size) - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + props: { + color: String, + vertical: Boolean, + type: { + type: String, + value: 'circular' + }, + size: { + type: String, + observer: 'setSizeWithUnit' + }, + textSize: { + type: String, + observer: 'setTextSizeWithUnit' + } + }, + methods: { + setSizeWithUnit(size) { + this.setData({ + sizeWithUnit: addUnit(size) + }); + }, + setTextSizeWithUnit(size) { + this.set({ + textSizeWithUnit: addUnit(size) + }); + } + } +}); diff --git a/utils/dist/loading/index.json b/utils/dist/loading/index.json index 32640e0..1edff93 100644 --- a/utils/dist/loading/index.json +++ b/utils/dist/loading/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/loading/index.wxml b/utils/dist/loading/index.wxml index 5229d04..6fac407 100644 --- a/utils/dist/loading/index.wxml +++ b/utils/dist/loading/index.wxml @@ -1,16 +1,16 @@ - - - - - - - - + + + + + + + + diff --git a/utils/dist/mixins/basic.d.ts b/utils/dist/mixins/basic.d.ts index b273369..7fd6a7f 100644 --- a/utils/dist/mixins/basic.d.ts +++ b/utils/dist/mixins/basic.d.ts @@ -1 +1 @@ -export declare const basic: string; +export declare const basic: string; diff --git a/utils/dist/mixins/basic.js b/utils/dist/mixins/basic.js index 2fdd634..aa5ab96 100644 --- a/utils/dist/mixins/basic.js +++ b/utils/dist/mixins/basic.js @@ -1,22 +1,22 @@ -export const basic = Behavior({ - methods: { - $emit(...args) { - this.triggerEvent(...args); - }, - getRect(selector, all) { - return new Promise(resolve => { - wx.createSelectorQuery() - .in(this)[all ? 'selectAll' : 'select'](selector) - .boundingClientRect(rect => { - if (all && Array.isArray(rect) && rect.length) { - resolve(rect); - } - if (!all && rect) { - resolve(rect); - } - }) - .exec(); - }); - } - } -}); +export const basic = Behavior({ + methods: { + $emit(...args) { + this.triggerEvent(...args); + }, + getRect(selector, all) { + return new Promise(resolve => { + wx.createSelectorQuery() + .in(this)[all ? 'selectAll' : 'select'](selector) + .boundingClientRect(rect => { + if (all && Array.isArray(rect) && rect.length) { + resolve(rect); + } + if (!all && rect) { + resolve(rect); + } + }) + .exec(); + }); + } + } +}); diff --git a/utils/dist/mixins/button.d.ts b/utils/dist/mixins/button.d.ts index b51db87..d25c019 100644 --- a/utils/dist/mixins/button.d.ts +++ b/utils/dist/mixins/button.d.ts @@ -1 +1 @@ -export declare const button: string; +export declare const button: string; diff --git a/utils/dist/mixins/button.js b/utils/dist/mixins/button.js index 5d3b4dc..94d177e 100644 --- a/utils/dist/mixins/button.js +++ b/utils/dist/mixins/button.js @@ -1,18 +1,18 @@ -export const button = Behavior({ - externalClasses: ['hover-class'], - properties: { - id: String, - lang: { - type: String, - value: 'en' - }, - businessId: Number, - sessionFrom: String, - sendMessageTitle: String, - sendMessagePath: String, - sendMessageImg: String, - showMessageCard: Boolean, - appParameter: String, - ariaLabel: String - } -}); +export const button = Behavior({ + externalClasses: ['hover-class'], + properties: { + id: String, + lang: { + type: String, + value: 'en' + }, + businessId: Number, + sessionFrom: String, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean, + appParameter: String, + ariaLabel: String + } +}); diff --git a/utils/dist/mixins/link.d.ts b/utils/dist/mixins/link.d.ts index d58043b..9c35f7b 100644 --- a/utils/dist/mixins/link.d.ts +++ b/utils/dist/mixins/link.d.ts @@ -1 +1 @@ -export declare const link: string; +export declare const link: string; diff --git a/utils/dist/mixins/link.js b/utils/dist/mixins/link.js index d7aed0c..bcf0f19 100644 --- a/utils/dist/mixins/link.js +++ b/utils/dist/mixins/link.js @@ -1,17 +1,17 @@ -export const link = Behavior({ - properties: { - url: String, - linkType: { - type: String, - value: 'navigateTo' - } - }, - methods: { - jumpLink(urlKey = 'url') { - const url = this.data[urlKey]; - if (url) { - wx[this.data.linkType]({ url }); - } - } - } -}); +export const link = Behavior({ + properties: { + url: String, + linkType: { + type: String, + value: 'navigateTo' + } + }, + methods: { + jumpLink(urlKey = 'url') { + const url = this.data[urlKey]; + if (url) { + wx[this.data.linkType]({ url }); + } + } + } +}); diff --git a/utils/dist/mixins/observer/behavior.d.ts b/utils/dist/mixins/observer/behavior.d.ts index 3da2a64..9743010 100644 --- a/utils/dist/mixins/observer/behavior.d.ts +++ b/utils/dist/mixins/observer/behavior.d.ts @@ -1 +1 @@ -export declare const behavior: string; +export declare const behavior: string; diff --git a/utils/dist/mixins/observer/behavior.js b/utils/dist/mixins/observer/behavior.js index 948f446..e60ff4f 100644 --- a/utils/dist/mixins/observer/behavior.js +++ b/utils/dist/mixins/observer/behavior.js @@ -1,14 +1,14 @@ -export const behavior = Behavior({ - methods: { - set(data, callback) { - return new Promise(resolve => { - this.setData(data, () => { - if (callback && typeof callback === 'function') { - callback.call(this); - } - resolve(); - }); - }); - } - } -}); +export const behavior = Behavior({ + methods: { + set(data, callback) { + return new Promise(resolve => { + this.setData(data, () => { + if (callback && typeof callback === 'function') { + callback.call(this); + } + resolve(); + }); + }); + } + } +}); diff --git a/utils/dist/mixins/observer/index.d.ts b/utils/dist/mixins/observer/index.d.ts index 4e54b2e..355210a 100644 --- a/utils/dist/mixins/observer/index.d.ts +++ b/utils/dist/mixins/observer/index.d.ts @@ -1 +1 @@ -export declare function observe(vantOptions: any, options: any): void; +export declare function observe(vantOptions: any, options: any): void; diff --git a/utils/dist/mixins/observer/index.js b/utils/dist/mixins/observer/index.js index d6f608d..f4ab3f0 100644 --- a/utils/dist/mixins/observer/index.js +++ b/utils/dist/mixins/observer/index.js @@ -1,19 +1,19 @@ -import { behavior } from './behavior'; -export function observe(vantOptions, options) { - const { watch } = vantOptions; - options.behaviors.push(behavior); - if (watch) { - const props = options.properties || {}; - Object.keys(watch).forEach(key => { - if (key in props) { - let prop = props[key]; - if (prop === null || !('type' in prop)) { - prop = { type: prop }; - } - prop.observer = watch[key]; - props[key] = prop; - } - }); - options.properties = props; - } -} +import { behavior } from './behavior'; +export function observe(vantOptions, options) { + const { watch } = vantOptions; + options.behaviors.push(behavior); + if (watch) { + const props = options.properties || {}; + Object.keys(watch).forEach(key => { + if (key in props) { + let prop = props[key]; + if (prop === null || !('type' in prop)) { + prop = { type: prop }; + } + prop.observer = watch[key]; + props[key] = prop; + } + }); + options.properties = props; + } +} diff --git a/utils/dist/mixins/open-type.d.ts b/utils/dist/mixins/open-type.d.ts index 64b023d..4165fd4 100644 --- a/utils/dist/mixins/open-type.d.ts +++ b/utils/dist/mixins/open-type.d.ts @@ -1 +1 @@ -export declare const openType: string; +export declare const openType: string; diff --git a/utils/dist/mixins/open-type.js b/utils/dist/mixins/open-type.js index 514517e..a1ee826 100644 --- a/utils/dist/mixins/open-type.js +++ b/utils/dist/mixins/open-type.js @@ -1,25 +1,25 @@ -export const openType = Behavior({ - properties: { - openType: String - }, - methods: { - bindGetUserInfo(event) { - this.$emit('getuserinfo', event.detail); - }, - bindContact(event) { - this.$emit('contact', event.detail); - }, - bindGetPhoneNumber(event) { - this.$emit('getphonenumber', event.detail); - }, - bindError(event) { - this.$emit('error', event.detail); - }, - bindLaunchApp(event) { - this.$emit('launchapp', event.detail); - }, - bindOpenSetting(event) { - this.$emit('opensetting', event.detail); - }, - } -}); +export const openType = Behavior({ + properties: { + openType: String + }, + methods: { + bindGetUserInfo(event) { + this.$emit('getuserinfo', event.detail); + }, + bindContact(event) { + this.$emit('contact', event.detail); + }, + bindGetPhoneNumber(event) { + this.$emit('getphonenumber', event.detail); + }, + bindError(event) { + this.$emit('error', event.detail); + }, + bindLaunchApp(event) { + this.$emit('launchapp', event.detail); + }, + bindOpenSetting(event) { + this.$emit('opensetting', event.detail); + }, + } +}); diff --git a/utils/dist/mixins/touch.d.ts b/utils/dist/mixins/touch.d.ts index 35ee831..8b50d29 100644 --- a/utils/dist/mixins/touch.d.ts +++ b/utils/dist/mixins/touch.d.ts @@ -1 +1 @@ -export declare const touch: string; +export declare const touch: string; diff --git a/utils/dist/mixins/touch.js b/utils/dist/mixins/touch.js index 2a79426..bedb23a 100644 --- a/utils/dist/mixins/touch.js +++ b/utils/dist/mixins/touch.js @@ -1,35 +1,35 @@ -const MIN_DISTANCE = 10; -function getDirection(x, y) { - if (x > y && x > MIN_DISTANCE) { - return 'horizontal'; - } - if (y > x && y > MIN_DISTANCE) { - return 'vertical'; - } - return ''; -} -export const touch = Behavior({ - methods: { - resetTouchStatus() { - this.direction = ''; - this.deltaX = 0; - this.deltaY = 0; - this.offsetX = 0; - this.offsetY = 0; - }, - touchStart(event) { - this.resetTouchStatus(); - const touch = event.touches[0]; - this.startX = touch.clientX; - this.startY = touch.clientY; - }, - touchMove(event) { - const touch = event.touches[0]; - this.deltaX = touch.clientX - this.startX; - this.deltaY = touch.clientY - this.startY; - this.offsetX = Math.abs(this.deltaX); - this.offsetY = Math.abs(this.deltaY); - this.direction = this.direction || getDirection(this.offsetX, this.offsetY); - } - } -}); +const MIN_DISTANCE = 10; +function getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; +} +export const touch = Behavior({ + methods: { + resetTouchStatus() { + this.direction = ''; + this.deltaX = 0; + this.deltaY = 0; + this.offsetX = 0; + this.offsetY = 0; + }, + touchStart(event) { + this.resetTouchStatus(); + const touch = event.touches[0]; + this.startX = touch.clientX; + this.startY = touch.clientY; + }, + touchMove(event) { + const touch = event.touches[0]; + this.deltaX = touch.clientX - this.startX; + this.deltaY = touch.clientY - this.startY; + this.offsetX = Math.abs(this.deltaX); + this.offsetY = Math.abs(this.deltaY); + this.direction = this.direction || getDirection(this.offsetX, this.offsetY); + } + } +}); diff --git a/utils/dist/mixins/transition.d.ts b/utils/dist/mixins/transition.d.ts index ee7b6ca..9306f3e 100644 --- a/utils/dist/mixins/transition.d.ts +++ b/utils/dist/mixins/transition.d.ts @@ -1 +1 @@ -export declare const transition: (showDefaultValue: boolean) => any; +export declare const transition: (showDefaultValue: boolean) => any; diff --git a/utils/dist/mixins/transition.js b/utils/dist/mixins/transition.js index a64df6a..7be0b5a 100644 --- a/utils/dist/mixins/transition.js +++ b/utils/dist/mixins/transition.js @@ -1,120 +1,120 @@ -import { isObj } from '../common/utils'; -const getClassNames = (name) => ({ - enter: `van-${name}-enter van-${name}-enter-active enter-class enter-active-class`, - 'enter-to': `van-${name}-enter-to van-${name}-enter-active enter-to-class enter-active-class`, - leave: `van-${name}-leave van-${name}-leave-active leave-class leave-active-class`, - 'leave-to': `van-${name}-leave-to van-${name}-leave-active leave-to-class leave-active-class` -}); -const nextTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 30)); -export const transition = function (showDefaultValue) { - return Behavior({ - properties: { - customStyle: String, - // @ts-ignore - show: { - type: Boolean, - value: showDefaultValue, - observer: 'observeShow' - }, - // @ts-ignore - duration: { - type: null, - value: 300, - observer: 'observeDuration' - }, - name: { - type: String, - value: 'fade' - } - }, - data: { - type: '', - inited: false, - display: false - }, - attached() { - if (this.data.show) { - this.enter(); - } - }, - methods: { - observeShow(value) { - value ? this.enter() : this.leave(); - }, - enter() { - const { duration, name } = this.data; - const classNames = getClassNames(name); - const currentDuration = isObj(duration) ? duration.enter : duration; - this.status = 'enter'; - this.$emit('before-enter'); - Promise.resolve() - .then(nextTick) - .then(() => { - this.checkStatus('enter'); - this.$emit('enter'); - this.setData({ - inited: true, - display: true, - classes: classNames.enter, - currentDuration - }); - }) - .then(nextTick) - .then(() => { - this.checkStatus('enter'); - this.transitionEnded = false; - this.setData({ - classes: classNames['enter-to'] - }); - }) - .catch(() => { }); - }, - leave() { - if (!this.data.display) { - return; - } - const { duration, name } = this.data; - const classNames = getClassNames(name); - const currentDuration = isObj(duration) ? duration.leave : duration; - this.status = 'leave'; - this.$emit('before-leave'); - Promise.resolve() - .then(nextTick) - .then(() => { - this.checkStatus('leave'); - this.$emit('leave'); - this.setData({ - classes: classNames.leave, - currentDuration - }); - }) - .then(nextTick) - .then(() => { - this.checkStatus('leave'); - this.transitionEnded = false; - setTimeout(() => this.onTransitionEnd(), currentDuration); - this.setData({ - classes: classNames['leave-to'] - }); - }) - .catch(() => { }); - }, - checkStatus(status) { - if (status !== this.status) { - throw new Error(`incongruent status: ${status}`); - } - }, - onTransitionEnd() { - if (this.transitionEnded) { - return; - } - this.transitionEnded = true; - this.$emit(`after-${this.status}`); - const { show, display } = this.data; - if (!show && display) { - this.setData({ display: false }); - } - } - } - }); -}; +import { isObj } from '../common/utils'; +const getClassNames = (name) => ({ + enter: `van-${name}-enter van-${name}-enter-active enter-class enter-active-class`, + 'enter-to': `van-${name}-enter-to van-${name}-enter-active enter-to-class enter-active-class`, + leave: `van-${name}-leave van-${name}-leave-active leave-class leave-active-class`, + 'leave-to': `van-${name}-leave-to van-${name}-leave-active leave-to-class leave-active-class` +}); +const nextTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 30)); +export const transition = function (showDefaultValue) { + return Behavior({ + properties: { + customStyle: String, + // @ts-ignore + show: { + type: Boolean, + value: showDefaultValue, + observer: 'observeShow' + }, + // @ts-ignore + duration: { + type: null, + value: 300, + observer: 'observeDuration' + }, + name: { + type: String, + value: 'fade' + } + }, + data: { + type: '', + inited: false, + display: false + }, + attached() { + if (this.data.show) { + this.enter(); + } + }, + methods: { + observeShow(value) { + value ? this.enter() : this.leave(); + }, + enter() { + const { duration, name } = this.data; + const classNames = getClassNames(name); + const currentDuration = isObj(duration) ? duration.enter : duration; + this.status = 'enter'; + this.$emit('before-enter'); + Promise.resolve() + .then(nextTick) + .then(() => { + this.checkStatus('enter'); + this.$emit('enter'); + this.setData({ + inited: true, + display: true, + classes: classNames.enter, + currentDuration + }); + }) + .then(nextTick) + .then(() => { + this.checkStatus('enter'); + this.transitionEnded = false; + this.setData({ + classes: classNames['enter-to'] + }); + }) + .catch(() => { }); + }, + leave() { + if (!this.data.display) { + return; + } + const { duration, name } = this.data; + const classNames = getClassNames(name); + const currentDuration = isObj(duration) ? duration.leave : duration; + this.status = 'leave'; + this.$emit('before-leave'); + Promise.resolve() + .then(nextTick) + .then(() => { + this.checkStatus('leave'); + this.$emit('leave'); + this.setData({ + classes: classNames.leave, + currentDuration + }); + }) + .then(nextTick) + .then(() => { + this.checkStatus('leave'); + this.transitionEnded = false; + setTimeout(() => this.onTransitionEnd(), currentDuration); + this.setData({ + classes: classNames['leave-to'] + }); + }) + .catch(() => { }); + }, + checkStatus(status) { + if (status !== this.status) { + throw new Error(`incongruent status: ${status}`); + } + }, + onTransitionEnd() { + if (this.transitionEnded) { + return; + } + this.transitionEnded = true; + this.$emit(`after-${this.status}`); + const { show, display } = this.data; + if (!show && display) { + this.setData({ display: false }); + } + } + } + }); +}; diff --git a/utils/dist/nav-bar/index.d.ts b/utils/dist/nav-bar/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/nav-bar/index.d.ts +++ b/utils/dist/nav-bar/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/nav-bar/index.js b/utils/dist/nav-bar/index.js index 3acf41a..b470920 100644 --- a/utils/dist/nav-bar/index.js +++ b/utils/dist/nav-bar/index.js @@ -1,38 +1,38 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - classes: ['title-class'], - props: { - title: String, - fixed: Boolean, - leftText: String, - rightText: String, - leftArrow: Boolean, - border: { - type: Boolean, - value: true - }, - zIndex: { - type: Number, - value: 1 - }, - safeAreaInsetTop: { - type: Boolean, - value: true - }, - }, - data: { - statusBarHeight: 0 - }, - created() { - const { statusBarHeight } = wx.getSystemInfoSync(); - this.setData({ statusBarHeight }); - }, - methods: { - onClickLeft() { - this.$emit('click-left'); - }, - onClickRight() { - this.$emit('click-right'); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + classes: ['title-class'], + props: { + title: String, + fixed: Boolean, + leftText: String, + rightText: String, + leftArrow: Boolean, + border: { + type: Boolean, + value: true + }, + zIndex: { + type: Number, + value: 1 + }, + safeAreaInsetTop: { + type: Boolean, + value: true + }, + }, + data: { + statusBarHeight: 0 + }, + created() { + const { statusBarHeight } = wx.getSystemInfoSync(); + this.setData({ statusBarHeight }); + }, + methods: { + onClickLeft() { + this.$emit('click-left'); + }, + onClickRight() { + this.$emit('click-right'); + } + } +}); diff --git a/utils/dist/nav-bar/index.json b/utils/dist/nav-bar/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/nav-bar/index.json +++ b/utils/dist/nav-bar/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/nav-bar/index.wxml b/utils/dist/nav-bar/index.wxml index 9ed4446..b90cde8 100644 --- a/utils/dist/nav-bar/index.wxml +++ b/utils/dist/nav-bar/index.wxml @@ -1,37 +1,37 @@ - - - - - - - {{ leftText }} - - - - - {{ title }} - - - - {{ rightText }} - - - + + + + + + + {{ leftText }} + + + + + {{ title }} + + + + {{ rightText }} + + + diff --git a/utils/dist/notice-bar/index.d.ts b/utils/dist/notice-bar/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/notice-bar/index.d.ts +++ b/utils/dist/notice-bar/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/notice-bar/index.js b/utils/dist/notice-bar/index.js index faf3567..82fa172 100644 --- a/utils/dist/notice-bar/index.js +++ b/utils/dist/notice-bar/index.js @@ -1,123 +1,123 @@ -import { VantComponent } from '../common/component'; -const FONT_COLOR = '#ed6a0c'; -const BG_COLOR = '#fffbe8'; -VantComponent({ - props: { - text: { - type: String, - value: '' - }, - mode: { - type: String, - value: '' - }, - url: { - type: String, - value: '' - }, - openType: { - type: String, - value: 'navigate' - }, - delay: { - type: Number, - value: 1 - }, - speed: { - type: Number, - value: 50 - }, - scrollable: { - type: Boolean, - value: true - }, - leftIcon: { - type: String, - value: '' - }, - color: { - type: String, - value: FONT_COLOR - }, - backgroundColor: { - type: String, - value: BG_COLOR - }, - wrapable: Boolean - }, - data: { - show: true - }, - watch: { - text() { - this.setData({}, this.init); - } - }, - created() { - this.resetAnimation = wx.createAnimation({ - duration: 0, - timingFunction: 'linear' - }); - }, - destroyed() { - this.timer && clearTimeout(this.timer); - }, - methods: { - init() { - Promise.all([ - this.getRect('.van-notice-bar__content'), - this.getRect('.van-notice-bar__wrap') - ]).then((rects) => { - const [contentRect, wrapRect] = rects; - if (contentRect == null || - wrapRect == null || - !contentRect.width || - !wrapRect.width) { - return; - } - const { speed, scrollable, delay } = this.data; - if (scrollable && wrapRect.width < contentRect.width) { - const duration = (contentRect.width / speed) * 1000; - this.wrapWidth = wrapRect.width; - this.contentWidth = contentRect.width; - this.duration = duration; - this.animation = wx.createAnimation({ - duration, - timingFunction: 'linear', - delay - }); - this.scroll(); - } - }); - }, - scroll() { - this.timer && clearTimeout(this.timer); - this.timer = null; - this.setData({ - animationData: this.resetAnimation - .translateX(this.wrapWidth) - .step() - .export() - }); - setTimeout(() => { - this.setData({ - animationData: this.animation - .translateX(-this.contentWidth) - .step() - .export() - }); - }, 20); - this.timer = setTimeout(() => { - this.scroll(); - }, this.duration); - }, - onClickIcon() { - this.timer && clearTimeout(this.timer); - this.timer = null; - this.setData({ show: false }); - }, - onClick(event) { - this.$emit('click', event); - } - } -}); +import { VantComponent } from '../common/component'; +const FONT_COLOR = '#ed6a0c'; +const BG_COLOR = '#fffbe8'; +VantComponent({ + props: { + text: { + type: String, + value: '' + }, + mode: { + type: String, + value: '' + }, + url: { + type: String, + value: '' + }, + openType: { + type: String, + value: 'navigate' + }, + delay: { + type: Number, + value: 1 + }, + speed: { + type: Number, + value: 50 + }, + scrollable: { + type: Boolean, + value: true + }, + leftIcon: { + type: String, + value: '' + }, + color: { + type: String, + value: FONT_COLOR + }, + backgroundColor: { + type: String, + value: BG_COLOR + }, + wrapable: Boolean + }, + data: { + show: true + }, + watch: { + text() { + this.setData({}, this.init); + } + }, + created() { + this.resetAnimation = wx.createAnimation({ + duration: 0, + timingFunction: 'linear' + }); + }, + destroyed() { + this.timer && clearTimeout(this.timer); + }, + methods: { + init() { + Promise.all([ + this.getRect('.van-notice-bar__content'), + this.getRect('.van-notice-bar__wrap') + ]).then((rects) => { + const [contentRect, wrapRect] = rects; + if (contentRect == null || + wrapRect == null || + !contentRect.width || + !wrapRect.width) { + return; + } + const { speed, scrollable, delay } = this.data; + if (scrollable && wrapRect.width < contentRect.width) { + const duration = (contentRect.width / speed) * 1000; + this.wrapWidth = wrapRect.width; + this.contentWidth = contentRect.width; + this.duration = duration; + this.animation = wx.createAnimation({ + duration, + timingFunction: 'linear', + delay + }); + this.scroll(); + } + }); + }, + scroll() { + this.timer && clearTimeout(this.timer); + this.timer = null; + this.setData({ + animationData: this.resetAnimation + .translateX(this.wrapWidth) + .step() + .export() + }); + setTimeout(() => { + this.setData({ + animationData: this.animation + .translateX(-this.contentWidth) + .step() + .export() + }); + }, 20); + this.timer = setTimeout(() => { + this.scroll(); + }, this.duration); + }, + onClickIcon() { + this.timer && clearTimeout(this.timer); + this.timer = null; + this.setData({ show: false }); + }, + onClick(event) { + this.$emit('click', event); + } + } +}); diff --git a/utils/dist/notice-bar/index.json b/utils/dist/notice-bar/index.json index a9ab393..d3b324f 100644 --- a/utils/dist/notice-bar/index.json +++ b/utils/dist/notice-bar/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } } \ No newline at end of file diff --git a/utils/dist/notice-bar/index.wxml b/utils/dist/notice-bar/index.wxml index eb0851c..b1a1e89 100644 --- a/utils/dist/notice-bar/index.wxml +++ b/utils/dist/notice-bar/index.wxml @@ -1,37 +1,37 @@ - - - - - - - - - {{ text }} - - - - - - - - - + + + + + + + + + {{ text }} + + + + + + + + + diff --git a/utils/dist/notify/index.d.ts b/utils/dist/notify/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/notify/index.d.ts +++ b/utils/dist/notify/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/notify/index.js b/utils/dist/notify/index.js index db9ba76..39580e2 100644 --- a/utils/dist/notify/index.js +++ b/utils/dist/notify/index.js @@ -1,59 +1,59 @@ -import { VantComponent } from '../common/component'; -import { WHITE } from '../common/color'; -VantComponent({ - props: { - message: String, - background: String, - type: { - type: String, - value: 'danger' - }, - color: { - type: String, - value: WHITE - }, - duration: { - type: Number, - value: 3000 - }, - zIndex: { - type: Number, - value: 110 - }, - safeAreaInsetTop: { - type: Boolean, - value: false - } - }, - created() { - const { statusBarHeight } = wx.getSystemInfoSync(); - this.setData({ statusBarHeight }); - }, - methods: { - show() { - const { duration, onOpened } = this.data; - clearTimeout(this.timer); - this.setData({ - show: true - }, onOpened); - if (duration > 0 && duration !== Infinity) { - this.timer = setTimeout(() => { - this.hide(); - }, duration); - } - }, - hide() { - const { onClose } = this.data; - clearTimeout(this.timer); - this.setData({ - show: false - }, onClose); - }, - onTap(event) { - const { onClick } = this.data; - if (onClick) { - onClick(event.detail); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { WHITE } from '../common/color'; +VantComponent({ + props: { + message: String, + background: String, + type: { + type: String, + value: 'danger' + }, + color: { + type: String, + value: WHITE + }, + duration: { + type: Number, + value: 3000 + }, + zIndex: { + type: Number, + value: 110 + }, + safeAreaInsetTop: { + type: Boolean, + value: false + } + }, + created() { + const { statusBarHeight } = wx.getSystemInfoSync(); + this.setData({ statusBarHeight }); + }, + methods: { + show() { + const { duration, onOpened } = this.data; + clearTimeout(this.timer); + this.setData({ + show: true + }, onOpened); + if (duration > 0 && duration !== Infinity) { + this.timer = setTimeout(() => { + this.hide(); + }, duration); + } + }, + hide() { + const { onClose } = this.data; + clearTimeout(this.timer); + this.setData({ + show: false + }, onClose); + }, + onTap(event) { + const { onClick } = this.data; + if (onClick) { + onClick(event.detail); + } + } + } +}); diff --git a/utils/dist/notify/index.json b/utils/dist/notify/index.json index c14a65f..eaad93e 100644 --- a/utils/dist/notify/index.json +++ b/utils/dist/notify/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-transition": "../transition/index" - } -} +{ + "component": true, + "usingComponents": { + "van-transition": "../transition/index" + } +} diff --git a/utils/dist/notify/index.wxml b/utils/dist/notify/index.wxml index 552b8e3..2c50caa 100644 --- a/utils/dist/notify/index.wxml +++ b/utils/dist/notify/index.wxml @@ -1,15 +1,15 @@ - - - - {{ message }} - - + + + + {{ message }} + + diff --git a/utils/dist/notify/notify.d.ts b/utils/dist/notify/notify.d.ts index 671195a..64f6c2a 100644 --- a/utils/dist/notify/notify.d.ts +++ b/utils/dist/notify/notify.d.ts @@ -1,19 +1,19 @@ -interface NotifyOptions { - type?: 'primary' | 'success' | 'danger' | 'warning'; - color?: string; - zIndex?: number; - message: string; - context?: any; - duration?: number; - selector?: string; - background?: string; - safeAreaInsetTop?: boolean; - onClick?: () => void; - onOpened?: () => void; - onClose?: () => void; -} -declare function Notify(options: NotifyOptions | string): any; -declare namespace Notify { - var clear: (options?: NotifyOptions) => void; -} -export default Notify; +interface NotifyOptions { + type?: 'primary' | 'success' | 'danger' | 'warning'; + color?: string; + zIndex?: number; + message: string; + context?: any; + duration?: number; + selector?: string; + background?: string; + safeAreaInsetTop?: boolean; + onClick?: () => void; + onOpened?: () => void; + onClose?: () => void; +} +declare function Notify(options: NotifyOptions | string): any; +declare namespace Notify { + var clear: (options?: NotifyOptions) => void; +} +export default Notify; diff --git a/utils/dist/notify/notify.js b/utils/dist/notify/notify.js index 140690b..4d2ec73 100644 --- a/utils/dist/notify/notify.js +++ b/utils/dist/notify/notify.js @@ -1,41 +1,41 @@ -import { WHITE } from '../common/color'; -const defaultOptions = { - selector: '#van-notify', - type: 'danger', - message: '', - background: '', - duration: 3000, - zIndex: 110, - color: WHITE, - onClick: () => { }, - onOpened: () => { }, - onClose: () => { } -}; -function parseOptions(message) { - return typeof message === 'string' ? { message } : message; -} -function getContext() { - const pages = getCurrentPages(); - return pages[pages.length - 1]; -} -export default function Notify(options) { - options = Object.assign({}, defaultOptions, parseOptions(options)); - const context = options.context || getContext(); - const notify = context.selectComponent(options.selector); - delete options.context; - delete options.selector; - if (notify) { - notify.set(options); - notify.show(); - return notify; - } - console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确'); -} -Notify.clear = function (options) { - options = Object.assign({}, defaultOptions, parseOptions(options)); - const context = options.context || getContext(); - const notify = context.selectComponent(options.selector); - if (notify) { - notify.hide(); - } -}; +import { WHITE } from '../common/color'; +const defaultOptions = { + selector: '#van-notify', + type: 'danger', + message: '', + background: '', + duration: 3000, + zIndex: 110, + color: WHITE, + onClick: () => { }, + onOpened: () => { }, + onClose: () => { } +}; +function parseOptions(message) { + return typeof message === 'string' ? { message } : message; +} +function getContext() { + const pages = getCurrentPages(); + return pages[pages.length - 1]; +} +export default function Notify(options) { + options = Object.assign({}, defaultOptions, parseOptions(options)); + const context = options.context || getContext(); + const notify = context.selectComponent(options.selector); + delete options.context; + delete options.selector; + if (notify) { + notify.set(options); + notify.show(); + return notify; + } + console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确'); +} +Notify.clear = function (options) { + options = Object.assign({}, defaultOptions, parseOptions(options)); + const context = options.context || getContext(); + const notify = context.selectComponent(options.selector); + if (notify) { + notify.hide(); + } +}; diff --git a/utils/dist/overlay/index.d.ts b/utils/dist/overlay/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/overlay/index.d.ts +++ b/utils/dist/overlay/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/overlay/index.js b/utils/dist/overlay/index.js index f579113..666a8b8 100644 --- a/utils/dist/overlay/index.js +++ b/utils/dist/overlay/index.js @@ -1,22 +1,22 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - show: Boolean, - customStyle: String, - duration: { - type: null, - value: 300 - }, - zIndex: { - type: Number, - value: 1 - } - }, - methods: { - onClick() { - this.$emit('click'); - }, - // for prevent touchmove - noop() { } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + show: Boolean, + customStyle: String, + duration: { + type: null, + value: 300 + }, + zIndex: { + type: Number, + value: 1 + } + }, + methods: { + onClick() { + this.$emit('click'); + }, + // for prevent touchmove + noop() { } + } +}); diff --git a/utils/dist/overlay/index.json b/utils/dist/overlay/index.json index c14a65f..eaad93e 100644 --- a/utils/dist/overlay/index.json +++ b/utils/dist/overlay/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-transition": "../transition/index" - } -} +{ + "component": true, + "usingComponents": { + "van-transition": "../transition/index" + } +} diff --git a/utils/dist/overlay/index.wxml b/utils/dist/overlay/index.wxml index 9212348..a65de2b 100644 --- a/utils/dist/overlay/index.wxml +++ b/utils/dist/overlay/index.wxml @@ -1,10 +1,10 @@ - - - + + + diff --git a/utils/dist/panel/index.d.ts b/utils/dist/panel/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/panel/index.d.ts +++ b/utils/dist/panel/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/panel/index.js b/utils/dist/panel/index.js index e624d5e..25e9c40 100644 --- a/utils/dist/panel/index.js +++ b/utils/dist/panel/index.js @@ -1,10 +1,10 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - classes: ['header-class', 'footer-class'], - props: { - desc: String, - title: String, - status: String, - useFooterSlot: Boolean - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + classes: ['header-class', 'footer-class'], + props: { + desc: String, + title: String, + status: String, + useFooterSlot: Boolean + } +}); diff --git a/utils/dist/panel/index.json b/utils/dist/panel/index.json index 0e5425c..7069216 100644 --- a/utils/dist/panel/index.json +++ b/utils/dist/panel/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-cell": "../cell/index" - } -} +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index" + } +} diff --git a/utils/dist/panel/index.wxml b/utils/dist/panel/index.wxml index 3f135d2..e277c9d 100644 --- a/utils/dist/panel/index.wxml +++ b/utils/dist/panel/index.wxml @@ -1,19 +1,19 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/utils/dist/picker-column/index.d.ts b/utils/dist/picker-column/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/picker-column/index.d.ts +++ b/utils/dist/picker-column/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/picker-column/index.js b/utils/dist/picker-column/index.js index 4a78299..6e8db44 100644 --- a/utils/dist/picker-column/index.js +++ b/utils/dist/picker-column/index.js @@ -1,119 +1,119 @@ -import { VantComponent } from '../common/component'; -import { isObj, range } from '../common/utils'; -const DEFAULT_DURATION = 200; -VantComponent({ - classes: ['active-class'], - props: { - valueKey: String, - className: String, - itemHeight: Number, - visibleItemCount: Number, - initialOptions: { - type: Array, - value: [] - }, - defaultIndex: { - type: Number, - value: 0 - } - }, - data: { - startY: 0, - offset: 0, - duration: 0, - startOffset: 0, - options: [], - currentIndex: 0 - }, - created() { - const { defaultIndex, initialOptions } = this.data; - this.set({ - currentIndex: defaultIndex, - options: initialOptions - }).then(() => { - this.setIndex(defaultIndex); - }); - }, - watch: { - defaultIndex(value) { - this.setIndex(value); - } - }, - methods: { - getCount() { - return this.data.options.length; - }, - onTouchStart(event) { - this.setData({ - startY: event.touches[0].clientY, - startOffset: this.data.offset, - duration: 0 - }); - }, - onTouchMove(event) { - const { data } = this; - const deltaY = event.touches[0].clientY - data.startY; - this.setData({ - offset: range(data.startOffset + deltaY, -(this.getCount() * data.itemHeight), data.itemHeight) - }); - }, - onTouchEnd() { - const { data } = this; - if (data.offset !== data.startOffset) { - this.setData({ duration: DEFAULT_DURATION }); - const index = range(Math.round(-data.offset / data.itemHeight), 0, this.getCount() - 1); - this.setIndex(index, true); - } - }, - onClickItem(event) { - const { index } = event.currentTarget.dataset; - this.setIndex(index, true); - }, - adjustIndex(index) { - const { data } = this; - const count = this.getCount(); - index = range(index, 0, count); - for (let i = index; i < count; i++) { - if (!this.isDisabled(data.options[i])) - return i; - } - for (let i = index - 1; i >= 0; i--) { - if (!this.isDisabled(data.options[i])) - return i; - } - }, - isDisabled(option) { - return isObj(option) && option.disabled; - }, - getOptionText(option) { - const { data } = this; - return isObj(option) && data.valueKey in option - ? option[data.valueKey] - : option; - }, - setIndex(index, userAction) { - const { data } = this; - index = this.adjustIndex(index) || 0; - const offset = -index * data.itemHeight; - if (index !== data.currentIndex) { - return this.set({ offset, currentIndex: index }).then(() => { - userAction && this.$emit('change', index); - }); - } - return this.set({ offset }); - }, - setValue(value) { - const { options } = this.data; - for (let i = 0; i < options.length; i++) { - if (this.getOptionText(options[i]) === value) { - return this.setIndex(i); - } - } - return Promise.resolve(); - }, - getValue() { - const { data } = this; - return data.options[data.currentIndex]; - } - } -}); +import { VantComponent } from '../common/component'; +import { isObj, range } from '../common/utils'; +const DEFAULT_DURATION = 200; +VantComponent({ + classes: ['active-class'], + props: { + valueKey: String, + className: String, + itemHeight: Number, + visibleItemCount: Number, + initialOptions: { + type: Array, + value: [] + }, + defaultIndex: { + type: Number, + value: 0 + } + }, + data: { + startY: 0, + offset: 0, + duration: 0, + startOffset: 0, + options: [], + currentIndex: 0 + }, + created() { + const { defaultIndex, initialOptions } = this.data; + this.set({ + currentIndex: defaultIndex, + options: initialOptions + }).then(() => { + this.setIndex(defaultIndex); + }); + }, + watch: { + defaultIndex(value) { + this.setIndex(value); + } + }, + methods: { + getCount() { + return this.data.options.length; + }, + onTouchStart(event) { + this.setData({ + startY: event.touches[0].clientY, + startOffset: this.data.offset, + duration: 0 + }); + }, + onTouchMove(event) { + const { data } = this; + const deltaY = event.touches[0].clientY - data.startY; + this.setData({ + offset: range(data.startOffset + deltaY, -(this.getCount() * data.itemHeight), data.itemHeight) + }); + }, + onTouchEnd() { + const { data } = this; + if (data.offset !== data.startOffset) { + this.setData({ duration: DEFAULT_DURATION }); + const index = range(Math.round(-data.offset / data.itemHeight), 0, this.getCount() - 1); + this.setIndex(index, true); + } + }, + onClickItem(event) { + const { index } = event.currentTarget.dataset; + this.setIndex(index, true); + }, + adjustIndex(index) { + const { data } = this; + const count = this.getCount(); + index = range(index, 0, count); + for (let i = index; i < count; i++) { + if (!this.isDisabled(data.options[i])) + return i; + } + for (let i = index - 1; i >= 0; i--) { + if (!this.isDisabled(data.options[i])) + return i; + } + }, + isDisabled(option) { + return isObj(option) && option.disabled; + }, + getOptionText(option) { + const { data } = this; + return isObj(option) && data.valueKey in option + ? option[data.valueKey] + : option; + }, + setIndex(index, userAction) { + const { data } = this; + index = this.adjustIndex(index) || 0; + const offset = -index * data.itemHeight; + if (index !== data.currentIndex) { + return this.set({ offset, currentIndex: index }).then(() => { + userAction && this.$emit('change', index); + }); + } + return this.set({ offset }); + }, + setValue(value) { + const { options } = this.data; + for (let i = 0; i < options.length; i++) { + if (this.getOptionText(options[i]) === value) { + return this.setIndex(i); + } + } + return Promise.resolve(); + }, + getValue() { + const { data } = this; + return data.options[data.currentIndex]; + } + } +}); diff --git a/utils/dist/picker-column/index.json b/utils/dist/picker-column/index.json index 32640e0..1edff93 100644 --- a/utils/dist/picker-column/index.json +++ b/utils/dist/picker-column/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/picker-column/index.wxml b/utils/dist/picker-column/index.wxml index f052ed9..d867118 100644 --- a/utils/dist/picker-column/index.wxml +++ b/utils/dist/picker-column/index.wxml @@ -1,22 +1,22 @@ - - - - - {{ getOptionText(option, valueKey) }} - - + + + + + {{ getOptionText(option, valueKey) }} + + diff --git a/utils/dist/picker-column/index.wxs b/utils/dist/picker-column/index.wxs index 3c8fc68..366b240 100644 --- a/utils/dist/picker-column/index.wxs +++ b/utils/dist/picker-column/index.wxs @@ -1,8 +1,8 @@ -function isObj(x) { - var type = typeof x; - return x !== null && (type === 'object' || type === 'function'); -} - -module.exports = function (option, valueKey) { - return isObj(option) && option[valueKey] != null ? option[valueKey] : option; -} +function isObj(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} + +module.exports = function (option, valueKey) { + return isObj(option) && option[valueKey] != null ? option[valueKey] : option; +} diff --git a/utils/dist/picker/index.d.ts b/utils/dist/picker/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/picker/index.d.ts +++ b/utils/dist/picker/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/picker/index.js b/utils/dist/picker/index.js index 8e78e66..8df0211 100644 --- a/utils/dist/picker/index.js +++ b/utils/dist/picker/index.js @@ -1,135 +1,135 @@ -import { VantComponent } from '../common/component'; -import { pickerProps } from './shared'; -VantComponent({ - classes: ['active-class', 'toolbar-class', 'column-class'], - props: Object.assign(Object.assign({}, pickerProps), { valueKey: { - type: String, - value: 'text' - }, toolbarPosition: { - type: String, - value: 'top' - }, defaultIndex: { - type: Number, - value: 0 - }, columns: { - type: Array, - value: [], - observer(columns = []) { - this.simple = columns.length && !columns[0].values; - this.children = this.selectAllComponents('.van-picker__column'); - if (Array.isArray(this.children) && this.children.length) { - this.setColumns().catch(() => { }); - } - } - } }), - beforeCreate() { - this.children = []; - }, - methods: { - noop() { }, - setColumns() { - const { data } = this; - const columns = this.simple ? [{ values: data.columns }] : data.columns; - const stack = columns.map((column, index) => this.setColumnValues(index, column.values)); - return Promise.all(stack); - }, - emit(event) { - const { type } = event.currentTarget.dataset; - if (this.simple) { - this.$emit(type, { - value: this.getColumnValue(0), - index: this.getColumnIndex(0) - }); - } - else { - this.$emit(type, { - value: this.getValues(), - index: this.getIndexes() - }); - } - }, - onChange(event) { - if (this.simple) { - this.$emit('change', { - picker: this, - value: this.getColumnValue(0), - index: this.getColumnIndex(0) - }); - } - else { - this.$emit('change', { - picker: this, - value: this.getValues(), - index: event.currentTarget.dataset.index - }); - } - }, - // get column instance by index - getColumn(index) { - return this.children[index]; - }, - // get column value by index - getColumnValue(index) { - const column = this.getColumn(index); - return column && column.getValue(); - }, - // set column value by index - setColumnValue(index, value) { - const column = this.getColumn(index); - if (column == null) { - return Promise.reject(new Error('setColumnValue: 对应列不存在')); - } - return column.setValue(value); - }, - // get column option index by column index - getColumnIndex(columnIndex) { - return (this.getColumn(columnIndex) || {}).data.currentIndex; - }, - // set column option index by column index - setColumnIndex(columnIndex, optionIndex) { - const column = this.getColumn(columnIndex); - if (column == null) { - return Promise.reject(new Error('setColumnIndex: 对应列不存在')); - } - return column.setIndex(optionIndex); - }, - // get options of column by index - getColumnValues(index) { - return (this.children[index] || {}).data.options; - }, - // set options of column by index - setColumnValues(index, options, needReset = true) { - const column = this.children[index]; - if (column == null) { - return Promise.reject(new Error('setColumnValues: 对应列不存在')); - } - const isSame = JSON.stringify(column.data.options) === JSON.stringify(options); - if (isSame) { - return Promise.resolve(); - } - return column.set({ options }).then(() => { - if (needReset) { - column.setIndex(0); - } - }); - }, - // get values of all columns - getValues() { - return this.children.map((child) => child.getValue()); - }, - // set values of all columns - setValues(values) { - const stack = values.map((value, index) => this.setColumnValue(index, value)); - return Promise.all(stack); - }, - // get indexes of all columns - getIndexes() { - return this.children.map((child) => child.data.currentIndex); - }, - // set indexes of all columns - setIndexes(indexes) { - const stack = indexes.map((optionIndex, columnIndex) => this.setColumnIndex(columnIndex, optionIndex)); - return Promise.all(stack); - } - } -}); +import { VantComponent } from '../common/component'; +import { pickerProps } from './shared'; +VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: Object.assign(Object.assign({}, pickerProps), { valueKey: { + type: String, + value: 'text' + }, toolbarPosition: { + type: String, + value: 'top' + }, defaultIndex: { + type: Number, + value: 0 + }, columns: { + type: Array, + value: [], + observer(columns = []) { + this.simple = columns.length && !columns[0].values; + this.children = this.selectAllComponents('.van-picker__column'); + if (Array.isArray(this.children) && this.children.length) { + this.setColumns().catch(() => { }); + } + } + } }), + beforeCreate() { + this.children = []; + }, + methods: { + noop() { }, + setColumns() { + const { data } = this; + const columns = this.simple ? [{ values: data.columns }] : data.columns; + const stack = columns.map((column, index) => this.setColumnValues(index, column.values)); + return Promise.all(stack); + }, + emit(event) { + const { type } = event.currentTarget.dataset; + if (this.simple) { + this.$emit(type, { + value: this.getColumnValue(0), + index: this.getColumnIndex(0) + }); + } + else { + this.$emit(type, { + value: this.getValues(), + index: this.getIndexes() + }); + } + }, + onChange(event) { + if (this.simple) { + this.$emit('change', { + picker: this, + value: this.getColumnValue(0), + index: this.getColumnIndex(0) + }); + } + else { + this.$emit('change', { + picker: this, + value: this.getValues(), + index: event.currentTarget.dataset.index + }); + } + }, + // get column instance by index + getColumn(index) { + return this.children[index]; + }, + // get column value by index + getColumnValue(index) { + const column = this.getColumn(index); + return column && column.getValue(); + }, + // set column value by index + setColumnValue(index, value) { + const column = this.getColumn(index); + if (column == null) { + return Promise.reject(new Error('setColumnValue: 对应列不存在')); + } + return column.setValue(value); + }, + // get column option index by column index + getColumnIndex(columnIndex) { + return (this.getColumn(columnIndex) || {}).data.currentIndex; + }, + // set column option index by column index + setColumnIndex(columnIndex, optionIndex) { + const column = this.getColumn(columnIndex); + if (column == null) { + return Promise.reject(new Error('setColumnIndex: 对应列不存在')); + } + return column.setIndex(optionIndex); + }, + // get options of column by index + getColumnValues(index) { + return (this.children[index] || {}).data.options; + }, + // set options of column by index + setColumnValues(index, options, needReset = true) { + const column = this.children[index]; + if (column == null) { + return Promise.reject(new Error('setColumnValues: 对应列不存在')); + } + const isSame = JSON.stringify(column.data.options) === JSON.stringify(options); + if (isSame) { + return Promise.resolve(); + } + return column.set({ options }).then(() => { + if (needReset) { + column.setIndex(0); + } + }); + }, + // get values of all columns + getValues() { + return this.children.map((child) => child.getValue()); + }, + // set values of all columns + setValues(values) { + const stack = values.map((value, index) => this.setColumnValue(index, value)); + return Promise.all(stack); + }, + // get indexes of all columns + getIndexes() { + return this.children.map((child) => child.data.currentIndex); + }, + // set indexes of all columns + setIndexes(indexes) { + const stack = indexes.map((optionIndex, columnIndex) => this.setColumnIndex(columnIndex, optionIndex)); + return Promise.all(stack); + } + } +}); diff --git a/utils/dist/picker/index.json b/utils/dist/picker/index.json index 2fcec89..bbeaf0a 100644 --- a/utils/dist/picker/index.json +++ b/utils/dist/picker/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "picker-column": "../picker-column/index", - "loading": "../loading/index" - } -} +{ + "component": true, + "usingComponents": { + "picker-column": "../picker-column/index", + "loading": "../loading/index" + } +} diff --git a/utils/dist/picker/index.wxml b/utils/dist/picker/index.wxml index 6631a73..1328b41 100644 --- a/utils/dist/picker/index.wxml +++ b/utils/dist/picker/index.wxml @@ -1,65 +1,65 @@ - - - - - - - - - - - - - - - - function isSimple(columns) { - return columns.length && !columns[0].values; - } - module.exports = isSimple; - + + + + + + + + + + + + + + + + function isSimple(columns) { + return columns.length && !columns[0].values; + } + module.exports = isSimple; + diff --git a/utils/dist/picker/shared.d.ts b/utils/dist/picker/shared.d.ts index c548045..cf3b13e 100644 --- a/utils/dist/picker/shared.d.ts +++ b/utils/dist/picker/shared.d.ts @@ -1,21 +1,21 @@ -export declare const pickerProps: { - title: StringConstructor; - loading: BooleanConstructor; - showToolbar: BooleanConstructor; - cancelButtonText: { - type: StringConstructor; - value: string; - }; - confirmButtonText: { - type: StringConstructor; - value: string; - }; - visibleItemCount: { - type: NumberConstructor; - value: number; - }; - itemHeight: { - type: NumberConstructor; - value: number; - }; -}; +export declare const pickerProps: { + title: StringConstructor; + loading: BooleanConstructor; + showToolbar: BooleanConstructor; + cancelButtonText: { + type: StringConstructor; + value: string; + }; + confirmButtonText: { + type: StringConstructor; + value: string; + }; + visibleItemCount: { + type: NumberConstructor; + value: number; + }; + itemHeight: { + type: NumberConstructor; + value: number; + }; +}; diff --git a/utils/dist/picker/shared.js b/utils/dist/picker/shared.js index cf57d1d..8e8aec5 100644 --- a/utils/dist/picker/shared.js +++ b/utils/dist/picker/shared.js @@ -1,21 +1,21 @@ -export const pickerProps = { - title: String, - loading: Boolean, - showToolbar: Boolean, - cancelButtonText: { - type: String, - value: '取消' - }, - confirmButtonText: { - type: String, - value: '确认' - }, - visibleItemCount: { - type: Number, - value: 5 - }, - itemHeight: { - type: Number, - value: 44 - } -}; +export const pickerProps = { + title: String, + loading: Boolean, + showToolbar: Boolean, + cancelButtonText: { + type: String, + value: '取消' + }, + confirmButtonText: { + type: String, + value: '确认' + }, + visibleItemCount: { + type: Number, + value: 5 + }, + itemHeight: { + type: Number, + value: 44 + } +}; diff --git a/utils/dist/popup/index.d.ts b/utils/dist/popup/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/popup/index.d.ts +++ b/utils/dist/popup/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/popup/index.js b/utils/dist/popup/index.js index 4a2e7af..02cc069 100644 --- a/utils/dist/popup/index.js +++ b/utils/dist/popup/index.js @@ -1,80 +1,80 @@ -import { VantComponent } from '../common/component'; -import { transition } from '../mixins/transition'; -VantComponent({ - classes: [ - 'enter-class', - 'enter-active-class', - 'enter-to-class', - 'leave-class', - 'leave-active-class', - 'leave-to-class' - ], - mixins: [transition(false)], - props: { - round: Boolean, - closeable: Boolean, - customStyle: String, - overlayStyle: String, - transition: { - type: String, - observer: 'observeClass' - }, - zIndex: { - type: Number, - value: 100 - }, - overlay: { - type: Boolean, - value: true - }, - closeIcon: { - type: String, - value: 'cross' - }, - closeIconPosition: { - type: String, - value: 'top-right' - }, - closeOnClickOverlay: { - type: Boolean, - value: true - }, - position: { - type: String, - value: 'center', - observer: 'observeClass' - }, - safeAreaInsetBottom: { - type: Boolean, - value: true - }, - safeAreaInsetTop: { - type: Boolean, - value: false - } - }, - created() { - this.observeClass(); - }, - methods: { - onClickCloseIcon() { - this.$emit('close'); - }, - onClickOverlay() { - this.$emit('click-overlay'); - if (this.data.closeOnClickOverlay) { - this.$emit('close'); - } - }, - observeClass() { - const { transition, position } = this.data; - const updateData = { - name: transition || position - }; - if (transition === 'none') { - updateData.duration = 0; - } - this.setData(updateData); - } - } -}); +import { VantComponent } from '../common/component'; +import { transition } from '../mixins/transition'; +VantComponent({ + classes: [ + 'enter-class', + 'enter-active-class', + 'enter-to-class', + 'leave-class', + 'leave-active-class', + 'leave-to-class' + ], + mixins: [transition(false)], + props: { + round: Boolean, + closeable: Boolean, + customStyle: String, + overlayStyle: String, + transition: { + type: String, + observer: 'observeClass' + }, + zIndex: { + type: Number, + value: 100 + }, + overlay: { + type: Boolean, + value: true + }, + closeIcon: { + type: String, + value: 'cross' + }, + closeIconPosition: { + type: String, + value: 'top-right' + }, + closeOnClickOverlay: { + type: Boolean, + value: true + }, + position: { + type: String, + value: 'center', + observer: 'observeClass' + }, + safeAreaInsetBottom: { + type: Boolean, + value: true + }, + safeAreaInsetTop: { + type: Boolean, + value: false + } + }, + created() { + this.observeClass(); + }, + methods: { + onClickCloseIcon() { + this.$emit('close'); + }, + onClickOverlay() { + this.$emit('click-overlay'); + if (this.data.closeOnClickOverlay) { + this.$emit('close'); + } + }, + observeClass() { + const { transition, position } = this.data; + const updateData = { + name: transition || position + }; + if (transition === 'none') { + updateData.duration = 0; + } + this.setData(updateData); + } + } +}); diff --git a/utils/dist/popup/index.json b/utils/dist/popup/index.json index 88a6eab..deabcd8 100644 --- a/utils/dist/popup/index.json +++ b/utils/dist/popup/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-overlay": "../overlay/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-overlay": "../overlay/index" + } +} diff --git a/utils/dist/popup/index.wxml b/utils/dist/popup/index.wxml index a384686..a2bed2c 100644 --- a/utils/dist/popup/index.wxml +++ b/utils/dist/popup/index.wxml @@ -1,24 +1,24 @@ - - - - - - - + + + + + + + diff --git a/utils/dist/progress/index.d.ts b/utils/dist/progress/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/progress/index.d.ts +++ b/utils/dist/progress/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/progress/index.js b/utils/dist/progress/index.js index 6ca67bd..f053acc 100644 --- a/utils/dist/progress/index.js +++ b/utils/dist/progress/index.js @@ -1,38 +1,38 @@ -import { VantComponent } from '../common/component'; -import { BLUE } from '../common/color'; -import { addUnit } from '../common/utils'; -VantComponent({ - props: { - inactive: Boolean, - percentage: Number, - pivotText: String, - pivotColor: String, - trackColor: String, - showPivot: { - type: Boolean, - value: true - }, - color: { - type: String, - value: BLUE - }, - textColor: { - type: String, - value: '#fff' - }, - strokeWidth: { - type: null, - observer: 'setStrokeWidthUnit' - } - }, - data: { - strokeWidthUnit: '4px' - }, - methods: { - setStrokeWidthUnit(val) { - this.setData({ - strokeWidthUnit: addUnit(val) - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { BLUE } from '../common/color'; +import { addUnit } from '../common/utils'; +VantComponent({ + props: { + inactive: Boolean, + percentage: Number, + pivotText: String, + pivotColor: String, + trackColor: String, + showPivot: { + type: Boolean, + value: true + }, + color: { + type: String, + value: BLUE + }, + textColor: { + type: String, + value: '#fff' + }, + strokeWidth: { + type: null, + observer: 'setStrokeWidthUnit' + } + }, + data: { + strokeWidthUnit: '4px' + }, + methods: { + setStrokeWidthUnit(val) { + this.setData({ + strokeWidthUnit: addUnit(val) + }); + } + } +}); diff --git a/utils/dist/progress/index.json b/utils/dist/progress/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/progress/index.json +++ b/utils/dist/progress/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/progress/index.wxml b/utils/dist/progress/index.wxml index 5d27517..b740a87 100644 --- a/utils/dist/progress/index.wxml +++ b/utils/dist/progress/index.wxml @@ -1,19 +1,19 @@ - - - - - - {{ getters.text(pivotText, percentage) }} - - - + + + + + + {{ getters.text(pivotText, percentage) }} + + + diff --git a/utils/dist/progress/index.wxs b/utils/dist/progress/index.wxs index d685345..a0735b1 100644 --- a/utils/dist/progress/index.wxs +++ b/utils/dist/progress/index.wxs @@ -1,5 +1,5 @@ -module.exports = { - text: function(pivotText, percentage) { - return pivotText || percentage + '%'; - } -}; +module.exports = { + text: function(pivotText, percentage) { + return pivotText || percentage + '%'; + } +}; diff --git a/utils/dist/radio-group/index.d.ts b/utils/dist/radio-group/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/radio-group/index.d.ts +++ b/utils/dist/radio-group/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/radio-group/index.js b/utils/dist/radio-group/index.js index e4c69e3..0b63933 100644 --- a/utils/dist/radio-group/index.js +++ b/utils/dist/radio-group/index.js @@ -1,38 +1,38 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - field: true, - relation: { - name: 'radio', - type: 'descendant', - linked(target) { - this.children = this.children || []; - this.children.push(target); - this.updateChild(target); - }, - unlinked(target) { - this.children = this.children.filter((child) => child !== target); - } - }, - props: { - value: { - type: null, - observer: 'updateChildren' - }, - disabled: { - type: Boolean, - observer: 'updateChildren' - } - }, - methods: { - updateChildren() { - (this.children || []).forEach((child) => this.updateChild(child)); - }, - updateChild(child) { - const { value, disabled } = this.data; - child.setData({ - value, - disabled: disabled || child.data.disabled - }); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + relation: { + name: 'radio', + type: 'descendant', + linked(target) { + this.children = this.children || []; + this.children.push(target); + this.updateChild(target); + }, + unlinked(target) { + this.children = this.children.filter((child) => child !== target); + } + }, + props: { + value: { + type: null, + observer: 'updateChildren' + }, + disabled: { + type: Boolean, + observer: 'updateChildren' + } + }, + methods: { + updateChildren() { + (this.children || []).forEach((child) => this.updateChild(child)); + }, + updateChild(child) { + const { value, disabled } = this.data; + child.setData({ + value, + disabled: disabled || child.data.disabled + }); + } + } +}); diff --git a/utils/dist/radio-group/index.json b/utils/dist/radio-group/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/radio-group/index.json +++ b/utils/dist/radio-group/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/radio-group/index.wxml b/utils/dist/radio-group/index.wxml index 4fa864c..a8f3249 100644 --- a/utils/dist/radio-group/index.wxml +++ b/utils/dist/radio-group/index.wxml @@ -1 +1 @@ - + diff --git a/utils/dist/radio/index.d.ts b/utils/dist/radio/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/radio/index.d.ts +++ b/utils/dist/radio/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/radio/index.js b/utils/dist/radio/index.js index c3b5165..7417dbf 100644 --- a/utils/dist/radio/index.js +++ b/utils/dist/radio/index.js @@ -1,60 +1,60 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - field: true, - relation: { - name: 'radio-group', - type: 'ancestor', - linked(target) { - this.parent = target; - }, - unlinked() { - this.parent = null; - } - }, - classes: ['icon-class', 'label-class'], - props: { - value: null, - disabled: Boolean, - useIconSlot: Boolean, - checkedColor: String, - labelPosition: { - type: String, - value: 'right' - }, - labelDisabled: Boolean, - shape: { - type: String, - value: 'round' - }, - iconSize: { - type: null, - observer: 'setIconSizeUnit' - } - }, - data: { - iconSizeWithUnit: '20px' - }, - methods: { - setIconSizeUnit(val) { - this.setData({ - iconSizeWithUnit: addUnit(val) - }); - }, - emitChange(value) { - const instance = this.parent || this; - instance.$emit('input', value); - instance.$emit('change', value); - }, - onChange(event) { - console.log(event); - this.emitChange(this.data.name); - }, - onClickLabel() { - const { disabled, labelDisabled, name } = this.data; - if (!disabled && !labelDisabled) { - this.emitChange(name); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + field: true, + relation: { + name: 'radio-group', + type: 'ancestor', + linked(target) { + this.parent = target; + }, + unlinked() { + this.parent = null; + } + }, + classes: ['icon-class', 'label-class'], + props: { + value: null, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right' + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round' + }, + iconSize: { + type: null, + observer: 'setIconSizeUnit' + } + }, + data: { + iconSizeWithUnit: '20px' + }, + methods: { + setIconSizeUnit(val) { + this.setData({ + iconSizeWithUnit: addUnit(val) + }); + }, + emitChange(value) { + const instance = this.parent || this; + instance.$emit('input', value); + instance.$emit('change', value); + }, + onChange(event) { + console.log(event); + this.emitChange(this.data.name); + }, + onClickLabel() { + const { disabled, labelDisabled, name } = this.data; + if (!disabled && !labelDisabled) { + this.emitChange(name); + } + } + } +}); diff --git a/utils/dist/radio/index.json b/utils/dist/radio/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/radio/index.json +++ b/utils/dist/radio/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/radio/index.wxml b/utils/dist/radio/index.wxml index 3b64f3f..2dd0e58 100644 --- a/utils/dist/radio/index.wxml +++ b/utils/dist/radio/index.wxml @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/utils/dist/rate/index.d.ts b/utils/dist/rate/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/rate/index.d.ts +++ b/utils/dist/rate/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/rate/index.js b/utils/dist/rate/index.js index 288ec71..f884b97 100644 --- a/utils/dist/rate/index.js +++ b/utils/dist/rate/index.js @@ -1,95 +1,95 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - field: true, - classes: ['icon-class'], - props: { - value: Number, - readonly: Boolean, - disabled: Boolean, - allowHalf: Boolean, - size: { - type: null, - observer: 'setSizeWithUnit' - }, - icon: { - type: String, - value: 'star' - }, - voidIcon: { - type: String, - value: 'star-o' - }, - color: { - type: String, - value: '#ffd21e' - }, - voidColor: { - type: String, - value: '#c7c7c7' - }, - disabledColor: { - type: String, - value: '#bdbdbd' - }, - count: { - type: Number, - value: 5 - }, - gutter: { - type: null, - observer: 'setGutterWithUnit' - }, - touchable: { - type: Boolean, - value: true - } - }, - data: { - innerValue: 0, - gutterWithUnit: undefined, - sizeWithUnit: null - }, - watch: { - value(value) { - if (value !== this.data.innerValue) { - this.setData({ innerValue: value }); - } - } - }, - methods: { - setGutterWithUnit(val) { - this.setData({ - gutterWithUnit: addUnit(val) - }); - }, - setSizeWithUnit(size) { - this.setData({ - sizeWithUnit: addUnit(size) - }); - }, - onSelect(event) { - const { data } = this; - const { score } = event.currentTarget.dataset; - if (!data.disabled && !data.readonly) { - this.setData({ innerValue: score + 1 }); - this.$emit('input', score + 1); - this.$emit('change', score + 1); - } - }, - onTouchMove(event) { - const { touchable } = this.data; - if (!touchable) - return; - const { clientX } = event.touches[0]; - this.getRect('.van-rate__icon', true).then((list) => { - const target = list - .sort(item => item.right - item.left) - .find(item => clientX >= item.left && clientX <= item.right); - if (target != null) { - this.onSelect(Object.assign(Object.assign({}, event), { currentTarget: target })); - } - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + field: true, + classes: ['icon-class'], + props: { + value: Number, + readonly: Boolean, + disabled: Boolean, + allowHalf: Boolean, + size: { + type: null, + observer: 'setSizeWithUnit' + }, + icon: { + type: String, + value: 'star' + }, + voidIcon: { + type: String, + value: 'star-o' + }, + color: { + type: String, + value: '#ffd21e' + }, + voidColor: { + type: String, + value: '#c7c7c7' + }, + disabledColor: { + type: String, + value: '#bdbdbd' + }, + count: { + type: Number, + value: 5 + }, + gutter: { + type: null, + observer: 'setGutterWithUnit' + }, + touchable: { + type: Boolean, + value: true + } + }, + data: { + innerValue: 0, + gutterWithUnit: undefined, + sizeWithUnit: null + }, + watch: { + value(value) { + if (value !== this.data.innerValue) { + this.setData({ innerValue: value }); + } + } + }, + methods: { + setGutterWithUnit(val) { + this.setData({ + gutterWithUnit: addUnit(val) + }); + }, + setSizeWithUnit(size) { + this.setData({ + sizeWithUnit: addUnit(size) + }); + }, + onSelect(event) { + const { data } = this; + const { score } = event.currentTarget.dataset; + if (!data.disabled && !data.readonly) { + this.setData({ innerValue: score + 1 }); + this.$emit('input', score + 1); + this.$emit('change', score + 1); + } + }, + onTouchMove(event) { + const { touchable } = this.data; + if (!touchable) + return; + const { clientX } = event.touches[0]; + this.getRect('.van-rate__icon', true).then((list) => { + const target = list + .sort(item => item.right - item.left) + .find(item => clientX >= item.left && clientX <= item.right); + if (target != null) { + this.onSelect(Object.assign(Object.assign({}, event), { currentTarget: target })); + } + }); + } + } +}); diff --git a/utils/dist/rate/index.json b/utils/dist/rate/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/rate/index.json +++ b/utils/dist/rate/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/rate/index.wxml b/utils/dist/rate/index.wxml index 72defd6..2cf9c5f 100644 --- a/utils/dist/rate/index.wxml +++ b/utils/dist/rate/index.wxml @@ -1,34 +1,34 @@ - - - - - - - - - + + + + + + + + + diff --git a/utils/dist/row/index.d.ts b/utils/dist/row/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/row/index.d.ts +++ b/utils/dist/row/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/row/index.js b/utils/dist/row/index.js index d7c8ba4..534a660 100644 --- a/utils/dist/row/index.js +++ b/utils/dist/row/index.js @@ -1,36 +1,36 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'col', - type: 'descendant', - linked(target) { - if (this.data.gutter) { - target.setGutter(this.data.gutter); - } - } - }, - props: { - gutter: Number - }, - watch: { - gutter: 'setGutter' - }, - mounted() { - if (this.data.gutter) { - this.setGutter(); - } - }, - methods: { - setGutter() { - const { gutter } = this.data; - const margin = `-${Number(gutter) / 2}px`; - const style = gutter - ? `margin-right: ${margin}; margin-left: ${margin};` - : ''; - this.setData({ style }); - this.getRelationNodes('../col/index').forEach(col => { - col.setGutter(this.data.gutter); - }); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'col', + type: 'descendant', + linked(target) { + if (this.data.gutter) { + target.setGutter(this.data.gutter); + } + } + }, + props: { + gutter: Number + }, + watch: { + gutter: 'setGutter' + }, + mounted() { + if (this.data.gutter) { + this.setGutter(); + } + }, + methods: { + setGutter() { + const { gutter } = this.data; + const margin = `-${Number(gutter) / 2}px`; + const style = gutter + ? `margin-right: ${margin}; margin-left: ${margin};` + : ''; + this.setData({ style }); + this.getRelationNodes('../col/index').forEach(col => { + col.setGutter(this.data.gutter); + }); + } + } +}); diff --git a/utils/dist/row/index.json b/utils/dist/row/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/row/index.json +++ b/utils/dist/row/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/row/index.wxml b/utils/dist/row/index.wxml index 20c5366..d160562 100644 --- a/utils/dist/row/index.wxml +++ b/utils/dist/row/index.wxml @@ -1,3 +1,3 @@ - - - + + + diff --git a/utils/dist/search/index.d.ts b/utils/dist/search/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/search/index.d.ts +++ b/utils/dist/search/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/search/index.js b/utils/dist/search/index.js index 931dd6c..bb9f214 100644 --- a/utils/dist/search/index.js +++ b/utils/dist/search/index.js @@ -1,73 +1,73 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - field: true, - classes: ['field-class', 'input-class', 'cancel-class'], - props: { - label: String, - focus: Boolean, - error: Boolean, - disabled: Boolean, - readonly: Boolean, - inputAlign: String, - showAction: Boolean, - useActionSlot: Boolean, - useLeftIconSlot: Boolean, - useRightIconSlot: Boolean, - leftIcon: { - type: String, - value: 'search' - }, - rightIcon: String, - placeholder: String, - placeholderStyle: String, - actionText: { - type: String, - value: '取消' - }, - background: { - type: String, - value: '#ffffff' - }, - maxlength: { - type: Number, - value: -1 - }, - shape: { - type: String, - value: 'square' - }, - clearable: { - type: Boolean, - value: true - } - }, - methods: { - onChange(event) { - this.setData({ value: event.detail }); - this.$emit('change', event.detail); - }, - onCancel() { - /** - * 修复修改输入框值时,输入框失焦和赋值同时触发,赋值失效 - * https://github.com/youzan/@vant/weapp/issues/1768 - */ - setTimeout(() => { - this.setData({ value: '' }); - this.$emit('cancel'); - this.$emit('change', ''); - }, 200); - }, - onSearch() { - this.$emit('search', this.data.value); - }, - onFocus() { - this.$emit('focus'); - }, - onBlur() { - this.$emit('blur'); - }, - onClear() { - this.$emit('clear'); - }, - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + classes: ['field-class', 'input-class', 'cancel-class'], + props: { + label: String, + focus: Boolean, + error: Boolean, + disabled: Boolean, + readonly: Boolean, + inputAlign: String, + showAction: Boolean, + useActionSlot: Boolean, + useLeftIconSlot: Boolean, + useRightIconSlot: Boolean, + leftIcon: { + type: String, + value: 'search' + }, + rightIcon: String, + placeholder: String, + placeholderStyle: String, + actionText: { + type: String, + value: '取消' + }, + background: { + type: String, + value: '#ffffff' + }, + maxlength: { + type: Number, + value: -1 + }, + shape: { + type: String, + value: 'square' + }, + clearable: { + type: Boolean, + value: true + } + }, + methods: { + onChange(event) { + this.setData({ value: event.detail }); + this.$emit('change', event.detail); + }, + onCancel() { + /** + * 修复修改输入框值时,输入框失焦和赋值同时触发,赋值失效 + * https://github.com/youzan/@vant/weapp/issues/1768 + */ + setTimeout(() => { + this.setData({ value: '' }); + this.$emit('cancel'); + this.$emit('change', ''); + }, 200); + }, + onSearch() { + this.$emit('search', this.data.value); + }, + onFocus() { + this.$emit('focus'); + }, + onBlur() { + this.$emit('blur'); + }, + onClear() { + this.$emit('clear'); + }, + } +}); diff --git a/utils/dist/search/index.json b/utils/dist/search/index.json index b4cfe91..8c052fe 100644 --- a/utils/dist/search/index.json +++ b/utils/dist/search/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-field": "../field/index" - } -} +{ + "component": true, + "usingComponents": { + "van-field": "../field/index" + } +} diff --git a/utils/dist/search/index.wxml b/utils/dist/search/index.wxml index 1d0e6f1..9967ef4 100644 --- a/utils/dist/search/index.wxml +++ b/utils/dist/search/index.wxml @@ -1,50 +1,50 @@ - - - - - {{ label }} - - - - - - - - - - - {{ actionText }} - - + + + + + {{ label }} + + + + + + + + + + + {{ actionText }} + + diff --git a/utils/dist/sidebar-item/index.d.ts b/utils/dist/sidebar-item/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/sidebar-item/index.d.ts +++ b/utils/dist/sidebar-item/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/sidebar-item/index.js b/utils/dist/sidebar-item/index.js index ecdaa08..9c5f91a 100644 --- a/utils/dist/sidebar-item/index.js +++ b/utils/dist/sidebar-item/index.js @@ -1,36 +1,36 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - classes: [ - 'active-class', - 'disabled-class', - ], - relation: { - type: 'ancestor', - name: 'sidebar', - linked(target) { - this.parent = target; - } - }, - props: { - dot: Boolean, - info: null, - title: String, - disabled: Boolean - }, - methods: { - onClick() { - const { parent } = this; - if (!parent || this.data.disabled) { - return; - } - const index = parent.children.indexOf(this); - parent.setActive(index).then(() => { - this.$emit('click', index); - parent.$emit('change', index); - }); - }, - setActive(selected) { - return this.setData({ selected }); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + classes: [ + 'active-class', + 'disabled-class', + ], + relation: { + type: 'ancestor', + name: 'sidebar', + linked(target) { + this.parent = target; + } + }, + props: { + dot: Boolean, + info: null, + title: String, + disabled: Boolean + }, + methods: { + onClick() { + const { parent } = this; + if (!parent || this.data.disabled) { + return; + } + const index = parent.children.indexOf(this); + parent.setActive(index).then(() => { + this.$emit('click', index); + parent.$emit('change', index); + }); + }, + setActive(selected) { + return this.setData({ selected }); + } + } +}); diff --git a/utils/dist/sidebar-item/index.json b/utils/dist/sidebar-item/index.json index bf0ebe0..82369bf 100644 --- a/utils/dist/sidebar-item/index.json +++ b/utils/dist/sidebar-item/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-info": "../info/index" - } -} +{ + "component": true, + "usingComponents": { + "van-info": "../info/index" + } +} diff --git a/utils/dist/sidebar-item/index.wxml b/utils/dist/sidebar-item/index.wxml index f68e864..573773b 100644 --- a/utils/dist/sidebar-item/index.wxml +++ b/utils/dist/sidebar-item/index.wxml @@ -1,18 +1,18 @@ - - - - - - {{ title }} - - + + + + + + {{ title }} + + diff --git a/utils/dist/sidebar/index.d.ts b/utils/dist/sidebar/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/sidebar/index.d.ts +++ b/utils/dist/sidebar/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/sidebar/index.js b/utils/dist/sidebar/index.js index 326faf5..3fa3b82 100644 --- a/utils/dist/sidebar/index.js +++ b/utils/dist/sidebar/index.js @@ -1,43 +1,43 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'sidebar-item', - type: 'descendant', - linked(target) { - this.children.push(target); - this.setActive(this.data.activeKey); - }, - unlinked(target) { - this.children = this.children.filter((item) => item !== target); - this.setActive(this.data.activeKey); - } - }, - props: { - activeKey: { - type: Number, - value: 0, - observer: 'setActive' - } - }, - beforeCreate() { - this.children = []; - this.currentActive = -1; - }, - methods: { - setActive(activeKey) { - const { children, currentActive } = this; - if (!children.length) { - return Promise.resolve(); - } - this.currentActive = activeKey; - const stack = []; - if (currentActive !== activeKey && children[currentActive]) { - stack.push(children[currentActive].setActive(false)); - } - if (children[activeKey]) { - stack.push(children[activeKey].setActive(true)); - } - return Promise.all(stack); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'sidebar-item', + type: 'descendant', + linked(target) { + this.children.push(target); + this.setActive(this.data.activeKey); + }, + unlinked(target) { + this.children = this.children.filter((item) => item !== target); + this.setActive(this.data.activeKey); + } + }, + props: { + activeKey: { + type: Number, + value: 0, + observer: 'setActive' + } + }, + beforeCreate() { + this.children = []; + this.currentActive = -1; + }, + methods: { + setActive(activeKey) { + const { children, currentActive } = this; + if (!children.length) { + return Promise.resolve(); + } + this.currentActive = activeKey; + const stack = []; + if (currentActive !== activeKey && children[currentActive]) { + stack.push(children[currentActive].setActive(false)); + } + if (children[activeKey]) { + stack.push(children[activeKey].setActive(true)); + } + return Promise.all(stack); + } + } +}); diff --git a/utils/dist/sidebar/index.json b/utils/dist/sidebar/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/sidebar/index.json +++ b/utils/dist/sidebar/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/sidebar/index.wxml b/utils/dist/sidebar/index.wxml index e64c19c..860aaa1 100644 --- a/utils/dist/sidebar/index.wxml +++ b/utils/dist/sidebar/index.wxml @@ -1,3 +1,3 @@ - - - + + + diff --git a/utils/dist/skeleton/index.d.ts b/utils/dist/skeleton/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/skeleton/index.d.ts +++ b/utils/dist/skeleton/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/skeleton/index.js b/utils/dist/skeleton/index.js index 4092bbd..0125afc 100644 --- a/utils/dist/skeleton/index.js +++ b/utils/dist/skeleton/index.js @@ -1,41 +1,41 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - row: { - type: Number, - value: 0 - }, - title: Boolean, - avatar: Boolean, - loading: { - type: Boolean, - value: true - }, - animate: { - type: Boolean, - value: true - }, - avatarSize: { - type: String, - value: '32px' - }, - avatarShape: { - type: String, - value: 'round' - }, - titleWidth: { - type: String, - value: '40%' - }, - rowWidth: { - type: null, - value: '100%', - observer(val) { - this.setData({ isArray: val instanceof Array }); - } - } - }, - data: { - isArray: false - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + row: { + type: Number, + value: 0 + }, + title: Boolean, + avatar: Boolean, + loading: { + type: Boolean, + value: true + }, + animate: { + type: Boolean, + value: true + }, + avatarSize: { + type: String, + value: '32px' + }, + avatarShape: { + type: String, + value: 'round' + }, + titleWidth: { + type: String, + value: '40%' + }, + rowWidth: { + type: null, + value: '100%', + observer(val) { + this.setData({ isArray: val instanceof Array }); + } + } + }, + data: { + isArray: false + } +}); diff --git a/utils/dist/skeleton/index.json b/utils/dist/skeleton/index.json index e8cfaaf..011372e 100644 --- a/utils/dist/skeleton/index.json +++ b/utils/dist/skeleton/index.json @@ -1,4 +1,4 @@ -{ - "component": true, - "usingComponents": {} +{ + "component": true, + "usingComponents": {} } \ No newline at end of file diff --git a/utils/dist/skeleton/index.wxml b/utils/dist/skeleton/index.wxml index 1177370..32d58d4 100644 --- a/utils/dist/skeleton/index.wxml +++ b/utils/dist/skeleton/index.wxml @@ -1,29 +1,29 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/utils/dist/slider/index.d.ts b/utils/dist/slider/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/slider/index.d.ts +++ b/utils/dist/slider/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/slider/index.js b/utils/dist/slider/index.js index 971e15e..3446600 100644 --- a/utils/dist/slider/index.js +++ b/utils/dist/slider/index.js @@ -1,107 +1,107 @@ -import { VantComponent } from '../common/component'; -import { touch } from '../mixins/touch'; -import { addUnit } from '../common/utils'; -VantComponent({ - mixins: [touch], - props: { - disabled: Boolean, - useButtonSlot: Boolean, - activeColor: String, - inactiveColor: String, - max: { - type: Number, - value: 100 - }, - min: { - type: Number, - value: 0 - }, - step: { - type: Number, - value: 1 - }, - value: { - type: Number, - value: 0 - }, - barHeight: { - type: null, - value: '2px' - } - }, - watch: { - value(value) { - this.updateValue(value, false); - } - }, - created() { - this.updateValue(this.data.value); - }, - methods: { - onTouchStart(event) { - if (this.data.disabled) - return; - this.touchStart(event); - this.startValue = this.format(this.data.value); - this.dragStatus = 'start'; - }, - onTouchMove(event) { - if (this.data.disabled) - return; - if (this.dragStatus === 'start') { - this.$emit('drag-start'); - } - this.touchMove(event); - this.dragStatus = 'draging'; - this.getRect('.van-slider').then((rect) => { - const diff = this.deltaX / rect.width * 100; - this.newValue = this.startValue + diff; - this.updateValue(this.newValue, false, true); - }); - }, - onTouchEnd() { - if (this.data.disabled) - return; - if (this.dragStatus === 'draging') { - this.updateValue(this.newValue, true); - this.$emit('drag-end'); - } - }, - onClick(event) { - if (this.data.disabled) - return; - const { min } = this.data; - this.getRect('.van-slider').then((rect) => { - const value = (event.detail.x - rect.left) / rect.width * this.getRange() + min; - this.updateValue(value, true); - }); - }, - updateValue(value, end, drag) { - value = this.format(value); - const { barHeight, min } = this.data; - const width = `${((value - min) * 100) / this.getRange()}%`; - this.setData({ - value, - barStyle: ` - width: ${width}; - height: ${addUnit(barHeight)}; - ${drag ? 'transition: none;' : ''} - `, - }); - if (drag) { - this.$emit('drag', { value }); - } - if (end) { - this.$emit('change', value); - } - }, - getRange() { - const { max, min } = this.data; - return max - min; - }, - format(value) { - const { max, min, step } = this.data; - return Math.round(Math.max(min, Math.min(value, max)) / step) * step; - } - } -}); +import { VantComponent } from '../common/component'; +import { touch } from '../mixins/touch'; +import { addUnit } from '../common/utils'; +VantComponent({ + mixins: [touch], + props: { + disabled: Boolean, + useButtonSlot: Boolean, + activeColor: String, + inactiveColor: String, + max: { + type: Number, + value: 100 + }, + min: { + type: Number, + value: 0 + }, + step: { + type: Number, + value: 1 + }, + value: { + type: Number, + value: 0 + }, + barHeight: { + type: null, + value: '2px' + } + }, + watch: { + value(value) { + this.updateValue(value, false); + } + }, + created() { + this.updateValue(this.data.value); + }, + methods: { + onTouchStart(event) { + if (this.data.disabled) + return; + this.touchStart(event); + this.startValue = this.format(this.data.value); + this.dragStatus = 'start'; + }, + onTouchMove(event) { + if (this.data.disabled) + return; + if (this.dragStatus === 'start') { + this.$emit('drag-start'); + } + this.touchMove(event); + this.dragStatus = 'draging'; + this.getRect('.van-slider').then((rect) => { + const diff = this.deltaX / rect.width * 100; + this.newValue = this.startValue + diff; + this.updateValue(this.newValue, false, true); + }); + }, + onTouchEnd() { + if (this.data.disabled) + return; + if (this.dragStatus === 'draging') { + this.updateValue(this.newValue, true); + this.$emit('drag-end'); + } + }, + onClick(event) { + if (this.data.disabled) + return; + const { min } = this.data; + this.getRect('.van-slider').then((rect) => { + const value = (event.detail.x - rect.left) / rect.width * this.getRange() + min; + this.updateValue(value, true); + }); + }, + updateValue(value, end, drag) { + value = this.format(value); + const { barHeight, min } = this.data; + const width = `${((value - min) * 100) / this.getRange()}%`; + this.setData({ + value, + barStyle: ` + width: ${width}; + height: ${addUnit(barHeight)}; + ${drag ? 'transition: none;' : ''} + `, + }); + if (drag) { + this.$emit('drag', { value }); + } + if (end) { + this.$emit('change', value); + } + }, + getRange() { + const { max, min } = this.data; + return max - min; + }, + format(value) { + const { max, min, step } = this.data; + return Math.round(Math.max(min, Math.min(value, max)) / step) * step; + } + } +}); diff --git a/utils/dist/slider/index.json b/utils/dist/slider/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/slider/index.json +++ b/utils/dist/slider/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/slider/index.wxml b/utils/dist/slider/index.wxml index d30d078..ad88663 100644 --- a/utils/dist/slider/index.wxml +++ b/utils/dist/slider/index.wxml @@ -1,29 +1,29 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/utils/dist/stepper/index.d.ts b/utils/dist/stepper/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/stepper/index.d.ts +++ b/utils/dist/stepper/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/stepper/index.js b/utils/dist/stepper/index.js index c242588..cbabecc 100644 --- a/utils/dist/stepper/index.js +++ b/utils/dist/stepper/index.js @@ -1,172 +1,172 @@ -import { VantComponent } from '../common/component'; -import { addUnit, isDef } from '../common/utils'; -const LONG_PRESS_START_TIME = 600; -const LONG_PRESS_INTERVAL = 200; -// add num and avoid float number -function add(num1, num2) { - const cardinal = Math.pow(10, 10); - return Math.round((num1 + num2) * cardinal) / cardinal; -} -VantComponent({ - field: true, - classes: ['input-class', 'plus-class', 'minus-class'], - props: { - value: null, - integer: Boolean, - disabled: Boolean, - inputWidth: null, - buttonSize: null, - asyncChange: Boolean, - disableInput: Boolean, - decimalLength: { - type: Number, - value: null - }, - min: { - type: null, - value: 1 - }, - max: { - type: null, - value: Number.MAX_SAFE_INTEGER - }, - step: { - type: null, - value: 1 - }, - showPlus: { - type: Boolean, - value: true - }, - showMinus: { - type: Boolean, - value: true - }, - disablePlus: Boolean, - disableMinus: Boolean - }, - watch: { - value(value) { - if (value === '') { - return; - } - const newValue = this.range(value); - if (typeof newValue === 'number' && +this.data.value !== newValue) { - this.setData({ value: newValue }); - } - }, - inputWidth() { - this.set({ - inputStyle: this.computeInputStyle() - }); - }, - buttonSize() { - this.set({ - inputStyle: this.computeInputStyle(), - buttonStyle: this.computeButtonStyle() - }); - } - }, - data: { - focus: false, - inputStyle: '', - buttonStyle: '' - }, - created() { - this.setData({ - value: this.range(this.data.value) - }); - }, - methods: { - isDisabled(type) { - if (type === 'plus') { - return this.data.disabled || this.data.disablePlus || this.data.value >= this.data.max; - } - return this.data.disabled || this.data.disableMinus || this.data.value <= this.data.min; - }, - onFocus(event) { - this.$emit('focus', event.detail); - }, - onBlur(event) { - const value = this.range(this.data.value); - this.triggerInput(value); - this.$emit('blur', event.detail); - }, - // limit value range - range(value) { - value = String(value).replace(/[^0-9.-]/g, ''); - // format range - value = value === '' ? 0 : +value; - value = Math.max(Math.min(this.data.max, value), this.data.min); - // format decimal - if (isDef(this.data.decimalLength)) { - value = value.toFixed(this.data.decimalLength); - } - return value; - }, - onInput(event) { - const { value = '' } = event.detail || {}; - this.triggerInput(value); - }, - onChange() { - const { type } = this; - if (this.isDisabled(type)) { - this.$emit('overlimit', type); - return; - } - const diff = type === 'minus' ? -this.data.step : +this.data.step; - const value = add(+this.data.value, diff); - this.triggerInput(this.range(value)); - this.$emit(type); - }, - longPressStep() { - this.longPressTimer = setTimeout(() => { - this.onChange(); - this.longPressStep(); - }, LONG_PRESS_INTERVAL); - }, - onTap(event) { - const { type } = event.currentTarget.dataset; - this.type = type; - this.onChange(); - }, - onTouchStart(event) { - clearTimeout(this.longPressTimer); - const { type } = event.currentTarget.dataset; - this.type = type; - this.isLongPress = false; - this.longPressTimer = setTimeout(() => { - this.isLongPress = true; - this.onChange(); - this.longPressStep(); - }, LONG_PRESS_START_TIME); - }, - onTouchEnd() { - clearTimeout(this.longPressTimer); - }, - triggerInput(value) { - this.setData({ - value: this.data.asyncChange ? this.data.value : value - }); - this.$emit('change', value); - }, - computeInputStyle() { - let style = ''; - if (this.data.inputWidth) { - style = `width: ${addUnit(this.data.inputWidth)};`; - } - if (this.data.buttonSize) { - style += `height: ${addUnit(this.data.buttonSize)};`; - } - return style; - }, - computeButtonStyle() { - let style = ''; - const size = addUnit(this.data.buttonSize); - if (this.data.buttonSize) { - style = `width: ${size};height: ${size};`; - } - return style; - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit, isDef } from '../common/utils'; +const LONG_PRESS_START_TIME = 600; +const LONG_PRESS_INTERVAL = 200; +// add num and avoid float number +function add(num1, num2) { + const cardinal = Math.pow(10, 10); + return Math.round((num1 + num2) * cardinal) / cardinal; +} +VantComponent({ + field: true, + classes: ['input-class', 'plus-class', 'minus-class'], + props: { + value: null, + integer: Boolean, + disabled: Boolean, + inputWidth: null, + buttonSize: null, + asyncChange: Boolean, + disableInput: Boolean, + decimalLength: { + type: Number, + value: null + }, + min: { + type: null, + value: 1 + }, + max: { + type: null, + value: Number.MAX_SAFE_INTEGER + }, + step: { + type: null, + value: 1 + }, + showPlus: { + type: Boolean, + value: true + }, + showMinus: { + type: Boolean, + value: true + }, + disablePlus: Boolean, + disableMinus: Boolean + }, + watch: { + value(value) { + if (value === '') { + return; + } + const newValue = this.range(value); + if (typeof newValue === 'number' && +this.data.value !== newValue) { + this.setData({ value: newValue }); + } + }, + inputWidth() { + this.set({ + inputStyle: this.computeInputStyle() + }); + }, + buttonSize() { + this.set({ + inputStyle: this.computeInputStyle(), + buttonStyle: this.computeButtonStyle() + }); + } + }, + data: { + focus: false, + inputStyle: '', + buttonStyle: '' + }, + created() { + this.setData({ + value: this.range(this.data.value) + }); + }, + methods: { + isDisabled(type) { + if (type === 'plus') { + return this.data.disabled || this.data.disablePlus || this.data.value >= this.data.max; + } + return this.data.disabled || this.data.disableMinus || this.data.value <= this.data.min; + }, + onFocus(event) { + this.$emit('focus', event.detail); + }, + onBlur(event) { + const value = this.range(this.data.value); + this.triggerInput(value); + this.$emit('blur', event.detail); + }, + // limit value range + range(value) { + value = String(value).replace(/[^0-9.-]/g, ''); + // format range + value = value === '' ? 0 : +value; + value = Math.max(Math.min(this.data.max, value), this.data.min); + // format decimal + if (isDef(this.data.decimalLength)) { + value = value.toFixed(this.data.decimalLength); + } + return value; + }, + onInput(event) { + const { value = '' } = event.detail || {}; + this.triggerInput(value); + }, + onChange() { + const { type } = this; + if (this.isDisabled(type)) { + this.$emit('overlimit', type); + return; + } + const diff = type === 'minus' ? -this.data.step : +this.data.step; + const value = add(+this.data.value, diff); + this.triggerInput(this.range(value)); + this.$emit(type); + }, + longPressStep() { + this.longPressTimer = setTimeout(() => { + this.onChange(); + this.longPressStep(); + }, LONG_PRESS_INTERVAL); + }, + onTap(event) { + const { type } = event.currentTarget.dataset; + this.type = type; + this.onChange(); + }, + onTouchStart(event) { + clearTimeout(this.longPressTimer); + const { type } = event.currentTarget.dataset; + this.type = type; + this.isLongPress = false; + this.longPressTimer = setTimeout(() => { + this.isLongPress = true; + this.onChange(); + this.longPressStep(); + }, LONG_PRESS_START_TIME); + }, + onTouchEnd() { + clearTimeout(this.longPressTimer); + }, + triggerInput(value) { + this.setData({ + value: this.data.asyncChange ? this.data.value : value + }); + this.$emit('change', value); + }, + computeInputStyle() { + let style = ''; + if (this.data.inputWidth) { + style = `width: ${addUnit(this.data.inputWidth)};`; + } + if (this.data.buttonSize) { + style += `height: ${addUnit(this.data.buttonSize)};`; + } + return style; + }, + computeButtonStyle() { + let style = ''; + const size = addUnit(this.data.buttonSize); + if (this.data.buttonSize) { + style = `width: ${size};height: ${size};`; + } + return style; + } + } +}); diff --git a/utils/dist/stepper/index.json b/utils/dist/stepper/index.json index 32640e0..1edff93 100644 --- a/utils/dist/stepper/index.json +++ b/utils/dist/stepper/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/stepper/index.wxml b/utils/dist/stepper/index.wxml index 456ccce..830e99a 100644 --- a/utils/dist/stepper/index.wxml +++ b/utils/dist/stepper/index.wxml @@ -1,37 +1,37 @@ - - - - - - - + + + + + + + diff --git a/utils/dist/steps/index.d.ts b/utils/dist/steps/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/steps/index.d.ts +++ b/utils/dist/steps/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/steps/index.js b/utils/dist/steps/index.js index 14b5f30..96479e1 100644 --- a/utils/dist/steps/index.js +++ b/utils/dist/steps/index.js @@ -1,22 +1,22 @@ -import { VantComponent } from '../common/component'; -import { GREEN } from '../common/color'; -VantComponent({ - props: { - icon: String, - steps: Array, - active: Number, - direction: { - type: String, - value: 'horizontal' - }, - activeColor: { - type: String, - value: GREEN - }, - activeIcon: { - type: String, - value: 'checked' - }, - inactiveIcon: String - } -}); +import { VantComponent } from '../common/component'; +import { GREEN } from '../common/color'; +VantComponent({ + props: { + icon: String, + steps: Array, + active: Number, + direction: { + type: String, + value: 'horizontal' + }, + activeColor: { + type: String, + value: GREEN + }, + activeIcon: { + type: String, + value: 'checked' + }, + inactiveIcon: String + } +}); diff --git a/utils/dist/steps/index.json b/utils/dist/steps/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/steps/index.json +++ b/utils/dist/steps/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/steps/index.wxml b/utils/dist/steps/index.wxml index 9e280d8..4abca82 100644 --- a/utils/dist/steps/index.wxml +++ b/utils/dist/steps/index.wxml @@ -1,51 +1,51 @@ - - - - - - - {{ item.text }} - {{ item.desc }} - - - - - - - - - - - - - - - -function get(index, active) { - if (index < active) { - return 'finish'; - } else if (index === active) { - return 'process'; - } - - return ''; -} - -module.exports = get; - + + + + + + + {{ item.text }} + {{ item.desc }} + + + + + + + + + + + + + + + +function get(index, active) { + if (index < active) { + return 'finish'; + } else if (index === active) { + return 'process'; + } + + return ''; +} + +module.exports = get; + diff --git a/utils/dist/sticky/index.d.ts b/utils/dist/sticky/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/sticky/index.d.ts +++ b/utils/dist/sticky/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/sticky/index.js b/utils/dist/sticky/index.js index 6b904a9..4c73a50 100644 --- a/utils/dist/sticky/index.js +++ b/utils/dist/sticky/index.js @@ -1,140 +1,140 @@ -import { VantComponent } from '../common/component'; -const ROOT_ELEMENT = '.van-sticky'; -VantComponent({ - props: { - zIndex: { - type: Number, - value: 99 - }, - offsetTop: { - type: Number, - value: 0, - observer: 'observeContent' - }, - disabled: { - type: Boolean, - observer(value) { - if (!this.mounted) { - return; - } - value ? this.disconnectObserver() : this.initObserver(); - } - }, - container: { - type: null, - observer(target) { - if (typeof target !== 'function' || !this.data.height) { - return; - } - this.observeContainer(); - } - } - }, - data: { - wrapStyle: '', - containerStyle: '' - }, - methods: { - setStyle() { - const { offsetTop, height, fixed, zIndex } = this.data; - if (fixed) { - this.setData({ - wrapStyle: `top: ${offsetTop}px;`, - containerStyle: `height: ${height}px; z-index: ${zIndex};` - }); - } - else { - this.setData({ - wrapStyle: '', - containerStyle: '' - }); - } - }, - getContainerRect() { - const nodesRef = this.data.container(); - return new Promise(resolve => nodesRef.boundingClientRect(resolve).exec()); - }, - initObserver() { - this.disconnectObserver(); - this.getRect(ROOT_ELEMENT).then((rect) => { - this.setData({ height: rect.height }); - wx.nextTick(() => { - this.observeContent(); - this.observeContainer(); - }); - }); - }, - disconnectObserver(observerName) { - if (observerName) { - const observer = this[observerName]; - observer && observer.disconnect(); - } - else { - this.contentObserver && this.contentObserver.disconnect(); - this.containerObserver && this.containerObserver.disconnect(); - } - }, - observeContent() { - const { offsetTop } = this.data; - this.disconnectObserver('contentObserver'); - const contentObserver = this.createIntersectionObserver({ - thresholds: [0, 1] - }); - this.contentObserver = contentObserver; - contentObserver.relativeToViewport({ top: -offsetTop }); - contentObserver.observe(ROOT_ELEMENT, res => { - if (this.data.disabled) { - return; - } - this.setFixed(res.boundingClientRect.top); - }); - }, - observeContainer() { - if (typeof this.data.container !== 'function') { - return; - } - const { height } = this.data; - this.getContainerRect().then((rect) => { - this.containerHeight = rect.height; - this.disconnectObserver('containerObserver'); - const containerObserver = this.createIntersectionObserver({ - thresholds: [0, 1] - }); - this.containerObserver = containerObserver; - containerObserver.relativeToViewport({ - top: this.containerHeight - height - }); - containerObserver.observe(ROOT_ELEMENT, res => { - if (this.data.disabled) { - return; - } - this.setFixed(res.boundingClientRect.top); - }); - }); - }, - setFixed(top) { - const { offsetTop, height } = this.data; - const { containerHeight } = this; - const fixed = containerHeight && height - ? top > height - containerHeight && top < offsetTop - : top < offsetTop; - this.$emit('scroll', { - scrollTop: top, - isFixed: fixed - }); - this.setData({ fixed }); - wx.nextTick(() => { - this.setStyle(); - }); - } - }, - mounted() { - this.mounted = true; - if (!this.data.disabled) { - this.initObserver(); - } - }, - destroyed() { - this.disconnectObserver(); - } -}); +import { VantComponent } from '../common/component'; +const ROOT_ELEMENT = '.van-sticky'; +VantComponent({ + props: { + zIndex: { + type: Number, + value: 99 + }, + offsetTop: { + type: Number, + value: 0, + observer: 'observeContent' + }, + disabled: { + type: Boolean, + observer(value) { + if (!this.mounted) { + return; + } + value ? this.disconnectObserver() : this.initObserver(); + } + }, + container: { + type: null, + observer(target) { + if (typeof target !== 'function' || !this.data.height) { + return; + } + this.observeContainer(); + } + } + }, + data: { + wrapStyle: '', + containerStyle: '' + }, + methods: { + setStyle() { + const { offsetTop, height, fixed, zIndex } = this.data; + if (fixed) { + this.setData({ + wrapStyle: `top: ${offsetTop}px;`, + containerStyle: `height: ${height}px; z-index: ${zIndex};` + }); + } + else { + this.setData({ + wrapStyle: '', + containerStyle: '' + }); + } + }, + getContainerRect() { + const nodesRef = this.data.container(); + return new Promise(resolve => nodesRef.boundingClientRect(resolve).exec()); + }, + initObserver() { + this.disconnectObserver(); + this.getRect(ROOT_ELEMENT).then((rect) => { + this.setData({ height: rect.height }); + wx.nextTick(() => { + this.observeContent(); + this.observeContainer(); + }); + }); + }, + disconnectObserver(observerName) { + if (observerName) { + const observer = this[observerName]; + observer && observer.disconnect(); + } + else { + this.contentObserver && this.contentObserver.disconnect(); + this.containerObserver && this.containerObserver.disconnect(); + } + }, + observeContent() { + const { offsetTop } = this.data; + this.disconnectObserver('contentObserver'); + const contentObserver = this.createIntersectionObserver({ + thresholds: [0, 1] + }); + this.contentObserver = contentObserver; + contentObserver.relativeToViewport({ top: -offsetTop }); + contentObserver.observe(ROOT_ELEMENT, res => { + if (this.data.disabled) { + return; + } + this.setFixed(res.boundingClientRect.top); + }); + }, + observeContainer() { + if (typeof this.data.container !== 'function') { + return; + } + const { height } = this.data; + this.getContainerRect().then((rect) => { + this.containerHeight = rect.height; + this.disconnectObserver('containerObserver'); + const containerObserver = this.createIntersectionObserver({ + thresholds: [0, 1] + }); + this.containerObserver = containerObserver; + containerObserver.relativeToViewport({ + top: this.containerHeight - height + }); + containerObserver.observe(ROOT_ELEMENT, res => { + if (this.data.disabled) { + return; + } + this.setFixed(res.boundingClientRect.top); + }); + }); + }, + setFixed(top) { + const { offsetTop, height } = this.data; + const { containerHeight } = this; + const fixed = containerHeight && height + ? top > height - containerHeight && top < offsetTop + : top < offsetTop; + this.$emit('scroll', { + scrollTop: top, + isFixed: fixed + }); + this.setData({ fixed }); + wx.nextTick(() => { + this.setStyle(); + }); + } + }, + mounted() { + this.mounted = true; + if (!this.data.disabled) { + this.initObserver(); + } + }, + destroyed() { + this.disconnectObserver(); + } +}); diff --git a/utils/dist/sticky/index.json b/utils/dist/sticky/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/sticky/index.json +++ b/utils/dist/sticky/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/sticky/index.wxml b/utils/dist/sticky/index.wxml index 2f95359..739929c 100644 --- a/utils/dist/sticky/index.wxml +++ b/utils/dist/sticky/index.wxml @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/utils/dist/submit-bar/index.d.ts b/utils/dist/submit-bar/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/submit-bar/index.d.ts +++ b/utils/dist/submit-bar/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/submit-bar/index.js b/utils/dist/submit-bar/index.js index 23a34da..1fe261b 100644 --- a/utils/dist/submit-bar/index.js +++ b/utils/dist/submit-bar/index.js @@ -1,57 +1,57 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - classes: [ - 'bar-class', - 'price-class', - 'button-class' - ], - props: { - tip: { - type: null, - observer: 'updateTip' - }, - tipIcon: String, - type: Number, - price: { - type: null, - observer: 'updatePrice' - }, - label: String, - loading: Boolean, - disabled: Boolean, - buttonText: String, - currency: { - type: String, - value: '¥' - }, - buttonType: { - type: String, - value: 'danger' - }, - decimalLength: { - type: Number, - value: 2, - observer: 'updatePrice' - }, - suffixLabel: String, - safeAreaInsetBottom: { - type: Boolean, - value: true - } - }, - methods: { - updatePrice() { - const { price, decimalLength } = this.data; - this.setData({ - hasPrice: typeof price === 'number', - priceStr: (price / 100).toFixed(decimalLength) - }); - }, - updateTip() { - this.setData({ hasTip: typeof this.data.tip === 'string' }); - }, - onSubmit(event) { - this.$emit('submit', event.detail); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + classes: [ + 'bar-class', + 'price-class', + 'button-class' + ], + props: { + tip: { + type: null, + observer: 'updateTip' + }, + tipIcon: String, + type: Number, + price: { + type: null, + observer: 'updatePrice' + }, + label: String, + loading: Boolean, + disabled: Boolean, + buttonText: String, + currency: { + type: String, + value: '¥' + }, + buttonType: { + type: String, + value: 'danger' + }, + decimalLength: { + type: Number, + value: 2, + observer: 'updatePrice' + }, + suffixLabel: String, + safeAreaInsetBottom: { + type: Boolean, + value: true + } + }, + methods: { + updatePrice() { + const { price, decimalLength } = this.data; + this.setData({ + hasPrice: typeof price === 'number', + priceStr: (price / 100).toFixed(decimalLength) + }); + }, + updateTip() { + this.setData({ hasTip: typeof this.data.tip === 'string' }); + }, + onSubmit(event) { + this.$emit('submit', event.detail); + } + } +}); diff --git a/utils/dist/submit-bar/index.json b/utils/dist/submit-bar/index.json index bda9b8d..61add22 100644 --- a/utils/dist/submit-bar/index.json +++ b/utils/dist/submit-bar/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-button": "../button/index", - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-button": "../button/index", + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/submit-bar/index.wxml b/utils/dist/submit-bar/index.wxml index 4cdbd18..dfded14 100644 --- a/utils/dist/submit-bar/index.wxml +++ b/utils/dist/submit-bar/index.wxml @@ -1,42 +1,42 @@ - - - - - - - - - {{ tip }} - - - - - - - - {{ label || '合计:' }} - - {{ currency }} - {{ priceStr }} - - {{ suffixLabel }} - - - {{ loading ? '' : buttonText }} - - - + + + + + + + + + {{ tip }} + + + + + + + + {{ label || '合计:' }} + + {{ currency }} + {{ priceStr }} + + {{ suffixLabel }} + + + {{ loading ? '' : buttonText }} + + + diff --git a/utils/dist/swipe-cell/index.d.ts b/utils/dist/swipe-cell/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/swipe-cell/index.d.ts +++ b/utils/dist/swipe-cell/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/swipe-cell/index.js b/utils/dist/swipe-cell/index.js index fa2e349..c6f4996 100644 --- a/utils/dist/swipe-cell/index.js +++ b/utils/dist/swipe-cell/index.js @@ -1,122 +1,122 @@ -import { VantComponent } from '../common/component'; -import { touch } from '../mixins/touch'; -import { range } from '../common/utils'; -const THRESHOLD = 0.3; -let ARRAY = []; -VantComponent({ - props: { - disabled: Boolean, - leftWidth: { - type: Number, - value: 0 - }, - rightWidth: { - type: Number, - value: 0 - }, - asyncClose: Boolean, - name: { - type: [Number, String], - value: '' - } - }, - mixins: [touch], - data: { - catchMove: false - }, - created() { - this.offset = 0; - ARRAY.push(this); - }, - destroyed() { - ARRAY = ARRAY.filter(item => item !== this); - }, - methods: { - open(position) { - const { leftWidth, rightWidth } = this.data; - const offset = position === 'left' ? leftWidth : -rightWidth; - this.swipeMove(offset); - this.$emit('open', { - position, - name: this.data.name - }); - }, - close() { - this.swipeMove(0); - }, - swipeMove(offset = 0) { - this.offset = range(offset, -this.data.rightWidth, this.data.leftWidth); - const transform = `translate3d(${this.offset}px, 0, 0)`; - const transition = this.dragging - ? 'none' - : 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)'; - this.setData({ - wrapperStyle: ` - -webkit-transform: ${transform}; - -webkit-transition: ${transition}; - transform: ${transform}; - transition: ${transition}; - ` - }); - }, - swipeLeaveTransition() { - const { leftWidth, rightWidth } = this.data; - const { offset } = this; - if (rightWidth > 0 && -offset > rightWidth * THRESHOLD) { - this.open('right'); - } - else if (leftWidth > 0 && offset > leftWidth * THRESHOLD) { - this.open('left'); - } - else { - this.swipeMove(0); - } - this.setData({ catchMove: false }); - }, - startDrag(event) { - if (this.data.disabled) { - return; - } - this.startOffset = this.offset; - this.touchStart(event); - }, - noop() { }, - onDrag(event) { - if (this.data.disabled) { - return; - } - this.touchMove(event); - if (this.direction !== 'horizontal') { - return; - } - this.dragging = true; - ARRAY.filter(item => item !== this).forEach(item => item.close()); - this.setData({ catchMove: true }); - this.swipeMove(this.startOffset + this.deltaX); - }, - endDrag() { - if (this.data.disabled) { - return; - } - this.dragging = false; - this.swipeLeaveTransition(); - }, - onClick(event) { - const { key: position = 'outside' } = event.currentTarget.dataset; - this.$emit('click', position); - if (!this.offset) { - return; - } - if (this.data.asyncClose) { - this.$emit('close', { - position, - instance: this, - name: this.data.name - }); - } - else { - this.swipeMove(0); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { touch } from '../mixins/touch'; +import { range } from '../common/utils'; +const THRESHOLD = 0.3; +let ARRAY = []; +VantComponent({ + props: { + disabled: Boolean, + leftWidth: { + type: Number, + value: 0 + }, + rightWidth: { + type: Number, + value: 0 + }, + asyncClose: Boolean, + name: { + type: [Number, String], + value: '' + } + }, + mixins: [touch], + data: { + catchMove: false + }, + created() { + this.offset = 0; + ARRAY.push(this); + }, + destroyed() { + ARRAY = ARRAY.filter(item => item !== this); + }, + methods: { + open(position) { + const { leftWidth, rightWidth } = this.data; + const offset = position === 'left' ? leftWidth : -rightWidth; + this.swipeMove(offset); + this.$emit('open', { + position, + name: this.data.name + }); + }, + close() { + this.swipeMove(0); + }, + swipeMove(offset = 0) { + this.offset = range(offset, -this.data.rightWidth, this.data.leftWidth); + const transform = `translate3d(${this.offset}px, 0, 0)`; + const transition = this.dragging + ? 'none' + : 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)'; + this.setData({ + wrapperStyle: ` + -webkit-transform: ${transform}; + -webkit-transition: ${transition}; + transform: ${transform}; + transition: ${transition}; + ` + }); + }, + swipeLeaveTransition() { + const { leftWidth, rightWidth } = this.data; + const { offset } = this; + if (rightWidth > 0 && -offset > rightWidth * THRESHOLD) { + this.open('right'); + } + else if (leftWidth > 0 && offset > leftWidth * THRESHOLD) { + this.open('left'); + } + else { + this.swipeMove(0); + } + this.setData({ catchMove: false }); + }, + startDrag(event) { + if (this.data.disabled) { + return; + } + this.startOffset = this.offset; + this.touchStart(event); + }, + noop() { }, + onDrag(event) { + if (this.data.disabled) { + return; + } + this.touchMove(event); + if (this.direction !== 'horizontal') { + return; + } + this.dragging = true; + ARRAY.filter(item => item !== this).forEach(item => item.close()); + this.setData({ catchMove: true }); + this.swipeMove(this.startOffset + this.deltaX); + }, + endDrag() { + if (this.data.disabled) { + return; + } + this.dragging = false; + this.swipeLeaveTransition(); + }, + onClick(event) { + const { key: position = 'outside' } = event.currentTarget.dataset; + this.$emit('click', position); + if (!this.offset) { + return; + } + if (this.data.asyncClose) { + this.$emit('close', { + position, + instance: this, + name: this.data.name + }); + } + else { + this.swipeMove(0); + } + } + } +}); diff --git a/utils/dist/swipe-cell/index.json b/utils/dist/swipe-cell/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/swipe-cell/index.json +++ b/utils/dist/swipe-cell/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/swipe-cell/index.wxml b/utils/dist/swipe-cell/index.wxml index 7293619..f710e41 100644 --- a/utils/dist/swipe-cell/index.wxml +++ b/utils/dist/swipe-cell/index.wxml @@ -1,20 +1,20 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/utils/dist/switch/index.d.ts b/utils/dist/switch/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/switch/index.d.ts +++ b/utils/dist/switch/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/switch/index.js b/utils/dist/switch/index.js index 4009817..6b9ea2f 100644 --- a/utils/dist/switch/index.js +++ b/utils/dist/switch/index.js @@ -1,51 +1,51 @@ -import { VantComponent } from '../common/component'; -import { BLUE, GRAY_DARK } from '../common/color'; -VantComponent({ - field: true, - classes: ['node-class'], - props: { - checked: null, - loading: Boolean, - disabled: Boolean, - activeColor: String, - inactiveColor: String, - size: { - type: String, - value: '30px' - }, - activeValue: { - type: null, - value: true - }, - inactiveValue: { - type: null, - value: false - } - }, - watch: { - checked(value) { - const loadingColor = this.getLoadingColor(value); - this.setData({ value, loadingColor }); - } - }, - created() { - const { checked: value } = this.data; - const loadingColor = this.getLoadingColor(value); - this.setData({ value, loadingColor }); - }, - methods: { - getLoadingColor(checked) { - const { activeColor, inactiveColor } = this.data; - return checked ? activeColor || BLUE : inactiveColor || GRAY_DARK; - }, - onClick() { - const { activeValue, inactiveValue } = this.data; - if (!this.data.disabled && !this.data.loading) { - const checked = this.data.checked === activeValue; - const value = checked ? inactiveValue : activeValue; - this.$emit('input', value); - this.$emit('change', value); - } - } - } -}); +import { VantComponent } from '../common/component'; +import { BLUE, GRAY_DARK } from '../common/color'; +VantComponent({ + field: true, + classes: ['node-class'], + props: { + checked: null, + loading: Boolean, + disabled: Boolean, + activeColor: String, + inactiveColor: String, + size: { + type: String, + value: '30px' + }, + activeValue: { + type: null, + value: true + }, + inactiveValue: { + type: null, + value: false + } + }, + watch: { + checked(value) { + const loadingColor = this.getLoadingColor(value); + this.setData({ value, loadingColor }); + } + }, + created() { + const { checked: value } = this.data; + const loadingColor = this.getLoadingColor(value); + this.setData({ value, loadingColor }); + }, + methods: { + getLoadingColor(checked) { + const { activeColor, inactiveColor } = this.data; + return checked ? activeColor || BLUE : inactiveColor || GRAY_DARK; + }, + onClick() { + const { activeValue, inactiveValue } = this.data; + if (!this.data.disabled && !this.data.loading) { + const checked = this.data.checked === activeValue; + const value = checked ? inactiveValue : activeValue; + this.$emit('input', value); + this.$emit('change', value); + } + } + } +}); diff --git a/utils/dist/switch/index.json b/utils/dist/switch/index.json index 01077f5..71a2515 100644 --- a/utils/dist/switch/index.json +++ b/utils/dist/switch/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-loading": "../loading/index" - } -} +{ + "component": true, + "usingComponents": { + "van-loading": "../loading/index" + } +} diff --git a/utils/dist/switch/index.wxml b/utils/dist/switch/index.wxml index 31a104d..4dc457e 100644 --- a/utils/dist/switch/index.wxml +++ b/utils/dist/switch/index.wxml @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + diff --git a/utils/dist/tab/index.d.ts b/utils/dist/tab/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/tab/index.d.ts +++ b/utils/dist/tab/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/tab/index.js b/utils/dist/tab/index.js index 555086b..498dd73 100644 --- a/utils/dist/tab/index.js +++ b/utils/dist/tab/index.js @@ -1,56 +1,56 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'tabs', - type: 'ancestor', - linked(target) { - this.parent = target; - }, - unlinked() { - this.parent = null; - } - }, - props: { - dot: Boolean, - info: null, - title: String, - disabled: Boolean, - titleStyle: String, - name: { - type: [Number, String], - value: '', - } - }, - data: { - active: false - }, - watch: { - title: 'update', - disabled: 'update', - dot: 'update', - info: 'update', - titleStyle: 'update' - }, - methods: { - getComputedName() { - if (this.data.name !== '') { - return this.data.name; - } - return this.index; - }, - updateRender(active, parent) { - const { data: parentData } = parent; - this.inited = this.inited || active; - this.setData({ - active, - shouldRender: this.inited || !parentData.lazyRender, - shouldShow: active || parentData.animated - }); - }, - update() { - if (this.parent) { - this.parent.updateTabs(); - } - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'tabs', + type: 'ancestor', + linked(target) { + this.parent = target; + }, + unlinked() { + this.parent = null; + } + }, + props: { + dot: Boolean, + info: null, + title: String, + disabled: Boolean, + titleStyle: String, + name: { + type: [Number, String], + value: '', + } + }, + data: { + active: false + }, + watch: { + title: 'update', + disabled: 'update', + dot: 'update', + info: 'update', + titleStyle: 'update' + }, + methods: { + getComputedName() { + if (this.data.name !== '') { + return this.data.name; + } + return this.index; + }, + updateRender(active, parent) { + const { data: parentData } = parent; + this.inited = this.inited || active; + this.setData({ + active, + shouldRender: this.inited || !parentData.lazyRender, + shouldShow: active || parentData.animated + }); + }, + update() { + if (this.parent) { + this.parent.updateTabs(); + } + } + } +}); diff --git a/utils/dist/tab/index.json b/utils/dist/tab/index.json index 32640e0..1edff93 100644 --- a/utils/dist/tab/index.json +++ b/utils/dist/tab/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/tab/index.wxml b/utils/dist/tab/index.wxml index f5e99f2..6acf5ae 100644 --- a/utils/dist/tab/index.wxml +++ b/utils/dist/tab/index.wxml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/utils/dist/tabbar-item/index.d.ts b/utils/dist/tabbar-item/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/tabbar-item/index.d.ts +++ b/utils/dist/tabbar-item/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/tabbar-item/index.js b/utils/dist/tabbar-item/index.js index bd5fccf..3f4aba3 100644 --- a/utils/dist/tabbar-item/index.js +++ b/utils/dist/tabbar-item/index.js @@ -1,47 +1,47 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - info: null, - name: null, - icon: String, - dot: Boolean - }, - relation: { - name: 'tabbar', - type: 'ancestor' - }, - data: { - active: false - }, - methods: { - onClick() { - if (this.parent) { - this.parent.onChange(this); - } - this.$emit('click'); - }, - updateFromParent() { - const { parent } = this; - if (!parent) { - return; - } - const index = parent.children.indexOf(this); - const parentData = parent.data; - const { data } = this; - const active = (data.name || index) === parentData.active; - const patch = {}; - if (active !== data.active) { - patch.active = active; - } - if (parentData.activeColor !== data.activeColor) { - patch.activeColor = parentData.activeColor; - } - if (parentData.inactiveColor !== data.inactiveColor) { - patch.inactiveColor = parentData.inactiveColor; - } - return Object.keys(patch).length > 0 - ? this.set(patch) - : Promise.resolve(); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + info: null, + name: null, + icon: String, + dot: Boolean + }, + relation: { + name: 'tabbar', + type: 'ancestor' + }, + data: { + active: false + }, + methods: { + onClick() { + if (this.parent) { + this.parent.onChange(this); + } + this.$emit('click'); + }, + updateFromParent() { + const { parent } = this; + if (!parent) { + return; + } + const index = parent.children.indexOf(this); + const parentData = parent.data; + const { data } = this; + const active = (data.name || index) === parentData.active; + const patch = {}; + if (active !== data.active) { + patch.active = active; + } + if (parentData.activeColor !== data.activeColor) { + patch.activeColor = parentData.activeColor; + } + if (parentData.inactiveColor !== data.inactiveColor) { + patch.inactiveColor = parentData.inactiveColor; + } + return Object.keys(patch).length > 0 + ? this.set(patch) + : Promise.resolve(); + } + } +}); diff --git a/utils/dist/tabbar-item/index.json b/utils/dist/tabbar-item/index.json index 16f174c..8ed8bcd 100644 --- a/utils/dist/tabbar-item/index.json +++ b/utils/dist/tabbar-item/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-info": "../info/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-info": "../info/index" + } +} diff --git a/utils/dist/tabbar-item/index.wxml b/utils/dist/tabbar-item/index.wxml index d83b061..a72253b 100644 --- a/utils/dist/tabbar-item/index.wxml +++ b/utils/dist/tabbar-item/index.wxml @@ -1,30 +1,30 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/utils/dist/tabbar/index.d.ts b/utils/dist/tabbar/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/tabbar/index.d.ts +++ b/utils/dist/tabbar/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/tabbar/index.js b/utils/dist/tabbar/index.js index b227644..e9a91ba 100644 --- a/utils/dist/tabbar/index.js +++ b/utils/dist/tabbar/index.js @@ -1,65 +1,65 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - relation: { - name: 'tabbar-item', - type: 'descendant', - linked(target) { - this.children.push(target); - target.parent = this; - target.updateFromParent(); - }, - unlinked(target) { - this.children = this.children.filter((item) => item !== target); - this.updateChildren(); - } - }, - props: { - active: { - type: null, - observer: 'updateChildren' - }, - activeColor: { - type: String, - observer: 'updateChildren' - }, - inactiveColor: { - type: String, - observer: 'updateChildren' - }, - fixed: { - type: Boolean, - value: true - }, - border: { - type: Boolean, - value: true - }, - zIndex: { - type: Number, - value: 1 - }, - safeAreaInsetBottom: { - type: Boolean, - value: true - } - }, - beforeCreate() { - this.children = []; - }, - methods: { - updateChildren() { - const { children } = this; - if (!Array.isArray(children) || !children.length) { - return Promise.resolve(); - } - return Promise.all(children.map((child) => child.updateFromParent())); - }, - onChange(child) { - const index = this.children.indexOf(child); - const active = child.data.name || index; - if (active !== this.data.active) { - this.$emit('change', active); - } - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + relation: { + name: 'tabbar-item', + type: 'descendant', + linked(target) { + this.children.push(target); + target.parent = this; + target.updateFromParent(); + }, + unlinked(target) { + this.children = this.children.filter((item) => item !== target); + this.updateChildren(); + } + }, + props: { + active: { + type: null, + observer: 'updateChildren' + }, + activeColor: { + type: String, + observer: 'updateChildren' + }, + inactiveColor: { + type: String, + observer: 'updateChildren' + }, + fixed: { + type: Boolean, + value: true + }, + border: { + type: Boolean, + value: true + }, + zIndex: { + type: Number, + value: 1 + }, + safeAreaInsetBottom: { + type: Boolean, + value: true + } + }, + beforeCreate() { + this.children = []; + }, + methods: { + updateChildren() { + const { children } = this; + if (!Array.isArray(children) || !children.length) { + return Promise.resolve(); + } + return Promise.all(children.map((child) => child.updateFromParent())); + }, + onChange(child) { + const index = this.children.indexOf(child); + const active = child.data.name || index; + if (active !== this.data.active) { + this.$emit('change', active); + } + } + } +}); diff --git a/utils/dist/tabbar/index.json b/utils/dist/tabbar/index.json index 467ce29..efdc3c8 100644 --- a/utils/dist/tabbar/index.json +++ b/utils/dist/tabbar/index.json @@ -1,3 +1,3 @@ -{ - "component": true -} +{ + "component": true +} diff --git a/utils/dist/tabbar/index.wxml b/utils/dist/tabbar/index.wxml index c49b9d9..b7b06e8 100644 --- a/utils/dist/tabbar/index.wxml +++ b/utils/dist/tabbar/index.wxml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/utils/dist/tabs/index.d.ts b/utils/dist/tabs/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/tabs/index.d.ts +++ b/utils/dist/tabs/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/tabs/index.js b/utils/dist/tabs/index.js index 8ba4002..5a92e09 100644 --- a/utils/dist/tabs/index.js +++ b/utils/dist/tabs/index.js @@ -1,289 +1,289 @@ -import { VantComponent } from '../common/component'; -import { touch } from '../mixins/touch'; -import { isDef, addUnit } from '../common/utils'; -VantComponent({ - mixins: [touch], - classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'], - relation: { - name: 'tab', - type: 'descendant', - linked(target) { - target.index = this.children.length; - this.children.push(target); - this.updateTabs(); - }, - unlinked(target) { - this.children = this.children - .filter((child) => child !== target) - .map((child, index) => { - child.index = index; - return child; - }); - this.updateTabs(); - } - }, - props: { - color: { - type: String, - observer: 'setLine' - }, - sticky: Boolean, - animated: { - type: Boolean, - observer() { - this.setTrack(); - this.children.forEach((child) => child.updateRender()); - } - }, - swipeable: Boolean, - lineWidth: { - type: [String, Number], - value: -1, - observer: 'setLine' - }, - lineHeight: { - type: [String, Number], - value: -1, - observer: 'setLine' - }, - titleActiveColor: String, - titleInactiveColor: String, - active: { - type: [String, Number], - value: 0, - observer(name) { - if (name !== this.getCurrentName()) { - this.setCurrentIndexByName(name); - } - } - }, - type: { - type: String, - value: 'line' - }, - border: { - type: Boolean, - value: true - }, - ellipsis: { - type: Boolean, - value: true - }, - duration: { - type: Number, - value: 0.3 - }, - zIndex: { - type: Number, - value: 1 - }, - swipeThreshold: { - type: Number, - value: 4, - observer(value) { - this.setData({ - scrollable: this.children.length > value || !this.data.ellipsis - }); - } - }, - offsetTop: { - type: Number, - value: 0 - }, - lazyRender: { - type: Boolean, - value: true - }, - }, - data: { - tabs: [], - lineStyle: '', - scrollLeft: 0, - scrollable: false, - trackStyle: '', - currentIndex: null, - container: null - }, - beforeCreate() { - this.children = []; - }, - mounted() { - this.setData({ - container: () => this.createSelectorQuery().select('.van-tabs') - }); - this.setLine(true); - this.setTrack(); - this.scrollIntoView(); - }, - methods: { - updateTabs() { - const { children = [], data } = this; - this.setData({ - tabs: children.map((child) => child.data), - scrollable: this.children.length > data.swipeThreshold || !data.ellipsis - }); - this.setCurrentIndexByName(this.getCurrentName() || data.active); - }, - trigger(eventName) { - const { currentIndex } = this.data; - const child = this.children[currentIndex]; - if (!isDef(child)) { - return; - } - this.$emit(eventName, { - index: currentIndex, - name: child.getComputedName(), - title: child.data.title - }); - }, - onTap(event) { - const { index } = event.currentTarget.dataset; - const child = this.children[index]; - if (child.data.disabled) { - this.trigger('disabled'); - } - else { - this.setCurrentIndex(index); - wx.nextTick(() => { - this.trigger('click'); - }); - } - }, - // correct the index of active tab - setCurrentIndexByName(name) { - const { children = [] } = this; - const matched = children.filter((child) => child.getComputedName() === name); - if (matched.length) { - this.setCurrentIndex(matched[0].index); - } - }, - setCurrentIndex(currentIndex) { - const { data, children = [] } = this; - if (!isDef(currentIndex) || - currentIndex >= children.length || - currentIndex < 0) { - return; - } - children.forEach((item, index) => { - const active = index === currentIndex; - if (active !== item.data.active || !item.inited) { - item.updateRender(active, this); - } - }); - if (currentIndex === data.currentIndex) { - return; - } - const shouldEmitChange = data.currentIndex !== null; - this.setData({ currentIndex }); - wx.nextTick(() => { - this.setLine(); - this.setTrack(); - this.scrollIntoView(); - this.trigger('input'); - if (shouldEmitChange) { - this.trigger('change'); - } - }); - }, - getCurrentName() { - const activeTab = this.children[this.data.currentIndex]; - if (activeTab) { - return activeTab.getComputedName(); - } - }, - setLine(skipTransition) { - if (this.data.type !== 'line') { - return; - } - const { color, duration, currentIndex, lineWidth, lineHeight } = this.data; - this.getRect('.van-tab', true).then((rects = []) => { - const rect = rects[currentIndex]; - if (rect == null) { - return; - } - const width = lineWidth !== -1 ? lineWidth : rect.width / 2; - const height = lineHeight !== -1 - ? `height: ${addUnit(lineHeight)}; border-radius: ${addUnit(lineHeight)};` - : ''; - let left = rects - .slice(0, currentIndex) - .reduce((prev, curr) => prev + curr.width, 0); - left += (rect.width - width) / 2; - const transition = skipTransition - ? '' - : `transition-duration: ${duration}s; -webkit-transition-duration: ${duration}s;`; - this.setData({ - lineStyle: ` - ${height} - width: ${addUnit(width)}; - background-color: ${color}; - -webkit-transform: translateX(${left}px); - transform: translateX(${left}px); - ${transition} - ` - }); - }); - }, - setTrack() { - const { animated, duration, currentIndex } = this.data; - if (!animated) { - return; - } - this.setData({ - trackStyle: ` - transform: translate3d(${-100 * currentIndex}%, 0, 0); - -webkit-transition-duration: ${duration}s; - transition-duration: ${duration}s; - ` - }); - }, - // scroll active tab into view - scrollIntoView() { - const { currentIndex, scrollable } = this.data; - if (!scrollable) { - return; - } - Promise.all([ - this.getRect('.van-tab', true), - this.getRect('.van-tabs__nav') - ]).then(([tabRects, navRect]) => { - const tabRect = tabRects[currentIndex]; - const offsetLeft = tabRects - .slice(0, currentIndex) - .reduce((prev, curr) => prev + curr.width, 0); - this.setData({ - scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2 - }); - }); - }, - onTouchScroll(event) { - this.$emit('scroll', event.detail); - }, - onTouchStart(event) { - if (!this.data.swipeable) - return; - this.touchStart(event); - }, - onTouchMove(event) { - if (!this.data.swipeable) - return; - this.touchMove(event); - }, - // watch swipe touch end - onTouchEnd() { - if (!this.data.swipeable) - return; - const { tabs, currentIndex } = this.data; - const { direction, deltaX, offsetX } = this; - const minSwipeDistance = 50; - if (direction === 'horizontal' && offsetX >= minSwipeDistance) { - if (deltaX > 0 && currentIndex !== 0) { - this.setCurrentIndex(currentIndex - 1); - } - else if (deltaX < 0 && currentIndex !== tabs.length - 1) { - this.setCurrentIndex(currentIndex + 1); - } - } - } - } -}); +import { VantComponent } from '../common/component'; +import { touch } from '../mixins/touch'; +import { isDef, addUnit } from '../common/utils'; +VantComponent({ + mixins: [touch], + classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'], + relation: { + name: 'tab', + type: 'descendant', + linked(target) { + target.index = this.children.length; + this.children.push(target); + this.updateTabs(); + }, + unlinked(target) { + this.children = this.children + .filter((child) => child !== target) + .map((child, index) => { + child.index = index; + return child; + }); + this.updateTabs(); + } + }, + props: { + color: { + type: String, + observer: 'setLine' + }, + sticky: Boolean, + animated: { + type: Boolean, + observer() { + this.setTrack(); + this.children.forEach((child) => child.updateRender()); + } + }, + swipeable: Boolean, + lineWidth: { + type: [String, Number], + value: -1, + observer: 'setLine' + }, + lineHeight: { + type: [String, Number], + value: -1, + observer: 'setLine' + }, + titleActiveColor: String, + titleInactiveColor: String, + active: { + type: [String, Number], + value: 0, + observer(name) { + if (name !== this.getCurrentName()) { + this.setCurrentIndexByName(name); + } + } + }, + type: { + type: String, + value: 'line' + }, + border: { + type: Boolean, + value: true + }, + ellipsis: { + type: Boolean, + value: true + }, + duration: { + type: Number, + value: 0.3 + }, + zIndex: { + type: Number, + value: 1 + }, + swipeThreshold: { + type: Number, + value: 4, + observer(value) { + this.setData({ + scrollable: this.children.length > value || !this.data.ellipsis + }); + } + }, + offsetTop: { + type: Number, + value: 0 + }, + lazyRender: { + type: Boolean, + value: true + }, + }, + data: { + tabs: [], + lineStyle: '', + scrollLeft: 0, + scrollable: false, + trackStyle: '', + currentIndex: null, + container: null + }, + beforeCreate() { + this.children = []; + }, + mounted() { + this.setData({ + container: () => this.createSelectorQuery().select('.van-tabs') + }); + this.setLine(true); + this.setTrack(); + this.scrollIntoView(); + }, + methods: { + updateTabs() { + const { children = [], data } = this; + this.setData({ + tabs: children.map((child) => child.data), + scrollable: this.children.length > data.swipeThreshold || !data.ellipsis + }); + this.setCurrentIndexByName(this.getCurrentName() || data.active); + }, + trigger(eventName) { + const { currentIndex } = this.data; + const child = this.children[currentIndex]; + if (!isDef(child)) { + return; + } + this.$emit(eventName, { + index: currentIndex, + name: child.getComputedName(), + title: child.data.title + }); + }, + onTap(event) { + const { index } = event.currentTarget.dataset; + const child = this.children[index]; + if (child.data.disabled) { + this.trigger('disabled'); + } + else { + this.setCurrentIndex(index); + wx.nextTick(() => { + this.trigger('click'); + }); + } + }, + // correct the index of active tab + setCurrentIndexByName(name) { + const { children = [] } = this; + const matched = children.filter((child) => child.getComputedName() === name); + if (matched.length) { + this.setCurrentIndex(matched[0].index); + } + }, + setCurrentIndex(currentIndex) { + const { data, children = [] } = this; + if (!isDef(currentIndex) || + currentIndex >= children.length || + currentIndex < 0) { + return; + } + children.forEach((item, index) => { + const active = index === currentIndex; + if (active !== item.data.active || !item.inited) { + item.updateRender(active, this); + } + }); + if (currentIndex === data.currentIndex) { + return; + } + const shouldEmitChange = data.currentIndex !== null; + this.setData({ currentIndex }); + wx.nextTick(() => { + this.setLine(); + this.setTrack(); + this.scrollIntoView(); + this.trigger('input'); + if (shouldEmitChange) { + this.trigger('change'); + } + }); + }, + getCurrentName() { + const activeTab = this.children[this.data.currentIndex]; + if (activeTab) { + return activeTab.getComputedName(); + } + }, + setLine(skipTransition) { + if (this.data.type !== 'line') { + return; + } + const { color, duration, currentIndex, lineWidth, lineHeight } = this.data; + this.getRect('.van-tab', true).then((rects = []) => { + const rect = rects[currentIndex]; + if (rect == null) { + return; + } + const width = lineWidth !== -1 ? lineWidth : rect.width / 2; + const height = lineHeight !== -1 + ? `height: ${addUnit(lineHeight)}; border-radius: ${addUnit(lineHeight)};` + : ''; + let left = rects + .slice(0, currentIndex) + .reduce((prev, curr) => prev + curr.width, 0); + left += (rect.width - width) / 2; + const transition = skipTransition + ? '' + : `transition-duration: ${duration}s; -webkit-transition-duration: ${duration}s;`; + this.setData({ + lineStyle: ` + ${height} + width: ${addUnit(width)}; + background-color: ${color}; + -webkit-transform: translateX(${left}px); + transform: translateX(${left}px); + ${transition} + ` + }); + }); + }, + setTrack() { + const { animated, duration, currentIndex } = this.data; + if (!animated) { + return; + } + this.setData({ + trackStyle: ` + transform: translate3d(${-100 * currentIndex}%, 0, 0); + -webkit-transition-duration: ${duration}s; + transition-duration: ${duration}s; + ` + }); + }, + // scroll active tab into view + scrollIntoView() { + const { currentIndex, scrollable } = this.data; + if (!scrollable) { + return; + } + Promise.all([ + this.getRect('.van-tab', true), + this.getRect('.van-tabs__nav') + ]).then(([tabRects, navRect]) => { + const tabRect = tabRects[currentIndex]; + const offsetLeft = tabRects + .slice(0, currentIndex) + .reduce((prev, curr) => prev + curr.width, 0); + this.setData({ + scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2 + }); + }); + }, + onTouchScroll(event) { + this.$emit('scroll', event.detail); + }, + onTouchStart(event) { + if (!this.data.swipeable) + return; + this.touchStart(event); + }, + onTouchMove(event) { + if (!this.data.swipeable) + return; + this.touchMove(event); + }, + // watch swipe touch end + onTouchEnd() { + if (!this.data.swipeable) + return; + const { tabs, currentIndex } = this.data; + const { direction, deltaX, offsetX } = this; + const minSwipeDistance = 50; + if (direction === 'horizontal' && offsetX >= minSwipeDistance) { + if (deltaX > 0 && currentIndex !== 0) { + this.setCurrentIndex(currentIndex - 1); + } + else if (deltaX < 0 && currentIndex !== tabs.length - 1) { + this.setCurrentIndex(currentIndex + 1); + } + } + } + } +}); diff --git a/utils/dist/tabs/index.json b/utils/dist/tabs/index.json index 19c0bc3..7bf32aa 100644 --- a/utils/dist/tabs/index.json +++ b/utils/dist/tabs/index.json @@ -1,7 +1,7 @@ -{ - "component": true, - "usingComponents": { - "van-info": "../info/index", - "van-sticky": "../sticky/index" - } -} +{ + "component": true, + "usingComponents": { + "van-info": "../info/index", + "van-sticky": "../sticky/index" + } +} diff --git a/utils/dist/tabs/index.wxml b/utils/dist/tabs/index.wxml index ed8f0d9..8ce78f3 100644 --- a/utils/dist/tabs/index.wxml +++ b/utils/dist/tabs/index.wxml @@ -1,60 +1,60 @@ - - - - - - - - - - - - - - {{ item.title }} - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + {{ item.title }} + + + + + + + + + + + + + + + + diff --git a/utils/dist/tabs/index.wxs b/utils/dist/tabs/index.wxs index aa117ce..aeb12e9 100644 --- a/utils/dist/tabs/index.wxs +++ b/utils/dist/tabs/index.wxs @@ -1,55 +1,55 @@ -/* eslint-disable */ -function tabClass(active, ellipsis) { - var classes = ['tab-class']; - - if (active) { - classes.push('tab-active-class'); - } - - if (ellipsis) { - classes.push('van-ellipsis'); - } - - return classes.join(' '); -} - -function tabStyle( - active, - ellipsis, - color, - type, - disabled, - activeColor, - inactiveColor, - swipeThreshold, - scrollable -) { - var styles = []; - var isCard = type === 'card'; - // card theme color - if (color && isCard) { - styles.push('border-color:' + color); - - if (!disabled) { - if (active) { - styles.push('background-color:' + color); - } else { - styles.push('color:' + color); - } - } - } - - var titleColor = active ? activeColor : inactiveColor; - if (titleColor) { - styles.push('color:' + titleColor); - } - - if (scrollable && ellipsis) { - styles.push('flex-basis:' + 88 / swipeThreshold + '%'); - } - - return styles.join(';'); -} - -module.exports.tabClass = tabClass; -module.exports.tabStyle = tabStyle; +/* eslint-disable */ +function tabClass(active, ellipsis) { + var classes = ['tab-class']; + + if (active) { + classes.push('tab-active-class'); + } + + if (ellipsis) { + classes.push('van-ellipsis'); + } + + return classes.join(' '); +} + +function tabStyle( + active, + ellipsis, + color, + type, + disabled, + activeColor, + inactiveColor, + swipeThreshold, + scrollable +) { + var styles = []; + var isCard = type === 'card'; + // card theme color + if (color && isCard) { + styles.push('border-color:' + color); + + if (!disabled) { + if (active) { + styles.push('background-color:' + color); + } else { + styles.push('color:' + color); + } + } + } + + var titleColor = active ? activeColor : inactiveColor; + if (titleColor) { + styles.push('color:' + titleColor); + } + + if (scrollable && ellipsis) { + styles.push('flex-basis:' + 88 / swipeThreshold + '%'); + } + + return styles.join(';'); +} + +module.exports.tabClass = tabClass; +module.exports.tabStyle = tabStyle; diff --git a/utils/dist/tag/index.d.ts b/utils/dist/tag/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/tag/index.d.ts +++ b/utils/dist/tag/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/tag/index.js b/utils/dist/tag/index.js index 093acb5..1295e4e 100644 --- a/utils/dist/tag/index.js +++ b/utils/dist/tag/index.js @@ -1,21 +1,21 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - size: String, - mark: Boolean, - color: String, - plain: Boolean, - round: Boolean, - textColor: String, - type: { - type: String, - value: 'default' - }, - closeable: Boolean - }, - methods: { - onClose() { - this.$emit('close'); - } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + size: String, + mark: Boolean, + color: String, + plain: Boolean, + round: Boolean, + textColor: String, + type: { + type: String, + value: 'default' + }, + closeable: Boolean + }, + methods: { + onClose() { + this.$emit('close'); + } + } +}); diff --git a/utils/dist/tag/index.json b/utils/dist/tag/index.json index 32640e0..1edff93 100644 --- a/utils/dist/tag/index.json +++ b/utils/dist/tag/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/tag/index.wxml b/utils/dist/tag/index.wxml index 8c78686..a7de30e 100644 --- a/utils/dist/tag/index.wxml +++ b/utils/dist/tag/index.wxml @@ -1,14 +1,14 @@ - - - - - - + + + + + + diff --git a/utils/dist/toast/index.d.ts b/utils/dist/toast/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/toast/index.d.ts +++ b/utils/dist/toast/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/toast/index.js b/utils/dist/toast/index.js index a9fe162..203cc55 100644 --- a/utils/dist/toast/index.js +++ b/utils/dist/toast/index.js @@ -1,29 +1,29 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - show: Boolean, - mask: Boolean, - message: String, - forbidClick: Boolean, - zIndex: { - type: Number, - value: 1000 - }, - type: { - type: String, - value: 'text' - }, - loadingType: { - type: String, - value: 'circular' - }, - position: { - type: String, - value: 'middle' - } - }, - methods: { - // for prevent touchmove - noop() { } - } -}); +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + show: Boolean, + mask: Boolean, + message: String, + forbidClick: Boolean, + zIndex: { + type: Number, + value: 1000 + }, + type: { + type: String, + value: 'text' + }, + loadingType: { + type: String, + value: 'circular' + }, + position: { + type: String, + value: 'middle' + } + }, + methods: { + // for prevent touchmove + noop() { } + } +}); diff --git a/utils/dist/toast/index.json b/utils/dist/toast/index.json index 9b1b78c..5971bb1 100644 --- a/utils/dist/toast/index.json +++ b/utils/dist/toast/index.json @@ -1,9 +1,9 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-loading": "../loading/index", - "van-overlay": "../overlay/index", - "van-transition": "../transition/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index", + "van-overlay": "../overlay/index", + "van-transition": "../transition/index" + } +} diff --git a/utils/dist/toast/index.wxml b/utils/dist/toast/index.wxml index 635e7d6..6a53bda 100644 --- a/utils/dist/toast/index.wxml +++ b/utils/dist/toast/index.wxml @@ -1,33 +1,33 @@ - - - - - {{ message }} - - - - - - {{ message }} - - - - - + + + + + {{ message }} + + + + + + {{ message }} + + + + + diff --git a/utils/dist/toast/toast.d.ts b/utils/dist/toast/toast.d.ts index f7148a0..2d21ed3 100644 --- a/utils/dist/toast/toast.d.ts +++ b/utils/dist/toast/toast.d.ts @@ -1,26 +1,26 @@ -/// -declare type ToastMessage = string | number; -interface ToastOptions { - show?: boolean; - type?: string; - mask?: boolean; - zIndex?: number; - context?: WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance; - position?: string; - duration?: number; - selector?: string; - forbidClick?: boolean; - loadingType?: string; - message?: ToastMessage; - onClose?: () => void; -} -declare function Toast(toastOptions: ToastOptions | ToastMessage): WechatMiniprogram.Component.TrivialInstance; -declare namespace Toast { - var loading: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance, Record, Record>; - var success: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance, Record, Record>; - var fail: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance, Record, Record>; - var clear: () => void; - var setDefaultOptions: (options: ToastOptions) => void; - var resetDefaultOptions: () => void; -} -export default Toast; +/// +declare type ToastMessage = string | number; +interface ToastOptions { + show?: boolean; + type?: string; + mask?: boolean; + zIndex?: number; + context?: WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance; + position?: string; + duration?: number; + selector?: string; + forbidClick?: boolean; + loadingType?: string; + message?: ToastMessage; + onClose?: () => void; +} +declare function Toast(toastOptions: ToastOptions | ToastMessage): WechatMiniprogram.Component.TrivialInstance; +declare namespace Toast { + var loading: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance, Record, Record>; + var success: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance, Record, Record>; + var fail: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance, Record, Record>; + var clear: () => void; + var setDefaultOptions: (options: ToastOptions) => void; + var resetDefaultOptions: () => void; +} +export default Toast; diff --git a/utils/dist/toast/toast.js b/utils/dist/toast/toast.js index ed5a894..400154f 100644 --- a/utils/dist/toast/toast.js +++ b/utils/dist/toast/toast.js @@ -1,66 +1,66 @@ -import { isObj } from '../common/utils'; -const defaultOptions = { - type: 'text', - mask: false, - message: '', - show: true, - zIndex: 1000, - duration: 2000, - position: 'middle', - forbidClick: false, - loadingType: 'circular', - selector: '#van-toast' -}; -let queue = []; -let currentOptions = Object.assign({}, defaultOptions); -function parseOptions(message) { - return isObj(message) ? message : { message }; -} -function getContext() { - const pages = getCurrentPages(); - return pages[pages.length - 1]; -} -function Toast(toastOptions) { - const options = Object.assign(Object.assign({}, currentOptions), parseOptions(toastOptions)); - const context = options.context || getContext(); - const toast = context.selectComponent(options.selector); - if (!toast) { - console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确'); - return; - } - delete options.context; - delete options.selector; - toast.clear = () => { - toast.setData({ show: false }); - if (options.onClose) { - options.onClose(); - } - }; - queue.push(toast); - toast.setData(options); - clearTimeout(toast.timer); - if (options.duration > 0) { - toast.timer = setTimeout(() => { - toast.clear(); - queue = queue.filter(item => item !== toast); - }, options.duration); - } - return toast; -} -const createMethod = (type) => (options) => Toast(Object.assign({ type }, parseOptions(options))); -Toast.loading = createMethod('loading'); -Toast.success = createMethod('success'); -Toast.fail = createMethod('fail'); -Toast.clear = () => { - queue.forEach(toast => { - toast.clear(); - }); - queue = []; -}; -Toast.setDefaultOptions = (options) => { - Object.assign(currentOptions, options); -}; -Toast.resetDefaultOptions = () => { - currentOptions = Object.assign({}, defaultOptions); -}; -export default Toast; +import { isObj } from '../common/utils'; +const defaultOptions = { + type: 'text', + mask: false, + message: '', + show: true, + zIndex: 1000, + duration: 2000, + position: 'middle', + forbidClick: false, + loadingType: 'circular', + selector: '#van-toast' +}; +let queue = []; +let currentOptions = Object.assign({}, defaultOptions); +function parseOptions(message) { + return isObj(message) ? message : { message }; +} +function getContext() { + const pages = getCurrentPages(); + return pages[pages.length - 1]; +} +function Toast(toastOptions) { + const options = Object.assign(Object.assign({}, currentOptions), parseOptions(toastOptions)); + const context = options.context || getContext(); + const toast = context.selectComponent(options.selector); + if (!toast) { + console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确'); + return; + } + delete options.context; + delete options.selector; + toast.clear = () => { + toast.setData({ show: false }); + if (options.onClose) { + options.onClose(); + } + }; + queue.push(toast); + toast.setData(options); + clearTimeout(toast.timer); + if (options.duration > 0) { + toast.timer = setTimeout(() => { + toast.clear(); + queue = queue.filter(item => item !== toast); + }, options.duration); + } + return toast; +} +const createMethod = (type) => (options) => Toast(Object.assign({ type }, parseOptions(options))); +Toast.loading = createMethod('loading'); +Toast.success = createMethod('success'); +Toast.fail = createMethod('fail'); +Toast.clear = () => { + queue.forEach(toast => { + toast.clear(); + }); + queue = []; +}; +Toast.setDefaultOptions = (options) => { + Object.assign(currentOptions, options); +}; +Toast.resetDefaultOptions = () => { + currentOptions = Object.assign({}, defaultOptions); +}; +export default Toast; diff --git a/utils/dist/transition/index.d.ts b/utils/dist/transition/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/transition/index.d.ts +++ b/utils/dist/transition/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/transition/index.js b/utils/dist/transition/index.js index a920f1f..58d186d 100644 --- a/utils/dist/transition/index.js +++ b/utils/dist/transition/index.js @@ -1,13 +1,13 @@ -import { VantComponent } from '../common/component'; -import { transition } from '../mixins/transition'; -VantComponent({ - classes: [ - 'enter-class', - 'enter-active-class', - 'enter-to-class', - 'leave-class', - 'leave-active-class', - 'leave-to-class' - ], - mixins: [transition(true)] -}); +import { VantComponent } from '../common/component'; +import { transition } from '../mixins/transition'; +VantComponent({ + classes: [ + 'enter-class', + 'enter-active-class', + 'enter-to-class', + 'leave-class', + 'leave-active-class', + 'leave-to-class' + ], + mixins: [transition(true)] +}); diff --git a/utils/dist/transition/index.json b/utils/dist/transition/index.json index 32640e0..1edff93 100644 --- a/utils/dist/transition/index.json +++ b/utils/dist/transition/index.json @@ -1,3 +1,3 @@ -{ - "component": true +{ + "component": true } \ No newline at end of file diff --git a/utils/dist/transition/index.wxml b/utils/dist/transition/index.wxml index 412e8af..c8e6ca8 100644 --- a/utils/dist/transition/index.wxml +++ b/utils/dist/transition/index.wxml @@ -1,8 +1,8 @@ - - - + + + diff --git a/utils/dist/tree-select/index.d.ts b/utils/dist/tree-select/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/tree-select/index.d.ts +++ b/utils/dist/tree-select/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/tree-select/index.js b/utils/dist/tree-select/index.js index bf82410..79de9ce 100644 --- a/utils/dist/tree-select/index.js +++ b/utils/dist/tree-select/index.js @@ -1,74 +1,74 @@ -import { VantComponent } from '../common/component'; -import { addUnit } from '../common/utils'; -VantComponent({ - classes: [ - 'main-item-class', - 'content-item-class', - 'main-active-class', - 'content-active-class', - 'main-disabled-class', - 'content-disabled-class' - ], - props: { - items: { - type: Array, - observer: 'updateSubItems' - }, - activeId: null, - mainActiveIndex: { - type: Number, - value: 0, - observer: 'updateSubItems' - }, - height: { - type: [Number, String], - value: 300, - observer: 'updateHeight' - }, - max: { - type: Number, - value: Infinity - } - }, - data: { - subItems: [] - }, - created() { - this.updateHeight(); - }, - methods: { - // 当一个子项被选择时 - onSelectItem(event) { - const { item } = event.currentTarget.dataset; - const isArray = Array.isArray(this.data.activeId); - // 判断有没有超出右侧选择的最大数 - const isOverMax = isArray && this.data.activeId.length >= this.data.max; - // 判断该项有没有被选中, 如果有被选中,则忽视是否超出的条件 - const isSelected = isArray - ? this.data.activeId.indexOf(item.id) > -1 - : this.data.activeId === item.id; - if (!item.disabled && (!isOverMax || isSelected)) { - this.$emit('click-item', item); - } - }, - // 当一个导航被点击时 - onClickNav(event) { - const index = event.detail; - const item = this.data.items[index]; - if (!item.disabled) { - this.$emit('click-nav', { index }); - } - }, - // 更新子项列表 - updateSubItems() { - const { items, mainActiveIndex } = this.data; - const { children = [] } = items[mainActiveIndex] || {}; - return this.set({ subItems: children }); - }, - updateHeight() { - this.setData({ - innerHeight: addUnit(this.data.height) - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { addUnit } from '../common/utils'; +VantComponent({ + classes: [ + 'main-item-class', + 'content-item-class', + 'main-active-class', + 'content-active-class', + 'main-disabled-class', + 'content-disabled-class' + ], + props: { + items: { + type: Array, + observer: 'updateSubItems' + }, + activeId: null, + mainActiveIndex: { + type: Number, + value: 0, + observer: 'updateSubItems' + }, + height: { + type: [Number, String], + value: 300, + observer: 'updateHeight' + }, + max: { + type: Number, + value: Infinity + } + }, + data: { + subItems: [] + }, + created() { + this.updateHeight(); + }, + methods: { + // 当一个子项被选择时 + onSelectItem(event) { + const { item } = event.currentTarget.dataset; + const isArray = Array.isArray(this.data.activeId); + // 判断有没有超出右侧选择的最大数 + const isOverMax = isArray && this.data.activeId.length >= this.data.max; + // 判断该项有没有被选中, 如果有被选中,则忽视是否超出的条件 + const isSelected = isArray + ? this.data.activeId.indexOf(item.id) > -1 + : this.data.activeId === item.id; + if (!item.disabled && (!isOverMax || isSelected)) { + this.$emit('click-item', item); + } + }, + // 当一个导航被点击时 + onClickNav(event) { + const index = event.detail; + const item = this.data.items[index]; + if (!item.disabled) { + this.$emit('click-nav', { index }); + } + }, + // 更新子项列表 + updateSubItems() { + const { items, mainActiveIndex } = this.data; + const { children = [] } = items[mainActiveIndex] || {}; + return this.set({ subItems: children }); + }, + updateHeight() { + this.setData({ + innerHeight: addUnit(this.data.height) + }); + } + } +}); diff --git a/utils/dist/tree-select/index.json b/utils/dist/tree-select/index.json index 42991a2..467cd25 100644 --- a/utils/dist/tree-select/index.json +++ b/utils/dist/tree-select/index.json @@ -1,8 +1,8 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-sidebar": "../sidebar/index", - "van-sidebar-item": "../sidebar-item/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-sidebar": "../sidebar/index", + "van-sidebar-item": "../sidebar-item/index" + } +} diff --git a/utils/dist/tree-select/index.wxml b/utils/dist/tree-select/index.wxml index d6f95a8..c5ba6f6 100644 --- a/utils/dist/tree-select/index.wxml +++ b/utils/dist/tree-select/index.wxml @@ -1,39 +1,39 @@ - - - - - - - - - - - - - {{ item.text }} - - - - + + + + + + + + + + + + + {{ item.text }} + + + + diff --git a/utils/dist/tree-select/index.wxs b/utils/dist/tree-select/index.wxs index b1cbb39..45add81 100644 --- a/utils/dist/tree-select/index.wxs +++ b/utils/dist/tree-select/index.wxs @@ -1,12 +1,12 @@ -/* eslint-disable */ -var array = require('../wxs/array.wxs'); - -function isActive (activeList, itemId) { - if (array.isArray(activeList)) { - return activeList.indexOf(itemId) > -1; - } - - return activeList === itemId; -} - -module.exports.isActive = isActive; +/* eslint-disable */ +var array = require('../wxs/array.wxs'); + +function isActive (activeList, itemId) { + if (array.isArray(activeList)) { + return activeList.indexOf(itemId) > -1; + } + + return activeList === itemId; +} + +module.exports.isActive = isActive; diff --git a/utils/dist/uploader/index.d.ts b/utils/dist/uploader/index.d.ts index cb0ff5c..509db18 100644 --- a/utils/dist/uploader/index.d.ts +++ b/utils/dist/uploader/index.d.ts @@ -1 +1 @@ -export {}; +export {}; diff --git a/utils/dist/uploader/index.js b/utils/dist/uploader/index.js index 9cc5def..93adf2c 100644 --- a/utils/dist/uploader/index.js +++ b/utils/dist/uploader/index.js @@ -1,151 +1,151 @@ -import { VantComponent } from '../common/component'; -import { isImageFile } from './utils'; -import { addUnit } from '../common/utils'; -VantComponent({ - props: { - disabled: Boolean, - multiple: Boolean, - uploadText: String, - useSlot: Boolean, - useBeforeRead: Boolean, - previewSize: { - type: null, - value: 90, - observer: 'setComputedPreviewSize' - }, - name: { - type: [Number, String], - value: '' - }, - accept: { - type: String, - value: 'image' - }, - fileList: { - type: Array, - value: [], - observer: 'formatFileList' - }, - maxSize: { - type: Number, - value: Number.MAX_VALUE - }, - maxCount: { - type: Number, - value: 100 - }, - deletable: { - type: Boolean, - value: true - }, - previewImage: { - type: Boolean, - value: true - }, - previewFullImage: { - type: Boolean, - value: true - }, - imageFit: { - type: String, - value: 'scaleToFill' - } - }, - data: { - lists: [], - computedPreviewSize: '', - isInCount: true - }, - methods: { - formatFileList() { - const { fileList = [], maxCount } = this.data; - const lists = fileList.map(item => (Object.assign(Object.assign({}, item), { isImage: typeof item.isImage === 'undefined' ? isImageFile(item) : item.isImage }))); - this.setData({ lists, isInCount: lists.length < maxCount }); - }, - setComputedPreviewSize(val) { - this.setData({ - computedPreviewSize: addUnit(val) - }); - }, - startUpload() { - if (this.data.disabled) - return; - const { name = '', capture = ['album', 'camera'], maxCount = 100, multiple = false, maxSize, accept, lists, useBeforeRead = false // 是否定义了 beforeRead - } = this.data; - let chooseFile = null; - const newMaxCount = maxCount - lists.length; - // 设置为只选择图片的时候使用 chooseImage 来实现 - if (accept === 'image') { - chooseFile = new Promise((resolve, reject) => { - wx.chooseImage({ - count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, - sourceType: capture, - success: resolve, - fail: reject - }); - }); - } - else { - chooseFile = new Promise((resolve, reject) => { - wx.chooseMessageFile({ - count: multiple ? newMaxCount : 1, - type: 'file', - success: resolve, - fail: reject - }); - }); - } - chooseFile.then((res) => { - const file = multiple ? res.tempFiles : res.tempFiles[0]; - // 检查文件大小 - if (file instanceof Array) { - const sizeEnable = file.every(item => item.size <= maxSize); - if (!sizeEnable) { - this.$emit('oversize', { name }); - return; - } - } - else if (file.size > maxSize) { - this.$emit('oversize', { name }); - return; - } - // 触发上传之前的钩子函数 - if (useBeforeRead) { - this.$emit('before-read', { - file, - name, - callback: (result) => { - if (result) { - // 开始上传 - this.$emit('after-read', { file, name }); - } - } - }); - } - else { - this.$emit('after-read', { file, name }); - } - }); - }, - deleteItem(event) { - const { index } = event.currentTarget.dataset; - this.$emit('delete', { index, name: this.data.name }); - }, - doPreviewImage(event) { - if (!this.data.previewFullImage) - return; - const curUrl = event.currentTarget.dataset.url; - const images = this.data.lists - .filter(item => item.isImage) - .map(item => item.url || item.path); - this.$emit('click-preview', { url: curUrl, name: this.data.name }); - wx.previewImage({ - urls: images, - current: curUrl, - fail() { - wx.showToast({ title: '预览图片失败', icon: 'none' }); - } - }); - } - } -}); +import { VantComponent } from '../common/component'; +import { isImageFile } from './utils'; +import { addUnit } from '../common/utils'; +VantComponent({ + props: { + disabled: Boolean, + multiple: Boolean, + uploadText: String, + useSlot: Boolean, + useBeforeRead: Boolean, + previewSize: { + type: null, + value: 90, + observer: 'setComputedPreviewSize' + }, + name: { + type: [Number, String], + value: '' + }, + accept: { + type: String, + value: 'image' + }, + fileList: { + type: Array, + value: [], + observer: 'formatFileList' + }, + maxSize: { + type: Number, + value: Number.MAX_VALUE + }, + maxCount: { + type: Number, + value: 100 + }, + deletable: { + type: Boolean, + value: true + }, + previewImage: { + type: Boolean, + value: true + }, + previewFullImage: { + type: Boolean, + value: true + }, + imageFit: { + type: String, + value: 'scaleToFill' + } + }, + data: { + lists: [], + computedPreviewSize: '', + isInCount: true + }, + methods: { + formatFileList() { + const { fileList = [], maxCount } = this.data; + const lists = fileList.map(item => (Object.assign(Object.assign({}, item), { isImage: typeof item.isImage === 'undefined' ? isImageFile(item) : item.isImage }))); + this.setData({ lists, isInCount: lists.length < maxCount }); + }, + setComputedPreviewSize(val) { + this.setData({ + computedPreviewSize: addUnit(val) + }); + }, + startUpload() { + if (this.data.disabled) + return; + const { name = '', capture = ['album', 'camera'], maxCount = 100, multiple = false, maxSize, accept, lists, useBeforeRead = false // 是否定义了 beforeRead + } = this.data; + let chooseFile = null; + const newMaxCount = maxCount - lists.length; + // 设置为只选择图片的时候使用 chooseImage 来实现 + if (accept === 'image') { + chooseFile = new Promise((resolve, reject) => { + wx.chooseImage({ + count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, + sourceType: capture, + success: resolve, + fail: reject + }); + }); + } + else { + chooseFile = new Promise((resolve, reject) => { + wx.chooseMessageFile({ + count: multiple ? newMaxCount : 1, + type: 'file', + success: resolve, + fail: reject + }); + }); + } + chooseFile.then((res) => { + const file = multiple ? res.tempFiles : res.tempFiles[0]; + // 检查文件大小 + if (file instanceof Array) { + const sizeEnable = file.every(item => item.size <= maxSize); + if (!sizeEnable) { + this.$emit('oversize', { name }); + return; + } + } + else if (file.size > maxSize) { + this.$emit('oversize', { name }); + return; + } + // 触发上传之前的钩子函数 + if (useBeforeRead) { + this.$emit('before-read', { + file, + name, + callback: (result) => { + if (result) { + // 开始上传 + this.$emit('after-read', { file, name }); + } + } + }); + } + else { + this.$emit('after-read', { file, name }); + } + }); + }, + deleteItem(event) { + const { index } = event.currentTarget.dataset; + this.$emit('delete', { index, name: this.data.name }); + }, + doPreviewImage(event) { + if (!this.data.previewFullImage) + return; + const curUrl = event.currentTarget.dataset.url; + const images = this.data.lists + .filter(item => item.isImage) + .map(item => item.url || item.path); + this.$emit('click-preview', { url: curUrl, name: this.data.name }); + wx.previewImage({ + urls: images, + current: curUrl, + fail() { + wx.showToast({ title: '预览图片失败', icon: 'none' }); + } + }); + } + } +}); diff --git a/utils/dist/uploader/index.json b/utils/dist/uploader/index.json index 0a336c0..8abfe20 100644 --- a/utils/dist/uploader/index.json +++ b/utils/dist/uploader/index.json @@ -1,6 +1,6 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index" - } -} +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/utils/dist/uploader/index.wxml b/utils/dist/uploader/index.wxml index 02546aa..acb14c6 100644 --- a/utils/dist/uploader/index.wxml +++ b/utils/dist/uploader/index.wxml @@ -1,57 +1,57 @@ - - - - - - - {{ item.name || ('图片' + index) }} - - - {{ item.name || item.url || item.path }} - - - - - - - - - - - - - - {{ uploadText }} - - - - + + + + + + + {{ item.name || ('图片' + index) }} + + + {{ item.name || item.url || item.path }} + + + + + + + + + + + + + + {{ uploadText }} + + + + diff --git a/utils/dist/uploader/utils.d.ts b/utils/dist/uploader/utils.d.ts index d3bb3b5..9c0178d 100644 --- a/utils/dist/uploader/utils.d.ts +++ b/utils/dist/uploader/utils.d.ts @@ -1,12 +1,12 @@ -interface File { - path: string; - url: string; - size: number; - name: string; - type: string; - time: number; - image: boolean; -} -export declare function isImageUrl(url: string): boolean; -export declare function isImageFile(item: File): boolean; -export {}; +interface File { + path: string; + url: string; + size: number; + name: string; + type: string; + time: number; + image: boolean; +} +export declare function isImageUrl(url: string): boolean; +export declare function isImageFile(item: File): boolean; +export {}; diff --git a/utils/dist/uploader/utils.js b/utils/dist/uploader/utils.js index aa59dc1..3186db2 100644 --- a/utils/dist/uploader/utils.js +++ b/utils/dist/uploader/utils.js @@ -1,16 +1,16 @@ -const IMAGE_EXT = ['jpeg', 'jpg', 'gif', 'png', 'svg']; -export function isImageUrl(url) { - return IMAGE_EXT.some(ext => url.indexOf(`.${ext}`) !== -1); -} -export function isImageFile(item) { - if (item.type) { - return item.type.indexOf('image') === 0; - } - if (item.path) { - return isImageUrl(item.path); - } - if (item.url) { - return isImageUrl(item.url); - } - return false; -} +const IMAGE_EXT = ['jpeg', 'jpg', 'gif', 'png', 'svg']; +export function isImageUrl(url) { + return IMAGE_EXT.some(ext => url.indexOf(`.${ext}`) !== -1); +} +export function isImageFile(item) { + if (item.type) { + return item.type.indexOf('image') === 0; + } + if (item.path) { + return isImageUrl(item.path); + } + if (item.url) { + return isImageUrl(item.url); + } + return false; +} diff --git a/utils/dist/wxs/array.wxs b/utils/dist/wxs/array.wxs index 610089c..4681032 100644 --- a/utils/dist/wxs/array.wxs +++ b/utils/dist/wxs/array.wxs @@ -1,5 +1,5 @@ -function isArray(array) { - return array && array.constructor === 'Array'; -} - -module.exports.isArray = isArray; +function isArray(array) { + return array && array.constructor === 'Array'; +} + +module.exports.isArray = isArray; diff --git a/utils/dist/wxs/bem.wxs b/utils/dist/wxs/bem.wxs index 93b2777..870ab24 100644 --- a/utils/dist/wxs/bem.wxs +++ b/utils/dist/wxs/bem.wxs @@ -1,38 +1,38 @@ -var array = require('./array.wxs'); -var object = require('./object.wxs'); -var PREFIX = 'van-'; - -function join(name, mods) { - name = PREFIX + name; - mods = mods.map(function(mod) { - return name + '--' + mod; - }); - mods.unshift(name); - return mods.join(' '); -} - -function traversing(mods, conf) { - if (!conf) { - return; - } - - if (typeof conf === 'string' || typeof conf === 'number') { - mods.push(conf); - } else if (array.isArray(conf)) { - conf.forEach(function(item) { - traversing(mods, item); - }); - } else if (typeof conf === 'object') { - object.keys(conf).forEach(function(key) { - conf[key] && mods.push(key); - }); - } -} - -function bem(name, conf) { - var mods = []; - traversing(mods, conf); - return join(name, mods); -} - -module.exports.bem = bem; +var array = require('./array.wxs'); +var object = require('./object.wxs'); +var PREFIX = 'van-'; + +function join(name, mods) { + name = PREFIX + name; + mods = mods.map(function(mod) { + return name + '--' + mod; + }); + mods.unshift(name); + return mods.join(' '); +} + +function traversing(mods, conf) { + if (!conf) { + return; + } + + if (typeof conf === 'string' || typeof conf === 'number') { + mods.push(conf); + } else if (array.isArray(conf)) { + conf.forEach(function(item) { + traversing(mods, item); + }); + } else if (typeof conf === 'object') { + object.keys(conf).forEach(function(key) { + conf[key] && mods.push(key); + }); + } +} + +function bem(name, conf) { + var mods = []; + traversing(mods, conf); + return join(name, mods); +} + +module.exports.bem = bem; diff --git a/utils/dist/wxs/memoize.wxs b/utils/dist/wxs/memoize.wxs index 261ae67..7e119d9 100644 --- a/utils/dist/wxs/memoize.wxs +++ b/utils/dist/wxs/memoize.wxs @@ -1,54 +1,54 @@ -/** - * Simple memoize - * wxs doesn't support fn.apply, so this memoize only support up to 2 args - */ - -function isPrimitive(value) { - var type = typeof value; - return ( - type === 'boolean' || - type === 'number' || - type === 'string' || - type === 'undefined' || - value === null - ); -} - -// mock simple fn.call in wxs -function call(fn, args) { - if (args.length === 2) { - return fn(args[0], args[1]); - } - - if (args.length === 1) { - return fn(args[0]); - } - - return fn(); -} - -function serializer(args) { - if (args.length === 1 && isPrimitive(args[0])) { - return args[0]; - } - var obj = {}; - for (var i = 0; i < args.length; i++) { - obj['key' + i] = args[i]; - } - return JSON.stringify(obj); -} - -function memoize(fn) { - var cache = {}; - - return function() { - var key = serializer(arguments); - if (cache[key] === undefined) { - cache[key] = call(fn, arguments); - } - - return cache[key]; - }; -} - -module.exports.memoize = memoize; +/** + * Simple memoize + * wxs doesn't support fn.apply, so this memoize only support up to 2 args + */ + +function isPrimitive(value) { + var type = typeof value; + return ( + type === 'boolean' || + type === 'number' || + type === 'string' || + type === 'undefined' || + value === null + ); +} + +// mock simple fn.call in wxs +function call(fn, args) { + if (args.length === 2) { + return fn(args[0], args[1]); + } + + if (args.length === 1) { + return fn(args[0]); + } + + return fn(); +} + +function serializer(args) { + if (args.length === 1 && isPrimitive(args[0])) { + return args[0]; + } + var obj = {}; + for (var i = 0; i < args.length; i++) { + obj['key' + i] = args[i]; + } + return JSON.stringify(obj); +} + +function memoize(fn) { + var cache = {}; + + return function() { + var key = serializer(arguments); + if (cache[key] === undefined) { + cache[key] = call(fn, arguments); + } + + return cache[key]; + }; +} + +module.exports.memoize = memoize; diff --git a/utils/dist/wxs/object.wxs b/utils/dist/wxs/object.wxs index e077107..69f16ea 100644 --- a/utils/dist/wxs/object.wxs +++ b/utils/dist/wxs/object.wxs @@ -1,13 +1,13 @@ -/* eslint-disable */ -var REGEXP = getRegExp('{|}|"', 'g'); - -function keys(obj) { - return JSON.stringify(obj) - .replace(REGEXP, '') - .split(',') - .map(function(item) { - return item.split(':')[0]; - }); -} - -module.exports.keys = keys; +/* eslint-disable */ +var REGEXP = getRegExp('{|}|"', 'g'); + +function keys(obj) { + return JSON.stringify(obj) + .replace(REGEXP, '') + .split(',') + .map(function(item) { + return item.split(':')[0]; + }); +} + +module.exports.keys = keys; diff --git a/utils/dist/wxs/utils.wxs b/utils/dist/wxs/utils.wxs index a18662d..a0df7ee 100644 --- a/utils/dist/wxs/utils.wxs +++ b/utils/dist/wxs/utils.wxs @@ -1,7 +1,7 @@ -var bem = require('./bem.wxs').bem; -var memoize = require('./memoize.wxs').memoize; - -module.exports = { - bem: memoize(bem), - memoize: memoize -}; +var bem = require('./bem.wxs').bem; +var memoize = require('./memoize.wxs').memoize; + +module.exports = { + bem: memoize(bem), + memoize: memoize +}; diff --git a/utils/util.js b/utils/util.js index dbadbb8..0cbb61a 100644 --- a/utils/util.js +++ b/utils/util.js @@ -1,19 +1,19 @@ -const formatTime = date => { - const year = date.getFullYear() - const month = date.getMonth() + 1 - const day = date.getDate() - const hour = date.getHours() - const minute = date.getMinutes() - const second = date.getSeconds() - - return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') -} - -const formatNumber = n => { - n = n.toString() - return n[1] ? n : '0' + n -} - -module.exports = { - formatTime: formatTime -} +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : '0' + n +} + +module.exports = { + formatTime: formatTime +} -- 2.39.5