From 998218675eb243d43912c203174a6b72b299c0f8 Mon Sep 17 00:00:00 2001 From: xusd <330628789@qq.com> Date: Thu, 19 Jun 2025 21:02:23 +0800 Subject: [PATCH] feature:市平台小程序 --- components/vant/action-sheet/index.json | 8 pages/homePage/index.wxss | 504 img/AIAide_4.png | 0 miniprogram_npm/@vant/weapp/goods-action-button/index.d.ts | 1 components/steps/index.js | 25 pages/evaluate/index.js | 97 miniprogram_npm/@vant/weapp/sidebar-item/index.js | 32 components/textarea/index.wxss | 1 components/vant/button/index.js | 64 pages/course/index.wxml | 270 miniprogram_npm/@vant/weapp/calendar/utils.js | 97 miniprogram_npm/@vant/weapp/image/index.json | 7 miniprogram_npm/@vant/weapp/goods-action-button/index.wxml | 30 pages/classicCase/index.json | 10 components/vant/radio-group/index.wxss | 1 miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss | 1 miniprogram_npm/@vant/weapp/grid/index.wxml | 8 miniprogram_npm/@vant/weapp/grid/index.d.ts | 1 miniprogram_npm/@vant/weapp/index-anchor/index.wxss | 1 miniprogram_npm/@vant/weapp/picker/index.wxs | 42 pages/addAgent/index.wxml | 103 miniprogram_npm/@vant/weapp/empty/index.d.ts | 1 components/vant/row/index.wxs | 18 pages/AIAideDetail/index.wxml | 32 components/vant/col/index.js | 9 miniprogram_npm/@vant/weapp/checkbox-group/index.d.ts | 1 miniprogram_npm/@vant/weapp/tree-select/index.wxs | 12 miniprogram_npm/@vant/weapp/steps/index.wxss | 1 miniprogram_npm/@vant/weapp/grid-item/index.wxss | 1 miniprogram_npm/@vant/weapp/picker/index.json | 7 miniprogram_npm/@vant/weapp/checkbox-group/index.wxml | 5 components/vant/sidebar-item/index.js | 32 miniprogram_npm/@vant/weapp/tabbar/index.wxml | 10 pages/speechToText/index.json | 4 components/vant/divider/index.wxss | 1 miniprogram_npm/@vant/weapp/common/utils.js | 113 miniprogram_npm/@vant/weapp/cell/index.wxss | 1 miniprogram_npm/@vant/weapp/empty/index.wxml | 22 miniprogram_npm/@vant/weapp/dropdown-item/shared.d.ts | 5 pages/myRegisterList/index.wxss | 179 components/vant/radio/index.json | 6 pages/addUnit/index.json | 3 components/vant/radio-group/index.js | 24 pages/mediateDetail/index.json | 6 pages/myRegisterDetail/index.wxml | 95 miniprogram_npm/@vant/weapp/progress/index.js | 55 miniprogram_npm/@vant/weapp/search/index.wxss | 1 pages/course/index.js | 74 components/time-format/index.wxss | 1 components/vant/popup/index.json | 7 miniprogram_npm/@vant/weapp/common/color.d.ts | 7 miniprogram_npm/@vant/weapp/checkbox-group/index.js | 39 miniprogram_npm/@vant/weapp/switch/index.wxss | 1 components/tooltip/index.wxml | 12 components/vant/col/index.wxs | 18 components/vant/mixins/page-scroll.d.ts | 5 miniprogram_npm/@vant/weapp/dropdown-menu/index.json | 3 components/vant/tabbar/index.wxss | 16 components/vant/datetime-picker/index.js | 329 miniprogram_npm/@vant/weapp/toast/index.wxml | 36 pages/login/index.wxml | 11 components/vant/loading/index.d.ts | 1 components/vant/loading/index.wxml | 19 miniprogram_npm/@vant/weapp/toast/index.d.ts | 1 miniprogram_npm/@vant/weapp/checkbox-group/index.wxss | 1 miniprogram_npm/@vant/weapp/collapse-item/index.js | 61 miniprogram_npm/@vant/weapp/swipe-cell/index.json | 3 miniprogram_npm/@vant/weapp/calendar/utils.wxs | 25 miniprogram_npm/@vant/weapp/collapse/index.json | 3 miniprogram_npm/@vant/weapp/dropdown-item/index.wxml | 48 miniprogram_npm/@vant/weapp/empty/index.wxss | 1 pages/addAddress/index.json | 4 miniprogram_npm/@vant/weapp/sidebar/index.json | 3 miniprogram_npm/@vant/weapp/datetime-picker/index.d.ts | 1 miniprogram_npm/@vant/weapp/col/index.js | 11 pages/autograph/index.json | 6 components/vant/mixins/basic.js | 11 miniprogram_npm/@vant/weapp/dropdown-item/index.d.ts | 1 components/vant/checkbox/index.json | 6 miniprogram_npm/@vant/weapp/datetime-picker/index.wxml | 16 components/time-format/index.wxml | 2 pages/addFilesList/index.wxml | 2 components/recording/index.js | 186 components/tooltip/index.wxss | 40 pages/materialUpload/index.wxml | 104 pages/login/index.wxss | 16 miniprogram_npm/@vant/weapp/cell/index.wxs | 17 pages/agreement/index.json | 4 components/vant/tabs/index.json | 7 components/personal-data-dom/index.wxss | 1 pages/addPerson/index.js | 344 miniprogram_npm/@vant/weapp/info/index.wxml | 7 miniprogram_npm/@vant/weapp/cell/index.js | 40 pages/ssimDetail/index.js | 51 img/supplement_1.png | 0 components/vant/mixins/link.d.ts | 1 miniprogram_npm/@vant/weapp/circle/index.json | 3 components/textarea/index.js | 23 miniprogram_npm/@vant/weapp/tabbar-item/index.d.ts | 1 components/tabbar-page/index.json | 4 pages/evaluate/index.wxss | 69 miniprogram_npm/@vant/weapp/grid/index.wxss | 1 pages/AIAide/index.js | 214 miniprogram_npm/@vant/weapp/sticky/index.wxss | 1 miniprogram_npm/@vant/weapp/index-anchor/index.wxml | 14 miniprogram_npm/@vant/weapp/uploader/shared.js | 33 img/update_1.png | 0 pages/addAgent/index.wxss | 202 components/mediate-card/index.js | 842 + miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss | 1 miniprogram_npm/@vant/weapp/info/index.d.ts | 1 pages/AIAideDetail/index.wxss | 25 miniprogram_npm/@vant/weapp/index-anchor/index.d.ts | 1 miniprogram_npm/@vant/weapp/panel/index.js | 11 miniprogram_npm/@vant/weapp/notice-bar/index.json | 6 miniprogram_npm/@vant/weapp/count-down/index.wxss | 1 miniprogram_npm/@vant/weapp/row/index.wxs | 18 READEME.md | 39 miniprogram_npm/@vant/weapp/grid-item/index.d.ts | 1 miniprogram_npm/@vant/weapp/grid-item/index.wxml | 27 pages/myJudicialConfirmation/index.json | 8 pages/ssimList/index.wxml | 44 components/personal-data-dom/index.wxml | 81 utils/moment.js | 4602 ++++++ components/file-card/index.wxml | 25 components/vant/loading/index.js | 16 miniprogram_npm/@vant/weapp/cell/index.wxml | 47 miniprogram_npm/@vant/weapp/sidebar-item/index.wxss | 1 pages/myRegisterList/index.wxml | 125 components/vant/loading/index.wxs | 22 components/vant/divider/index.wxs | 18 components/vant/picker/index.json | 7 miniprogram_npm/@vant/weapp/search/index.wxml | 53 pages/materialShow/index.json | 6 components/vant/wxs/memoize.wxs | 55 miniprogram_npm/@vant/weapp/goods-action/index.json | 3 pages/me/index.wxml | 61 miniprogram_npm/@vant/weapp/search/index.d.ts | 1 pages/organizeList/index.json | 5 components/vant/overlay/index.json | 6 miniprogram_npm/@vant/weapp/rate/index.js | 93 miniprogram_npm/@vant/weapp/tabbar-item/index.js | 58 pages/findAdjust/index.wxml | 69 pages/perfectInformation/index.js | 211 components/vant/tabbar/index.d.ts | 1 miniprogram_npm/@vant/weapp/count-down/index.js | 104 pages/realNameAuthentication/index.js | 216 miniprogram_npm/@vant/weapp/tabs/index.js | 282 components/vant/button/index.d.ts | 1 components/vant/button/index.wxml | 53 miniprogram_npm/@vant/weapp/grid-item/index.js | 54 components/ellipsis-text/index.json | 4 components/vant/tabbar/index.wxml | 10 components/vant/tabbar-item/index.wxml | 28 components/vant/tabbar-item/index.d.ts | 1 miniprogram_npm/@vant/weapp/toast/index.wxss | 1 miniprogram_npm/@vant/weapp/config-provider/index.js | 11 components/vant/switch/index.wxs | 26 miniprogram_npm/@vant/weapp/count-down/index.d.ts | 1 miniprogram_npm/@vant/weapp/overlay/index.wxml | 21 components/vant/definitions/index.d.ts | 27 pages/caseType/index.wxml | 49 components/vant/col/index.json | 3 components/vant/grid-item/index.json | 6 pages/course/index.wxss | 110 pages/orderConfirm/index.wxss | 32 components/tabbar-page/index.js | 110 miniprogram_npm/@vant/weapp/overlay/index.d.ts | 1 pages/mediateDetail/index.js | 110 components/vant/cell/index.js | 38 components/vant/icon/index.json | 6 miniprogram_npm/@vant/weapp/search/index.js | 92 miniprogram_npm/@vant/weapp/field/props.js | 67 miniprogram_npm/@vant/weapp/common/style/clearfix.wxss | 1 components/vant/common/version.js | 48 components/vant/common/color.d.ts | 7 miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs | 16 miniprogram_npm/@vant/weapp/index-bar/index.wxml | 22 miniprogram_npm/@vant/weapp/index-bar/index.d.ts | 1 miniprogram_npm/@vant/weapp/cell-group/index.json | 3 components/vant/switch/index.wxss | 1 pages/urgingList/index.js | 44 miniprogram_npm/@vant/weapp/overlay/index.wxss | 1 miniprogram_npm/@vant/weapp/tag/index.wxml | 15 miniprogram_npm/@vant/weapp/popup/index.json | 7 pages/addUnit/index.js | 199 components/vant/mixins/page-scroll.js | 36 miniprogram_npm/@vant/weapp/dialog/index.json | 9 pages/orderConfirm/index.wxml | 62 pages/evaluate/index.wxml | 39 pages/assistMediate/index.json | 7 miniprogram_npm/@vant/weapp/common/validator.d.ts | 9 components/vant/toast/index.js | 29 components/mediate-card/index.json | 10 components/vant/mixins/basic.d.ts | 1 miniprogram_npm/@vant/weapp/calendar/utils.d.ts | 12 miniprogram_npm/@vant/weapp/col/index.wxs | 18 pages/homePageInfo/index.json | 5 pages/webview/index.wxml | 2 miniprogram_npm/@vant/weapp/wxs/array.wxs | 5 miniprogram_npm/@vant/weapp/checkbox/index.wxs | 20 miniprogram_npm/@vant/weapp/image/index.wxs | 32 img/arrive_1.png | 0 components/vant/tab/index.js | 56 miniprogram_npm/@vant/weapp/count-down/index.wxml | 4 pages/floatImagePage/index.json | 8 miniprogram_npm/@vant/weapp/tag/index.d.ts | 1 miniprogram_npm/@vant/weapp/action-sheet/index.json | 8 pages/ssimList/index.wxss | 82 miniprogram_npm/@vant/weapp/tree-select/index.js | 70 components/vant/picker-column/index.wxs | 36 miniprogram_npm/@vant/weapp/dropdown-item/index.wxss | 1 miniprogram_npm/@vant/weapp/card/index.json | 6 components/vant/image/index.json | 7 components/vant/grid/index.wxss | 1 components/vant/wxs/array.wxs | 5 miniprogram_npm/@vant/weapp/dialog/index.js | 127 miniprogram_npm/@vant/weapp/share-sheet/options.json | 3 miniprogram_npm/@vant/weapp/cell/index.d.ts | 1 pages/ssimList/index.js | 269 miniprogram_npm/@vant/weapp/datetime-picker/index.wxss | 1 miniprogram_npm/@vant/weapp/col/index.wxml | 9 components/vant/button/index.wxss | 144 miniprogram_npm/@vant/weapp/stepper/index.json | 3 components/drop-down-select/index.js | 73 components/recording/index.wxss | 163 miniprogram_npm/@vant/weapp/divider/index.wxml | 9 styles/animate_base.wxss | 62 miniprogram_npm/@vant/weapp/icon/index.wxss | 1 miniprogram_npm/@vant/weapp/mixins/page-scroll.d.ts | 5 miniprogram_npm/@vant/weapp/submit-bar/index.wxss | 1 pages/myRegisterFlow/index.js | 146 components/vant/tab/index.json | 3 img/case_2.png | 0 components/common-page/index.wxml | 39 miniprogram_npm/@vant/weapp/mixins/basic.js | 14 components/vant/common/validator.d.ts | 9 miniprogram_npm/@vant/weapp/radio-group/index.wxss | 1 miniprogram_npm/@vant/weapp/skeleton/index.wxss | 1 components/vant/col/index.wxml | 9 miniprogram_npm/@vant/weapp/index-bar/index.wxss | 1 pages/myJudicialConfirmation/index.js | 174 miniprogram_npm/@vant/weapp/uploader/utils.d.ts | 22 miniprogram_npm/@vant/weapp/collapse-item/index.wxml | 44 miniprogram_npm/@vant/weapp/radio/index.json | 6 miniprogram_npm/@vant/weapp/index-bar/index.js | 243 utils/util.js | 500 miniprogram_npm/@vant/weapp/nav-bar/index.js | 68 components/vant/col/index.d.ts | 1 miniprogram_npm/@vant/weapp/common/utils.d.ts | 13 components/vant/transition/index.json | 3 components/vant/grid/index.json | 3 miniprogram_npm/@vant/weapp/transition/index.json | 3 miniprogram_npm/@vant/weapp/tree-select/index.wxss | 1 components/mediate-card/index.wxml | 224 miniprogram_npm/@vant/weapp/field/index.wxs | 18 miniprogram_npm/@vant/weapp/image/index.js | 62 components/vant/picker/shared.d.ts | 21 img/right.png | 0 miniprogram_npm/@vant/weapp/calendar/calendar.wxml | 68 components/vant/empty/index.d.ts | 1 miniprogram_npm/@vant/weapp/collapse-item/index.d.ts | 1 miniprogram_npm/@vant/weapp/tag/index.wxss | 1 components/vant/empty/index.wxml | 22 components/vant/picker-column/index.wxss | 1 miniprogram_npm/@vant/weapp/notify/index.json | 6 pages/myMediate/index.wxml | 40 pages/myRegisterFlow/index.wxss | 88 pages/ssimDetail/index.wxss | 16 miniprogram_npm/@vant/weapp/panel/index.json | 6 miniprogram_npm/@vant/weapp/loading/index.wxs | 22 pages/perfectInformation/index.wxml | 28 miniprogram_npm/@vant/weapp/toast/toast.js | 81 components/vant/field/input.wxml | 28 miniprogram_npm/@vant/weapp/circle/canvas.js | 47 miniprogram_npm/@vant/weapp/field/index.d.ts | 1 components/vant/grid-item/index.wxs | 32 app.json | 98 miniprogram_npm/@vant/weapp/notice-bar/index.js | 124 components/vant/common/component.js | 45 miniprogram_npm/@vant/weapp/divider/index.d.ts | 1 miniprogram_npm/@vant/weapp/field/index.wxml | 56 components/vant/common/component.d.ts | 4 miniprogram_npm/@vant/weapp/grid/index.js | 57 styles/public_components.wxss | 313 miniprogram_npm/@vant/weapp/button/index.wxs | 39 miniprogram_npm/@vant/weapp/definitions/index.d.ts | 27 pages/caseType/index.wxss | 131 components/vant/tabbar-item/index.json | 7 img/case_1.png | 0 components/vant/picker-column/index.wxml | 23 components/vant/row/index.json | 3 pages/urgingList/index.wxml | 15 components/vant/search/index.wxss | 1 miniprogram_npm/@vant/weapp/card/index.js | 51 miniprogram_npm/@vant/weapp/mixins/transition.d.ts | 1 miniprogram_npm/@vant/weapp/row/index.wxss | 1 pages/myMediate/index.wxss | 41 pages/ssimDetail/index.wxml | 28 miniprogram_npm/@vant/weapp/tabs/index.wxml | 63 pages/perfectInformation/index.wxss | 9 pages/materialUpload/index.json | 4 miniprogram_npm/@vant/weapp/circle/canvas.d.ts | 4 components/vant/grid-item/index.wxml | 27 components/vant/picker-column/index.d.ts | 1 miniprogram_npm/@vant/weapp/slider/index.js | 189 components/vant/image/index.wxml | 34 miniprogram_npm/@vant/weapp/goods-action-icon/index.json | 7 miniprogram_npm/@vant/weapp/sidebar-item/index.d.ts | 1 miniprogram_npm/@vant/weapp/col/index.json | 3 components/vant/field/textarea.wxml | 29 components/vant/info/index.wxss | 30 pages/DetailPerson/index.json | 4 miniprogram_npm/@vant/weapp/collapse/index.js | 48 components/vant/grid-item/index.d.ts | 1 miniprogram_npm/@vant/weapp/calendar/components/header/index.json | 3 miniprogram_npm/@vant/weapp/icon/index.d.ts | 1 components/vant/image/index.d.ts | 1 miniprogram_npm/@vant/weapp/index-anchor/index.js | 28 miniprogram_npm/@vant/weapp/share-sheet/index.wxss | 1 miniprogram_npm/@vant/weapp/progress/index.json | 3 components/recording/index.wxml | 62 miniprogram_npm/@vant/weapp/tab/index.json | 3 miniprogram_npm/@vant/weapp/sidebar-item/index.wxml | 18 miniprogram_npm/@vant/weapp/icon/index.wxml | 20 miniprogram_npm/@vant/weapp/toast/toast.d.ts | 26 components/vant/picker/index.wxs | 42 components/vant/wxs/bem.wxs | 39 miniprogram_npm/@vant/weapp/mixins/button.d.ts | 1 pages/addPerson/index.json | 5 miniprogram_npm/@vant/weapp/button/index.js | 67 miniprogram_npm/@vant/weapp/calendar/index.json | 10 miniprogram_npm/@vant/weapp/common/index.wxss | 1 miniprogram_npm/@vant/weapp/notice-bar/index.wxs | 15 miniprogram_npm/@vant/weapp/tabs/index.d.ts | 1 miniprogram_npm/@vant/weapp/dropdown-menu/index.js | 117 pages/me/index.wxss | 97 pages/myRegisterDetail/index.js | 115 img/Like_1.png | 0 miniprogram_npm/@vant/weapp/steps/index.js | 35 pages/findAdjust/index.wxss | 139 miniprogram_npm/@vant/weapp/radio-group/index.wxml | 5 components/vant/field/index.json | 7 components/vant/tabs/index.js | 278 miniprogram_npm/@vant/weapp/collapse-item/animate.d.ts | 2 miniprogram_npm/@vant/weapp/rate/index.json | 6 miniprogram_npm/@vant/weapp/area/index.wxss | 1 pages/signIn/index.wxml | 36 pages/webview/index.json | 4 miniprogram_npm/@vant/weapp/radio-group/index.d.ts | 1 miniprogram_npm/@vant/weapp/picker-column/index.wxss | 1 pages/organizeDetail/index.json | 4 components/vant/sticky/index.json | 3 pages/realNameAuthentication/index.json | 7 components/mediate-detail/index.json | 8 miniprogram_npm/@vant/weapp/picker/index.js | 161 miniprogram_npm/@vant/weapp/info/index.wxss | 1 miniprogram_npm/@vant/weapp/tabbar/index.json | 3 components/vant/empty/index.wxss | 1 components/vant/cell-group/index.d.ts | 1 components/vant/cell-group/index.wxml | 11 pages/myRegisterFlow/index.wxml | 69 miniprogram_npm/@vant/weapp/info/index.js | 10 pages/messageCenter/index.json | 6 miniprogram_npm/@vant/weapp/tabbar-item/index.wxml | 28 pages/myJudicialConfirmation/index.wxml | 46 pages/mediateDetail/index.wxml | 9 miniprogram_npm/@vant/weapp/sticky/index.wxml | 8 components/vant/mixins/transition.js | 115 pages/speechToText/index.wxml | 79 pages/signIn/index.wxss | 40 miniprogram_npm/@vant/weapp/stepper/index.wxs | 22 miniprogram_npm/@vant/weapp/field/index.wxss | 1 components/vant/definitions/index.js | 1 miniprogram_npm/@vant/weapp/sticky/index.d.ts | 1 components/vant/popup/index.wxs | 18 img/AIAide_2.png | 0 pages/myRegisterDetail/index.json | 4 project.config.json | 55 miniprogram_npm/@vant/weapp/loading/index.json | 3 miniprogram_npm/@vant/weapp/slider/index.wxss | 1 miniprogram_npm/@vant/weapp/divider/index.wxss | 1 pages/urgingList/index.wxss | 31 components/textarea/index.wxml | 12 pages/orderConfirm/index.js | 78 miniprogram_npm/@vant/weapp/dialog/dialog.d.ts | 50 miniprogram_npm/@vant/weapp/goods-action-button/index.wxss | 1 styles/public.wxss | 253 components/vant/cell/index.wxss | 1 miniprogram_npm/@vant/weapp/calendar/index.wxs | 38 pages/caseType/index.js | 563 miniprogram_npm/@vant/weapp/common/version.js | 58 pages/assistMediate/index.js | 64 components/vant/common/utils.js | 92 pages/AIAide/index.wxss | 191 miniprogram_npm/@vant/weapp/loading/index.js | 18 miniprogram_npm/@vant/weapp/submit-bar/index.js | 58 miniprogram_npm/@vant/weapp/collapse-item/index.wxss | 1 components/vant/radio/index.wxs | 33 miniprogram_npm/@vant/weapp/checkbox/index.wxss | 1 pages/addAddress/index.wxss | 1 miniprogram_npm/@vant/weapp/icon/index.js | 22 pages/classicCase/index.js | 185 components/vant/sidebar/index.json | 3 miniprogram_npm/@vant/weapp/uploader/index.wxss | 1 components/vant/toast/index.json | 9 components/vant/checkbox-group/index.json | 3 components/vant/divider/index.wxml | 9 miniprogram_npm/@vant/weapp/skeleton/index.d.ts | 1 components/vant/datetime-picker/index.json | 6 miniprogram_npm/@vant/weapp/common/validator.js | 43 components/drop-down-select/index.wxss | 101 pages/register/index.wxss | 905 + components/vant/loading/index.json | 3 utils/wxs/util.wxs | 55 miniprogram_npm/@vant/weapp/mixins/basic.d.ts | 1 components/vant/picker/index.js | 136 miniprogram_npm/@vant/weapp/area/index.wxml | 20 img/AIAide_1.png | 0 pages/DetailPerson/index.js | 79 pages/addFilesList/index.js | 66 components/steps/index.json | 4 pages/classicCase/index.wxml | 43 pages/AIAide/index.wxml | 114 miniprogram_npm/@vant/weapp/picker-column/index.wxml | 23 miniprogram_npm/@vant/weapp/picker-column/index.d.ts | 1 pages/homePage/index.wxml | 183 miniprogram_npm/@vant/weapp/wxs/utils.wxs | 10 components/vant/common/version.d.ts | 7 components/vant/info/index.d.ts | 1 components/vant/common/style/mixins/ellipsis.wxss | 0 components/vant/popup/index.d.ts | 1 miniprogram_npm/@vant/weapp/picker/shared.d.ts | 21 components/vant/sidebar-item/index.json | 6 components/vant/popup/index.wxml | 39 miniprogram_npm/@vant/weapp/area/index.d.ts | 1 components/vant/search/index.wxml | 53 miniprogram_npm/@vant/weapp/picker-column/index.js | 122 components/vant/cell-group/index.wxss | 1 miniprogram_npm/@vant/weapp/popup/index.wxs | 18 pages/addFilesList/index.json | 3 app.js | 55 components/vant/rate/index.json | 6 miniprogram_npm/@vant/weapp/tabs/index.wxss | 1 miniprogram_npm/@vant/weapp/calendar/components/month/index.d.ts | 6 miniprogram_npm/@vant/weapp/transition/index.wxs | 17 components/common-page/index.wxss | 23 miniprogram_npm/@vant/weapp/button/index.json | 7 miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml | 39 miniprogram_npm/@vant/weapp/tabbar-item/index.wxss | 1 components/vant/toast/toast.js | 66 components/vant/cell/index.wxs | 17 miniprogram_npm/@vant/weapp/skeleton/index.wxml | 29 components/vant/divider/index.d.ts | 1 components/vant/info/index.wxml | 7 miniprogram_npm/@vant/weapp/swipe-cell/index.d.ts | 1 components/vant/search/index.d.ts | 1 components/vant/common/style/hairline.wxss | 1 components/vant/transition/index.js | 13 miniprogram_npm/@vant/weapp/count-down/utils.d.ts | 10 miniprogram_npm/@vant/weapp/tab/index.js | 58 miniprogram_npm/@vant/weapp/nav-bar/index.json | 6 miniprogram_npm/@vant/weapp/swipe-cell/index.wxml | 20 miniprogram_npm/@vant/weapp/tree-select/index.d.ts | 1 pages/floatImagePage/index.js | 663 miniprogram_npm/@vant/weapp/share-sheet/index.d.ts | 1 miniprogram_npm/@vant/weapp/cell-group/index.js | 13 miniprogram_npm/@vant/weapp/tree-select/index.wxml | 41 miniprogram_npm/@vant/weapp/sidebar/index.js | 36 miniprogram_npm/@vant/weapp/wxs/bem.wxs | 39 miniprogram_npm/@vant/weapp/share-sheet/index.wxml | 46 components/textarea/index.json | 4 pages/addAddress/index.js | 66 miniprogram_npm/@vant/weapp/image/index.wxss | 1 components/vant/mixins/link.js | 23 components/vant/popup/index.wxss | 151 pages/organizeDetail/index.js | 51 components/time-format/index.json | 4 components/vant/action-sheet/index.wxss | 1 components/vant/common/index.wxss | 69 miniprogram_npm/@vant/weapp/radio/index.wxs | 33 components/vant/tabs/index.d.ts | 1 miniprogram_npm/@vant/weapp/config-provider/index.d.ts | 1 components/vant/tabs/index.wxml | 63 miniprogram_npm/@vant/weapp/field/input.wxml | 28 img/meeting_1.png | 0 miniprogram_npm/@vant/weapp/config-provider/index.wxml | 5 miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss | 1 miniprogram_npm/@vant/weapp/dialog/index.d.ts | 1 miniprogram_npm/@vant/weapp/mixins/touch.js | 40 components/vant/button/index.wxs | 39 miniprogram_npm/@vant/weapp/wxs/add-unit.wxs | 12 miniprogram_npm/@vant/weapp/dialog/index.wxml | 113 miniprogram_npm/@vant/weapp/checkbox/index.wxml | 31 components/vant/radio-group/index.json | 3 pages/addAddress/index.wxml | 2 miniprogram_npm/@vant/weapp/switch/index.json | 6 miniprogram_npm/@vant/weapp/picker/toolbar.wxml | 23 pages/homePage/index.json | 6 pages/autograph/index.wxml | 20 miniprogram_npm/@vant/weapp/collapse/index.d.ts | 1 miniprogram_npm/@vant/weapp/collapse/index.wxml | 3 pages/addUnit/index.wxss | 95 pages/organizeList/index.wxml | 41 miniprogram_npm/@vant/weapp/tabbar-item/index.json | 7 pages/materialShow/index.wxml | 43 package-lock.json | 3 components/vant/tabbar/index.json | 3 miniprogram_npm/@vant/weapp/cell/index.json | 6 miniprogram_npm/@vant/weapp/wxs/memoize.wxs | 55 miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss | 0 components/drop-down-select/index.wxml | 36 miniprogram_npm/@vant/weapp/grid-item/index.json | 6 miniprogram_npm/@vant/weapp/area/index.js | 232 miniprogram_npm/@vant/weapp/action-sheet/index.js | 73 components/vant/search/index.js | 89 pages/myMediate/index.js | 223 sitemap.json | 7 pages/homePageInfo/index.wxml | 24 miniprogram_npm/@vant/weapp/index-anchor/index.json | 3 components/steps/index.wxss | 82 miniprogram_npm/@vant/weapp/swipe-cell/index.js | 135 pages/mediateDetail/index.wxss | 14 miniprogram_npm/@vant/weapp/circle/index.wxml | 9 pages/myRegisterList/index.json | 6 pages/speechToText/index.wxss | 227 miniprogram_npm/@vant/weapp/calendar/components/month/index.json | 3 components/vant/divider/index.json | 4 api/api.js | 44 components/vant/field/index.wxml | 57 miniprogram_npm/@vant/weapp/circle/index.d.ts | 1 components/vant/checkbox/index.wxml | 31 miniprogram_npm/@vant/weapp/calendar/components/header/index.js | 45 components/tabbar-page/index.wxml | 37 components/vant/checkbox/index.d.ts | 1 miniprogram_npm/@vant/weapp/goods-action/index.wxml | 5 miniprogram_npm/@vant/weapp/goods-action/index.d.ts | 1 miniprogram_npm/@vant/weapp/search/index.json | 6 miniprogram_npm/@vant/weapp/slider/index.wxml | 68 pages/agreement/index.wxss | 19 miniprogram_npm/@vant/weapp/nav-bar/index.wxml | 42 miniprogram_npm/@vant/weapp/empty/index.json | 4 pages/webview/index.js | 18 miniprogram_npm/@vant/weapp/sticky/index.json | 3 miniprogram_npm/@vant/weapp/share-sheet/options.js | 27 miniprogram_npm/@vant/weapp/nav-bar/index.d.ts | 1 pages/speechToText/index.js | 207 miniprogram_npm/@vant/weapp/tabs/index.wxs | 82 components/vant/cell/index.wxml | 47 miniprogram_npm/@vant/weapp/mixins/transition.js | 121 pages/login/index.json | 3 components/vant/overlay/index.js | 26 components/vant/cell/index.d.ts | 1 miniprogram_npm/@vant/weapp/radio-group/index.js | 24 components/vant/sidebar/index.d.ts | 1 components/vant/radio/index.wxss | 1 components/vant/action-sheet/index.d.ts | 1 components/vant/sidebar-item/index.d.ts | 1 components/vant/sidebar-item/index.wxml | 18 miniprogram_npm/@vant/weapp/cell-group/index.wxss | 1 miniprogram_npm/@vant/weapp/slider/index.d.ts | 1 miniprogram_npm/@vant/weapp/image/index.d.ts | 1 styles/animate.wxss | 31 miniprogram_npm/@vant/weapp/swipe-cell/index.wxss | 1 components/vant/rate/index.wxml | 35 miniprogram_npm/@vant/weapp/grid/index.json | 3 components/vant/rate/index.d.ts | 1 miniprogram_npm/@vant/weapp/sidebar/index.wxss | 1 components/vant/picker-column/index.js | 118 components/tabbar-page/index.wxss | 73 components/vant/checkbox/index.wxss | 1 components/vant/common/style/var.wxss | 0 miniprogram_npm/@vant/weapp/checkbox/index.d.ts | 1 components/vant/mixins/button.js | 41 miniprogram_npm/@vant/weapp/uploader/index.wxml | 83 components/tooltip/index.json | 4 miniprogram_npm/@vant/weapp/notify/index.wxs | 22 miniprogram_npm/@vant/weapp/dropdown-menu/index.d.ts | 1 miniprogram_npm/@vant/weapp/uploader/index.d.ts | 1 components/personal-data-dom/index.json | 4 components/vant/sidebar/index.wxml | 3 components/vant/checkbox-group/index.wxml | 5 components/vant/action-sheet/index.wxml | 69 pages/register/index.wxml | 411 components/vant/common/style/mixins/hairline.wxss | 0 miniprogram_npm/@vant/weapp/mixins/button.js | 44 components/vant/tabs/index.wxss | 115 pages/floatImagePage/index.wxml | 176 miniprogram_npm/@vant/weapp/picker/index.wxss | 1 pages/myJudicialConfirmation/index.wxss | 2 components/vant/checkbox-group/index.d.ts | 1 miniprogram_npm/@vant/weapp/uploader/shared.d.ts | 28 miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml | 23 miniprogram_npm/@vant/weapp/steps/index.json | 6 miniprogram_npm/@vant/weapp/count-down/index.json | 3 miniprogram_npm/@vant/weapp/notice-bar/index.wxss | 1 pages/addAgent/index.json | 4 components/vant/picker/toolbar.wxml | 23 pages/AIAideDetail/index.json | 4 components/vant/action-sheet/index.js | 73 miniprogram_npm/@vant/weapp/checkbox-group/index.json | 3 miniprogram_npm/@vant/weapp/goods-action/index.js | 17 pages/classicCase/index.wxss | 101 miniprogram_npm/@vant/weapp/goods-action-button/index.js | 38 components/vant/common/style/clearfix.wxss | 1 components/vant/picker/index.wxss | 1 miniprogram_npm/@vant/weapp/action-sheet/index.wxml | 69 pages/organizeList/index.wxss | 83 components/personal-data-dom/index.js | 169 components/ellipsis-text/index.js | 66 miniprogram_npm/@vant/weapp/dropdown-item/index.js | 107 components/vant/icon/index.wxs | 39 miniprogram_npm/@vant/weapp/action-sheet/index.d.ts | 1 miniprogram_npm/@vant/weapp/share-sheet/options.wxs | 14 miniprogram_npm/@vant/weapp/common/style/hairline.wxss | 1 miniprogram_npm/@vant/weapp/toast/index.json | 9 components/ellipsis-text/index.wxss | 29 miniprogram_npm/@vant/weapp/circle/index.wxss | 1 pages/evaluate/index.json | 4 miniprogram_npm/@vant/weapp/popup/index.d.ts | 1 pages/assistMediate/index.wxml | 25 miniprogram_npm/@vant/weapp/wxs/style.wxs | 42 pages/addPerson/index.wxml | 195 miniprogram_npm/@vant/weapp/notice-bar/index.wxml | 38 miniprogram_npm/@vant/weapp/calendar/index.js | 360 miniprogram_npm/@vant/weapp/share-sheet/options.d.ts | 1 miniprogram_npm/@vant/weapp/dropdown-item/index.json | 8 miniprogram_npm/@vant/weapp/sidebar-item/index.json | 6 pages/addAgent/index.js | 322 components/vant/field/index.wxss | 134 components/vant/image/index.wxs | 32 components/vant/overlay/index.wxss | 1 miniprogram_npm/@vant/weapp/common/style/var.wxss | 0 miniprogram_npm/@vant/weapp/goods-action/index.wxss | 1 miniprogram_npm/@vant/weapp/share-sheet/options.wxml | 20 components/vant/tabbar-item/index.js | 56 miniprogram_npm/@vant/weapp/sidebar/index.wxml | 3 miniprogram_npm/@vant/weapp/row/index.js | 26 miniprogram_npm/@vant/weapp/notice-bar/index.d.ts | 1 miniprogram_npm/@vant/weapp/submit-bar/index.wxml | 44 miniprogram_npm/@vant/weapp/stepper/index.d.ts | 1 miniprogram_npm/@vant/weapp/icon/index.wxs | 39 miniprogram_npm/@vant/weapp/stepper/index.wxml | 44 miniprogram_npm/@vant/weapp/uploader/index.js | 170 miniprogram_npm/@vant/weapp/card/index.d.ts | 1 components/vant/checkbox/index.js | 77 components/vant/grid-item/index.wxss | 1 components/vant/col/index.wxss | 1 miniprogram_npm/@vant/weapp/dialog/index.wxss | 1 pages/orderConfirm/index.json | 4 miniprogram_npm/@vant/weapp/common/color.js | 10 miniprogram_npm/@vant/weapp/sticky/index.wxs | 25 components/vant/mixins/button.d.ts | 1 miniprogram_npm/@vant/weapp/card/index.wxml | 56 pages/autograph/index.wxss | 13 miniprogram_npm/@vant/weapp/sidebar/index.d.ts | 1 components/vant/icon/index.wxss | 1 components/mediate-card/index.wxss | 418 images/avatar.png | 0 components/vant/transition/index.wxml | 14 pages/homePageInfo/index.js | 47 components/vant/button/index.json | 7 pages/materialShow/index.js | 169 components/vant/transition/index.d.ts | 1 miniprogram_npm/@vant/weapp/slider/index.wxs | 14 pages/homePageInfo/index.wxss | 40 miniprogram_npm/@vant/weapp/common/relation.js | 65 pages/floatImagePage/index.wxss | 711 components/vant/switch/index.json | 6 miniprogram_npm/@vant/weapp/stepper/index.wxss | 1 components/vant/common/relation.d.ts | 15 components/vant/sticky/index.wxml | 8 project.private.config.json | 11 components/vant/picker/index.d.ts | 1 miniprogram_npm/@vant/weapp/submit-bar/index.d.ts | 1 miniprogram_npm/@vant/weapp/card/index.wxss | 1 miniprogram_npm/@vant/weapp/uploader/utils.js | 102 components/tooltip/index.js | 25 components/vant/field/props.d.ts | 4 miniprogram_npm/@vant/weapp/overlay/index.json | 6 miniprogram_npm/@vant/weapp/tag/index.wxs | 13 pages/course/index.json | 5 components/vant/icon/index.d.ts | 1 components/vant/icon/index.wxml | 20 components/vant/common/style/mixins/clearfix.wxss | 0 components/vant/picker/index.wxml | 37 components/vant/sidebar/index.js | 36 miniprogram_npm/@vant/weapp/row/index.d.ts | 1 components/vant/tabs/index.wxs | 82 pages/agreement/index.wxml | 11 miniprogram_npm/@vant/weapp/radio/index.js | 68 components/vant/field/index.wxs | 18 miniprogram_npm/@vant/weapp/action-sheet/index.wxss | 1 miniprogram_npm/@vant/weapp/cell-group/index.d.ts | 1 miniprogram_npm/@vant/weapp/popup/index.wxml | 26 miniprogram_npm/@vant/weapp/goods-action-icon/index.js | 27 miniprogram_npm/@vant/weapp/row/index.wxml | 5 components/file-card/index.json | 4 miniprogram_npm/@vant/weapp/mixins/link.js | 27 components/vant/grid-item/index.js | 54 components/vant/radio/index.wxml | 30 miniprogram_npm/@vant/weapp/cell-group/index.wxml | 11 components/vant/image/index.wxss | 1 pages/assistMediate/index.wxss | 24 components/vant/divider/index.js | 12 components/vant/radio/index.d.ts | 1 components/vant/common/relation.js | 56 components/vant/picker/shared.js | 21 components/vant/popup/index.js | 81 miniprogram_npm/@vant/weapp/datetime-picker/index.json | 6 components/vant/overlay/index.d.ts | 1 components/vant/wxs/style.wxs | 42 components/vant/overlay/index.wxml | 21 pages/homePage/index.js | 400 miniprogram_npm/@vant/weapp/share-sheet/options.wxss | 1 pages/addUnit/index.wxml | 53 pages/materialShow/index.wxss | 92 components/mediate-detail/index.js | 163 miniprogram_npm/@vant/weapp/col/index.d.ts | 1 components/vant/checkbox-group/index.js | 36 components/vant/tab/index.wxss | 1 miniprogram_npm/@vant/weapp/submit-bar/index.json | 7 miniprogram_npm/@vant/weapp/dialog/dialog.js | 90 miniprogram_npm/@vant/weapp/index-bar/index.json | 3 miniprogram_npm/@vant/weapp/transition/index.js | 15 miniprogram_npm/@vant/weapp/radio/index.wxss | 1 miniprogram_npm/@vant/weapp/tabbar/index.js | 68 miniprogram_npm/@vant/weapp/common/relation.d.ts | 15 miniprogram_npm/@vant/weapp/radio-group/index.json | 3 miniprogram_npm/@vant/weapp/calendar/index.wxml | 25 miniprogram_npm/@vant/weapp/skeleton/index.json | 4 miniprogram_npm/@vant/weapp/icon/index.json | 6 miniprogram_npm/@vant/weapp/notify/notify.js | 60 pages/materialUpload/index.js | 297 components/mediate-detail/index.wxml | 269 miniprogram_npm/@vant/weapp/transition/index.wxss | 1 miniprogram_npm/@vant/weapp/calendar/index.d.ts | 1 miniprogram_npm/@vant/weapp/rate/index.wxml | 35 pages/login/index.js | 67 miniprogram_npm/@vant/weapp/calendar/components/month/index.js | 158 miniprogram_npm/@vant/weapp/progress/index.wxss | 1 miniprogram_npm/@vant/weapp/tab/index.wxss | 1 components/vant/mixins/touch.d.ts | 1 components/vant/switch/index.wxml | 16 components/vant/switch/index.d.ts | 1 miniprogram_npm/@vant/weapp/button/index.wxml | 53 miniprogram_npm/@vant/weapp/button/index.d.ts | 1 miniprogram_npm/@vant/weapp/count-down/utils.js | 64 pages/messageCenter/index.wxml | 53 pages/findAdjust/index.js | 264 miniprogram_npm/@vant/weapp/goods-action-icon/index.d.ts | 1 components/file-card/index.wxss | 43 images/me_2.png | 0 miniprogram_npm/@vant/weapp/rate/index.d.ts | 1 app.wxss | 98 components/vant/cell-group/index.js | 11 components/vant/transition/index.wxss | 1 components/vant/common/color.js | 7 components/vant/empty/index.wxs | 15 miniprogram_npm/@vant/weapp/share-sheet/index.js | 57 components/vant/picker-column/index.json | 3 pages/signIn/index.js | 72 miniprogram_npm/@vant/weapp/switch/index.js | 38 pages/register/index.js | 947 + components/vant/checkbox/index.wxs | 20 components/vant/sticky/index.d.ts | 1 miniprogram_npm/@vant/weapp/goods-action-icon/index.wxml | 36 components/vant/grid/index.js | 57 miniprogram_npm/@vant/weapp/stepper/index.js | 200 miniprogram_npm/@vant/weapp/divider/index.wxs | 18 miniprogram_npm/@vant/weapp/tree-select/index.json | 8 pages/ssimList/index.json | 4 components/vant/field/index.js | 107 miniprogram_npm/@vant/weapp/toast/index.js | 31 components/ellipsis-text/index.wxml | 8 pages/myRegisterList/index.js | 253 miniprogram_npm/@vant/weapp/panel/index.wxss | 1 components/recording/index.json | 6 pages/ssimDetail/index.json | 5 miniprogram_npm/@vant/weapp/tag/index.json | 6 components/vant/datetime-picker/index.wxss | 1 components/vant/row/index.wxss | 1 miniprogram_npm/@vant/weapp/notify/index.wxss | 1 pages/DetailPerson/index.wxml | 43 components/vant/wxs/object.wxs | 13 miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss | 0 pages/myRegisterFlow/index.json | 6 miniprogram_npm/@vant/weapp/common/version.d.ts | 7 components/vant/wxs/add-unit.wxs | 12 components/vant/grid/index.d.ts | 1 components/vant/search/index.json | 6 components/vant/empty/index.js | 10 miniprogram_npm/@vant/weapp/popup/index.wxss | 1 .eslintrc.js | 31 miniprogram_npm/@vant/weapp/config-provider/index.wxs | 29 miniprogram_npm/@vant/weapp/goods-action-icon/index.wxss | 1 components/vant/grid/index.wxml | 8 miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss | 1 miniprogram_npm/@vant/weapp/loading/index.d.ts | 1 miniprogram_npm/@vant/weapp/share-sheet/index.json | 7 pages/organizeList/index.js | 259 pages/realNameAuthentication/index.wxss | 19 miniprogram_npm/@vant/weapp/row/index.json | 3 components/vant/radio/index.js | 68 miniprogram_npm/@vant/weapp/notify/index.d.ts | 1 miniprogram_npm/@vant/weapp/area/index.json | 6 components/vant/info/index.json | 3 components/vant/tab/index.d.ts | 1 miniprogram_npm/@vant/weapp/col/index.wxss | 1 miniprogram_npm/@vant/weapp/notify/index.wxml | 21 pages/caseType/index.json | 4 pages/DetailPerson/index.wxss | 16 miniprogram_npm/@vant/weapp/nav-bar/index.wxs | 13 miniprogram_npm/@vant/weapp/wxs/object.wxs | 13 components/vant/grid/index.wxs | 13 components/vant/tab/index.wxml | 8 pages/me/index.js | 72 miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss | 0 miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs | 71 miniprogram_npm/@vant/weapp/panel/index.d.ts | 1 miniprogram_npm/@vant/weapp/tag/index.js | 23 miniprogram_npm/@vant/weapp/field/textarea.wxml | 29 miniprogram_npm/@vant/weapp/calendar/index.wxss | 1 components/common-page/index.js | 190 miniprogram_npm/@vant/weapp/field/index.js | 122 miniprogram_npm/@vant/weapp/mixins/link.d.ts | 1 miniprogram_npm/@vant/weapp/picker-column/index.json | 3 pages/organizeDetail/index.wxss | 16 miniprogram_npm/@vant/weapp/field/index.json | 7 components/mediate-detail/index.wxss | 121 components/vant/sticky/index.wxss | 1 miniprogram_npm/@vant/weapp/loading/index.wxml | 19 components/vant/empty/index.json | 4 pages/myMediate/index.json | 8 pages/webview/index.wxss | 1 img/close.png | 0 pages/addPerson/index.wxss | 194 components/vant/rate/index.js | 93 miniprogram_npm/@vant/weapp/rate/index.wxss | 1 components/vant/image/index.js | 60 pages/findAdjust/index.json | 7 components/vant/tabbar-item/index.wxss | 29 pages/perfectInformation/index.json | 6 pages/me/index.json | 4 miniprogram_npm/@vant/weapp/sticky/index.js | 124 miniprogram_npm/@vant/weapp/info/index.json | 3 miniprogram_npm/@vant/weapp/tabbar/index.wxss | 1 components/vant/sidebar/index.wxss | 1 img/me-center.png | 0 pages/messageCenter/index.js | 124 pages/myRegisterDetail/index.wxss | 169 miniprogram_npm/@vant/weapp/empty/index.wxs | 15 components/vant/switch/index.js | 36 miniprogram_npm/@vant/weapp/overlay/index.js | 28 miniprogram_npm/@vant/weapp/collapse-item/animate.js | 43 miniprogram_npm/@vant/weapp/field/props.d.ts | 4 miniprogram_npm/@vant/weapp/switch/index.wxml | 16 components/vant/toast/toast.d.ts | 26 miniprogram_npm/@vant/weapp/panel/index.wxml | 19 miniprogram_npm/@vant/weapp/popup/index.js | 91 components/vant/datetime-picker/index.d.ts | 1 components/vant/info/index.js | 8 pages/signIn/index.json | 4 components/vant/datetime-picker/index.wxml | 16 components/vant/row/index.wxml | 5 components/vant/transition/index.wxs | 17 miniprogram_npm/@vant/weapp/grid-item/index.wxs | 32 components/vant/row/index.d.ts | 1 miniprogram_npm/@vant/weapp/collapse-item/index.json | 6 miniprogram_npm/@vant/weapp/common/component.js | 48 images/me_3.png | 0 pages/urgingList/index.json | 6 miniprogram_npm/@vant/weapp/mixins/page-scroll.js | 42 miniprogram_npm/@vant/weapp/image/index.wxml | 34 pages/AIAide/index.json | 6 img/criticize_1.png | 0 miniprogram_npm/@vant/weapp/switch/index.d.ts | 1 components/vant/sticky/index.wxs | 25 miniprogram_npm/@vant/weapp/slider/index.json | 3 components/time-format/index.js | 53 img/finish_1.png | 0 components/vant/field/props.js | 64 miniprogram_npm/@vant/weapp/checkbox/index.json | 6 components/vant/tabbar/index.js | 69 miniprogram_npm/@vant/weapp/checkbox/index.js | 79 miniprogram_npm/@vant/weapp/notify/notify.d.ts | 20 miniprogram_npm/@vant/weapp/progress/index.d.ts | 1 components/vant/common/style/ellipsis.wxss | 1 miniprogram_npm/@vant/weapp/tab/index.d.ts | 1 miniprogram_npm/@vant/weapp/notify/index.js | 68 miniprogram_npm/@vant/weapp/config-provider/index.json | 3 components/vant/mixins/transition.d.ts | 1 components/vant/toast/index.wxml | 36 miniprogram_npm/@vant/weapp/switch/index.wxs | 26 miniprogram_npm/@vant/weapp/progress/index.wxml | 20 miniprogram_npm/@vant/weapp/steps/index.wxml | 54 miniprogram_npm/@vant/weapp/tab/index.wxml | 8 miniprogram_npm/@vant/weapp/collapse/index.wxss | 1 pages/materialUpload/index.wxss | 58 pages/messageCenter/index.wxss | 104 components/vant/cell/index.json | 6 components/vant/toast/index.d.ts | 1 miniprogram_npm/@vant/weapp/progress/index.wxs | 36 pages/agreement/index.js | 33 components/vant/row/index.js | 23 pages/register/index.json | 8 components/vant/field/index.d.ts | 1 miniprogram_npm/@vant/weapp/steps/index.d.ts | 1 miniprogram_npm/@vant/weapp/picker/index.d.ts | 1 miniprogram_npm/@vant/weapp/share-sheet/index.wxs | 12 miniprogram_npm/@vant/weapp/picker-column/index.wxs | 36 pages/AIAideDetail/index.js | 97 components/vant/checkbox-group/index.wxss | 1 pages/organizeDetail/index.wxml | 28 miniprogram_npm/@vant/weapp/picker/index.wxml | 37 components/steps/index.wxml | 42 components/vant/icon/index.js | 20 pages/realNameAuthentication/index.wxml | 33 miniprogram_npm/@vant/weapp/mixins/touch.d.ts | 1 miniprogram_npm/@vant/weapp/skeleton/index.js | 48 miniprogram_npm/@vant/weapp/goods-action-button/index.json | 6 miniprogram_npm/@vant/weapp/divider/index.json | 4 miniprogram_npm/@vant/weapp/tabbar/index.d.ts | 1 components/vant/sticky/index.js | 118 components/common-page/index.json | 4 components/vant/toast/index.wxss | 49 miniprogram_npm/@vant/weapp/circle/index.js | 203 components/file-card/index.js | 66 miniprogram_npm/@vant/weapp/uploader/index.json | 7 components/vant/loading/index.wxss | 1 miniprogram_npm/@vant/weapp/empty/index.js | 12 components/vant/wxs/utils.wxs | 10 miniprogram_npm/@vant/weapp/nav-bar/index.wxss | 1 miniprogram_npm/@vant/weapp/tabs/index.json | 7 miniprogram_npm/@vant/weapp/datetime-picker/index.js | 329 components/vant/mixins/touch.js | 37 miniprogram_npm/@vant/weapp/radio/index.d.ts | 1 images/me_1.png | 0 miniprogram_npm/@vant/weapp/radio/index.wxml | 30 components/vant/common/utils.d.ts | 14 miniprogram_npm/@vant/weapp/uploader/index.wxs | 14 components/vant/common/validator.js | 31 miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml | 16 components/vant/radio-group/index.d.ts | 1 miniprogram_npm/@vant/weapp/dropdown-item/shared.js | 2 miniprogram_npm/@vant/weapp/area/index.wxs | 8 miniprogram_npm/@vant/weapp/calendar/components/header/index.d.ts | 1 components/vant/radio-group/index.wxml | 5 miniprogram_npm/@vant/weapp/transition/index.wxml | 10 miniprogram_npm/@vant/weapp/loading/index.wxss | 1 miniprogram_npm/@vant/weapp/transition/index.d.ts | 1 components/drop-down-select/index.json | 4 font/DingTalk_JinBuTi_Regular.ttf | 0 pages/addFilesList/index.wxss | 1 miniprogram_npm/@vant/weapp/common/component.d.ts | 4 miniprogram_npm/@vant/weapp/divider/index.js | 14 components/vant/sidebar-item/index.wxss | 1 components/vant/cell-group/index.json | 3 pages/autograph/index.js | 37 miniprogram_npm/@vant/weapp/picker/shared.js | 24 components/vant/rate/index.wxss | 1 miniprogram_npm/@vant/weapp/button/index.wxss | 1 miniprogram_npm/@vant/weapp/grid/index.wxs | 13 miniprogram_npm/@vant/weapp/definitions/index.js | 2 964 files changed, 43,397 insertions(+), 0 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/READEME.md b/READEME.md new file mode 100644 index 0000000..1a192cc --- /dev/null +++ b/READEME.md @@ -0,0 +1,39 @@ +<!-- + * @Company: hugeInfo + * @Author: ldh + * @Date: 2022-06-06 11:12:28 + * @LastEditTime: 2022-12-02 11:59:52 + * @LastEditors: ldh + * @Version: 1.0.0 + * @Description: 项目说明 +--> +# 项目说明 + +## 注意说明 + +### 1、发布项目需要注意 util.js 中 isDebug 变量控制 api 的选择,api 包含了测试和正式区分 + +### 2、项目引入了vant组件库的源码 + +- style中的public.css是全局样式变量,也是vant的全局样式变量 + +- 项目对于vant的源码做了部分修改,所以更新的时候需要注意,如有未提及的修改可自行判断 + +``` +1: tabbar - 添加了一个myHeight: string(单位px)的传入参数指定tabbar高度 +2: popup - 修改了当position==='bottom'时使用自定义的样式 +3: toast - 修改了展示样式 +4: tabs - 添加一个disabled: boolean的传入参数指定当前tabs组件不可点击,但是vant的click操作可以响应 +``` + +## 项目结构 + +``` +├── api # 项目api接口 +├── components # 公共组件,页面组件库 +├── pages # 页面 +├── styles # 样式 +├── utils # 公共方法,wxs文件 +├── app.js +├── app.wsss +└── app.json diff --git a/api/api.js b/api/api.js new file mode 100644 index 0000000..3b20bdd --- /dev/null +++ b/api/api.js @@ -0,0 +1,44 @@ +const testUrl = { + // === 测试环境 === + // web: 'http://x6dvxr.natappfree.cc/', + // img: 'http://120.79.193.119:9103/wx414ae04ac3f10b4e/images/', + // assets: 'http://120.79.193.119:9103/wx414ae04ac3f10b4e/js/', + // txt: 'http://120.79.193.119:9103/wx414ae04ac3f10b4e/txt/', + web: 'https://zfw-dyh.by.gov.cn/', + img: 'https://zfw-dyh.by.gov.cn/gztest/wechat/images/', + assets: 'https://zfw-dyh.by.gov.cn/gztest/wechat/js/', + txt: 'https://zfw-dyh.by.gov.cn/gztest/wechat/txt/', + + // === 测试环境 === + fileShowUrl: 'gzdyh-test-sys', + fileDownUrl: 'gzdyh-test-sys', + mediate: 'gzdyh-test-mediate', // dyh-mediate + cust: 'gzdyh-test-cust', // dyh-cust + oper: 'gzdyh-test-oper', // dyh-oper + sys: 'gzdyh-test-sys', // dyh-sys + disp: 'gzdyh-test-disp', //dyh-disp + utils: 'gzdyh-test-utils', //dyh-utils +}; + +const url = { + // === 正式环境 === + web: 'https://zfw-dyh.by.gov.cn/', + img: 'https://zfw-dyh.by.gov.cn/gz/wechat/images/', + assets: 'https://zfw-dyh.by.gov.cn/gz/wechat/js/', + txt: 'https://zfw-dyh.by.gov.cn/gz/wechat/txt/', + + //正式环境 + fileShowUrl: 'gzdyh-sys', + fileDownUrl: 'gzdyh-sys', + mediate: 'gzdyh-mediate', // gzdyh-mediate + cust: 'gzdyh-cust', // gzdyh-cust + oper: 'gzdyh-oper', // gzdyh-oper + sys: 'gzdyh-sys', // gzdyh-sys + disp: 'gzdyh-disp', //gzdyh-disp + utils: 'gzdyh-utils', //gzdyh-utils +}; + +module.exports = { + url, + testUrl +}; \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..c164f94 --- /dev/null +++ b/app.js @@ -0,0 +1,55 @@ +// app.js +const $$ = require('./utils/util'); + +App({ + onLaunch() { + // 字体 + wx.loadFontFace({ + family: 'DingTalk', // 字体名称 + source: 'url("../../font/DingTalk_JinBuTi_Regular.ttf")', + global: true, // 是否全局生效 + }) + // 小程序更新 + const updateManager = wx.getUpdateManager(); + updateManager.onCheckForUpdate(function (res) { + // 请求完新版本信息的回调 + if (res.hasUpdate == true) { + updateManager.onUpdateReady(function () { + $$.loginOutClearData(); + wx.showModal({ + title: '更新提示', + content: '检测到新版本更新', + showCancel: false, + success(res) { + if (res.confirm) { + // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate(); + } + }, + }); + }); + } + }); + updateManager.onUpdateFailed(function () { + // 新版本下载失败 + wx.showModal({ + title: '已经有新版本了哟~', + content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~', + }); + }); + // 获取缓存的token + let userInfo = wx.getStorageSync('userInfo'); + if (userInfo) { + this.globalData.token = userInfo.token; + } + }, + globalData: { + token: '', // 用户token + material: { + uploadVisible: false, + data: [], // 材料上传的数据 + person: [], // 申请调解页面进入附件上传页面时,需要传递的申请人,代理人,被申请人的数据,便于身份材料时选择 + }, + caseMsg: {}, // 案件详情,用于我的申请时跳转到其他页面传输案件的数据。 + }, +}); \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..b4ba4e7 --- /dev/null +++ b/app.json @@ -0,0 +1,98 @@ +{ + "pages": [ + "pages/homePage/index", + "pages/homePageInfo/index", + "pages/messageCenter/index", + "pages/register/index", + "pages/caseType/index", + "pages/addAddress/index", + "pages/speechToText/index", + "pages/addPerson/index", + "pages/addUnit/index", + "pages/addAgent/index", + "pages/addFilesList/index", + "pages/urgingList/index", + "pages/DetailPerson/index", + "pages/AIAide/index", + "pages/AIAideDetail/index", + "pages/evaluate/index", + "pages/myRegisterList/index", + "pages/myRegisterFlow/index", + "pages/myRegisterDetail/index", + "pages/autograph/index", + "pages/course/index", + "pages/orderConfirm/index", + "pages/mediateDetail/index", + "pages/materialShow/index", + "pages/findAdjust/index", + "pages/assistMediate/index", + "pages/myMediate/index", + "pages/me/index", + "pages/myJudicialConfirmation/index", + "pages/signIn/index", + "pages/materialUpload/index", + "pages/realNameAuthentication/index", + "pages/perfectInformation/index", + "pages/agreement/index", + "pages/login/index", + "pages/webview/index", + "pages/classicCase/index", + "pages/ssimList/index", + "pages/ssimDetail/index", + "pages/organizeDetail/index", + "pages/organizeList/index", + "pages/floatImagePage/index" + ], + "window": { + "backgroundTextStyle": "dark", + "navigationBarBackgroundColor": "#1A6FB8", + "navigationBarTitleText": "广州解纷码", + "navigationBarTextStyle": "white", + "backgroundColor": "#d10202", + "backgroundColorTop": "#d10202", + "backgroundColorBottom": "#d10202" + }, + "sitemapLocation": "sitemap.json", + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于推荐附近的调解员或调解组织" + } + }, + "usingComponents": { + "tabbar-page": "./components/tabbar-page/index", + "common-page": "./components/common-page/index", + "van-icon": "./components/vant/icon/index", + "van-button": "./components/vant/button/index", + "van-tabbar": "./components/vant/tabbar/index", + "van-tabbar-item": "./components/vant/tabbar-item/index", + "van-overlay": "./components/vant/overlay/index", + "van-picker": "./components/vant/picker/index", + "van-popup": "./components/vant/popup/index", + "van-row": "./components/vant/row/index", + "van-col": "./components/vant/col/index", + "van-search": "./components/vant/search/index", + "van-divider": "./components/vant/divider/index", + "van-tab": "./components/vant/tab/index", + "van-tabs": "./components/vant/tabs/index", + "van-empty": "./components/vant/empty/index", + "van-image": "./components/vant/image/index", + "van-loading": "./components/vant/loading/index", + "van-cell": "./components/vant/cell/index", + "van-cell-group": "./components/vant/cell-group/index", + "van-field": "./components/vant/field/index", + "van-radio": "./components/vant/radio/index", + "van-radio-group": "./components/vant/radio-group/index", + "van-checkbox": "./components/vant/checkbox/index", + "van-checkbox-group": "./components/vant/checkbox-group/index", + "van-toast": "./components/vant/toast/index", + "van-sidebar-item": "./components/vant/sidebar-item/index", + "van-sidebar": "./components/vant/sidebar/index", + "van-grid": "./components/vant/grid/index", + "van-grid-item": "./components/vant/grid-item/index", + "van-datetime-picker": "./components/vant/datetime-picker/index", + "van-rate": "./components/vant/rate/index", + "van-action-sheet": "./components/vant/action-sheet/index", + "van-switch": "./components/vant/switch/index" + }, + "lazyCodeLoading": "requiredComponents" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..dfe8a57 --- /dev/null +++ b/app.wxss @@ -0,0 +1,98 @@ +/**app.wxss**/ +@import './styles/public.wxss'; +@import './styles/animate.wxss'; +@import './components/vant/common/index.wxss'; + +/* font-family */ +@font-face { + font-family: 'DingTalk'; + src: url('./font/DingTalk_JinBuTi_Regular.ttf') format('truetype'); +} + +page { + color: var(--text-color); + background-color: var(--bg-color); + font-size: var(--font-size-main); + line-height: var(--line-height-main); + font-family: var(--base-font-family); +} + +/* iphoneX底部安全距离 */ +.safeHeight { + height: env(safe-area-inset-bottom); +} + +page .btn { + background: #ffffff; + border-radius: 8rpx; + font-size: 28rpx; + width: 400rpx; + height: 80rpx; + line-height: 80rpx; + margin: 0; + border: none; +} + +page .btn-blue { + background-color: #26a7df; + color: #ffffff; +} + +page .btn-primary { + background-color: var(--main-color); + color: #ffffff; +} + +page .btn-white { + background-color: #ffffff; + color: var(--main-color); +} + +.pre { + white-space: pre-wrap; + word-wrap: break-word; + color: var(--text-color); + font-family: var(--base-font-family); +} + +.public-color { + color: var(--main-color) +} + +.more-btn { + padding: 16rpx 0; + color: var(--main-color); + display: flex; + align-items: center; + justify-content: center; +} + +.more-btn-image { + height: 28rpx; + width: 28rpx; + margin-left: 8rpx; +} + +page .tab-active-class { + color: var(--main-color); +} + +.myMediate .tab-nav-class, +.messageCenter-tabs .tab-nav-class { + background-color: var(--bg-color); +} + +.popup-bottom-button { + padding: 32rpx 0; + border-top: 2rpx solid var(--border-color); + position: fixed; + bottom: 0; + left: 32rpx; + right: 32rpx; + background-color: #ffffff; +} + +.second-font { + font-size: 24rpx; + line-height: 40rpx; +} \ No newline at end of file diff --git a/components/common-page/index.js b/components/common-page/index.js new file mode 100644 index 0000000..f599e0b --- /dev/null +++ b/components/common-page/index.js @@ -0,0 +1,190 @@ +const $$ = require('../../utils/util'); +const app = getApp(); + +// 获取手机号码 +function getPhoneNumber(submitData) { + return $$.request({ + url: 'paAccount/getUserPhone', + type: 'post', + service: 'cust', + submitData + }); +} + +Component({ + /** + * 组件的属性列表 + * popup: 下拉框的数据;visible:boolean 是否显示;title: string 标题;selectData: array;列数据;可拓展对象属性 + * safeBottom: iphoneX安全距离 + */ + properties: { + popup: { + type: Object, + value: { + visible: false + }, // default: { visible: false, title: '', selectData: [] } + }, + safeBottom: { + type: Boolean, + value: true, + }, + }, + + /** + * 组件的初始数据 + */ + columnsDefaultIndex: 0, + data: { + loginVisible: false, + popupIndex: null, + }, + + pageLifetimes: { + show: function () { + if (!app.globalData.token) { + console.log('测试') + if (!app.globalData.access_token) { + $$.showModal({ + content: '抱歉您未登录,是否前往登录?', + success: (res) => { + if (res.confirm) { + // wx.redirectTo({ + // url: '../../pages/login/index', + // }); + this.handleGetUserInfo() + } else { + wx.navigateBack({ + delta: 1, + }); + } + }, + }); + + } + } + if (app.globalData.token && !this.data.loginVisible) { + this.setData({ + loginVisible: true + }); + } + }, + }, + + // 登录,获取用户信息 + async handleGetUserInfo() { + $$.showLoading(); + wx.getUserProfile({ + desc: '完善用户信息', + complete(res) { + if (res.errMsg === 'getUserProfile:ok') { + wx.login({ + async success(res2) { + if (res2.code) { + const accountInfo = wx.getAccountInfoSync(); + const submitData = { + appid: accountInfo.miniProgram.appId, + code: res2.code, + avatar: res?.userInfo.avatarUrl, + encryptedData: res.encryptedData, + ivStr: res.iv, + }; + const res3 = await loginApi(submitData); + $$.hideLoading(); + if (res3.type) { + wx.setStorage({ + key: 'userInfo', + data: res3.data + }); + app.globalData.token = res3.data.token; + $$.showToast({ + title: '登录成功', + icon: 'success' + }); + await $$.sleep(); + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + } + } else { + $$.hideLoading(); + $$.showToast('登录失败,请稍后重试'); + } + }, + }); + } else { + $$.hideLoading(); + $$.showToast({ + title: '抱歉!授权失败' + }); + } + }, + }); + }, + + observers: { + 'popup.visible,popup.noPicker': function (data1, data2) { + if ((data1, data2)) { + this.setData({ + popupIndex: this.data.popup.activeIndex + }); + } + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 退出登录 + loginOut() { + this.setData({ + loginVisible: false + }); + }, + // 获取手机号码 + async handleGetPhoneNumber(code) { + $$.showLoading(); + const accountInfo = wx.getAccountInfoSync(); + const res = await getPhoneNumber({ + appid: accountInfo.miniProgram.appId, + code + }); + $$.hideLoading(); + if (res.type) { + $$.showToast({ + title: '获取成功' + }); + return res.data; + } + }, + // 下拉框底层弹出层方法 + _handleClosePopup() { + this.triggerEvent('onClosePopup'); + }, + _handleChangePicker(e) { + this.triggerEvent('onChangePicker', { + dataset: e.currentTarget.dataset, + detail: e.detail + }); + }, + _handleConfirmPicker(e) { + if (this.data.popup.noPicker) { + // 当组件不是Picker时 + let index = e.currentTarget.dataset.index; + let value = e.currentTarget.dataset.value; + this.triggerEvent('onConfirmPicker', { + dataset: e.currentTarget.dataset, + detail: { + index, + value + } + }); + return; + } + this.triggerEvent('onConfirmPicker', { + dataset: e.currentTarget.dataset, + detail: e.detail + }); + }, + }, +}); \ No newline at end of file diff --git a/components/common-page/index.json b/components/common-page/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/common-page/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/common-page/index.wxml b/components/common-page/index.wxml new file mode 100644 index 0000000..fcccc1b --- /dev/null +++ b/components/common-page/index.wxml @@ -0,0 +1,39 @@ +<!-- 非tabbar页面引入 --> +<!-- 页面内容 --> +<slot wx:if="{{ loginVisible }}" /> +<view style="display:none" wx:else> + <slot /> +</view> +<!-- iphonex底部安全距离 --> +<view class="adaptation" wx:if="{{ safeBottom }}" /> +<!-- 统一下拉底层弹出层 两种样式 --> +<block hidden="{{ popup.visible }}"> + <van-popup bind:close="_handleClosePopup" position="bottom" show="{{ popup.visible }}" wx:if="{{ !popup.noPicker }}" z-index="999"> + <van-picker + bind:cancel="_handleClosePopup" + bind:change="_handleChangePicker" + bind:confirm="_handleConfirmPicker" + column-class="my-van-picker-column" + columns="{{ popup.selectData || [] }}" + show-toolbar + title="{{ popup.title || '请选择' }}" + value-key="label" + /> + </van-popup> + <van-popup + bind:close="_handleClosePopup" + closeable + position="bottom" + show="{{ popup.visible }}" + title="{{ popup.title || '请选择' }}" + wx:else + z-index="999" + > + <scroll-view scroll-y="{{true}}" style="max-height: 800rpx;padding-top: 16rpx;"> + <view bind:tap="_handleConfirmPicker" data-index="{{ index }}" data-value="{{ item }}" class="popup-item {{ index === popupIndex ? 'popup-item-active' : '' }}" wx:for="{{ popup.selectData }}" wx:key="index"> + <view class="popup-item-content">{{ item.label }}</view> + <van-icon name="success" size="16" wx:if="{{ index === popupIndex }}" /> + </view> + </scroll-view> + </van-popup> +</block> diff --git a/components/common-page/index.wxss b/components/common-page/index.wxss new file mode 100644 index 0000000..e745055 --- /dev/null +++ b/components/common-page/index.wxss @@ -0,0 +1,23 @@ +/* components/common-page/index.wxss */ +.my-van-picker-column { + font-size: 28rpx !important; +} + +.adaptation { + height: env(safe-area-inset-bottom); +} + +.popup-item { + padding: 16rpx 32rpx; + display: flex; + align-items: center; +} + +.popup-item-content { + flex: 1; + padding-right: 32rpx; +} + +.popup-item-active { + color: var(--main-color); +} diff --git a/components/drop-down-select/index.js b/components/drop-down-select/index.js new file mode 100644 index 0000000..162bde9 --- /dev/null +++ b/components/drop-down-select/index.js @@ -0,0 +1,73 @@ +Component({ + /** + * 组件的属性列表 + * data: [{name:'标题',key:'字段key',data:[{ label:'', vlaue:'',children:[] }]}], 数据源 + * active: {'key':''}, 当前选中 + * menuTextAlign, 是否居中标题 + */ + properties: { + data: { + type: Array, + value: [], + }, + active: { + type: Object, + value: {}, + }, + menuTextAlign: { + type: Boolean, + value: false, + }, + }, + + /** + * 组件的初始数据 + */ + data: { + myActive: {}, // 当前选择的value,用于校验切换时重置 + dataIndex: null, // 当前选中的data数据的下标 + dataActive: { data: [] }, + activeName: {}, // 选中的标题 + }, + + observers: { + active: function (data) { + let visible = false; + for (let item in this.data.myActive) { + if (this.data.myActive[item] !== data[item] && this.data.myActive[item]) { + visible = true; + } + } + if (visible) this.setData({ activeName: {} }); + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 选择item + _handleClickItem(e) { + let item = e.currentTarget.dataset.item; + if (item.children) { + // 存在子集则是标题不可选择 + return; + } + this.data.activeName[this.data.dataActive.key] = item.label; + let activeCopy = { ...this.data.active }; + activeCopy[this.data.dataActive.key] = item.value; + this.data.myActive[this.data.dataActive.key] = item.value; + this.triggerEvent('ongetvalue', activeCopy); + this.setData({ activeName: this.data.activeName, dataIndex: null, dataActive: { data: [] }, myActive: this.data.myActive }); + }, + // 选择 + _handleSelectData(e) { + let index = e.currentTarget.dataset.index; + this.setData({ dataIndex: index, dataActive: this.data.data[index] }); + }, + // 取消 + _handleClose() { + this.setData({ dataIndex: null, dataActive: { data: [] } }); + }, + }, +}); diff --git a/components/drop-down-select/index.json b/components/drop-down-select/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/drop-down-select/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/drop-down-select/index.wxml b/components/drop-down-select/index.wxml new file mode 100644 index 0000000..277a1c3 --- /dev/null +++ b/components/drop-down-select/index.wxml @@ -0,0 +1,36 @@ +<!-- // components/drop-down-fliter/index.wxml --> +<view class="drop-down-select"> + <view class="drop-down-select-menu"> + <van-row> + <view class="{{dataIndex === index ? 'active' : ''}}" bindtap="_handleSelectData" wx:for="{{data}}" wx:key="index" data-index="{{index}}"> + <van-col span="8"> + <view style="display: flex;justify-content: {{menuTextAlign?'center':''}};padding-left: {{index===0?0:'8rpx'}};"> + <view class="menu-title">{{activeName[item.key] || item.name}}</view> + <van-icon name="play" custom-class="arrow" /> + </view> + </van-col> + </view> + </van-row> + </view> + <view wx:if="{{ dataActive.key }}" class="drop-down-select-submenu"> + <van-row gutter="20"> + <block wx:for="{{dataActive.data}}" wx:key="index"> + <van-col span="{{item.span || 12}}" bindtap="_handleClickItem" data-item="{{item}}"> + <view class="submenu-item {{active[dataActive.key] == item.value && 'active'}}"> + <text class="submenu-title {{item.children&&'submenu-title-h5'}}">{{item.label}}</text> + <van-icon name="success" custom-class="tick" /> + </view> + </van-col> + <view wx:if="{{item.children}}" style="margin-left: 56rpx;"> + <van-col span="24" bindtap="_handleClickItem" data-item="{{item2}}" wx:for="{{item.children}}" wx:for-item="item2" wx:for-index="index2" wx:key="index2"> + <view class="submenu-item {{active[dataActive.key] == item2.value && 'active'}}"> + <text class="submenu-title">{{item2.label}}</text> + <van-icon name="success" custom-class="tick" /> + </view> + </van-col> + </view> + </block> + </van-row> + </view> +</view> +<view class="cover" bindtap="_handleClose" hidden="{{ dataIndex === null }}"></view> \ No newline at end of file diff --git a/components/drop-down-select/index.wxss b/components/drop-down-select/index.wxss new file mode 100644 index 0000000..1c29f69 --- /dev/null +++ b/components/drop-down-select/index.wxss @@ -0,0 +1,101 @@ +/* components/drop-down-fliter/index.wxss */ +.drop-down-select { + position: relative; + padding: 0 var(--padding-my); + z-index: 100; +} + +.drop-down-select-menu { + position: relative; + background-color: #fff; + padding: 24rpx 32rpx; + border-radius: var(--border-radius-card-sm); +} + +.menu-title { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.active .menu-title { + color: var(--main-color); +} + +.arrow { + transition: transform 1s; + transform: rotate(90deg); +} + +.active .arrow { + transform: rotate(-90deg); + color: var(--main-color); +} + +.drop-down-select-submenu { + position: absolute; + left: var(--padding-my); + right: var(--padding-my); + top: 89rpx; + padding: 24rpx 32rpx 0; + background-color: #fff; + animation: move 0.5s 0s; + z-index: 99; + border-radius: var(--border-radius-card-sm); + margin-top: 16rpx; + max-height: 800rpx; + overflow-y: auto; +} + +@keyframes move { + 0% { + top: 0; + } + 100% { + top: 89rpx; + } +} + +.submenu-item { + margin-bottom: 24rpx; +} + +.active .submenu-title { + color: var(--main-color); +} + +.submenu-title-h5 { + font-weight: 600; +} + +.tick { + display: none; + margin-left: 12rpx; + color: var(--main-color); +} + +.active .tick { + display: inline; +} + +.cover { + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 100%; + height: 100%; + background-color: var(--gray-7); + opacity: 0.4; + z-index: 99; + animation: covermove 0.5s 0s; +} + +@keyframes covermove { + 0% { + height: 0; + } + 100% { + height: 100%; + } +} diff --git a/components/ellipsis-text/index.js b/components/ellipsis-text/index.js new file mode 100644 index 0000000..99a6984 --- /dev/null +++ b/components/ellipsis-text/index.js @@ -0,0 +1,66 @@ +// components/ellipsis-text/index.js +const $$ = require('../../utils/util'); + +Component({ + /** + * 组件的属性列表 + */ + properties: { + content: { + type: String, + value: '', + }, + fontsize: { + type: String, + value: '28', + }, + line: { + type: String, + value: 1, + }, + suffixVisible: Boolean, // 是否有省略后缀操作 + }, + + /** + * 组件的初始数据 + */ + data: { + lineHeight: null, + }, + + lifetimes: { + ready: function () { + if (!this.data.suffixVisible) { + this.setData({ lineHeight: this.data.fontsize === '24' ? '40rpx' : '' }); + return; + } + let that = this; + wx.getSystemInfoAsync({ + success: (res1) => { + const query = this.createSelectorQuery(); + query.select('#ellipsis-text').boundingClientRect(); + query.exec(function (res) { + let clientWidth = res[0].width; + let ratio = 750 / (res1.windowWidth || 375); + let allNum = parseInt(parseInt(clientWidth) / (parseInt(that.data.fontsize) / ratio)); + if (that.data.content.length > allNum * parseInt(that.data.line)) { + that.setData({ lineHeight: that.data.fontsize === '24' ? '40rpx' : '' }); + } + }); + }, + }); + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 点击查看隐藏内容 + _handleShow() { + if (this.data.suffixVisible) { + $$.showModal({ title: '', content: this.data.content, showCancel: false }); + } + }, + }, +}); diff --git a/components/ellipsis-text/index.json b/components/ellipsis-text/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/ellipsis-text/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/ellipsis-text/index.wxml b/components/ellipsis-text/index.wxml new file mode 100644 index 0000000..9c10ca1 --- /dev/null +++ b/components/ellipsis-text/index.wxml @@ -0,0 +1,8 @@ +<!--文字省略组件--> +<view class="ellipsis" style="font-size:{{ fontsize }}rpx;" catchtap="_handleShow"> + <view + class="ellipsis-text-{{ line }}" + id="ellipsis-text" + style="{{ lineHeight ? 'line-height: ' + lineHeight : '' }}" + >{{ content || '-' }}</view> +</view> diff --git a/components/ellipsis-text/index.wxss b/components/ellipsis-text/index.wxss new file mode 100644 index 0000000..513a3e0 --- /dev/null +++ b/components/ellipsis-text/index.wxss @@ -0,0 +1,29 @@ +/* components/ellipsis-text/index.wxss */ +.ellipsis { + position: relative; +} + +.ellipsis-text-1 { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + line-height: 1.5715; +} + +.ellipsis-text-2 { + -webkit-box-orient: vertical; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 2; + line-height: 1.5715; +} + +.ellipsis-text-3 { + -webkit-box-orient: vertical; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 3; + line-height: 1.5715; +} diff --git a/components/file-card/index.js b/components/file-card/index.js new file mode 100644 index 0000000..b528f20 --- /dev/null +++ b/components/file-card/index.js @@ -0,0 +1,66 @@ +/* + * @Company: hugeInfo + * @Author: ldh + * @Date: 2022-06-07 15:10:04 + * @LastEditTime: 2022-06-09 16:03:47 + * @LastEditors: ldh + * @Version: 1.0.0 + * @Description: + */ +// components/file/index.js +const $$ = require('../../utils/util'); + +Component({ + /** + * 组件的属性列表 + */ + properties: { + fileInfoList: Array, // 文件列表数据 + linkName: { + type: String, + value: '预览', + }, + isPreview: { + //是否预览模式 + type: Boolean, + value: true, + }, + backgroundColor: { + type: String, + value: '', + }, + }, + + /** + * 组件的初始数据 + */ + data: { + imgUrl: $$.url.img, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 点击文件 + _handleOpenFiles(e) { + let item = e.currentTarget.dataset.item; + if (this.data.isPreview) { + let url = $$.baseUrl + $$.url.fileShowUrl + item.id; + $$.openFiles(item.cat, url, [url]); + return false; + } + this.triggerEvent('onopenfiles', item); + }, + // 长按开始 + _handleTouchstart(e) { + let item = e.currentTarget.dataset.item; + this.triggerEvent('ontouchstart', item); + }, + // 长按结束 + _handleTouchend(e) { + let item = e.currentTarget.dataset.item; + this.triggerEvent('ontouchend', item); + }, + }, +}); diff --git a/components/file-card/index.json b/components/file-card/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/file-card/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/file-card/index.wxml b/components/file-card/index.wxml new file mode 100644 index 0000000..a79c274 --- /dev/null +++ b/components/file-card/index.wxml @@ -0,0 +1,25 @@ +<!--文件card组件--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<view + bindtouchend="_handleTouchend" + bindtouchstart="_handleTouchstart" + catchtap="_handleOpenFiles" + class="file" + data-item="{{ item }}" + style="{{ backgroundColor ? 'background-color: #ffffff' : '' }}" + wx:for="{{ fileInfoList || [] }}" + wx:key="index" +> + <view class="file-header"> + <view>{{ item.name }}</view> + <view class="file-header-link">{{ linkName }}</view> + </view> + <view class="file-main"> + <view>{{ wxs.fileType(item.cat) }}</view> + <view class="file-main-content"> + <van-icon custom-style="padding-right:8rpx;" name="{{ imgUrl }}link.png" /> + <view class="file-main-content-text">{{ item.trueName }}</view> + </view> + </view> +</view> diff --git a/components/file-card/index.wxss b/components/file-card/index.wxss new file mode 100644 index 0000000..3aa5670 --- /dev/null +++ b/components/file-card/index.wxss @@ -0,0 +1,43 @@ +/* components/file/index.wxss */ +.file { + background-color: #f2f2f2; + font-size: 28rpx; + padding: 24rpx; + margin-bottom: 16rpx; + border-radius: var(--border-radius-card); +} + +.file-header { + display: flex; + justify-content: space-between; + align-items: center; + line-height: 44rpx; +} + +.file-header-link { + color: var(--main-color); + font-size: 24rpx; +} + +.file-main { + display: flex; + justify-content: space-between; + margin-top: 8rpx; + font-size: 24rpx; + line-height: 40rpx; +} + +.file-main-content { + overflow: hidden; + display: flex; + align-items: center; + flex: 1; + justify-content: flex-end; + padding-left: 32rpx; +} + +.file-main-content-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} diff --git a/components/mediate-card/index.js b/components/mediate-card/index.js new file mode 100644 index 0000000..18604f0 --- /dev/null +++ b/components/mediate-card/index.js @@ -0,0 +1,842 @@ +const $$ = require('../../utils/util'); +const app = getApp(); + +// 获取当事人人员数据 +function getPartyApi(submitData) { + return $$.request({ + url: 'paCaseInfo/selectCaseUserName?caseId=' + submitData, + type: 'get', + service: 'mediate' + }); +} + +//调解视窗 +function getCaseViewApi(submitData) { + return $$.request({ + url: 'guide/windowCaseGuideByMilvus?caseId=' + submitData, + v1: true, + type: 'get', + service: 'mediate' + }); +} + +// 评价 +function rateApi(submitData) { + return $$.request({ + url: 'guideRatings/saveGuideRatings', + submitData, + type: 'post', + v1: true, + service: 'mediate' + }); +} +//相似度 +function checkCaseSimilarityApi(submitData) { + return $$.request({ + url: 'guide/checkCaseSimilarity', + submitData, + type: 'get', + v1: true, + service: 'mediate' + }); +} + + +Component({ + /** + * 组件的属性列表 + * pageType: string 页面来源 '1':我的调解; '2':我的司法确认on + * data: 数据 + * active: 是否选中卡片 + */ + properties: { + pageType: { + type: String, + value: '1', + }, + data: { + type: Object, + value: {}, + }, + active: { + type: Boolean, + value: false, + }, + caseindex: Number, // 当前案件的下标便于操作返回后更新对应的案件 + caseId: '', + }, + + /** + * 组件的初始数据 + * card: string 卡片类型; + '1':待受理 + '2_1':待调解(司法确认:待开始)未预约 + '2_2':待调解(司法确认:待开始)有预约 + '3_1':调解中(司法确认:进行中)未预约 + '3_2':调解中(司法确认:进行中)有预约 + '4_1':调解结束(司法确认:已结束)调解成功(司法确认:已达成) + '4_2':调解结束(司法确认:已结束)调解失败(司法确认:未达成) + '5':调解 - 退回 + '6':调解 - 不予受理 + '7': 调解 - 申请人撤回 + */ + card: '1', + data: { + imgUrl: $$.url.img, + color: '', // 颜色 + rate: '', + baseContent: [{ + title: '申请时间', + value: 'applyTime' + }, + { + title: '申请人', + value: 'plaintiffs' + }, + { + title: '被申请人', + value: 'defendants' + }, + ], + showAdditionalContent: false, + showCaseProvision: false, + showLegalList: false, + showModal: false, + hasEvaluated: false, + guideInfoList: [], + legalInfoList:[], + newGuideInfoList: [], + // 假设这是你的 NewLegalInfoList 数组 + NewLegalInfoList: [], + showTip: false, + + + + // 主要内容 + content: [], + // 额外说明区 + explain: { + visible: false, + }, + // 额外操作区 + simple: { + visible: false, + button: [], + }, + // 底部操作区是否可见 + bottomAction: false, + // 底部文件展示区 + bottomText: { + visible: false, + }, + action: [{ + title: '补充材料', + icon: `${$$.url.img}buchongcailiao.png`, + type: '1', + dot: false, + }, + // { + // title: '在线沟通', + // icon: `${$$.url.img}zaixiangoutong.png`, + // type: '2', + // dot: false, + // }, + { + title: '预约确认', + icon: `${$$.url.img}yuyuequeren.png`, + type: '3', + dot: false, + }, + // { + // title: '在线签名', + // icon: `${$$.url.img}zaixianqianming.png`, + // type: '4', + // dot: false, + // }, + ], + // 案件数据 + cardData: {}, + }, + lifetimes: { + // 在组件实例刚刚被创建时执行 + created: function () {}, + // 在组件实例进入页面节点树时执行 + attached: function () { + this._searchCase(); + }, + // 在组件实例被从页面节点树移除时执行 + detached: function () {}, + }, + + observers: { + // 用于加载不同的卡片 + 'data.process,data.perType': function () { + this._defaultData(); + const data = this.data.data; + data.meetInfo = data.meetInfo || {}; + const pageType = this.data.pageType; + const card = this._cardType(data); + // 待受理 + if (card === '1') { + // 只有是登记人才可以修改案件 + if (data.whetherInput === '1') { + this.data.simple = { + visible: true, + button: [{ + title: '撤销申请', + type: 'cancelCase' + }], + }; + } + this.data.color = 'color-black'; + } + // 退回 or 不予受理 + if (['5', '6'].indexOf(card) !== -1) { + this.data.content = [{ + title: pageType === '1' ? '审查组织' : '审查法院', + value: 'errorObjName' + }, + { + title: '审查时间', + value: 'errorTime' + }, + ]; + // 只有是登记人才可以修改案件 + let data = {} + this.data.simple = { + visible: card === '5' && data.whetherInput === '1' ? true : false, + button: [{ + buttonType: 'primary', + title: '修改申请', + type: 'changeCase' + }, + { + title: '撤销申请', + type: 'cancelCase' + }, + ], + }; + this.data.explain = { + visible: true, + title: '原因说明', + content: data.errorContent || '-', + }; + this.data.color = card === '5' ? 'color-tui' : 'color-fail'; + } + // 待调解 or 调解中 or 调解结束 的共同显示 + if (['1', '5', '6', '7'].indexOf(card) === -1) { + this.data.content = + pageType === '1' ? [{ + title: '调解组织', + value: 'mediateUnitName' + }, + { + title: '调解员', + value: 'mediator' + }, + ] : [{ + title: '受理法院', + value: 'courtName' + }, + { + title: '承办法官', + value: 'judgeName' + }, + ]; + } + // 待调解 or 调解中 + if (['2_1', '2_2', '3_1', '3_2'].indexOf(card) !== -1) { + if (['2_2', '3_2'].indexOf(card) !== -1) { + this.data.explain = { + visible: true, + title: '预约信息', + order: true, + }; + if (!data.meetInfo.fixStatus || data.meetInfo.fixStatus === '1') { + this.data.action[2].dot = true; // 显示图标红点提示 + } + let arr = !!data.meetInfo.orderStartTime ? [{ + title: pageType === '1' ? '线上调解房间号' : '线上司法确认房间号', + type: 'copy' + }] : []; + this.data.simple = { + visible: true, + button: [{ + buttonType: 'primary', + title: data.meetInfo.signStatus === '2' || !data.meetInfo.signStatus ? (pageType === '1' ? '进入调解室' : '进入司法确认') : '签到', + type: data.meetInfo.signStatus === '2' || !data.meetInfo.signStatus ? 'goToRoom' : 'signIn', + }, + ...arr, + ], + }; + } + this.data.bottomAction = data.whetherInput === '1' ? true : false; + this.data.color = card === '2_1' || card === '2_2' ? 'color-dai' : 'color-ing'; + } + // 调解结束 + if (['4_1', '4_2'].indexOf(card) !== -1) { + this.data.simple = { + visible: true, + button: [{ + buttonType: 'primary', + title: pageType === '1' ? '调解历程' : '司法确认历程', + type: 'history' + }], + }; + this.data.bottomText = { + visible: true, + content: [{ + title: pageType === '1' ? '调解结果' : '司法确认结果', + value: pageType === '1' ? 'mediResultName' : 'judicResultName', + color: data.mediResult === '22_00025-1' || data.judicResult === '22_00028-1' ? '#07c160' : '#ee0a24', + }, + { + title: pageType === '1' ? '调解时间' : '司法确认时间', + value: pageType === '1' ? ['mediStartTime', 'mediEndTime'] : ['judicStartTime', 'judicEndTime'], + type: 'time', + }, + ], + }; + this.data.color = 'color-end'; + } + // 申请人撤回 + if (card === '7') { + this.data.color = 'color-tui'; + } + this.setData({ + color: this.data.color, + content: this.data.content, + explain: this.data.explain, + simple: this.data.simple, + bottomAction: this.data.bottomAction, + bottomText: this.data.bottomText, + action: this.data.action, + }); + this._formatTime(card); + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + + onRateChange(event) { + console.log('event', event.detail); + this.setData({ + rate: event.detail + }) + }, + + async _searchCase() { + let type = false; + try { + if (this.data.simple.visible && (this.data.simple.button[0].type === 'signIn' || this.data.simple.button[0].type === 'goToRoom')) { + $$.showLoading(); + const guideTitleRes = await getCaseViewApi(this.data.data.id); + $$.hideLoading(); + if (guideTitleRes.type) { + // 操作成功,设定 type 为 true + type = true; + const guideInfoList = guideTitleRes.data.find((i) => i.guideName === '类案推荐')?.guideInfoList; + const legalInfoList = guideTitleRes.data.find((i) => i.guideName === '法条推荐')?.guideInfoList.map(item => ({ + ...item, + showDetails: false // 默认设定为关闭状态 + })); + this.setData({ + guideInfoList, + legalInfoList, + newGuideInfoList: guideInfoList, + NewLegalInfoList: legalInfoList + }); + const tip = await checkCaseSimilarityApi({ + caseId: this.data.data.id + }); + if (tip.data === true) { + this.setData({ + showTip: true + }) + } + } + } + return { + type + }; + } catch (error) { + console.error('刷新失败:', error); + return { + type: false + }; + } + }, + + + // 恢复默认数据 + _defaultData() { + this.data.color = ''; + // 主要内容 + this.data.content = []; + // 额外说明区 + this.data.explain = { + visible: false + }; + // 额外操作区 + this.data.simple = { + visible: false, + button: [] + }; + // 底部操作区是否可见 + this.data.bottomAction = false; + // 底部文件展示区 + this.data.bottomText = { + visible: false + }; + this.data.action = [{ + title: '预约确认', + icon: `${$$.url.img}yuyuequeren.png`, + type: '3', + dot: false, + }, + { + title: '补充材料', + icon: `${$$.url.img}buchongcailiao.png`, + type: '1', + dot: false, + }, + { + title: '...', + type: '10', + dot: false, + }, + // { + // title: '在线沟通', + // icon: `${$$.url.img}zaixiangoutong.png`, + // type: '2', + // dot: false, + // }, + // { + // title: '在线签名', + // icon: `${$$.url.img}zaixianqianming.png`, + // type: '4', + // dot: false, + // }, + + ]; + }, + // 查看文件 + _handleOpenFiles(e) { + let item = e.currentTarget.dataset.item; + let url = $$.baseUrl + $$.url.fileShowUrl + item.id; + $$.openFiles(item.cat, url, [url]); + }, + + //补充材料页面 + goToOtherPage() { + // 跳转到其他页面的逻辑 + wx.navigateTo({ + url: '../../pages/materialShow/index?caseId=' + this.data.data.id + '&editVisible=true', + }); + }, + + + _q() { + let that = this; + $$.showModal({ + title: '推荐内容评价', + content: '推荐内容对您有帮助吗?', + cancelText: '我再想想', + confirmText: '评价完成', + success: (res) => { + if (res.confirm) { + that.submitCase(); + } + }, + }); + }, + + async submitCase() { + $$.showLoading(); + const res = await rateApi({ + serviceId: id, + rating: rate, + }); + $$.hideLoading(); + if (res.type) { + $$.showToast({ + icon: 'success', + title: '感谢您的评价' + }); + } + }, + + + _m(event) { + const index = event.currentTarget.dataset.key; // 获取点击的法条索引 + const currentLegal = this.data.NewLegalInfoList[index]; // 获取当前点击的法条对象 + currentLegal.showDetails = !currentLegal.showDetails; // 更新当前法条的展开状态 + + // 更新数据,只修改当前点击的法条对象,而不是整体更新 NewLegalInfoList 状态 + this.setData({ + ['NewLegalInfoList[' + index + ']']: currentLegal + }); + }, + + + + + //打开弹窗 + openPopup() { + // 点击评价按钮时触发的操作 + if (this.data.hasEvaluated) { + // 如果用户已经评价过,显示提示消息 + $$.showToast({ + title: "不可重复评价" + }); + } else { + // 如果用户未评价,则打开弹出框供用户评价 + this.setData({ + showModal: !this.data.showModal // 显示弹出框 + }); + } + }, + + _r() { + // 用户完成评价后触发的操作 + this.setData({ + showModal: false, // 关闭弹出框 + hasEvaluated: true // 标记用户已经评价过 + }); + $$.showToast({ + title: "评价完成" + }); // 显示评价完成的提示消息 + }, + + + + + + + + + + + // 底部操作区操作 + _handleBottomAction(e) { + let type = e.currentTarget.dataset.type; + if (type === '1') { + // 补充材料 + // 获取人员数据保存至全局变量中,方便附件上传页面获取有多少人员 + this._goToMaterial(this.data.data.id); + } else if (type === '2') { + $$.showToast({ + title: '功能暂未开放,敬请期待' + }); + } else if (type === '3') { + if (this.card === '2_1' || this.card === '3_1') { + $$.showToast({ + title: '抱歉!该案件暂无预约信息' + }); + return false; + } + // 预约确认 + app.globalData.caseMsg = this.data.data; + app.globalData.caseMsg.caseIndex = this.data.caseindex; + wx.navigateTo({ + url: '../../pages/orderConfirm/index?meetUserId=' + this.data.data.meetInfo.meetUserId + '&pageType=' + this.data.pageType, + }); + } + // else if (type === '4') { + // // 在线签名 + // wx.navigateTo({ + // url: '../../pages/autograph/index', + // }); + // } + else if (type === '10') { + // ... + this.setData({ + showAdditionalContent: !this.data.showAdditionalContent + }); // 当点击 type 为 10 的时候显示额外内容 + } + }, + // 额外的操作 + async _handleSimpleButton(e) { + let type = e.currentTarget.dataset.type; + if (type === 'changeCase') { + // 修改申请 + app.globalData.caseMsg = this.data.data; + app.globalData.caseMsg.caseIndex = this.data.caseindex; + wx.navigateTo({ + url: '../../pages/register/index?caseId=' + this.data.data.id + '&change=true', + }); + } else if (type === 'cancelCase') { + // 撤销申请 + $$.showModal({ + content: '确定撤销申请吗?', + success: (res) => { + if (res.confirm) { + this.triggerEvent('onCancelCase', this.data.data.id); + } + }, + }); + } else if (type === 'signIn') { + // 进入签到 + if (this.data.data.meetInfo.orderStartTime) { + let visible = false; + let diff_minute = $$.moment(this.data.data.meetInfo.orderStartTime).diff($$.moment(new Date()), 'minute'); + if (diff_minute > 60) { + $$.showModal({ + title: '签到失败提醒', + content: '正式调解开始前1小时内开放签到操作,请稍后再试', + showCancel: 'false', + confirmText: '我知道了', + }); + visible = true; + } + if (visible) { + return false; + } + } + app.globalData.caseMsg = this.data.data; + app.globalData.caseMsg.caseIndex = this.data.caseindex; + wx.navigateTo({ + url: '../../pages/signIn/index?meetUserId=' + this.data.data.meetInfo.meetUserId, + }); + } else if (type === 'goToRoom') { + // 进入调解室 + if (!this.data.data.meetInfo.roomNo) { + $$.showModal({ + title: '进入调解失败提醒', + content: '房间号尚未创建,请联系调解员进行确认', + showCancel: 'false', + confirmText: '我知道了', + }); + return false; + } + let that = this; + wx.setClipboardData({ + data: that.data.data.meetInfo.roomNo, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + $$.showToast({ + icon: 'success', + title: '会议号复制成功' + }); + }, + }); + }, + }); + $$.sleep(); + // 跳转到小鱼视频小程序 + wx.navigateToMiniProgram({ + appId: 'wx5a161b9b42305c0a', + path: 'pages/index/main', + success(res) {}, + }); + } else if (type === 'history') { + // 进入调解历程 or 司法历程 + app.globalData.caseMsg = this.data.data; + wx.navigateTo({ + url: '../../pages/course/index?id=' + this.data.data.id + '&pageType=' + this.data.pageType, + }); + } else if (type === 'copy') { + // 复制房间号 + if (!this.data.data.meetInfo.roomNo) { + $$.showToast({ + title: '抱歉,无房间号' + }); + return false; + } + this.triggerEvent('onOpenBottomPopup', { + data: this.data.data.meetInfo.roomNo, + type: 'roomNo' + }); + } + }, + + async _v() { + let a = []; + let b = []; + if (this.data.newGuideInfoList?.length > 3) { + a = this.data.newGuideInfoList.filter((i, idx) => idx > 2); + } else { + a = this.data.guideInfoList || []; + } + if (this.data.NewLegalInfoList?.length > 3) { + b = this.data.NewLegalInfoList.filter((i, idx) => idx > 2); + } else { + b = this.data.legalInfoList || []; + } + this.setData({ + newGuideInfoList: a, + NewLegalInfoList: b + }); + }, + + //类案推荐详情 + async _classicCase(e) { + const index = e.currentTarget.dataset.index; // 获取点击的元素索引 + const selectedItem = this.data.newGuideInfoList[index]; // 根据索引获取对应的数据 + const guideInfoId = selectedItem.guideInfoId; + const guideId = selectedItem.id; + + // 跳转到 classicCase 页面,并传递相应的参数 + wx.navigateTo({ + url: `../../pages/classicCase/index?guideInfoId=${guideInfoId}&guideId=${guideId}` + }); + }, + + async _handleNewSimpleButton(e) { + let type = e.currentTarget.dataset.type; + if (type === 'changeCase') { + // 修改申请 + app.globalData.caseMsg = this.data.data; + app.globalData.caseMsg.caseIndex = this.data.caseindex; + wx.navigateTo({ + url: '../../pages/register/index?caseId=' + this.data.data.id + '&change=true', + }); + } else if (type === 'signIn') { + // 进入签到 + if (this.data.data.meetInfo.orderStartTime) { + let visible = false; + let diff_minute = $$.moment(this.data.data.meetInfo.orderStartTime).diff($$.moment(new Date()), 'minute'); + if (diff_minute > 60) { + $$.showModal({ + title: '签到失败提醒', + content: '正式调解开始前1小时内开放签到操作,请稍后再试', + showCancel: 'false', + confirmText: '我知道了', + }); + visible = true; + } + if (visible) { + return false; + } + } + app.globalData.caseMsg = this.data.data; + app.globalData.caseMsg.caseIndex = this.data.caseindex; + wx.navigateTo({ + url: '../../pages/signIn/index?meetUserId=' + this.data.data.meetInfo.meetUserId, + }); + } else if (type === 'goToRoom') { + // 进入调解室 + if (!this.data.data.meetInfo.roomNo) { + $$.showModal({ + title: '进入调解失败提醒', + content: '房间号尚未创建,请联系调解员进行确认', + showCancel: 'false', + confirmText: '我知道了', + }); + return false; + } + let that = this; + wx.setClipboardData({ + data: that.data.data.meetInfo.roomNo, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + $$.showToast({ + icon: 'success', + title: '会议号复制成功' + }); + }, + }); + }, + }); + $$.sleep(); + // 跳转到小鱼视频小程序 + wx.navigateToMiniProgram({ + appId: 'wx5a161b9b42305c0a', + path: 'pages/index/main', + success(res) {}, + }); + } else if (type === 'history') { + // 进入调解历程 or 司法历程 + app.globalData.caseMsg = this.data.data; + wx.navigateTo({ + url: '../../pages/course/index?id=' + this.data.data.id + '&pageType=' + this.data.pageType, + }); + } else if (type === 'copy') { + // 复制房间号 + if (!this.data.data.meetInfo.roomNo) { + $$.showToast({ + title: '抱歉,无房间号' + }); + return false; + } + this.triggerEvent('onOpenBottomPopup', { + data: this.data.data.meetInfo.roomNo, + type: 'roomNo' + }); + } + }, + // 判断我的调解 和 我的司法确认的卡片类型便于组件使用 + _cardType(value) { + let result = '1'; + if (value.process) { + if (value.process === '1') { + result = '1'; + } else if (value.process === '2' || value.process === '3') { + if (!value.meetInfo.orderStartTime) { + result = '_1'; + } else { + result = '_2'; + } + result = value.process + result; + } else if (value.process === '4') { + result = value.mediResult === '22_00025-1' || value.judicResult === '22_00028-1' ? '4_1' : '4_2'; + } else { + result = value.process; + } + } + this.card = result; + return result; + }, + // 格式化时间 + _formatTime(card) { + let arr = ['applyTime', 'mediStartTime', 'mediEndTime', 'errorTime', 'judicStartTime', 'judicEndTime'], + arr2 = ['orderStartTime', 'orderEndTime']; + let data = this.data.data; + arr.forEach((x) => { + if (data[x]) { + data[x] = $$.timeFormat(data[x]); + } + }); + arr2.forEach((x) => { + if (data.meetInfo[x]) { + data.meetInfo[x] = $$.timeFormat(data.meetInfo[x]); + } + }); + data.cardTypeName = data.processName || '-'; + this.setData({ + cardData: { + ...data + } + }); + }, + // 跳转至案件详情 + _handleGetCaseDetail() { + wx.navigateTo({ + url: '../../pages/mediateDetail/index?id=' + this.data.data.id + '&pageType=' + this.data.pageType, + }); + }, + // 跳转至补充材料 + async _goToMaterial(id) { + $$.showLoading(); + const res = await getPartyApi(id); + $$.hideLoading(); + if (res.type) { + app.globalData.material.person = res.data || []; + wx.navigateTo({ + url: '../../pages/materialShow/index?caseId=' + this.data.data.id + '&editVisible=true', + }); + } + }, + // 打开文件 + _handleOpenFiles(e) { + let item = e.currentTarget.dataset.item; + let url = $$.baseUrl + $$.url.fileShowUrl + item.id; + $$.openFiles(item.cat, url, [url]); + }, + }, +}); \ No newline at end of file diff --git a/components/mediate-card/index.json b/components/mediate-card/index.json new file mode 100644 index 0000000..d7041ce --- /dev/null +++ b/components/mediate-card/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "usingComponents": { + "ellipsis-text": "../ellipsis-text/index", + "file-card": "../file-card/index", + "time-format": "../time-format/index", + "van-rate": "../vant/rate" + + } +} diff --git a/components/mediate-card/index.wxml b/components/mediate-card/index.wxml new file mode 100644 index 0000000..0bc3bb3 --- /dev/null +++ b/components/mediate-card/index.wxml @@ -0,0 +1,224 @@ +<!--我的调解 or 我的司法确认的案件卡片--> + +<view bindtap="_handleGetCaseDetail" class="card {{ active ? 'card-active' : '' }}"> + <!-- 头部区域 --> + <view class="header"> + <view class="{{ color }} header-title"> + <view class="header-title-txt">{{ cardData.caseNo || '-' }}</view> + </view> + <view class="{{ color }}">{{ cardData.cardTypeName }} + <van-icon name="arrow" /> + </view> + + </view> + <!-- 主要内容区 --> + <block> + <view class="card-text" style="display: flex; {{ color === 'color-black' && !simple.visible ? 'border: none' : ''}}; {{simple.visible && item.type === cancelCase ? '' : 'border:none'}}"> + <view style="margin-right: 24px;"> + <view class="card-cell" wx:for="{{ baseContent }}" wx:key="index"> + <view class="card-cell-title">{{ item.title }}</view> + </view> + <view class="card-cell" wx:for="{{ content }}" wx:key="index"> + <view class="card-cell-title">{{ item.title }}</view> + </view> + </view> + <view style="{{ color === 'color-black' && !simple.visible ? 'border: none' : '' }}"> + <view class="card-cell" wx:for="{{ baseContent }}" wx:key="index"> + <view class="card-cell-value">{{ cardData[item.value] || '-' }}</view> + </view> + <view class="card-cell" wx:for="{{ content }}" wx:key="index"> + <view class="card-cell-value">{{ cardData[item.value] || '-' }}</view> + </view> + </view> + </view> + <view class="card-text" style="{{ !explain.order ? 'border: none;' : 'border: none' }}" wx:if="{{ content.length !== 0 }}"> + <view class="card-cell" wx:for="{{ bottomText.content }}" wx:key="index"> + <view>{{ item.title }}:</view> + <view class="card-cell-value" style="{{ item.color ? 'color: ' + item.color : '' }}"> + <block wx:if="{{ item.type === 'time' }}">{{ cardData[item.value[0]] || '-' }} ~ {{ cardData[item.value[1]] || '-' }}</block> + <block wx:else>{{ cardData[item.value] || '-' }}</block> + </view> + </view> + </view> + </block> + <!-- 额外说明区 --> + <view class="explain" wx:if="{{ explain.visible && !explain.order }}"> + <view class="explain-title">{{ explain.title }}</view> + <!-- 异常信息 --> + <block wx:if="{{ !!explain.content }}"> + <ellipsis-text content="{{ explain.content||'' }}" fontsize="24" line="2" suffixVisible="true" /> + </block> + </view> + <!-- 预约信息 --> + <view class="order" wx:if="{{ explain.order }}"> + <view class="order-date"> + <view class="order-date-day"> + <time-format format="DD" value="{{ cardData.meetInfo.orderStartTime }}" />号 + </view> + <view class="order-date-month"> + <time-format format="M" value="{{ cardData.meetInfo.orderStartTime }}" />月 + </view> + </view> + <view style="flex: 1;"> + <view class="order-date-time"> + <view> + 预约时间: + <time-format format="HH:mm" value="{{ cardData.meetInfo.orderStartTime }}" /> + <text>{{ ' ~ ' }}</text> + <time-format format="HH:mm" value="{{ cardData.meetInfo.orderEndTime }}" /> + </view> + <view class="order-date-type">{{ cardData.meetInfo.meetWayName }}{{ pageType==='1' ? '调解' : '司法确认' }}</view> + </view> + <view>预约地点:{{ cardData.meetInfo.meetAddr || '-' }}</view> + </view> + </view> + <!-- 底部文件展示区 --> + <view class="action-bottom-text" wx:if="{{ bottomText.visible }}"> + <!-- 文件展示 --> + <view catchtap="_handleOpenFiles" class="action-file {{ pageType === '1' ? 'action-file-color1' : 'action-file-color2' }}" data-item="{{ item }}" wx:for="{{ cardData.ownerTypeFile }}" wx:key="index"> + <view class="action-file-name {{ pageType === '1' ? 'action-file-name-color1' : 'action-file-name-color2' }}"> + <view>{{ pageType === '1' ? '调解' : '民事' }}</view> + <view>{{ pageType === '1' ? '协议' : '裁定' }}</view> + </view> + <view class="action-file-content"> + <view class="action-file-content-name">{{ item.name }}</view> + <view class="action-file-content-btn {{ pageType === '1' ? 'action-file-content-btn-color1' : 'action-file-content-btn-color2' }}">点击查看</view> + </view> + </view> + </view> + <!-- 额外的操作 --> + <!-- <view class="simple" wx:if="{{ simple.visible }}"> + <van-button catchtap="_handleSimpleButton" custom-class="simple-button" data-type="{{ item.type }}" size="small" type="{{ item.buttonType || 'default' }}" wx:for="{{ simple.button }}" wx:key="index">{{ item.title }}</van-button> + </view> --> + <view class="simple" wx:if="{{ simple.visible }}"> + <van-button catchtap="_handleSimpleButton" custom-class="simple-button" data-type="{{ item.type }}" size="small" type="{{ item.buttonType || 'default' }}" wx:for="{{ simple.button }}" wx:key="index" wx:if="{{ item.type !== 'signIn' && item.type !== 'goToRoom' && item.type !== 'copy'}}">{{ item.title }}</van-button> + </view> + + + + + <!-- 新底部操作区 --> + <!-- --> + <block wx:if="{{ simple.visible && (simple.button[0].type === 'signIn' || simple.button[0].type === 'goToRoom') }}"> + <view class="NewButton"> + <block wx:for="{{ action }}" wx:key="{{ index }}"> + <view wx:if="{{ index === 0}}" class="NewRedButton" catchtap="_handleBottomAction" data-type="{{ item.type }}"> + <image src="/img/finish_1.png" class="img"></image>{{ item.title }} + </view> + <block wx:elif="{{ index === 1 }}"> + <view class="NewRedButton" catchtap="_handleSimpleButton" custom-class="simple-button" data-type="{{ item.type }}" wx:if="{{ index === 0 }}" wx:for="{{ simple.button }}" wx:key="index"> + <image src="/img/meeting_1.png" class="img" wx:if="{{ simple.button[0].type === 'goToRoom' }}"></image> + <image src="/img/arrive_1.png" class="img" wx:if="{{ simple.button[0].type === 'signIn' }}"></image> + <view>{{ item.title }}</view> + </view> + </block> + <view wx:if="{{ index === 2}}" class="NewRedButton1" catchtap="_handleBottomAction" data-type="{{ item.type }}"> + {{ item.title }} + </view> + </block> + <view class="ButtonCover" wx:if="{{ showAdditionalContent }}"> + <view class="ButtonCoverContent" bindtap="goToOtherPage">补充材料</view> + <view class="ButtonCoverContent" catchtap="_handleSimpleButton" custom-class="simple-button" data-type="{{ item.type }}" wx:if="{{ index === 1 }}" wx:for="{{ simple.button }}" wx:key="index">在线调解房间号</view> + </view> + + </view> + <view class="action-bottom"> + + </view> + <view style="padding: 0 16px;"> + <view class="case" wx:if="{{ showTip }}"> + <view class="img-case_2"> + <image src="/img/case_2.png" class="img"></image> + </view> + <view> + 通过与相似类案的大数据分析,建议您优先选择案件调解方式。这将有效为您节约时间和金钱成本,以更容易保持双方关系的方式让您收获满意的结果。 + </view> + </view> + <view class="caseBox"> + <view class="caseBox-title"> + <image src="/img/case_1.png" class="img"></image>为您推荐与本案相似的典型案例 + </view> + <!--wx:if="{{ index < 3 }}"--> + <view class="newBox"> + <view class="caseBox-content" catch:tap="_classicCase" wx:for="{{ newGuideInfoList}}" wx:key="index" data-index="{{index}}"> + <view class="caseBox-dot"></view> + <!-- {{item.caseSimilarity}} --> + <view class="caseBox-Item">{{item.guideTitle}}</view> + <view class="caseBox-arrow"> + <van-icon name="arrow" size="8" /> + </view> + </view> + + </view> + <view class="caseLegalBox-title"> + <image src="/img/case_1.png" class="img"></image>为您推荐与本案相关的专业法条 + </view> + <view class="newBox1"> + <view wx:for="{{NewLegalInfoList}}" x:key="index" data-key="{{ index }}" catch:tap="_m"> + <view> + <view class="caseLegalBox-content"> + <view class="caseLegalBox-dot"></view> + <view class="caseLegalBox-Item">{{item.guideText}}</view> + <view class="caseLegalBox-arrow"> + <van-icon name="arrow-up" size="8" wx:if="{{ !item.showDetails }}" /> + <van-icon name="arrow-down" size="8" wx:else /> + </view> + </view> + <view wx:if="{{ item.showDetails }}"> + <view style="background-color: #fff; padding:0 8px 8px 8px; font-size: 12px;"> + <text>{{item.guideText}}</text> + </view> + </view> + </view> + </view> + + </view> + <view class="evaluate"> + <!-- <image class="img" src="/img/update_1.png" catch:tap="_v"></image> + <image class="img1" src="/img/Like_1.png" catch:tap="openPopup"></image> --> + </view> + + </view> + </view> + </block> +</view> +<!-- <view class="action-bottom" wx:if="{{ bottomAction }}"> + <view + catchtap="_handleBottomAction" + class="action-bottom-item" + data-type="{{ item.type }}" + wx:for="{{ action }}" + wx:if="{{ pageType === '2' && item.type === '1' ? false : index < 2 }}" + wx:key="index" + > + <view class="action-bottom-actionTitle1">{{ item.title }}</view> + </view> + </view> --> + + +<!-- 底部操作区 --> +<!-- <view class="action-bottom" wx:if="{{ bottomAction }}"> + <view catchtap="_handleBottomAction" class="action-bottom-item" data-type="{{ item.type }}" wx:for="{{ action }}" wx:if="{{ pageType === '2' && item.type === '1' ? false : true }}" wx:key="index"> + <van-icon custom-class="action-bottom-item-image" dot="{{ item.dot }}" name="{{ item.icon }}" /> + <view class="action-bottom-actionTitle">{{ item.title }}</view> + </view> + </view> --> + +<view class="popup-box" wx:if="{{showModal}}"> + <view class="overBox"> + <view class="judgment">推荐内容评价</view> + <view class="help">推荐内容对您有什么帮助吗?</view> + <view class="star"> + <van-rate v-model="value" :size="24" bind:change="onRateChange" color="rgba(255,146,0,1)" void-icon="star" void-color="#eee" gutter="16px" /> + </view> + <view class="buttonBox"> + <view class="think" catch:tap="openPopup"> + 我再想想 + </view> + <view class="judgmentFinish" catch:tap="_r"> + 评价完成 + </view> + </view> + + </view> +</view> \ No newline at end of file diff --git a/components/mediate-card/index.wxss b/components/mediate-card/index.wxss new file mode 100644 index 0000000..eb0fce1 --- /dev/null +++ b/components/mediate-card/index.wxss @@ -0,0 +1,418 @@ +/* components/mediate-card/index.wxss */ +@import '../../styles/public_components.wxss'; + +.color-black { + color: var(--text-color); +} + +.color-black::before { + background-color: var(--text-color); +} + +.color-tui { + color: var(--text-color); +} + +.color-tui::before { + background-color: var(--text-color); +} + +.color-dai { + color: #d16902; +} + +.color-dai::before { + background-color: #d16902; +} + +.color-ing { + color: #1989fa; +} + +.color-ing::before { + background-color: #1989fa; +} + +.color-end { + color: #05aeae; +} + +.color-end::before { + background-color: #05aeae; +} + +.color-fail { + color: #ee0a24; +} + +.color-fail::before { + background-color: #ee0a24; +} + +.card { + background-color: #ffffff; + border-radius: var(--border-radius-card); + overflow: hidden; +} + +.card-active { + border: 2rpx solid var(--main-color); +} + +.header { + height: 84rpx; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 2rpx solid var(--border-color); + margin: 0 32rpx; + line-height: 28rpx; +} + +.header-title { + display: flex; + align-items: center; + font-weight: 600; + position: relative; + color: var(--text-color); +} + +.header-title::before { + content: ''; + width: 8rpx; + height: 28rpx; + border-radius: 4rpx; + position: absolute; + left: -32rpx; + top: 4rpx; +} + +.header-title-txt { + padding-right: 16rpx; +} + +.simple { + text-align: right; + margin: 24rpx 0; +} + +.simple-button { + margin-right: 32rpx; +} + +.action-bottom { + display: flex; + border-top: 1px solid var(--border-color); + margin: 0 32rpx; + gap: 24rpx; +} + +.action-bottom-actionTitle { + font-size: 24rpx; + line-height: 24rpx; + margin-top: 14rpx; +} + + + +.action-bottom-text { + border-bottom: 1px solid var(--border-color); + margin: 0 32rpx; +} + +.action-bottom-item { + flex: 1; + font-size: 28rpx; + text-align: center; + padding: 24rpx 0; +} + +.action-bottom-item-image { + font-size: 70rpx !important; +} + +.card-text { + font-size: 24rpx; + line-height: 40rpx; + padding: 16rpx 0; + border-bottom: 2rpx solid var(--border-color); + margin: 0 32rpx; +} + + +.card-text .card-cell { + padding: 0; +} + +.explain { + background-color: var(--gray-4); + border-radius: var(--border-radius-card-sm); + padding: 16rpx; + margin: 0 32rpx; + margin-bottom: 24rpx; + font-size: 28rpx; +} + +.explain-title { + margin-bottom: 8rpx; + font-weight: 600; + font-size: 24rpx; + line-height: 24rpx; +} + + +.NewButton { + display: flex; + flex-wrap: nowrap; + gap: 12px; + margin: 12px 16px; +} + +.NewRedButton { + background-color: #FFE6E6; + min-width: 126px; + height: 32px; + border-radius: var(--border-radius-card-sm); + display: flex; + color: #D1021C; + justify-content: center; + align-items: center; +} + +.NewRedButton1 { + background-color: #FFE6E6; + min-width: 48px; + height: 32px; + border-radius: var(--border-radius-card-sm); + display: flex; + color: #D1021C; + justify-content: center; + font-size: 16px; +} + +.ButtonCover { + background-color: #FFE6E6; + width: 108px; + position: absolute; + z-index: 100; + right: 0; + margin-top: 38px; + margin-right: 23px; + color: #D1021C; + font-size: 12px; + border-radius: var(--border-radius-card-sm); +} + +.ButtonCoverContent { + line-height: 20px; + margin: 8px auto 8px 12px; +} + +.case { + background-color: rgba(24, 144, 255, 0.12); + color: rgba(24, 144, 255, 1); + border-radius: 4px; + margin-top: 12px; + padding: 4px 0; + margin-bottom: 8px; + font-size: 12px; + display: flex; + justify-content: space-between; + padding: 4px 8px 4px 8px; +} + +.caseBox { + background-color: rgba(246, 247, 251, 1); + border-radius: var(--border-radius-card-sm); + padding: 0px 8px 0px 8px; +} + +.caseBox-title { + color: rgba(0, 0, 0, 0.9); + font-size: 12px; + line-height: 20px; + display: flex; + align-items: center; + margin-bottom: 8px; + padding-top: 12px; +} + +.caseLegalBox-title { + color: rgba(0, 0, 0, 0.9); + font-size: 12px; + line-height: 20px; + display: flex; + align-items: center; + padding-top: 12px; +} + +.caseBox-content { + background-color: #fff; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 4px; +} + +.caseLegalBox-content { + display: flex; + background-color: #fff; + align-items: center; + margin-top: 8px; + justify-content: center; +} + +.caseBox-dot { + height: 6px; + width: 6px; + border-radius: 50%; + background-color: rgba(217, 217, 217, 0.6); +} + +.caseLegalBox-dot { + height: 6px; + width: 6px; + border-radius: 50%; + background-color: rgba(217, 217, 217, 0.6); + margin-left: 8px; + margin-right: 4px; +} + + +.caseBox-Item { + font-size: 12px; + margin: 8px 13px 8px 6px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 250px; +} + +.caseLegalBox-Item { + font-size: 12px; + margin: 8px 13px 8px 6px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 250px; +} + +.caseBox-arrow { + width: 16px; + height: 16px; + border-radius: 50%; + background-color: rgba(246, 247, 251, 1); + display: flex; + justify-content: center; + align-items: center; +} + +.caseLegalBox-arrow { + width: 16px; + height: 16px; + border-radius: 50%; + background-color: rgba(246, 247, 251, 1); + display: flex; + justify-content: center; + align-items: center; + margin-right: 8px; +} + +.img-case_2 { + display: flex; + margin-top: 4px; +} + +.img { + height: 12px; + width: 12px; + margin-right: 4px; +} + +.img1 { + height: 12px; + width: 12px; + margin-right: 1px; +} + +.evaluate { + display: flex; + justify-content: flex-end; + gap: 18px; + margin-top: 12px; + margin-bottom: 13px; + padding-bottom: 13px; +} + +/* 蒙层 */ +.popup-box { + position: fixed; + z-index: 100; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.5); + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +.overBox { + background-color: #fff; + width: 300px; + z-index: 101; + position: absolute; + box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.16); + border-radius: 8px; +} + +.judgment { + font-size: 17px; + line-height: 24px; + display: flex; + justify-content: center; + margin-top: 20px; +} + +.help { + color: rgba(23, 26, 29, 0.6); + font-size: 14px; + margin: 12px 20px; +} + +.star { + z-index: 102; + margin: 0px 20px 16PX 20PX; +} + +.buttonBox { + display: flex; + border-top: 1px solid rgba(126, 134, 142, 0.16); + height: 48px; + font-size: 17px; +} + +.think { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + border-right: 1px solid rgba(126, 134, 142, 0.16); +} + +.judgmentFinish { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + color: rgba(209, 2, 28, 1); +} + +.newBox { + max-height: 125px; + overflow-y: auto; +} + + + diff --git a/components/mediate-detail/index.js b/components/mediate-detail/index.js new file mode 100644 index 0000000..6981636 --- /dev/null +++ b/components/mediate-detail/index.js @@ -0,0 +1,163 @@ +const $$ = require('../../utils/util'); + +Component({ + /** + * 组件的属性列表 + */ + properties: { + pageType: String, // '1':我的调解; '2':我的司法确认, '3':登记页面 + caseData: { + // 案件数据 + type: Object, + value: {}, + }, + materialNum: String, // 相关材料数量,只有申请调解时查看才会传递 + type: { + // '1':待受理;'2':待调解(待开始);'3':调解中(进行中);'4':调解结束(已结束);'5':调解-退回;'6':不予受理;'7':异常终止 + type: String, + value: '1', + }, + }, + + /** + * 组件的初始数据 + */ + data: { + imgUrl: $$.url.img, + titleShow: { + '09_01001-1': ['自然人', '姓名', '真实姓名'], + '09_01001-2': ['法人', '企业名称', '企业全名', '法定代表人姓名'], + '09_01001-3': ['机构代表人', '机构名称', '机构全名', '机构代表人姓名'], + }, + partyList: [], // 申请人 or 被申请人 or 代理人信息 + sealVisible: '', // 退回 or 不予受理 or 异常终止显示 + mediateVisible: false, // 调解信息是否显示 + mediate_fileInfoList: [], + mediate_data: [], + judicialVisible: false, // 司法确认信息是否显示 + judicial_fileInfoList: [], + judicial_data: [], + caseClaimHtml: '', + caseDesHtml: '', + }, + + observers: { + 'caseData.id,caseData.process': function () { + if (this.data.pageType === '1') { + this._mediateData(this.data.caseData); + } + if (this.data.pageType === '2') { + this._judicialData(this.data.caseData.judicInfo, this.data.caseData); + this._mediateData(this.data.caseData.caseInfo); + } + if (this.data.pageType === '3') { + this.data.caseData.fileSize = this.data.materialNum; + this._mediateData(this.data.caseData); + } + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 整理司法确认数据 + _judicialData(data, caseData) { + let fileInfoList = []; + data.fileInfoList?.forEach((x) => { + fileInfoList = fileInfoList.concat(x.fileList || []); + }); + // 判断展示 + let judicialVisible = false; + let sealVisible = ''; + let obj = {}; + // 判断司法确认信息展示 + if (['1', '6', '7'].indexOf(this.data.type) === -1) { + judicialVisible = true; + } + if (this.data.type === '6' || this.data.type === '7') { + sealVisible = caseData.processName; + } + obj = { judicialVisible: judicialVisible, sealVisible: sealVisible }; + this.setData({ + judicial_data: data, + mediateVisible: true, + judicial_fileInfoList: fileInfoList, + ...obj, + }); + }, + // 整理调解数据 + _mediateData(data) { + // 合并当事人 + let partyList = []; + let plaintiffList = []; + data.plaintiffList?.forEach((x, t) => { + plaintiffList.push({ ...x, type: 'plaintiffList', orderNum: data.plaintiffList.length !== 1 && t + 1 }); + }); + let defendantList = []; + data.defendantList?.forEach((x, t) => { + defendantList.push({ ...x, type: 'defendantList', orderNum: data.defendantList.length !== 1 && t + 1 }); + }); + partyList = [...plaintiffList, ...defendantList]; + let fileInfoList = []; + data.fileInfoList?.forEach((x) => { + fileInfoList = fileInfoList.concat(x.fileList || []); + }); + // 判断展示 + let mediateVisible = false; + let sealVisible = ''; + let obj = {}; + // 判断调解信息展示 + if (this.data.pageType === '1') { + if (['1', '5', '6', '7'].indexOf(this.data.type) === -1) { + mediateVisible = true; + } + if (this.data.type === '5') { + sealVisible = data.caseStatusName; + } + if (this.data.type === '6' || this.data.type === '7') { + sealVisible = data.processName; + } + obj = { mediateVisible: mediateVisible, sealVisible: sealVisible }; + } + this.setData({ + mediate_data: data, + partyList: partyList, + mediate_fileInfoList: fileInfoList, + caseClaimHtml: `<pre class="pre">${data.caseClaim || '-'}</pre>`, + caseDesHtml: `<pre class="pre">${data.caseDes || '-'}</pre>`, + ...obj, + }); + }, + // 打开文件 + _handleOpenFiles(e) { + let item = e.currentTarget.dataset.item; + let url = $$.baseUrl + $$.url.fileShowUrl + item.id; + $$.openFiles(item.cat, url, [url]); + }, + // 复制 + _handleCopy(e) { + let text = e.currentTarget.dataset.text; + if (!text) { + $$.showToast({ title: '暂无房间号' }); + return; + } + wx.setClipboardData({ + data: text, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + $$.showToast({ icon: 'success', title: '复制成功' }); + }, + }); + }, + }); + }, + // 跳转至材料上传页面 + handleGoToMaterial(e) { + wx.navigateTo({ + url: '../../pages/materialShow/index?caseId=' + e.currentTarget.dataset.id, + }); + }, + }, +}); diff --git a/components/mediate-detail/index.json b/components/mediate-detail/index.json new file mode 100644 index 0000000..1def063 --- /dev/null +++ b/components/mediate-detail/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "ellipsis-text": "../ellipsis-text/index", + "file-card": "../file-card/index", + "time-format": "../time-format/index" + } +} diff --git a/components/mediate-detail/index.wxml b/components/mediate-detail/index.wxml new file mode 100644 index 0000000..637e91d --- /dev/null +++ b/components/mediate-detail/index.wxml @@ -0,0 +1,269 @@ +<!--调解详情 or 司法确认详情组件--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<!-- 司法确认信息 --> +<view class="card" wx:if="{{ judicialVisible }}"> + <view class="user"> + <image class="user-avatar" src="{{ imgUrl }}avatar-fg.png" /> + <view class="user-content"> + <view class="user-content-header"> + <view class="user-content-header-title">{{ judicial_data.judgeName || '-' }}</view> + <van-icon color="#232323" name="phone-circle-o" size="16" /> + <view class="user-content-header-phone" style="color:#232323">{{ judicial_data.judgeMobile || '-' }}</view> + </view> + <view class="user-content-subTitle"> + <ellipsis-text content="承办法官 | {{ judicial_data.courtName || '-' }}" fontsize="24" /> + </view> + </view> + </view> + <!-- 待开始 - 预约信息 --> + <view class="order" wx:if="{{ type === '2' && !!judicial_data.orderStartTime }}"> + <view class="order-date"> + <view class="order-date-day"> + <time-format format="DD" value="{{ judicial_data.orderStartTime }}" />号 + </view> + <view class="order-date-month"> + <time-format format="M" value="{{ judicial_data.orderStartTime }}" />月 + </view> + </view> + <view style="flex: 1;"> + <view class="order-date-time"> + <view> + 预约时间: + <time-format format="HH:mm" value="{{ judicial_data.orderStartTime }}" /> + <text>{{ ' ~ ' }}</text> + <time-format format="HH:mm" value="{{ judicial_data.orderEndTime }}" /> + </view> + <view class="order-date-type">{{ judicial_data.meetWayName }}调解</view> + </view> + <view>预约地点:{{ judicial_data.meetAddr || '-' }}</view> + </view> + </view> + <!-- 进行中 - 司法确认信息 --> + <view class="mediateMsg mediateMsg-judge" wx:if="{{ type === '3' && !!judicial_data.judicStartTime }}"> + <view>司法确认开始时间:{{ judicial_data.judicStartTime || '-' }}</view> + <view>司法确认地点:{{ judicial_data.meetAddr || '-' }}</view> + <view>司法确认方式:{{ judicial_data.meetWayName || '-' }}</view> + <view style="display:flex"> + 线上司法确认房间号:{{ judicial_data.roomNo || '-' }} + <view bind:tap="_handleCopy" class="mediateMsg-copy" data-text="{{ judicial_data.roomNo }}"> + <van-icon name="{{ imgUrl }}copy.png" size="12" /> + <view style="padding-left:8rpx">复制</view> + </view> + </view> + </view> + <!-- 司法确认结束 --> + <block wx:if="{{ type === '4' }}"> + <view class="mediateMsg mediateMsg-judge mediateMsg-margin"> + <view>司法确认时间:{{ judicial_data.judicStartTime || '-' }} ~ {{ judicial_data.judicEndTime || '-' }}</view> + <view>司法确认地点:{{ judicial_data.meetAddr || '-' }}</view> + <view>司法确认方式:{{ judicial_data.meetWayName || '-' }}</view> + <view> + 司法确认结果: + <text style="color: {{ judicial_data.judicResult === '22_00028-1' ? '#07c160' : '#ee0a24' }};">{{ judicial_data.judicResultName || '-' }}</text> + </view> + </view> + <view + catchtap="_handleOpenFiles" + class="action-file action-file-color2" + data-item="{{ item }}" + style="{{ judicial_fileInfoList.length - 1 === index ? 'margin-bottom: 0;' : '' }}" + wx:for="{{ judicial_fileInfoList }}" + wx:key="index" + > + <view class="action-file-name action-file-name-color2"> + <view>民事</view> + <view>裁定</view> + </view> + <view class="action-file-content"> + <view class="action-file-content-name">{{ item.name }}</view> + <view class="action-file-content-btn action-file-content-btn-color2">点击查看</view> + </view> + </view> + </block> +</view> + +<!-- 调解信息 --> +<view class="card" wx:if="{{ mediateVisible }}"> + <view class="user"> + <image class="user-avatar" src="{{ imgUrl }}avatar-tjy.png" /> + <view class="user-content"> + <view class="user-content-header"> + <view class="user-content-header-title">{{ mediate_data.mediator || '-' }}</view> + <van-icon color="#71B4E3" name="phone-circle-o" size="16" /> + <view class="user-content-header-phone" style="color:#71B4E3">{{ mediate_data.mediatorMobile || '-' }}</view> + </view> + <view class="user-content-subTitle"> + <ellipsis-text content="调解员 | {{ mediate_data.mediateUnitName || '-' }}" fontsize="24" /> + </view> + </view> + </view> + <block wx:if="{{ pageType === '1' }}"> + <!-- 待调解 - 预约信息 --> + <view class="order" wx:if="{{ type === '2' && !!mediate_data.meetInfo.orderStartTime }}"> + <view class="order-date"> + <view class="order-date-day"> + <time-format format="DD" value="{{ mediate_data.meetInfo.orderStartTime }}" />号 + </view> + <view class="order-date-month"> + <time-format format="M" value="{{ mediate_data.meetInfo.orderStartTime }}" />月 + </view> + </view> + <view style="flex: 1;"> + <view class="order-date-time"> + <view> + 预约时间: + <time-format format="HH:mm" value="{{ mediate_data.meetInfo.orderStartTime }}" /> + <text>{{ ' ~ ' }}</text> + <time-format format="HH:mm" value="{{ mediate_data.meetInfo.orderEndTime }}" /> + </view> + <view class="order-date-type">{{ mediate_data.meetInfo.meetWayName }}调解</view> + </view> + <view>预约地点:{{ mediate_data.meetInfo.meetAddr || '-' }}</view> + </view> + </view> + <!-- 调解中 - 调解信息 --> + <view class="mediateMsg" wx:if="{{ type === '3' && !!mediate_data.mediStartTime }}"> + <view>调解开始时间:<time-format value="{{ mediate_data.mediStartTime }}" /></view> + <view>调解地点:{{ mediate_data.meetInfo.meetAddr || '-' }}</view> + <view>调解方式:{{ mediate_data.meetInfo.meetWayName || '-' }}</view> + <view style="display:flex"> + 线上调解房间号:{{ mediate_data.meetInfo.roomNo || '-' }} + <view bind:tap="_handleCopy" class="mediateMsg-copy" data-text="{{ mediate_data.meetInfo.roomNo }}"> + <van-icon name="{{ imgUrl }}copy.png" size="12" /> + <view style="padding-left:8rpx">复制</view> + </view> + </view> + </view> + </block> + <!-- 调解结束 --> + <block wx:if="{{ type === '4' || pageType === '2'}}"> + <view class="mediateMsg mediateMsg-margin"> + <view wx:if="{{ judicialVisible }}">调解案号:{{ mediate_data.caseNo || '-' }}</view> + <view> + 调解时间: + <time-format value="{{ mediate_data.mediStartTime }}" /> + <text>{{' ~ '}}</text> + <time-format value="{{ mediate_data.mediEndTime }}" /> + </view> + <view>调解地点:{{ mediate_data.meetInfo.meetAddr || '-' }}</view> + <view>调解方式:{{ mediate_data.meetInfo.meetWayName || '-' }}</view> + <view> + 调解结果: + <text style="color: {{ mediate_data.mediResult === '22_00025-1' ? '#07c160' : '#ee0a24' }};">{{ mediate_data.mediResultName || '-' }}</text> + </view> + </view> + <view + catchtap="_handleOpenFiles" + class="action-file action-file-color1" + data-item="{{ item }}" + style="{{ mediate_fileInfoList.length - 1 === index ? 'margin-bottom: 0;' : '' }}" + wx:for="{{ mediate_fileInfoList }}" + wx:key="index" + > + <view class="action-file-name action-file-name-color1"> + <view>调解</view> + <view>协议</view> + </view> + <view class="action-file-content"> + <view class="action-file-content-name">{{ item.name }}</view> + <view class="action-file-content-btn action-file-content-btn-color1">点击查看</view> + </view> + </view> + </block> +</view> + +<!-- 纠纷信息 --> +<block> + <!-- 意向组织 or 意向调解员 --> + <view + class="card card2" + style="background: linear-gradient(95deg,rgba(173,198,255,0.50) 0%, rgba(214,228,255,0.80) 4%, rgba(214,228,255,0.55) 100%)" + wx:if="{{ mediate_data.wantUserId || mediate_data.wantUnitId }}" + > + <view class="cell"> + <view class="cell-title">意向{{ mediate_data.wantUserId ? '调解员' : '调解组织' }}</view> + <view class="cell-select">{{ mediate_data.wantUserId ? mediate_data.wantUserName : mediate_data.wantUnitName }}</view> + </view> + </view> + <view class="card"> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷发生地</view> + <view>{{ mediate_data.prov ? wxs.showLocation(mediate_data) : '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷发生详址</view> + <view>{{ mediate_data.addr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷类型</view> + <view>{{ mediate_data.caseTypeName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷描述</view> + <view> + <rich-text nodes="{{ caseDesHtml }}"></rich-text> + </view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">调解请求</view> + <view> + <rich-text nodes="{{ caseClaimHtml }}"></rich-text> + </view> + </view> + </view> + <!-- 申请人 and 被申请人 --> + <view class="card card3"> + <block wx:for="{{ partyList }}" wx:key="index"> + <view class="party"> + <view class="party-img {{ item.type === 'plaintiffList' ? 'party-img-shen' : 'party-img-bei' }}">{{ item.type === 'plaintiffList' ? '申请' : '被申' }}</view> + <view class="party-content"> + <view class="party-content-title"> + <view class="party-content-title-name"> + <ellipsis-text content="{{ item.trueName }}" /> + </view> + <view class="party-content-title-phone">{{ item.mobile }}</view> + </view> + <view class="party-content-subTitle"> + <ellipsis-text + content="{{ titleShow[item.perClass][0] }}{{ !!item.deputy ? ' | ' : '' }}{{ item.deputy || '' }}{{ item.certiNo ? ' | ' : '' }}{{ item.certiNo }}" + fontsize="24" + /> + </view> + </view> + </view> + <!-- 代理人 --> + <view class="party" wx:if="{{ !!item.agent }}"> + <view class="party-img party-img-shen">{{ item.type === 'plaintiffList' ? '申请' : '被申' }}</view> + <view class="party-content"> + <view class="party-content-title"> + <view class="party-content-title-name"> + <ellipsis-text content="{{ item.agent.trueName }}" /> + </view> + <view class="party-content-title-phone">{{ item.agent.mobile }}</view> + <view class="tag {{ item.type === 'plaintiffList' ? 'tag-cyan' : 'tag-orange' }}" style="margin-left:16rpx">代理人</view> + </view> + <view class="party-content-subTitle"> + <ellipsis-text content="代理对象 | {{ item.trueName }}" fontsize="24" /> + </view> + </view> + </view> + </block> + </view> + <!-- 纠纷材料 --> + <view class="card card2"> + <view bindtap="handleGoToMaterial" class="cell" data-id="{{ mediate_data.id }}"> + <view class="cell-title">纠纷材料</view> + <view class="cell-select">{{ mediate_data.fileSize || 0 }}份资料</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + </view> +</block> + +<!-- 退回 or 不予受理 or 异常终止显示 --> +<view class="seal" wx:if="{{ !!sealVisible }}"> + <image class="seal-image" src="{{ imgUrl }}detail-seal.png" /> + <view class="seal-text">{{ sealVisible || '不予受理' }}</view> +</view> diff --git a/components/mediate-detail/index.wxss b/components/mediate-detail/index.wxss new file mode 100644 index 0000000..3278a00 --- /dev/null +++ b/components/mediate-detail/index.wxss @@ -0,0 +1,121 @@ +/* components/mediate-detail/index.wxss */ +@import '../../styles/public_components.wxss'; + +.card { + padding: 24rpx 32rpx; + background-color: #ffffff; + margin: 0 var(--padding-my); + border-radius: var(--border-radius-card); + margin-top: 16rpx; +} + +.card2 { + padding: 0 32rpx; +} + +.card3 { + padding: 4rpx 32rpx; +} + +.user { + display: flex; + align-items: center; +} + +.user-avatar { + width: 88rpx; + height: 88rpx; + margin-right: 16rpx; +} + +.user-content { + flex: 1; + overflow: hidden; +} + +.user-content-header { + display: flex; + align-items: center; +} + +.user-content-header-title { + font-weight: 600; + margin-right: 16rpx; +} + +.user-content-header-phone { + font-size: 24rpx; + margin-left: 8rpx; +} + +.user-content-subTitle { + font-size: 24rpx; + line-height: 40rpx; + color: var(--second-text-color); +} + +.order { + margin-left: 0; + margin-right: 0; +} + +.mediateMsg { + background-color: rgba(113, 180, 227, 0.1); + border-radius: 10rpx; + font-size: 24rpx; + line-height: 40rpx; + padding: 24rpx 32rpx; + margin-top: 16rpx; +} + +.mediateMsg-judge { + background-color: rgba(249, 241, 189, 0.6); +} + +.mediateMsg-margin { + margin-bottom: 24rpx; +} + +.mediateMsg-copy { + position: relative; + display: flex; + align-items: center; + padding-left: 8rpx; + margin-left: 8rpx; +} + +.mediateMsg-copy::before { + content: ''; + position: absolute; + left: 0; + height: 24rpx; + width: 2rpx; + background-color: var(--text-color); +} + +.seal { + position: absolute; + z-index: 999; + transform: rotate(13deg); + right: var(--padding-my); + top: 150rpx; +} + +.seal-image { + width: 360rpx; + height: 120rpx; +} + +.seal-text { + position: absolute; + font-size: 40rpx; + line-height: 60rpx; + letter-spacing: 20rpx; + top: 30rpx; + z-index: 999; + left: 0; + right: 0; + text-align: center; + font-weight: 600; + color: #fc5159; +} diff --git a/components/personal-data-dom/index.js b/components/personal-data-dom/index.js new file mode 100644 index 0000000..df53ff6 --- /dev/null +++ b/components/personal-data-dom/index.js @@ -0,0 +1,169 @@ +// components/personal-data-dom/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + + +// 获取信息 +function getUserInfoApi() { + return $$.request({ + url: 'paUser/getUserInfo', + type: 'get', + service: 'cust' + }); +} + +Component({ + /** + * 组件的属性列表 + * submitData: object form数据 + * type: string 判断当前使用组件的页面realNameAuthentication为实名认证页面 + * isCheck: boolean 判断是否只读不可修改 + * isImproveData: boolean 判断是否是完善资料,则不显示证件信息 + */ + properties: { + submitData: { + type: Object, + value: {}, + }, + type: { + type: String, + value: '', + }, + isCheck: { + type: Boolean, + value: false, + }, + isImproveData: { + type: Boolean, + value: false, + }, + }, + + /** + * 组件的初始数据 + */ + select: {}, // 下拉框资源 + location: [], + data: {}, + + pageLifetimes: { + show() { + $$.showLoading(); + this._getSelectOptionData(); + this._getLocationData(); + this._getUserInfo(); + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // + _handleChange(e) { + let key = e.currentTarget.dataset.key; + if (key === 'clearidcard') { + this.triggerEvent('handleChange', { + key: 'idcard', + value: '' + }); + } else { + this.triggerEvent('handleChange', { + key, + value: e.detail + }); + } + }, + // 展示弹出层 + _handleShowPopup(e) { + if (this.data.isCheck) { + return false; + } + let type = e.currentTarget.dataset.type; + let title = e.currentTarget.dataset.title; + let selectData = []; + if (type === 'location') { + let selectOption = JSON.parse(JSON.stringify(this.location)); + let indexArr = $$.getLocationIndex(this.location, this.data.submitData); + selectData = [{ + values: selectOption, + defaultIndex: indexArr[0] + }, + { + values: selectOption[indexArr[0]].children, + defaultIndex: indexArr[1] + }, + { + values: selectOption[indexArr[0]].children[indexArr[1]].children || [], + defaultIndex: indexArr[2] + }, + ]; + selectData.forEach((x) => { + x.values.forEach((y) => { + delete y.children; + }); + }); + } else { + let selectOption = this.select[type]; + selectData = selectOption; + } + this.triggerEvent('handleShowPopup', { + visible: true, + title: title, + type: type, + selectData: selectData, + }); + }, + // 获取手机号码 + _handleGetPhoneNumber(e) { + console.log('eeeee', e); + this.triggerEvent('handleGetPhoneNumber', e.detail.code); + }, + // 获取个人信息 + async _getUserInfo() { + console.log('个人信息') + console.log(app.globalData.access_token, 'app.globalData.access_token1111111') + const res = await getUserInfoApi(); + $$.hideLoading(); + if (res.type) { + if (res.data.trueName !== null) + this.triggerEvent('getUserInfo', res.data); + wx.setStorage({ + key: 'userInfo', + data: res.data + }); + } + }, + // 请求下拉框资源 + async _getSelectOptionData() { + const res = await $$.commonRequest({ + url: `${$$.url.assets}selectOption.json`, + type: 'get' + }); + if (res) { + this.select = { + cardType: [], + sex: [], + }; + this.select.cardType = res.data.cardType || []; + this.select.sex = res.data.sex || []; + } + }, + // 获取省市区等地理资源 + async _getLocationData() { + $$.showLoading(); + const res = await $$.commonRequest({ + url: `${$$.url.assets}locationSelect.json`, + type: 'get' + }); + $$.hideLoading(); + if (res) { + let location = []; + $$.province.forEach((x) => { + location.push(res[x][0]); + }); + this.location = location; + } + }, + }, +}); \ No newline at end of file diff --git a/components/personal-data-dom/index.json b/components/personal-data-dom/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/personal-data-dom/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/personal-data-dom/index.wxml b/components/personal-data-dom/index.wxml new file mode 100644 index 0000000..9a6980d --- /dev/null +++ b/components/personal-data-dom/index.wxml @@ -0,0 +1,81 @@ +<!--完善资料页面 和 实名认证页面的form表单公用组件--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<van-cell-group border="{{false}}"> + <van-field + bind:change="_handleChange" + clearable + data-key="trueName" + label="真实姓名" + placeholder="请输入" + readonly="{{ isCheck }}" + required="{{ type === 'realNameAuthentication' ? true : false }}" + value="{{ submitData.trueName || '' }}" + /> + <van-field + wx:if="{{ !isImproveData }}" + bindtap="_handleShowPopup" + data-title="证件类型" + data-type="cardType" + is-link="{{ !isCheck }}" + label="证件类型" + placeholder="请选择" + readonly + value="{{ submitData.idcardTypeName || '' }}" + /> + <van-field + wx:if="{{ !isImproveData }}" + bind:change="_handleChange" + data-key="idcard" + label="证件号码" + placeholder="请输入" + readonly="{{ isCheck }}" + required="{{ type === 'realNameAuthentication' ? true : false }}" + type="idcard" + value="{{ submitData.idcard || '' }}" + /> + <van-field + bind:change="_handleChange" + data-key="mobile" + label="联系方式" + placeholder="请输入" + readonly="{{ isCheck }}" + required="{{ type === 'realNameAuthentication' ? true : false }}" + type="number" + value="{{ submitData.mobile || '' }}" + > + <view slot="button" style="display: {{ isCheck ? 'none' : '' }};"> + <van-button bindgetphonenumber="_handleGetPhoneNumber" open-type="getPhoneNumber" size="small" type="primary">点击获取</van-button> + </view> + </van-field> + <block wx:if="{{ type !== 'realNameAuthentication' }}"> + <van-field + bindtap="_handleShowPopup" + data-title="性别" + data-type="sex" + is-link="{{ !isCheck }}" + label="性别" + placeholder="请选择" + readonly + value="{{ submitData.sexName || '' }}" + /> + </block> + <van-field + bindtap="_handleShowPopup" + data-title="居住地" + data-type="location" + is-link="{{ !isCheck }}" + label="居住地" + placeholder="市/区(县)/街道" + readonly + value="{{ submitData.city ? wxs.showLocation(submitData) : '' }}" + /> + <block wx:if="{{ type === 'realNameAuthentication' }}"> + <van-cell border="{{ false }}"> + <van-checkbox bind:change="_handleChange" data-key="agree" shape="square" slot="title" value="{{ submitData.agree || false }}"> + <text class="form-text">我同意并授权以上信息用于矛盾纠纷的调解申请、进度查询等操作</text> + </van-checkbox> + </van-cell> + </block> + <slot></slot> +</van-cell-group> diff --git a/components/personal-data-dom/index.wxss b/components/personal-data-dom/index.wxss new file mode 100644 index 0000000..dc16b2d --- /dev/null +++ b/components/personal-data-dom/index.wxss @@ -0,0 +1 @@ +/* components/personal-data-dom/index.wxss */ \ No newline at end of file diff --git a/components/recording/index.js b/components/recording/index.js new file mode 100644 index 0000000..f6ea5d8 --- /dev/null +++ b/components/recording/index.js @@ -0,0 +1,186 @@ +// components/recording/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +Component({ + /** + * 组件的属性列表 + */ + properties: {}, + + /** + * 组件的初始数据 + */ + countdown: null, + recordMannager: null, + data: { + imgUrl: $$.url.img, + overlayShow: false, + second: 60, // 录音时长 + recordVisible: false, // 是否开启录音 + popup: { + visible: false, + content: '', + }, + tooltipVisible: false, + }, + + pageLifetimes: { + hide: function () { + if (this.countdown) { + clearInterval(this.countdown); + } + if (this.recordMannager) { + this.recordMannager.stop(); + } + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 使用改文字 + _handleUseWords() { + this.triggerEvent('getwords', this.data.popup.content); + this.setData({ popup: { visible: false, content: '' }, overlayShow: false }); + }, + // 修改文字 + _handleChangeWords(e) { + this.data.popup.content = e.detail; + this.setData({ popup: this.data.popup }); + }, + // 语音转文字 + _transferText(e) { + $$.showLoading(); + let speakUrl = e.tempFilePath; + let that = this; + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/v1/xfyun/speech`, + filePath: speakUrl, + name: 'fileNames', + header: { Authorization: app.globalData.token }, + complete(res) { + $$.hideLoading(); + if (res.errMsg === 'uploadFile:ok') { + const { code, data, msg } = JSON.parse(res.data); + if (code === '0' || code === 0) { + that.setData({ + popup: { + visible: true, + content: data, + }, + tooltipVisible: data ? true : false, + }); + setTimeout(() => { + that.setData({ tooltipVisible: false }); + }, 2000); + } else { + $$.showToast({ icon: 'error', title: msg }); + } + } else { + $$.showToast({ icon: 'error', title: '录音转写失败' }); + } + }, + }); + }, + // 录音开始触发 + _startRecord() { + let that = this; + this.countdown = setInterval(() => { + if (that.data.second - 1 <= 0) { + that.recordMannager.stop(); + } + that.setData({ second: that.data.second - 1 }); + }, 1000); + this.setData({ second: 60, recordVisible: true }); + }, + // 录音结束触发 + _endRecord(e) { + if (this.countdown) { + clearInterval(this.countdown); + } + if (60 - this.data.second <= 5) { + $$.showToast({ title: '抱歉!录音时间过短,请重新录入' }); + this.setData({ second: 60, recordVisible: false }); + return false; + } + this.setData({ second: 60, recordVisible: false }); + this._transferText(e); + }, + // 点击 开始说话 and 结束说话 + _handleStartOrEnd() { + // 结束说话 + if (this.data.recordVisible) { + this.recordMannager.stop(); + return false; + } + $$.showLoading(); + let that = this; + wx.getSetting({ + success(res) { + if (res.authSetting['scope.record'] === false) { + $$.hideLoading(); + $$.showModal({ + content: '抱歉!此功能需授权麦克风录音功能', + confirmText: '跳转授权', + success: (res) => { + if (res.confirm) { + wx.openSetting({ + success(res) { + if (res.authSetting['scope.record']) { + $$.showToast({ title: '授权成功' }); + } else { + $$.showToast({ title: '授权失败' }); + } + }, + }); + } + }, + }); + return false; + } + // 开始说话 + if (!that.data.recordVisible) { + const recordMannager = wx.getRecorderManager(); + recordMannager.onStart(() => that._startRecord()); + recordMannager.onStop((e) => that._endRecord(e)); + recordMannager.onError((e) => { + $$.showToast({ title: '抱歉!录音时间过短,请重新录入' }); + that.setData({ second: 60, recordVisible: false }); + }); + const options = { + duration: 60000, + sampleRate: 16000, + numberOfChannels: 1, + encodeBitRate: 96000, + format: 'pcm', + }; + recordMannager.start(options); + that.recordMannager = recordMannager; + $$.hideLoading(); + } + }, + }); + }, + // 进入录音界面 + _handleOpenRecording(e) { + this.triggerEvent('onVisible', { visible: true }); + this.setData({ overlayShow: true }); + }, + // 关闭录音界面 + _handleHiddenRecording() { + if (this.data.recordVisible) { + return false; + } + this.triggerEvent('onVisible', { visible: false }); + this.setData({ overlayShow: false }); + }, + // 关闭文字显示 + _handleClosePopup() { + this.setData({ popup: { visible: false } }); + }, + // 阻止冒泡 + _catchtop() {}, + }, +}); diff --git a/components/recording/index.json b/components/recording/index.json new file mode 100644 index 0000000..7fd09b7 --- /dev/null +++ b/components/recording/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "tooltip": "../tooltip/index" + } +} diff --git a/components/recording/index.wxml b/components/recording/index.wxml new file mode 100644 index 0000000..99eab17 --- /dev/null +++ b/components/recording/index.wxml @@ -0,0 +1,62 @@ +<!--录音转文字--> +<van-button bind:click="_handleOpenRecording" block color="#F2F2F2" custom-style="color:rgba(0,0,0,85)" type="primary">语音录入</van-button> +<van-overlay bind:click="_handleHiddenRecording" show="{{ overlayShow }}" z-index="999"> + <view catchtap="_catchtop" class="recording"> + <!-- 语音动画 --> + <block wx:if="{{ recordVisible }}"> + <view class="time-box"> + <view class="time-box-top"> + <view class="hr hr1" /> + <view class="hr hr2" /> + <view class="hr hr3" /> + <view class="hr hr4" /> + <view class="hr hr5" /> + <view class="hr hr6" /> + <view class="hr hr7" /> + <view class="hr hr8" /> + <view class="hr hr9" /> + <view class="hr hr10" /> + </view> + <view class="time-box-bottom"> + <view class="hr hr1" /> + <view class="hr hr2" /> + <view class="hr hr3" /> + <view class="hr hr4" /> + <view class="hr hr5" /> + <view class="hr hr6" /> + <view class="hr hr7" /> + <view class="hr hr8" /> + <view class="hr hr9" /> + <view class="hr hr10" /> + </view> + </view> + <view class="recording-title">点击下方按钮后结束说话</view> + <view>(还可以说{{ second }}秒)</view> + </block> + <block wx:else> + <image class="recording-img" src="{{ imgUrl }}recording.png" /> + <view class="recording-title">点击下方按钮后开始说话</view> + <view>(最长支持60秒)</view> + </block> + </view> + <view catchtap="_catchtop" class="recording-button-bg"> + <van-button bind:click="_handleStartOrEnd" block color="#ffffff" custom-class="recording-button" plain>{{ recordVisible ? '结束说话' : '开始说话' }}</van-button> + </view> +</van-overlay> +<van-popup bind:close="_handleClosePopup" closeable position="bottom" round show="{{ popup.visible }}" title="调解请说" z-index="999"> + <view class="recording-content"> + <tooltip content="点击文字可进行修改" visible="{{ tooltipVisible }}" /> + <van-field + autosize="{{ { maxHeight: 400, minHeight: 50 } }}" + bind:change="_handleChangeWords" + border="{{ false }}" + custom-style="padding:0" + placeholder="无转写可直接编辑" + type="textarea" + value="{{ popup.content }}" + /> + </view> + <view class="recording-popup-button"> + <van-button bind:click="_handleUseWords" block data-type="next" type="primary">使用文字</van-button> + </view> +</van-popup> diff --git a/components/recording/index.wxss b/components/recording/index.wxss new file mode 100644 index 0000000..8bbc587 --- /dev/null +++ b/components/recording/index.wxss @@ -0,0 +1,163 @@ +/* components/recording/index.wxss */ +@import '../../styles/public_components.wxss'; + +.recording { + position: absolute; + width: 350rpx; + padding: 48rpx 0; + top: 15%; + left: 50%; + margin-left: -175rpx; + text-align: center; + color: #ffffff; + border-radius: 20rpx; + border: 4rpx solid #ffffff; + font-size: 28rpx; +} + +.recording-img { + width: 150rpx; + height: 150rpx; +} + +.recording-title { + padding: 24rpx 0; +} + +.recording-button-bg { + padding: 32rpx var(--padding-my); + position: absolute; + left: 0; + right: 0; + bottom: env(safe-area-inset-bottom); +} + +.recording-button-bg .recording-button { + background-color: rgba(0, 0, 0, 0.5); +} + +.recording-content { + position: relative; + padding: 32rpx; + margin-bottom: 146rpx; +} + +.recording-popup-button { + padding: 32rpx; + border-top: 2rpx solid var(--border-color); + position: fixed; + bottom: env(safe-area-inset-bottom); + left: 0; + right: 0; +} + +.time-box { + position: relative; + height: 120rpx; + left: 50%; + margin-left: -86rpx; +} + +.time-box-top { + position: absolute; + bottom: 50%; +} + +.time-box-bottom { + position: absolute; + top: 50%; + transform: rotateX(180deg); +} + +.hr { + background-color: red; + width: 10rpx; + height: 10rpx; + bottom: 0; + position: absolute; + background: #ffffff; + animation: bodong 0.5s infinite ease; + border-top-left-radius: 5rpx; + border-top-right-radius: 5rpx; +} + +.hr1 { + left: 0; + animation-delay: 1s; + animation-duration: 1s; +} + +.hr2 { + left: 18rpx; + animation-delay: 0.9s; + animation-duration: 0.9s; +} + +.hr3 { + left: 36rpx; + animation-delay: 0.8s; + animation-duration: 0.8s; +} + +.hr4 { + left: 54rpx; + animation-delay: 0.7s; + animation-duration: 0.7s; +} + +.hr5 { + left: 72rpx; + animation-delay: 0.6s; + animation-duration: 0.6s; +} + +.hr6 { + left: 90rpx; + animation-delay: 0.5s; + animation-duration: 0.5s; +} + +.hr7 { + left: 108rpx; + animation-delay: 0.7s; + animation-duration: 0.7s; +} + +.hr8 { + left: 126rpx; + animation-delay: 0.6s; + animation-duration: 0.6s; +} + +.hr9 { + left: 144rpx; + animation-delay: 0.8s; + animation-duration: 0.8s; +} + +.hr10 { + left: 162rpx; + animation-delay: 1s; + animation-duration: 1s; +} + +@keyframes bodong { + 0% { + height: 10rpx; + } + 20% { + height: 20rpx; + } + 30% { + height: 30rpx; + } + 60% { + height: 60rpx; + } + 80% { + height: 30rpx; + } + 100% { + height: 10rpx; + } +} diff --git a/components/steps/index.js b/components/steps/index.js new file mode 100644 index 0000000..ae465a6 --- /dev/null +++ b/components/steps/index.js @@ -0,0 +1,25 @@ +const $$ = require('../../utils/util'); + +Component({ + /** + * 组件的属性列表 + * stepsData: array 步骤条数据,一维数组,只需步骤名称 + * stepsActive: number 步骤条当前选择下标 + * stepsType: 步骤条的类型, 'number' , 'picture' + */ + properties: { + stepsData: { + type: Array, + value: [], + }, + stepsActive: Number, + stepsType: { + type: String, + value: 'number', + }, + }, + + data: { + imgUrl: $$.url.img, + }, +}); diff --git a/components/steps/index.json b/components/steps/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/steps/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/steps/index.wxml b/components/steps/index.wxml new file mode 100644 index 0000000..10806b9 --- /dev/null +++ b/components/steps/index.wxml @@ -0,0 +1,42 @@ +<!--步骤条--> +<view class="steps"> + <block wx:if="{{ stepsType === 'number' }}"> + <view class="steps-item {{ index <= stepsActive && 'steps-item-active' }}" wx:for="{{ stepsData }}" wx:key="index"> + <view class="steps-item-round" wx:if="{{ index > stepsActive }}">{{ index + 1 }}</view> + <view class="steps-item-round" wx:else> + <van-icon name="success" /> + </view> + <view class="steps-item-text">{{ item }}</view> + <view class="steps-item-icon" wx:if="{{ index < stepsData.length - 1 }}"> + <block wx:if="{{ index > stepsActive }}"> + <van-icon name="{{ imgUrl }}steps-arrow.png" size="14" /> + </block> + <block wx:else> + <van-icon custom-style="font-weight:600" name="arrow" size="14" /> + </block> + </view> + </view> + </block> + <block wx:else> + <view class="steps-item {{ index <= stepsActive && 'steps-item-active' }}" wx:for="{{ stepsData }}" wx:key="index"> + <view class="steps-item-round" wx:if="{{ index > stepsActive }}"> + <view class="steps-item-number">{{item.number}}</view> + </view> + <view class="steps-item-round" wx:if="{{ index === stepsActive }}"> + <view class="steps-item-number">{{item.number}}</view> + </view> + <view class="steps-item-round1" wx:if="{{ index < stepsActive }}"> + <van-icon name="success" /> + </view> + <view class="steps-item-text">{{ item.title }}</view> + <view class="steps-item-icon" wx:if="{{ index < stepsData.length - 1 }}"> + <block wx:if="{{ index > stepsActive }}"> + <view class="steps-item-line"></view> + </block> + <block wx:else> + <view class="steps-item-hoverLine"></view> + </block> + </view> + </view> + </block> +</view> \ No newline at end of file diff --git a/components/steps/index.wxss b/components/steps/index.wxss new file mode 100644 index 0000000..de676a0 --- /dev/null +++ b/components/steps/index.wxss @@ -0,0 +1,82 @@ +/* components/steps/index.wxss */ +.steps { + display: flex; + align-items: center; + background-color: #ffffff; +} + +.steps-item { + position: relative; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + color: rgba(23, 26, 29, 0.40); +} + +.steps-item-active, +.steps-item-active .steps-item-icon { + color: var(--main-color); +} + +.steps-item-active .steps-item-round { + background-color: var(--main-color); + color: var(--white); +} + +.steps-item-line {} + +.steps-item-hoverLine { + width: 168rpx; + border: 1px solid var(--main-color); +} + +.steps-item-line { + width: 168rpx; + border: 1px solid #E5E6EB; +} + +.steps-item-active .steps-item-number1 { + background-color: var(--main-color); + color: var(--white); +} + +.steps-item-round { + position: relative; + width: 60rpx; + height: 60rpx; + border-radius: 50%; + color: #86909C; + margin-bottom: 8rpx; + background-color: #F2F3F5; + display: flex; + align-items: center; + justify-content: center; +} + +.steps-item-round1 { + position: relative; + width: 60rpx; + height: 60rpx; + border-radius: 50%; + color: #86909C; + margin-bottom: 8rpx; + background-color: #e8f3ff; + display: flex; + align-items: center; + justify-content: center; +} + +.steps-item-text { + font-size: 24rpx; + line-height: 40rpx; +} + +.steps-item-icon { + position: absolute; + z-index: 889; + top: 50%; + margin-top: -24rpx; + right: -88rpx; + color: #cccccc; +} \ No newline at end of file diff --git a/components/tabbar-page/index.js b/components/tabbar-page/index.js new file mode 100644 index 0000000..0fd1aca --- /dev/null +++ b/components/tabbar-page/index.js @@ -0,0 +1,110 @@ +// components/tabbarPage/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +Component({ + /** + * 组件的初始数据 + */ + data: { + mediate: $$.url.img + 'mediate.png', + mediate_active: $$.url.img + 'mediate-active.png', + active: 0, + loginVisible: !!app.globalData.token, + moreFunctionVisible: false, + moreFunctionList: [ + { + title: '找调解组员', + subTitle: '专业的调解员为您快速解忧', + icon: `${$$.url.img}mediator.png`, + url: '../../pages/findAdjust/index?type=1', + key: '3', + }, + { + title: '找调解组织', + subTitle: '身边的调解组织为您解忧', + icon: `${$$.url.img}organization.png`, + url: '../../pages/findAdjust/index?type=2', + key: '2', + }, + // TODO:协助调解是“调解员端”功能,在当事人小程序中暂时隐藏 + // { + // title: '协助调解', + // subTitle: '参与到外部调解并提供帮助', + // icon: `${$$.url.img}assistMediate.png`, + // url: '../../pages/assistMediate/index', + // key: '5', + // }, + { + title: '我的司法确认', + subTitle: '查询司法确认受理进度', + icon: `${$$.url.img}judicial-confirmation.png`, + url: '../../pages/myJudicialConfirmation/index', + key: '1', + }, + { + title: '个人中心', + subTitle: '实名认证,完善个人信息', + icon: `${$$.url.img}me-center.png`, + url: '../../pages/me/index', + key: '4', + }, + ], + }, + + pageLifetimes: { + show: function () { + if (app.globalData.token && !this.data.loginVisible) { + this.setData({ loginVisible: true }); + } + if (!app.globalData.token) { + this.setData({ loginVisible: false }); + } + }, + }, + + /** + * 组件的方法列表 + */ + methods: { + // 退出登录 + loginOut() { + this.setData({ loginVisible: false }); + }, + // 更多功能进入 + _handleGoPage(e) { + let url = e.currentTarget.dataset.url; + let key = e.currentTarget.dataset.key; + if (['2', '3', '4'].includes(key) && $$.userTest('login')) { + wx.navigateTo({ + url: url, + }); + } + if (['1', '5'].includes(key) && $$.userTest('all')) { + wx.navigateTo({ + url: url, + }); + } + }, + // 切换tab + _handleChangeTab(event) { + if (event.detail === 1) { + this._handleMaskVisible(); + return false; + } + if (event.detail === 2 && !this.data.loginVisible) { + wx.navigateTo({ url: '../../pages/login/index' }); + return false; + } + if (event.detail === 3) { + if ($$.userTest('all')) { + wx.navigateTo({ url: '../../pages/myMediate/index' }); + } + } + }, + // 关闭mask + _handleMaskVisible() { + this.setData({ moreFunctionVisible: !this.data.moreFunctionVisible }); + }, + }, +}); diff --git a/components/tabbar-page/index.json b/components/tabbar-page/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/tabbar-page/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/tabbar-page/index.wxml b/components/tabbar-page/index.wxml new file mode 100644 index 0000000..02e6f5f --- /dev/null +++ b/components/tabbar-page/index.wxml @@ -0,0 +1,37 @@ +<!--tabbar页面引入tabbar--> +<!-- 页面内容 --> +<view class="tabbar-main"> + <slot></slot> +</view> +<!-- tabbar --> +<van-tabbar active="{{ active }}" placeholder bind:change="_handleChangeTab"> + <van-tabbar-item icon="wap-home-o">首页</van-tabbar-item> + <van-tabbar-item> + <view class="tabbar-apps"> + <van-icon name="apps-o" size="24" /> + </view> + </van-tabbar-item> + <van-tabbar-item style="display:{{ loginVisible && 'none' }}" icon="contact">登录</van-tabbar-item> + <van-tabbar-item style="display:{{ !loginVisible && 'none' }}"> + <image slot="icon" src="{{ mediate }}" class="tabbar-icon" /> + <image slot="icon-active" src="{{ mediate_active }}" class="tabbar-icon" /> + 我的调解 + </van-tabbar-item> +</van-tabbar> +<!-- 更多功能 --> +<block> + <view class="more-function" style="transform:{{ moreFunctionVisible ? 'translate3d(0, 0, 0)' : 'translate3d(0, 1000rpx, 0)' }}"> + <view wx:for="{{ moreFunctionList }}" wx:key="index" bindtap="_handleGoPage" data-key="{{ item.key }}" data-url="{{ item.url }}" class="more-function-item"> + <image class="more-function-img" src="{{ item.icon }}" /> + <view> + <view>{{ item.title }}</view> + <view class="more-function-text">{{ item.subTitle }}</view> + </view> + </view> + </view> + <view style="display: {{ moreFunctionVisible ? 'flex' : 'none' }};" class="more-function-close" bindtap="_handleMaskVisible"> + <van-icon name="cross" size="20" /> + </view> +</block> +<!-- 遮罩层 --> +<van-overlay show="{{ moreFunctionVisible }}" bind:click="_handleMaskVisible" z-index="99" custom-style="background-color:#333333" /> \ No newline at end of file diff --git a/components/tabbar-page/index.wxss b/components/tabbar-page/index.wxss new file mode 100644 index 0000000..8f10c6c --- /dev/null +++ b/components/tabbar-page/index.wxss @@ -0,0 +1,73 @@ +/* components/tabbarPage/index.wxss */ +.tabbar-main { + position: relative; + top: 0; + bottom: 0; + left: 0; + right: 0; +} + +.tabbar-apps { + width: 110rpx; + height: 68rpx; + color: #ffffff; + border-radius: 20rpx; + background-color: var(--main-color); + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0px 0 6px 4px rgb(0 0 0 / 10%); +} + +.tabbar-icon { + width: 36rpx; + height: 32rpx; +} + +.more-function { + position: fixed; + bottom: 128rpx; + z-index: 999; + transition: transform 0.5s; + transform: translate3d(0, 1000rpx, 0); + left: 50%; + margin-left: -200rpx; + margin-bottom: env(safe-area-inset-bottom); +} + +.more-function-close { + position: fixed; + z-index: 999; + bottom: 12rpx; + width: 108rpx; + height: 68rpx; + left: 50%; + margin-left: -54rpx; + text-align: center; + background-color: #ffffff; + border-radius: 35rpx; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: env(safe-area-inset-bottom); +} + +.more-function-img { + width: 100rpx; + height: 100rpx; + margin-right: 16rpx; +} + +.more-function-item { + display: flex; + align-items: center; + color: #ffffff; + margin-bottom: 64rpx; +} + +.more-function-text { + font-size: 24rpx; + line-height: 24rpx; + color: #c0b2b2; + padding-top: 16rpx; +} diff --git a/components/textarea/index.js b/components/textarea/index.js new file mode 100644 index 0000000..225de8c --- /dev/null +++ b/components/textarea/index.js @@ -0,0 +1,23 @@ +// components/textarea/index.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/textarea/index.json b/components/textarea/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/textarea/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/textarea/index.wxml b/components/textarea/index.wxml new file mode 100644 index 0000000..b4809c1 --- /dev/null +++ b/components/textarea/index.wxml @@ -0,0 +1,12 @@ +<block> + <view class="cell-item"> + <view class="cell-title"><text><text class="cell-required">*</text> 事项概况</text></view> + <van-field custom-style="padding:0 20rpx;line-height:90rpx" autosize="{{ { maxHeight: 88, minHeight: 88 } }}" bind:change="handleChange" border="{{ false }}" data-key="caseDes" placeholder="请完整描述事项概况,应具备5要素:发生时间+发生地点+人物情况+事项起因+事项经过" type="textarea" value="{{ submitData.caseDes }}" /> + </view> + <view> + <view class="textarea-foot"> + <view></view> + </view> + <!-- <recording bind:getwords="handleGetWords" bind:onVisible="handleVisibleRecording" data-type="caseDes" /> --> + </view> +</block> \ No newline at end of file diff --git a/components/textarea/index.wxss b/components/textarea/index.wxss new file mode 100644 index 0000000..e8f95d7 --- /dev/null +++ b/components/textarea/index.wxss @@ -0,0 +1 @@ +/* components/textarea/index.wxss */ \ No newline at end of file diff --git a/components/time-format/index.js b/components/time-format/index.js new file mode 100644 index 0000000..e979bcc --- /dev/null +++ b/components/time-format/index.js @@ -0,0 +1,53 @@ +/* + * @Company: hugeInfo + * @Author: ldh + * @Date: 2022-06-06 11:40:55 + * @LastEditTime: 2022-06-15 09:18:40 + * @LastEditors: ldh + * @Version: 1.0.0 + * @Description: + */ +// components/time-format/index.js +const $$ = require('../../utils/util'); + +Component({ + /** + * 组件的属性列表 + */ + properties: { + value: String, + format: String, + fromtype: String, + }, + + /** + * 组件的初始数据 + */ + data: { + time: '', + }, + + observers: { + value: function () { + this.setData({ time: $$.timeFormat(this.data.value, this.data.format || undefined) }); + }, + }, + + lifetimes: { + ready: function () { + if (this.data.fromtype === 'messageCenter') { + let str = '今天 '; + let nowTime = $$.moment(); + let time = $$.moment(this.data.value || new Date()); + let diffTime = time.diff(nowTime, 'hours'); + if (diffTime > 0 && diffTime <= 1) { + str = '今天 '; + } + if (diffTime >= -1 && diffTime < 0) { + str = '昨天 '; + } + this.setData({ time: str + $$.timeFormat(this.data.value || new Date(), 'HH:mm') }); + } + }, + }, +}); diff --git a/components/time-format/index.json b/components/time-format/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/time-format/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/time-format/index.wxml b/components/time-format/index.wxml new file mode 100644 index 0000000..eefcf82 --- /dev/null +++ b/components/time-format/index.wxml @@ -0,0 +1,2 @@ +<!--components/time-format/index.wxml--> +<text>{{ time || '-' }}</text> \ No newline at end of file diff --git a/components/time-format/index.wxss b/components/time-format/index.wxss new file mode 100644 index 0000000..7b5205c --- /dev/null +++ b/components/time-format/index.wxss @@ -0,0 +1 @@ +/* components/time-format/index.wxss */ \ No newline at end of file diff --git a/components/tooltip/index.js b/components/tooltip/index.js new file mode 100644 index 0000000..5d5b499 --- /dev/null +++ b/components/tooltip/index.js @@ -0,0 +1,25 @@ +Component({ + /** + * 组件的属性列表 + * width: number 展示宽度 + * content: string 展示内容 + * visible: boolean 是否显示 + * placement: string 方向,可传入参数:left,right,center + */ + properties: { + content: String, + visible: Boolean, + width: { + type: Number, + value: 300, + }, + placement: { + type: String, + value: 'center', + }, + fontsize: { + type: String, + value: '28rpx', + }, + }, +}); diff --git a/components/tooltip/index.json b/components/tooltip/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/tooltip/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/tooltip/index.wxml b/components/tooltip/index.wxml new file mode 100644 index 0000000..044ac74 --- /dev/null +++ b/components/tooltip/index.wxml @@ -0,0 +1,12 @@ +<!--components/tooltip/index.wxml--> +<view + class="tooltip" + style="{{ placement === 'left' ? 'left:0;' : placement === 'right' ? 'right:0;' : 'left:50%;margin-left:-'+ width / 2 + 'rpx' }}" + wx:if="{{ visible }}" +> + <view + class="tooltip-arrow" + style="{{ placement === 'left' ? 'left:24rpx;' : placement === 'right' ? 'right:24rpx;' : 'left:50%;margin-left:-16rpx' }}" + /> + <view class="tooltip-content" style="width:{{ width }}rpx;{{ fontsize ? 'font-size: ' + fontsize : '' }}">{{ content }}</view> +</view> diff --git a/components/tooltip/index.wxss b/components/tooltip/index.wxss new file mode 100644 index 0000000..e24e95f --- /dev/null +++ b/components/tooltip/index.wxss @@ -0,0 +1,40 @@ +/* components/tooltip/index.wxss */ +.tooltip { + position: absolute; + bottom: 100%; + margin-bottom: 24rpx; + align-content: center; + z-index: 999; +} + +.tooltip-content { + position: relative; + padding: 8rpx 0; + color: #fff; + text-align: center; + text-decoration: none; + word-wrap: break-word; + background-color: #3c3d3f; + border-radius: 4rpx; + box-shadow: 0 6rpx 12rpx -8rpx #0000001f, 0 12rpx 32rpx #00000014, 0 18rpx 56rpx 16rpx #0000000d; + font-size: 28rpx; + line-height: 1.5; +} + +.tooltip-arrow { + position: absolute; + width: 32rpx; + height: 32rpx; + overflow: hidden; + border-radius: 4rpx; + transform: rotate(45deg); + bottom: -14rpx; +} + +.tooltip-arrow::before { + position: absolute; + width: 32rpx; + height: 32rpx; + background-color: #3c3d3f; + content: ''; +} diff --git a/components/vant/action-sheet/index.d.ts b/components/vant/action-sheet/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/action-sheet/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/action-sheet/index.js b/components/vant/action-sheet/index.js new file mode 100644 index 0000000..b7af646 --- /dev/null +++ b/components/vant/action-sheet/index.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var button_1 = require("../mixins/button"); +(0, component_1.VantComponent)({ + mixins: [button_1.button], + props: { + show: Boolean, + title: String, + cancelText: String, + description: String, + round: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 100, + }, + actions: { + type: Array, + value: [], + }, + overlay: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + closeOnClickAction: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, + methods: { + onSelect: function (event) { + var _this = this; + var index = event.currentTarget.dataset.index; + var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile; + var item = actions[index]; + if (item) { + this.$emit('select', item); + if (closeOnClickAction) { + this.onClose(); + } + if (item.openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: item.getUserProfileDesc || ' ', + complete: function (userProfile) { + _this.$emit('getuserinfo', userProfile); + }, + }); + } + } + }, + onCancel: function () { + this.$emit('cancel'); + }, + onClose: function () { + this.$emit('close'); + }, + onClickOverlay: function () { + this.$emit('click-overlay'); + this.onClose(); + }, + }, +}); diff --git a/components/vant/action-sheet/index.json b/components/vant/action-sheet/index.json new file mode 100644 index 0000000..19bf989 --- /dev/null +++ b/components/vant/action-sheet/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" + } +} diff --git a/components/vant/action-sheet/index.wxml b/components/vant/action-sheet/index.wxml new file mode 100644 index 0000000..b04cc3a --- /dev/null +++ b/components/vant/action-sheet/index.wxml @@ -0,0 +1,69 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<van-popup + show="{{ show }}" + position="bottom" + round="{{ round }}" + z-index="{{ zIndex }}" + overlay="{{ overlay }}" + custom-class="van-action-sheet" + safe-area-inset-bottom="{{ safeAreaInsetBottom }}" + close-on-click-overlay="{{ closeOnClickOverlay }}" + bind:close="onClickOverlay" +> + <view wx:if="{{ title }}" class="van-action-sheet__header"> + {{ title }} + <van-icon + name="cross" + custom-class="van-action-sheet__close" + bind:click="onClose" + /> + </view> + <view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom"> + {{ description }} + </view> + <view wx:if="{{ actions && actions.length }}"> + <!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 --> + <button + wx:for="{{ actions }}" + wx:key="index" + open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}" + style="{{ item.color ? 'color: ' + item.color : '' }}" + class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}" + hover-class="van-action-sheet__item--hover" + data-index="{{ index }}" + bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}" + bindgetuserinfo="onGetUserInfo" + bindcontact="onContact" + bindgetphonenumber="onGetPhoneNumber" + binderror="onError" + bindlaunchapp="onLaunchApp" + bindopensetting="onOpenSetting" + lang="{{ lang }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" + > + <block wx:if="{{ !item.loading }}"> + {{ item.name }} + <view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view> + </block> + <van-loading wx:else custom-class="van-action-sheet__loading" size="22px" /> + </button> + </view> + <slot /> + <block wx:if="{{ cancelText }}"> + <view class="van-action-sheet__gap" /> + <view + class="van-action-sheet__cancel" + hover-class="van-action-sheet__cancel--hover" + hover-stay-time="70" + bind:tap="onCancel" + > + {{ cancelText }} + </view> + </block> +</van-popup> diff --git a/components/vant/action-sheet/index.wxss b/components/vant/action-sheet/index.wxss new file mode 100644 index 0000000..eedd361 --- /dev/null +++ b/components/vant/action-sheet/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-action-sheet{color:var(--action-sheet-item-text-color,#323233);max-height:var(--action-sheet-max-height,90%)!important}.van-action-sheet__cancel,.van-action-sheet__item{background-color:var(--action-sheet-item-background,#fff);font-size:var(--action-sheet-item-font-size,16px);line-height:var(--action-sheet-item-line-height,22px);padding:14px 16px;text-align:center}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{background-color:var(--action-sheet-cancel-padding-color,#f7f8fa);display:block;height:var(--action-sheet-cancel-padding-top,8px)}.van-action-sheet__item--disabled{color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{color:var(--action-sheet-subname-color,#969799);font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.van-action-sheet__header{font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--font-weight-bold,500);line-height:var(--action-sheet-header-height,48px);text-align:center}.van-action-sheet__description{color:var(--action-sheet-description-color,#969799);font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.van-action-sheet__close{color:var(--action-sheet-close-icon-color,#c8c9cc);font-size:var(--action-sheet-close-icon-size,22px)!important;line-height:inherit!important;padding:var(--action-sheet-close-icon-padding,0 16px);position:absolute!important;right:0;top:0}.van-action-sheet__loading{display:flex!important} \ No newline at end of file diff --git a/components/vant/button/index.d.ts b/components/vant/button/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/button/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/button/index.js b/components/vant/button/index.js new file mode 100644 index 0000000..0e3c134 --- /dev/null +++ b/components/vant/button/index.js @@ -0,0 +1,64 @@ +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +import { canIUseFormFieldButton } from '../common/version'; +const mixins = [button]; +if (canIUseFormFieldButton()) { + mixins.push('wx://form-field-button'); +} +VantComponent({ + mixins, + classes: ['hover-class', 'loading-class'], + data: { + baseStyle: '', + }, + props: { + formType: String, + icon: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + plain: Boolean, + block: Boolean, + round: Boolean, + square: Boolean, + loading: Boolean, + hairline: Boolean, + disabled: Boolean, + loadingText: String, + customStyle: String, + loadingType: { + type: String, + value: 'circular', + }, + type: { + type: String, + value: 'default', + }, + dataset: null, + size: { + type: String, + value: 'normal', + }, + loadingSize: { + type: String, + value: '20px', + }, + color: String, + }, + methods: { + onClick(event) { + this.$emit('click', event); + const { canIUseGetUserProfile, openType, getUserProfileDesc, lang, } = this.data; + if (openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: getUserProfileDesc || ' ', + lang: lang || 'en', + complete: (userProfile) => { + this.$emit('getuserinfo', userProfile); + }, + }); + } + }, + }, +}); diff --git a/components/vant/button/index.json b/components/vant/button/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/components/vant/button/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/components/vant/button/index.wxml b/components/vant/button/index.wxml new file mode 100644 index 0000000..8034845 --- /dev/null +++ b/components/vant/button/index.wxml @@ -0,0 +1,53 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<button + id="{{ id }}" + data-detail="{{ dataset }}" + class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" + hover-class="van-button--active hover-class" + lang="{{ lang }}" + form-type="{{ formType }}" + style="{{ computed.rootStyle({ plain, color, customStyle }) }}" + open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}" + business-id="{{ businessId }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" + aria-label="{{ ariaLabel }}" + bindtap="{{ disabled || loading ? '' : 'onClick' }}" + bindgetuserinfo="onGetUserInfo" + bindcontact="onContact" + bindgetphonenumber="onGetPhoneNumber" + binderror="onError" + bindlaunchapp="onLaunchApp" + bindopensetting="onOpenSetting" +> + <block wx:if="{{ loading }}"> + <van-loading + custom-class="loading-class" + size="{{ loadingSize }}" + type="{{ loadingType }}" + color="{{ computed.loadingColor({ type, color, plain }) }}" + /> + <view wx:if="{{ loadingText }}" class="van-button__loading-text"> + {{ loadingText }} + </view> + </block> + <block wx:else> + <van-icon + wx:if="{{ icon }}" + size="1.2em" + name="{{ icon }}" + class-prefix="{{ classPrefix }}" + class="van-button__icon" + custom-style="line-height: inherit;" + /> + <view class="van-button__text"> + <slot /> + </view> + </block> +</button> diff --git a/components/vant/button/index.wxs b/components/vant/button/index.wxs new file mode 100644 index 0000000..8b649fe --- /dev/null +++ b/components/vant/button/index.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + if (!data.color) { + return data.customStyle; + } + + var properties = { + color: data.plain ? data.color : '#fff', + background: data.plain ? null : data.color, + }; + + // hide border when color is linear-gradient + if (data.color.indexOf('gradient') !== -1) { + properties.border = 0; + } else { + properties['border-color'] = data.color; + } + + return style([properties, data.customStyle]); +} + +function loadingColor(data) { + if (data.plain) { + return data.color ? data.color : '#c9c9c9'; + } + + if (data.type === 'default') { + return '#c9c9c9'; + } + + return '#fff'; +} + +module.exports = { + rootStyle: rootStyle, + loadingColor: loadingColor, +}; diff --git a/components/vant/button/index.wxss b/components/vant/button/index.wxss new file mode 100644 index 0000000..4d98787 --- /dev/null +++ b/components/vant/button/index.wxss @@ -0,0 +1,144 @@ +@import '../common/index.wxss'; +.van-button { + -webkit-text-size-adjust: 100%; + align-items: center; + -webkit-appearance: none; + border-radius: var(--button-border-radius, 2px); + box-sizing: border-box; + display: inline-flex; + font-size: var(--button-default-font-size, 16px); + height: var(--button-default-height, 44px); + justify-content: center; + line-height: var(--button-line-height, 20px); + padding: 0; + position: relative; + text-align: center; + transition: opacity 0.2s; + vertical-align: middle; +} +.van-button:before { + background-color: #000; + border: inherit; + border-color: #000; + border-radius: inherit; + content: ' '; + height: 100%; + left: 50%; + opacity: 0; + position: absolute; + top: 50%; + transform: translate(-50%, -50%); + width: 100%; +} +.van-button:after { + border-width: 0; +} +.van-button--active:before { + opacity: 0.15; +} +.van-button--unclickable:after { + display: none; +} +.van-button--default { + background: var(--button-default-background-color, #fff); + border: var(--button-border-width, 1px) solid var(--button-default-border-color, #ebedf0); + color: var(--button-default-color, #323233); +} +.van-button--primary { + background: var(--button-primary-background-color, #07c160); + border: var(--button-border-width, 1px) solid var(--button-primary-border-color, #07c160); + color: var(--button-primary-color, #fff); +} +.van-button--info { + background: var(--button-info-background-color, #1989fa); + border: var(--button-border-width, 1px) solid var(--button-info-border-color, #1989fa); + color: var(--button-info-color, #fff); +} +.van-button--danger { + background: var(--button-danger-background-color, #ee0a24); + border: var(--button-border-width, 1px) solid var(--button-danger-border-color, #ee0a24); + color: var(--button-danger-color, #fff); +} +.van-button--warning { + background: var(--button-warning-background-color, #ff976a); + border: var(--button-border-width, 1px) solid var(--button-warning-border-color, #ff976a); + color: var(--button-warning-color, #fff); +} +.van-button--plain { + background: var(--button-plain-background-color, #fff); +} +.van-button--plain.van-button--primary { + color: var(--button-primary-background-color, #07c160); +} +.van-button--plain.van-button--info { + color: var(--button-info-background-color, #1989fa); +} +.van-button--plain.van-button--danger { + color: var(--button-danger-background-color, #ee0a24); +} +.van-button--plain.van-button--warning { + color: var(--button-warning-background-color, #ff976a); +} +.van-button--large { + height: var(--button-large-height, 50px); + width: 100%; +} +.van-button--normal { + font-size: var(--button-normal-font-size, 14px); + padding: 0 15px; +} +.van-button--small { + font-size: var(--button-small-font-size, 12px); + height: var(--button-small-height, 30px); + min-width: var(--button-small-min-width, 60px); + padding: 0 var(--padding-xs, 8px); +} +.van-button--mini { + display: inline-block; + font-size: var(--button-mini-font-size, 10px); + height: var(--button-mini-height, 22px); + min-width: var(--button-mini-min-width, 50px); +} +.van-button--mini + .van-button--mini { + margin-left: 5px; +} +.van-button--block { + display: flex; + width: 100%; +} +.van-button--round { + border-radius: var(--button-round-border-radius, 999px); +} +.van-button--square { + border-radius: 0; +} +.van-button--disabled { + opacity: var(--button-disabled-opacity, 0.5); +} +.van-button__text { + display: inline; +} +.van-button__icon + .van-button__text:not(:empty), +.van-button__loading-text { + margin-left: 16rpx; +} +.van-button__icon { + line-height: inherit !important; + min-width: 1em; + vertical-align: top; +} +.van-button--hairline { + border-width: 0; + padding-top: 1px; +} +.van-button--hairline:after { + border-color: inherit; + border-radius: calc(var(--button-border-radius, 2px) * 2); + border-width: 1px; +} +.van-button--hairline.van-button--round:after { + border-radius: var(--button-round-border-radius, 999px); +} +.van-button--hairline.van-button--square:after { + border-radius: 0; +} diff --git a/components/vant/cell-group/index.d.ts b/components/vant/cell-group/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/cell-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/cell-group/index.js b/components/vant/cell-group/index.js new file mode 100644 index 0000000..170760f --- /dev/null +++ b/components/vant/cell-group/index.js @@ -0,0 +1,11 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + title: String, + border: { + type: Boolean, + value: true, + }, + inset: Boolean, + }, +}); diff --git a/components/vant/cell-group/index.json b/components/vant/cell-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/cell-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/cell-group/index.wxml b/components/vant/cell-group/index.wxml new file mode 100644 index 0000000..311e064 --- /dev/null +++ b/components/vant/cell-group/index.wxml @@ -0,0 +1,11 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + wx:if="{{ title }}" + class="{{ utils.bem('cell-group__title', { inset }) }}" +> + {{ title }} +</view> +<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}"> + <slot /> +</view> diff --git a/components/vant/cell-group/index.wxss b/components/vant/cell-group/index.wxss new file mode 100644 index 0000000..08b252f --- /dev/null +++ b/components/vant/cell-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell-group--inset{border-radius:var(--cell-group-inset-border-radius,8px);margin:var(--cell-group-inset-padding,0 16px);overflow:hidden}.van-cell-group__title{color:var(--cell-group-title-color,#969799);font-size:var(--cell-group-title-font-size,14px);line-height:var(--cell-group-title-line-height,16px);padding:var(--cell-group-title-padding,16px 16px 8px)}.van-cell-group__title--inset{padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)} \ No newline at end of file diff --git a/components/vant/cell/index.d.ts b/components/vant/cell/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/cell/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/cell/index.js b/components/vant/cell/index.js new file mode 100644 index 0000000..35548b9 --- /dev/null +++ b/components/vant/cell/index.js @@ -0,0 +1,38 @@ +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, + }, + titleStyle: String, + }, + methods: { + onClick(event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + }, +}); diff --git a/components/vant/cell/index.json b/components/vant/cell/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/components/vant/cell/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/components/vant/cell/index.wxml b/components/vant/cell/index.wxml new file mode 100644 index 0000000..8387c3c --- /dev/null +++ b/components/vant/cell/index.wxml @@ -0,0 +1,47 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}" + hover-class="van-cell--hover hover-class" + hover-stay-time="70" + style="{{ customStyle }}" + bind:tap="onClick" +> + <van-icon + wx:if="{{ icon }}" + name="{{ icon }}" + class="van-cell__left-icon-wrap" + custom-class="van-cell__left-icon" + /> + <slot wx:else name="icon" /> + + <view + style="{{ computed.titleStyle({ titleWidth, titleStyle }) }}" + class="van-cell__title title-class" + > + + <block wx:if="{{ title }}">{{ title }}</block> + <slot wx:else name="title" /> + + <view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class"> + <slot wx:if="{{ useLabelSlot }}" name="label" /> + <block wx:elif="{{ label }}">{{ label }}</block> + </view> + </view> + + <view class="van-cell__value value-class"> + <block wx:if="{{ value || value === 0 }}">{{ value }}</block> + <slot wx:else /> + </view> + + <van-icon + wx:if="{{ isLink }}" + name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}" + class="van-cell__right-icon-wrap right-icon-class" + custom-class="van-cell__right-icon" + /> + <slot wx:else name="right-icon" /> + + <slot name="extra" /> +</view> diff --git a/components/vant/cell/index.wxs b/components/vant/cell/index.wxs new file mode 100644 index 0000000..e3500c4 --- /dev/null +++ b/components/vant/cell/index.wxs @@ -0,0 +1,17 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function titleStyle(data) { + return style([ + { + 'max-width': addUnit(data.titleWidth), + 'min-width': addUnit(data.titleWidth), + }, + data.titleStyle, + ]); +} + +module.exports = { + titleStyle: titleStyle, +}; diff --git a/components/vant/cell/index.wxss b/components/vant/cell/index.wxss new file mode 100644 index 0000000..1802f8e --- /dev/null +++ b/components/vant/cell/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell{background-color:var(--cell-background-color,#fff);box-sizing:border-box;color:var(--cell-text-color,#323233);display:flex;font-size:var(--cell-font-size,14px);line-height:var(--cell-line-height,24px);padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);position:relative;width:100%}.van-cell:after{border-bottom:1px solid #ebedf0;bottom:0;box-sizing:border-box;content:" ";left:16px;pointer-events:none;position:absolute;right:16px;transform:scaleY(.5);transform-origin:center}.van-cell--borderless:after{display:none}.van-cell-group{background-color:var(--cell-background-color,#fff)}.van-cell__label{color:var(--cell-label-color,#969799);font-size:var(--cell-label-font-size,12px);line-height:var(--cell-label-line-height,18px);margin-top:var(--cell-label-margin-top,3px)}.van-cell__value{color:var(--cell-value-color,#969799);overflow:hidden;text-align:right;vertical-align:middle}.van-cell__title,.van-cell__value{flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{align-items:center;display:flex;font-size:var(--cell-icon-size,16px);height:var(--cell-line-height,24px)}.van-cell__left-icon-wrap{margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{color:var(--cell-right-icon-color,#969799);margin-left:var(--padding-base,4px)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{color:var(--cell-required-color,#ee0a24);content:"*";font-size:var(--cell-font-size,14px);left:var(--padding-xs,8px);position:absolute}.van-cell--center{align-items:center}.van-cell--large{padding-bottom:var(--cell-large-vertical-padding,12px);padding-top:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:var(--cell-large-label-font-size,14px)} \ No newline at end of file diff --git a/components/vant/checkbox-group/index.d.ts b/components/vant/checkbox-group/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/checkbox-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/checkbox-group/index.js b/components/vant/checkbox-group/index.js new file mode 100644 index 0000000..c47d97d --- /dev/null +++ b/components/vant/checkbox-group/index.js @@ -0,0 +1,36 @@ +import { useChildren } from '../common/relation'; +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + relation: useChildren('checkbox', function (target) { + this.updateChild(target); + }), + props: { + max: Number, + value: { + type: Array, + observer: 'updateChildren', + }, + disabled: { + type: Boolean, + observer: 'updateChildren', + }, + direction: { + type: String, + value: 'vertical', + }, + }, + methods: { + updateChildren() { + this.children.forEach((child) => this.updateChild(child)); + }, + updateChild(child) { + const { value, disabled, direction } = this.data; + child.setData({ + value: value.indexOf(child.data.name) !== -1, + parentDisabled: disabled, + direction, + }); + }, + }, +}); diff --git a/components/vant/checkbox-group/index.json b/components/vant/checkbox-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/checkbox-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/checkbox-group/index.wxml b/components/vant/checkbox-group/index.wxml new file mode 100644 index 0000000..638bf9d --- /dev/null +++ b/components/vant/checkbox-group/index.wxml @@ -0,0 +1,5 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="{{ utils.bem('checkbox-group', [{ horizontal: direction === 'horizontal' }]) }}"> + <slot /> +</view> diff --git a/components/vant/checkbox-group/index.wxss b/components/vant/checkbox-group/index.wxss new file mode 100644 index 0000000..c5666d7 --- /dev/null +++ b/components/vant/checkbox-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox-group--horizontal{display:flex;flex-wrap:wrap} \ No newline at end of file diff --git a/components/vant/checkbox/index.d.ts b/components/vant/checkbox/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/checkbox/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/checkbox/index.js b/components/vant/checkbox/index.js new file mode 100644 index 0000000..e3b78ab --- /dev/null +++ b/components/vant/checkbox/index.js @@ -0,0 +1,77 @@ +import { useParent } from '../common/relation'; +import { VantComponent } from '../common/component'; +function emit(target, value) { + target.$emit('input', value); + target.$emit('change', value); +} +VantComponent({ + field: true, + relation: useParent('checkbox-group'), + classes: ['icon-class', 'label-class'], + props: { + value: Boolean, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right', + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round', + }, + iconSize: { + type: null, + value: 20, + }, + }, + data: { + parentDisabled: false, + direction: 'vertical', + }, + methods: { + emitChange(value) { + if (this.parent) { + this.setParentValue(this.parent, value); + } + else { + emit(this, value); + } + }, + toggle() { + const { parentDisabled, disabled, value } = this.data; + if (!disabled && !parentDisabled) { + this.emitChange(!value); + } + }, + onClickLabel() { + const { labelDisabled, parentDisabled, disabled, value } = this.data; + if (!disabled && !labelDisabled && !parentDisabled) { + 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); + } + } + }, + }, +}); diff --git a/components/vant/checkbox/index.json b/components/vant/checkbox/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/components/vant/checkbox/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/components/vant/checkbox/index.wxml b/components/vant/checkbox/index.wxml new file mode 100644 index 0000000..39a7bb0 --- /dev/null +++ b/components/vant/checkbox/index.wxml @@ -0,0 +1,31 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="{{ utils.bem('checkbox', [{ horizontal: direction === 'horizontal' }]) }} custom-class"> + <view + wx:if="{{ labelPosition === 'left' }}" + class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" + bindtap="onClickLabel" + > + <slot /> + </view> + <view class="van-checkbox__icon-wrap" bindtap="toggle"> + <slot wx:if="{{ useIconSlot }}" name="icon" /> + <van-icon + wx:else + name="success" + size="0.8em" + class="{{ utils.bem('checkbox__icon', [shape, { disabled: disabled || parentDisabled, checked: value }]) }}" + style="{{ computed.iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) }}" + custom-class="icon-class" + custom-style="line-height: 1.25em;" + /> + </view> + <view + wx:if="{{ labelPosition === 'right' }}" + class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" + bindtap="onClickLabel" + > + <slot /> + </view> +</view> diff --git a/components/vant/checkbox/index.wxs b/components/vant/checkbox/index.wxs new file mode 100644 index 0000000..eb9c772 --- /dev/null +++ b/components/vant/checkbox/index.wxs @@ -0,0 +1,20 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) { + var styles = { + 'font-size': addUnit(iconSize), + }; + + if (checkedColor && value && !disabled && !parentDisabled) { + styles['border-color'] = checkedColor; + styles['background-color'] = checkedColor; + } + + return style(styles); +} + +module.exports = { + iconStyle: iconStyle, +}; diff --git a/components/vant/checkbox/index.wxss b/components/vant/checkbox/index.wxss new file mode 100644 index 0000000..da2272a --- /dev/null +++ b/components/vant/checkbox/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox{align-items:center;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{align-items:center;border:1px solid var(--checkbox-border-color,#c8c9cc);box-sizing:border-box;color:transparent;display:flex;font-size:var(--checkbox-size,20px);height:1em;justify-content:center;text-align:center;transition-duration:var(--checkbox-transition-duration,.2s);transition-property:color,border-color,background-color;width:1em}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:var(--checkbox-checked-icon-color,#1989fa);color:#fff}.van-checkbox__icon--disabled{background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;color:var(--checkbox-label-color,#323233);padding-left:var(--checkbox-label-margin,10px)}.van-checkbox__label--left{float:left;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file diff --git a/components/vant/col/index.d.ts b/components/vant/col/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/col/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/col/index.js b/components/vant/col/index.js new file mode 100644 index 0000000..02bb78d --- /dev/null +++ b/components/vant/col/index.js @@ -0,0 +1,9 @@ +import { useParent } from '../common/relation'; +import { VantComponent } from '../common/component'; +VantComponent({ + relation: useParent('row'), + props: { + span: Number, + offset: Number, + }, +}); diff --git a/components/vant/col/index.json b/components/vant/col/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/col/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/col/index.wxml b/components/vant/col/index.wxml new file mode 100644 index 0000000..975348b --- /dev/null +++ b/components/vant/col/index.wxml @@ -0,0 +1,9 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}" + style="{{ computed.rootStyle({ gutter }) }}" +> + <slot /> +</view> diff --git a/components/vant/col/index.wxs b/components/vant/col/index.wxs new file mode 100644 index 0000000..507c1cb --- /dev/null +++ b/components/vant/col/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + if (!data.gutter) { + return ''; + } + + return style({ + 'padding-right': addUnit(data.gutter / 2), + 'padding-left': addUnit(data.gutter / 2), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/components/vant/col/index.wxss b/components/vant/col/index.wxss new file mode 100644 index 0000000..2fa265e --- /dev/null +++ b/components/vant/col/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-col{box-sizing:border-box;float:left}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} \ No newline at end of file diff --git a/components/vant/common/color.d.ts b/components/vant/common/color.d.ts new file mode 100644 index 0000000..386f307 --- /dev/null +++ b/components/vant/common/color.d.ts @@ -0,0 +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"; diff --git a/components/vant/common/color.js b/components/vant/common/color.js new file mode 100644 index 0000000..6b285bd --- /dev/null +++ b/components/vant/common/color.js @@ -0,0 +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'; diff --git a/components/vant/common/component.d.ts b/components/vant/common/component.d.ts new file mode 100644 index 0000000..1d0fd27 --- /dev/null +++ b/components/vant/common/component.d.ts @@ -0,0 +1,4 @@ +/// <reference types="miniprogram-api-typings" /> +import { VantComponentOptions } from 'definitions/index'; +declare function VantComponent<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption>(vantOptions: VantComponentOptions<Data, Props, Methods>): void; +export { VantComponent }; diff --git a/components/vant/common/component.js b/components/vant/common/component.js new file mode 100644 index 0000000..8528dc0 --- /dev/null +++ b/components/vant/common/component.js @@ -0,0 +1,45 @@ +import { basic } from '../mixins/basic'; +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', + destroyed: 'detached', + classes: 'externalClasses', + }); + // add default externalClasses + options.externalClasses = options.externalClasses || []; + options.externalClasses.push('custom-class'); + // add default behaviors + options.behaviors = options.behaviors || []; + options.behaviors.push(basic); + // add relations + const { relation } = vantOptions; + if (relation) { + options.relations = relation.relations; + options.behaviors.push(relation.mixin); + } + // map field to form-field behavior + if (vantOptions.field) { + options.behaviors.push('wx://form-field'); + } + // add default options + options.options = { + multipleSlots: true, + addGlobalClass: true, + }; + Component(options); +} +export { VantComponent }; diff --git a/components/vant/common/index.wxss b/components/vant/common/index.wxss new file mode 100644 index 0000000..ddd8795 --- /dev/null +++ b/components/vant/common/index.wxss @@ -0,0 +1,69 @@ +.van-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.van-multi-ellipsis--l2 { + -webkit-line-clamp: 2; +} +.van-multi-ellipsis--l2, +.van-multi-ellipsis--l3 { + -webkit-box-orient: vertical; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; +} +.van-multi-ellipsis--l3 { + -webkit-line-clamp: 3; +} +.van-clearfix:after { + clear: both; + content: ''; + display: table; +} +.van-hairline, +.van-hairline--bottom, +.van-hairline--left, +.van-hairline--right, +.van-hairline--surround, +.van-hairline--top, +.van-hairline--top-bottom { + position: relative; +} +.van-hairline--bottom:after, +.van-hairline--left:after, +.van-hairline--right:after, +.van-hairline--surround:after, +.van-hairline--top-bottom:after, +.van-hairline--top:after, +.van-hairline:after { + border: 0 solid #ebedf0; + bottom: -50%; + box-sizing: border-box; + content: ' '; + left: -50%; + pointer-events: none; + position: absolute; + right: -50%; + top: -50%; + transform: scale(0.5); + transform-origin: center; +} +.van-hairline--top:after { + border-top-width: 1px; +} +.van-hairline--left:after { + border-left-width: 1px; +} +.van-hairline--right:after { + border-right-width: 1px; +} +.van-hairline--bottom:after { + border-bottom-width: 1px; +} +.van-hairline--top-bottom:after { + border-width: 1px 0; +} +.van-hairline--surround:after { + border-width: 1px; +} diff --git a/components/vant/common/relation.d.ts b/components/vant/common/relation.d.ts new file mode 100644 index 0000000..4b5af00 --- /dev/null +++ b/components/vant/common/relation.d.ts @@ -0,0 +1,15 @@ +/// <reference types="miniprogram-api-typings" /> +declare type TrivialInstance = WechatMiniprogram.Component.TrivialInstance; +export declare function useParent(name: string, onEffect?: (this: TrivialInstance) => void): { + relations: { + [x: string]: WechatMiniprogram.Component.RelationOption; + }; + mixin: string; +}; +export declare function useChildren(name: string, onEffect?: (this: TrivialInstance, target: TrivialInstance) => void): { + relations: { + [x: string]: WechatMiniprogram.Component.RelationOption; + }; + mixin: string; +}; +export {}; diff --git a/components/vant/common/relation.js b/components/vant/common/relation.js new file mode 100644 index 0000000..04e2934 --- /dev/null +++ b/components/vant/common/relation.js @@ -0,0 +1,56 @@ +export function useParent(name, onEffect) { + const path = `../${name}/index`; + return { + relations: { + [path]: { + type: 'ancestor', + linked() { + onEffect && onEffect.call(this); + }, + linkChanged() { + onEffect && onEffect.call(this); + }, + unlinked() { + onEffect && onEffect.call(this); + }, + }, + }, + mixin: Behavior({ + created() { + Object.defineProperty(this, 'parent', { + get: () => this.getRelationNodes(path)[0], + }); + Object.defineProperty(this, 'index', { + // @ts-ignore + get: () => { var _a, _b; return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.indexOf(this); }, + }); + }, + }), + }; +} +export function useChildren(name, onEffect) { + const path = `../${name}/index`; + return { + relations: { + [path]: { + type: 'descendant', + linked(target) { + onEffect && onEffect.call(this, target); + }, + linkChanged(target) { + onEffect && onEffect.call(this, target); + }, + unlinked(target) { + onEffect && onEffect.call(this, target); + }, + }, + }, + mixin: Behavior({ + created() { + Object.defineProperty(this, 'children', { + get: () => this.getRelationNodes(path) || [], + }); + }, + }), + }; +} diff --git a/components/vant/common/style/clearfix.wxss b/components/vant/common/style/clearfix.wxss new file mode 100644 index 0000000..442246f --- /dev/null +++ b/components/vant/common/style/clearfix.wxss @@ -0,0 +1 @@ +.van-clearfix:after{clear:both;content:"";display:table} \ No newline at end of file diff --git a/components/vant/common/style/ellipsis.wxss b/components/vant/common/style/ellipsis.wxss new file mode 100644 index 0000000..ee701df --- /dev/null +++ b/components/vant/common/style/ellipsis.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3} \ No newline at end of file diff --git a/components/vant/common/style/hairline.wxss b/components/vant/common/style/hairline.wxss new file mode 100644 index 0000000..f7c6260 --- /dev/null +++ b/components/vant/common/style/hairline.wxss @@ -0,0 +1 @@ +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} \ No newline at end of file diff --git a/components/vant/common/style/mixins/clearfix.wxss b/components/vant/common/style/mixins/clearfix.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/vant/common/style/mixins/clearfix.wxss diff --git a/components/vant/common/style/mixins/ellipsis.wxss b/components/vant/common/style/mixins/ellipsis.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/vant/common/style/mixins/ellipsis.wxss diff --git a/components/vant/common/style/mixins/hairline.wxss b/components/vant/common/style/mixins/hairline.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/vant/common/style/mixins/hairline.wxss diff --git a/components/vant/common/style/var.wxss b/components/vant/common/style/var.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/vant/common/style/var.wxss diff --git a/components/vant/common/utils.d.ts b/components/vant/common/utils.d.ts new file mode 100644 index 0000000..af36e60 --- /dev/null +++ b/components/vant/common/utils.d.ts @@ -0,0 +1,14 @@ +/// <reference types="miniprogram-api-typings" /> +/// <reference types="node" /> +export { isDef } from './validator'; +export declare function range(num: number, min: number, max: number): number; +export declare function nextTick(cb: (...args: any[]) => void): void; +export declare function getSystemInfoSync(): WechatMiniprogram.SystemInfo; +export declare function addUnit(value?: string | number): string | undefined; +export declare function requestAnimationFrame(cb: () => void): NodeJS.Timeout | WechatMiniprogram.NodesRef; +export declare function pickExclude(obj: unknown, keys: string[]): {}; +export declare function getRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>; +export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>; +export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void; +export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>; +export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject; diff --git a/components/vant/common/utils.js b/components/vant/common/utils.js new file mode 100644 index 0000000..d06acb1 --- /dev/null +++ b/components/vant/common/utils.js @@ -0,0 +1,92 @@ +import { isDef, isNumber, isPlainObject, isPromise } from './validator'; +import { canIUseGroupSetData, canIUseNextTick } from './version'; +export { isDef } from './validator'; +export function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +export function nextTick(cb) { + if (canIUseNextTick()) { + wx.nextTick(cb); + } + else { + setTimeout(() => { + cb(); + }, 1000 / 30); + } +} +let systemInfo; +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 requestAnimationFrame(cb) { + const systemInfo = getSystemInfoSync(); + if (systemInfo.platform === 'devtools') { + return setTimeout(() => { + cb(); + }, 1000 / 30); + } + return wx + .createSelectorQuery() + .selectViewport() + .boundingClientRect() + .exec(() => { + cb(); + }); +} +export function pickExclude(obj, keys) { + if (!isPlainObject(obj)) { + return {}; + } + return Object.keys(obj).reduce((prev, key) => { + if (!keys.includes(key)) { + prev[key] = obj[key]; + } + return prev; + }, {}); +} +export function getRect(context, selector) { + return new Promise((resolve) => { + wx.createSelectorQuery() + .in(context) + .select(selector) + .boundingClientRect() + .exec((rect = []) => resolve(rect[0])); + }); +} +export function getAllRect(context, selector) { + return new Promise((resolve) => { + wx.createSelectorQuery() + .in(context) + .selectAll(selector) + .boundingClientRect() + .exec((rect = []) => resolve(rect[0])); + }); +} +export function groupSetData(context, cb) { + if (canIUseGroupSetData()) { + context.groupSetData(cb); + } + else { + cb(); + } +} +export function toPromise(promiseLike) { + if (isPromise(promiseLike)) { + return promiseLike; + } + return Promise.resolve(promiseLike); +} +export function getCurrentPage() { + const pages = getCurrentPages(); + return pages[pages.length - 1]; +} diff --git a/components/vant/common/validator.d.ts b/components/vant/common/validator.d.ts new file mode 100644 index 0000000..152894a --- /dev/null +++ b/components/vant/common/validator.d.ts @@ -0,0 +1,9 @@ +export declare function isFunction(val: unknown): val is Function; +export declare function isPlainObject(val: unknown): val is Record<string, unknown>; +export declare function isPromise<T = unknown>(val: unknown): val is Promise<T>; +export declare function isDef(value: unknown): boolean; +export declare function isObj(x: unknown): x is Record<string, unknown>; +export declare function isNumber(value: string): boolean; +export declare function isBoolean(value: unknown): value is boolean; +export declare function isImageUrl(url: string): boolean; +export declare function isVideoUrl(url: string): boolean; diff --git a/components/vant/common/validator.js b/components/vant/common/validator.js new file mode 100644 index 0000000..f11f844 --- /dev/null +++ b/components/vant/common/validator.js @@ -0,0 +1,31 @@ +// eslint-disable-next-line @typescript-eslint/ban-types +export function isFunction(val) { + return typeof val === 'function'; +} +export function isPlainObject(val) { + return val !== null && typeof val === 'object' && !Array.isArray(val); +} +export function isPromise(val) { + return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch); +} +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 isBoolean(value) { + return typeof value === 'boolean'; +} +const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i; +const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i; +export function isImageUrl(url) { + return IMAGE_REGEXP.test(url); +} +export function isVideoUrl(url) { + return VIDEO_REGEXP.test(url); +} diff --git a/components/vant/common/version.d.ts b/components/vant/common/version.d.ts new file mode 100644 index 0000000..988b226 --- /dev/null +++ b/components/vant/common/version.d.ts @@ -0,0 +1,7 @@ +export declare function canIUseModel(): boolean; +export declare function canIUseFormFieldButton(): boolean; +export declare function canIUseAnimate(): boolean; +export declare function canIUseGroupSetData(): boolean; +export declare function canIUseNextTick(): boolean; +export declare function canIUseCanvas2d(): boolean; +export declare function canIUseGetUserProfile(): boolean; diff --git a/components/vant/common/version.js b/components/vant/common/version.js new file mode 100644 index 0000000..eb85185 --- /dev/null +++ b/components/vant/common/version.js @@ -0,0 +1,48 @@ +import { getSystemInfoSync } from './utils'; +function compareVersion(v1, v2) { + v1 = v1.split('.'); + v2 = v2.split('.'); + const len = Math.max(v1.length, v2.length); + while (v1.length < len) { + v1.push('0'); + } + while (v2.length < len) { + v2.push('0'); + } + for (let i = 0; i < len; i++) { + const num1 = parseInt(v1[i], 10); + const num2 = parseInt(v2[i], 10); + if (num1 > num2) { + return 1; + } + if (num1 < num2) { + return -1; + } + } + return 0; +} +function gte(version) { + const system = getSystemInfoSync(); + return compareVersion(system.SDKVersion, version) >= 0; +} +export function canIUseModel() { + return gte('2.9.3'); +} +export function canIUseFormFieldButton() { + return gte('2.10.3'); +} +export function canIUseAnimate() { + return gte('2.9.0'); +} +export function canIUseGroupSetData() { + return gte('2.4.0'); +} +export function canIUseNextTick() { + return wx.canIUse('nextTick'); +} +export function canIUseCanvas2d() { + return gte('2.9.0'); +} +export function canIUseGetUserProfile() { + return !!wx.getUserProfile; +} diff --git a/components/vant/datetime-picker/index.d.ts b/components/vant/datetime-picker/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/datetime-picker/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/datetime-picker/index.js b/components/vant/datetime-picker/index.js new file mode 100644 index 0000000..e30afef --- /dev/null +++ b/components/vant/datetime-picker/index.js @@ -0,0 +1,329 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var validator_1 = require("../common/validator"); +var shared_1 = require("../picker/shared"); +var currentYear = new Date().getFullYear(); +function isValidDate(date) { + return (0, validator_1.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".concat(val).slice(-2); +} +function times(n, iteratee) { + var index = -1; + var result = Array(n < 0 ? 0 : n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +function getTrueValue(formattedValue) { + if (formattedValue === undefined) { + formattedValue = '1'; + } + 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(); +} +var defaultFormatter = function (type, value) { return value; }; +(0, component_1.VantComponent)({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { value: { + type: null, + observer: 'updateValue', + }, filter: null, type: { + type: String, + value: 'datetime', + observer: 'updateValue', + }, showToolbar: { + type: Boolean, + value: true, + }, formatter: { + type: null, + value: defaultFormatter, + }, minDate: { + type: Number, + value: new Date(currentYear - 10, 0, 1).getTime(), + observer: 'updateValue', + }, maxDate: { + type: Number, + value: new Date(currentYear + 10, 11, 31).getTime(), + observer: 'updateValue', + }, minHour: { + type: Number, + value: 0, + observer: 'updateValue', + }, maxHour: { + type: Number, + value: 23, + observer: 'updateValue', + }, minMinute: { + type: Number, + value: 0, + observer: 'updateValue', + }, maxMinute: { + type: Number, + value: 59, + observer: 'updateValue', + } }), + data: { + innerValue: Date.now(), + columns: [], + }, + methods: { + updateValue: function () { + var _this = this; + var data = this.data; + var val = this.correctValue(data.value); + var isEqual = val === data.innerValue; + this.updateColumnValue(val).then(function () { + if (!isEqual) { + _this.$emit('input', val); + } + }); + }, + getPicker: function () { + if (this.picker == null) { + this.picker = this.selectComponent('.van-datetime-picker'); + var picker_1 = this.picker; + var setColumnValues_1 = picker_1.setColumnValues; + picker_1.setColumnValues = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return setColumnValues_1.apply(picker_1, __spreadArray(__spreadArray([], args, true), [false], false)); + }; + } + return this.picker; + }, + updateColumns: function () { + var _a = this.data.formatter, formatter = _a === void 0 ? defaultFormatter : _a; + var results = this.getOriginColumns().map(function (column) { return ({ + values: column.values.map(function (value) { return formatter(column.type, value); }), + }); }); + return this.set({ columns: results }); + }, + getOriginColumns: function () { + var filter = this.data.filter; + var results = this.getRanges().map(function (_a) { + var type = _a.type, range = _a.range; + var values = times(range[1] - range[0] + 1, function (index) { + var value = range[0] + index; + return type === 'year' ? "".concat(value) : padZero(value); + }); + if (filter) { + values = filter(type, values); + } + return { type: type, values: values }; + }); + return results; + }, + getRanges: function () { + var data = this.data; + if (data.type === 'time') { + return [ + { + type: 'hour', + range: [data.minHour, data.maxHour], + }, + { + type: 'minute', + range: [data.minMinute, data.maxMinute], + }, + ]; + } + var _a = this.getBoundary('max', data.innerValue), maxYear = _a.maxYear, maxDate = _a.maxDate, maxMonth = _a.maxMonth, maxHour = _a.maxHour, maxMinute = _a.maxMinute; + var _b = this.getBoundary('min', data.innerValue), minYear = _b.minYear, minDate = _b.minDate, minMonth = _b.minMonth, minHour = _b.minHour, minMinute = _b.minMinute; + var 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: function (value) { + var data = this.data; + // validate value + var isDateType = data.type !== 'time'; + if (isDateType && !isValidDate(value)) { + value = data.minDate; + } + else if (!isDateType && !value) { + var minHour = data.minHour; + value = "".concat(padZero(minHour), ":00"); + } + // time type + if (!isDateType) { + var _a = value.split(':'), hour = _a[0], minute = _a[1]; + hour = padZero(range(hour, data.minHour, data.maxHour)); + minute = padZero(range(minute, data.minMinute, data.maxMinute)); + return "".concat(hour, ":").concat(minute); + } + // date type + value = Math.max(value, data.minDate); + value = Math.min(value, data.maxDate); + return value; + }, + getBoundary: function (type, innerValue) { + var _a; + var value = new Date(innerValue); + var boundary = new Date(this.data["".concat(type, "Date")]); + var year = boundary.getFullYear(); + var month = 1; + var date = 1; + var hour = 0; + var 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 _a = {}, + _a["".concat(type, "Year")] = year, + _a["".concat(type, "Month")] = month, + _a["".concat(type, "Date")] = date, + _a["".concat(type, "Hour")] = hour, + _a["".concat(type, "Minute")] = minute, + _a; + }, + onCancel: function () { + this.$emit('cancel'); + }, + onConfirm: function () { + this.$emit('confirm', this.data.innerValue); + }, + onChange: function () { + var _this = this; + var data = this.data; + var value; + var picker = this.getPicker(); + var originColumns = this.getOriginColumns(); + if (data.type === 'time') { + var indexes = picker.getIndexes(); + value = "".concat(+originColumns[0].values[indexes[0]], ":").concat(+originColumns[1] + .values[indexes[1]]); + } + else { + var indexes = picker.getIndexes(); + var values = indexes.map(function (value, index) { return originColumns[index].values[value]; }); + var year = getTrueValue(values[0]); + var month = getTrueValue(values[1]); + var maxDate = getMonthEndDay(year, month); + var date = getTrueValue(values[2]); + if (data.type === 'year-month') { + date = 1; + } + date = date > maxDate ? maxDate : date; + var hour = 0; + var 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(function () { + _this.$emit('input', value); + _this.$emit('change', picker); + }); + }, + updateColumnValue: function (value) { + var _this = this; + var values = []; + var type = this.data.type; + var formatter = this.data.formatter || defaultFormatter; + var picker = this.getPicker(); + if (type === 'time') { + var pair = value.split(':'); + values = [formatter('hour', pair[0]), formatter('minute', pair[1])]; + } + else { + var date = new Date(value); + values = [ + formatter('year', "".concat(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(function () { return _this.updateColumns(); }) + .then(function () { return picker.setValues(values); }); + }, + }, + created: function () { + var _this = this; + var innerValue = this.correctValue(this.data.value); + this.updateColumnValue(innerValue).then(function () { + _this.$emit('input', innerValue); + }); + }, +}); diff --git a/components/vant/datetime-picker/index.json b/components/vant/datetime-picker/index.json new file mode 100644 index 0000000..a778e91 --- /dev/null +++ b/components/vant/datetime-picker/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/components/vant/datetime-picker/index.wxml b/components/vant/datetime-picker/index.wxml new file mode 100644 index 0000000..ade2202 --- /dev/null +++ b/components/vant/datetime-picker/index.wxml @@ -0,0 +1,16 @@ +<van-picker + class="van-datetime-picker" + active-class="active-class" + toolbar-class="toolbar-class" + column-class="column-class" + title="{{ title }}" + columns="{{ columns }}" + item-height="{{ itemHeight }}" + show-toolbar="{{ showToolbar }}" + visible-item-count="{{ visibleItemCount }}" + confirm-button-text="{{ confirmButtonText }}" + cancel-button-text="{{ cancelButtonText }}" + bind:change="onChange" + bind:confirm="onConfirm" + bind:cancel="onCancel" +/> diff --git a/components/vant/datetime-picker/index.wxss b/components/vant/datetime-picker/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/components/vant/datetime-picker/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/components/vant/definitions/index.d.ts b/components/vant/definitions/index.d.ts new file mode 100644 index 0000000..a7cc750 --- /dev/null +++ b/components/vant/definitions/index.d.ts @@ -0,0 +1,27 @@ +/// <reference types="miniprogram-api-typings" /> +interface VantComponentInstance { + parent: WechatMiniprogram.Component.TrivialInstance; + children: WechatMiniprogram.Component.TrivialInstance[]; + index: number; + $emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void; +} +export declare type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = { + data?: Data; + field?: boolean; + classes?: string[]; + mixins?: string[]; + props?: Props; + relation?: { + relations: Record<string, WechatMiniprogram.Component.RelationOption>; + mixin: string; + }; + methods?: Methods; + beforeCreate?: () => void; + created?: () => void; + mounted?: () => void; + destroyed?: () => void; +} & ThisType<VantComponentInstance & WechatMiniprogram.Component.Instance<Data & { + name: string; + value: any; +} & Record<string, any>, Props, Methods> & Record<string, any>>; +export {}; diff --git a/components/vant/definitions/index.js b/components/vant/definitions/index.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/definitions/index.js @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/divider/index.d.ts b/components/vant/divider/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/divider/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/divider/index.js b/components/vant/divider/index.js new file mode 100644 index 0000000..9596edd --- /dev/null +++ b/components/vant/divider/index.js @@ -0,0 +1,12 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + dashed: Boolean, + hairline: Boolean, + contentPosition: String, + fontSize: String, + borderColor: String, + textColor: String, + customStyle: String, + }, +}); diff --git a/components/vant/divider/index.json b/components/vant/divider/index.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/components/vant/divider/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/components/vant/divider/index.wxml b/components/vant/divider/index.wxml new file mode 100644 index 0000000..f6a5a45 --- /dev/null +++ b/components/vant/divider/index.wxml @@ -0,0 +1,9 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('divider', [{ dashed, hairline }, contentPosition]) }}" + style="{{ computed.rootStyle({ borderColor, textColor, fontSize, customStyle }) }}" +> + <slot /> +</view> diff --git a/components/vant/divider/index.wxs b/components/vant/divider/index.wxs new file mode 100644 index 0000000..215b14f --- /dev/null +++ b/components/vant/divider/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + 'border-color': data.borderColor, + color: data.textColor, + 'font-size': addUnit(data.fontSize), + }, + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/components/vant/divider/index.wxss b/components/vant/divider/index.wxss new file mode 100644 index 0000000..e91dc44 --- /dev/null +++ b/components/vant/divider/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-divider{align-items:center;border:0 solid var(--divider-border-color,#ebedf0);color:var(--divider-text-color,#969799);display:flex;font-size:var(--divider-font-size,14px);line-height:var(--divider-line-height,24px);margin:var(--divider-margin,16px 0)}.van-divider:after,.van-divider:before{border-color:inherit;border-style:inherit;border-width:1px 0 0;box-sizing:border-box;display:block;flex:1;height:1px}.van-divider:before{content:""}.van-divider--hairline:after,.van-divider--hairline:before{transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--center:before,.van-divider--left:before,.van-divider--right:before{margin-right:var(--divider-content-padding,16px)}.van-divider--center:after,.van-divider--left:after,.van-divider--right:after{content:"";margin-left:var(--divider-content-padding,16px)}.van-divider--left:before{max-width:var(--divider-content-left-width,10%)}.van-divider--right:after{max-width:var(--divider-content-right-width,10%)} \ No newline at end of file diff --git a/components/vant/empty/index.d.ts b/components/vant/empty/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/empty/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/empty/index.js b/components/vant/empty/index.js new file mode 100644 index 0000000..842e1bb --- /dev/null +++ b/components/vant/empty/index.js @@ -0,0 +1,10 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + description: String, + image: { + type: String, + value: 'default', + }, + }, +}); diff --git a/components/vant/empty/index.json b/components/vant/empty/index.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/components/vant/empty/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/components/vant/empty/index.wxml b/components/vant/empty/index.wxml new file mode 100644 index 0000000..9c7b719 --- /dev/null +++ b/components/vant/empty/index.wxml @@ -0,0 +1,22 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class van-empty"> + <view class="van-empty__image"> + <slot name="image"></slot> + </view> + <view class="van-empty__image"> + <image wx:if="{{ image }}" class="van-empty__image__img" src="{{ computed.imageUrl(image) }}" /> + </view> + + <view class="van-empty__description"> + <slot name="description"></slot> + </view> + <view class="van-empty__description"> + {{ description }} + </view> + + <view class="van-empty__bottom"> + <slot></slot> + </view> +</view> diff --git a/components/vant/empty/index.wxs b/components/vant/empty/index.wxs new file mode 100644 index 0000000..cf92ece --- /dev/null +++ b/components/vant/empty/index.wxs @@ -0,0 +1,15 @@ +/* eslint-disable */ +var PRESETS = ['error', 'search', 'default', 'network']; + +function imageUrl(image) { + if (PRESETS.indexOf(image) !== -1) { + return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png'; + } + + return image; +} + +module.exports = { + imageUrl: imageUrl, +}; + diff --git a/components/vant/empty/index.wxss b/components/vant/empty/index.wxss new file mode 100644 index 0000000..0fb74fe --- /dev/null +++ b/components/vant/empty/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-empty{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding:32px 0}.van-empty__image{height:160px;width:160px}.van-empty__image:empty{display:none}.van-empty__image__img{height:100%;width:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{color:#969799;font-size:14px;line-height:20px;margin-top:16px;padding:0 60px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px} \ No newline at end of file diff --git a/components/vant/field/index.d.ts b/components/vant/field/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/field/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/field/index.js b/components/vant/field/index.js new file mode 100644 index 0000000..35627a2 --- /dev/null +++ b/components/vant/field/index.js @@ -0,0 +1,107 @@ +import { nextTick } from '../common/utils'; +import { VantComponent } from '../common/component'; +import { commonProps, inputProps, textareaProps } from './props'; +VantComponent({ + field: true, + classes: ['input-class', 'right-icon-class', 'label-class'], + props: Object.assign(Object.assign(Object.assign(Object.assign({}, commonProps), inputProps), textareaProps), { size: String, icon: String, label: String, error: Boolean, center: Boolean, isLink: Boolean, leftIcon: String, rightIcon: String, autosize: null, required: Boolean, iconClass: String, clickable: Boolean, inputAlign: String, customStyle: String, errorMessage: String, arrowDirection: String, showWordLimit: Boolean, errorMessageAlign: String, readonly: { + type: Boolean, + observer: 'setShowClear', + }, clearable: { + type: Boolean, + observer: 'setShowClear', + }, clearTrigger: { + type: String, + value: 'focus', + }, border: { + type: Boolean, + value: true, + }, titleWidth: { + type: String, + value: '6.2em', + }, clearIcon: { + type: String, + value: 'clear', + } }), + data: { + focused: false, + innerValue: '', + showClear: false, + }, + created() { + this.value = this.data.value; + this.setData({ innerValue: this.value }); + }, + methods: { + onInput(event) { + const { value = '' } = event.detail || {}; + this.value = value; + this.setShowClear(); + this.emitChange(); + }, + onFocus(event) { + this.focused = true; + this.setShowClear(); + this.$emit('focus', event.detail); + }, + onBlur(event) { + this.focused = false; + this.setShowClear(); + this.$emit('blur', event.detail); + }, + onClickIcon() { + this.$emit('click-icon'); + }, + onClickInput(event) { + this.$emit('click-input', event.detail); + }, + onClear() { + this.setData({ innerValue: '' }); + this.value = ''; + this.setShowClear(); + nextTick(() => { + this.emitChange(); + this.$emit('clear', ''); + }); + }, + onConfirm(event) { + const { value = '' } = event.detail || {}; + this.value = value; + this.setShowClear(); + this.$emit('confirm', value); + }, + setValue(value) { + this.value = value; + this.setShowClear(); + if (value === '') { + this.setData({ innerValue: '' }); + } + this.emitChange(); + }, + onLineChange(event) { + this.$emit('linechange', event.detail); + }, + onKeyboardHeightChange(event) { + this.$emit('keyboardheightchange', event.detail); + }, + emitChange() { + this.setData({ value: this.value }); + nextTick(() => { + this.$emit('input', this.value); + this.$emit('change', this.value); + }); + }, + setShowClear() { + const { clearable, readonly, clearTrigger } = this.data; + const { focused, value } = this; + let showClear = false; + if (clearable && !readonly) { + const hasValue = !!value; + const trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused); + showClear = hasValue && trigger; + } + this.setData({ showClear }); + }, + noop() { }, + }, +}); diff --git a/components/vant/field/index.json b/components/vant/field/index.json new file mode 100644 index 0000000..5906c50 --- /dev/null +++ b/components/vant/field/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/components/vant/field/index.wxml b/components/vant/field/index.wxml new file mode 100644 index 0000000..f42d0ab --- /dev/null +++ b/components/vant/field/index.wxml @@ -0,0 +1,57 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<van-cell + size="{{ size }}" + icon="{{ leftIcon }}" + center="{{ center }}" + border="{{ border }}" + is-link="{{ isLink }}" + required="{{ required }}" + clickable="{{ clickable }}" + title-width="{{ titleWidth }}" + title-style="margin-right: 12px;" + custom-style="{{ customStyle }}" + arrow-direction="{{ arrowDirection }}" + custom-class="van-field" +> + <slot /> + <slot name="left-icon" slot="icon" /> + <view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title"> + {{ label }} + </view> + <slot wx:else name="label" slot="title" /> + <view class="{{ utils.bem('field__body', [type]) }}"> + <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput"> + <slot name="input" /> + </view> + <include wx:if="{{ type === 'textarea' }}" src="./textarea.wxml" /> + <include wx:else src="./input.wxml" /> + + <van-icon + wx:if="{{ showClear }}" + name="{{ clearIcon }}" + class="van-field__clear-root van-field__icon-root" + catch:touchstart="onClear" + /> + <view class="van-field__icon-container" bind:tap="onClickIcon"> + <van-icon + wx:if="{{ rightIcon || icon }}" + name="{{ rightIcon || icon }}" + class="van-field__icon-root {{ iconClass }}" + custom-class="right-icon-class" + /> + <slot name="right-icon" /> + <slot name="icon" /> + </view> + <view class="van-field__button"> + <slot name="button" /> + </view> + </view> + <view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit"> + <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }} + </view> + <view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}"> + {{ errorMessage }} + </view> +</van-cell> diff --git a/components/vant/field/index.wxs b/components/vant/field/index.wxs new file mode 100644 index 0000000..78575b9 --- /dev/null +++ b/components/vant/field/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function inputStyle(autosize) { + if (autosize && autosize.constructor === 'Object') { + return style({ + 'min-height': addUnit(autosize.minHeight), + 'max-height': addUnit(autosize.maxHeight), + }); + } + + return ''; +} + +module.exports = { + inputStyle: inputStyle, +}; diff --git a/components/vant/field/index.wxss b/components/vant/field/index.wxss new file mode 100644 index 0000000..e62ed24 --- /dev/null +++ b/components/vant/field/index.wxss @@ -0,0 +1,134 @@ +@import '../common/index.wxss'; +.van-field { + --cell-icon-size: var(--field-icon-size, 16px); +} +.van-field__label { + color: var(--field-label-color, #646566); +} +.van-field__label--disabled { + color: var(--field-disabled-text-color, #c8c9cc); +} +.van-field__body { + align-items: center; + display: flex; +} +.van-field__body--textarea { + box-sizing: border-box; + line-height: 1.2em; + min-height: var(--cell-line-height, 24px); + padding: 3.6px 0; +} +.van-field__control:empty + .van-field__control { + display: block; +} +.van-field__control { + background-color: initial; + border: 0; + box-sizing: border-box; + color: var(--field-input-text-color, #323233); + display: none; + height: var(--cell-line-height, 24px); + line-height: inherit; + margin: 0; + min-height: var(--cell-line-height, 24px); + padding: 0; + position: relative; + resize: none; + text-align: left; + width: 100%; +} +.van-field__control:empty { + display: none; +} +.van-field__control--textarea { + height: var(--field-text-area-min-height, 18px); + min-height: var(--field-text-area-min-height, 18px); +} +.van-field__control--error { + color: var(--field-input-error-text-color, #ee0a24); +} +.van-field__control--disabled { + background-color: initial; + color: var(--field-input-disabled-text-color, #c8c9cc); + opacity: 1; +} +.van-field__control--center { + text-align: center; +} +.van-field__control--right { + text-align: right; +} +.van-field__control--custom { + align-items: center; + display: flex; + min-height: var(--cell-line-height, 24px); +} +.van-field__placeholder { + color: var(--field-placeholder-text-color, #c8c9cc); + left: 0; + pointer-events: none; + position: absolute; + right: 0; + top: 0; +} +.van-field__placeholder--error { + color: var(--field-error-message-color, #ee0a24); +} +.van-field__icon-root { + align-items: center; + display: flex; + min-height: var(--cell-line-height, 24px); +} +.van-field__clear-root, +.van-field__icon-container { + line-height: inherit; + margin-right: calc(var(--padding-xs, 8px) * -1); + padding: 0 var(--padding-xs, 8px); + vertical-align: middle; +} +.van-field__button, +.van-field__clear-root, +.van-field__icon-container { + flex-shrink: 0; +} +.van-field__clear-root { + color: var(--field-clear-icon-color, #c8c9cc); + font-size: var(--field-clear-icon-size, 16px); +} +.van-field__icon-container { + color: var(--field-icon-container-color, #969799); + font-size: var(--field-icon-size, 16px); +} +.van-field__icon-container:empty { + display: none; +} +.van-field__button { + padding-left: var(--padding-xs, 8px); +} +.van-field__button:empty { + display: none; +} +.van-field__error-message { + color: var(--field-error-message-color, #ee0a24); + font-size: var(--field-error-message-text-font-size, 12px); + text-align: left; +} +.van-field__error-message--center { + text-align: center; +} +.van-field__error-message--right { + text-align: right; +} +.van-field__word-limit { + color: var(--field-word-limit-color, #646566); + font-size: var(--field-word-limit-font-size, 12px); + line-height: var(--field-word-limit-line-height, 16px); + margin-top: var(--padding-base, 4px); + text-align: right; +} +.van-field__word-num { + display: inline; +} +.van-field__word-num--full { + color: var(--field-word-num-full-color, #ee0a24); +} diff --git a/components/vant/field/input.wxml b/components/vant/field/input.wxml new file mode 100644 index 0000000..dc247aa --- /dev/null +++ b/components/vant/field/input.wxml @@ -0,0 +1,28 @@ +<input + class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class" + type="{{ type }}" + focus="{{ focus }}" + cursor="{{ cursor }}" + value="{{ innerValue || '' }}" + auto-focus="{{ autoFocus }}" + disabled="{{ disabled || readonly }}" + maxlength="{{ maxlength }}" + placeholder="{{ placeholder }}" + placeholder-style="{{ placeholderStyle }}" + placeholder-class="{{ utils.bem('field__placeholder', { error }) }}" + confirm-type="{{ confirmType }}" + confirm-hold="{{ confirmHold }}" + hold-keyboard="{{ holdKeyboard }}" + cursor-spacing="{{ cursorSpacing }}" + adjust-position="{{ adjustPosition }}" + selection-end="{{ selectionEnd }}" + selection-start="{{ selectionStart }}" + always-embed="{{ alwaysEmbed }}" + password="{{ password || type === 'password' }}" + bindinput="onInput" + bindtap="onClickInput" + bindblur="onBlur" + bindfocus="onFocus" + bindconfirm="onConfirm" + bindkeyboardheightchange="onKeyboardHeightChange" +/> diff --git a/components/vant/field/props.d.ts b/components/vant/field/props.d.ts new file mode 100644 index 0000000..5cd130a --- /dev/null +++ b/components/vant/field/props.d.ts @@ -0,0 +1,4 @@ +/// <reference types="miniprogram-api-typings" /> +export declare const commonProps: WechatMiniprogram.Component.PropertyOption; +export declare const inputProps: WechatMiniprogram.Component.PropertyOption; +export declare const textareaProps: WechatMiniprogram.Component.PropertyOption; diff --git a/components/vant/field/props.js b/components/vant/field/props.js new file mode 100644 index 0000000..ae405b3 --- /dev/null +++ b/components/vant/field/props.js @@ -0,0 +1,64 @@ +export const commonProps = { + value: { + type: String, + observer(value) { + if (value !== this.value) { + this.setData({ innerValue: value }); + this.value = value; + } + }, + }, + placeholder: String, + placeholderStyle: String, + placeholderClass: String, + disabled: Boolean, + maxlength: { + type: Number, + value: -1, + }, + cursorSpacing: { + type: Number, + value: 50, + }, + autoFocus: Boolean, + focus: Boolean, + cursor: { + type: Number, + value: -1, + }, + selectionStart: { + type: Number, + value: -1, + }, + selectionEnd: { + type: Number, + value: -1, + }, + adjustPosition: { + type: Boolean, + value: true, + }, + holdKeyboard: Boolean, +}; +export const inputProps = { + type: { + type: String, + value: 'text', + }, + password: Boolean, + confirmType: String, + confirmHold: Boolean, + alwaysEmbed: Boolean, +}; +export const textareaProps = { + autoHeight: Boolean, + fixed: Boolean, + showConfirmBar: { + type: Boolean, + value: true, + }, + disableDefaultPadding: { + type: Boolean, + value: true, + }, +}; diff --git a/components/vant/field/textarea.wxml b/components/vant/field/textarea.wxml new file mode 100644 index 0000000..5015a51 --- /dev/null +++ b/components/vant/field/textarea.wxml @@ -0,0 +1,29 @@ +<textarea + class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class" + fixed="{{ fixed }}" + focus="{{ focus }}" + cursor="{{ cursor }}" + value="{{ innerValue }}" + auto-focus="{{ autoFocus }}" + disabled="{{ disabled || readonly }}" + maxlength="{{ maxlength }}" + placeholder="{{ placeholder }}" + placeholder-style="{{ placeholderStyle }}" + placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}" + auto-height="{{ !!autosize }}" + style="{{ computed.inputStyle(autosize) }}" + cursor-spacing="{{ cursorSpacing }}" + adjust-position="{{ adjustPosition }}" + show-confirm-bar="{{ showConfirmBar }}" + hold-keyboard="{{ holdKeyboard }}" + selection-end="{{ selectionEnd }}" + selection-start="{{ selectionStart }}" + disable-default-padding="{{ disableDefaultPadding }}" + bindinput="onInput" + bindtap="onClickInput" + bindblur="onBlur" + bindfocus="onFocus" + bindconfirm="onConfirm" + bindlinechange="onLineChange" + bindkeyboardheightchange="onKeyboardHeightChange" +/> diff --git a/components/vant/grid-item/index.d.ts b/components/vant/grid-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/grid-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/grid-item/index.js b/components/vant/grid-item/index.js new file mode 100644 index 0000000..a7d47a2 --- /dev/null +++ b/components/vant/grid-item/index.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var link_1 = require("../mixins/link"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useParent)('grid'), + classes: ['content-class', 'icon-class', 'text-class'], + mixins: [link_1.link], + props: { + icon: String, + iconColor: String, + iconPrefix: { + type: String, + value: 'van-icon', + }, + dot: Boolean, + info: null, + badge: null, + text: String, + useSlot: Boolean, + }, + data: { + viewStyle: '', + }, + mounted: function () { + this.updateStyle(); + }, + methods: { + updateStyle: function () { + if (!this.parent) { + return; + } + var _a = this.parent, data = _a.data, children = _a.children; + var columnNum = data.columnNum, border = data.border, square = data.square, gutter = data.gutter, clickable = data.clickable, center = data.center, direction = data.direction, reverse = data.reverse, iconSize = data.iconSize; + this.setData({ + center: center, + border: border, + square: square, + gutter: gutter, + clickable: clickable, + direction: direction, + reverse: reverse, + iconSize: iconSize, + index: children.indexOf(this), + columnNum: columnNum, + }); + }, + onClick: function () { + this.$emit('click'); + this.jumpLink(); + }, + }, +}); diff --git a/components/vant/grid-item/index.json b/components/vant/grid-item/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/components/vant/grid-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/components/vant/grid-item/index.wxml b/components/vant/grid-item/index.wxml new file mode 100644 index 0000000..e95087d --- /dev/null +++ b/components/vant/grid-item/index.wxml @@ -0,0 +1,27 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('grid-item', { square }) }}" + style="{{ computed.wrapperStyle({ square, gutter, columnNum, index }) }}" + bindtap="onClick" +> + <view + class="content-class {{ utils.bem('grid-item__content', [direction, { center, square, reverse, clickable, surround: border && gutter }]) }} {{ border ? 'van-hairline--surround' : '' }}" + style="{{ computed.contentStyle({ square, gutter }) }}" + > + <block wx:if="{{ useSlot }}"> + <slot /> + </block> + <block wx:else> + <view class="van-grid-item__icon icon-class"> + <van-icon wx:if="{{ icon }}" name="{{ icon }}" color="{{ iconColor }}" class-prefix="{{ iconPrefix }}" dot="{{ dot }}" info="{{ badge || info }}" size="{{ iconSize }}" /> + <slot wx:else name="icon"></slot> + </view> + <view class="van-grid-item__text text-class"> + <text wx:if="{{ text }}">{{ text }}</text> + <slot wx:else name="text"></slot> + </view> + </block> + </view> +</view> diff --git a/components/vant/grid-item/index.wxs b/components/vant/grid-item/index.wxs new file mode 100644 index 0000000..2cfe37d --- /dev/null +++ b/components/vant/grid-item/index.wxs @@ -0,0 +1,32 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function wrapperStyle(data) { + var width = 100 / data.columnNum + '%'; + + return style({ + width: width, + 'padding-top': data.square ? width : null, + 'padding-right': addUnit(data.gutter), + 'margin-top': + data.index >= data.columnNum && !data.square + ? addUnit(data.gutter) + : null, + }); +} + +function contentStyle(data) { + return data.square + ? style({ + right: addUnit(data.gutter), + bottom: addUnit(data.gutter), + height: 'auto', + }) + : ''; +} + +module.exports = { + wrapperStyle: wrapperStyle, + contentStyle: contentStyle, +}; diff --git a/components/vant/grid-item/index.wxss b/components/vant/grid-item/index.wxss new file mode 100644 index 0000000..acaea84 --- /dev/null +++ b/components/vant/grid-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-grid-item{box-sizing:border-box;float:left;position:relative}.van-grid-item--square{height:0}.van-grid-item__content{background-color:var(--grid-item-content-background-color,#fff);box-sizing:border-box;display:flex;flex-direction:column;height:100%;padding:var(--grid-item-content-padding,16px 8px)}.van-grid-item__content:after{border-width:0 1px 1px 0;z-index:1}.van-grid-item__content--surround:after{border-width:1px}.van-grid-item__content--center{align-items:center;justify-content:center}.van-grid-item__content--square{left:0;position:absolute;right:0;top:0}.van-grid-item__content--horizontal{flex-direction:row}.van-grid-item__content--horizontal .van-grid-item__text{margin:0 0 0 8px}.van-grid-item__content--reverse{flex-direction:column-reverse}.van-grid-item__content--reverse .van-grid-item__text{margin:0 0 8px}.van-grid-item__content--horizontal.van-grid-item__content--reverse{flex-direction:row-reverse}.van-grid-item__content--horizontal.van-grid-item__content--reverse .van-grid-item__text{margin:0 8px 0 0}.van-grid-item__content--clickable:active{background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{align-items:center;display:flex;font-size:var(--grid-item-icon-size,26px);height:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:var(--grid-item-text-color,#646566);font-size:var(--grid-item-text-font-size,12px)}.van-grid-item__icon+.van-grid-item__text{margin-top:8px} \ No newline at end of file diff --git a/components/vant/grid/index.d.ts b/components/vant/grid/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/grid/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/grid/index.js b/components/vant/grid/index.js new file mode 100644 index 0000000..28d14f4 --- /dev/null +++ b/components/vant/grid/index.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('grid-item'), + props: { + square: { + type: Boolean, + observer: 'updateChildren', + }, + gutter: { + type: null, + 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', + }, + direction: { + type: String, + observer: 'updateChildren', + }, + iconSize: { + type: String, + observer: 'updateChildren', + }, + reverse: { + type: Boolean, + value: false, + observer: 'updateChildren', + }, + }, + methods: { + updateChildren: function () { + this.children.forEach(function (child) { + child.updateStyle(); + }); + }, + }, +}); diff --git a/components/vant/grid/index.json b/components/vant/grid/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/grid/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/grid/index.wxml b/components/vant/grid/index.wxml new file mode 100644 index 0000000..2e4118f --- /dev/null +++ b/components/vant/grid/index.wxml @@ -0,0 +1,8 @@ +<wxs src="./index.wxs" module="computed" /> + +<view + class="van-grid custom-class {{ border && !gutter ? 'van-hairline--top' : '' }}" + style="{{ computed.rootStyle({ gutter }) }}" +> + <slot /> +</view> diff --git a/components/vant/grid/index.wxs b/components/vant/grid/index.wxs new file mode 100644 index 0000000..cd3b1bd --- /dev/null +++ b/components/vant/grid/index.wxs @@ -0,0 +1,13 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style({ + 'padding-left': addUnit(data.gutter), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/components/vant/grid/index.wxss b/components/vant/grid/index.wxss new file mode 100644 index 0000000..e347440 --- /dev/null +++ b/components/vant/grid/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-grid{box-sizing:border-box;overflow:hidden;position:relative} \ No newline at end of file diff --git a/components/vant/icon/index.d.ts b/components/vant/icon/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/icon/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/icon/index.js b/components/vant/icon/index.js new file mode 100644 index 0000000..34fee33 --- /dev/null +++ b/components/vant/icon/index.js @@ -0,0 +1,20 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + dot: Boolean, + info: null, + size: null, + color: String, + customStyle: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + name: String, + }, + methods: { + onClick() { + this.$emit('click'); + }, + }, +}); diff --git a/components/vant/icon/index.json b/components/vant/icon/index.json new file mode 100644 index 0000000..bf0ebe0 --- /dev/null +++ b/components/vant/icon/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-info": "../info/index" + } +} diff --git a/components/vant/icon/index.wxml b/components/vant/icon/index.wxml new file mode 100644 index 0000000..3c70174 --- /dev/null +++ b/components/vant/icon/index.wxml @@ -0,0 +1,20 @@ +<wxs src="./index.wxs" module="computed" /> + +<view + class="{{ computed.rootClass({ classPrefix, name }) }}" + style="{{ computed.rootStyle({ customStyle, color, size }) }}" + bindtap="onClick" +> + <van-info + wx:if="{{ info !== null || dot }}" + dot="{{ dot }}" + info="{{ info }}" + custom-class="van-icon__info" + /> + <image + wx:if="{{ computed.isImage(name) }}" + src="{{ name }}" + mode="aspectFit" + class="van-icon__image" + /> +</view> diff --git a/components/vant/icon/index.wxs b/components/vant/icon/index.wxs new file mode 100644 index 0000000..45e3aa0 --- /dev/null +++ b/components/vant/icon/index.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function isImage(name) { + return name.indexOf('/') !== -1; +} + +function rootClass(data) { + var classes = ['custom-class']; + + if (data.classPrefix != null) { + classes.push(data.classPrefix); + } + + if (isImage(data.name)) { + classes.push('van-icon--image'); + } else if (data.classPrefix != null) { + classes.push(data.classPrefix + '-' + data.name); + } + + return classes.join(' '); +} + +function rootStyle(data) { + return style([ + { + color: data.color, + 'font-size': addUnit(data.size), + }, + data.customStyle, + ]); +} + +module.exports = { + isImage: isImage, + rootClass: rootClass, + rootStyle: rootStyle, +}; diff --git a/components/vant/icon/index.wxss b/components/vant/icon/index.wxss new file mode 100644 index 0000000..61a7d68 --- /dev/null +++ b/components/vant/icon/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-icon{text-rendering:auto;-webkit-font-smoothing:antialiased;font:normal normal normal 14px/1 vant-icon;font-size:inherit;position:relative}.van-icon,.van-icon:before{display:inline-block}.van-icon-exchange:before{content:"\e6af"}.van-icon-eye:before{content:"\e6b0"}.van-icon-enlarge:before{content:"\e6b1"}.van-icon-expand-o:before{content:"\e6b2"}.van-icon-eye-o:before{content:"\e6b3"}.van-icon-expand:before{content:"\e6b4"}.van-icon-filter-o:before{content:"\e6b5"}.van-icon-fire:before{content:"\e6b6"}.van-icon-fail:before{content:"\e6b7"}.van-icon-failure:before{content:"\e6b8"}.van-icon-fire-o:before{content:"\e6b9"}.van-icon-flag-o:before{content:"\e6ba"}.van-icon-font:before{content:"\e6bb"}.van-icon-font-o:before{content:"\e6bc"}.van-icon-gem-o:before{content:"\e6bd"}.van-icon-flower-o:before{content:"\e6be"}.van-icon-gem:before{content:"\e6bf"}.van-icon-gift-card:before{content:"\e6c0"}.van-icon-friends:before{content:"\e6c1"}.van-icon-friends-o:before{content:"\e6c2"}.van-icon-gold-coin:before{content:"\e6c3"}.van-icon-gold-coin-o:before{content:"\e6c4"}.van-icon-good-job-o:before{content:"\e6c5"}.van-icon-gift:before{content:"\e6c6"}.van-icon-gift-o:before{content:"\e6c7"}.van-icon-gift-card-o:before{content:"\e6c8"}.van-icon-good-job:before{content:"\e6c9"}.van-icon-home-o:before{content:"\e6ca"}.van-icon-goods-collect:before{content:"\e6cb"}.van-icon-graphic:before{content:"\e6cc"}.van-icon-goods-collect-o:before{content:"\e6cd"}.van-icon-hot-o:before{content:"\e6ce"}.van-icon-info:before{content:"\e6cf"}.van-icon-hotel-o:before{content:"\e6d0"}.van-icon-info-o:before{content:"\e6d1"}.van-icon-hot-sale-o:before{content:"\e6d2"}.van-icon-hot:before{content:"\e6d3"}.van-icon-like:before{content:"\e6d4"}.van-icon-idcard:before{content:"\e6d5"}.van-icon-invitation:before{content:"\e6d6"}.van-icon-like-o:before{content:"\e6d7"}.van-icon-hot-sale:before{content:"\e6d8"}.van-icon-location-o:before{content:"\e6d9"}.van-icon-location:before{content:"\e6da"}.van-icon-label:before{content:"\e6db"}.van-icon-lock:before{content:"\e6dc"}.van-icon-label-o:before{content:"\e6dd"}.van-icon-map-marked:before{content:"\e6de"}.van-icon-logistics:before{content:"\e6df"}.van-icon-manager:before{content:"\e6e0"}.van-icon-more:before{content:"\e6e1"}.van-icon-live:before{content:"\e6e2"}.van-icon-manager-o:before{content:"\e6e3"}.van-icon-medal:before{content:"\e6e4"}.van-icon-more-o:before{content:"\e6e5"}.van-icon-music-o:before{content:"\e6e6"}.van-icon-music:before{content:"\e6e7"}.van-icon-new-arrival-o:before{content:"\e6e8"}.van-icon-medal-o:before{content:"\e6e9"}.van-icon-new-o:before{content:"\e6ea"}.van-icon-free-postage:before{content:"\e6eb"}.van-icon-newspaper-o:before{content:"\e6ec"}.van-icon-new-arrival:before{content:"\e6ed"}.van-icon-minus:before{content:"\e6ee"}.van-icon-orders-o:before{content:"\e6ef"}.van-icon-new:before{content:"\e6f0"}.van-icon-paid:before{content:"\e6f1"}.van-icon-notes-o:before{content:"\e6f2"}.van-icon-other-pay:before{content:"\e6f3"}.van-icon-pause-circle:before{content:"\e6f4"}.van-icon-pause:before{content:"\e6f5"}.van-icon-pause-circle-o:before{content:"\e6f6"}.van-icon-peer-pay:before{content:"\e6f7"}.van-icon-pending-payment:before{content:"\e6f8"}.van-icon-passed:before{content:"\e6f9"}.van-icon-plus:before{content:"\e6fa"}.van-icon-phone-circle-o:before{content:"\e6fb"}.van-icon-phone-o:before{content:"\e6fc"}.van-icon-printer:before{content:"\e6fd"}.van-icon-photo-fail:before{content:"\e6fe"}.van-icon-phone:before{content:"\e6ff"}.van-icon-photo-o:before{content:"\e700"}.van-icon-play-circle:before{content:"\e701"}.van-icon-play:before{content:"\e702"}.van-icon-phone-circle:before{content:"\e703"}.van-icon-point-gift-o:before{content:"\e704"}.van-icon-point-gift:before{content:"\e705"}.van-icon-play-circle-o:before{content:"\e706"}.van-icon-shrink:before{content:"\e707"}.van-icon-photo:before{content:"\e708"}.van-icon-qr:before{content:"\e709"}.van-icon-qr-invalid:before{content:"\e70a"}.van-icon-question-o:before{content:"\e70b"}.van-icon-revoke:before{content:"\e70c"}.van-icon-replay:before{content:"\e70d"}.van-icon-service:before{content:"\e70e"}.van-icon-question:before{content:"\e70f"}.van-icon-search:before{content:"\e710"}.van-icon-refund-o:before{content:"\e711"}.van-icon-service-o:before{content:"\e712"}.van-icon-scan:before{content:"\e713"}.van-icon-share:before{content:"\e714"}.van-icon-send-gift-o:before{content:"\e715"}.van-icon-share-o:before{content:"\e716"}.van-icon-setting:before{content:"\e717"}.van-icon-points:before{content:"\e718"}.van-icon-photograph:before{content:"\e719"}.van-icon-shop:before{content:"\e71a"}.van-icon-shop-o:before{content:"\e71b"}.van-icon-shop-collect-o:before{content:"\e71c"}.van-icon-shop-collect:before{content:"\e71d"}.van-icon-smile:before{content:"\e71e"}.van-icon-shopping-cart-o:before{content:"\e71f"}.van-icon-sign:before{content:"\e720"}.van-icon-sort:before{content:"\e721"}.van-icon-star-o:before{content:"\e722"}.van-icon-smile-comment-o:before{content:"\e723"}.van-icon-stop:before{content:"\e724"}.van-icon-stop-circle-o:before{content:"\e725"}.van-icon-smile-o:before{content:"\e726"}.van-icon-star:before{content:"\e727"}.van-icon-success:before{content:"\e728"}.van-icon-stop-circle:before{content:"\e729"}.van-icon-records:before{content:"\e72a"}.van-icon-shopping-cart:before{content:"\e72b"}.van-icon-tosend:before{content:"\e72c"}.van-icon-todo-list:before{content:"\e72d"}.van-icon-thumb-circle-o:before{content:"\e72e"}.van-icon-thumb-circle:before{content:"\e72f"}.van-icon-umbrella-circle:before{content:"\e730"}.van-icon-underway:before{content:"\e731"}.van-icon-upgrade:before{content:"\e732"}.van-icon-todo-list-o:before{content:"\e733"}.van-icon-tv-o:before{content:"\e734"}.van-icon-underway-o:before{content:"\e735"}.van-icon-user-o:before{content:"\e736"}.van-icon-vip-card-o:before{content:"\e737"}.van-icon-vip-card:before{content:"\e738"}.van-icon-send-gift:before{content:"\e739"}.van-icon-wap-home:before{content:"\e73a"}.van-icon-wap-nav:before{content:"\e73b"}.van-icon-volume-o:before{content:"\e73c"}.van-icon-video:before{content:"\e73d"}.van-icon-wap-home-o:before{content:"\e73e"}.van-icon-volume:before{content:"\e73f"}.van-icon-warning:before{content:"\e740"}.van-icon-weapp-nav:before{content:"\e741"}.van-icon-wechat-pay:before{content:"\e742"}.van-icon-warning-o:before{content:"\e743"}.van-icon-wechat:before{content:"\e744"}.van-icon-setting-o:before{content:"\e745"}.van-icon-youzan-shield:before{content:"\e746"}.van-icon-warn-o:before{content:"\e747"}.van-icon-smile-comment:before{content:"\e748"}.van-icon-user-circle-o:before{content:"\e749"}.van-icon-video-o:before{content:"\e74a"}.van-icon-add-square:before{content:"\e65c"}.van-icon-add:before{content:"\e65d"}.van-icon-arrow-down:before{content:"\e65e"}.van-icon-arrow-up:before{content:"\e65f"}.van-icon-arrow:before{content:"\e660"}.van-icon-after-sale:before{content:"\e661"}.van-icon-add-o:before{content:"\e662"}.van-icon-alipay:before{content:"\e663"}.van-icon-ascending:before{content:"\e664"}.van-icon-apps-o:before{content:"\e665"}.van-icon-aim:before{content:"\e666"}.van-icon-award:before{content:"\e667"}.van-icon-arrow-left:before{content:"\e668"}.van-icon-award-o:before{content:"\e669"}.van-icon-audio:before{content:"\e66a"}.van-icon-bag-o:before{content:"\e66b"}.van-icon-balance-list:before{content:"\e66c"}.van-icon-back-top:before{content:"\e66d"}.van-icon-bag:before{content:"\e66e"}.van-icon-balance-pay:before{content:"\e66f"}.van-icon-balance-o:before{content:"\e670"}.van-icon-bar-chart-o:before{content:"\e671"}.van-icon-bars:before{content:"\e672"}.van-icon-balance-list-o:before{content:"\e673"}.van-icon-birthday-cake-o:before{content:"\e674"}.van-icon-bookmark:before{content:"\e675"}.van-icon-bill:before{content:"\e676"}.van-icon-bell:before{content:"\e677"}.van-icon-browsing-history-o:before{content:"\e678"}.van-icon-browsing-history:before{content:"\e679"}.van-icon-bookmark-o:before{content:"\e67a"}.van-icon-bulb-o:before{content:"\e67b"}.van-icon-bullhorn-o:before{content:"\e67c"}.van-icon-bill-o:before{content:"\e67d"}.van-icon-calendar-o:before{content:"\e67e"}.van-icon-brush-o:before{content:"\e67f"}.van-icon-card:before{content:"\e680"}.van-icon-cart-o:before{content:"\e681"}.van-icon-cart-circle:before{content:"\e682"}.van-icon-cart-circle-o:before{content:"\e683"}.van-icon-cart:before{content:"\e684"}.van-icon-cash-on-deliver:before{content:"\e685"}.van-icon-cash-back-record:before{content:"\e686"}.van-icon-cashier-o:before{content:"\e687"}.van-icon-chart-trending-o:before{content:"\e688"}.van-icon-certificate:before{content:"\e689"}.van-icon-chat:before{content:"\e68a"}.van-icon-clear:before{content:"\e68b"}.van-icon-chat-o:before{content:"\e68c"}.van-icon-checked:before{content:"\e68d"}.van-icon-clock:before{content:"\e68e"}.van-icon-clock-o:before{content:"\e68f"}.van-icon-close:before{content:"\e690"}.van-icon-closed-eye:before{content:"\e691"}.van-icon-circle:before{content:"\e692"}.van-icon-cluster-o:before{content:"\e693"}.van-icon-column:before{content:"\e694"}.van-icon-comment-circle-o:before{content:"\e695"}.van-icon-cluster:before{content:"\e696"}.van-icon-comment:before{content:"\e697"}.van-icon-comment-o:before{content:"\e698"}.van-icon-comment-circle:before{content:"\e699"}.van-icon-completed:before{content:"\e69a"}.van-icon-credit-pay:before{content:"\e69b"}.van-icon-coupon:before{content:"\e69c"}.van-icon-debit-pay:before{content:"\e69d"}.van-icon-coupon-o:before{content:"\e69e"}.van-icon-contact:before{content:"\e69f"}.van-icon-descending:before{content:"\e6a0"}.van-icon-desktop-o:before{content:"\e6a1"}.van-icon-diamond-o:before{content:"\e6a2"}.van-icon-description:before{content:"\e6a3"}.van-icon-delete:before{content:"\e6a4"}.van-icon-diamond:before{content:"\e6a5"}.van-icon-delete-o:before{content:"\e6a6"}.van-icon-cross:before{content:"\e6a7"}.van-icon-edit:before{content:"\e6a8"}.van-icon-ellipsis:before{content:"\e6a9"}.van-icon-down:before{content:"\e6aa"}.van-icon-discount:before{content:"\e6ab"}.van-icon-ecard-pay:before{content:"\e6ac"}.van-icon-envelop-o:before{content:"\e6ae"}.van-icon-shield-o:before{content:"\e74b"}.van-icon-guide-o:before{content:"\e74c"}.van-icon-cash-o:before{content:"\e74d"}.van-icon-qq:before{content:"\e74e"}.van-icon-wechat-moments:before{content:"\e74f"}.van-icon-weibo:before{content:"\e750"}.van-icon-link-o:before{content:"\e751"}.van-icon-miniprogram-o:before{content:"\e752"}@font-face{font-display:auto;font-family:vant-icon;font-style:normal;font-weight:400;src:url(https://at.alicdn.com/t/font_2553510_iv4v8nulyz.woff2?t=1649083952952) format("woff2"),url(https://at.alicdn.com/t/font_2553510_iv4v8nulyz.woff?t=1649083952952) format("woff"),url(https://at.alicdn.com/t/font_2553510_iv4v8nulyz.ttf?t=1649083952952) format("truetype")}:host{align-items:center;display:inline-flex;justify-content:center}.van-icon--image{height:1em;width:1em}.van-icon__image{height:100%;width:100%}.van-icon__info{z-index:1} \ No newline at end of file diff --git a/components/vant/image/index.d.ts b/components/vant/image/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/image/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/image/index.js b/components/vant/image/index.js new file mode 100644 index 0000000..06c9dd1 --- /dev/null +++ b/components/vant/image/index.js @@ -0,0 +1,60 @@ +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +VantComponent({ + mixins: [button], + classes: ['custom-class', 'loading-class', 'error-class', 'image-class'], + props: { + src: { + type: String, + observer() { + this.setData({ + error: false, + loading: true, + }); + }, + }, + round: Boolean, + width: null, + height: null, + radius: null, + lazyLoad: Boolean, + useErrorSlot: Boolean, + useLoadingSlot: Boolean, + showMenuByLongpress: Boolean, + fit: { + type: String, + value: 'fill', + }, + showError: { + type: Boolean, + value: true, + }, + showLoading: { + type: Boolean, + value: true, + }, + }, + data: { + error: false, + loading: true, + viewStyle: '', + }, + methods: { + 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/components/vant/image/index.json b/components/vant/image/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/components/vant/image/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/components/vant/image/index.wxml b/components/vant/image/index.wxml new file mode 100644 index 0000000..d3092bd --- /dev/null +++ b/components/vant/image/index.wxml @@ -0,0 +1,34 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + style="{{ computed.rootStyle({ width, height, radius }) }}" + class="custom-class {{ utils.bem('image', { round })}}" + bind:tap="onClick" +> + <image + wx:if="{{ !error }}" + src="{{ src }}" + mode="{{ computed.mode(fit) }}" + lazy-load="{{ lazyLoad }}" + class="image-class van-image__img" + show-menu-by-longpress="{{ showMenuByLongpress }}" + bind:load="onLoad" + bind:error="onError" + /> + + <view + wx:if="{{ loading && showLoading }}" + class="loading-class van-image__loading" + > + <slot wx:if="{{ useLoadingSlot }}" name="loading" /> + <van-icon wx:else name="photo" custom-class="van-image__loading-icon" /> + </view> + <view + wx:if="{{ error && showError }}" + class="error-class van-image__error" + > + <slot wx:if="{{ useErrorSlot }}" name="error" /> + <van-icon wx:else name="photo-fail" custom-class="van-image__error-icon" /> + </view> +</view> diff --git a/components/vant/image/index.wxs b/components/vant/image/index.wxs new file mode 100644 index 0000000..cec14b8 --- /dev/null +++ b/components/vant/image/index.wxs @@ -0,0 +1,32 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + width: addUnit(data.width), + height: addUnit(data.height), + 'border-radius': addUnit(data.radius), + }, + data.radius ? 'overflow: hidden' : null, + ]); +} + +var FIT_MODE_MAP = { + none: 'center', + fill: 'scaleToFill', + cover: 'aspectFill', + contain: 'aspectFit', + widthFix: 'widthFix', + heightFix: 'heightFix', +}; + +function mode(fit) { + return FIT_MODE_MAP[fit]; +} + +module.exports = { + rootStyle: rootStyle, + mode: mode, +}; diff --git a/components/vant/image/index.wxss b/components/vant/image/index.wxss new file mode 100644 index 0000000..a9c6ebb --- /dev/null +++ b/components/vant/image/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-image{display:inline-block;position:relative}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important} \ No newline at end of file diff --git a/components/vant/info/index.d.ts b/components/vant/info/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/info/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/info/index.js b/components/vant/info/index.js new file mode 100644 index 0000000..6eac8f8 --- /dev/null +++ b/components/vant/info/index.js @@ -0,0 +1,8 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + dot: Boolean, + info: null, + customStyle: String, + }, +}); diff --git a/components/vant/info/index.json b/components/vant/info/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/info/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/info/index.wxml b/components/vant/info/index.wxml new file mode 100644 index 0000000..b39b524 --- /dev/null +++ b/components/vant/info/index.wxml @@ -0,0 +1,7 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + wx:if="{{ info !== null && info !== '' || dot }}" + class="van-info {{ utils.bem('info', { dot }) }} custom-class" + style="{{ customStyle }}" +>{{ dot ? '' : info }}</view> diff --git a/components/vant/info/index.wxss b/components/vant/info/index.wxss new file mode 100644 index 0000000..e77cdfb --- /dev/null +++ b/components/vant/info/index.wxss @@ -0,0 +1,30 @@ +@import '../common/index.wxss'; +.van-info { + align-items: center; + background-color: var(--info-background-color, #ee0a24); + border: var(--info-border-width, 1px) solid #fff; + border-radius: var(--info-size, 16px); + box-sizing: border-box; + color: var(--info-color, #fff); + display: inline-flex; + font-family: var(--info-font-family, -apple-system-font, Helvetica Neue, Arial, sans-serif); + font-size: var(--info-font-size, 12px); + font-weight: var(--info-font-weight, 500); + height: var(--info-size, 16px); + justify-content: center; + min-width: var(--info-size, 16px); + padding: var(--info-padding, 0 3px); + position: absolute; + right: 6px; + top: 0; + transform: translate(50%, -50%); + transform-origin: 100%; + white-space: nowrap; +} +.van-info--dot { + background-color: var(--info-dot-color, #ee0a24); + border-radius: 100%; + height: var(--info-dot-size, 8px); + min-width: 0; + width: var(--info-dot-size, 8px); +} diff --git a/components/vant/loading/index.d.ts b/components/vant/loading/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/loading/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/loading/index.js b/components/vant/loading/index.js new file mode 100644 index 0000000..f5f96ba --- /dev/null +++ b/components/vant/loading/index.js @@ -0,0 +1,16 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + color: String, + vertical: Boolean, + type: { + type: String, + value: 'circular', + }, + size: String, + textSize: String, + }, + data: { + array12: Array.from({ length: 12 }), + }, +}); diff --git a/components/vant/loading/index.json b/components/vant/loading/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/loading/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/loading/index.wxml b/components/vant/loading/index.wxml new file mode 100644 index 0000000..7d4a539 --- /dev/null +++ b/components/vant/loading/index.wxml @@ -0,0 +1,19 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class {{ utils.bem('loading', { vertical }) }}"> + <view + class="van-loading__spinner van-loading__spinner--{{ type }}" + style="{{ computed.spinnerStyle({ color, size }) }}" + > + <view + wx:if="{{ type === 'spinner' }}" + wx:for="{{ array12 }}" + wx:key="index" + class="van-loading__dot" + /> + </view> + <view class="van-loading__text" style="{{ computed.textStyle({ textSize }) }}"> + <slot /> + </view> +</view> diff --git a/components/vant/loading/index.wxs b/components/vant/loading/index.wxs new file mode 100644 index 0000000..02a0b80 --- /dev/null +++ b/components/vant/loading/index.wxs @@ -0,0 +1,22 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function spinnerStyle(data) { + return style({ + color: data.color, + width: addUnit(data.size), + height: addUnit(data.size), + }); +} + +function textStyle(data) { + return style({ + 'font-size': addUnit(data.textSize), + }); +} + +module.exports = { + spinnerStyle: spinnerStyle, + textStyle: textStyle, +}; diff --git a/components/vant/loading/index.wxss b/components/vant/loading/index.wxss new file mode 100644 index 0000000..fc84e84 --- /dev/null +++ b/components/vant/loading/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{align-items:center;color:var(--loading-spinner-color,#c8c9cc);display:inline-flex;justify-content:center}.van-loading__spinner{animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;box-sizing:border-box;height:var(--loading-spinner-size,30px);max-height:100%;max-width:100%;position:relative;width:var(--loading-spinner-size,30px)}.van-loading__spinner--spinner{animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-radius:100%;border-top-color:initial}.van-loading__text{color:var(--loading-text-color,#969799);font-size:var(--loading-text-font-size,14px);line-height:var(--loading-text-line-height,20px);margin-left:var(--padding-xs,8px)}.van-loading__text:empty{display:none}.van-loading--vertical{flex-direction:column}.van-loading--vertical .van-loading__text{margin:var(--padding-xs,8px) 0 0}.van-loading__dot{height:100%;left:0;position:absolute;top:0;width:100%}.van-loading__dot:before{background-color:currentColor;border-radius:40%;content:" ";display:block;height:25%;margin:0 auto;width:2px}.van-loading__dot:first-of-type{opacity:1;transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;transform:rotate(1turn)}@keyframes van-rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} \ No newline at end of file diff --git a/components/vant/mixins/basic.d.ts b/components/vant/mixins/basic.d.ts new file mode 100644 index 0000000..b273369 --- /dev/null +++ b/components/vant/mixins/basic.d.ts @@ -0,0 +1 @@ +export declare const basic: string; diff --git a/components/vant/mixins/basic.js b/components/vant/mixins/basic.js new file mode 100644 index 0000000..617cc07 --- /dev/null +++ b/components/vant/mixins/basic.js @@ -0,0 +1,11 @@ +export const basic = Behavior({ + methods: { + $emit(name, detail, options) { + this.triggerEvent(name, detail, options); + }, + set(data) { + this.setData(data); + return new Promise((resolve) => wx.nextTick(resolve)); + }, + }, +}); diff --git a/components/vant/mixins/button.d.ts b/components/vant/mixins/button.d.ts new file mode 100644 index 0000000..b51db87 --- /dev/null +++ b/components/vant/mixins/button.d.ts @@ -0,0 +1 @@ +export declare const button: string; diff --git a/components/vant/mixins/button.js b/components/vant/mixins/button.js new file mode 100644 index 0000000..ac1e569 --- /dev/null +++ b/components/vant/mixins/button.js @@ -0,0 +1,41 @@ +import { canIUseGetUserProfile } from '../common/version'; +export const button = Behavior({ + externalClasses: ['hover-class'], + properties: { + id: String, + lang: String, + businessId: Number, + sessionFrom: String, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean, + appParameter: String, + ariaLabel: String, + openType: String, + getUserProfileDesc: String, + }, + data: { + canIUseGetUserProfile: canIUseGetUserProfile(), + }, + methods: { + onGetUserInfo(event) { + this.triggerEvent('getuserinfo', event.detail); + }, + onContact(event) { + this.triggerEvent('contact', event.detail); + }, + onGetPhoneNumber(event) { + this.triggerEvent('getphonenumber', event.detail); + }, + onError(event) { + this.triggerEvent('error', event.detail); + }, + onLaunchApp(event) { + this.triggerEvent('launchapp', event.detail); + }, + onOpenSetting(event) { + this.triggerEvent('opensetting', event.detail); + }, + }, +}); diff --git a/components/vant/mixins/link.d.ts b/components/vant/mixins/link.d.ts new file mode 100644 index 0000000..d58043b --- /dev/null +++ b/components/vant/mixins/link.d.ts @@ -0,0 +1 @@ +export declare const link: string; diff --git a/components/vant/mixins/link.js b/components/vant/mixins/link.js new file mode 100644 index 0000000..8c274e1 --- /dev/null +++ b/components/vant/mixins/link.js @@ -0,0 +1,23 @@ +export const link = Behavior({ + properties: { + url: String, + linkType: { + type: String, + value: 'navigateTo', + }, + }, + methods: { + jumpLink(urlKey = 'url') { + const url = this.data[urlKey]; + if (url) { + if (this.data.linkType === 'navigateTo' && + getCurrentPages().length > 9) { + wx.redirectTo({ url }); + } + else { + wx[this.data.linkType]({ url }); + } + } + }, + }, +}); diff --git a/components/vant/mixins/page-scroll.d.ts b/components/vant/mixins/page-scroll.d.ts new file mode 100644 index 0000000..a316bb8 --- /dev/null +++ b/components/vant/mixins/page-scroll.d.ts @@ -0,0 +1,5 @@ +/// <reference types="miniprogram-api-typings" /> +declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption; +declare type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void; +export declare const pageScrollMixin: (scroller: Scroller) => string; +export {}; diff --git a/components/vant/mixins/page-scroll.js b/components/vant/mixins/page-scroll.js new file mode 100644 index 0000000..0a0a561 --- /dev/null +++ b/components/vant/mixins/page-scroll.js @@ -0,0 +1,36 @@ +import { getCurrentPage, isDef } from '../common/utils'; +function onPageScroll(event) { + const { vanPageScroller = [] } = getCurrentPage(); + vanPageScroller.forEach((scroller) => { + if (typeof scroller === 'function') { + // @ts-ignore + scroller(event); + } + }); +} +export const pageScrollMixin = (scroller) => Behavior({ + attached() { + const page = getCurrentPage(); + if (!isDef(page)) { + return; + } + if (Array.isArray(page.vanPageScroller)) { + page.vanPageScroller.push(scroller.bind(this)); + } + else { + page.vanPageScroller = + typeof page.onPageScroll === 'function' + ? [page.onPageScroll.bind(page), scroller.bind(this)] + : [scroller.bind(this)]; + } + page.onPageScroll = onPageScroll; + }, + detached() { + var _a; + const page = getCurrentPage(); + if (isDef(page)) { + page.vanPageScroller = + ((_a = page.vanPageScroller) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== scroller)) || []; + } + }, +}); diff --git a/components/vant/mixins/touch.d.ts b/components/vant/mixins/touch.d.ts new file mode 100644 index 0000000..35ee831 --- /dev/null +++ b/components/vant/mixins/touch.d.ts @@ -0,0 +1 @@ +export declare const touch: string; diff --git a/components/vant/mixins/touch.js b/components/vant/mixins/touch.js new file mode 100644 index 0000000..ecefae8 --- /dev/null +++ b/components/vant/mixins/touch.js @@ -0,0 +1,37 @@ +// @ts-nocheck +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/components/vant/mixins/transition.d.ts b/components/vant/mixins/transition.d.ts new file mode 100644 index 0000000..dd829e5 --- /dev/null +++ b/components/vant/mixins/transition.d.ts @@ -0,0 +1 @@ +export declare function transition(showDefaultValue: boolean): string; diff --git a/components/vant/mixins/transition.js b/components/vant/mixins/transition.js new file mode 100644 index 0000000..bc7fc8e --- /dev/null +++ b/components/vant/mixins/transition.js @@ -0,0 +1,115 @@ +// @ts-nocheck +import { requestAnimationFrame } from '../common/utils'; +import { isObj } from '../common/validator'; +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`, +}); +export function transition(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, + }, + ready() { + if (this.data.show === true) { + this.observeShow(true, false); + } + }, + methods: { + observeShow(value, old) { + if (value === old) { + return; + } + 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'); + requestAnimationFrame(() => { + if (this.status !== 'enter') { + return; + } + this.$emit('enter'); + this.setData({ + inited: true, + display: true, + classes: classNames.enter, + currentDuration, + }); + requestAnimationFrame(() => { + if (this.status !== 'enter') { + return; + } + this.transitionEnded = false; + this.setData({ classes: classNames['enter-to'] }); + }); + }); + }, + 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'); + requestAnimationFrame(() => { + if (this.status !== 'leave') { + return; + } + this.$emit('leave'); + this.setData({ + classes: classNames.leave, + currentDuration, + }); + requestAnimationFrame(() => { + if (this.status !== 'leave') { + return; + } + this.transitionEnded = false; + setTimeout(() => this.onTransitionEnd(), currentDuration); + this.setData({ classes: classNames['leave-to'] }); + }); + }); + }, + 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/components/vant/overlay/index.d.ts b/components/vant/overlay/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/overlay/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/overlay/index.js b/components/vant/overlay/index.js new file mode 100644 index 0000000..48117a0 --- /dev/null +++ b/components/vant/overlay/index.js @@ -0,0 +1,26 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + show: Boolean, + customStyle: String, + duration: { + type: null, + value: 300, + }, + zIndex: { + type: Number, + value: 1, + }, + lockScroll: { + type: Boolean, + value: true, + }, + }, + methods: { + onClick() { + this.$emit('click'); + }, + // for prevent touchmove + noop() { }, + }, +}); diff --git a/components/vant/overlay/index.json b/components/vant/overlay/index.json new file mode 100644 index 0000000..c14a65f --- /dev/null +++ b/components/vant/overlay/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-transition": "../transition/index" + } +} diff --git a/components/vant/overlay/index.wxml b/components/vant/overlay/index.wxml new file mode 100644 index 0000000..92734a0 --- /dev/null +++ b/components/vant/overlay/index.wxml @@ -0,0 +1,21 @@ +<van-transition + wx:if="{{ lockScroll }}" + show="{{ show }}" + custom-class="van-overlay" + custom-style="z-index: {{ zIndex }}; {{ customStyle }}" + duration="{{ duration }}" + bind:tap="onClick" + catch:touchmove="noop" +> + <slot></slot> +</van-transition> +<van-transition + wx:else + show="{{ show }}" + custom-class="van-overlay" + custom-style="z-index: {{ zIndex }}; {{ customStyle }}" + duration="{{ duration }}" + bind:tap="onClick" +> + <slot></slot> +</van-transition> diff --git a/components/vant/overlay/index.wxss b/components/vant/overlay/index.wxss new file mode 100644 index 0000000..d1ad81a --- /dev/null +++ b/components/vant/overlay/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-overlay{background-color:var(--overlay-background-color,rgba(0,0,0,.7));height:100%;left:0;position:fixed;top:0;width:100%} \ No newline at end of file diff --git a/components/vant/picker-column/index.d.ts b/components/vant/picker-column/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/picker-column/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/picker-column/index.js b/components/vant/picker-column/index.js new file mode 100644 index 0000000..abcc520 --- /dev/null +++ b/components/vant/picker-column/index.js @@ -0,0 +1,118 @@ +import { VantComponent } from '../common/component'; +import { range } from '../common/utils'; +import { isObj } from '../common/validator'; +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, + observer(value) { + this.setIndex(value); + }, + }, + }, + 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); + }); + }, + 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/components/vant/picker-column/index.json b/components/vant/picker-column/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/picker-column/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/picker-column/index.wxml b/components/vant/picker-column/index.wxml new file mode 100644 index 0000000..f2c8da2 --- /dev/null +++ b/components/vant/picker-column/index.wxml @@ -0,0 +1,23 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="van-picker-column custom-class" + style="{{ computed.rootStyle({ itemHeight, visibleItemCount }) }}" + bind:touchstart="onTouchStart" + catch:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" +> + <view style="{{ computed.wrapperStyle({ offset, itemHeight, visibleItemCount, duration }) }}"> + <view + wx:for="{{ options }}" + wx:for-item="option" + wx:key="index" + data-index="{{ index }}" + style="height: {{ itemHeight }}px" + class="van-ellipsis {{ utils.bem('picker-column__item', { disabled: option && option.disabled, selected: index === currentIndex }) }} {{ index === currentIndex ? 'active-class' : '' }}" + bindtap="onClickItem" + >{{ computed.optionText(option, valueKey) }}</view> + </view> +</view> diff --git a/components/vant/picker-column/index.wxs b/components/vant/picker-column/index.wxs new file mode 100644 index 0000000..2d5a611 --- /dev/null +++ b/components/vant/picker-column/index.wxs @@ -0,0 +1,36 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function isObj(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} + +function optionText(option, valueKey) { + return isObj(option) && option[valueKey] != null ? option[valueKey] : option; +} + +function rootStyle(data) { + return style({ + height: addUnit(data.itemHeight * data.visibleItemCount), + }); +} + +function wrapperStyle(data) { + var offset = addUnit( + data.offset + (data.itemHeight * (data.visibleItemCount - 1)) / 2 + ); + + return style({ + transition: 'transform ' + data.duration + 'ms', + 'line-height': addUnit(data.itemHeight), + transform: 'translate3d(0, ' + offset + ', 0)', + }); +} + +module.exports = { + optionText: optionText, + rootStyle: rootStyle, + wrapperStyle: wrapperStyle, +}; diff --git a/components/vant/picker-column/index.wxss b/components/vant/picker-column/index.wxss new file mode 100644 index 0000000..519a438 --- /dev/null +++ b/components/vant/picker-column/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-picker-column{color:var(--picker-option-text-color,#000);font-size:var(--picker-option-font-size,16px);overflow:hidden;text-align:center}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{color:var(--picker-option-selected-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-picker-column__item--disabled{opacity:var(--picker-option-disabled-opacity,.3)} \ No newline at end of file diff --git a/components/vant/picker/index.d.ts b/components/vant/picker/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/picker/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/picker/index.js b/components/vant/picker/index.js new file mode 100644 index 0000000..cef057d --- /dev/null +++ b/components/vant/picker/index.js @@ -0,0 +1,136 @@ +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; + if (Array.isArray(this.children) && this.children.length) { + this.setColumns().catch(() => { }); + } + }, + } }), + beforeCreate() { + Object.defineProperty(this, 'children', { + get: () => this.selectAllComponents('.van-picker__column') || [], + }); + }, + 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/components/vant/picker/index.json b/components/vant/picker/index.json new file mode 100644 index 0000000..2fcec89 --- /dev/null +++ b/components/vant/picker/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "picker-column": "../picker-column/index", + "loading": "../loading/index" + } +} diff --git a/components/vant/picker/index.wxml b/components/vant/picker/index.wxml new file mode 100644 index 0000000..8564ccc --- /dev/null +++ b/components/vant/picker/index.wxml @@ -0,0 +1,37 @@ +<wxs src="./index.wxs" module="computed" /> + +<view class="van-picker custom-class"> + <include wx:if="{{ toolbarPosition === 'top' }}" src="./toolbar.wxml" /> + + <view wx:if="{{ loading }}" class="van-picker__loading"> + <loading color="#1989fa"/> + </view> + + <view + class="van-picker__columns" + style="{{ computed.columnsStyle({ itemHeight, visibleItemCount }) }}" + catch:touchmove="noop" + > + <picker-column + class="van-picker__column" + wx:for="{{ computed.columns(columns) }}" + wx:key="index" + data-index="{{ index }}" + custom-class="column-class" + value-key="{{ valueKey }}" + initial-options="{{ item.values }}" + default-index="{{ item.defaultIndex || defaultIndex }}" + item-height="{{ itemHeight }}" + visible-item-count="{{ visibleItemCount }}" + active-class="active-class" + bind:change="onChange" + /> + <view class="van-picker__mask" style="{{ computed.maskStyle({ itemHeight, visibleItemCount }) }}" /> + <view + class="van-picker__frame van-hairline--top-bottom" + style="{{ computed.frameStyle({ itemHeight }) }}" + /> + </view> + + <include wx:if="{{ toolbarPosition === 'bottom' }}" src="./toolbar.wxml" /> +</view> diff --git a/components/vant/picker/index.wxs b/components/vant/picker/index.wxs new file mode 100644 index 0000000..0abbd10 --- /dev/null +++ b/components/vant/picker/index.wxs @@ -0,0 +1,42 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); +var array = require('../wxs/array.wxs'); + +function columnsStyle(data) { + return style({ + height: addUnit(data.itemHeight * data.visibleItemCount), + }); +} + +function maskStyle(data) { + return style({ + 'background-size': + '100% ' + addUnit((data.itemHeight * (data.visibleItemCount - 1)) / 2), + }); +} + +function frameStyle(data) { + return style({ + height: addUnit(data.itemHeight), + }); +} + +function columns(columns) { + if (!array.isArray(columns)) { + return []; + } + + if (columns.length && !columns[0].values) { + return [{ values: columns }]; + } + + return columns; +} + +module.exports = { + columnsStyle: columnsStyle, + frameStyle: frameStyle, + maskStyle: maskStyle, + columns: columns, +}; diff --git a/components/vant/picker/index.wxss b/components/vant/picker/index.wxss new file mode 100644 index 0000000..d924abb --- /dev/null +++ b/components/vant/picker/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-picker{-webkit-text-size-adjust:100%;background-color:var(--picker-background-color,#fff);overflow:hidden;position:relative;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:flex;height:var(--picker-toolbar-height,44px);justify-content:space-between;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{font-size:var(--picker-action-font-size,14px);padding:var(--picker-action-padding,0 16px)}.van-picker__cancel--hover,.van-picker__confirm--hover{opacity:.7}.van-picker__confirm{color:var(--picker-confirm-action-color,#576b95)}.van-picker__cancel{color:var(--picker-cancel-action-color,#969799)}.van-picker__title{font-size:var(--picker-option-font-size,16px);font-weight:var(--font-weight-bold,500);max-width:50%;text-align:center}.van-picker__columns{display:flex;position:relative}.van-picker__column{flex:1 1;width:0}.van-picker__loading{align-items:center;background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9));bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:4}.van-picker__mask{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-position:top,bottom;background-repeat:no-repeat;height:100%;left:0;top:0;width:100%;z-index:2}.van-picker__frame,.van-picker__mask{pointer-events:none;position:absolute}.van-picker__frame{left:16px;right:16px;top:50%;transform:translateY(-50%);z-index:1} \ No newline at end of file diff --git a/components/vant/picker/shared.d.ts b/components/vant/picker/shared.d.ts new file mode 100644 index 0000000..c548045 --- /dev/null +++ b/components/vant/picker/shared.d.ts @@ -0,0 +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; + }; +}; diff --git a/components/vant/picker/shared.js b/components/vant/picker/shared.js new file mode 100644 index 0000000..5f21f32 --- /dev/null +++ b/components/vant/picker/shared.js @@ -0,0 +1,21 @@ +export const pickerProps = { + title: String, + loading: Boolean, + showToolbar: Boolean, + cancelButtonText: { + type: String, + value: '取消', + }, + confirmButtonText: { + type: String, + value: '确认', + }, + visibleItemCount: { + type: Number, + value: 6, + }, + itemHeight: { + type: Number, + value: 44, + }, +}; diff --git a/components/vant/picker/toolbar.wxml b/components/vant/picker/toolbar.wxml new file mode 100644 index 0000000..414f612 --- /dev/null +++ b/components/vant/picker/toolbar.wxml @@ -0,0 +1,23 @@ +<view wx:if="{{ showToolbar }}" class="van-picker__toolbar toolbar-class"> + <view + class="van-picker__cancel" + hover-class="van-picker__cancel--hover" + hover-stay-time="70" + data-type="cancel" + bindtap="emit" + > + {{ cancelButtonText }} + </view> + <view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ + title + }}</view> + <view + class="van-picker__confirm" + hover-class="van-picker__confirm--hover" + hover-stay-time="70" + data-type="confirm" + bindtap="emit" + > + {{ confirmButtonText }} + </view> +</view> diff --git a/components/vant/popup/index.d.ts b/components/vant/popup/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/popup/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/popup/index.js b/components/vant/popup/index.js new file mode 100644 index 0000000..a83ccaa --- /dev/null +++ b/components/vant/popup/index.js @@ -0,0 +1,81 @@ +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', 'close-icon-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', + }, + title: String, + 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, + }, + lockScroll: { + type: Boolean, + value: true, + }, + }, + created() { + this.observeClass(); + }, + methods: { + onClickCloseIcon() { + this.$emit('close'); + }, + onClickOverlay() { + this.$emit('click-overlay'); + if (this.data.closeOnClickOverlay) { + this.$emit('close'); + } + }, + observeClass() { + const { transition, position, duration } = this.data; + const updateData = { + name: transition || position, + }; + if (transition === 'none') { + updateData.duration = 0; + this.originDuration = duration; + } else if (this.originDuration != null) { + updateData.duration = this.originDuration; + } + this.setData(updateData); + }, + }, +}); diff --git a/components/vant/popup/index.json b/components/vant/popup/index.json new file mode 100644 index 0000000..88a6eab --- /dev/null +++ b/components/vant/popup/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-overlay": "../overlay/index" + } +} diff --git a/components/vant/popup/index.wxml b/components/vant/popup/index.wxml new file mode 100644 index 0000000..f39b33b --- /dev/null +++ b/components/vant/popup/index.wxml @@ -0,0 +1,39 @@ +<wxs module="utils" src="../wxs/utils.wxs" /> +<wxs module="computed" src="./index.wxs" /> + +<van-overlay + bind:click="onClickOverlay" + custom-style="{{ overlayStyle }}" + duration="{{ duration }}" + lock-scroll="{{ lockScroll }}" + show="{{ show }}" + wx:if="{{ overlay }}" + z-index="{{ zIndex }}" +/> +<view + bind:transitionend="onTransitionEnd" + class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}" + style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}" + wx:if="{{ inited }}" +> + <block wx:if="{{ position === 'bottom' }}"> + <view class="van-popup__header"> + <view wx:if="{{ !!title }}">{{ title }}</view> + <van-icon bind:tap="onClickCloseIcon" class="close-icon-class" name="{{ closeIcon }}" wx:if="{{ closeable }}" /> + </view> + <slot /> + </block> + <block wx:else> + <slot /> + <van-icon + bind:tap="onClickCloseIcon" + class="close-icon-class van-popup__close-icon van-popup__close-icon--{{ closeIconPosition }}" + name="{{ closeIcon }}" + wx:if="{{ closeable }}" + /> + </block> +</view> + +<view style="display:none" wx:else> + <slot /> +</view> diff --git a/components/vant/popup/index.wxs b/components/vant/popup/index.wxs new file mode 100644 index 0000000..8d59f24 --- /dev/null +++ b/components/vant/popup/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function popupStyle(data) { + return style([ + { + 'z-index': data.zIndex, + '-webkit-transition-duration': data.currentDuration + 'ms', + 'transition-duration': data.currentDuration + 'ms', + }, + data.display ? null : 'display: none', + data.customStyle, + ]); +} + +module.exports = { + popupStyle: popupStyle, +}; diff --git a/components/vant/popup/index.wxss b/components/vant/popup/index.wxss new file mode 100644 index 0000000..305874b --- /dev/null +++ b/components/vant/popup/index.wxss @@ -0,0 +1,151 @@ +@import '../common/index.wxss'; +.van-popup { + -webkit-overflow-scrolling: touch; + animation: ease both; + background-color: var(--popup-background-color, #fff); + box-sizing: border-box; + max-height: 100%; + overflow-y: auto; + position: fixed; + transition-timing-function: ease; +} +.van-popup--center { + left: 50%; + top: 50%; + transform: translate3d(-50%, -50%, 0); +} +.van-popup--center.van-popup--round { + border-radius: var(--popup-round-border-radius, 16px); +} +.van-popup--top { + left: 0; + top: 0; + width: 100%; +} +.van-popup--top.van-popup--round { + border-radius: 0 0 var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)) + var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)); +} +.van-popup--right { + right: 0; + top: 50%; + transform: translate3d(0, -50%, 0); +} +.van-popup--right.van-popup--round { + border-radius: var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)) 0 0 + var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)); +} +.van-popup--bottom { + bottom: 0; + left: 0; + width: 100%; +} +.van-popup--bottom.van-popup--round { + border-radius: var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)) + var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)) 0 0; +} +.van-popup--left { + left: 0; + top: 50%; + transform: translate3d(0, -50%, 0); +} +.van-popup--left.van-popup--round { + border-radius: 0 var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)) + var(--popup-round-border-radius, var(--popup-round-border-radius, 16px)) 0; +} +.van-popup--bottom.van-popup--safe { + padding-bottom: env(safe-area-inset-bottom); +} +.van-popup--safeTop { + padding-top: env(safe-area-inset-top); +} +.van-popup__close-icon { + color: var(--popup-close-icon-color, #969799); + font-size: var(--popup-close-icon-size, 18px); + position: absolute; + z-index: var(--popup-close-icon-z-index, 1); +} +.van-popup__close-icon--top-left { + left: var(--popup-close-icon-margin, 16px); + top: var(--popup-close-icon-margin, 16px); +} +.van-popup__close-icon--top-right { + right: var(--popup-close-icon-margin, 16px); + top: var(--popup-close-icon-margin, 16px); +} +.van-popup__close-icon--bottom-left { + bottom: var(--popup-close-icon-margin, 16px); + left: var(--popup-close-icon-margin, 16px); +} +.van-popup__close-icon--bottom-right { + bottom: var(--popup-close-icon-margin, 16px); + right: var(--popup-close-icon-margin, 16px); +} +.van-popup__close-icon:active { + opacity: 0.6; +} +.van-scale-enter-active, +.van-scale-leave-active { + transition-property: opacity, transform; +} +.van-scale-enter, +.van-scale-leave-to { + opacity: 0; + transform: translate3d(-50%, -50%, 0) scale(0.7); +} +.van-fade-enter-active, +.van-fade-leave-active { + transition-property: opacity; +} +.van-fade-enter, +.van-fade-leave-to { + opacity: 0; +} +.van-center-enter-active, +.van-center-leave-active { + transition-property: opacity; +} +.van-center-enter, +.van-center-leave-to { + opacity: 0; +} +.van-bottom-enter-active, +.van-bottom-leave-active, +.van-left-enter-active, +.van-left-leave-active, +.van-right-enter-active, +.van-right-leave-active, +.van-top-enter-active, +.van-top-leave-active { + transition-property: transform; +} +.van-bottom-enter, +.van-bottom-leave-to { + transform: translate3d(0, 100%, 0); +} +.van-top-enter, +.van-top-leave-to { + transform: translate3d(0, -100%, 0); +} +.van-left-enter, +.van-left-leave-to { + transform: translate3d(-100%, -50%, 0); +} +.van-right-enter, +.van-right-leave-to { + transform: translate3d(100%, -50%, 0); +} +.van-popup__header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 24rpx 32rpx 0; + font-weight: 600; + font-size: 32rpx; + line-height: 48rpx; + z-index: 999; +} +.van-popup__main { + margin-top: 96rpx; + position: relative; +} diff --git a/components/vant/radio-group/index.d.ts b/components/vant/radio-group/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/radio-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/radio-group/index.js b/components/vant/radio-group/index.js new file mode 100644 index 0000000..ddb2a60 --- /dev/null +++ b/components/vant/radio-group/index.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useChildren)('radio'), + props: { + value: { + type: null, + observer: 'updateChildren', + }, + direction: String, + disabled: { + type: Boolean, + observer: 'updateChildren', + }, + }, + methods: { + updateChildren: function () { + this.children.forEach(function (child) { return child.updateFromParent(); }); + }, + }, +}); diff --git a/components/vant/radio-group/index.json b/components/vant/radio-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/radio-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/radio-group/index.wxml b/components/vant/radio-group/index.wxml new file mode 100644 index 0000000..0ab17af --- /dev/null +++ b/components/vant/radio-group/index.wxml @@ -0,0 +1,5 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="{{ utils.bem('radio-group', [direction]) }}"> + <slot></slot> +</view> diff --git a/components/vant/radio-group/index.wxss b/components/vant/radio-group/index.wxss new file mode 100644 index 0000000..4e3b5d4 --- /dev/null +++ b/components/vant/radio-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-radio-group--horizontal{display:flex;flex-wrap:wrap} \ No newline at end of file diff --git a/components/vant/radio/index.d.ts b/components/vant/radio/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/radio/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/radio/index.js b/components/vant/radio/index.js new file mode 100644 index 0000000..61a86d5 --- /dev/null +++ b/components/vant/radio/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var version_1 = require("../common/version"); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useParent)('radio-group', function () { + this.updateFromParent(); + }), + classes: ['icon-class', 'label-class'], + props: { + name: null, + value: null, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right', + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round', + }, + iconSize: { + type: null, + value: 20, + }, + }, + data: { + direction: '', + parentDisabled: false, + }, + methods: { + updateFromParent: function () { + if (!this.parent) { + return; + } + var _a = this.parent.data, value = _a.value, parentDisabled = _a.disabled, direction = _a.direction; + this.setData({ + value: value, + direction: direction, + parentDisabled: parentDisabled, + }); + }, + emitChange: function (value) { + var instance = this.parent || this; + instance.$emit('input', value); + instance.$emit('change', value); + if ((0, version_1.canIUseModel)()) { + instance.setData({ value: value }); + } + }, + onChange: function () { + if (!this.data.disabled && !this.data.parentDisabled) { + this.emitChange(this.data.name); + } + }, + onClickLabel: function () { + var _a = this.data, disabled = _a.disabled, parentDisabled = _a.parentDisabled, labelDisabled = _a.labelDisabled, name = _a.name; + if (!(disabled || parentDisabled) && !labelDisabled) { + this.emitChange(name); + } + }, + }, +}); diff --git a/components/vant/radio/index.json b/components/vant/radio/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/components/vant/radio/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/components/vant/radio/index.wxml b/components/vant/radio/index.wxml new file mode 100644 index 0000000..5f898c0 --- /dev/null +++ b/components/vant/radio/index.wxml @@ -0,0 +1,30 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="{{ utils.bem('radio', [direction]) }} custom-class"> + <view + wx:if="{{ labelPosition === 'left' }}" + class="{{ utils.bem('radio__label', [labelPosition, { disabled: disabled || parentDisabled }]) }} label-class" + bindtap="onClickLabel" + > + <slot /> + </view> + <view class="van-radio__icon-wrap" style="font-size: {{ utils.addUnit(iconSize) }}" bindtap="onChange"> + <slot wx:if="{{ useIconSlot }}" name="icon" /> + <van-icon + wx:else + name="success" + class="{{ utils.bem('radio__icon', [shape, { disabled: disabled || parentDisabled, checked: value === name }]) }}" + style="{{ computed.iconStyle({ iconSize, checkedColor, disabled, parentDisabled, value, name }) }}" + custom-class="icon-class" + custom-style="{{ computed.iconCustomStyle({ iconSize }) }}" + /> + </view> + <view + wx:if="{{ labelPosition === 'right' }}" + class="label-class {{ utils.bem('radio__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" + bindtap="onClickLabel" + > + <slot /> + </view> +</view> diff --git a/components/vant/radio/index.wxs b/components/vant/radio/index.wxs new file mode 100644 index 0000000..a428aad --- /dev/null +++ b/components/vant/radio/index.wxs @@ -0,0 +1,33 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function iconStyle(data) { + var styles = { + 'font-size': addUnit(data.iconSize), + }; + + if ( + data.checkedColor && + !(data.disabled || data.parentDisabled) && + data.value === data.name + ) { + styles['border-color'] = data.checkedColor; + styles['background-color'] = data.checkedColor; + } + + return style(styles); +} + +function iconCustomStyle(data) { + return style({ + 'line-height': addUnit(data.iconSize), + 'font-size': '.8em', + display: 'block', + }); +} + +module.exports = { + iconStyle: iconStyle, + iconCustomStyle: iconCustomStyle, +}; diff --git a/components/vant/radio/index.wxss b/components/vant/radio/index.wxss new file mode 100644 index 0000000..257b0c7 --- /dev/null +++ b/components/vant/radio/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-radio{align-items:center;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-radio__icon-wrap{flex:none}.van-radio--horizontal{margin-right:var(--padding-sm,12px)}.van-radio__icon{align-items:center;border:1px solid var(--radio-border-color,#c8c9cc);box-sizing:border-box;color:transparent;display:flex;font-size:var(--radio-size,20px);height:1em;justify-content:center;text-align:center;transition-duration:var(--radio-transition-duration,.2s);transition-property:color,border-color,background-color;width:1em}.van-radio__icon--round{border-radius:100%}.van-radio__icon--checked{background-color:var(--radio-checked-icon-color,#1989fa);border-color:var(--radio-checked-icon-color,#1989fa);color:#fff}.van-radio__icon--disabled{background-color:var(--radio-disabled-background-color,#ebedf0);border-color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__icon--disabled.van-radio__icon--checked{color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__label{word-wrap:break-word;color:var(--radio-label-color,#323233);line-height:var(--radio-size,20px);padding-left:var(--radio-label-margin,10px)}.van-radio__label--left{float:left;margin:0 var(--radio-label-margin,10px) 0 0}.van-radio__label--disabled{color:var(--radio-disabled-label-color,#c8c9cc)}.van-radio__label:empty{margin:0} \ No newline at end of file diff --git a/components/vant/rate/index.d.ts b/components/vant/rate/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/rate/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/rate/index.js b/components/vant/rate/index.js new file mode 100644 index 0000000..30a96de --- /dev/null +++ b/components/vant/rate/index.js @@ -0,0 +1,93 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = require("../common/utils"); +var component_1 = require("../common/component"); +var version_1 = require("../common/version"); +(0, component_1.VantComponent)({ + field: true, + classes: ['icon-class'], + props: { + value: { + type: Number, + observer: function (value) { + if (value !== this.data.innerValue) { + this.setData({ innerValue: value }); + } + }, + }, + readonly: Boolean, + disabled: Boolean, + allowHalf: Boolean, + size: null, + icon: { + type: String, + value: 'star', + }, + voidIcon: { + type: String, + value: 'star-o', + }, + color: String, + voidColor: String, + disabledColor: String, + count: { + type: Number, + value: 5, + observer: function (value) { + this.setData({ innerCountArray: Array.from({ length: value }) }); + }, + }, + gutter: null, + touchable: { + type: Boolean, + value: true, + }, + }, + data: { + innerValue: 0, + innerCountArray: Array.from({ length: 5 }), + }, + methods: { + onSelect: function (event) { + var _this = this; + var data = this.data; + var score = event.currentTarget.dataset.score; + if (!data.disabled && !data.readonly) { + this.setData({ innerValue: score + 1 }); + if ((0, version_1.canIUseModel)()) { + this.setData({ value: score + 1 }); + } + wx.nextTick(function () { + _this.$emit('input', score + 1); + _this.$emit('change', score + 1); + }); + } + }, + onTouchMove: function (event) { + var _this = this; + var touchable = this.data.touchable; + if (!touchable) + return; + var clientX = event.touches[0].clientX; + (0, utils_1.getAllRect)(this, '.van-rate__icon').then(function (list) { + var target = list + .sort(function (cur, next) { return cur.dataset.score - next.dataset.score; }) + .find(function (item) { return clientX >= item.left && clientX <= item.right; }); + if (target != null) { + _this.onSelect(__assign(__assign({}, event), { currentTarget: target })); + } + }); + }, + }, +}); diff --git a/components/vant/rate/index.json b/components/vant/rate/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/components/vant/rate/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/components/vant/rate/index.wxml b/components/vant/rate/index.wxml new file mode 100644 index 0000000..049714c --- /dev/null +++ b/components/vant/rate/index.wxml @@ -0,0 +1,35 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="../wxs/style.wxs" module="style" /> + +<view + class="{{ utils.bem('rate') }} custom-class" + bind:touchmove="onTouchMove" +> + <view + class="{{ utils.bem('rate__item') }}" + wx:for="{{ innerCountArray }}" + wx:key="index" + style="{{ style({ paddingRight: index !== count - 1 ? utils.addUnit(gutter) : null }) }}" + > + <van-icon + name="{{ index + 1 <= innerValue ? icon : voidIcon }}" + class="{{ utils.bem('rate__icon', [{ disabled, full: index + 1 <= innerValue }])}}" + style="{{ style({ fontSize: utils.addUnit(size) }) }}" + custom-class="icon-class" + data-score="{{ index }}" + color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}" + bind:click="onSelect" + /> + + <van-icon + wx:if="{{ allowHalf }}" + name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}" + class="{{ utils.bem('rate__icon', ['half', { disabled, full: index + 0.5 <= innerValue }]) }}" + style="{{ style({ fontSize: utils.addUnit(size) }) }}" + custom-class="icon-class" + data-score="{{ index - 0.5 }}" + color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}" + bind:click="onSelect" + /> + </view> +</view> diff --git a/components/vant/rate/index.wxss b/components/vant/rate/index.wxss new file mode 100644 index 0000000..e2a517e --- /dev/null +++ b/components/vant/rate/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-rate{display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{padding:0 var(--rate-horizontal-padding,2px);position:relative}.van-rate__item:not(:last-child){padding-right:var(--rate-icon-gutter,4px)}.van-rate__icon{color:var(--rate-icon-void-color,#c8c9cc);display:block;font-size:var(--rate-icon-size,20px);height:1em}.van-rate__icon--half{left:var(--rate-horizontal-padding,2px);overflow:hidden;position:absolute;top:0;width:.5em}.van-rate__icon--full,.van-rate__icon--half{color:var(--rate-icon-full-color,#ee0a24)}.van-rate__icon--disabled{color:var(--rate-icon-disabled-color,#c8c9cc)} \ No newline at end of file diff --git a/components/vant/row/index.d.ts b/components/vant/row/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/row/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/row/index.js b/components/vant/row/index.js new file mode 100644 index 0000000..cc844f8 --- /dev/null +++ b/components/vant/row/index.js @@ -0,0 +1,23 @@ +import { VantComponent } from '../common/component'; +import { useChildren } from '../common/relation'; +VantComponent({ + relation: useChildren('col', function (target) { + const { gutter } = this.data; + if (gutter) { + target.setData({ gutter }); + } + }), + props: { + gutter: { + type: Number, + observer: 'setGutter', + }, + }, + methods: { + setGutter() { + this.children.forEach((col) => { + col.setData(this.data); + }); + }, + }, +}); diff --git a/components/vant/row/index.json b/components/vant/row/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/row/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/row/index.wxml b/components/vant/row/index.wxml new file mode 100644 index 0000000..69a4359 --- /dev/null +++ b/components/vant/row/index.wxml @@ -0,0 +1,5 @@ +<wxs src="./index.wxs" module="computed" /> + +<view class="van-row custom-class" style="{{ computed.rootStyle({ gutter }) }}"> + <slot /> +</view> diff --git a/components/vant/row/index.wxs b/components/vant/row/index.wxs new file mode 100644 index 0000000..f5c5958 --- /dev/null +++ b/components/vant/row/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + if (!data.gutter) { + return ''; + } + + return style({ + 'margin-right': addUnit(-data.gutter / 2), + 'margin-left': addUnit(-data.gutter / 2), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/components/vant/row/index.wxss b/components/vant/row/index.wxss new file mode 100644 index 0000000..bb8946b --- /dev/null +++ b/components/vant/row/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-row:after{clear:both;content:"";display:table} \ No newline at end of file diff --git a/components/vant/search/index.d.ts b/components/vant/search/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/search/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/search/index.js b/components/vant/search/index.js new file mode 100644 index 0000000..d6f4bfa --- /dev/null +++ b/components/vant/search/index.js @@ -0,0 +1,89 @@ +import { VantComponent } from '../common/component'; +import { canIUseModel } from '../common/version'; +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, + }, + clearTrigger: { + type: String, + value: 'focus', + }, + clearIcon: { + type: String, + value: 'clear', + }, + }, + methods: { + onChange(event) { + if (canIUseModel()) { + this.setData({ value: event.detail }); + } + this.$emit('change', event.detail); + }, + onCancel() { + /** + * 修复修改输入框值时,输入框失焦和赋值同时触发,赋值失效 + * https://github.com/youzan/@vant/weapp/issues/1768 + */ + setTimeout(() => { + if (canIUseModel()) { + this.setData({ value: '' }); + } + this.$emit('cancel'); + this.$emit('change', ''); + }, 200); + }, + onSearch(event) { + this.$emit('search', event.detail); + }, + onFocus(event) { + this.$emit('focus', event.detail); + }, + onBlur(event) { + this.$emit('blur', event.detail); + }, + onClear(event) { + this.$emit('clear', event.detail); + }, + onClickInput(event) { + this.$emit('click-input', event.detail); + }, + }, +}); diff --git a/components/vant/search/index.json b/components/vant/search/index.json new file mode 100644 index 0000000..b4cfe91 --- /dev/null +++ b/components/vant/search/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-field": "../field/index" + } +} diff --git a/components/vant/search/index.wxml b/components/vant/search/index.wxml new file mode 100644 index 0000000..8800070 --- /dev/null +++ b/components/vant/search/index.wxml @@ -0,0 +1,53 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ utils.bem('search', { withaction: showAction || useActionSlot }) }} custom-class" + style="background: {{ background }}" +> + <view class="{{ utils.bem('search__content', [shape]) }}"> + <view class="van-search__label" wx:if="{{ label }}">{{ label }}</view> + <slot wx:else name="label" /> + + <van-field + type="search" + left-icon="{{ !useLeftIconSlot ? leftIcon : '' }}" + right-icon="{{ !useRightIconSlot ? rightIcon : '' }}" + focus="{{ focus }}" + error="{{ error }}" + border="{{ false }}" + confirm-type="search" + class="van-search__field field-class" + value="{{ value || '' }}" + disabled="{{ disabled }}" + readonly="{{ readonly }}" + clearable="{{ clearable }}" + clear-trigger="{{ clearTrigger }}" + clear-icon="{{ clearIcon }}" + maxlength="{{ maxlength }}" + input-align="{{ inputAlign }}" + input-class="input-class" + placeholder="{{ placeholder }}" + placeholder-style="{{ placeholderStyle }}" + custom-style="padding: 5px 10px 5px 0; background-color: transparent;" + bind:blur="onBlur" + bind:focus="onFocus" + bind:change="onChange" + bind:confirm="onSearch" + bind:clear="onClear" + bind:click-input="onClickInput" + > + <slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" /> + <slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" /> + </van-field> + </view> + + <view + wx:if="{{ showAction || useActionSlot }}" + class="van-search__action" + hover-class="van-search__action--hover" + hover-stay-time="70" + > + <slot wx:if="{{ useActionSlot }}" name="action" /> + <view wx:else bind:tap="onCancel" class="cancel-class">{{ actionText }}</view> + </view> +</view> diff --git a/components/vant/search/index.wxss b/components/vant/search/index.wxss new file mode 100644 index 0000000..212f7aa --- /dev/null +++ b/components/vant/search/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-search{align-items:center;box-sizing:border-box;display:flex;padding:var(--search-padding,10px 12px)}.van-search__content{background-color:var(--search-background-color,#f7f8fa);border-radius:2px;display:flex;flex:1;padding-left:var(--padding-sm,12px)}.van-search__content--round{border-radius:999px}.van-search__label{color:var(--search-label-color,#323233);font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,34px);padding:var(--search-label-padding,0 5px)}.van-search__field{flex:1}.van-search__field__left-icon{color:var(--search-left-icon-color,#969799)}.van-search--withaction{padding-right:0}.van-search__action{color:var(--search-action-text-color,#323233);font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,34px);padding:var(--search-action-padding,0 8px)}.van-search__action--hover{background-color:#f2f3f5} \ No newline at end of file diff --git a/components/vant/sidebar-item/index.d.ts b/components/vant/sidebar-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/sidebar-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/sidebar-item/index.js b/components/vant/sidebar-item/index.js new file mode 100644 index 0000000..eac568f --- /dev/null +++ b/components/vant/sidebar-item/index.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + classes: ['active-class', 'disabled-class'], + relation: (0, relation_1.useParent)('sidebar'), + props: { + dot: Boolean, + badge: null, + info: null, + title: String, + disabled: Boolean, + }, + methods: { + onClick: function () { + var _this = this; + var parent = this.parent; + if (!parent || this.data.disabled) { + return; + } + var index = parent.children.indexOf(this); + parent.setActive(index).then(function () { + _this.$emit('click', index); + parent.$emit('change', index); + }); + }, + setActive: function (selected) { + return this.setData({ selected: selected }); + }, + }, +}); diff --git a/components/vant/sidebar-item/index.json b/components/vant/sidebar-item/index.json new file mode 100644 index 0000000..bf0ebe0 --- /dev/null +++ b/components/vant/sidebar-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-info": "../info/index" + } +} diff --git a/components/vant/sidebar-item/index.wxml b/components/vant/sidebar-item/index.wxml new file mode 100644 index 0000000..c5c08a6 --- /dev/null +++ b/components/vant/sidebar-item/index.wxml @@ -0,0 +1,18 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ utils.bem('sidebar-item', { selected, disabled }) }} {{ selected ? 'active-class' : '' }} {{ disabled ? 'disabled-class' : '' }} custom-class" + hover-class="van-sidebar-item--hover" + hover-stay-time="70" + bind:tap="onClick" +> + <view class="van-sidebar-item__text"> + <van-info + wx:if="{{ badge != null || info !== null || dot }}" + dot="{{ dot }}" + info="{{ badge != null ? badge : info }}" + /> + <view wx:if="{{ title }}">{{ title }}</view> + <slot wx:else name="title" /> + </view> +</view> diff --git a/components/vant/sidebar-item/index.wxss b/components/vant/sidebar-item/index.wxss new file mode 100644 index 0000000..f1ce421 --- /dev/null +++ b/components/vant/sidebar-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-sidebar-item{background-color:var(--sidebar-background-color,#f7f8fa);border-left:3px solid transparent;box-sizing:border-box;color:var(--sidebar-text-color,#323233);display:block;font-size:var(--sidebar-font-size,14px);line-height:var(--sidebar-line-height,20px);overflow:hidden;padding:var(--sidebar-padding,20px 12px 20px 8px);-webkit-user-select:none;user-select:none}.van-sidebar-item__text{display:inline-block;position:relative;word-break:break-all}.van-sidebar-item--hover:not(.van-sidebar-item--disabled){background-color:var(--sidebar-active-color,#f2f3f5)}.van-sidebar-item:after{border-bottom-width:1px}.van-sidebar-item--selected{border-color:var(--sidebar-selected-border-color,#ee0a24);color:var(--sidebar-selected-text-color,#323233);font-weight:var(--sidebar-selected-font-weight,500)}.van-sidebar-item--selected:after{border-right-width:1px}.van-sidebar-item--selected,.van-sidebar-item--selected.van-sidebar-item--hover{background-color:var(--sidebar-selected-background-color,#fff)}.van-sidebar-item--disabled{color:var(--sidebar-disabled-text-color,#c8c9cc)} \ No newline at end of file diff --git a/components/vant/sidebar/index.d.ts b/components/vant/sidebar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/sidebar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/sidebar/index.js b/components/vant/sidebar/index.js new file mode 100644 index 0000000..f3e0a58 --- /dev/null +++ b/components/vant/sidebar/index.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('sidebar-item', function () { + this.setActive(this.data.activeKey); + }), + props: { + activeKey: { + type: Number, + value: 0, + observer: 'setActive', + }, + }, + beforeCreate: function () { + this.currentActive = -1; + }, + methods: { + setActive: function (activeKey) { + var _a = this, children = _a.children, currentActive = _a.currentActive; + if (!children.length) { + return Promise.resolve(); + } + this.currentActive = activeKey; + var 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/components/vant/sidebar/index.json b/components/vant/sidebar/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/sidebar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/sidebar/index.wxml b/components/vant/sidebar/index.wxml new file mode 100644 index 0000000..96b11c7 --- /dev/null +++ b/components/vant/sidebar/index.wxml @@ -0,0 +1,3 @@ +<view class="van-sidebar custom-class"> + <slot /> +</view> diff --git a/components/vant/sidebar/index.wxss b/components/vant/sidebar/index.wxss new file mode 100644 index 0000000..5a2d44f --- /dev/null +++ b/components/vant/sidebar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-sidebar{width:var(--sidebar-width,80px)} \ No newline at end of file diff --git a/components/vant/sticky/index.d.ts b/components/vant/sticky/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/sticky/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/sticky/index.js b/components/vant/sticky/index.js new file mode 100644 index 0000000..e1ae6df --- /dev/null +++ b/components/vant/sticky/index.js @@ -0,0 +1,118 @@ +import { getRect } from '../common/utils'; +import { VantComponent } from '../common/component'; +import { isDef } from '../common/validator'; +import { pageScrollMixin } from '../mixins/page-scroll'; +const ROOT_ELEMENT = '.van-sticky'; +VantComponent({ + props: { + zIndex: { + type: Number, + value: 99, + }, + offsetTop: { + type: Number, + value: 0, + observer: 'onScroll', + }, + disabled: { + type: Boolean, + observer: 'onScroll', + }, + container: { + type: null, + observer: 'onScroll', + }, + scrollTop: { + type: null, + observer(val) { + this.onScroll({ scrollTop: val }); + }, + }, + }, + mixins: [ + pageScrollMixin(function (event) { + if (this.data.scrollTop != null) { + return; + } + this.onScroll(event); + }), + ], + data: { + height: 0, + fixed: false, + transform: 0, + }, + mounted() { + this.onScroll(); + }, + methods: { + onScroll({ scrollTop } = {}) { + const { container, offsetTop, disabled } = this.data; + if (disabled) { + this.setDataAfterDiff({ + fixed: false, + transform: 0, + }); + return; + } + this.scrollTop = scrollTop || this.scrollTop; + if (typeof container === 'function') { + Promise.all([ + getRect(this, ROOT_ELEMENT), + this.getContainerRect(), + ]).then(([root, container]) => { + if (offsetTop + root.height > container.height + container.top) { + this.setDataAfterDiff({ + fixed: false, + transform: container.height - root.height, + }); + } + else if (offsetTop >= root.top) { + this.setDataAfterDiff({ + fixed: true, + height: root.height, + transform: 0, + }); + } + else { + this.setDataAfterDiff({ fixed: false, transform: 0 }); + } + }); + return; + } + getRect(this, ROOT_ELEMENT).then((root) => { + if (!isDef(root)) { + return; + } + if (offsetTop >= root.top) { + this.setDataAfterDiff({ fixed: true, height: root.height }); + this.transform = 0; + } + else { + this.setDataAfterDiff({ fixed: false }); + } + }); + }, + setDataAfterDiff(data) { + wx.nextTick(() => { + const diff = Object.keys(data).reduce((prev, key) => { + if (data[key] !== this.data[key]) { + prev[key] = data[key]; + } + return prev; + }, {}); + if (Object.keys(diff).length > 0) { + this.setData(diff); + } + this.$emit('scroll', { + scrollTop: this.scrollTop, + isFixed: data.fixed || this.data.fixed, + }); + }); + }, + getContainerRect() { + const nodesRef = this.data.container(); + return new Promise((resolve) => nodesRef.boundingClientRect(resolve).exec()); + }, + }, +}); diff --git a/components/vant/sticky/index.json b/components/vant/sticky/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/sticky/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/sticky/index.wxml b/components/vant/sticky/index.wxml new file mode 100644 index 0000000..15e9f4a --- /dev/null +++ b/components/vant/sticky/index.wxml @@ -0,0 +1,8 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class van-sticky" style="{{ computed.containerStyle({ fixed, height, zIndex }) }}"> + <view class="{{ utils.bem('sticky-wrap', { fixed }) }}" style="{{ computed.wrapStyle({ fixed, offsetTop, transform, zIndex }) }}"> + <slot /> + </view> +</view> diff --git a/components/vant/sticky/index.wxs b/components/vant/sticky/index.wxs new file mode 100644 index 0000000..be99d89 --- /dev/null +++ b/components/vant/sticky/index.wxs @@ -0,0 +1,25 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function wrapStyle(data) { + return style({ + transform: data.transform + ? 'translate3d(0, ' + data.transform + 'px, 0)' + : '', + top: data.fixed ? addUnit(data.offsetTop) : '', + 'z-index': data.zIndex, + }); +} + +function containerStyle(data) { + return style({ + height: data.fixed ? addUnit(data.height) : '', + 'z-index': data.zIndex, + }); +} + +module.exports = { + wrapStyle: wrapStyle, + containerStyle: containerStyle, +}; diff --git a/components/vant/sticky/index.wxss b/components/vant/sticky/index.wxss new file mode 100644 index 0000000..34d76aa --- /dev/null +++ b/components/vant/sticky/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{left:0;position:fixed;right:0} \ No newline at end of file diff --git a/components/vant/switch/index.d.ts b/components/vant/switch/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/switch/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/switch/index.js b/components/vant/switch/index.js new file mode 100644 index 0000000..4cad09c --- /dev/null +++ b/components/vant/switch/index.js @@ -0,0 +1,36 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + classes: ['node-class'], + props: { + checked: null, + loading: Boolean, + disabled: Boolean, + activeColor: String, + inactiveColor: String, + size: { + type: String, + value: '30', + }, + activeValue: { + type: null, + value: true, + }, + inactiveValue: { + type: null, + value: false, + }, + }, + methods: { + onClick() { + const { activeValue, inactiveValue, disabled, loading } = this.data; + if (disabled || loading) { + return; + } + const checked = this.data.checked === activeValue; + const value = checked ? inactiveValue : activeValue; + this.$emit('input', value); + this.$emit('change', value); + }, + }, +}); diff --git a/components/vant/switch/index.json b/components/vant/switch/index.json new file mode 100644 index 0000000..01077f5 --- /dev/null +++ b/components/vant/switch/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-loading": "../loading/index" + } +} diff --git a/components/vant/switch/index.wxml b/components/vant/switch/index.wxml new file mode 100644 index 0000000..4e9789b --- /dev/null +++ b/components/vant/switch/index.wxml @@ -0,0 +1,16 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class" + style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}" + bind:tap="onClick" +> + <view class="van-switch__node node-class"> + <van-loading + wx:if="{{ loading }}" + color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}" + custom-class="van-switch__loading" + /> + </view> +</view> diff --git a/components/vant/switch/index.wxs b/components/vant/switch/index.wxs new file mode 100644 index 0000000..3ae387a --- /dev/null +++ b/components/vant/switch/index.wxs @@ -0,0 +1,26 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + var currentColor = data.checked === data.activeValue ? data.activeColor : data.inactiveColor; + + return style({ + 'font-size': addUnit(data.size), + 'background-color': currentColor, + }); +} + +var BLUE = '#1989fa'; +var GRAY_DARK = '#969799'; + +function loadingColor(data) { + return data.checked === data.activeValue + ? data.activeColor || BLUE + : data.inactiveColor || GRAY_DARK; +} + +module.exports = { + rootStyle: rootStyle, + loadingColor: loadingColor, +}; diff --git a/components/vant/switch/index.wxss b/components/vant/switch/index.wxss new file mode 100644 index 0000000..35929de --- /dev/null +++ b/components/vant/switch/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-switch{background-color:var(--switch-background-color,#fff);border:var(--switch-border,1px solid rgba(0,0,0,.1));border-radius:var(--switch-node-size,1em);box-sizing:initial;display:inline-block;height:var(--switch-height,1em);position:relative;transition:background-color var(--switch-transition-duration,.3s);width:var(--switch-width,2em)}.van-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,1em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,1em);z-index:var(--switch-node-z-index,1)}.van-switch__loading{height:50%;left:25%;position:absolute!important;top:25%;width:50%}.van-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.van-switch--on .van-switch__node{transform:translateX(calc(var(--switch-width, 2em) - var(--switch-node-size, 1em)))}.van-switch--disabled{opacity:var(--switch-disabled-opacity,.4)} \ No newline at end of file diff --git a/components/vant/tab/index.d.ts b/components/vant/tab/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/tab/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/tab/index.js b/components/vant/tab/index.js new file mode 100644 index 0000000..9ada62e --- /dev/null +++ b/components/vant/tab/index.js @@ -0,0 +1,56 @@ +import { useParent } from '../common/relation'; +import { VantComponent } from '../common/component'; +VantComponent({ + relation: useParent('tabs'), + props: { + dot: { + type: Boolean, + observer: 'update', + }, + info: { + type: null, + observer: 'update', + }, + title: { + type: String, + observer: 'update', + }, + disabled: { + type: Boolean, + observer: 'update', + }, + titleStyle: { + type: String, + observer: 'update', + }, + name: { + type: null, + value: '', + }, + }, + data: { + active: false, + }, + 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/components/vant/tab/index.json b/components/vant/tab/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/tab/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/tab/index.wxml b/components/vant/tab/index.wxml new file mode 100644 index 0000000..f5e99f2 --- /dev/null +++ b/components/vant/tab/index.wxml @@ -0,0 +1,8 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="custom-class {{ utils.bem('tab__pane', { active, inactive: !active }) }}" + style="{{ shouldShow ? '' : 'display: none;' }}" +> + <slot wx:if="{{ shouldRender }}" /> +</view> diff --git a/components/vant/tab/index.wxss b/components/vant/tab/index.wxss new file mode 100644 index 0000000..1c90c88 --- /dev/null +++ b/components/vant/tab/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';:host{box-sizing:border-box;flex-shrink:0;width:100%}.van-tab__pane{-webkit-overflow-scrolling:touch;box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible} \ No newline at end of file diff --git a/components/vant/tabbar-item/index.d.ts b/components/vant/tabbar-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/tabbar-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/tabbar-item/index.js b/components/vant/tabbar-item/index.js new file mode 100644 index 0000000..4154399 --- /dev/null +++ b/components/vant/tabbar-item/index.js @@ -0,0 +1,56 @@ +import { VantComponent } from '../common/component'; +import { useParent } from '../common/relation'; +VantComponent({ + props: { + info: null, + name: null, + icon: String, + dot: Boolean, + iconPrefix: { + type: String, + value: 'van-icon', + }, + }, + relation: useParent('tabbar'), + data: { + active: false, + activeColor: '', + inactiveColor: '', + }, + methods: { + onClick() { + const { parent } = this; + if (parent) { + const index = parent.children.indexOf(this); + const active = this.data.name || index; + if (active !== this.data.active) { + parent.$emit('change', active); + } + } + 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; + } + if (Object.keys(patch).length > 0) { + this.setData(patch); + } + }, + }, +}); diff --git a/components/vant/tabbar-item/index.json b/components/vant/tabbar-item/index.json new file mode 100644 index 0000000..16f174c --- /dev/null +++ b/components/vant/tabbar-item/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-info": "../info/index" + } +} diff --git a/components/vant/tabbar-item/index.wxml b/components/vant/tabbar-item/index.wxml new file mode 100644 index 0000000..524728f --- /dev/null +++ b/components/vant/tabbar-item/index.wxml @@ -0,0 +1,28 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ utils.bem('tabbar-item', { active }) }} custom-class" + style="color: {{ active ? activeColor : inactiveColor }}" + bindtap="onClick" +> + <view class="van-tabbar-item__icon"> + <van-icon + wx:if="{{ icon }}" + name="{{ icon }}" + class-prefix="{{ iconPrefix }}" + custom-class="van-tabbar-item__icon__inner" + /> + <block wx:else> + <slot wx:if="{{ active }}" name="icon-active" /> + <slot wx:else name="icon" /> + </block> + <van-info + dot="{{ dot }}" + info="{{ info }}" + custom-class="van-tabbar-item__info" + /> + </view> + <view class="van-tabbar-item__text"> + <slot /> + </view> +</view> diff --git a/components/vant/tabbar-item/index.wxss b/components/vant/tabbar-item/index.wxss new file mode 100644 index 0000000..0c2c6f5 --- /dev/null +++ b/components/vant/tabbar-item/index.wxss @@ -0,0 +1,29 @@ +@import '../common/index.wxss'; +:host { + flex: 1; +} +.van-tabbar-item { + align-items: center; + color: var(--tabbar-item-text-color, #646566); + display: flex; + flex-direction: column; + font-size: var(--tabbar-item-font-size, 12px); + height: 100%; + justify-content: center; + line-height: var(--tabbar-item-line-height, 1); +} +.van-tabbar-item__icon { + font-size: var(--tabbar-item-icon-size, 22px); + margin-bottom: var(--tabbar-item-margin-bottom, 4px); + position: relative; +} +.van-tabbar-item__icon__inner { + display: block; + min-width: 1em; +} +.van-tabbar-item--active { + color: var(--tabbar-item-active-color, #1989fa); +} +.van-tabbar-item__info { + margin-top: 2px; +} diff --git a/components/vant/tabbar/index.d.ts b/components/vant/tabbar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/tabbar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/tabbar/index.js b/components/vant/tabbar/index.js new file mode 100644 index 0000000..5444999 --- /dev/null +++ b/components/vant/tabbar/index.js @@ -0,0 +1,69 @@ +import { VantComponent } from '../common/component'; +import { useChildren } from '../common/relation'; +import { getRect } from '../common/utils'; +VantComponent({ + relation: useChildren('tabbar-item', function () { + this.updateChildren(); + }), + props: { + active: { + type: null, + observer: 'updateChildren', + }, + activeColor: { + type: String, + observer: 'updateChildren', + }, + inactiveColor: { + type: String, + observer: 'updateChildren', + }, + fixed: { + type: Boolean, + value: true, + observer: 'setHeight', + }, + placeholder: { + type: Boolean, + observer: 'setHeight', + }, + border: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 1, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + myHeight: { + type: String, + value: '' + } + }, + data: { + height: 50, + }, + methods: { + updateChildren() { + const { children } = this; + if (!Array.isArray(children) || !children.length) { + return; + } + children.forEach((child) => child.updateFromParent()); + }, + setHeight() { + if (!this.data.fixed || !this.data.placeholder) { + return; + } + wx.nextTick(() => { + getRect(this, '.van-tabbar').then((res) => { + this.setData({ height: res.height }); + }); + }); + }, + }, +}); diff --git a/components/vant/tabbar/index.json b/components/vant/tabbar/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/tabbar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/tabbar/index.wxml b/components/vant/tabbar/index.wxml new file mode 100644 index 0000000..a453e1a --- /dev/null +++ b/components/vant/tabbar/index.wxml @@ -0,0 +1,10 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }} custom-class" + style="{{ zIndex ? 'z-index: ' + zIndex : '' }};{{ myHeight ? 'height: ' + myHeight : '' }}px;" +> + <slot /> +</view> + +<view wx:if="{{ fixed && placeholder }}" style="height: {{ height }}px;"></view> diff --git a/components/vant/tabbar/index.wxss b/components/vant/tabbar/index.wxss new file mode 100644 index 0000000..048e8f5 --- /dev/null +++ b/components/vant/tabbar/index.wxss @@ -0,0 +1,16 @@ +@import '../common/index.wxss'; +.van-tabbar { + background-color: var(--tabbar-background-color, #fff); + box-sizing: initial; + display: flex; + height: var(--tabbar-height, 50px); + width: 100%; +} +.van-tabbar--fixed { + bottom: 0; + left: 0; + position: fixed; +} +.van-tabbar--safe { + padding-bottom: env(safe-area-inset-bottom); +} diff --git a/components/vant/tabs/index.d.ts b/components/vant/tabs/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/tabs/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/tabs/index.js b/components/vant/tabs/index.js new file mode 100644 index 0000000..7aa9ad9 --- /dev/null +++ b/components/vant/tabs/index.js @@ -0,0 +1,278 @@ +import { VantComponent } from '../common/component'; +import { touch } from '../mixins/touch'; +import { getAllRect, getRect, groupSetData, nextTick, requestAnimationFrame, } from '../common/utils'; +import { isDef } from '../common/validator'; +import { useChildren } from '../common/relation'; +VantComponent({ + mixins: [touch], + classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'], + relation: useChildren('tab', function () { + this.updateTabs(); + }), + props: { + sticky: Boolean, + border: Boolean, + swipeable: Boolean, + titleActiveColor: String, + titleInactiveColor: String, + color: String, + animated: { + type: Boolean, + observer() { + this.children.forEach((child, index) => child.updateRender(index === this.data.currentIndex, this)); + }, + }, + lineWidth: { + type: null, + value: 40, + observer: 'resize', + }, + lineHeight: { + type: null, + value: -1, + }, + active: { + type: null, + value: 0, + observer(name) { + if (name !== this.getCurrentName()) { + this.setCurrentIndexByName(name); + } + }, + }, + type: { + type: String, + value: 'line', + }, + ellipsis: { + type: Boolean, + value: true, + }, + duration: { + type: Number, + value: 0.3, + }, + zIndex: { + type: Number, + value: 1, + }, + swipeThreshold: { + type: Number, + value: 5, + observer(value) { + this.setData({ + scrollable: this.children.length > value || !this.data.ellipsis, + }); + }, + }, + offsetTop: { + type: Number, + value: 0, + }, + lazyRender: { + type: Boolean, + value: true, + }, + disabled:{ + type: Boolean, + value: false + } + }, + data: { + tabs: [], + scrollLeft: 0, + scrollable: false, + currentIndex: 0, + container: null, + skipTransition: true, + scrollWithAnimation: false, + lineOffsetLeft: 0, + }, + mounted() { + requestAnimationFrame(() => { + this.swiping = true; + this.setData({ + container: () => this.createSelectorQuery().select('.van-tabs'), + }); + this.resize(); + 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(data.active || this.getCurrentName()); + }, + trigger(eventName, child) { + const { currentIndex } = this.data; + const currentChild = child || this.children[currentIndex]; + if (!isDef(currentChild)) { + return; + } + this.$emit(eventName, { + index: currentChild.index, + name: currentChild.getComputedName(), + title: currentChild.data.title, + }); + }, + onTap(event) { + const { index } = event.currentTarget.dataset; + const child = this.children[index]; + if (this.data.disabled){ + this.trigger('click'); + return; + } + if (child.data.disabled) { + this.trigger('disabled', child); + } + else { + this.setCurrentIndex(index); + 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; + } + groupSetData(this, () => { + 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 }); + requestAnimationFrame(() => { + this.resize(); + this.scrollIntoView(); + }); + nextTick(() => { + this.trigger('input'); + if (shouldEmitChange) { + this.trigger('change'); + } + }); + }, + getCurrentName() { + const activeTab = this.children[this.data.currentIndex]; + if (activeTab) { + return activeTab.getComputedName(); + } + }, + resize() { + if (this.data.type !== 'line') { + return; + } + const { currentIndex, ellipsis, skipTransition } = this.data; + Promise.all([ + getAllRect(this, '.van-tab'), + getRect(this, '.van-tabs__line'), + ]).then(([rects = [], lineRect]) => { + const rect = rects[currentIndex]; + if (rect == null) { + return; + } + let lineOffsetLeft = rects + .slice(0, currentIndex) + .reduce((prev, curr) => prev + curr.width, 0); + lineOffsetLeft += + (rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8); + this.setData({ lineOffsetLeft }); + this.swiping = true; + if (skipTransition) { + nextTick(() => { + this.setData({ skipTransition: false }); + }); + } + }); + }, + // scroll active tab into view + scrollIntoView() { + const { currentIndex, scrollable, scrollWithAnimation } = this.data; + if (!scrollable) { + return; + } + Promise.all([ + getAllRect(this, '.van-tab'), + getRect(this, '.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, + }); + if (!scrollWithAnimation) { + nextTick(() => { + this.setData({ scrollWithAnimation: true }); + }); + } + }); + }, + onTouchScroll(event) { + this.$emit('scroll', event.detail); + }, + onTouchStart(event) { + if (!this.data.swipeable) + return; + this.swiping = true; + this.touchStart(event); + }, + onTouchMove(event) { + if (!this.data.swipeable || !this.swiping) + return; + this.touchMove(event); + }, + // watch swipe touch end + onTouchEnd() { + if (!this.data.swipeable || !this.swiping) + return; + const { direction, deltaX, offsetX } = this; + const minSwipeDistance = 50; + if (direction === 'horizontal' && offsetX >= minSwipeDistance) { + const index = this.getAvaiableTab(deltaX); + if (index !== -1) { + this.setCurrentIndex(index); + } + } + this.swiping = false; + }, + getAvaiableTab(direction) { + const { tabs, currentIndex } = this.data; + const step = direction > 0 ? -1 : 1; + for (let i = step; currentIndex + i < tabs.length && currentIndex + i >= 0; i += step) { + const index = currentIndex + i; + if (index >= 0 && + index < tabs.length && + tabs[index] && + !tabs[index].disabled) { + return index; + } + } + return -1; + }, + }, +}); diff --git a/components/vant/tabs/index.json b/components/vant/tabs/index.json new file mode 100644 index 0000000..19c0bc3 --- /dev/null +++ b/components/vant/tabs/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-info": "../info/index", + "van-sticky": "../sticky/index" + } +} diff --git a/components/vant/tabs/index.wxml b/components/vant/tabs/index.wxml new file mode 100644 index 0000000..f76dd63 --- /dev/null +++ b/components/vant/tabs/index.wxml @@ -0,0 +1,63 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class {{ utils.bem('tabs', [type]) }}"> + <van-sticky + disabled="{{ !sticky }}" + z-index="{{ zIndex }}" + offset-top="{{ offsetTop }}" + container="{{ container }}" + bind:scroll="onTouchScroll" + > + <view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }}"> + <slot name="nav-left" /> + + <scroll-view + scroll-x="{{ scrollable }}" + scroll-with-animation="{{ scrollWithAnimation }}" + scroll-left="{{ scrollLeft }}" + class="{{ utils.bem('tabs__scroll', [type]) }}" + style="{{ color ? 'border-color: ' + color : '' }}" + > + <view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}"> + <view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth }) }}" /> + <view + wx:for="{{ tabs }}" + wx:key="index" + data-index="{{ index }}" + class="{{ computed.tabClass(index === currentIndex, ellipsis) }} {{ utils.bem('tab', { active: index === currentIndex, disabled: item.disabled, complete: !ellipsis }) }}" + style="{{ computed.tabStyle({ active: index === currentIndex, ellipsis, color, type, disabled: item.disabled, titleActiveColor, titleInactiveColor, swipeThreshold, scrollable }) }}" + bind:tap="onTap" + > + <view class="{{ ellipsis ? 'van-ellipsis' : '' }}" style="{{ item.titleStyle }}"> + {{ item.title }} + <van-info + wx:if="{{ item.info !== null || item.dot }}" + info="{{ item.info }}" + dot="{{ item.dot }}" + custom-class="van-tab__title__info" + /> + </view> + </view> + </view> + </scroll-view> + + <slot name="nav-right" /> + </view> + </van-sticky> + + <view + class="van-tabs__content" + bind:touchstart="onTouchStart" + bind:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" + > + <view + class="{{ utils.bem('tabs__track', [{ animated }]) }} van-tabs__track" + style="{{ computed.trackStyle({ duration, currentIndex, animated }) }}" + > + <slot /> + </view> + </view> +</view> diff --git a/components/vant/tabs/index.wxs b/components/vant/tabs/index.wxs new file mode 100644 index 0000000..a027c7b --- /dev/null +++ b/components/vant/tabs/index.wxs @@ -0,0 +1,82 @@ +/* eslint-disable */ +var utils = require('../wxs/utils.wxs'); +var style = require('../wxs/style.wxs'); + +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(data) { + var titleColor = data.active + ? data.titleActiveColor + : data.titleInactiveColor; + + var ellipsis = data.scrollable && data.ellipsis; + + // card theme color + if (data.type === 'card') { + return style({ + 'border-color': data.color, + 'background-color': !data.disabled && data.active ? data.color : null, + color: titleColor || (!data.disabled && !data.active ? data.color : null), + 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null, + }); + } + + return style({ + color: titleColor, + 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null, + }); +} + +function navStyle(color, type) { + return style({ + 'border-color': type === 'card' && color ? color : null, + }); +} + +function trackStyle(data) { + if (!data.animated) { + return ''; + } + + return style({ + left: -100 * data.currentIndex + '%', + 'transition-duration': data.duration + 's', + '-webkit-transition-duration': data.duration + 's', + }); +} + +function lineStyle(data) { + return style({ + width: utils.addUnit(data.lineWidth), + transform: 'translateX(' + data.lineOffsetLeft + 'px)', + '-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)', + 'background-color': data.color, + height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, + 'border-radius': + data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, + 'transition-duration': !data.skipTransition ? data.duration + 's' : null, + '-webkit-transition-duration': !data.skipTransition + ? data.duration + 's' + : null, + }); +} + +module.exports = { + tabClass: tabClass, + tabStyle: tabStyle, + trackStyle: trackStyle, + lineStyle: lineStyle, + navStyle: navStyle, +}; diff --git a/components/vant/tabs/index.wxss b/components/vant/tabs/index.wxss new file mode 100644 index 0000000..7742cef --- /dev/null +++ b/components/vant/tabs/index.wxss @@ -0,0 +1,115 @@ +@import '../common/index.wxss'; +.van-tabs { + -webkit-tap-highlight-color: transparent; + position: relative; +} +.van-tabs__wrap { + display: flex; + overflow: hidden; +} +.van-tabs__wrap--scrollable .van-tab { + flex: 0 0 22%; +} +.van-tabs__wrap--scrollable .van-tab--complete { + flex: 1 0 auto !important; + padding: 0 12px; +} +.van-tabs__wrap--scrollable .van-tabs__nav--complete { + padding-left: 8px; + padding-right: 8px; +} +.van-tabs__scroll { + background-color: var(--tabs-nav-background-color, #fff); +} +.van-tabs__scroll--line { + box-sizing: initial; + height: calc(100% + 15px); +} +.van-tabs__scroll--card { + border: 1px solid var(--tabs-default-color, #ee0a24); + border-radius: 2px; + box-sizing: border-box; + margin: 0 var(--padding-md, 16px); + width: calc(100% - var(--padding-md, 16px) * 2); +} +.van-tabs__scroll::-webkit-scrollbar { + display: none; +} +.van-tabs__nav { + display: flex; + position: relative; + -webkit-user-select: none; + user-select: none; +} +.van-tabs__nav--card { + box-sizing: border-box; + height: var(--tabs-card-height, 30px); +} +.van-tabs__nav--card .van-tab { + border-right: 1px solid var(--tabs-default-color, #ee0a24); + color: var(--tabs-default-color, #ee0a24); + line-height: calc(var(--tabs-card-height, 30px) - 2px); +} +.van-tabs__nav--card .van-tab:last-child { + border-right: none; +} +.van-tabs__nav--card .van-tab.van-tab--active { + background-color: var(--tabs-default-color, #ee0a24); + color: #fff; +} +.van-tabs__nav--card .van-tab--disabled { + color: var(--tab-disabled-text-color, #c8c9cc); +} +.van-tabs__line { + background-color: var(--tabs-bottom-bar-color, #ee0a24); + border-radius: var(--tabs-bottom-bar-height, 3px); + bottom: 0; + height: var(--tabs-bottom-bar-height, 3px); + left: 0; + position: absolute; + z-index: 1; +} +.van-tabs__track { + height: 100%; + position: relative; + width: 100%; +} +.van-tabs__track--animated { + display: flex; + transition-property: left; +} +.van-tabs__content { + overflow: hidden; +} +.van-tabs--line .van-tabs__wrap { + height: var(--tabs-line-height, 44px); +} +.van-tabs--card .van-tabs__wrap { + height: var(--tabs-card-height, 30px); +} +.van-tab { + box-sizing: border-box; + color: var(--tab-text-color, #646566); + cursor: pointer; + flex: 1; + font-size: var(--tab-font-size, 14px); + line-height: 44rpx; + min-width: 0; + position: relative; + text-align: center; + height: var(--tabs-line-height); + font-weight: var(--font-weight-bold); +} +.van-tab--active { + color: var(--tab-active-text-color, #323233); + font-weight: var(--font-weight-bold, 500); +} +.van-tab--disabled { + color: var(--tab-disabled-text-color, #c8c9cc); +} +.van-tab__title__info { + display: inline-block; + position: relative !important; + top: -1px !important; + transform: translateX(0) !important; +} diff --git a/components/vant/toast/index.d.ts b/components/vant/toast/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/toast/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/toast/index.js b/components/vant/toast/index.js new file mode 100644 index 0000000..414e746 --- /dev/null +++ b/components/vant/toast/index.js @@ -0,0 +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() { }, + }, +}); diff --git a/components/vant/toast/index.json b/components/vant/toast/index.json new file mode 100644 index 0000000..9b1b78c --- /dev/null +++ b/components/vant/toast/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index", + "van-overlay": "../overlay/index", + "van-transition": "../transition/index" + } +} diff --git a/components/vant/toast/index.wxml b/components/vant/toast/index.wxml new file mode 100644 index 0000000..dbbaab5 --- /dev/null +++ b/components/vant/toast/index.wxml @@ -0,0 +1,36 @@ +<van-overlay + wx:if="{{ mask || forbidClick }}" + show="{{ show }}" + z-index="{{ zIndex }}" + custom-style="{{ mask ? '' : 'background-color: transparent;' }}" +/> +<van-transition + show="{{ show }}" + custom-style="z-index: {{ zIndex }}" + custom-class="van-toast__container" +> + <view + class="van-toast van-toast--{{ (type === 'text' || type === 'html') ? 'text' : 'icon' }} van-toast--{{ position }}" + catch:touchmove="noop" + > + <!-- text only --> + <text wx:if="{{ type === 'text' }}">{{ message }}</text> + + <!-- html only --> + <rich-text wx:elif="{{ type === 'html' }}" nodes="{{ message }}"></rich-text> + + <!-- with icon --> + <block wx:else> + <van-loading + wx:if="{{ type === 'loading' }}" + color="white" + type="{{ loadingType }}" + custom-class="van-toast__loading" + /> + <van-icon wx:else class="van-toast__icon" name="{{ type === 'fail' ? 'warning' : type }}" /> + <text wx:if="{{ message }}" class="van-toast__text">{{ message }}</text> + </block> + + <slot /> + </view> +</van-transition> diff --git a/components/vant/toast/index.wxss b/components/vant/toast/index.wxss new file mode 100644 index 0000000..4c66b8e --- /dev/null +++ b/components/vant/toast/index.wxss @@ -0,0 +1,49 @@ +@import '../common/index.wxss'; +.van-toast { + word-wrap: break-word; + align-items: center; + background-color: var(--toast-background-color, rgba(0, 0, 0, 0.7)); + border-radius: var(--toast-border-radius, 8px); + box-sizing: initial; + color: var(--toast-text-color, #fff); + display: flex; + flex-direction: column; + font-size: var(--toast-font-size, 14px); + justify-content: center; + line-height: var(--toast-line-height, 20px); + white-space: pre-wrap; +} +.van-toast__container { + left: 50%; + max-width: var(--toast-max-width, 70%); + position: fixed; + top: 50%; + transform: translate(-50%, -50%); + width: -webkit-fit-content; + width: fit-content; +} +.van-toast--text { + min-width: var(--toast-text-min-width, 96px); + padding: var(--toast-text-padding, 8px 12px); +} +.van-toast--icon { + min-height: var(--toast-default-min-height, 88px); + padding: var(--toast-default-padding, 16px); + min-width: var(--toast-default-width, 88px); + max-width: 400rpx; +} +.van-toast--icon .van-toast__icon { + font-size: var(--toast-icon-size, 36px); +} +.van-toast--icon .van-toast__text { + padding-top: 8px; +} +.van-toast__loading { + margin: 10px 0; +} +.van-toast--top { + transform: translateY(-30vh); +} +.van-toast--bottom { + transform: translateY(30vh); +} diff --git a/components/vant/toast/toast.d.ts b/components/vant/toast/toast.d.ts new file mode 100644 index 0000000..db3f40e --- /dev/null +++ b/components/vant/toast/toast.d.ts @@ -0,0 +1,26 @@ +/// <reference types="miniprogram-api-typings" /> +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 | undefined; +declare namespace Toast { + var loading: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined; + var success: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined; + var fail: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined; + var clear: () => void; + var setDefaultOptions: (options: ToastOptions) => void; + var resetDefaultOptions: () => void; +} +export default Toast; diff --git a/components/vant/toast/toast.js b/components/vant/toast/toast.js new file mode 100644 index 0000000..10775f3 --- /dev/null +++ b/components/vant/toast/toast.js @@ -0,0 +1,66 @@ +import { isObj } from '../common/validator'; +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 != null && 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/components/vant/transition/index.d.ts b/components/vant/transition/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/components/vant/transition/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/components/vant/transition/index.js b/components/vant/transition/index.js new file mode 100644 index 0000000..59bb984 --- /dev/null +++ b/components/vant/transition/index.js @@ -0,0 +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)], +}); diff --git a/components/vant/transition/index.json b/components/vant/transition/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/vant/transition/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/vant/transition/index.wxml b/components/vant/transition/index.wxml new file mode 100644 index 0000000..82097a3 --- /dev/null +++ b/components/vant/transition/index.wxml @@ -0,0 +1,14 @@ +<wxs src="./index.wxs" module="computed" /> + +<view + wx:if="{{ inited }}" + class="van-transition custom-class {{ classes }}" + style="{{ computed.rootStyle({ currentDuration, display, customStyle }) }}" + bind:transitionend="onTransitionEnd" +> + <slot /> +</view> + +<view wx:else style="display:none"> + <slot /> +</view> diff --git a/components/vant/transition/index.wxs b/components/vant/transition/index.wxs new file mode 100644 index 0000000..e0babf6 --- /dev/null +++ b/components/vant/transition/index.wxs @@ -0,0 +1,17 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + return style([ + { + '-webkit-transition-duration': data.currentDuration + 'ms', + 'transition-duration': data.currentDuration + 'ms', + }, + data.display ? null : 'display: none', + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/components/vant/transition/index.wxss b/components/vant/transition/index.wxss new file mode 100644 index 0000000..3a3d37f --- /dev/null +++ b/components/vant/transition/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-transition{transition-timing-function:ease}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-fade-down-enter-active,.van-fade-down-leave-active,.van-fade-left-enter-active,.van-fade-left-leave-active,.van-fade-right-enter-active,.van-fade-right-leave-active,.van-fade-up-enter-active,.van-fade-up-leave-active{transition-property:opacity,transform}.van-fade-up-enter,.van-fade-up-leave-to{opacity:0;transform:translate3d(0,100%,0)}.van-fade-down-enter,.van-fade-down-leave-to{opacity:0;transform:translate3d(0,-100%,0)}.van-fade-left-enter,.van-fade-left-leave-to{opacity:0;transform:translate3d(-100%,0,0)}.van-fade-right-enter,.van-fade-right-leave-to{opacity:0;transform:translate3d(100%,0,0)}.van-slide-down-enter-active,.van-slide-down-leave-active,.van-slide-left-enter-active,.van-slide-left-leave-active,.van-slide-right-enter-active,.van-slide-right-leave-active,.van-slide-up-enter-active,.van-slide-up-leave-active{transition-property:transform}.van-slide-up-enter,.van-slide-up-leave-to{transform:translate3d(0,100%,0)}.van-slide-down-enter,.van-slide-down-leave-to{transform:translate3d(0,-100%,0)}.van-slide-left-enter,.van-slide-left-leave-to{transform:translate3d(-100%,0,0)}.van-slide-right-enter,.van-slide-right-leave-to{transform:translate3d(100%,0,0)} \ No newline at end of file diff --git a/components/vant/wxs/add-unit.wxs b/components/vant/wxs/add-unit.wxs new file mode 100644 index 0000000..4f33462 --- /dev/null +++ b/components/vant/wxs/add-unit.wxs @@ -0,0 +1,12 @@ +/* eslint-disable */ +var REGEXP = getRegExp('^-?\d+(\.\d+)?$'); + +function addUnit(value) { + if (value == null) { + return undefined; + } + + return REGEXP.test('' + value) ? value + 'px' : value; +} + +module.exports = addUnit; diff --git a/components/vant/wxs/array.wxs b/components/vant/wxs/array.wxs new file mode 100644 index 0000000..610089c --- /dev/null +++ b/components/vant/wxs/array.wxs @@ -0,0 +1,5 @@ +function isArray(array) { + return array && array.constructor === 'Array'; +} + +module.exports.isArray = isArray; diff --git a/components/vant/wxs/bem.wxs b/components/vant/wxs/bem.wxs new file mode 100644 index 0000000..1efa129 --- /dev/null +++ b/components/vant/wxs/bem.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +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; diff --git a/components/vant/wxs/memoize.wxs b/components/vant/wxs/memoize.wxs new file mode 100644 index 0000000..8f7f46d --- /dev/null +++ b/components/vant/wxs/memoize.wxs @@ -0,0 +1,55 @@ +/** + * Simple memoize + * wxs doesn't support fn.apply, so this memoize only support up to 2 args + */ +/* eslint-disable */ + +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; diff --git a/components/vant/wxs/object.wxs b/components/vant/wxs/object.wxs new file mode 100644 index 0000000..e077107 --- /dev/null +++ b/components/vant/wxs/object.wxs @@ -0,0 +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; diff --git a/components/vant/wxs/style.wxs b/components/vant/wxs/style.wxs new file mode 100644 index 0000000..d88ca7c --- /dev/null +++ b/components/vant/wxs/style.wxs @@ -0,0 +1,42 @@ +/* eslint-disable */ +var object = require('./object.wxs'); +var array = require('./array.wxs'); + +function kebabCase(word) { + var newWord = word + .replace(getRegExp("[A-Z]", 'g'), function (i) { + return '-' + i; + }) + .toLowerCase() + + return newWord; +} + +function style(styles) { + if (array.isArray(styles)) { + return styles + .filter(function (item) { + return item != null && item !== ''; + }) + .map(function (item) { + return style(item); + }) + .join(';'); + } + + if ('Object' === styles.constructor) { + return object + .keys(styles) + .filter(function (key) { + return styles[key] != null && styles[key] !== ''; + }) + .map(function (key) { + return [kebabCase(key), [styles[key]]].join(':'); + }) + .join(';'); + } + + return styles; +} + +module.exports = style; diff --git a/components/vant/wxs/utils.wxs b/components/vant/wxs/utils.wxs new file mode 100644 index 0000000..f66d33a --- /dev/null +++ b/components/vant/wxs/utils.wxs @@ -0,0 +1,10 @@ +/* eslint-disable */ +var bem = require('./bem.wxs'); +var memoize = require('./memoize.wxs'); +var addUnit = require('./add-unit.wxs'); + +module.exports = { + bem: memoize(bem), + memoize: memoize, + addUnit: addUnit +}; diff --git a/font/DingTalk_JinBuTi_Regular.ttf b/font/DingTalk_JinBuTi_Regular.ttf new file mode 100644 index 0000000..c4efa55 --- /dev/null +++ b/font/DingTalk_JinBuTi_Regular.ttf Binary files differ diff --git a/images/avatar.png b/images/avatar.png new file mode 100644 index 0000000..90673f1 --- /dev/null +++ b/images/avatar.png Binary files differ diff --git a/images/me_1.png b/images/me_1.png new file mode 100644 index 0000000..49bc1a1 --- /dev/null +++ b/images/me_1.png Binary files differ diff --git a/images/me_2.png b/images/me_2.png new file mode 100644 index 0000000..a4ca297 --- /dev/null +++ b/images/me_2.png Binary files differ diff --git a/images/me_3.png b/images/me_3.png new file mode 100644 index 0000000..8162a9f --- /dev/null +++ b/images/me_3.png Binary files differ diff --git a/img/AIAide_1.png b/img/AIAide_1.png new file mode 100644 index 0000000..a053b28 --- /dev/null +++ b/img/AIAide_1.png Binary files differ diff --git a/img/AIAide_2.png b/img/AIAide_2.png new file mode 100644 index 0000000..af64c3d --- /dev/null +++ b/img/AIAide_2.png Binary files differ diff --git a/img/AIAide_4.png b/img/AIAide_4.png new file mode 100644 index 0000000..ebd1dca --- /dev/null +++ b/img/AIAide_4.png Binary files differ diff --git a/img/Like_1.png b/img/Like_1.png new file mode 100644 index 0000000..1d6c0f4 --- /dev/null +++ b/img/Like_1.png Binary files differ diff --git a/img/arrive_1.png b/img/arrive_1.png new file mode 100644 index 0000000..10acd3c --- /dev/null +++ b/img/arrive_1.png Binary files differ diff --git a/img/case_1.png b/img/case_1.png new file mode 100644 index 0000000..29fb0cd --- /dev/null +++ b/img/case_1.png Binary files differ diff --git a/img/case_2.png b/img/case_2.png new file mode 100644 index 0000000..1e06f69 --- /dev/null +++ b/img/case_2.png Binary files differ diff --git a/img/close.png b/img/close.png new file mode 100644 index 0000000..2840e79 --- /dev/null +++ b/img/close.png Binary files differ diff --git a/img/criticize_1.png b/img/criticize_1.png new file mode 100644 index 0000000..edcfee6 --- /dev/null +++ b/img/criticize_1.png Binary files differ diff --git a/img/finish_1.png b/img/finish_1.png new file mode 100644 index 0000000..66abd8e --- /dev/null +++ b/img/finish_1.png Binary files differ diff --git a/img/me-center.png b/img/me-center.png new file mode 100644 index 0000000..03bbb9c --- /dev/null +++ b/img/me-center.png Binary files differ diff --git a/img/meeting_1.png b/img/meeting_1.png new file mode 100644 index 0000000..0ae2245 --- /dev/null +++ b/img/meeting_1.png Binary files differ diff --git a/img/right.png b/img/right.png new file mode 100644 index 0000000..8add306 --- /dev/null +++ b/img/right.png Binary files differ diff --git a/img/supplement_1.png b/img/supplement_1.png new file mode 100644 index 0000000..cfe6a93 --- /dev/null +++ b/img/supplement_1.png Binary files differ diff --git a/img/update_1.png b/img/update_1.png new file mode 100644 index 0000000..1f1d5eb --- /dev/null +++ b/img/update_1.png Binary files differ diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.d.ts b/miniprogram_npm/@vant/weapp/action-sheet/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.js b/miniprogram_npm/@vant/weapp/action-sheet/index.js new file mode 100644 index 0000000..b7af646 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var button_1 = require("../mixins/button"); +(0, component_1.VantComponent)({ + mixins: [button_1.button], + props: { + show: Boolean, + title: String, + cancelText: String, + description: String, + round: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 100, + }, + actions: { + type: Array, + value: [], + }, + overlay: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + closeOnClickAction: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, + methods: { + onSelect: function (event) { + var _this = this; + var index = event.currentTarget.dataset.index; + var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile; + var item = actions[index]; + if (item) { + this.$emit('select', item); + if (closeOnClickAction) { + this.onClose(); + } + if (item.openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: item.getUserProfileDesc || ' ', + complete: function (userProfile) { + _this.$emit('getuserinfo', userProfile); + }, + }); + } + } + }, + onCancel: function () { + this.$emit('cancel'); + }, + onClose: function () { + this.$emit('close'); + }, + onClickOverlay: function () { + this.$emit('click-overlay'); + this.onClose(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.json b/miniprogram_npm/@vant/weapp/action-sheet/index.json new file mode 100644 index 0000000..19bf989 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.wxml b/miniprogram_npm/@vant/weapp/action-sheet/index.wxml new file mode 100644 index 0000000..b04cc3a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.wxml @@ -0,0 +1,69 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<van-popup + show="{{ show }}" + position="bottom" + round="{{ round }}" + z-index="{{ zIndex }}" + overlay="{{ overlay }}" + custom-class="van-action-sheet" + safe-area-inset-bottom="{{ safeAreaInsetBottom }}" + close-on-click-overlay="{{ closeOnClickOverlay }}" + bind:close="onClickOverlay" +> + <view wx:if="{{ title }}" class="van-action-sheet__header"> + {{ title }} + <van-icon + name="cross" + custom-class="van-action-sheet__close" + bind:click="onClose" + /> + </view> + <view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom"> + {{ description }} + </view> + <view wx:if="{{ actions && actions.length }}"> + <!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 --> + <button + wx:for="{{ actions }}" + wx:key="index" + open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}" + style="{{ item.color ? 'color: ' + item.color : '' }}" + class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}" + hover-class="van-action-sheet__item--hover" + data-index="{{ index }}" + bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}" + bindgetuserinfo="onGetUserInfo" + bindcontact="onContact" + bindgetphonenumber="onGetPhoneNumber" + binderror="onError" + bindlaunchapp="onLaunchApp" + bindopensetting="onOpenSetting" + lang="{{ lang }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" + > + <block wx:if="{{ !item.loading }}"> + {{ item.name }} + <view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view> + </block> + <van-loading wx:else custom-class="van-action-sheet__loading" size="22px" /> + </button> + </view> + <slot /> + <block wx:if="{{ cancelText }}"> + <view class="van-action-sheet__gap" /> + <view + class="van-action-sheet__cancel" + hover-class="van-action-sheet__cancel--hover" + hover-stay-time="70" + bind:tap="onCancel" + > + {{ cancelText }} + </view> + </block> +</van-popup> diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.wxss b/miniprogram_npm/@vant/weapp/action-sheet/index.wxss new file mode 100644 index 0000000..eedd361 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-action-sheet{color:var(--action-sheet-item-text-color,#323233);max-height:var(--action-sheet-max-height,90%)!important}.van-action-sheet__cancel,.van-action-sheet__item{background-color:var(--action-sheet-item-background,#fff);font-size:var(--action-sheet-item-font-size,16px);line-height:var(--action-sheet-item-line-height,22px);padding:14px 16px;text-align:center}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{background-color:var(--action-sheet-cancel-padding-color,#f7f8fa);display:block;height:var(--action-sheet-cancel-padding-top,8px)}.van-action-sheet__item--disabled{color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{color:var(--action-sheet-subname-color,#969799);font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.van-action-sheet__header{font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--font-weight-bold,500);line-height:var(--action-sheet-header-height,48px);text-align:center}.van-action-sheet__description{color:var(--action-sheet-description-color,#969799);font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.van-action-sheet__close{color:var(--action-sheet-close-icon-color,#c8c9cc);font-size:var(--action-sheet-close-icon-size,22px)!important;line-height:inherit!important;padding:var(--action-sheet-close-icon-padding,0 16px);position:absolute!important;right:0;top:0}.van-action-sheet__loading{display:flex!important} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/area/index.d.ts b/miniprogram_npm/@vant/weapp/area/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/area/index.js b/miniprogram_npm/@vant/weapp/area/index.js new file mode 100644 index 0000000..f86bb37 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.js @@ -0,0 +1,232 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var shared_1 = require("../picker/shared"); +var utils_1 = require("../common/utils"); +var EMPTY_CODE = '000000'; +(0, component_1.VantComponent)({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { value: { + type: String, + observer: function (value) { + this.code = value; + this.setValues(); + }, + }, areaList: { + type: Object, + value: {}, + observer: 'setValues', + }, columnsNum: { + type: null, + value: 3, + }, columnsPlaceholder: { + type: Array, + observer: function (val) { + this.setData({ + typeToColumnsPlaceholder: { + province: val[0] || '', + city: val[1] || '', + county: val[2] || '', + }, + }); + }, + } }), + data: { + columns: [{ values: [] }, { values: [] }, { values: [] }], + typeToColumnsPlaceholder: {}, + }, + mounted: function () { + var _this = this; + (0, utils_1.requestAnimationFrame)(function () { + _this.setValues(); + }); + }, + methods: { + getPicker: function () { + if (this.picker == null) { + this.picker = this.selectComponent('.van-area__picker'); + } + return this.picker; + }, + onCancel: function (event) { + this.emit('cancel', event.detail); + }, + onConfirm: function (event) { + var index = event.detail.index; + var value = event.detail.value; + value = this.parseValues(value); + this.emit('confirm', { value: value, index: index }); + }, + emit: function (type, detail) { + detail.values = detail.value; + delete detail.value; + this.$emit(type, detail); + }, + parseValues: function (values) { + var columnsPlaceholder = this.data.columnsPlaceholder; + return values.map(function (value, index) { + if (value && + (!value.code || value.name === columnsPlaceholder[index])) { + return __assign(__assign({}, value), { code: '', name: '' }); + } + return value; + }); + }, + onChange: function (event) { + var _this = this; + var _a; + var _b = event.detail, index = _b.index, picker = _b.picker, value = _b.value; + this.code = value[index].code; + (_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(function () { + _this.$emit('change', { + picker: picker, + values: _this.parseValues(picker.getValues()), + index: index, + }); + }); + }, + getConfig: function (type) { + var areaList = this.data.areaList; + return (areaList && areaList["".concat(type, "_list")]) || {}; + }, + getList: function (type, code) { + if (type !== 'province' && !code) { + return []; + } + var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder; + var list = this.getConfig(type); + var result = Object.keys(list).map(function (code) { return ({ + code: code, + name: list[code], + }); }); + if (code != null) { + // oversea code + if (code[0] === '9' && type === 'city') { + code = '9'; + } + result = result.filter(function (item) { return item.code.indexOf(code) === 0; }); + } + if (typeToColumnsPlaceholder[type] && result.length) { + // set columns placeholder + var codeFill = type === 'province' + ? '' + : type === 'city' + ? EMPTY_CODE.slice(2, 4) + : EMPTY_CODE.slice(4, 6); + result.unshift({ + code: "".concat(code).concat(codeFill), + name: typeToColumnsPlaceholder[type], + }); + } + return result; + }, + getIndex: function (type, code) { + var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; + var list = this.getList(type, code.slice(0, compareNum - 2)); + // oversea code + if (code[0] === '9' && type === 'province') { + compareNum = 1; + } + code = code.slice(0, compareNum); + for (var i = 0; i < list.length; i++) { + if (list[i].code.slice(0, compareNum) === code) { + return i; + } + } + return 0; + }, + setValues: function () { + var picker = this.getPicker(); + if (!picker) { + return; + } + var code = this.code || this.getDefaultCode(); + var provinceList = this.getList('province'); + var cityList = this.getList('city', code.slice(0, 2)); + var stack = []; + var indexes = []; + var columnsNum = this.data.columnsNum; + if (columnsNum >= 1) { + stack.push(picker.setColumnValues(0, provinceList, false)); + indexes.push(this.getIndex('province', code)); + } + if (columnsNum >= 2) { + stack.push(picker.setColumnValues(1, cityList, false)); + indexes.push(this.getIndex('city', code)); + if (cityList.length && code.slice(2, 4) === '00') { + code = cityList[0].code; + } + } + if (columnsNum === 3) { + stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false)); + indexes.push(this.getIndex('county', code)); + } + return Promise.all(stack) + .catch(function () { }) + .then(function () { return picker.setIndexes(indexes); }) + .catch(function () { }); + }, + getDefaultCode: function () { + var columnsPlaceholder = this.data.columnsPlaceholder; + if (columnsPlaceholder.length) { + return EMPTY_CODE; + } + var countyCodes = Object.keys(this.getConfig('county')); + if (countyCodes[0]) { + return countyCodes[0]; + } + var cityCodes = Object.keys(this.getConfig('city')); + if (cityCodes[0]) { + return cityCodes[0]; + } + return ''; + }, + getValues: function () { + var picker = this.getPicker(); + if (!picker) { + return []; + } + return this.parseValues(picker.getValues().filter(function (value) { return !!value; })); + }, + getDetail: function () { + var values = this.getValues(); + var area = { + code: '', + country: '', + province: '', + city: '', + county: '', + }; + if (!values.length) { + return area; + } + var names = values.map(function (item) { return item.name; }); + area.code = values[values.length - 1].code; + if (area.code[0] === '9') { + area.country = names[1] || ''; + area.province = names[2] || ''; + } + else { + area.province = names[0] || ''; + area.city = names[1] || ''; + area.county = names[2] || ''; + } + return area; + }, + reset: function (code) { + this.code = code || ''; + return this.setValues(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/area/index.json b/miniprogram_npm/@vant/weapp/area/index.json new file mode 100644 index 0000000..a778e91 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/area/index.wxml b/miniprogram_npm/@vant/weapp/area/index.wxml new file mode 100644 index 0000000..f7dc51f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.wxml @@ -0,0 +1,20 @@ +<wxs src="./index.wxs" module="computed" /> + +<van-picker + class="van-area__picker" + active-class="active-class" + toolbar-class="toolbar-class" + column-class="column-class" + show-toolbar + value-key="name" + title="{{ title }}" + loading="{{ loading }}" + columns="{{ computed.displayColumns(columns, columnsNum) }}" + item-height="{{ itemHeight }}" + visible-item-count="{{ visibleItemCount }}" + cancel-button-text="{{ cancelButtonText }}" + confirm-button-text="{{ confirmButtonText }}" + bind:change="onChange" + bind:confirm="onConfirm" + bind:cancel="onCancel" +/> diff --git a/miniprogram_npm/@vant/weapp/area/index.wxs b/miniprogram_npm/@vant/weapp/area/index.wxs new file mode 100644 index 0000000..07723c1 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.wxs @@ -0,0 +1,8 @@ +/* eslint-disable */ +function displayColumns(columns, columnsNum) { + return columns.slice(0, +columnsNum); +} + +module.exports = { + displayColumns: displayColumns, +}; diff --git a/miniprogram_npm/@vant/weapp/area/index.wxss b/miniprogram_npm/@vant/weapp/area/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/button/index.d.ts b/miniprogram_npm/@vant/weapp/button/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/button/index.js b/miniprogram_npm/@vant/weapp/button/index.js new file mode 100644 index 0000000..984135c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var button_1 = require("../mixins/button"); +var version_1 = require("../common/version"); +var mixins = [button_1.button]; +if ((0, version_1.canIUseFormFieldButton)()) { + mixins.push('wx://form-field-button'); +} +(0, component_1.VantComponent)({ + mixins: mixins, + classes: ['hover-class', 'loading-class'], + data: { + baseStyle: '', + }, + props: { + formType: String, + icon: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + plain: Boolean, + block: Boolean, + round: Boolean, + square: Boolean, + loading: Boolean, + hairline: Boolean, + disabled: Boolean, + loadingText: String, + customStyle: String, + loadingType: { + type: String, + value: 'circular', + }, + type: { + type: String, + value: 'default', + }, + dataset: null, + size: { + type: String, + value: 'normal', + }, + loadingSize: { + type: String, + value: '20px', + }, + color: String, + }, + methods: { + onClick: function (event) { + var _this = this; + this.$emit('click', event); + var _a = this.data, canIUseGetUserProfile = _a.canIUseGetUserProfile, openType = _a.openType, getUserProfileDesc = _a.getUserProfileDesc, lang = _a.lang; + if (openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: getUserProfileDesc || ' ', + lang: lang || 'en', + complete: function (userProfile) { + _this.$emit('getuserinfo', userProfile); + }, + }); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/button/index.json b/miniprogram_npm/@vant/weapp/button/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/button/index.wxml b/miniprogram_npm/@vant/weapp/button/index.wxml new file mode 100644 index 0000000..8034845 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.wxml @@ -0,0 +1,53 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<button + id="{{ id }}" + data-detail="{{ dataset }}" + class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" + hover-class="van-button--active hover-class" + lang="{{ lang }}" + form-type="{{ formType }}" + style="{{ computed.rootStyle({ plain, color, customStyle }) }}" + open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}" + business-id="{{ businessId }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" + aria-label="{{ ariaLabel }}" + bindtap="{{ disabled || loading ? '' : 'onClick' }}" + bindgetuserinfo="onGetUserInfo" + bindcontact="onContact" + bindgetphonenumber="onGetPhoneNumber" + binderror="onError" + bindlaunchapp="onLaunchApp" + bindopensetting="onOpenSetting" +> + <block wx:if="{{ loading }}"> + <van-loading + custom-class="loading-class" + size="{{ loadingSize }}" + type="{{ loadingType }}" + color="{{ computed.loadingColor({ type, color, plain }) }}" + /> + <view wx:if="{{ loadingText }}" class="van-button__loading-text"> + {{ loadingText }} + </view> + </block> + <block wx:else> + <van-icon + wx:if="{{ icon }}" + size="1.2em" + name="{{ icon }}" + class-prefix="{{ classPrefix }}" + class="van-button__icon" + custom-style="line-height: inherit;" + /> + <view class="van-button__text"> + <slot /> + </view> + </block> +</button> diff --git a/miniprogram_npm/@vant/weapp/button/index.wxs b/miniprogram_npm/@vant/weapp/button/index.wxs new file mode 100644 index 0000000..8b649fe --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + if (!data.color) { + return data.customStyle; + } + + var properties = { + color: data.plain ? data.color : '#fff', + background: data.plain ? null : data.color, + }; + + // hide border when color is linear-gradient + if (data.color.indexOf('gradient') !== -1) { + properties.border = 0; + } else { + properties['border-color'] = data.color; + } + + return style([properties, data.customStyle]); +} + +function loadingColor(data) { + if (data.plain) { + return data.color ? data.color : '#c9c9c9'; + } + + if (data.type === 'default') { + return '#c9c9c9'; + } + + return '#fff'; +} + +module.exports = { + rootStyle: rootStyle, + loadingColor: loadingColor, +}; diff --git a/miniprogram_npm/@vant/weapp/button/index.wxss b/miniprogram_npm/@vant/weapp/button/index.wxss new file mode 100644 index 0000000..bd8bb5a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-button{-webkit-text-size-adjust:100%;align-items:center;-webkit-appearance:none;border-radius:var(--button-border-radius,2px);box-sizing:border-box;display:inline-flex;font-size:var(--button-default-font-size,16px);height:var(--button-default-height,44px);justify-content:center;line-height:var(--button-line-height,20px);padding:0;position:relative;text-align:center;transition:opacity .2s;vertical-align:middle}.van-button:before{background-color:#000;border:inherit;border-color:#000;border-radius:inherit;content:" ";height:100%;left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);width:100%}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{background:var(--button-default-background-color,#fff);border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0);color:var(--button-default-color,#323233)}.van-button--primary{background:var(--button-primary-background-color,#07c160);border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160);color:var(--button-primary-color,#fff)}.van-button--info{background:var(--button-info-background-color,#1989fa);border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa);color:var(--button-info-color,#fff)}.van-button--danger{background:var(--button-danger-background-color,#ee0a24);border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24);color:var(--button-danger-color,#fff)}.van-button--warning{background:var(--button-warning-background-color,#ff976a);border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a);color:var(--button-warning-color,#fff)}.van-button--plain{background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:var(--button-warning-background-color,#ff976a)}.van-button--large{height:var(--button-large-height,50px);width:100%}.van-button--normal{font-size:var(--button-normal-font-size,14px);padding:0 15px}.van-button--small{font-size:var(--button-small-font-size,12px);height:var(--button-small-height,30px);min-width:var(--button-small-min-width,60px);padding:0 var(--padding-xs,8px)}.van-button--mini{display:inline-block;font-size:var(--button-mini-font-size,10px);height:var(--button-mini-height,22px);min-width:var(--button-mini-min-width,50px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:flex;width:100%}.van-button--round{border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{line-height:inherit!important;min-width:1em;vertical-align:top}.van-button--hairline{border-width:0;padding-top:1px}.van-button--hairline:after{border-color:inherit;border-radius:calc(var(--button-border-radius, 2px)*2);border-width:1px}.van-button--hairline.van-button--round:after{border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/calendar.wxml b/miniprogram_npm/@vant/weapp/calendar/calendar.wxml new file mode 100644 index 0000000..808f739 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/calendar.wxml @@ -0,0 +1,68 @@ +<view class="van-calendar"> + <header + title="{{ title }}" + showTitle="{{ showTitle }}" + subtitle="{{ subtitle }}" + showSubtitle="{{ showSubtitle }}" + firstDayOfWeek="{{ firstDayOfWeek }}" + bind:click-subtitle="onClickSubtitle" + > + <slot name="title" slot="title"></slot> + </header> + + <scroll-view + class="van-calendar__body" + scroll-y + scroll-into-view="{{ scrollIntoView }}" + > + <month + wx:for="{{ computed.getMonths(minDate, maxDate) }}" + wx:key="index" + id="month{{ index }}" + class="month" + data-date="{{ item }}" + date="{{ item }}" + type="{{ type }}" + color="{{ color }}" + minDate="{{ minDate }}" + maxDate="{{ maxDate }}" + showMark="{{ showMark }}" + formatter="{{ formatter }}" + rowHeight="{{ rowHeight }}" + currentDate="{{ currentDate }}" + showSubtitle="{{ showSubtitle }}" + allowSameDay="{{ allowSameDay }}" + showMonthTitle="{{ index !== 0 || !showSubtitle }}" + firstDayOfWeek="{{ firstDayOfWeek }}" + bind:click="onClickDay" + /> + </scroll-view> + + <view + class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}" + > + <slot name="footer"></slot> + </view> + + <view + class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}" + > + <van-button + wx:if="{{ showConfirm }}" + round + block + type="danger" + color="{{ color }}" + custom-class="van-calendar__confirm" + disabled="{{ computed.getButtonDisabled(type, currentDate) }}" + nativeType="text" + bind:click="onConfirm" + > + {{ + computed.getButtonDisabled(type, currentDate) + ? confirmDisabledText + : confirmText + }} + </van-button> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.d.ts b/miniprogram_npm/@vant/weapp/calendar/components/header/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.js b/miniprogram_npm/@vant/weapp/calendar/components/header/index.js new file mode 100644 index 0000000..544b3a4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.js @@ -0,0 +1,45 @@ +"use strict"; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../../../common/component"); +(0, component_1.VantComponent)({ + props: { + title: { + type: String, + value: '日期选择', + }, + subtitle: String, + showTitle: Boolean, + showSubtitle: Boolean, + firstDayOfWeek: { + type: Number, + observer: 'initWeekDay', + }, + }, + data: { + weekdays: [], + }, + created: function () { + this.initWeekDay(); + }, + methods: { + initWeekDay: function () { + var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六']; + var firstDayOfWeek = this.data.firstDayOfWeek || 0; + this.setData({ + weekdays: __spreadArray(__spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7), true), defaultWeeks.slice(0, firstDayOfWeek), true), + }); + }, + onClickSubtitle: function (event) { + this.$emit('click-subtitle', event); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.json b/miniprogram_npm/@vant/weapp/calendar/components/header/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml new file mode 100644 index 0000000..7e56c83 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml @@ -0,0 +1,16 @@ +<view class="van-calendar__header"> + <block wx:if="{{ showTitle }}"> + <view class="van-calendar__header-title"><slot name="title"></slot></view> + <view class="van-calendar__header-title">{{ title }}</view> + </block> + + <view wx:if="{{ showSubtitle }}" class="van-calendar__header-subtitle" bind:tap="onClickSubtitle"> + {{ subtitle }} + </view> + + <view class="van-calendar__weekdays"> + <view wx:for="{{ weekdays }}" wx:key="index" class="van-calendar__weekday"> + {{ item }} + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss new file mode 100644 index 0000000..272537e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar__header{box-shadow:var(--calendar-header-box-shadow,0 2px 10px hsla(220,1%,50%,.16));flex-shrink:0}.van-calendar__header-subtitle,.van-calendar__header-title{font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:flex}.van-calendar__weekday{flex:1;font-size:var(--calendar-weekdays-font-size,12px);line-height:var(--calendar-weekdays-height,30px);text-align:center} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.d.ts b/miniprogram_npm/@vant/weapp/calendar/components/month/index.d.ts new file mode 100644 index 0000000..3ccf85a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.d.ts @@ -0,0 +1,6 @@ +export interface Day { + date: Date; + type: string; + text: number; + bottomInfo?: string; +} diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.js b/miniprogram_npm/@vant/weapp/calendar/components/month/index.js new file mode 100644 index 0000000..4d137f5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../../../common/component"); +var utils_1 = require("../../utils"); +(0, component_1.VantComponent)({ + props: { + date: { + type: null, + observer: 'setDays', + }, + type: { + type: String, + observer: 'setDays', + }, + color: String, + minDate: { + type: null, + observer: 'setDays', + }, + maxDate: { + type: null, + observer: 'setDays', + }, + showMark: Boolean, + rowHeight: null, + formatter: { + type: null, + observer: 'setDays', + }, + currentDate: { + type: null, + observer: 'setDays', + }, + firstDayOfWeek: { + type: Number, + observer: 'setDays', + }, + allowSameDay: Boolean, + showSubtitle: Boolean, + showMonthTitle: Boolean, + }, + data: { + visible: true, + days: [], + }, + methods: { + onClick: function (event) { + var index = event.currentTarget.dataset.index; + var item = this.data.days[index]; + if (item.type !== 'disabled') { + this.$emit('click', item); + } + }, + setDays: function () { + var days = []; + var startDate = new Date(this.data.date); + var year = startDate.getFullYear(); + var month = startDate.getMonth(); + var totalDay = (0, utils_1.getMonthEndDay)(startDate.getFullYear(), startDate.getMonth() + 1); + for (var day = 1; day <= totalDay; day++) { + var date = new Date(year, month, day); + var type = this.getDayType(date); + var config = { + date: date, + type: type, + text: day, + bottomInfo: this.getBottomInfo(type), + }; + if (this.data.formatter) { + config = this.data.formatter(config); + } + days.push(config); + } + this.setData({ days: days }); + }, + getMultipleDayType: function (day) { + var currentDate = this.data.currentDate; + if (!Array.isArray(currentDate)) { + return ''; + } + var isSelected = function (date) { + return currentDate.some(function (item) { return (0, utils_1.compareDay)(item, date) === 0; }); + }; + if (isSelected(day)) { + var prevDay = (0, utils_1.getPrevDay)(day); + var nextDay = (0, utils_1.getNextDay)(day); + var prevSelected = isSelected(prevDay); + var nextSelected = isSelected(nextDay); + if (prevSelected && nextSelected) { + return 'multiple-middle'; + } + if (prevSelected) { + return 'end'; + } + return nextSelected ? 'start' : 'multiple-selected'; + } + return ''; + }, + getRangeDayType: function (day) { + var _a = this.data, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay; + if (!Array.isArray(currentDate)) { + return ''; + } + var startDay = currentDate[0], endDay = currentDate[1]; + if (!startDay) { + return ''; + } + var compareToStart = (0, utils_1.compareDay)(day, startDay); + if (!endDay) { + return compareToStart === 0 ? 'start' : ''; + } + var compareToEnd = (0, utils_1.compareDay)(day, endDay); + if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) { + return 'start-end'; + } + if (compareToStart === 0) { + return 'start'; + } + if (compareToEnd === 0) { + return 'end'; + } + if (compareToStart > 0 && compareToEnd < 0) { + return 'middle'; + } + return ''; + }, + getDayType: function (day) { + var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, currentDate = _a.currentDate; + if ((0, utils_1.compareDay)(day, minDate) < 0 || (0, utils_1.compareDay)(day, maxDate) > 0) { + return 'disabled'; + } + if (type === 'single') { + return (0, utils_1.compareDay)(day, currentDate) === 0 ? 'selected' : ''; + } + if (type === 'multiple') { + return this.getMultipleDayType(day); + } + /* istanbul ignore else */ + if (type === 'range') { + return this.getRangeDayType(day); + } + return ''; + }, + getBottomInfo: function (type) { + if (this.data.type === 'range') { + if (type === 'start') { + return '开始'; + } + if (type === 'end') { + return '结束'; + } + if (type === 'start-end') { + return '开始/结束'; + } + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.json b/miniprogram_npm/@vant/weapp/calendar/components/month/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml new file mode 100644 index 0000000..0c73b2f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml @@ -0,0 +1,39 @@ +<wxs src="./index.wxs" module="computed"></wxs> +<wxs src="../../../wxs/utils.wxs" module="utils" /> + +<view class="van-calendar__month" style="{{ computed.getMonthStyle(visible, date, rowHeight) }}"> + <view wx:if="{{ showMonthTitle }}" class="van-calendar__month-title"> + {{ computed.formatMonthTitle(date) }} + </view> + + <view wx:if="{{ visible }}" class="van-calendar__days"> + <view wx:if="{{ showMark }}" class="van-calendar__month-mark"> + {{ computed.getMark(date) }} + </view> + + <view + wx:for="{{ days }}" + wx:key="index" + style="{{ computed.getDayStyle(item.type, index, date, rowHeight, color, firstDayOfWeek) }}" + class="{{ utils.bem('calendar__day', [item.type]) }} {{ item.className }}" + data-index="{{ index }}" + bindtap="onClick" + > + <view wx:if="{{ item.type === 'selected' }}" class="van-calendar__selected-day" style="width: {{ rowHeight }}px; height: {{ rowHeight }}px; background: {{ color }}"> + <view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view> + {{ item.text }} + <view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info"> + {{ item.bottomInfo }} + </view> + </view> + + <view wx:else> + <view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view> + {{ item.text }} + <view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info"> + {{ item.bottomInfo }} + </view> + </view> + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs new file mode 100644 index 0000000..55e45a5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs @@ -0,0 +1,71 @@ +/* eslint-disable */ +var utils = require('../../utils.wxs'); + +function getMark(date) { + return getDate(date).getMonth() + 1; +} + +var ROW_HEIGHT = 64; + +function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) { + var style = []; + var current = getDate(date).getDay() || 7; + var offset = current < firstDayOfWeek ? (7 - firstDayOfWeek + current) : + current === 7 && firstDayOfWeek === 0 ? 0 : + (current - firstDayOfWeek); + + if (index === 0) { + style.push(['margin-left', (100 * offset) / 7 + '%']); + } + + if (rowHeight !== ROW_HEIGHT) { + style.push(['height', rowHeight + 'px']); + } + + if (color) { + if ( + type === 'start' || + type === 'end' || + type === 'start-end' || + type === 'multiple-selected' || + type === 'multiple-middle' + ) { + style.push(['background', color]); + } else if (type === 'middle') { + style.push(['color', color]); + } + } + + return style + .map(function(item) { + return item.join(':'); + }) + .join(';'); +} + +function formatMonthTitle(date) { + date = getDate(date); + return date.getFullYear() + '年' + (date.getMonth() + 1) + '月'; +} + +function getMonthStyle(visible, date, rowHeight) { + if (!visible) { + date = getDate(date); + + var totalDay = utils.getMonthEndDay( + date.getFullYear(), + date.getMonth() + 1 + ); + var offset = getDate(date).getDay(); + var padding = Math.ceil((totalDay + offset) / 7) * rowHeight; + + return 'padding-bottom:' + padding + 'px'; + } +} + +module.exports = { + getMark: getMark, + getDayStyle: getDayStyle, + formatMonthTitle: formatMonthTitle, + getMonthStyle: getMonthStyle +}; diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss new file mode 100644 index 0000000..9aee73d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:100%}.van-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.van-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.van-calendar__day,.van-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.van-calendar__day{font-size:var(--calendar-day-font-size,16px);height:var(--calendar-day-height,64px);position:relative;width:14.285%}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#ee0a24);color:var(--calendar-range-edge-color,#fff)}.van-calendar__day--start{border-radius:4px 0 0 4px}.van-calendar__day--end{border-radius:0 4px 4px 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px}.van-calendar__day--middle{color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{background-color:currentColor;bottom:0;content:"";left:0;opacity:var(--calendar-range-middle-background-opacity,.1);position:absolute;right:0;top:0}.van-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.van-calendar__bottom-info,.van-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,54px);width:var(--calendar-selected-day-size,54px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/index.d.ts b/miniprogram_npm/@vant/weapp/calendar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/calendar/index.js b/miniprogram_npm/@vant/weapp/calendar/index.js new file mode 100644 index 0000000..31989f0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.js @@ -0,0 +1,360 @@ +"use strict"; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var utils_1 = require("./utils"); +var toast_1 = __importDefault(require("../toast/toast")); +var utils_2 = require("../common/utils"); +var initialMinDate = (0, utils_1.getToday)().getTime(); +var initialMaxDate = (function () { + var now = (0, utils_1.getToday)(); + return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime(); +})(); +var getTime = function (date) { + return date instanceof Date ? date.getTime() : date; +}; +(0, component_1.VantComponent)({ + props: { + title: { + type: String, + value: '日期选择', + }, + color: String, + show: { + type: Boolean, + observer: function (val) { + if (val) { + this.initRect(); + this.scrollIntoView(); + } + }, + }, + formatter: null, + confirmText: { + type: String, + value: '确定', + }, + confirmDisabledText: { + type: String, + value: '确定', + }, + rangePrompt: String, + showRangePrompt: { + type: Boolean, + value: true, + }, + defaultDate: { + type: null, + observer: function (val) { + this.setData({ currentDate: val }); + this.scrollIntoView(); + }, + }, + allowSameDay: Boolean, + type: { + type: String, + value: 'single', + observer: 'reset', + }, + minDate: { + type: Number, + value: initialMinDate, + }, + maxDate: { + type: Number, + value: initialMaxDate, + }, + position: { + type: String, + value: 'bottom', + }, + rowHeight: { + type: null, + value: utils_1.ROW_HEIGHT, + }, + round: { + type: Boolean, + value: true, + }, + poppable: { + type: Boolean, + value: true, + }, + showMark: { + type: Boolean, + value: true, + }, + showTitle: { + type: Boolean, + value: true, + }, + showConfirm: { + type: Boolean, + value: true, + }, + showSubtitle: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + maxRange: { + type: null, + value: null, + }, + firstDayOfWeek: { + type: Number, + value: 0, + }, + readonly: Boolean, + }, + data: { + subtitle: '', + currentDate: null, + scrollIntoView: '', + }, + created: function () { + this.setData({ + currentDate: this.getInitialDate(this.data.defaultDate), + }); + }, + mounted: function () { + if (this.data.show || !this.data.poppable) { + this.initRect(); + this.scrollIntoView(); + } + }, + methods: { + reset: function () { + this.setData({ currentDate: this.getInitialDate() }); + this.scrollIntoView(); + }, + initRect: function () { + var _this = this; + if (this.contentObserver != null) { + this.contentObserver.disconnect(); + } + var contentObserver = this.createIntersectionObserver({ + thresholds: [0, 0.1, 0.9, 1], + observeAll: true, + }); + this.contentObserver = contentObserver; + contentObserver.relativeTo('.van-calendar__body'); + contentObserver.observe('.month', function (res) { + if (res.boundingClientRect.top <= res.relativeRect.top) { + // @ts-ignore + _this.setData({ subtitle: (0, utils_1.formatMonthTitle)(res.dataset.date) }); + } + }); + }, + limitDateRange: function (date, minDate, maxDate) { + if (minDate === void 0) { minDate = null; } + if (maxDate === void 0) { maxDate = null; } + minDate = minDate || this.data.minDate; + maxDate = maxDate || this.data.maxDate; + if ((0, utils_1.compareDay)(date, minDate) === -1) { + return minDate; + } + if ((0, utils_1.compareDay)(date, maxDate) === 1) { + return maxDate; + } + return date; + }, + getInitialDate: function (defaultDate) { + var _this = this; + if (defaultDate === void 0) { defaultDate = null; } + var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate; + var now = (0, utils_1.getToday)().getTime(); + if (type === 'range') { + if (!Array.isArray(defaultDate)) { + defaultDate = []; + } + var _b = defaultDate || [], startDay = _b[0], endDay = _b[1]; + var start = this.limitDateRange(startDay || now, minDate, (0, utils_1.getPrevDay)(new Date(maxDate)).getTime()); + var end = this.limitDateRange(endDay || now, (0, utils_1.getNextDay)(new Date(minDate)).getTime()); + return [start, end]; + } + if (type === 'multiple') { + if (Array.isArray(defaultDate)) { + return defaultDate.map(function (date) { return _this.limitDateRange(date); }); + } + return [this.limitDateRange(now)]; + } + if (!defaultDate || Array.isArray(defaultDate)) { + defaultDate = now; + } + return this.limitDateRange(defaultDate); + }, + scrollIntoView: function () { + var _this = this; + (0, utils_2.requestAnimationFrame)(function () { + var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate; + // @ts-ignore + var targetDate = type === 'single' ? currentDate : currentDate[0]; + var displayed = show || !poppable; + if (!targetDate || !displayed) { + return; + } + var months = (0, utils_1.getMonths)(minDate, maxDate); + months.some(function (month, index) { + if ((0, utils_1.compareMonth)(month, targetDate) === 0) { + _this.setData({ scrollIntoView: "month".concat(index) }); + return true; + } + return false; + }); + }); + }, + onOpen: function () { + this.$emit('open'); + }, + onOpened: function () { + this.$emit('opened'); + }, + onClose: function () { + this.$emit('close'); + }, + onClosed: function () { + this.$emit('closed'); + }, + onClickDay: function (event) { + if (this.data.readonly) { + return; + } + var date = event.detail.date; + var _a = this.data, type = _a.type, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay; + if (type === 'range') { + // @ts-ignore + var startDay_1 = currentDate[0], endDay = currentDate[1]; + if (startDay_1 && !endDay) { + var compareToStart = (0, utils_1.compareDay)(date, startDay_1); + if (compareToStart === 1) { + var days_1 = this.selectComponent('.month').data.days; + days_1.some(function (day, index) { + var isDisabled = day.type === 'disabled' && + getTime(startDay_1) < getTime(day.date) && + getTime(day.date) < getTime(date); + if (isDisabled) { + (date = days_1[index - 1].date); + } + return isDisabled; + }); + this.select([startDay_1, date], true); + } + else if (compareToStart === -1) { + this.select([date, null]); + } + else if (allowSameDay) { + this.select([date, date]); + } + } + else { + this.select([date, null]); + } + } + else if (type === 'multiple') { + var selectedIndex_1; + // @ts-ignore + var selected = currentDate.some(function (dateItem, index) { + var equal = (0, utils_1.compareDay)(dateItem, date) === 0; + if (equal) { + selectedIndex_1 = index; + } + return equal; + }); + if (selected) { + // @ts-ignore + var cancelDate = currentDate.splice(selectedIndex_1, 1); + this.setData({ currentDate: currentDate }); + this.unselect(cancelDate); + } + else { + // @ts-ignore + this.select(__spreadArray(__spreadArray([], currentDate, true), [date], false)); + } + } + else { + this.select(date, true); + } + }, + unselect: function (dateArray) { + var date = dateArray[0]; + if (date) { + this.$emit('unselect', (0, utils_1.copyDates)(date)); + } + }, + select: function (date, complete) { + if (complete && this.data.type === 'range') { + var valid = this.checkRange(date); + if (!valid) { + // auto selected to max range if showConfirm + if (this.data.showConfirm) { + this.emit([ + date[0], + (0, utils_1.getDayByOffset)(date[0], this.data.maxRange - 1), + ]); + } + else { + this.emit(date); + } + return; + } + } + this.emit(date); + if (complete && !this.data.showConfirm) { + this.onConfirm(); + } + }, + emit: function (date) { + this.setData({ + currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), + }); + this.$emit('select', (0, utils_1.copyDates)(date)); + }, + checkRange: function (date) { + var _a = this.data, maxRange = _a.maxRange, rangePrompt = _a.rangePrompt, showRangePrompt = _a.showRangePrompt; + if (maxRange && (0, utils_1.calcDateNum)(date) > maxRange) { + if (showRangePrompt) { + (0, toast_1.default)({ + context: this, + message: rangePrompt || "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ".concat(maxRange, " \u5929"), + }); + } + this.$emit('over-range'); + return false; + } + return true; + }, + onConfirm: function () { + var _this = this; + if (this.data.type === 'range' && + !this.checkRange(this.data.currentDate)) { + return; + } + wx.nextTick(function () { + // @ts-ignore + _this.$emit('confirm', (0, utils_1.copyDates)(_this.data.currentDate)); + }); + }, + onClickSubtitle: function (event) { + this.$emit('click-subtitle', event); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/calendar/index.json b/miniprogram_npm/@vant/weapp/calendar/index.json new file mode 100644 index 0000000..397d5ae --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "usingComponents": { + "header": "./components/header/index", + "month": "./components/month/index", + "van-button": "../button/index", + "van-popup": "../popup/index", + "van-toast": "../toast/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/calendar/index.wxml b/miniprogram_npm/@vant/weapp/calendar/index.wxml new file mode 100644 index 0000000..bc8bcfd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.wxml @@ -0,0 +1,25 @@ +<wxs src="./index.wxs" module="computed" /> +<wxs src="../wxs/utils.wxs" module="utils" /> + +<import src="./calendar.wxml" /> + +<van-popup + wx:if="{{ poppable }}" + custom-class="van-calendar__popup--{{ position }}" + close-icon-class="van-calendar__close-icon" + show="{{ show }}" + round="{{ round }}" + position="{{ position }}" + closeable="{{ showTitle || showSubtitle }}" + close-on-click-overlay="{{ closeOnClickOverlay }}" + bind:enter="onOpen" + bind:close="onClose" + bind:after-enter="onOpened" + bind:after-leave="onClosed" +> + <include src="./calendar.wxml" /> +</van-popup> + +<include wx:else src="./calendar.wxml" /> + +<van-toast id="van-toast" /> diff --git a/miniprogram_npm/@vant/weapp/calendar/index.wxs b/miniprogram_npm/@vant/weapp/calendar/index.wxs new file mode 100644 index 0000000..0c570fc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.wxs @@ -0,0 +1,38 @@ +/* eslint-disable */ +var utils = require('./utils.wxs'); + +function getMonths(minDate, maxDate) { + var months = []; + var cursor = getDate(minDate); + + cursor.setDate(1); + cursor.setMinutes(cursor.getMinutes() - cursor.getTimezoneOffset()); + + do { + months.push(cursor.getTime()); + cursor.setMonth(cursor.getMonth() + 1); + } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1); + + return months; +} + +function getButtonDisabled(type, currentDate) { + if (currentDate == null) { + return true; + } + + if (type === 'range') { + return !currentDate[0] || !currentDate[1]; + } + + if (type === 'multiple') { + return !currentDate.length; + } + + return !currentDate; +} + +module.exports = { + getMonths: getMonths, + getButtonDisabled: getButtonDisabled +}; diff --git a/miniprogram_npm/@vant/weapp/calendar/index.wxss b/miniprogram_npm/@vant/weapp/calendar/index.wxss new file mode 100644 index 0000000..05df518 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/utils.d.ts b/miniprogram_npm/@vant/weapp/calendar/utils.d.ts new file mode 100644 index 0000000..eb710c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/utils.d.ts @@ -0,0 +1,12 @@ +export declare const ROW_HEIGHT = 64; +export declare function formatMonthTitle(date: Date): string; +export declare function compareMonth(date1: Date | number, date2: Date | number): 1 | -1 | 0; +export declare function compareDay(day1: Date | number, day2: Date | number): 1 | -1 | 0; +export declare function getDayByOffset(date: Date, offset: number): Date; +export declare function getPrevDay(date: Date): Date; +export declare function getNextDay(date: Date): Date; +export declare function getToday(): Date; +export declare function calcDateNum(date: [Date, Date]): number; +export declare function copyDates(dates: Date | Date[]): Date | Date[]; +export declare function getMonthEndDay(year: number, month: number): number; +export declare function getMonths(minDate: number, maxDate: number): number[]; diff --git a/miniprogram_npm/@vant/weapp/calendar/utils.js b/miniprogram_npm/@vant/weapp/calendar/utils.js new file mode 100644 index 0000000..c9e5df7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/utils.js @@ -0,0 +1,97 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0; +exports.ROW_HEIGHT = 64; +function formatMonthTitle(date) { + if (!(date instanceof Date)) { + date = new Date(date); + } + return "".concat(date.getFullYear(), "\u5E74").concat(date.getMonth() + 1, "\u6708"); +} +exports.formatMonthTitle = formatMonthTitle; +function compareMonth(date1, date2) { + if (!(date1 instanceof Date)) { + date1 = new Date(date1); + } + if (!(date2 instanceof Date)) { + date2 = new Date(date2); + } + var year1 = date1.getFullYear(); + var year2 = date2.getFullYear(); + var month1 = date1.getMonth(); + var month2 = date2.getMonth(); + if (year1 === year2) { + return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; + } + return year1 > year2 ? 1 : -1; +} +exports.compareMonth = compareMonth; +function compareDay(day1, day2) { + if (!(day1 instanceof Date)) { + day1 = new Date(day1); + } + if (!(day2 instanceof Date)) { + day2 = new Date(day2); + } + var compareMonthResult = compareMonth(day1, day2); + if (compareMonthResult === 0) { + var date1 = day1.getDate(); + var date2 = day2.getDate(); + return date1 === date2 ? 0 : date1 > date2 ? 1 : -1; + } + return compareMonthResult; +} +exports.compareDay = compareDay; +function getDayByOffset(date, offset) { + date = new Date(date); + date.setDate(date.getDate() + offset); + return date; +} +exports.getDayByOffset = getDayByOffset; +function getPrevDay(date) { + return getDayByOffset(date, -1); +} +exports.getPrevDay = getPrevDay; +function getNextDay(date) { + return getDayByOffset(date, 1); +} +exports.getNextDay = getNextDay; +function getToday() { + var today = new Date(); + today.setHours(0, 0, 0, 0); + return today; +} +exports.getToday = getToday; +function calcDateNum(date) { + var day1 = new Date(date[0]).getTime(); + var day2 = new Date(date[1]).getTime(); + return (day2 - day1) / (1000 * 60 * 60 * 24) + 1; +} +exports.calcDateNum = calcDateNum; +function copyDates(dates) { + if (Array.isArray(dates)) { + return dates.map(function (date) { + if (date === null) { + return date; + } + return new Date(date); + }); + } + return new Date(dates); +} +exports.copyDates = copyDates; +function getMonthEndDay(year, month) { + return 32 - new Date(year, month - 1, 32).getDate(); +} +exports.getMonthEndDay = getMonthEndDay; +function getMonths(minDate, maxDate) { + var months = []; + var cursor = new Date(minDate); + cursor.setDate(1); + do { + months.push(cursor.getTime()); + cursor.setMonth(cursor.getMonth() + 1); + } while (compareMonth(cursor, maxDate) !== 1); + return months; +} +exports.getMonths = getMonths; diff --git a/miniprogram_npm/@vant/weapp/calendar/utils.wxs b/miniprogram_npm/@vant/weapp/calendar/utils.wxs new file mode 100644 index 0000000..e57f6b3 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/utils.wxs @@ -0,0 +1,25 @@ +/* eslint-disable */ +function getMonthEndDay(year, month) { + return 32 - getDate(year, month - 1, 32).getDate(); +} + +function compareMonth(date1, date2) { + date1 = getDate(date1); + date2 = getDate(date2); + + var year1 = date1.getFullYear(); + var year2 = date2.getFullYear(); + var month1 = date1.getMonth(); + var month2 = date2.getMonth(); + + if (year1 === year2) { + return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; + } + + return year1 > year2 ? 1 : -1; +} + +module.exports = { + getMonthEndDay: getMonthEndDay, + compareMonth: compareMonth +}; diff --git a/miniprogram_npm/@vant/weapp/card/index.d.ts b/miniprogram_npm/@vant/weapp/card/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/card/index.js b/miniprogram_npm/@vant/weapp/card/index.js new file mode 100644 index 0000000..2815655 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var link_1 = require("../mixins/link"); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + classes: [ + 'num-class', + 'desc-class', + 'thumb-class', + 'title-class', + 'price-class', + 'origin-price-class', + ], + mixins: [link_1.link], + props: { + tag: String, + num: String, + desc: String, + thumb: String, + title: String, + price: { + type: String, + observer: 'updatePrice', + }, + centered: Boolean, + lazyLoad: Boolean, + thumbLink: String, + originPrice: String, + thumbMode: { + type: String, + value: 'aspectFit', + }, + currency: { + type: String, + value: '¥', + }, + }, + methods: { + updatePrice: function () { + var price = this.data.price; + var priceArr = price.toString().split('.'); + this.setData({ + integerStr: priceArr[0], + decimalStr: priceArr[1] ? ".".concat(priceArr[1]) : '', + }); + }, + onClickThumb: function () { + this.jumpLink('thumbLink'); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/card/index.json b/miniprogram_npm/@vant/weapp/card/index.json new file mode 100644 index 0000000..e917407 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-tag": "../tag/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/card/index.wxml b/miniprogram_npm/@vant/weapp/card/index.wxml new file mode 100644 index 0000000..62173e4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.wxml @@ -0,0 +1,56 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="custom-class van-card"> + <view class="{{ utils.bem('card__header', { center: centered }) }}"> + <view class="van-card__thumb" bind:tap="onClickThumb"> + <image + wx:if="{{ thumb }}" + src="{{ thumb }}" + mode="{{ thumbMode }}" + lazy-load="{{ lazyLoad }}" + class="van-card__img thumb-class" + /> + <slot wx:else name="thumb" /> + <van-tag + wx:if="{{ tag }}" + mark + type="danger" + custom-class="van-card__tag" + > + {{ tag }} + </van-tag> + <slot wx:else name="tag" /> + </view> + + <view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}"> + <view> + <view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view> + <slot wx:else name="title" /> + + <view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view> + <slot wx:else name="desc" /> + + <slot name="tags" /> + </view> + + <view class="van-card__bottom"> + <slot name="price-top" /> + <view wx:if="{{ price || price === 0 }}" class="van-card__price price-class"> + <text>{{ currency }}</text> + <text class="van-card__price-integer">{{ integerStr }}</text> + <text class="van-card__price-decimal">{{ decimalStr }}</text> + </view> + <slot wx:else name="price" /> + <view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view> + <slot wx:else name="origin-price" /> + <view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view> + <slot wx:else name="num" /> + <slot name="bottom" /> + </view> + </view> + </view> + + <view class="van-card__footer"> + <slot name="footer" /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/card/index.wxss b/miniprogram_npm/@vant/weapp/card/index.wxss new file mode 100644 index 0000000..0f4d7c5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-card{background-color:var(--card-background-color,#fafafa);box-sizing:border-box;color:var(--card-text-color,#323233);font-size:var(--card-font-size,12px);padding:var(--card-padding,8px 16px);position:relative}.van-card__header{display:flex}.van-card__header--center{align-items:center;justify-content:center}.van-card__thumb{flex:none;height:var(--card-thumb-size,88px);margin-right:var(--padding-xs,8px);position:relative;width:var(--card-thumb-size,88px)}.van-card__thumb:empty{display:none}.van-card__img{border-radius:8px;height:100%;width:100%}.van-card__content{display:flex;flex:1;flex-direction:column;justify-content:space-between;min-height:var(--card-thumb-size,88px);min-width:0;position:relative}.van-card__content--center{justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:var(--card-title-line-height,16px)}.van-card__desc{color:var(--card-desc-color,#646566);line-height:var(--card-desc-line-height,20px)}.van-card__bottom{line-height:20px}.van-card__price{color:var(--card-price-color,#ee0a24);display:inline-block;font-size:var(--card-price-font-size,12px);font-weight:700}.van-card__price-integer{font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{color:var(--card-origin-price-color,#646566);display:inline-block;font-size:var(--card-origin-price-font-size,10px);margin-left:5px;text-decoration:line-through}.van-card__num{float:right}.van-card__tag{left:0;position:absolute!important;top:2px}.van-card__footer{flex:none;text-align:right;width:100%} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.d.ts b/miniprogram_npm/@vant/weapp/cell-group/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.js b/miniprogram_npm/@vant/weapp/cell-group/index.js new file mode 100644 index 0000000..34a93a6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + title: String, + border: { + type: Boolean, + value: true, + }, + inset: Boolean, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.json b/miniprogram_npm/@vant/weapp/cell-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.wxml b/miniprogram_npm/@vant/weapp/cell-group/index.wxml new file mode 100644 index 0000000..311e064 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.wxml @@ -0,0 +1,11 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + wx:if="{{ title }}" + class="{{ utils.bem('cell-group__title', { inset }) }}" +> + {{ title }} +</view> +<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.wxss b/miniprogram_npm/@vant/weapp/cell-group/index.wxss new file mode 100644 index 0000000..08b252f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell-group--inset{border-radius:var(--cell-group-inset-border-radius,8px);margin:var(--cell-group-inset-padding,0 16px);overflow:hidden}.van-cell-group__title{color:var(--cell-group-title-color,#969799);font-size:var(--cell-group-title-font-size,14px);line-height:var(--cell-group-title-line-height,16px);padding:var(--cell-group-title-padding,16px 16px 8px)}.van-cell-group__title--inset{padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/cell/index.d.ts b/miniprogram_npm/@vant/weapp/cell/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/cell/index.js b/miniprogram_npm/@vant/weapp/cell/index.js new file mode 100644 index 0000000..80f3039 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var link_1 = require("../mixins/link"); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + classes: [ + 'title-class', + 'label-class', + 'value-class', + 'right-icon-class', + 'hover-class', + ], + mixins: [link_1.link], + props: { + title: null, + value: null, + icon: String, + size: String, + label: String, + center: Boolean, + isLink: Boolean, + required: Boolean, + clickable: Boolean, + titleWidth: String, + customStyle: String, + arrowDirection: String, + useLabelSlot: Boolean, + border: { + type: Boolean, + value: true, + }, + titleStyle: String, + }, + methods: { + onClick: function (event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/cell/index.json b/miniprogram_npm/@vant/weapp/cell/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/cell/index.wxml b/miniprogram_npm/@vant/weapp/cell/index.wxml new file mode 100644 index 0000000..8387c3c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.wxml @@ -0,0 +1,47 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}" + hover-class="van-cell--hover hover-class" + hover-stay-time="70" + style="{{ customStyle }}" + bind:tap="onClick" +> + <van-icon + wx:if="{{ icon }}" + name="{{ icon }}" + class="van-cell__left-icon-wrap" + custom-class="van-cell__left-icon" + /> + <slot wx:else name="icon" /> + + <view + style="{{ computed.titleStyle({ titleWidth, titleStyle }) }}" + class="van-cell__title title-class" + > + + <block wx:if="{{ title }}">{{ title }}</block> + <slot wx:else name="title" /> + + <view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class"> + <slot wx:if="{{ useLabelSlot }}" name="label" /> + <block wx:elif="{{ label }}">{{ label }}</block> + </view> + </view> + + <view class="van-cell__value value-class"> + <block wx:if="{{ value || value === 0 }}">{{ value }}</block> + <slot wx:else /> + </view> + + <van-icon + wx:if="{{ isLink }}" + name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}" + class="van-cell__right-icon-wrap right-icon-class" + custom-class="van-cell__right-icon" + /> + <slot wx:else name="right-icon" /> + + <slot name="extra" /> +</view> diff --git a/miniprogram_npm/@vant/weapp/cell/index.wxs b/miniprogram_npm/@vant/weapp/cell/index.wxs new file mode 100644 index 0000000..e3500c4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.wxs @@ -0,0 +1,17 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function titleStyle(data) { + return style([ + { + 'max-width': addUnit(data.titleWidth), + 'min-width': addUnit(data.titleWidth), + }, + data.titleStyle, + ]); +} + +module.exports = { + titleStyle: titleStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/cell/index.wxss b/miniprogram_npm/@vant/weapp/cell/index.wxss new file mode 100644 index 0000000..1802f8e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell{background-color:var(--cell-background-color,#fff);box-sizing:border-box;color:var(--cell-text-color,#323233);display:flex;font-size:var(--cell-font-size,14px);line-height:var(--cell-line-height,24px);padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);position:relative;width:100%}.van-cell:after{border-bottom:1px solid #ebedf0;bottom:0;box-sizing:border-box;content:" ";left:16px;pointer-events:none;position:absolute;right:16px;transform:scaleY(.5);transform-origin:center}.van-cell--borderless:after{display:none}.van-cell-group{background-color:var(--cell-background-color,#fff)}.van-cell__label{color:var(--cell-label-color,#969799);font-size:var(--cell-label-font-size,12px);line-height:var(--cell-label-line-height,18px);margin-top:var(--cell-label-margin-top,3px)}.van-cell__value{color:var(--cell-value-color,#969799);overflow:hidden;text-align:right;vertical-align:middle}.van-cell__title,.van-cell__value{flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{align-items:center;display:flex;font-size:var(--cell-icon-size,16px);height:var(--cell-line-height,24px)}.van-cell__left-icon-wrap{margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{color:var(--cell-right-icon-color,#969799);margin-left:var(--padding-base,4px)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{color:var(--cell-required-color,#ee0a24);content:"*";font-size:var(--cell-font-size,14px);left:var(--padding-xs,8px);position:absolute}.van-cell--center{align-items:center}.van-cell--large{padding-bottom:var(--cell-large-vertical-padding,12px);padding-top:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:var(--cell-large-label-font-size,14px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.d.ts b/miniprogram_npm/@vant/weapp/checkbox-group/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.js b/miniprogram_npm/@vant/weapp/checkbox-group/index.js new file mode 100644 index 0000000..80c93a1 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var relation_1 = require("../common/relation"); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useChildren)('checkbox', function (target) { + this.updateChild(target); + }), + props: { + max: Number, + value: { + type: Array, + observer: 'updateChildren', + }, + disabled: { + type: Boolean, + observer: 'updateChildren', + }, + direction: { + type: String, + value: 'vertical', + }, + }, + methods: { + updateChildren: function () { + var _this = this; + this.children.forEach(function (child) { return _this.updateChild(child); }); + }, + updateChild: function (child) { + var _a = this.data, value = _a.value, disabled = _a.disabled, direction = _a.direction; + child.setData({ + value: value.indexOf(child.data.name) !== -1, + parentDisabled: disabled, + direction: direction, + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.json b/miniprogram_npm/@vant/weapp/checkbox-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.wxml b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxml new file mode 100644 index 0000000..638bf9d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxml @@ -0,0 +1,5 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="{{ utils.bem('checkbox-group', [{ horizontal: direction === 'horizontal' }]) }}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.wxss b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxss new file mode 100644 index 0000000..c5666d7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox-group--horizontal{display:flex;flex-wrap:wrap} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.d.ts b/miniprogram_npm/@vant/weapp/checkbox/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.js b/miniprogram_npm/@vant/weapp/checkbox/index.js new file mode 100644 index 0000000..6247365 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var relation_1 = require("../common/relation"); +var component_1 = require("../common/component"); +function emit(target, value) { + target.$emit('input', value); + target.$emit('change', value); +} +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useParent)('checkbox-group'), + classes: ['icon-class', 'label-class'], + props: { + value: Boolean, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right', + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round', + }, + iconSize: { + type: null, + value: 20, + }, + }, + data: { + parentDisabled: false, + direction: 'vertical', + }, + methods: { + emitChange: function (value) { + if (this.parent) { + this.setParentValue(this.parent, value); + } + else { + emit(this, value); + } + }, + toggle: function () { + var _a = this.data, parentDisabled = _a.parentDisabled, disabled = _a.disabled, value = _a.value; + if (!disabled && !parentDisabled) { + this.emitChange(!value); + } + }, + onClickLabel: function () { + var _a = this.data, labelDisabled = _a.labelDisabled, parentDisabled = _a.parentDisabled, disabled = _a.disabled, value = _a.value; + if (!disabled && !labelDisabled && !parentDisabled) { + this.emitChange(!value); + } + }, + setParentValue: function (parent, value) { + var parentValue = parent.data.value.slice(); + var name = this.data.name; + var max = parent.data.max; + if (value) { + if (max && parentValue.length >= max) { + return; + } + if (parentValue.indexOf(name) === -1) { + parentValue.push(name); + emit(parent, parentValue); + } + } + else { + var index = parentValue.indexOf(name); + if (index !== -1) { + parentValue.splice(index, 1); + emit(parent, parentValue); + } + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.json b/miniprogram_npm/@vant/weapp/checkbox/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.wxml b/miniprogram_npm/@vant/weapp/checkbox/index.wxml new file mode 100644 index 0000000..39a7bb0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.wxml @@ -0,0 +1,31 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="{{ utils.bem('checkbox', [{ horizontal: direction === 'horizontal' }]) }} custom-class"> + <view + wx:if="{{ labelPosition === 'left' }}" + class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" + bindtap="onClickLabel" + > + <slot /> + </view> + <view class="van-checkbox__icon-wrap" bindtap="toggle"> + <slot wx:if="{{ useIconSlot }}" name="icon" /> + <van-icon + wx:else + name="success" + size="0.8em" + class="{{ utils.bem('checkbox__icon', [shape, { disabled: disabled || parentDisabled, checked: value }]) }}" + style="{{ computed.iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) }}" + custom-class="icon-class" + custom-style="line-height: 1.25em;" + /> + </view> + <view + wx:if="{{ labelPosition === 'right' }}" + class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" + bindtap="onClickLabel" + > + <slot /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.wxs b/miniprogram_npm/@vant/weapp/checkbox/index.wxs new file mode 100644 index 0000000..eb9c772 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.wxs @@ -0,0 +1,20 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) { + var styles = { + 'font-size': addUnit(iconSize), + }; + + if (checkedColor && value && !disabled && !parentDisabled) { + styles['border-color'] = checkedColor; + styles['background-color'] = checkedColor; + } + + return style(styles); +} + +module.exports = { + iconStyle: iconStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.wxss b/miniprogram_npm/@vant/weapp/checkbox/index.wxss new file mode 100644 index 0000000..da2272a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox{align-items:center;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{align-items:center;border:1px solid var(--checkbox-border-color,#c8c9cc);box-sizing:border-box;color:transparent;display:flex;font-size:var(--checkbox-size,20px);height:1em;justify-content:center;text-align:center;transition-duration:var(--checkbox-transition-duration,.2s);transition-property:color,border-color,background-color;width:1em}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:var(--checkbox-checked-icon-color,#1989fa);color:#fff}.van-checkbox__icon--disabled{background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;color:var(--checkbox-label-color,#323233);padding-left:var(--checkbox-label-margin,10px)}.van-checkbox__label--left{float:left;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/circle/canvas.d.ts b/miniprogram_npm/@vant/weapp/circle/canvas.d.ts new file mode 100644 index 0000000..15268c9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/canvas.d.ts @@ -0,0 +1,4 @@ +/// <reference types="miniprogram-api-typings" /> +declare type CanvasContext = WechatMiniprogram.CanvasContext; +export declare function adaptor(ctx: CanvasContext & Record<string, unknown>): CanvasContext; +export {}; diff --git a/miniprogram_npm/@vant/weapp/circle/canvas.js b/miniprogram_npm/@vant/weapp/circle/canvas.js new file mode 100644 index 0000000..d81df74 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/canvas.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.adaptor = void 0; +function adaptor(ctx) { + // @ts-ignore + return Object.assign(ctx, { + setStrokeStyle: function (val) { + ctx.strokeStyle = val; + }, + setLineWidth: function (val) { + ctx.lineWidth = val; + }, + setLineCap: function (val) { + ctx.lineCap = val; + }, + setFillStyle: function (val) { + ctx.fillStyle = val; + }, + setFontSize: function (val) { + ctx.font = String(val); + }, + setGlobalAlpha: function (val) { + ctx.globalAlpha = val; + }, + setLineJoin: function (val) { + ctx.lineJoin = val; + }, + setTextAlign: function (val) { + ctx.textAlign = val; + }, + setMiterLimit: function (val) { + ctx.miterLimit = val; + }, + setShadow: function (offsetX, offsetY, blur, color) { + ctx.shadowOffsetX = offsetX; + ctx.shadowOffsetY = offsetY; + ctx.shadowBlur = blur; + ctx.shadowColor = color; + }, + setTextBaseline: function (val) { + ctx.textBaseline = val; + }, + createCircularGradient: function () { }, + draw: function () { }, + }); +} +exports.adaptor = adaptor; diff --git a/miniprogram_npm/@vant/weapp/circle/index.d.ts b/miniprogram_npm/@vant/weapp/circle/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/circle/index.js b/miniprogram_npm/@vant/weapp/circle/index.js new file mode 100644 index 0000000..9037e1c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.js @@ -0,0 +1,203 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var color_1 = require("../common/color"); +var component_1 = require("../common/component"); +var utils_1 = require("../common/utils"); +var validator_1 = require("../common/validator"); +var version_1 = require("../common/version"); +var canvas_1 = require("./canvas"); +function format(rate) { + return Math.min(Math.max(rate, 0), 100); +} +var PERIMETER = 2 * Math.PI; +var BEGIN_ANGLE = -Math.PI / 2; +var STEP = 1; +(0, component_1.VantComponent)({ + props: { + text: String, + lineCap: { + type: String, + value: 'round', + }, + value: { + type: Number, + value: 0, + observer: 'reRender', + }, + speed: { + type: Number, + value: 50, + }, + size: { + type: Number, + value: 100, + observer: function () { + this.drawCircle(this.currentValue); + }, + }, + fill: String, + layerColor: { + type: String, + value: color_1.WHITE, + }, + color: { + type: null, + value: color_1.BLUE, + observer: function () { + var _this = this; + this.setHoverColor().then(function () { + _this.drawCircle(_this.currentValue); + }); + }, + }, + type: { + type: String, + value: '', + }, + strokeWidth: { + type: Number, + value: 4, + }, + clockwise: { + type: Boolean, + value: true, + }, + }, + data: { + hoverColor: color_1.BLUE, + }, + methods: { + getContext: function () { + var _this = this; + var _a = this.data, type = _a.type, size = _a.size; + if (type === '' || !(0, version_1.canIUseCanvas2d)()) { + var ctx = wx.createCanvasContext('van-circle', this); + return Promise.resolve(ctx); + } + var dpr = (0, utils_1.getSystemInfoSync)().pixelRatio; + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(_this) + .select('#van-circle') + .node() + .exec(function (res) { + var canvas = res[0].node; + var ctx = canvas.getContext(type); + if (!_this.inited) { + _this.inited = true; + canvas.width = size * dpr; + canvas.height = size * dpr; + ctx.scale(dpr, dpr); + } + resolve((0, canvas_1.adaptor)(ctx)); + }); + }); + }, + setHoverColor: function () { + var _this = this; + var _a = this.data, color = _a.color, size = _a.size; + if ((0, validator_1.isObj)(color)) { + return this.getContext().then(function (context) { + var LinearColor = context.createLinearGradient(size, 0, 0, 0); + Object.keys(color) + .sort(function (a, b) { return parseFloat(a) - parseFloat(b); }) + .map(function (key) { + return LinearColor.addColorStop(parseFloat(key) / 100, color[key]); + }); + _this.hoverColor = LinearColor; + }); + } + this.hoverColor = color; + return Promise.resolve(); + }, + presetCanvas: function (context, strokeStyle, beginAngle, endAngle, fill) { + var _a = this.data, strokeWidth = _a.strokeWidth, lineCap = _a.lineCap, clockwise = _a.clockwise, size = _a.size; + var position = size / 2; + var radius = position - strokeWidth / 2; + context.setStrokeStyle(strokeStyle); + context.setLineWidth(strokeWidth); + context.setLineCap(lineCap); + context.beginPath(); + context.arc(position, position, radius, beginAngle, endAngle, !clockwise); + context.stroke(); + if (fill) { + context.setFillStyle(fill); + context.fill(); + } + }, + renderLayerCircle: function (context) { + var _a = this.data, layerColor = _a.layerColor, fill = _a.fill; + this.presetCanvas(context, layerColor, 0, PERIMETER, fill); + }, + renderHoverCircle: function (context, formatValue) { + var clockwise = this.data.clockwise; + // 结束角度 + var progress = PERIMETER * (formatValue / 100); + var endAngle = clockwise + ? BEGIN_ANGLE + progress + : 3 * Math.PI - (BEGIN_ANGLE + progress); + this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); + }, + drawCircle: function (currentValue) { + var _this = this; + var size = this.data.size; + this.getContext().then(function (context) { + context.clearRect(0, 0, size, size); + _this.renderLayerCircle(context); + var formatValue = format(currentValue); + if (formatValue !== 0) { + _this.renderHoverCircle(context, formatValue); + } + context.draw(); + }); + }, + reRender: function () { + var _this = this; + // tofector 动画暂时没有想到好的解决方案 + var _a = this.data, value = _a.value, speed = _a.speed; + if (speed <= 0 || speed > 1000) { + this.drawCircle(value); + return; + } + this.clearMockInterval(); + this.currentValue = this.currentValue || 0; + var run = function () { + _this.interval = setTimeout(function () { + if (_this.currentValue !== value) { + if (Math.abs(_this.currentValue - value) < STEP) { + _this.currentValue = value; + } + else if (_this.currentValue < value) { + _this.currentValue += STEP; + } + else { + _this.currentValue -= STEP; + } + _this.drawCircle(_this.currentValue); + run(); + } + else { + _this.clearMockInterval(); + } + }, 1000 / speed); + }; + run(); + }, + clearMockInterval: function () { + if (this.interval) { + clearTimeout(this.interval); + this.interval = null; + } + }, + }, + mounted: function () { + var _this = this; + this.currentValue = this.data.value; + this.setHoverColor().then(function () { + _this.drawCircle(_this.currentValue); + }); + }, + destroyed: function () { + this.clearMockInterval(); + }, +}); diff --git a/miniprogram_npm/@vant/weapp/circle/index.json b/miniprogram_npm/@vant/weapp/circle/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/circle/index.wxml b/miniprogram_npm/@vant/weapp/circle/index.wxml new file mode 100644 index 0000000..52bc59f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.wxml @@ -0,0 +1,9 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="van-circle"> + <canvas class="van-circle__canvas" type="{{ type }}" style="width: {{ utils.addUnit(size) }};height:{{ utils.addUnit(size) }}" id="van-circle" canvas-id="van-circle"></canvas> + <view wx:if="{{ !text }}" class="van-circle__text"> + <slot></slot> + </view> + <cover-view wx:else class="van-circle__text">{{ text }}</cover-view> +</view> diff --git a/miniprogram_npm/@vant/weapp/circle/index.wxss b/miniprogram_npm/@vant/weapp/circle/index.wxss new file mode 100644 index 0000000..2200751 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-circle{display:inline-block;position:relative;text-align:center}.van-circle__text{color:var(--circle-text-color,#323233);left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/col/index.d.ts b/miniprogram_npm/@vant/weapp/col/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/col/index.js b/miniprogram_npm/@vant/weapp/col/index.js new file mode 100644 index 0000000..63c56eb --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var relation_1 = require("../common/relation"); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useParent)('row'), + props: { + span: Number, + offset: Number, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/col/index.json b/miniprogram_npm/@vant/weapp/col/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/col/index.wxml b/miniprogram_npm/@vant/weapp/col/index.wxml new file mode 100644 index 0000000..975348b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.wxml @@ -0,0 +1,9 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}" + style="{{ computed.rootStyle({ gutter }) }}" +> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/col/index.wxs b/miniprogram_npm/@vant/weapp/col/index.wxs new file mode 100644 index 0000000..507c1cb --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + if (!data.gutter) { + return ''; + } + + return style({ + 'padding-right': addUnit(data.gutter / 2), + 'padding-left': addUnit(data.gutter / 2), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/col/index.wxss b/miniprogram_npm/@vant/weapp/col/index.wxss new file mode 100644 index 0000000..2fa265e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-col{box-sizing:border-box;float:left}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/collapse-item/animate.d.ts b/miniprogram_npm/@vant/weapp/collapse-item/animate.d.ts new file mode 100644 index 0000000..32157b6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/animate.d.ts @@ -0,0 +1,2 @@ +/// <reference types="miniprogram-api-typings" /> +export declare function setContentAnimate(context: WechatMiniprogram.Component.TrivialInstance, expanded: boolean, mounted: boolean): void; diff --git a/miniprogram_npm/@vant/weapp/collapse-item/animate.js b/miniprogram_npm/@vant/weapp/collapse-item/animate.js new file mode 100644 index 0000000..5734087 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/animate.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setContentAnimate = void 0; +var utils_1 = require("../common/utils"); +function useAnimation(context, expanded, mounted, height) { + var animation = wx.createAnimation({ + duration: 0, + timingFunction: 'ease-in-out', + }); + if (expanded) { + if (height === 0) { + animation.height('auto').top(1).step(); + } + else { + animation + .height(height) + .top(1) + .step({ + duration: mounted ? 300 : 1, + }) + .height('auto') + .step(); + } + context.setData({ + animation: animation.export(), + }); + return; + } + animation.height(height).top(0).step({ duration: 1 }).height(0).step({ + duration: 300, + }); + context.setData({ + animation: animation.export(), + }); +} +function setContentAnimate(context, expanded, mounted) { + (0, utils_1.getRect)(context, '.van-collapse-item__content') + .then(function (rect) { return rect.height; }) + .then(function (height) { + useAnimation(context, expanded, mounted, height); + }); +} +exports.setContentAnimate = setContentAnimate; diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.d.ts b/miniprogram_npm/@vant/weapp/collapse-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.js b/miniprogram_npm/@vant/weapp/collapse-item/index.js new file mode 100644 index 0000000..473d8e2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var animate_1 = require("./animate"); +(0, component_1.VantComponent)({ + classes: ['title-class', 'content-class'], + relation: (0, relation_1.useParent)('collapse'), + 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: { + expanded: false, + }, + mounted: function () { + this.updateExpanded(); + this.mounted = true; + }, + methods: { + updateExpanded: function () { + if (!this.parent) { + return; + } + var _a = this.parent.data, value = _a.value, accordion = _a.accordion; + var _b = this.parent.children, children = _b === void 0 ? [] : _b; + var name = this.data.name; + var index = children.indexOf(this); + var currentName = name == null ? index : name; + var expanded = accordion + ? value === currentName + : (value || []).some(function (name) { return name === currentName; }); + if (expanded !== this.data.expanded) { + (0, animate_1.setContentAnimate)(this, expanded, this.mounted); + } + this.setData({ index: index, expanded: expanded }); + }, + onClick: function () { + if (this.data.disabled) { + return; + } + var _a = this.data, name = _a.name, expanded = _a.expanded; + var index = this.parent.children.indexOf(this); + var currentName = name == null ? index : name; + this.parent.switch(currentName, !expanded); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.json b/miniprogram_npm/@vant/weapp/collapse-item/index.json new file mode 100644 index 0000000..0e5425c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.wxml b/miniprogram_npm/@vant/weapp/collapse-item/index.wxml new file mode 100644 index 0000000..ae4cc83 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.wxml @@ -0,0 +1,44 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}"> + <van-cell + title="{{ title }}" + title-class="title-class" + icon="{{ icon }}" + value="{{ value }}" + label="{{ label }}" + is-link="{{ isLink }}" + clickable="{{ clickable }}" + border="{{ border && expanded }}" + class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}" + right-icon-class="van-cell__right-icon" + custom-class="van-cell" + hover-class="van-cell--hover" + bind:click="onClick" + > + <slot + name="title" + slot="title" + /> + <slot + name="icon" + slot="icon" + /> + <slot name="value" /> + <slot + name="right-icon" + slot="right-icon" + /> + </van-cell> + <view + class="{{ utils.bem('collapse-item__wrapper') }}" + style="height: 0;" + animation="{{ animation }}" + > + <view + class="van-collapse-item__content content-class" + > + <slot /> + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.wxss b/miniprogram_npm/@vant/weapp/collapse-item/index.wxss new file mode 100644 index 0000000..4a65b5a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{transform:rotate(90deg);transition:transform var(--collapse-item-transition-duration,.3s)}.van-collapse-item__title--expanded .van-cell__right-icon{transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:var(--collapse-item-title-disabled-color,#c8c9cc)!important}.van-collapse-item__title--disabled .van-cell--hover{background-color:#fff!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{background-color:var(--collapse-item-content-background-color,#fff);color:var(--collapse-item-content-text-color,#969799);font-size:var(--collapse-item-content-font-size,13px);line-height:var(--collapse-item-content-line-height,1.5);padding:var(--collapse-item-content-padding,15px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/collapse/index.d.ts b/miniprogram_npm/@vant/weapp/collapse/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/collapse/index.js b/miniprogram_npm/@vant/weapp/collapse/index.js new file mode 100644 index 0000000..943d542 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('collapse-item'), + props: { + value: { + type: null, + observer: 'updateExpanded', + }, + accordion: { + type: Boolean, + observer: 'updateExpanded', + }, + border: { + type: Boolean, + value: true, + }, + }, + methods: { + updateExpanded: function () { + this.children.forEach(function (child) { + child.updateExpanded(); + }); + }, + switch: function (name, expanded) { + var _a = this.data, accordion = _a.accordion, value = _a.value; + var changeItem = name; + if (!accordion) { + name = expanded + ? (value || []).concat(name) + : (value || []).filter(function (activeName) { return activeName !== name; }); + } + else { + name = expanded ? name : ''; + } + if (expanded) { + this.$emit('open', changeItem); + } + else { + this.$emit('close', changeItem); + } + this.$emit('change', name); + this.$emit('input', name); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/collapse/index.json b/miniprogram_npm/@vant/weapp/collapse/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/collapse/index.wxml b/miniprogram_npm/@vant/weapp/collapse/index.wxml new file mode 100644 index 0000000..fd4e171 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.wxml @@ -0,0 +1,3 @@ +<view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/collapse/index.wxss b/miniprogram_npm/@vant/weapp/collapse/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/color.d.ts b/miniprogram_npm/@vant/weapp/common/color.d.ts new file mode 100644 index 0000000..386f307 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/color.d.ts @@ -0,0 +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"; diff --git a/miniprogram_npm/@vant/weapp/common/color.js b/miniprogram_npm/@vant/weapp/common/color.js new file mode 100644 index 0000000..008a45a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/color.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GRAY_DARK = exports.GRAY = exports.ORANGE = exports.GREEN = exports.WHITE = exports.BLUE = exports.RED = void 0; +exports.RED = '#ee0a24'; +exports.BLUE = '#1989fa'; +exports.WHITE = '#fff'; +exports.GREEN = '#07c160'; +exports.ORANGE = '#ff976a'; +exports.GRAY = '#323233'; +exports.GRAY_DARK = '#969799'; diff --git a/miniprogram_npm/@vant/weapp/common/component.d.ts b/miniprogram_npm/@vant/weapp/common/component.d.ts new file mode 100644 index 0000000..1d0fd27 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/component.d.ts @@ -0,0 +1,4 @@ +/// <reference types="miniprogram-api-typings" /> +import { VantComponentOptions } from 'definitions/index'; +declare function VantComponent<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption>(vantOptions: VantComponentOptions<Data, Props, Methods>): void; +export { VantComponent }; diff --git a/miniprogram_npm/@vant/weapp/common/component.js b/miniprogram_npm/@vant/weapp/common/component.js new file mode 100644 index 0000000..f1ab5c9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/component.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VantComponent = void 0; +var basic_1 = require("../mixins/basic"); +function mapKeys(source, target, map) { + Object.keys(map).forEach(function (key) { + if (source[key]) { + target[map[key]] = source[key]; + } + }); +} +function VantComponent(vantOptions) { + var options = {}; + mapKeys(vantOptions, options, { + data: 'data', + props: 'properties', + mixins: 'behaviors', + methods: 'methods', + beforeCreate: 'created', + created: 'attached', + mounted: 'ready', + destroyed: 'detached', + classes: 'externalClasses', + }); + // add default externalClasses + options.externalClasses = options.externalClasses || []; + options.externalClasses.push('custom-class'); + // add default behaviors + options.behaviors = options.behaviors || []; + options.behaviors.push(basic_1.basic); + // add relations + var relation = vantOptions.relation; + if (relation) { + options.relations = relation.relations; + options.behaviors.push(relation.mixin); + } + // map field to form-field behavior + if (vantOptions.field) { + options.behaviors.push('wx://form-field'); + } + // add default options + options.options = { + multipleSlots: true, + addGlobalClass: true, + }; + Component(options); +} +exports.VantComponent = VantComponent; diff --git a/miniprogram_npm/@vant/weapp/common/index.wxss b/miniprogram_npm/@vant/weapp/common/index.wxss new file mode 100644 index 0000000..a73bb7a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/index.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{clear:both;content:"";display:table}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/relation.d.ts b/miniprogram_npm/@vant/weapp/common/relation.d.ts new file mode 100644 index 0000000..4b5af00 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/relation.d.ts @@ -0,0 +1,15 @@ +/// <reference types="miniprogram-api-typings" /> +declare type TrivialInstance = WechatMiniprogram.Component.TrivialInstance; +export declare function useParent(name: string, onEffect?: (this: TrivialInstance) => void): { + relations: { + [x: string]: WechatMiniprogram.Component.RelationOption; + }; + mixin: string; +}; +export declare function useChildren(name: string, onEffect?: (this: TrivialInstance, target: TrivialInstance) => void): { + relations: { + [x: string]: WechatMiniprogram.Component.RelationOption; + }; + mixin: string; +}; +export {}; diff --git a/miniprogram_npm/@vant/weapp/common/relation.js b/miniprogram_npm/@vant/weapp/common/relation.js new file mode 100644 index 0000000..008256c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/relation.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useChildren = exports.useParent = void 0; +function useParent(name, onEffect) { + var _a; + var path = "../".concat(name, "/index"); + return { + relations: (_a = {}, + _a[path] = { + type: 'ancestor', + linked: function () { + onEffect && onEffect.call(this); + }, + linkChanged: function () { + onEffect && onEffect.call(this); + }, + unlinked: function () { + onEffect && onEffect.call(this); + }, + }, + _a), + mixin: Behavior({ + created: function () { + var _this = this; + Object.defineProperty(this, 'parent', { + get: function () { return _this.getRelationNodes(path)[0]; }, + }); + Object.defineProperty(this, 'index', { + // @ts-ignore + get: function () { var _a, _b; return (_b = (_a = _this.parent) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.indexOf(_this); }, + }); + }, + }), + }; +} +exports.useParent = useParent; +function useChildren(name, onEffect) { + var _a; + var path = "../".concat(name, "/index"); + return { + relations: (_a = {}, + _a[path] = { + type: 'descendant', + linked: function (target) { + onEffect && onEffect.call(this, target); + }, + linkChanged: function (target) { + onEffect && onEffect.call(this, target); + }, + unlinked: function (target) { + onEffect && onEffect.call(this, target); + }, + }, + _a), + mixin: Behavior({ + created: function () { + var _this = this; + Object.defineProperty(this, 'children', { + get: function () { return _this.getRelationNodes(path) || []; }, + }); + }, + }), + }; +} +exports.useChildren = useChildren; diff --git a/miniprogram_npm/@vant/weapp/common/style/clearfix.wxss b/miniprogram_npm/@vant/weapp/common/style/clearfix.wxss new file mode 100644 index 0000000..442246f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/clearfix.wxss @@ -0,0 +1 @@ +.van-clearfix:after{clear:both;content:"";display:table} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss b/miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss new file mode 100644 index 0000000..ee701df --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/style/hairline.wxss b/miniprogram_npm/@vant/weapp/common/style/hairline.wxss new file mode 100644 index 0000000..f7c6260 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/hairline.wxss @@ -0,0 +1 @@ +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss b/miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss diff --git a/miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss b/miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss diff --git a/miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss b/miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss diff --git a/miniprogram_npm/@vant/weapp/common/style/var.wxss b/miniprogram_npm/@vant/weapp/common/style/var.wxss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/var.wxss diff --git a/miniprogram_npm/@vant/weapp/common/utils.d.ts b/miniprogram_npm/@vant/weapp/common/utils.d.ts new file mode 100644 index 0000000..5332a68 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/utils.d.ts @@ -0,0 +1,13 @@ +/// <reference types="miniprogram-api-typings" /> +export { isDef } from './validator'; +export declare function range(num: number, min: number, max: number): number; +export declare function nextTick(cb: (...args: any[]) => void): void; +export declare function getSystemInfoSync(): WechatMiniprogram.SystemInfo; +export declare function addUnit(value?: string | number): string | undefined; +export declare function requestAnimationFrame(cb: () => void): number | WechatMiniprogram.NodesRef; +export declare function pickExclude(obj: unknown, keys: string[]): {}; +export declare function getRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>; +export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>; +export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void; +export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>; +export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject; diff --git a/miniprogram_npm/@vant/weapp/common/utils.js b/miniprogram_npm/@vant/weapp/common/utils.js new file mode 100644 index 0000000..8966b00 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/utils.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCurrentPage = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.getSystemInfoSync = exports.nextTick = exports.range = exports.isDef = void 0; +var validator_1 = require("./validator"); +var version_1 = require("./version"); +var validator_2 = require("./validator"); +Object.defineProperty(exports, "isDef", { enumerable: true, get: function () { return validator_2.isDef; } }); +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +exports.range = range; +function nextTick(cb) { + if ((0, version_1.canIUseNextTick)()) { + wx.nextTick(cb); + } + else { + setTimeout(function () { + cb(); + }, 1000 / 30); + } +} +exports.nextTick = nextTick; +var systemInfo; +function getSystemInfoSync() { + if (systemInfo == null) { + systemInfo = wx.getSystemInfoSync(); + } + return systemInfo; +} +exports.getSystemInfoSync = getSystemInfoSync; +function addUnit(value) { + if (!(0, validator_1.isDef)(value)) { + return undefined; + } + value = String(value); + return (0, validator_1.isNumber)(value) ? "".concat(value, "px") : value; +} +exports.addUnit = addUnit; +function requestAnimationFrame(cb) { + var systemInfo = getSystemInfoSync(); + if (systemInfo.platform === 'devtools') { + return setTimeout(function () { + cb(); + }, 1000 / 30); + } + return wx + .createSelectorQuery() + .selectViewport() + .boundingClientRect() + .exec(function () { + cb(); + }); +} +exports.requestAnimationFrame = requestAnimationFrame; +function pickExclude(obj, keys) { + if (!(0, validator_1.isPlainObject)(obj)) { + return {}; + } + return Object.keys(obj).reduce(function (prev, key) { + if (!keys.includes(key)) { + prev[key] = obj[key]; + } + return prev; + }, {}); +} +exports.pickExclude = pickExclude; +function getRect(context, selector) { + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(context) + .select(selector) + .boundingClientRect() + .exec(function (rect) { + if (rect === void 0) { rect = []; } + return resolve(rect[0]); + }); + }); +} +exports.getRect = getRect; +function getAllRect(context, selector) { + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(context) + .selectAll(selector) + .boundingClientRect() + .exec(function (rect) { + if (rect === void 0) { rect = []; } + return resolve(rect[0]); + }); + }); +} +exports.getAllRect = getAllRect; +function groupSetData(context, cb) { + if ((0, version_1.canIUseGroupSetData)()) { + context.groupSetData(cb); + } + else { + cb(); + } +} +exports.groupSetData = groupSetData; +function toPromise(promiseLike) { + if ((0, validator_1.isPromise)(promiseLike)) { + return promiseLike; + } + return Promise.resolve(promiseLike); +} +exports.toPromise = toPromise; +function getCurrentPage() { + var pages = getCurrentPages(); + return pages[pages.length - 1]; +} +exports.getCurrentPage = getCurrentPage; diff --git a/miniprogram_npm/@vant/weapp/common/validator.d.ts b/miniprogram_npm/@vant/weapp/common/validator.d.ts new file mode 100644 index 0000000..152894a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/validator.d.ts @@ -0,0 +1,9 @@ +export declare function isFunction(val: unknown): val is Function; +export declare function isPlainObject(val: unknown): val is Record<string, unknown>; +export declare function isPromise<T = unknown>(val: unknown): val is Promise<T>; +export declare function isDef(value: unknown): boolean; +export declare function isObj(x: unknown): x is Record<string, unknown>; +export declare function isNumber(value: string): boolean; +export declare function isBoolean(value: unknown): value is boolean; +export declare function isImageUrl(url: string): boolean; +export declare function isVideoUrl(url: string): boolean; diff --git a/miniprogram_npm/@vant/weapp/common/validator.js b/miniprogram_npm/@vant/weapp/common/validator.js new file mode 100644 index 0000000..169e796 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/validator.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isVideoUrl = exports.isImageUrl = exports.isBoolean = exports.isNumber = exports.isObj = exports.isDef = exports.isPromise = exports.isPlainObject = exports.isFunction = void 0; +// eslint-disable-next-line @typescript-eslint/ban-types +function isFunction(val) { + return typeof val === 'function'; +} +exports.isFunction = isFunction; +function isPlainObject(val) { + return val !== null && typeof val === 'object' && !Array.isArray(val); +} +exports.isPlainObject = isPlainObject; +function isPromise(val) { + return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch); +} +exports.isPromise = isPromise; +function isDef(value) { + return value !== undefined && value !== null; +} +exports.isDef = isDef; +function isObj(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} +exports.isObj = isObj; +function isNumber(value) { + return /^\d+(\.\d+)?$/.test(value); +} +exports.isNumber = isNumber; +function isBoolean(value) { + return typeof value === 'boolean'; +} +exports.isBoolean = isBoolean; +var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i; +var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i; +function isImageUrl(url) { + return IMAGE_REGEXP.test(url); +} +exports.isImageUrl = isImageUrl; +function isVideoUrl(url) { + return VIDEO_REGEXP.test(url); +} +exports.isVideoUrl = isVideoUrl; diff --git a/miniprogram_npm/@vant/weapp/common/version.d.ts b/miniprogram_npm/@vant/weapp/common/version.d.ts new file mode 100644 index 0000000..988b226 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/version.d.ts @@ -0,0 +1,7 @@ +export declare function canIUseModel(): boolean; +export declare function canIUseFormFieldButton(): boolean; +export declare function canIUseAnimate(): boolean; +export declare function canIUseGroupSetData(): boolean; +export declare function canIUseNextTick(): boolean; +export declare function canIUseCanvas2d(): boolean; +export declare function canIUseGetUserProfile(): boolean; diff --git a/miniprogram_npm/@vant/weapp/common/version.js b/miniprogram_npm/@vant/weapp/common/version.js new file mode 100644 index 0000000..1e49e30 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/version.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.canIUseGetUserProfile = exports.canIUseCanvas2d = exports.canIUseNextTick = exports.canIUseGroupSetData = exports.canIUseAnimate = exports.canIUseFormFieldButton = exports.canIUseModel = void 0; +var utils_1 = require("./utils"); +function compareVersion(v1, v2) { + v1 = v1.split('.'); + v2 = v2.split('.'); + var len = Math.max(v1.length, v2.length); + while (v1.length < len) { + v1.push('0'); + } + while (v2.length < len) { + v2.push('0'); + } + for (var i = 0; i < len; i++) { + var num1 = parseInt(v1[i], 10); + var num2 = parseInt(v2[i], 10); + if (num1 > num2) { + return 1; + } + if (num1 < num2) { + return -1; + } + } + return 0; +} +function gte(version) { + var system = (0, utils_1.getSystemInfoSync)(); + return compareVersion(system.SDKVersion, version) >= 0; +} +function canIUseModel() { + return gte('2.9.3'); +} +exports.canIUseModel = canIUseModel; +function canIUseFormFieldButton() { + return gte('2.10.3'); +} +exports.canIUseFormFieldButton = canIUseFormFieldButton; +function canIUseAnimate() { + return gte('2.9.0'); +} +exports.canIUseAnimate = canIUseAnimate; +function canIUseGroupSetData() { + return gte('2.4.0'); +} +exports.canIUseGroupSetData = canIUseGroupSetData; +function canIUseNextTick() { + return wx.canIUse('nextTick'); +} +exports.canIUseNextTick = canIUseNextTick; +function canIUseCanvas2d() { + return gte('2.9.0'); +} +exports.canIUseCanvas2d = canIUseCanvas2d; +function canIUseGetUserProfile() { + return !!wx.getUserProfile; +} +exports.canIUseGetUserProfile = canIUseGetUserProfile; diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.d.ts b/miniprogram_npm/@vant/weapp/config-provider/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.js b/miniprogram_npm/@vant/weapp/config-provider/index.js new file mode 100644 index 0000000..21fb1c4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + themeVars: { + type: Object, + value: {}, + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.json b/miniprogram_npm/@vant/weapp/config-provider/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.wxml b/miniprogram_npm/@vant/weapp/config-provider/index.wxml new file mode 100644 index 0000000..3cfb461 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.wxml @@ -0,0 +1,5 @@ +<wxs src="./index.wxs" module="computed" /> + +<view class="van-config-provider" style="{{ computed.mapThemeVarsToCSSVars(themeVars) }}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.wxs b/miniprogram_npm/@vant/weapp/config-provider/index.wxs new file mode 100644 index 0000000..7ca0203 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.wxs @@ -0,0 +1,29 @@ +/* eslint-disable */ +var object = require('../wxs/object.wxs'); +var style = require('../wxs/style.wxs'); + +function kebabCase(word) { + var newWord = word + .replace(getRegExp("[A-Z]", 'g'), function (i) { + return '-' + i; + }) + .toLowerCase() + .replace(getRegExp("^-"), ''); + + return newWord; +} + +function mapThemeVarsToCSSVars(themeVars) { + var cssVars = {}; + object.keys(themeVars).forEach(function (key) { + var cssVarsKey = '--' + kebabCase(key); + cssVars[cssVarsKey] = themeVars[key]; + }); + + return style(cssVars); +} + +module.exports = { + kebabCase: kebabCase, + mapThemeVarsToCSSVars: mapThemeVarsToCSSVars, +}; diff --git a/miniprogram_npm/@vant/weapp/count-down/index.d.ts b/miniprogram_npm/@vant/weapp/count-down/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/count-down/index.js b/miniprogram_npm/@vant/weapp/count-down/index.js new file mode 100644 index 0000000..afc780b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var utils_1 = require("./utils"); +function simpleTick(fn) { + return setTimeout(fn, 30); +} +(0, component_1.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: (0, utils_1.parseTimeData)(0), + formattedTime: '0', + }, + destroyed: function () { + clearTimeout(this.tid); + this.tid = null; + }, + methods: { + // 开始 + start: function () { + if (this.counting) { + return; + } + this.counting = true; + this.endTime = Date.now() + this.remain; + this.tick(); + }, + // 暂停 + pause: function () { + this.counting = false; + clearTimeout(this.tid); + }, + // 重置 + reset: function () { + this.pause(); + this.remain = this.data.time; + this.setRemain(this.remain); + if (this.data.autoStart) { + this.start(); + } + }, + tick: function () { + if (this.data.millisecond) { + this.microTick(); + } + else { + this.macroTick(); + } + }, + microTick: function () { + var _this = this; + this.tid = simpleTick(function () { + _this.setRemain(_this.getRemain()); + if (_this.remain !== 0) { + _this.microTick(); + } + }); + }, + macroTick: function () { + var _this = this; + this.tid = simpleTick(function () { + var remain = _this.getRemain(); + if (!(0, utils_1.isSameSecond)(remain, _this.remain) || remain === 0) { + _this.setRemain(remain); + } + if (_this.remain !== 0) { + _this.macroTick(); + } + }); + }, + getRemain: function () { + return Math.max(this.endTime - Date.now(), 0); + }, + setRemain: function (remain) { + this.remain = remain; + var timeData = (0, utils_1.parseTimeData)(remain); + if (this.data.useSlot) { + this.$emit('change', timeData); + } + this.setData({ + formattedTime: (0, utils_1.parseFormat)(this.data.format, timeData), + }); + if (remain === 0) { + this.pause(); + this.$emit('finish'); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/count-down/index.json b/miniprogram_npm/@vant/weapp/count-down/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/count-down/index.wxml b/miniprogram_npm/@vant/weapp/count-down/index.wxml new file mode 100644 index 0000000..e206e16 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.wxml @@ -0,0 +1,4 @@ +<view class="van-count-down"> + <slot wx:if="{{ useSlot }}"/> + <block wx:else>{{ formattedTime }}</block> +</view> diff --git a/miniprogram_npm/@vant/weapp/count-down/index.wxss b/miniprogram_npm/@vant/weapp/count-down/index.wxss new file mode 100644 index 0000000..8b957f7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-count-down{color:var(--count-down-text-color,#323233);font-size:var(--count-down-font-size,14px);line-height:var(--count-down-line-height,20px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/count-down/utils.d.ts b/miniprogram_npm/@vant/weapp/count-down/utils.d.ts new file mode 100644 index 0000000..e4a58dd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/utils.d.ts @@ -0,0 +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; diff --git a/miniprogram_npm/@vant/weapp/count-down/utils.js b/miniprogram_npm/@vant/weapp/count-down/utils.js new file mode 100644 index 0000000..a7cfa5f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/utils.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isSameSecond = exports.parseFormat = exports.parseTimeData = void 0; +function padZero(num, targetLength) { + if (targetLength === void 0) { targetLength = 2; } + var str = num + ''; + while (str.length < targetLength) { + str = '0' + str; + } + return str; +} +var SECOND = 1000; +var MINUTE = 60 * SECOND; +var HOUR = 60 * MINUTE; +var DAY = 24 * HOUR; +function parseTimeData(time) { + var days = Math.floor(time / DAY); + var hours = Math.floor((time % DAY) / HOUR); + var minutes = Math.floor((time % HOUR) / MINUTE); + var seconds = Math.floor((time % MINUTE) / SECOND); + var milliseconds = Math.floor(time % SECOND); + return { + days: days, + hours: hours, + minutes: minutes, + seconds: seconds, + milliseconds: milliseconds, + }; +} +exports.parseTimeData = parseTimeData; +function parseFormat(format, timeData) { + var days = timeData.days; + var hours = timeData.hours, minutes = timeData.minutes, seconds = timeData.seconds, milliseconds = timeData.milliseconds; + 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)); +} +exports.parseFormat = parseFormat; +function isSameSecond(time1, time2) { + return Math.floor(time1 / 1000) === Math.floor(time2 / 1000); +} +exports.isSameSecond = isSameSecond; diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.d.ts b/miniprogram_npm/@vant/weapp/datetime-picker/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.js b/miniprogram_npm/@vant/weapp/datetime-picker/index.js new file mode 100644 index 0000000..e30afef --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.js @@ -0,0 +1,329 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var validator_1 = require("../common/validator"); +var shared_1 = require("../picker/shared"); +var currentYear = new Date().getFullYear(); +function isValidDate(date) { + return (0, validator_1.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".concat(val).slice(-2); +} +function times(n, iteratee) { + var index = -1; + var result = Array(n < 0 ? 0 : n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +function getTrueValue(formattedValue) { + if (formattedValue === undefined) { + formattedValue = '1'; + } + 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(); +} +var defaultFormatter = function (type, value) { return value; }; +(0, component_1.VantComponent)({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { value: { + type: null, + observer: 'updateValue', + }, filter: null, type: { + type: String, + value: 'datetime', + observer: 'updateValue', + }, showToolbar: { + type: Boolean, + value: true, + }, formatter: { + type: null, + value: defaultFormatter, + }, minDate: { + type: Number, + value: new Date(currentYear - 10, 0, 1).getTime(), + observer: 'updateValue', + }, maxDate: { + type: Number, + value: new Date(currentYear + 10, 11, 31).getTime(), + observer: 'updateValue', + }, minHour: { + type: Number, + value: 0, + observer: 'updateValue', + }, maxHour: { + type: Number, + value: 23, + observer: 'updateValue', + }, minMinute: { + type: Number, + value: 0, + observer: 'updateValue', + }, maxMinute: { + type: Number, + value: 59, + observer: 'updateValue', + } }), + data: { + innerValue: Date.now(), + columns: [], + }, + methods: { + updateValue: function () { + var _this = this; + var data = this.data; + var val = this.correctValue(data.value); + var isEqual = val === data.innerValue; + this.updateColumnValue(val).then(function () { + if (!isEqual) { + _this.$emit('input', val); + } + }); + }, + getPicker: function () { + if (this.picker == null) { + this.picker = this.selectComponent('.van-datetime-picker'); + var picker_1 = this.picker; + var setColumnValues_1 = picker_1.setColumnValues; + picker_1.setColumnValues = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return setColumnValues_1.apply(picker_1, __spreadArray(__spreadArray([], args, true), [false], false)); + }; + } + return this.picker; + }, + updateColumns: function () { + var _a = this.data.formatter, formatter = _a === void 0 ? defaultFormatter : _a; + var results = this.getOriginColumns().map(function (column) { return ({ + values: column.values.map(function (value) { return formatter(column.type, value); }), + }); }); + return this.set({ columns: results }); + }, + getOriginColumns: function () { + var filter = this.data.filter; + var results = this.getRanges().map(function (_a) { + var type = _a.type, range = _a.range; + var values = times(range[1] - range[0] + 1, function (index) { + var value = range[0] + index; + return type === 'year' ? "".concat(value) : padZero(value); + }); + if (filter) { + values = filter(type, values); + } + return { type: type, values: values }; + }); + return results; + }, + getRanges: function () { + var data = this.data; + if (data.type === 'time') { + return [ + { + type: 'hour', + range: [data.minHour, data.maxHour], + }, + { + type: 'minute', + range: [data.minMinute, data.maxMinute], + }, + ]; + } + var _a = this.getBoundary('max', data.innerValue), maxYear = _a.maxYear, maxDate = _a.maxDate, maxMonth = _a.maxMonth, maxHour = _a.maxHour, maxMinute = _a.maxMinute; + var _b = this.getBoundary('min', data.innerValue), minYear = _b.minYear, minDate = _b.minDate, minMonth = _b.minMonth, minHour = _b.minHour, minMinute = _b.minMinute; + var 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: function (value) { + var data = this.data; + // validate value + var isDateType = data.type !== 'time'; + if (isDateType && !isValidDate(value)) { + value = data.minDate; + } + else if (!isDateType && !value) { + var minHour = data.minHour; + value = "".concat(padZero(minHour), ":00"); + } + // time type + if (!isDateType) { + var _a = value.split(':'), hour = _a[0], minute = _a[1]; + hour = padZero(range(hour, data.minHour, data.maxHour)); + minute = padZero(range(minute, data.minMinute, data.maxMinute)); + return "".concat(hour, ":").concat(minute); + } + // date type + value = Math.max(value, data.minDate); + value = Math.min(value, data.maxDate); + return value; + }, + getBoundary: function (type, innerValue) { + var _a; + var value = new Date(innerValue); + var boundary = new Date(this.data["".concat(type, "Date")]); + var year = boundary.getFullYear(); + var month = 1; + var date = 1; + var hour = 0; + var 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 _a = {}, + _a["".concat(type, "Year")] = year, + _a["".concat(type, "Month")] = month, + _a["".concat(type, "Date")] = date, + _a["".concat(type, "Hour")] = hour, + _a["".concat(type, "Minute")] = minute, + _a; + }, + onCancel: function () { + this.$emit('cancel'); + }, + onConfirm: function () { + this.$emit('confirm', this.data.innerValue); + }, + onChange: function () { + var _this = this; + var data = this.data; + var value; + var picker = this.getPicker(); + var originColumns = this.getOriginColumns(); + if (data.type === 'time') { + var indexes = picker.getIndexes(); + value = "".concat(+originColumns[0].values[indexes[0]], ":").concat(+originColumns[1] + .values[indexes[1]]); + } + else { + var indexes = picker.getIndexes(); + var values = indexes.map(function (value, index) { return originColumns[index].values[value]; }); + var year = getTrueValue(values[0]); + var month = getTrueValue(values[1]); + var maxDate = getMonthEndDay(year, month); + var date = getTrueValue(values[2]); + if (data.type === 'year-month') { + date = 1; + } + date = date > maxDate ? maxDate : date; + var hour = 0; + var 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(function () { + _this.$emit('input', value); + _this.$emit('change', picker); + }); + }, + updateColumnValue: function (value) { + var _this = this; + var values = []; + var type = this.data.type; + var formatter = this.data.formatter || defaultFormatter; + var picker = this.getPicker(); + if (type === 'time') { + var pair = value.split(':'); + values = [formatter('hour', pair[0]), formatter('minute', pair[1])]; + } + else { + var date = new Date(value); + values = [ + formatter('year', "".concat(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(function () { return _this.updateColumns(); }) + .then(function () { return picker.setValues(values); }); + }, + }, + created: function () { + var _this = this; + var innerValue = this.correctValue(this.data.value); + this.updateColumnValue(innerValue).then(function () { + _this.$emit('input', innerValue); + }); + }, +}); diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.json b/miniprogram_npm/@vant/weapp/datetime-picker/index.json new file mode 100644 index 0000000..a778e91 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.wxml b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxml new file mode 100644 index 0000000..ade2202 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxml @@ -0,0 +1,16 @@ +<van-picker + class="van-datetime-picker" + active-class="active-class" + toolbar-class="toolbar-class" + column-class="column-class" + title="{{ title }}" + columns="{{ columns }}" + item-height="{{ itemHeight }}" + show-toolbar="{{ showToolbar }}" + visible-item-count="{{ visibleItemCount }}" + confirm-button-text="{{ confirmButtonText }}" + cancel-button-text="{{ cancelButtonText }}" + bind:change="onChange" + bind:confirm="onConfirm" + bind:cancel="onCancel" +/> diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.wxss b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/definitions/index.d.ts b/miniprogram_npm/@vant/weapp/definitions/index.d.ts new file mode 100644 index 0000000..a7cc750 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/definitions/index.d.ts @@ -0,0 +1,27 @@ +/// <reference types="miniprogram-api-typings" /> +interface VantComponentInstance { + parent: WechatMiniprogram.Component.TrivialInstance; + children: WechatMiniprogram.Component.TrivialInstance[]; + index: number; + $emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void; +} +export declare type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = { + data?: Data; + field?: boolean; + classes?: string[]; + mixins?: string[]; + props?: Props; + relation?: { + relations: Record<string, WechatMiniprogram.Component.RelationOption>; + mixin: string; + }; + methods?: Methods; + beforeCreate?: () => void; + created?: () => void; + mounted?: () => void; + destroyed?: () => void; +} & ThisType<VantComponentInstance & WechatMiniprogram.Component.Instance<Data & { + name: string; + value: any; +} & Record<string, any>, Props, Methods> & Record<string, any>>; +export {}; diff --git a/miniprogram_npm/@vant/weapp/definitions/index.js b/miniprogram_npm/@vant/weapp/definitions/index.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/definitions/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/miniprogram_npm/@vant/weapp/dialog/dialog.d.ts b/miniprogram_npm/@vant/weapp/dialog/dialog.d.ts new file mode 100644 index 0000000..e1f48c2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/dialog.d.ts @@ -0,0 +1,50 @@ +/// <reference types="miniprogram-api-typings" /> +export declare type Action = 'confirm' | 'cancel' | 'overlay'; +interface DialogOptions { + lang?: string; + show?: boolean; + title?: string; + width?: string | number | null; + zIndex?: number; + theme?: string; + context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance; + message?: string; + overlay?: boolean; + selector?: string; + ariaLabel?: string; + className?: string; + customStyle?: string; + transition?: string; + /** + * @deprecated use beforeClose instead + */ + asyncClose?: boolean; + beforeClose?: null | ((action: Action) => Promise<void | boolean> | void); + 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; +} +declare const Dialog: { + (options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>; + alert(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>; + confirm(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>; + close(): void; + stopLoading(): void; + currentOptions: DialogOptions; + defaultOptions: DialogOptions; + setDefaultOptions(options: DialogOptions): void; + resetDefaultOptions(): void; +}; +export default Dialog; diff --git a/miniprogram_npm/@vant/weapp/dialog/dialog.js b/miniprogram_npm/@vant/weapp/dialog/dialog.js new file mode 100644 index 0000000..0cba6ab --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/dialog.js @@ -0,0 +1,90 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var queue = []; +var defaultOptions = { + show: false, + title: '', + width: null, + theme: 'default', + message: '', + zIndex: 100, + overlay: true, + selector: '#van-dialog', + className: '', + asyncClose: false, + beforeClose: null, + transition: 'scale', + customStyle: '', + messageAlign: '', + overlayStyle: '', + confirmButtonText: '确认', + cancelButtonText: '取消', + showConfirmButton: true, + showCancelButton: false, + closeOnClickOverlay: false, + confirmButtonOpenType: '', +}; +var currentOptions = __assign({}, defaultOptions); +function getContext() { + var pages = getCurrentPages(); + return pages[pages.length - 1]; +} +var Dialog = function (options) { + options = __assign(__assign({}, currentOptions), options); + return new Promise(function (resolve, reject) { + var context = options.context || getContext(); + var dialog = context.selectComponent(options.selector); + delete options.context; + delete options.selector; + if (dialog) { + dialog.setData(__assign({ callback: function (action, instance) { + action === 'confirm' ? resolve(instance) : reject(instance); + } }, options)); + wx.nextTick(function () { + dialog.setData({ show: true }); + }); + queue.push(dialog); + } + else { + console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确'); + } + }); +}; +Dialog.alert = function (options) { return Dialog(options); }; +Dialog.confirm = function (options) { + return Dialog(__assign({ showCancelButton: true }, options)); +}; +Dialog.close = function () { + queue.forEach(function (dialog) { + dialog.close(); + }); + queue = []; +}; +Dialog.stopLoading = function () { + queue.forEach(function (dialog) { + dialog.stopLoading(); + }); +}; +Dialog.currentOptions = currentOptions; +Dialog.defaultOptions = defaultOptions; +Dialog.setDefaultOptions = function (options) { + currentOptions = __assign(__assign({}, currentOptions), options); + Dialog.currentOptions = currentOptions; +}; +Dialog.resetDefaultOptions = function () { + currentOptions = __assign({}, defaultOptions); + Dialog.currentOptions = currentOptions; +}; +Dialog.resetDefaultOptions(); +exports.default = Dialog; diff --git a/miniprogram_npm/@vant/weapp/dialog/index.d.ts b/miniprogram_npm/@vant/weapp/dialog/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/dialog/index.js b/miniprogram_npm/@vant/weapp/dialog/index.js new file mode 100644 index 0000000..3d59264 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var button_1 = require("../mixins/button"); +var color_1 = require("../common/color"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + mixins: [button_1.button], + props: { + show: { + type: Boolean, + observer: function (show) { + !show && this.stopLoading(); + }, + }, + title: String, + message: String, + theme: { + type: String, + value: 'default', + }, + useSlot: Boolean, + className: String, + customStyle: String, + asyncClose: Boolean, + messageAlign: String, + beforeClose: null, + overlayStyle: String, + useTitleSlot: Boolean, + showCancelButton: Boolean, + closeOnClickOverlay: Boolean, + confirmButtonOpenType: String, + width: null, + zIndex: { + type: Number, + value: 2000, + }, + confirmButtonText: { + type: String, + value: '确认', + }, + cancelButtonText: { + type: String, + value: '取消', + }, + confirmButtonColor: { + type: String, + value: color_1.RED, + }, + cancelButtonColor: { + type: String, + value: color_1.GRAY, + }, + showConfirmButton: { + type: Boolean, + value: true, + }, + overlay: { + type: Boolean, + value: true, + }, + transition: { + type: String, + value: 'scale', + }, + }, + data: { + loading: { + confirm: false, + cancel: false, + }, + callback: (function () { }), + }, + methods: { + onConfirm: function () { + this.handleAction('confirm'); + }, + onCancel: function () { + this.handleAction('cancel'); + }, + onClickOverlay: function () { + this.close('overlay'); + }, + close: function (action) { + var _this = this; + this.setData({ show: false }); + wx.nextTick(function () { + _this.$emit('close', action); + var callback = _this.data.callback; + if (callback) { + callback(action, _this); + } + }); + }, + stopLoading: function () { + this.setData({ + loading: { + confirm: false, + cancel: false, + }, + }); + }, + handleAction: function (action) { + var _a; + var _this = this; + this.$emit(action, { dialog: this }); + var _b = this.data, asyncClose = _b.asyncClose, beforeClose = _b.beforeClose; + if (!asyncClose && !beforeClose) { + this.close(action); + return; + } + this.setData((_a = {}, + _a["loading.".concat(action)] = true, + _a)); + if (beforeClose) { + (0, utils_1.toPromise)(beforeClose(action)).then(function (value) { + if (value) { + _this.close(action); + } + else { + _this.stopLoading(); + } + }); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/dialog/index.json b/miniprogram_npm/@vant/weapp/dialog/index.json new file mode 100644 index 0000000..43417fc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-button": "../button/index", + "van-goods-action": "../goods-action/index", + "van-goods-action-button": "../goods-action-button/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/dialog/index.wxml b/miniprogram_npm/@vant/weapp/dialog/index.wxml new file mode 100644 index 0000000..f49dee4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.wxml @@ -0,0 +1,113 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<van-popup + show="{{ show }}" + z-index="{{ zIndex }}" + overlay="{{ overlay }}" + transition="{{ transition }}" + custom-class="van-dialog van-dialog--{{ theme }} {{ className }}" + custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}" + overlay-style="{{ overlayStyle }}" + close-on-click-overlay="{{ closeOnClickOverlay }}" + bind:close="onClickOverlay" +> + <view + wx:if="{{ title || useTitleSlot }}" + class="{{ utils.bem('dialog__header', { isolated: !(message || useSlot) }) }}" + > + <slot wx:if="{{ useTitleSlot }}" name="title" /> + <block wx:elif="{{ title }}">{{ title }}</block> + </view> + + <slot wx:if="{{ useSlot }}" /> + <view + wx:elif="{{ message }}" + class="{{ utils.bem('dialog__message', [theme, messageAlign, { hasTitle: title }]) }}" + > + <text class="van-dialog__message-text">{{ message }}</text> + </view> + + <van-goods-action wx:if="{{ theme === 'round-button' }}" custom-class="van-dialog__footer--round-button"> + <van-goods-action-button + wx:if="{{ showCancelButton }}" + size="large" + loading="{{ loading.cancel }}" + class="van-dialog__button van-hairline--right" + custom-class="van-dialog__cancel" + custom-style="color: {{ cancelButtonColor }}" + bind:click="onCancel" + > + {{ cancelButtonText }} + </van-goods-action-button> + <van-goods-action-button + wx:if="{{ showConfirmButton }}" + size="large" + class="van-dialog__button" + loading="{{ loading.confirm }}" + custom-class="van-dialog__confirm" + custom-style="color: {{ confirmButtonColor }}" + + open-type="{{ confirmButtonOpenType }}" + lang="{{ lang }}" + business-id="{{ businessId }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" + + bind:click="onConfirm" + bindgetuserinfo="onGetUserInfo" + bindcontact="onContact" + bindgetphonenumber="onGetPhoneNumber" + binderror="onError" + bindlaunchapp="onLaunchApp" + bindopensetting="onOpenSetting" + > + {{ confirmButtonText }} + </van-goods-action-button> + </van-goods-action> + + <view wx:else class="van-hairline--top van-dialog__footer"> + <van-button + wx:if="{{ showCancelButton }}" + size="large" + loading="{{ loading.cancel }}" + class="van-dialog__button van-hairline--right" + custom-class="van-dialog__cancel" + custom-style="color: {{ cancelButtonColor }}" + bind:click="onCancel" + > + {{ cancelButtonText }} + </van-button> + <van-button + wx:if="{{ showConfirmButton }}" + size="large" + class="van-dialog__button" + loading="{{ loading.confirm }}" + custom-class="van-dialog__confirm" + custom-style="color: {{ confirmButtonColor }}" + + open-type="{{ confirmButtonOpenType }}" + lang="{{ lang }}" + business-id="{{ businessId }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" + + bind:click="onConfirm" + bindgetuserinfo="onGetUserInfo" + bindcontact="onContact" + bindgetphonenumber="onGetPhoneNumber" + binderror="onError" + bindlaunchapp="onLaunchApp" + bindopensetting="onOpenSetting" + > + {{ confirmButtonText }} + </van-button> + </view> +</van-popup> diff --git a/miniprogram_npm/@vant/weapp/dialog/index.wxss b/miniprogram_npm/@vant/weapp/dialog/index.wxss new file mode 100644 index 0000000..571861a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dialog{background-color:var(--dialog-background-color,#fff);border-radius:var(--dialog-border-radius,16px);font-size:var(--dialog-font-size,16px);overflow:hidden;top:45%!important;width:var(--dialog-width,320px)}@media (max-width:321px){.van-dialog{width:var(--dialog-small-screen-width,90%)}}.van-dialog__header{font-weight:var(--dialog-header-font-weight,500);line-height:var(--dialog-header-line-height,24px);padding-top:var(--dialog-header-padding-top,24px);text-align:center}.van-dialog__header--isolated{padding:var(--dialog-header-isolated-padding,24px 0)}.van-dialog__message{-webkit-overflow-scrolling:touch;font-size:var(--dialog-message-font-size,14px);line-height:var(--dialog-message-line-height,20px);max-height:var(--dialog-message-max-height,60vh);overflow-y:auto;padding:var(--dialog-message-padding,24px);text-align:center}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--hasTitle{color:var(--dialog-has-title-message-text-color,#646566);padding-top:var(--dialog-has-title-message-padding-top,8px)}.van-dialog__message--round-button{color:#323233;padding-bottom:16px}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:flex}.van-dialog__footer--round-button{padding:8px 24px 16px!important;position:relative!important}.van-dialog__button{flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog-bounce-enter{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;transform:translate3d(-50%,-50%,0) scale(.9)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/divider/index.d.ts b/miniprogram_npm/@vant/weapp/divider/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/divider/index.js b/miniprogram_npm/@vant/weapp/divider/index.js new file mode 100644 index 0000000..5c63844 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + dashed: Boolean, + hairline: Boolean, + contentPosition: String, + fontSize: String, + borderColor: String, + textColor: String, + customStyle: String, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/divider/index.json b/miniprogram_npm/@vant/weapp/divider/index.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/miniprogram_npm/@vant/weapp/divider/index.wxml b/miniprogram_npm/@vant/weapp/divider/index.wxml new file mode 100644 index 0000000..f6a5a45 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.wxml @@ -0,0 +1,9 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('divider', [{ dashed, hairline }, contentPosition]) }}" + style="{{ computed.rootStyle({ borderColor, textColor, fontSize, customStyle }) }}" +> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/divider/index.wxs b/miniprogram_npm/@vant/weapp/divider/index.wxs new file mode 100644 index 0000000..215b14f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + 'border-color': data.borderColor, + color: data.textColor, + 'font-size': addUnit(data.fontSize), + }, + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/divider/index.wxss b/miniprogram_npm/@vant/weapp/divider/index.wxss new file mode 100644 index 0000000..e91dc44 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-divider{align-items:center;border:0 solid var(--divider-border-color,#ebedf0);color:var(--divider-text-color,#969799);display:flex;font-size:var(--divider-font-size,14px);line-height:var(--divider-line-height,24px);margin:var(--divider-margin,16px 0)}.van-divider:after,.van-divider:before{border-color:inherit;border-style:inherit;border-width:1px 0 0;box-sizing:border-box;display:block;flex:1;height:1px}.van-divider:before{content:""}.van-divider--hairline:after,.van-divider--hairline:before{transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--center:before,.van-divider--left:before,.van-divider--right:before{margin-right:var(--divider-content-padding,16px)}.van-divider--center:after,.van-divider--left:after,.van-divider--right:after{content:"";margin-left:var(--divider-content-padding,16px)}.van-divider--left:before{max-width:var(--divider-content-left-width,10%)}.van-divider--right:after{max-width:var(--divider-content-right-width,10%)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.d.ts b/miniprogram_npm/@vant/weapp/dropdown-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.js b/miniprogram_npm/@vant/weapp/dropdown-item/index.js new file mode 100644 index 0000000..42de11f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.js @@ -0,0 +1,107 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var relation_1 = require("../common/relation"); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useParent)('dropdown-menu', function () { + this.updateDataFromParent(); + }), + props: { + value: { + type: null, + observer: 'rerender', + }, + title: { + type: String, + observer: 'rerender', + }, + disabled: Boolean, + titleClass: { + type: String, + observer: 'rerender', + }, + options: { + type: Array, + value: [], + observer: 'rerender', + }, + popupStyle: String, + }, + data: { + transition: true, + showPopup: false, + showWrapper: false, + displayTitle: '', + }, + methods: { + rerender: function () { + var _this = this; + wx.nextTick(function () { + var _a; + (_a = _this.parent) === null || _a === void 0 ? void 0 : _a.updateItemListData(); + }); + }, + updateDataFromParent: function () { + if (this.parent) { + var _a = this.parent.data, overlay = _a.overlay, duration = _a.duration, activeColor = _a.activeColor, closeOnClickOverlay = _a.closeOnClickOverlay, direction = _a.direction; + this.setData({ + overlay: overlay, + duration: duration, + activeColor: activeColor, + closeOnClickOverlay: closeOnClickOverlay, + direction: direction, + }); + } + }, + onOpen: function () { + this.$emit('open'); + }, + onOpened: function () { + this.$emit('opened'); + }, + onClose: function () { + this.$emit('close'); + }, + onClosed: function () { + this.$emit('closed'); + this.setData({ showWrapper: false }); + }, + onOptionTap: function (event) { + var option = event.currentTarget.dataset.option; + var value = option.value; + var shouldEmitChange = this.data.value !== value; + this.setData({ showPopup: false, value: value }); + this.$emit('close'); + this.rerender(); + if (shouldEmitChange) { + this.$emit('change', value); + } + }, + toggle: function (show, options) { + var _this = this; + var _a; + if (options === void 0) { options = {}; } + var showPopup = this.data.showPopup; + if (typeof show !== 'boolean') { + show = !showPopup; + } + if (show === showPopup) { + return; + } + this.setData({ + transition: !options.immediate, + showPopup: show, + }); + if (show) { + (_a = this.parent) === null || _a === void 0 ? void 0 : _a.getChildWrapperStyle().then(function (wrapperStyle) { + _this.setData({ wrapperStyle: wrapperStyle, showWrapper: true }); + _this.rerender(); + }); + } + else { + this.rerender(); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.json b/miniprogram_npm/@vant/weapp/dropdown-item/index.json new file mode 100644 index 0000000..88d5409 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.wxml b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxml new file mode 100644 index 0000000..dd75292 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxml @@ -0,0 +1,48 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + wx:if="{{ showWrapper }}" + class="{{ utils.bem('dropdown-item', direction) }}" + style="{{ wrapperStyle }}" +> + <van-popup + show="{{ showPopup }}" + custom-style="position: absolute;{{ popupStyle }}" + overlay-style="position: absolute;" + overlay="{{ overlay }}" + position="{{ direction === 'down' ? 'top' : 'bottom' }}" + duration="{{ transition ? duration : 0 }}" + close-on-click-overlay="{{ closeOnClickOverlay }}" + bind:enter="onOpen" + bind:leave="onClose" + bind:close="toggle" + bind:after-enter="onOpened" + bind:after-leave="onClosed" + > + <van-cell + wx:for="{{ options }}" + wx:key="value" + data-option="{{ item }}" + class="{{ utils.bem('dropdown-item__option', { active: item.value === value } ) }}" + clickable + icon="{{ item.icon }}" + bind:tap="onOptionTap" + > + <view + slot="title" + class="van-dropdown-item__title" + style="{{ item.value === value ? 'color:' + activeColor : '' }}" + > + {{ item.text }} + </view> + <van-icon + wx:if="{{ item.value === value }}" + name="success" + class="van-dropdown-item__icon" + color="{{ activeColor }}" + /> + </van-cell> + + <slot /> + </van-popup> +</view> diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.wxss b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxss new file mode 100644 index 0000000..80505e9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dropdown-item{left:0;overflow:hidden;position:fixed;right:0}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active .van-dropdown-item__icon,.van-dropdown-item__option--active .van-dropdown-item__title{color:var(--dropdown-menu-option-active-color,#ee0a24)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__icon{display:block;line-height:inherit} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/shared.d.ts b/miniprogram_npm/@vant/weapp/dropdown-item/shared.d.ts new file mode 100644 index 0000000..774eb4c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/shared.d.ts @@ -0,0 +1,5 @@ +export interface Option { + text: string; + value: string | number; + icon: string; +} diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/shared.js b/miniprogram_npm/@vant/weapp/dropdown-item/shared.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/shared.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.d.ts b/miniprogram_npm/@vant/weapp/dropdown-menu/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.js b/miniprogram_npm/@vant/weapp/dropdown-menu/index.js new file mode 100644 index 0000000..a589a17 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.js @@ -0,0 +1,117 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var utils_1 = require("../common/utils"); +var ARRAY = []; +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useChildren)('dropdown-item', function () { + 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: function () { + var windowHeight = (0, utils_1.getSystemInfoSync)().windowHeight; + this.windowHeight = windowHeight; + ARRAY.push(this); + }, + destroyed: function () { + var _this = this; + ARRAY = ARRAY.filter(function (item) { return item !== _this; }); + }, + methods: { + updateItemListData: function () { + this.setData({ + itemListData: this.children.map(function (child) { return child.data; }), + }); + }, + updateChildrenData: function () { + this.children.forEach(function (child) { + child.updateDataFromParent(); + }); + }, + toggleItem: function (active) { + this.children.forEach(function (item, index) { + var showPopup = item.data.showPopup; + if (index === active) { + item.toggle(); + } + else if (showPopup) { + item.toggle(false, { immediate: true }); + } + }); + }, + close: function () { + this.children.forEach(function (child) { + child.toggle(false, { immediate: true }); + }); + }, + getChildWrapperStyle: function () { + var _this = this; + var _a = this.data, zIndex = _a.zIndex, direction = _a.direction; + return (0, utils_1.getRect)(this, '.van-dropdown-menu').then(function (rect) { + var _a = rect.top, top = _a === void 0 ? 0 : _a, _b = rect.bottom, bottom = _b === void 0 ? 0 : _b; + var offset = direction === 'down' ? bottom : _this.windowHeight - top; + var wrapperStyle = "z-index: ".concat(zIndex, ";"); + if (direction === 'down') { + wrapperStyle += "top: ".concat((0, utils_1.addUnit)(offset), ";"); + } + else { + wrapperStyle += "bottom: ".concat((0, utils_1.addUnit)(offset), ";"); + } + return wrapperStyle; + }); + }, + onTitleTap: function (event) { + var _this = this; + var index = event.currentTarget.dataset.index; + var child = this.children[index]; + if (!child.data.disabled) { + ARRAY.forEach(function (menuItem) { + if (menuItem && + menuItem.data.closeOnClickOutside && + menuItem !== _this) { + menuItem.close(); + } + }); + this.toggleItem(index); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.json b/miniprogram_npm/@vant/weapp/dropdown-menu/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml new file mode 100644 index 0000000..cfd661d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml @@ -0,0 +1,23 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="van-dropdown-menu van-dropdown-menu--top-bottom custom-class"> + <view + wx:for="{{ itemListData }}" + wx:key="index" + data-index="{{ index }}" + class="{{ utils.bem('dropdown-menu__item', { disabled: item.disabled }) }}" + bind:tap="onTitleTap" + > + <view + class="{{ item.titleClass }} {{ utils.bem('dropdown-menu__title', { active: item.showPopup, down: item.showPopup === (direction === 'down') }) }}" + style="{{ item.showPopup ? 'color:' + activeColor : '' }}" + > + <view class="van-ellipsis"> + {{ computed.displayTitle(item) }} + </view> + </view> + </view> + + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs new file mode 100644 index 0000000..6538854 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs @@ -0,0 +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 +}; diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss new file mode 100644 index 0000000..daa5748 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dropdown-menu{background-color:var(--dropdown-menu-background-color,#fff);box-shadow:var(--dropdown-menu-box-shadow,0 2px 12px hsla(210,1%,40%,.12));display:flex;height:var(--dropdown-menu-height,50px);-webkit-user-select:none;user-select:none}.van-dropdown-menu__item{align-items:center;display:flex;flex:1;justify-content:center;min-width:0}.van-dropdown-menu__item:active{opacity:.7}.van-dropdown-menu__item--disabled:active{opacity:1}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:var(--dropdown-menu-title-disabled-text-color,#969799)}.van-dropdown-menu__title{box-sizing:border-box;color:var(--dropdown-menu-title-text-color,#323233);font-size:var(--dropdown-menu-title-font-size,15px);line-height:var(--dropdown-menu-title-line-height,18px);max-width:100%;padding:var(--dropdown-menu-title-padding,0 8px);position:relative}.van-dropdown-menu__title:after{border-color:transparent transparent currentcolor currentcolor;border-style:solid;border-width:3px;content:"";margin-top:-5px;opacity:.8;position:absolute;right:-4px;top:50%;transform:rotate(-45deg)}.van-dropdown-menu__title--active{color:var(--dropdown-menu-title-active-text-color,#ee0a24)}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/empty/index.d.ts b/miniprogram_npm/@vant/weapp/empty/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/empty/index.js b/miniprogram_npm/@vant/weapp/empty/index.js new file mode 100644 index 0000000..755e638 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + description: String, + image: { + type: String, + value: 'default', + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/empty/index.json b/miniprogram_npm/@vant/weapp/empty/index.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxml b/miniprogram_npm/@vant/weapp/empty/index.wxml new file mode 100644 index 0000000..9c7b719 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.wxml @@ -0,0 +1,22 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class van-empty"> + <view class="van-empty__image"> + <slot name="image"></slot> + </view> + <view class="van-empty__image"> + <image wx:if="{{ image }}" class="van-empty__image__img" src="{{ computed.imageUrl(image) }}" /> + </view> + + <view class="van-empty__description"> + <slot name="description"></slot> + </view> + <view class="van-empty__description"> + {{ description }} + </view> + + <view class="van-empty__bottom"> + <slot></slot> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxs b/miniprogram_npm/@vant/weapp/empty/index.wxs new file mode 100644 index 0000000..cf92ece --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.wxs @@ -0,0 +1,15 @@ +/* eslint-disable */ +var PRESETS = ['error', 'search', 'default', 'network']; + +function imageUrl(image) { + if (PRESETS.indexOf(image) !== -1) { + return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png'; + } + + return image; +} + +module.exports = { + imageUrl: imageUrl, +}; + diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxss b/miniprogram_npm/@vant/weapp/empty/index.wxss new file mode 100644 index 0000000..0fb74fe --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-empty{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding:32px 0}.van-empty__image{height:160px;width:160px}.van-empty__image:empty{display:none}.van-empty__image__img{height:100%;width:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{color:#969799;font-size:14px;line-height:20px;margin-top:16px;padding:0 60px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/field/index.d.ts b/miniprogram_npm/@vant/weapp/field/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/field/index.js b/miniprogram_npm/@vant/weapp/field/index.js new file mode 100644 index 0000000..5e93c3a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.js @@ -0,0 +1,122 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = require("../common/utils"); +var component_1 = require("../common/component"); +var props_1 = require("./props"); +(0, component_1.VantComponent)({ + field: true, + classes: ['input-class', 'right-icon-class', 'label-class'], + props: __assign(__assign(__assign(__assign({}, props_1.commonProps), props_1.inputProps), props_1.textareaProps), { size: String, icon: String, label: String, error: Boolean, center: Boolean, isLink: Boolean, leftIcon: String, rightIcon: String, autosize: null, required: Boolean, iconClass: String, clickable: Boolean, inputAlign: String, customStyle: String, errorMessage: String, arrowDirection: String, showWordLimit: Boolean, errorMessageAlign: String, readonly: { + type: Boolean, + observer: 'setShowClear', + }, clearable: { + type: Boolean, + observer: 'setShowClear', + }, clearTrigger: { + type: String, + value: 'focus', + }, border: { + type: Boolean, + value: true, + }, titleWidth: { + type: String, + value: '6.2em', + }, clearIcon: { + type: String, + value: 'clear', + } }), + data: { + focused: false, + innerValue: '', + showClear: false, + }, + created: function () { + this.value = this.data.value; + this.setData({ innerValue: this.value }); + }, + methods: { + onInput: function (event) { + var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a; + this.value = value; + this.setShowClear(); + this.emitChange(); + }, + onFocus: function (event) { + this.focused = true; + this.setShowClear(); + this.$emit('focus', event.detail); + }, + onBlur: function (event) { + this.focused = false; + this.setShowClear(); + this.$emit('blur', event.detail); + }, + onClickIcon: function () { + this.$emit('click-icon'); + }, + onClickInput: function (event) { + this.$emit('click-input', event.detail); + }, + onClear: function () { + var _this = this; + this.setData({ innerValue: '' }); + this.value = ''; + this.setShowClear(); + (0, utils_1.nextTick)(function () { + _this.emitChange(); + _this.$emit('clear', ''); + }); + }, + onConfirm: function (event) { + var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a; + this.value = value; + this.setShowClear(); + this.$emit('confirm', value); + }, + setValue: function (value) { + this.value = value; + this.setShowClear(); + if (value === '') { + this.setData({ innerValue: '' }); + } + this.emitChange(); + }, + onLineChange: function (event) { + this.$emit('linechange', event.detail); + }, + onKeyboardHeightChange: function (event) { + this.$emit('keyboardheightchange', event.detail); + }, + emitChange: function () { + var _this = this; + this.setData({ value: this.value }); + (0, utils_1.nextTick)(function () { + _this.$emit('input', _this.value); + _this.$emit('change', _this.value); + }); + }, + setShowClear: function () { + var _a = this.data, clearable = _a.clearable, readonly = _a.readonly, clearTrigger = _a.clearTrigger; + var _b = this, focused = _b.focused, value = _b.value; + var showClear = false; + if (clearable && !readonly) { + var hasValue = !!value; + var trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused); + showClear = hasValue && trigger; + } + this.setData({ showClear: showClear }); + }, + noop: function () { }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/field/index.json b/miniprogram_npm/@vant/weapp/field/index.json new file mode 100644 index 0000000..5906c50 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/field/index.wxml b/miniprogram_npm/@vant/weapp/field/index.wxml new file mode 100644 index 0000000..ec2e0ea --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.wxml @@ -0,0 +1,56 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<van-cell + size="{{ size }}" + icon="{{ leftIcon }}" + center="{{ center }}" + border="{{ border }}" + is-link="{{ isLink }}" + required="{{ required }}" + clickable="{{ clickable }}" + title-width="{{ titleWidth }}" + title-style="margin-right: 12px;" + custom-style="{{ customStyle }}" + arrow-direction="{{ arrowDirection }}" + custom-class="van-field" +> + <slot name="left-icon" slot="icon" /> + <view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title"> + {{ label }} + </view> + <slot wx:else name="label" slot="title" /> + <view class="{{ utils.bem('field__body', [type]) }}"> + <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput"> + <slot name="input" /> + </view> + <include wx:if="{{ type === 'textarea' }}" src="./textarea.wxml" /> + <include wx:else src="./input.wxml" /> + + <van-icon + wx:if="{{ showClear }}" + name="{{ clearIcon }}" + class="van-field__clear-root van-field__icon-root" + catch:touchstart="onClear" + /> + <view class="van-field__icon-container" bind:tap="onClickIcon"> + <van-icon + wx:if="{{ rightIcon || icon }}" + name="{{ rightIcon || icon }}" + class="van-field__icon-root {{ iconClass }}" + custom-class="right-icon-class" + /> + <slot name="right-icon" /> + <slot name="icon" /> + </view> + <view class="van-field__button"> + <slot name="button" /> + </view> + </view> + <view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit"> + <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }} + </view> + <view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}"> + {{ errorMessage }} + </view> +</van-cell> diff --git a/miniprogram_npm/@vant/weapp/field/index.wxs b/miniprogram_npm/@vant/weapp/field/index.wxs new file mode 100644 index 0000000..78575b9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function inputStyle(autosize) { + if (autosize && autosize.constructor === 'Object') { + return style({ + 'min-height': addUnit(autosize.minHeight), + 'max-height': addUnit(autosize.maxHeight), + }); + } + + return ''; +} + +module.exports = { + inputStyle: inputStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/field/index.wxss b/miniprogram_npm/@vant/weapp/field/index.wxss new file mode 100644 index 0000000..7571fe6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-field{--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:var(--field-label-color,#646566)}.van-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{align-items:center;display:flex}.van-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.van-field__control:empty+.van-field__control{display:block}.van-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,#323233);display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.van-field__control:empty{display:none}.van-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.van-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{color:var(--field-clear-icon-color,#c8c9cc);font-size:var(--field-clear-icon-size,16px)}.van-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{color:var(--field-error-message-color,#ee0a24);font-size:var(--field-error-message-text-font-size,12px);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.van-field__word-num{display:inline}.van-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/field/input.wxml b/miniprogram_npm/@vant/weapp/field/input.wxml new file mode 100644 index 0000000..efe9a08 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/input.wxml @@ -0,0 +1,28 @@ +<input + class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class" + type="{{ type }}" + focus="{{ focus }}" + cursor="{{ cursor }}" + value="{{ innerValue }}" + auto-focus="{{ autoFocus }}" + disabled="{{ disabled || readonly }}" + maxlength="{{ maxlength }}" + placeholder="{{ placeholder }}" + placeholder-style="{{ placeholderStyle }}" + placeholder-class="{{ utils.bem('field__placeholder', { error }) }}" + confirm-type="{{ confirmType }}" + confirm-hold="{{ confirmHold }}" + hold-keyboard="{{ holdKeyboard }}" + cursor-spacing="{{ cursorSpacing }}" + adjust-position="{{ adjustPosition }}" + selection-end="{{ selectionEnd }}" + selection-start="{{ selectionStart }}" + always-embed="{{ alwaysEmbed }}" + password="{{ password || type === 'password' }}" + bindinput="onInput" + bindtap="onClickInput" + bindblur="onBlur" + bindfocus="onFocus" + bindconfirm="onConfirm" + bindkeyboardheightchange="onKeyboardHeightChange" +/> diff --git a/miniprogram_npm/@vant/weapp/field/props.d.ts b/miniprogram_npm/@vant/weapp/field/props.d.ts new file mode 100644 index 0000000..5cd130a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/props.d.ts @@ -0,0 +1,4 @@ +/// <reference types="miniprogram-api-typings" /> +export declare const commonProps: WechatMiniprogram.Component.PropertyOption; +export declare const inputProps: WechatMiniprogram.Component.PropertyOption; +export declare const textareaProps: WechatMiniprogram.Component.PropertyOption; diff --git a/miniprogram_npm/@vant/weapp/field/props.js b/miniprogram_npm/@vant/weapp/field/props.js new file mode 100644 index 0000000..3cb8dca --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/props.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.textareaProps = exports.inputProps = exports.commonProps = void 0; +exports.commonProps = { + value: { + type: String, + observer: function (value) { + if (value !== this.value) { + this.setData({ innerValue: value }); + this.value = value; + } + }, + }, + placeholder: String, + placeholderStyle: String, + placeholderClass: String, + disabled: Boolean, + maxlength: { + type: Number, + value: -1, + }, + cursorSpacing: { + type: Number, + value: 50, + }, + autoFocus: Boolean, + focus: Boolean, + cursor: { + type: Number, + value: -1, + }, + selectionStart: { + type: Number, + value: -1, + }, + selectionEnd: { + type: Number, + value: -1, + }, + adjustPosition: { + type: Boolean, + value: true, + }, + holdKeyboard: Boolean, +}; +exports.inputProps = { + type: { + type: String, + value: 'text', + }, + password: Boolean, + confirmType: String, + confirmHold: Boolean, + alwaysEmbed: Boolean, +}; +exports.textareaProps = { + autoHeight: Boolean, + fixed: Boolean, + showConfirmBar: { + type: Boolean, + value: true, + }, + disableDefaultPadding: { + type: Boolean, + value: true, + }, +}; diff --git a/miniprogram_npm/@vant/weapp/field/textarea.wxml b/miniprogram_npm/@vant/weapp/field/textarea.wxml new file mode 100644 index 0000000..5015a51 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/textarea.wxml @@ -0,0 +1,29 @@ +<textarea + class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class" + fixed="{{ fixed }}" + focus="{{ focus }}" + cursor="{{ cursor }}" + value="{{ innerValue }}" + auto-focus="{{ autoFocus }}" + disabled="{{ disabled || readonly }}" + maxlength="{{ maxlength }}" + placeholder="{{ placeholder }}" + placeholder-style="{{ placeholderStyle }}" + placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}" + auto-height="{{ !!autosize }}" + style="{{ computed.inputStyle(autosize) }}" + cursor-spacing="{{ cursorSpacing }}" + adjust-position="{{ adjustPosition }}" + show-confirm-bar="{{ showConfirmBar }}" + hold-keyboard="{{ holdKeyboard }}" + selection-end="{{ selectionEnd }}" + selection-start="{{ selectionStart }}" + disable-default-padding="{{ disableDefaultPadding }}" + bindinput="onInput" + bindtap="onClickInput" + bindblur="onBlur" + bindfocus="onFocus" + bindconfirm="onConfirm" + bindlinechange="onLineChange" + bindkeyboardheightchange="onKeyboardHeightChange" +/> diff --git a/miniprogram_npm/@vant/weapp/goods-action-button/index.d.ts b/miniprogram_npm/@vant/weapp/goods-action-button/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-button/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/goods-action-button/index.js b/miniprogram_npm/@vant/weapp/goods-action-button/index.js new file mode 100644 index 0000000..9872224 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-button/index.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var button_1 = require("../mixins/button"); +var link_1 = require("../mixins/link"); +(0, component_1.VantComponent)({ + mixins: [link_1.link, button_1.button], + relation: (0, relation_1.useParent)('goods-action'), + props: { + text: String, + color: String, + loading: Boolean, + disabled: Boolean, + plain: Boolean, + type: { + type: String, + value: 'danger', + }, + }, + methods: { + onClick: function (event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + updateStyle: function () { + if (this.parent == null) { + return; + } + var index = this.index; + var _a = this.parent.children, children = _a === void 0 ? [] : _a; + this.setData({ + isFirst: index === 0, + isLast: index === children.length - 1, + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/goods-action-button/index.json b/miniprogram_npm/@vant/weapp/goods-action-button/index.json new file mode 100644 index 0000000..b567686 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-button/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-button": "../button/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/goods-action-button/index.wxml b/miniprogram_npm/@vant/weapp/goods-action-button/index.wxml new file mode 100644 index 0000000..4505f21 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-button/index.wxml @@ -0,0 +1,30 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<van-button + id="{{ id }}" + lang="{{ lang }}" + type="{{ type }}" + color="{{ color }}" + plain="{{ plain }}" + loading="{{ loading }}" + disabled="{{ disabled }}" + open-type="{{ openType }}" + class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}" + custom-class="van-goods-action-button__inner" + business-id="{{ businessId }}" + session-from="{{ sessionFrom }}" + app-parameter="{{ appParameter }}" + send-message-img="{{ sendMessageImg }}" + send-message-path="{{ sendMessagePath }}" + show-message-card="{{ showMessageCard }}" + send-message-title="{{ sendMessageTitle }}" + bind:click="onClick" + binderror="onError" + bindcontact="onContact" + bindopensetting="onOpenSetting" + bindgetuserinfo="onGetUserInfo" + bindgetphonenumber="onGetPhoneNumber" + bindlaunchapp="onLaunchApp" +> + {{ text }} + <slot></slot> +</van-button> diff --git a/miniprogram_npm/@vant/weapp/goods-action-button/index.wxss b/miniprogram_npm/@vant/weapp/goods-action-button/index.wxss new file mode 100644 index 0000000..759a1d9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-button/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';:host{flex:1}.van-goods-action-button{--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(to right,#ffd01e,#ff8917));--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(to right,#ff6034,#ee0a24));--button-default-height:var(--goods-action-button-height,40px);--button-line-height:var(--goods-action-button-line-height,20px);--button-plain-background-color:var(--goods-action-button-plain-color,#fff);--button-border-width:0;display:block}.van-goods-action-button--first{--button-border-radius:999px 0 0 var(--goods-action-button-border-radius,999px);margin-left:5px}.van-goods-action-button--last{--button-border-radius:0 999px var(--goods-action-button-border-radius,999px) 0;margin-right:5px}.van-goods-action-button--first.van-goods-action-button--last{--button-border-radius:var(--goods-action-button-border-radius,999px)}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{font-weight:var(--font-weight-bold,500)!important;width:100%}@media (max-width:321px){.van-goods-action-button{font-size:13px}} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/goods-action-icon/index.d.ts b/miniprogram_npm/@vant/weapp/goods-action-icon/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-icon/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/goods-action-icon/index.js b/miniprogram_npm/@vant/weapp/goods-action-icon/index.js new file mode 100644 index 0000000..9d9386e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-icon/index.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var button_1 = require("../mixins/button"); +var link_1 = require("../mixins/link"); +(0, component_1.VantComponent)({ + classes: ['icon-class', 'text-class'], + mixins: [link_1.link, button_1.button], + props: { + text: String, + dot: Boolean, + info: String, + icon: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + disabled: Boolean, + loading: Boolean, + }, + methods: { + onClick: function (event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/goods-action-icon/index.json b/miniprogram_npm/@vant/weapp/goods-action-icon/index.json new file mode 100644 index 0000000..93bfe8a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-icon/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-button": "../button/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/goods-action-icon/index.wxml b/miniprogram_npm/@vant/weapp/goods-action-icon/index.wxml new file mode 100644 index 0000000..c769685 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-icon/index.wxml @@ -0,0 +1,36 @@ +<van-button + square + id="{{ id }}" + size="large" + lang="{{ lang }}" + loading="{{ loading }}" + disabled="{{ disabled }}" + open-type="{{ openType }}" + business-id="{{ businessId }}" + custom-class="van-goods-action-icon" + session-from="{{ sessionFrom }}" + app-parameter="{{ appParameter }}" + send-message-img="{{ sendMessageImg }}" + send-message-path="{{ sendMessagePath }}" + show-message-card="{{ showMessageCard }}" + send-message-title="{{ sendMessageTitle }}" + bind:click="onClick" + binderror="onError" + bindcontact="onContact" + bindopensetting="onOpenSetting" + bindgetuserinfo="onGetUserInfo" + bindgetphonenumber="onGetPhoneNumber" + bindlaunchapp="onLaunchApp" +> + <van-icon + wx:if="{{ icon }}" + name="{{ icon }}" + dot="{{ dot }}" + info="{{ info }}" + class-prefix="{{ classPrefix }}" + class="van-goods-action-icon__icon" + custom-class="icon-class" + /> + <slot wx:else name="icon" /> + <text class="text-class">{{ text }}</text> +</van-button> diff --git a/miniprogram_npm/@vant/weapp/goods-action-icon/index.wxss b/miniprogram_npm/@vant/weapp/goods-action-icon/index.wxss new file mode 100644 index 0000000..6e4758d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action-icon/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-goods-action-icon{border:none!important;color:var(--goods-action-icon-text-color,#646566)!important;display:flex!important;flex-direction:column;font-size:var(--goods-action-icon-font-size,10px)!important;height:var(--goods-action-icon-height,50px)!important;justify-content:center!important;line-height:1!important;min-width:var(--goods-action-icon-width,48px)}.van-goods-action-icon__icon{color:var(--goods-action-icon-color,#323233);display:flex;font-size:var(--goods-action-icon-size,18px);margin:0 auto 5px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/goods-action/index.d.ts b/miniprogram_npm/@vant/weapp/goods-action/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/goods-action/index.js b/miniprogram_npm/@vant/weapp/goods-action/index.js new file mode 100644 index 0000000..e49bcbc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action/index.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('goods-action-button', function () { + this.children.forEach(function (item) { + item.updateStyle(); + }); + }), + props: { + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/goods-action/index.json b/miniprogram_npm/@vant/weapp/goods-action/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/goods-action/index.wxml b/miniprogram_npm/@vant/weapp/goods-action/index.wxml new file mode 100644 index 0000000..569450c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action/index.wxml @@ -0,0 +1,5 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="custom-class {{ utils.bem('goods-action', { safe: safeAreaInsetBottom }) }}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/goods-action/index.wxss b/miniprogram_npm/@vant/weapp/goods-action/index.wxss new file mode 100644 index 0000000..7793e77 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/goods-action/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-goods-action{align-items:center;background-color:var(--goods-action-background-color,#fff);bottom:0;box-sizing:initial;display:flex;height:var(--goods-action-height,50px);left:0;position:fixed;right:0}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/grid-item/index.d.ts b/miniprogram_npm/@vant/weapp/grid-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/grid-item/index.js b/miniprogram_npm/@vant/weapp/grid-item/index.js new file mode 100644 index 0000000..a7d47a2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid-item/index.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var link_1 = require("../mixins/link"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useParent)('grid'), + classes: ['content-class', 'icon-class', 'text-class'], + mixins: [link_1.link], + props: { + icon: String, + iconColor: String, + iconPrefix: { + type: String, + value: 'van-icon', + }, + dot: Boolean, + info: null, + badge: null, + text: String, + useSlot: Boolean, + }, + data: { + viewStyle: '', + }, + mounted: function () { + this.updateStyle(); + }, + methods: { + updateStyle: function () { + if (!this.parent) { + return; + } + var _a = this.parent, data = _a.data, children = _a.children; + var columnNum = data.columnNum, border = data.border, square = data.square, gutter = data.gutter, clickable = data.clickable, center = data.center, direction = data.direction, reverse = data.reverse, iconSize = data.iconSize; + this.setData({ + center: center, + border: border, + square: square, + gutter: gutter, + clickable: clickable, + direction: direction, + reverse: reverse, + iconSize: iconSize, + index: children.indexOf(this), + columnNum: columnNum, + }); + }, + onClick: function () { + this.$emit('click'); + this.jumpLink(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/grid-item/index.json b/miniprogram_npm/@vant/weapp/grid-item/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/grid-item/index.wxml b/miniprogram_npm/@vant/weapp/grid-item/index.wxml new file mode 100644 index 0000000..e95087d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid-item/index.wxml @@ -0,0 +1,27 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('grid-item', { square }) }}" + style="{{ computed.wrapperStyle({ square, gutter, columnNum, index }) }}" + bindtap="onClick" +> + <view + class="content-class {{ utils.bem('grid-item__content', [direction, { center, square, reverse, clickable, surround: border && gutter }]) }} {{ border ? 'van-hairline--surround' : '' }}" + style="{{ computed.contentStyle({ square, gutter }) }}" + > + <block wx:if="{{ useSlot }}"> + <slot /> + </block> + <block wx:else> + <view class="van-grid-item__icon icon-class"> + <van-icon wx:if="{{ icon }}" name="{{ icon }}" color="{{ iconColor }}" class-prefix="{{ iconPrefix }}" dot="{{ dot }}" info="{{ badge || info }}" size="{{ iconSize }}" /> + <slot wx:else name="icon"></slot> + </view> + <view class="van-grid-item__text text-class"> + <text wx:if="{{ text }}">{{ text }}</text> + <slot wx:else name="text"></slot> + </view> + </block> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/grid-item/index.wxs b/miniprogram_npm/@vant/weapp/grid-item/index.wxs new file mode 100644 index 0000000..2cfe37d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid-item/index.wxs @@ -0,0 +1,32 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function wrapperStyle(data) { + var width = 100 / data.columnNum + '%'; + + return style({ + width: width, + 'padding-top': data.square ? width : null, + 'padding-right': addUnit(data.gutter), + 'margin-top': + data.index >= data.columnNum && !data.square + ? addUnit(data.gutter) + : null, + }); +} + +function contentStyle(data) { + return data.square + ? style({ + right: addUnit(data.gutter), + bottom: addUnit(data.gutter), + height: 'auto', + }) + : ''; +} + +module.exports = { + wrapperStyle: wrapperStyle, + contentStyle: contentStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/grid-item/index.wxss b/miniprogram_npm/@vant/weapp/grid-item/index.wxss new file mode 100644 index 0000000..acaea84 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-grid-item{box-sizing:border-box;float:left;position:relative}.van-grid-item--square{height:0}.van-grid-item__content{background-color:var(--grid-item-content-background-color,#fff);box-sizing:border-box;display:flex;flex-direction:column;height:100%;padding:var(--grid-item-content-padding,16px 8px)}.van-grid-item__content:after{border-width:0 1px 1px 0;z-index:1}.van-grid-item__content--surround:after{border-width:1px}.van-grid-item__content--center{align-items:center;justify-content:center}.van-grid-item__content--square{left:0;position:absolute;right:0;top:0}.van-grid-item__content--horizontal{flex-direction:row}.van-grid-item__content--horizontal .van-grid-item__text{margin:0 0 0 8px}.van-grid-item__content--reverse{flex-direction:column-reverse}.van-grid-item__content--reverse .van-grid-item__text{margin:0 0 8px}.van-grid-item__content--horizontal.van-grid-item__content--reverse{flex-direction:row-reverse}.van-grid-item__content--horizontal.van-grid-item__content--reverse .van-grid-item__text{margin:0 8px 0 0}.van-grid-item__content--clickable:active{background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{align-items:center;display:flex;font-size:var(--grid-item-icon-size,26px);height:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:var(--grid-item-text-color,#646566);font-size:var(--grid-item-text-font-size,12px)}.van-grid-item__icon+.van-grid-item__text{margin-top:8px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/grid/index.d.ts b/miniprogram_npm/@vant/weapp/grid/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/grid/index.js b/miniprogram_npm/@vant/weapp/grid/index.js new file mode 100644 index 0000000..28d14f4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid/index.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('grid-item'), + props: { + square: { + type: Boolean, + observer: 'updateChildren', + }, + gutter: { + type: null, + 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', + }, + direction: { + type: String, + observer: 'updateChildren', + }, + iconSize: { + type: String, + observer: 'updateChildren', + }, + reverse: { + type: Boolean, + value: false, + observer: 'updateChildren', + }, + }, + methods: { + updateChildren: function () { + this.children.forEach(function (child) { + child.updateStyle(); + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/grid/index.json b/miniprogram_npm/@vant/weapp/grid/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/grid/index.wxml b/miniprogram_npm/@vant/weapp/grid/index.wxml new file mode 100644 index 0000000..2e4118f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid/index.wxml @@ -0,0 +1,8 @@ +<wxs src="./index.wxs" module="computed" /> + +<view + class="van-grid custom-class {{ border && !gutter ? 'van-hairline--top' : '' }}" + style="{{ computed.rootStyle({ gutter }) }}" +> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/grid/index.wxs b/miniprogram_npm/@vant/weapp/grid/index.wxs new file mode 100644 index 0000000..cd3b1bd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid/index.wxs @@ -0,0 +1,13 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style({ + 'padding-left': addUnit(data.gutter), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/grid/index.wxss b/miniprogram_npm/@vant/weapp/grid/index.wxss new file mode 100644 index 0000000..e347440 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/grid/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-grid{box-sizing:border-box;overflow:hidden;position:relative} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/icon/index.d.ts b/miniprogram_npm/@vant/weapp/icon/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/icon/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/icon/index.js b/miniprogram_npm/@vant/weapp/icon/index.js new file mode 100644 index 0000000..103b11e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/icon/index.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + dot: Boolean, + info: null, + size: null, + color: String, + customStyle: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + name: String, + }, + methods: { + onClick: function () { + this.$emit('click'); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/icon/index.json b/miniprogram_npm/@vant/weapp/icon/index.json new file mode 100644 index 0000000..bf0ebe0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/icon/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-info": "../info/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/icon/index.wxml b/miniprogram_npm/@vant/weapp/icon/index.wxml new file mode 100644 index 0000000..3c70174 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/icon/index.wxml @@ -0,0 +1,20 @@ +<wxs src="./index.wxs" module="computed" /> + +<view + class="{{ computed.rootClass({ classPrefix, name }) }}" + style="{{ computed.rootStyle({ customStyle, color, size }) }}" + bindtap="onClick" +> + <van-info + wx:if="{{ info !== null || dot }}" + dot="{{ dot }}" + info="{{ info }}" + custom-class="van-icon__info" + /> + <image + wx:if="{{ computed.isImage(name) }}" + src="{{ name }}" + mode="aspectFit" + class="van-icon__image" + /> +</view> diff --git a/miniprogram_npm/@vant/weapp/icon/index.wxs b/miniprogram_npm/@vant/weapp/icon/index.wxs new file mode 100644 index 0000000..45e3aa0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/icon/index.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function isImage(name) { + return name.indexOf('/') !== -1; +} + +function rootClass(data) { + var classes = ['custom-class']; + + if (data.classPrefix != null) { + classes.push(data.classPrefix); + } + + if (isImage(data.name)) { + classes.push('van-icon--image'); + } else if (data.classPrefix != null) { + classes.push(data.classPrefix + '-' + data.name); + } + + return classes.join(' '); +} + +function rootStyle(data) { + return style([ + { + color: data.color, + 'font-size': addUnit(data.size), + }, + data.customStyle, + ]); +} + +module.exports = { + isImage: isImage, + rootClass: rootClass, + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/icon/index.wxss b/miniprogram_npm/@vant/weapp/icon/index.wxss new file mode 100644 index 0000000..9be9372 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/icon/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-icon{text-rendering:auto;-webkit-font-smoothing:antialiased;font:normal normal normal 14px/1 vant-icon;font-size:inherit;position:relative}.van-icon,.van-icon:before{display:inline-block}.van-icon-exchange:before{content:"\e6af"}.van-icon-eye:before{content:"\e6b0"}.van-icon-enlarge:before{content:"\e6b1"}.van-icon-expand-o:before{content:"\e6b2"}.van-icon-eye-o:before{content:"\e6b3"}.van-icon-expand:before{content:"\e6b4"}.van-icon-filter-o:before{content:"\e6b5"}.van-icon-fire:before{content:"\e6b6"}.van-icon-fail:before{content:"\e6b7"}.van-icon-failure:before{content:"\e6b8"}.van-icon-fire-o:before{content:"\e6b9"}.van-icon-flag-o:before{content:"\e6ba"}.van-icon-font:before{content:"\e6bb"}.van-icon-font-o:before{content:"\e6bc"}.van-icon-gem-o:before{content:"\e6bd"}.van-icon-flower-o:before{content:"\e6be"}.van-icon-gem:before{content:"\e6bf"}.van-icon-gift-card:before{content:"\e6c0"}.van-icon-friends:before{content:"\e6c1"}.van-icon-friends-o:before{content:"\e6c2"}.van-icon-gold-coin:before{content:"\e6c3"}.van-icon-gold-coin-o:before{content:"\e6c4"}.van-icon-good-job-o:before{content:"\e6c5"}.van-icon-gift:before{content:"\e6c6"}.van-icon-gift-o:before{content:"\e6c7"}.van-icon-gift-card-o:before{content:"\e6c8"}.van-icon-good-job:before{content:"\e6c9"}.van-icon-home-o:before{content:"\e6ca"}.van-icon-goods-collect:before{content:"\e6cb"}.van-icon-graphic:before{content:"\e6cc"}.van-icon-goods-collect-o:before{content:"\e6cd"}.van-icon-hot-o:before{content:"\e6ce"}.van-icon-info:before{content:"\e6cf"}.van-icon-hotel-o:before{content:"\e6d0"}.van-icon-info-o:before{content:"\e6d1"}.van-icon-hot-sale-o:before{content:"\e6d2"}.van-icon-hot:before{content:"\e6d3"}.van-icon-like:before{content:"\e6d4"}.van-icon-idcard:before{content:"\e6d5"}.van-icon-invitation:before{content:"\e6d6"}.van-icon-like-o:before{content:"\e6d7"}.van-icon-hot-sale:before{content:"\e6d8"}.van-icon-location-o:before{content:"\e6d9"}.van-icon-location:before{content:"\e6da"}.van-icon-label:before{content:"\e6db"}.van-icon-lock:before{content:"\e6dc"}.van-icon-label-o:before{content:"\e6dd"}.van-icon-map-marked:before{content:"\e6de"}.van-icon-logistics:before{content:"\e6df"}.van-icon-manager:before{content:"\e6e0"}.van-icon-more:before{content:"\e6e1"}.van-icon-live:before{content:"\e6e2"}.van-icon-manager-o:before{content:"\e6e3"}.van-icon-medal:before{content:"\e6e4"}.van-icon-more-o:before{content:"\e6e5"}.van-icon-music-o:before{content:"\e6e6"}.van-icon-music:before{content:"\e6e7"}.van-icon-new-arrival-o:before{content:"\e6e8"}.van-icon-medal-o:before{content:"\e6e9"}.van-icon-new-o:before{content:"\e6ea"}.van-icon-free-postage:before{content:"\e6eb"}.van-icon-newspaper-o:before{content:"\e6ec"}.van-icon-new-arrival:before{content:"\e6ed"}.van-icon-minus:before{content:"\e6ee"}.van-icon-orders-o:before{content:"\e6ef"}.van-icon-new:before{content:"\e6f0"}.van-icon-paid:before{content:"\e6f1"}.van-icon-notes-o:before{content:"\e6f2"}.van-icon-other-pay:before{content:"\e6f3"}.van-icon-pause-circle:before{content:"\e6f4"}.van-icon-pause:before{content:"\e6f5"}.van-icon-pause-circle-o:before{content:"\e6f6"}.van-icon-peer-pay:before{content:"\e6f7"}.van-icon-pending-payment:before{content:"\e6f8"}.van-icon-passed:before{content:"\e6f9"}.van-icon-plus:before{content:"\e6fa"}.van-icon-phone-circle-o:before{content:"\e6fb"}.van-icon-phone-o:before{content:"\e6fc"}.van-icon-printer:before{content:"\e6fd"}.van-icon-photo-fail:before{content:"\e6fe"}.van-icon-phone:before{content:"\e6ff"}.van-icon-photo-o:before{content:"\e700"}.van-icon-play-circle:before{content:"\e701"}.van-icon-play:before{content:"\e702"}.van-icon-phone-circle:before{content:"\e703"}.van-icon-point-gift-o:before{content:"\e704"}.van-icon-point-gift:before{content:"\e705"}.van-icon-play-circle-o:before{content:"\e706"}.van-icon-shrink:before{content:"\e707"}.van-icon-photo:before{content:"\e708"}.van-icon-qr:before{content:"\e709"}.van-icon-qr-invalid:before{content:"\e70a"}.van-icon-question-o:before{content:"\e70b"}.van-icon-revoke:before{content:"\e70c"}.van-icon-replay:before{content:"\e70d"}.van-icon-service:before{content:"\e70e"}.van-icon-question:before{content:"\e70f"}.van-icon-search:before{content:"\e710"}.van-icon-refund-o:before{content:"\e711"}.van-icon-service-o:before{content:"\e712"}.van-icon-scan:before{content:"\e713"}.van-icon-share:before{content:"\e714"}.van-icon-send-gift-o:before{content:"\e715"}.van-icon-share-o:before{content:"\e716"}.van-icon-setting:before{content:"\e717"}.van-icon-points:before{content:"\e718"}.van-icon-photograph:before{content:"\e719"}.van-icon-shop:before{content:"\e71a"}.van-icon-shop-o:before{content:"\e71b"}.van-icon-shop-collect-o:before{content:"\e71c"}.van-icon-shop-collect:before{content:"\e71d"}.van-icon-smile:before{content:"\e71e"}.van-icon-shopping-cart-o:before{content:"\e71f"}.van-icon-sign:before{content:"\e720"}.van-icon-sort:before{content:"\e721"}.van-icon-star-o:before{content:"\e722"}.van-icon-smile-comment-o:before{content:"\e723"}.van-icon-stop:before{content:"\e724"}.van-icon-stop-circle-o:before{content:"\e725"}.van-icon-smile-o:before{content:"\e726"}.van-icon-star:before{content:"\e727"}.van-icon-success:before{content:"\e728"}.van-icon-stop-circle:before{content:"\e729"}.van-icon-records:before{content:"\e72a"}.van-icon-shopping-cart:before{content:"\e72b"}.van-icon-tosend:before{content:"\e72c"}.van-icon-todo-list:before{content:"\e72d"}.van-icon-thumb-circle-o:before{content:"\e72e"}.van-icon-thumb-circle:before{content:"\e72f"}.van-icon-umbrella-circle:before{content:"\e730"}.van-icon-underway:before{content:"\e731"}.van-icon-upgrade:before{content:"\e732"}.van-icon-todo-list-o:before{content:"\e733"}.van-icon-tv-o:before{content:"\e734"}.van-icon-underway-o:before{content:"\e735"}.van-icon-user-o:before{content:"\e736"}.van-icon-vip-card-o:before{content:"\e737"}.van-icon-vip-card:before{content:"\e738"}.van-icon-send-gift:before{content:"\e739"}.van-icon-wap-home:before{content:"\e73a"}.van-icon-wap-nav:before{content:"\e73b"}.van-icon-volume-o:before{content:"\e73c"}.van-icon-video:before{content:"\e73d"}.van-icon-wap-home-o:before{content:"\e73e"}.van-icon-volume:before{content:"\e73f"}.van-icon-warning:before{content:"\e740"}.van-icon-weapp-nav:before{content:"\e741"}.van-icon-wechat-pay:before{content:"\e742"}.van-icon-warning-o:before{content:"\e743"}.van-icon-wechat:before{content:"\e744"}.van-icon-setting-o:before{content:"\e745"}.van-icon-youzan-shield:before{content:"\e746"}.van-icon-warn-o:before{content:"\e747"}.van-icon-smile-comment:before{content:"\e748"}.van-icon-user-circle-o:before{content:"\e749"}.van-icon-video-o:before{content:"\e74a"}.van-icon-add-square:before{content:"\e65c"}.van-icon-add:before{content:"\e65d"}.van-icon-arrow-down:before{content:"\e65e"}.van-icon-arrow-up:before{content:"\e65f"}.van-icon-arrow:before{content:"\e660"}.van-icon-after-sale:before{content:"\e661"}.van-icon-add-o:before{content:"\e662"}.van-icon-alipay:before{content:"\e663"}.van-icon-ascending:before{content:"\e664"}.van-icon-apps-o:before{content:"\e665"}.van-icon-aim:before{content:"\e666"}.van-icon-award:before{content:"\e667"}.van-icon-arrow-left:before{content:"\e668"}.van-icon-award-o:before{content:"\e669"}.van-icon-audio:before{content:"\e66a"}.van-icon-bag-o:before{content:"\e66b"}.van-icon-balance-list:before{content:"\e66c"}.van-icon-back-top:before{content:"\e66d"}.van-icon-bag:before{content:"\e66e"}.van-icon-balance-pay:before{content:"\e66f"}.van-icon-balance-o:before{content:"\e670"}.van-icon-bar-chart-o:before{content:"\e671"}.van-icon-bars:before{content:"\e672"}.van-icon-balance-list-o:before{content:"\e673"}.van-icon-birthday-cake-o:before{content:"\e674"}.van-icon-bookmark:before{content:"\e675"}.van-icon-bill:before{content:"\e676"}.van-icon-bell:before{content:"\e677"}.van-icon-browsing-history-o:before{content:"\e678"}.van-icon-browsing-history:before{content:"\e679"}.van-icon-bookmark-o:before{content:"\e67a"}.van-icon-bulb-o:before{content:"\e67b"}.van-icon-bullhorn-o:before{content:"\e67c"}.van-icon-bill-o:before{content:"\e67d"}.van-icon-calendar-o:before{content:"\e67e"}.van-icon-brush-o:before{content:"\e67f"}.van-icon-card:before{content:"\e680"}.van-icon-cart-o:before{content:"\e681"}.van-icon-cart-circle:before{content:"\e682"}.van-icon-cart-circle-o:before{content:"\e683"}.van-icon-cart:before{content:"\e684"}.van-icon-cash-on-deliver:before{content:"\e685"}.van-icon-cash-back-record:before{content:"\e686"}.van-icon-cashier-o:before{content:"\e687"}.van-icon-chart-trending-o:before{content:"\e688"}.van-icon-certificate:before{content:"\e689"}.van-icon-chat:before{content:"\e68a"}.van-icon-clear:before{content:"\e68b"}.van-icon-chat-o:before{content:"\e68c"}.van-icon-checked:before{content:"\e68d"}.van-icon-clock:before{content:"\e68e"}.van-icon-clock-o:before{content:"\e68f"}.van-icon-close:before{content:"\e690"}.van-icon-closed-eye:before{content:"\e691"}.van-icon-circle:before{content:"\e692"}.van-icon-cluster-o:before{content:"\e693"}.van-icon-column:before{content:"\e694"}.van-icon-comment-circle-o:before{content:"\e695"}.van-icon-cluster:before{content:"\e696"}.van-icon-comment:before{content:"\e697"}.van-icon-comment-o:before{content:"\e698"}.van-icon-comment-circle:before{content:"\e699"}.van-icon-completed:before{content:"\e69a"}.van-icon-credit-pay:before{content:"\e69b"}.van-icon-coupon:before{content:"\e69c"}.van-icon-debit-pay:before{content:"\e69d"}.van-icon-coupon-o:before{content:"\e69e"}.van-icon-contact:before{content:"\e69f"}.van-icon-descending:before{content:"\e6a0"}.van-icon-desktop-o:before{content:"\e6a1"}.van-icon-diamond-o:before{content:"\e6a2"}.van-icon-description:before{content:"\e6a3"}.van-icon-delete:before{content:"\e6a4"}.van-icon-diamond:before{content:"\e6a5"}.van-icon-delete-o:before{content:"\e6a6"}.van-icon-cross:before{content:"\e6a7"}.van-icon-edit:before{content:"\e6a8"}.van-icon-ellipsis:before{content:"\e6a9"}.van-icon-down:before{content:"\e6aa"}.van-icon-discount:before{content:"\e6ab"}.van-icon-ecard-pay:before{content:"\e6ac"}.van-icon-envelop-o:before{content:"\e6ae"}.van-icon-shield-o:before{content:"\e74b"}.van-icon-guide-o:before{content:"\e74c"}.van-icon-cash-o:before{content:"\e74d"}@font-face{font-display:auto;font-family:vant-icon;font-style:normal;font-weight:400;src:url(https://at.alicdn.com/t/font_2553510_5imfhdc20ag.woff2?t=1640074908811) format("woff2"),url(https://at.alicdn.com/t/font_2553510_5imfhdc20ag.woff?t=1640074908811) format("woff"),url(https://at.alicdn.com/t/font_2553510_5imfhdc20ag.ttf?t=1640074908811) format("truetype")}:host{align-items:center;display:inline-flex;justify-content:center}.van-icon--image{height:1em;width:1em}.van-icon__image{height:100%;width:100%}.van-icon__info{z-index:1} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/image/index.d.ts b/miniprogram_npm/@vant/weapp/image/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/image/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/image/index.js b/miniprogram_npm/@vant/weapp/image/index.js new file mode 100644 index 0000000..d4c62fc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/image/index.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var button_1 = require("../mixins/button"); +(0, component_1.VantComponent)({ + mixins: [button_1.button], + classes: ['custom-class', 'loading-class', 'error-class', 'image-class'], + props: { + src: { + type: String, + observer: function () { + this.setData({ + error: false, + loading: true, + }); + }, + }, + round: Boolean, + width: null, + height: null, + radius: null, + lazyLoad: Boolean, + useErrorSlot: Boolean, + useLoadingSlot: Boolean, + showMenuByLongpress: Boolean, + fit: { + type: String, + value: 'fill', + }, + showError: { + type: Boolean, + value: true, + }, + showLoading: { + type: Boolean, + value: true, + }, + }, + data: { + error: false, + loading: true, + viewStyle: '', + }, + methods: { + onLoad: function (event) { + this.setData({ + loading: false, + }); + this.$emit('load', event.detail); + }, + onError: function (event) { + this.setData({ + loading: false, + error: true, + }); + this.$emit('error', event.detail); + }, + onClick: function (event) { + this.$emit('click', event.detail); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/image/index.json b/miniprogram_npm/@vant/weapp/image/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/image/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/image/index.wxml b/miniprogram_npm/@vant/weapp/image/index.wxml new file mode 100644 index 0000000..d3092bd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/image/index.wxml @@ -0,0 +1,34 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + style="{{ computed.rootStyle({ width, height, radius }) }}" + class="custom-class {{ utils.bem('image', { round })}}" + bind:tap="onClick" +> + <image + wx:if="{{ !error }}" + src="{{ src }}" + mode="{{ computed.mode(fit) }}" + lazy-load="{{ lazyLoad }}" + class="image-class van-image__img" + show-menu-by-longpress="{{ showMenuByLongpress }}" + bind:load="onLoad" + bind:error="onError" + /> + + <view + wx:if="{{ loading && showLoading }}" + class="loading-class van-image__loading" + > + <slot wx:if="{{ useLoadingSlot }}" name="loading" /> + <van-icon wx:else name="photo" custom-class="van-image__loading-icon" /> + </view> + <view + wx:if="{{ error && showError }}" + class="error-class van-image__error" + > + <slot wx:if="{{ useErrorSlot }}" name="error" /> + <van-icon wx:else name="photo-fail" custom-class="van-image__error-icon" /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/image/index.wxs b/miniprogram_npm/@vant/weapp/image/index.wxs new file mode 100644 index 0000000..cec14b8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/image/index.wxs @@ -0,0 +1,32 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + width: addUnit(data.width), + height: addUnit(data.height), + 'border-radius': addUnit(data.radius), + }, + data.radius ? 'overflow: hidden' : null, + ]); +} + +var FIT_MODE_MAP = { + none: 'center', + fill: 'scaleToFill', + cover: 'aspectFill', + contain: 'aspectFit', + widthFix: 'widthFix', + heightFix: 'heightFix', +}; + +function mode(fit) { + return FIT_MODE_MAP[fit]; +} + +module.exports = { + rootStyle: rootStyle, + mode: mode, +}; diff --git a/miniprogram_npm/@vant/weapp/image/index.wxss b/miniprogram_npm/@vant/weapp/image/index.wxss new file mode 100644 index 0000000..a9c6ebb --- /dev/null +++ b/miniprogram_npm/@vant/weapp/image/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-image{display:inline-block;position:relative}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/index-anchor/index.d.ts b/miniprogram_npm/@vant/weapp/index-anchor/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-anchor/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/index-anchor/index.js b/miniprogram_npm/@vant/weapp/index-anchor/index.js new file mode 100644 index 0000000..9a361a9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-anchor/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = require("../common/utils"); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useParent)('index-bar'), + props: { + useSlot: Boolean, + index: null, + }, + data: { + active: false, + wrapperStyle: '', + anchorStyle: '', + }, + methods: { + scrollIntoView: function (scrollTop) { + var _this = this; + (0, utils_1.getRect)(this, '.van-index-anchor-wrapper').then(function (rect) { + wx.pageScrollTo({ + duration: 0, + scrollTop: scrollTop + rect.top - _this.parent.data.stickyOffsetTop, + }); + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/index-anchor/index.json b/miniprogram_npm/@vant/weapp/index-anchor/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-anchor/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/index-anchor/index.wxml b/miniprogram_npm/@vant/weapp/index-anchor/index.wxml new file mode 100644 index 0000000..49affa7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-anchor/index.wxml @@ -0,0 +1,14 @@ +<view + class="van-index-anchor-wrapper" + style="{{ wrapperStyle }}" +> + <view + class="van-index-anchor {{ active ? 'van-index-anchor--active van-hairline--bottom' : '' }}" + style="{{ anchorStyle }}" + > + <slot wx:if="{{ useSlot }}"/> + <block wx:else> + <text>{{ index }}</text> + </block> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/index-anchor/index.wxss b/miniprogram_npm/@vant/weapp/index-anchor/index.wxss new file mode 100644 index 0000000..4b91560 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-anchor/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-index-anchor{background-color:var(--index-anchor-background-color,transparent);color:var(--index-anchor-text-color,#323233);font-size:var(--index-anchor-font-size,14px);font-weight:var(--index-anchor-font-weight,500);line-height:var(--index-anchor-line-height,32px);padding:var(--index-anchor-padding,0 16px)}.van-index-anchor--active{background-color:var(--index-anchor-active-background-color,#fff);color:var(--index-anchor-active-text-color,#07c160);left:0;right:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/index-bar/index.d.ts b/miniprogram_npm/@vant/weapp/index-bar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-bar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/index-bar/index.js b/miniprogram_npm/@vant/weapp/index-bar/index.js new file mode 100644 index 0000000..afc5412 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-bar/index.js @@ -0,0 +1,243 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var color_1 = require("../common/color"); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var utils_1 = require("../common/utils"); +var page_scroll_1 = require("../mixins/page-scroll"); +var indexList = function () { + var indexList = []; + var charCodeOfA = 'A'.charCodeAt(0); + for (var i = 0; i < 26; i++) { + indexList.push(String.fromCharCode(charCodeOfA + i)); + } + return indexList; +}; +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('index-anchor', function () { + this.updateData(); + }), + props: { + sticky: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 1, + }, + highlightColor: { + type: String, + value: color_1.GREEN, + }, + stickyOffsetTop: { + type: Number, + value: 0, + }, + indexList: { + type: Array, + value: indexList(), + }, + }, + mixins: [ + (0, page_scroll_1.pageScrollMixin)(function (event) { + this.scrollTop = (event === null || event === void 0 ? void 0 : event.scrollTop) || 0; + this.onScroll(); + }), + ], + data: { + activeAnchorIndex: null, + showSidebar: false, + }, + created: function () { + this.scrollTop = 0; + }, + methods: { + updateData: function () { + var _this = this; + wx.nextTick(function () { + if (_this.timer != null) { + clearTimeout(_this.timer); + } + _this.timer = setTimeout(function () { + _this.setData({ + showSidebar: !!_this.children.length, + }); + _this.setRect().then(function () { + _this.onScroll(); + }); + }, 0); + }); + }, + setRect: function () { + return Promise.all([ + this.setAnchorsRect(), + this.setListRect(), + this.setSiderbarRect(), + ]); + }, + setAnchorsRect: function () { + var _this = this; + return Promise.all(this.children.map(function (anchor) { + return (0, utils_1.getRect)(anchor, '.van-index-anchor-wrapper').then(function (rect) { + Object.assign(anchor, { + height: rect.height, + top: rect.top + _this.scrollTop, + }); + }); + })); + }, + setListRect: function () { + var _this = this; + return (0, utils_1.getRect)(this, '.van-index-bar').then(function (rect) { + if (!(0, utils_1.isDef)(rect)) { + return; + } + Object.assign(_this, { + height: rect.height, + top: rect.top + _this.scrollTop, + }); + }); + }, + setSiderbarRect: function () { + var _this = this; + return (0, utils_1.getRect)(this, '.van-index-bar__sidebar').then(function (res) { + if (!(0, utils_1.isDef)(res)) { + return; + } + _this.sidebar = { + height: res.height, + top: res.top, + }; + }); + }, + setDiffData: function (_a) { + var target = _a.target, data = _a.data; + var diffData = {}; + Object.keys(data).forEach(function (key) { + if (target.data[key] !== data[key]) { + diffData[key] = data[key]; + } + }); + if (Object.keys(diffData).length) { + target.setData(diffData); + } + }, + getAnchorRect: function (anchor) { + return (0, utils_1.getRect)(anchor, '.van-index-anchor-wrapper').then(function (rect) { return ({ + height: rect.height, + top: rect.top, + }); }); + }, + getActiveAnchorIndex: function () { + var _a = this, children = _a.children, scrollTop = _a.scrollTop; + var _b = this.data, sticky = _b.sticky, stickyOffsetTop = _b.stickyOffsetTop; + for (var i = this.children.length - 1; i >= 0; i--) { + var preAnchorHeight = i > 0 ? children[i - 1].height : 0; + var reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0; + if (reachTop + scrollTop >= children[i].top) { + return i; + } + } + return -1; + }, + onScroll: function () { + var _this = this; + var _a = this, _b = _a.children, children = _b === void 0 ? [] : _b, scrollTop = _a.scrollTop; + if (!children.length) { + return; + } + var _c = this.data, sticky = _c.sticky, stickyOffsetTop = _c.stickyOffsetTop, zIndex = _c.zIndex, highlightColor = _c.highlightColor; + var active = this.getActiveAnchorIndex(); + this.setDiffData({ + target: this, + data: { + activeAnchorIndex: active, + }, + }); + if (sticky) { + var isActiveAnchorSticky_1 = false; + if (active !== -1) { + isActiveAnchorSticky_1 = + children[active].top <= stickyOffsetTop + scrollTop; + } + children.forEach(function (item, index) { + if (index === active) { + var wrapperStyle = ''; + var anchorStyle = "\n color: ".concat(highlightColor, ";\n "); + if (isActiveAnchorSticky_1) { + wrapperStyle = "\n height: ".concat(children[index].height, "px;\n "); + anchorStyle = "\n position: fixed;\n top: ".concat(stickyOffsetTop, "px;\n z-index: ").concat(zIndex, ";\n color: ").concat(highlightColor, ";\n "); + } + _this.setDiffData({ + target: item, + data: { + active: true, + anchorStyle: anchorStyle, + wrapperStyle: wrapperStyle, + }, + }); + } + else if (index === active - 1) { + var currentAnchor = children[index]; + var currentOffsetTop = currentAnchor.top; + var targetOffsetTop = index === children.length - 1 + ? _this.top + : children[index + 1].top; + var parentOffsetHeight = targetOffsetTop - currentOffsetTop; + var translateY = parentOffsetHeight - currentAnchor.height; + var anchorStyle = "\n position: relative;\n transform: translate3d(0, ".concat(translateY, "px, 0);\n z-index: ").concat(zIndex, ";\n color: ").concat(highlightColor, ";\n "); + _this.setDiffData({ + target: item, + data: { + active: true, + anchorStyle: anchorStyle, + }, + }); + } + else { + _this.setDiffData({ + target: item, + data: { + active: false, + anchorStyle: '', + wrapperStyle: '', + }, + }); + } + }); + } + }, + onClick: function (event) { + this.scrollToAnchor(event.target.dataset.index); + }, + onTouchMove: function (event) { + var sidebarLength = this.children.length; + var touch = event.touches[0]; + var itemHeight = this.sidebar.height / sidebarLength; + var 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: function () { + this.scrollToAnchorIndex = null; + }, + scrollToAnchor: function (index) { + var _this = this; + if (typeof index !== 'number' || this.scrollToAnchorIndex === index) { + return; + } + this.scrollToAnchorIndex = index; + var anchor = this.children.find(function (item) { return item.data.index === _this.data.indexList[index]; }); + if (anchor) { + anchor.scrollIntoView(this.scrollTop); + this.$emit('select', anchor.data.index); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/index-bar/index.json b/miniprogram_npm/@vant/weapp/index-bar/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-bar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/index-bar/index.wxml b/miniprogram_npm/@vant/weapp/index-bar/index.wxml new file mode 100644 index 0000000..19a59cf --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-bar/index.wxml @@ -0,0 +1,22 @@ +<view class="van-index-bar"> + <slot /> + + <view + wx:if="{{ showSidebar }}" + class="van-index-bar__sidebar" + catch:tap="onClick" + catch:touchmove="onTouchMove" + catch:touchend="onTouchStop" + catch:touchcancel="onTouchStop" + > + <view + wx:for="{{ indexList }}" + wx:key="index" + class="van-index-bar__index" + style="z-index: {{ zIndex + 1 }}; color: {{ activeAnchorIndex === index ? highlightColor : '' }}" + data-index="{{ index }}" + > + {{ item }} + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/index-bar/index.wxss b/miniprogram_npm/@vant/weapp/index-bar/index.wxss new file mode 100644 index 0000000..8568801 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/index-bar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-index-bar{position:relative}.van-index-bar__sidebar{display:flex;flex-direction:column;position:fixed;right:0;text-align:center;top:50%;transform:translateY(-50%);-webkit-user-select:none;user-select:none}.van-index-bar__index{font-size:var(--index-bar-index-font-size,10px);font-weight:500;line-height:var(--index-bar-index-line-height,14px);padding:0 var(--padding-base,4px) 0 var(--padding-md,16px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/info/index.d.ts b/miniprogram_npm/@vant/weapp/info/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/info/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/info/index.js b/miniprogram_npm/@vant/weapp/info/index.js new file mode 100644 index 0000000..e61af73 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/info/index.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + dot: Boolean, + info: null, + customStyle: String, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/info/index.json b/miniprogram_npm/@vant/weapp/info/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/info/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/info/index.wxml b/miniprogram_npm/@vant/weapp/info/index.wxml new file mode 100644 index 0000000..b39b524 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/info/index.wxml @@ -0,0 +1,7 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + wx:if="{{ info !== null && info !== '' || dot }}" + class="van-info {{ utils.bem('info', { dot }) }} custom-class" + style="{{ customStyle }}" +>{{ dot ? '' : info }}</view> diff --git a/miniprogram_npm/@vant/weapp/info/index.wxss b/miniprogram_npm/@vant/weapp/info/index.wxss new file mode 100644 index 0000000..375ed5a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/info/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-info{align-items:center;background-color:var(--info-background-color,#ee0a24);border:var(--info-border-width,1px) solid #fff;border-radius:var(--info-size,16px);box-sizing:border-box;color:var(--info-color,#fff);display:inline-flex;font-family:var(--info-font-family,-apple-system-font,Helvetica Neue,Arial,sans-serif);font-size:var(--info-font-size,12px);font-weight:var(--info-font-weight,500);height:var(--info-size,16px);justify-content:center;min-width:var(--info-size,16px);padding:var(--info-padding,0 3px);position:absolute;right:0;top:0;transform:translate(50%,-50%);transform-origin:100%;white-space:nowrap}.van-info--dot{background-color:var(--info-dot-color,#ee0a24);border-radius:100%;height:var(--info-dot-size,8px);min-width:0;width:var(--info-dot-size,8px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/loading/index.d.ts b/miniprogram_npm/@vant/weapp/loading/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/loading/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/loading/index.js b/miniprogram_npm/@vant/weapp/loading/index.js new file mode 100644 index 0000000..be9c0ef --- /dev/null +++ b/miniprogram_npm/@vant/weapp/loading/index.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + color: String, + vertical: Boolean, + type: { + type: String, + value: 'circular', + }, + size: String, + textSize: String, + }, + data: { + array12: Array.from({ length: 12 }), + }, +}); diff --git a/miniprogram_npm/@vant/weapp/loading/index.json b/miniprogram_npm/@vant/weapp/loading/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/loading/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/loading/index.wxml b/miniprogram_npm/@vant/weapp/loading/index.wxml new file mode 100644 index 0000000..7d4a539 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/loading/index.wxml @@ -0,0 +1,19 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class {{ utils.bem('loading', { vertical }) }}"> + <view + class="van-loading__spinner van-loading__spinner--{{ type }}" + style="{{ computed.spinnerStyle({ color, size }) }}" + > + <view + wx:if="{{ type === 'spinner' }}" + wx:for="{{ array12 }}" + wx:key="index" + class="van-loading__dot" + /> + </view> + <view class="van-loading__text" style="{{ computed.textStyle({ textSize }) }}"> + <slot /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/loading/index.wxs b/miniprogram_npm/@vant/weapp/loading/index.wxs new file mode 100644 index 0000000..02a0b80 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/loading/index.wxs @@ -0,0 +1,22 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function spinnerStyle(data) { + return style({ + color: data.color, + width: addUnit(data.size), + height: addUnit(data.size), + }); +} + +function textStyle(data) { + return style({ + 'font-size': addUnit(data.textSize), + }); +} + +module.exports = { + spinnerStyle: spinnerStyle, + textStyle: textStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/loading/index.wxss b/miniprogram_npm/@vant/weapp/loading/index.wxss new file mode 100644 index 0000000..fc84e84 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/loading/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{align-items:center;color:var(--loading-spinner-color,#c8c9cc);display:inline-flex;justify-content:center}.van-loading__spinner{animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;box-sizing:border-box;height:var(--loading-spinner-size,30px);max-height:100%;max-width:100%;position:relative;width:var(--loading-spinner-size,30px)}.van-loading__spinner--spinner{animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-radius:100%;border-top-color:initial}.van-loading__text{color:var(--loading-text-color,#969799);font-size:var(--loading-text-font-size,14px);line-height:var(--loading-text-line-height,20px);margin-left:var(--padding-xs,8px)}.van-loading__text:empty{display:none}.van-loading--vertical{flex-direction:column}.van-loading--vertical .van-loading__text{margin:var(--padding-xs,8px) 0 0}.van-loading__dot{height:100%;left:0;position:absolute;top:0;width:100%}.van-loading__dot:before{background-color:currentColor;border-radius:40%;content:" ";display:block;height:25%;margin:0 auto;width:2px}.van-loading__dot:first-of-type{opacity:1;transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;transform:rotate(1turn)}@keyframes van-rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/mixins/basic.d.ts b/miniprogram_npm/@vant/weapp/mixins/basic.d.ts new file mode 100644 index 0000000..b273369 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/basic.d.ts @@ -0,0 +1 @@ +export declare const basic: string; diff --git a/miniprogram_npm/@vant/weapp/mixins/basic.js b/miniprogram_npm/@vant/weapp/mixins/basic.js new file mode 100644 index 0000000..4373ad4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/basic.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.basic = void 0; +exports.basic = Behavior({ + methods: { + $emit: function (name, detail, options) { + this.triggerEvent(name, detail, options); + }, + set: function (data) { + this.setData(data); + return new Promise(function (resolve) { return wx.nextTick(resolve); }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/mixins/button.d.ts b/miniprogram_npm/@vant/weapp/mixins/button.d.ts new file mode 100644 index 0000000..b51db87 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/button.d.ts @@ -0,0 +1 @@ +export declare const button: string; diff --git a/miniprogram_npm/@vant/weapp/mixins/button.js b/miniprogram_npm/@vant/weapp/mixins/button.js new file mode 100644 index 0000000..83640ce --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/button.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.button = void 0; +var version_1 = require("../common/version"); +exports.button = Behavior({ + externalClasses: ['hover-class'], + properties: { + id: String, + lang: String, + businessId: Number, + sessionFrom: String, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean, + appParameter: String, + ariaLabel: String, + openType: String, + getUserProfileDesc: String, + }, + data: { + canIUseGetUserProfile: (0, version_1.canIUseGetUserProfile)(), + }, + methods: { + onGetUserInfo: function (event) { + this.triggerEvent('getuserinfo', event.detail); + }, + onContact: function (event) { + this.triggerEvent('contact', event.detail); + }, + onGetPhoneNumber: function (event) { + this.triggerEvent('getphonenumber', event.detail); + }, + onError: function (event) { + this.triggerEvent('error', event.detail); + }, + onLaunchApp: function (event) { + this.triggerEvent('launchapp', event.detail); + }, + onOpenSetting: function (event) { + this.triggerEvent('opensetting', event.detail); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/mixins/link.d.ts b/miniprogram_npm/@vant/weapp/mixins/link.d.ts new file mode 100644 index 0000000..d58043b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/link.d.ts @@ -0,0 +1 @@ +export declare const link: string; diff --git a/miniprogram_npm/@vant/weapp/mixins/link.js b/miniprogram_npm/@vant/weapp/mixins/link.js new file mode 100644 index 0000000..14cb7e8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/link.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.link = void 0; +exports.link = Behavior({ + properties: { + url: String, + linkType: { + type: String, + value: 'navigateTo', + }, + }, + methods: { + jumpLink: function (urlKey) { + if (urlKey === void 0) { urlKey = 'url'; } + var url = this.data[urlKey]; + if (url) { + if (this.data.linkType === 'navigateTo' && + getCurrentPages().length > 9) { + wx.redirectTo({ url: url }); + } + else { + wx[this.data.linkType]({ url: url }); + } + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/mixins/page-scroll.d.ts b/miniprogram_npm/@vant/weapp/mixins/page-scroll.d.ts new file mode 100644 index 0000000..a316bb8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/page-scroll.d.ts @@ -0,0 +1,5 @@ +/// <reference types="miniprogram-api-typings" /> +declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption; +declare type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void; +export declare const pageScrollMixin: (scroller: Scroller) => string; +export {}; diff --git a/miniprogram_npm/@vant/weapp/mixins/page-scroll.js b/miniprogram_npm/@vant/weapp/mixins/page-scroll.js new file mode 100644 index 0000000..6857a97 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/page-scroll.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pageScrollMixin = void 0; +var utils_1 = require("../common/utils"); +function onPageScroll(event) { + var _a = (0, utils_1.getCurrentPage)().vanPageScroller, vanPageScroller = _a === void 0 ? [] : _a; + vanPageScroller.forEach(function (scroller) { + if (typeof scroller === 'function') { + // @ts-ignore + scroller(event); + } + }); +} +var pageScrollMixin = function (scroller) { + return Behavior({ + attached: function () { + var page = (0, utils_1.getCurrentPage)(); + if (!(0, utils_1.isDef)(page)) { + return; + } + if (Array.isArray(page.vanPageScroller)) { + page.vanPageScroller.push(scroller.bind(this)); + } + else { + page.vanPageScroller = + typeof page.onPageScroll === 'function' + ? [page.onPageScroll.bind(page), scroller.bind(this)] + : [scroller.bind(this)]; + } + page.onPageScroll = onPageScroll; + }, + detached: function () { + var _a; + var page = (0, utils_1.getCurrentPage)(); + if ((0, utils_1.isDef)(page)) { + page.vanPageScroller = + ((_a = page.vanPageScroller) === null || _a === void 0 ? void 0 : _a.filter(function (item) { return item !== scroller; })) || []; + } + }, + }); +}; +exports.pageScrollMixin = pageScrollMixin; diff --git a/miniprogram_npm/@vant/weapp/mixins/touch.d.ts b/miniprogram_npm/@vant/weapp/mixins/touch.d.ts new file mode 100644 index 0000000..35ee831 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/touch.d.ts @@ -0,0 +1 @@ +export declare const touch: string; diff --git a/miniprogram_npm/@vant/weapp/mixins/touch.js b/miniprogram_npm/@vant/weapp/mixins/touch.js new file mode 100644 index 0000000..d762c2c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/touch.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.touch = void 0; +// @ts-nocheck +var MIN_DISTANCE = 10; +function getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; +} +exports.touch = Behavior({ + methods: { + resetTouchStatus: function () { + this.direction = ''; + this.deltaX = 0; + this.deltaY = 0; + this.offsetX = 0; + this.offsetY = 0; + }, + touchStart: function (event) { + this.resetTouchStatus(); + var touch = event.touches[0]; + this.startX = touch.clientX; + this.startY = touch.clientY; + }, + touchMove: function (event) { + var 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/miniprogram_npm/@vant/weapp/mixins/transition.d.ts b/miniprogram_npm/@vant/weapp/mixins/transition.d.ts new file mode 100644 index 0000000..dd829e5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/transition.d.ts @@ -0,0 +1 @@ +export declare function transition(showDefaultValue: boolean): string; diff --git a/miniprogram_npm/@vant/weapp/mixins/transition.js b/miniprogram_npm/@vant/weapp/mixins/transition.js new file mode 100644 index 0000000..2b29431 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/mixins/transition.js @@ -0,0 +1,121 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.transition = void 0; +// @ts-nocheck +var utils_1 = require("../common/utils"); +var validator_1 = require("../common/validator"); +var getClassNames = function (name) { return ({ + enter: "van-".concat(name, "-enter van-").concat(name, "-enter-active enter-class enter-active-class"), + 'enter-to': "van-".concat(name, "-enter-to van-").concat(name, "-enter-active enter-to-class enter-active-class"), + leave: "van-".concat(name, "-leave van-").concat(name, "-leave-active leave-class leave-active-class"), + 'leave-to': "van-".concat(name, "-leave-to van-").concat(name, "-leave-active leave-to-class leave-active-class"), +}); }; +function transition(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, + }, + ready: function () { + if (this.data.show === true) { + this.observeShow(true, false); + } + }, + methods: { + observeShow: function (value, old) { + if (value === old) { + return; + } + value ? this.enter() : this.leave(); + }, + enter: function () { + var _this = this; + var _a = this.data, duration = _a.duration, name = _a.name; + var classNames = getClassNames(name); + var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration; + this.status = 'enter'; + this.$emit('before-enter'); + (0, utils_1.requestAnimationFrame)(function () { + if (_this.status !== 'enter') { + return; + } + _this.$emit('enter'); + _this.setData({ + inited: true, + display: true, + classes: classNames.enter, + currentDuration: currentDuration, + }); + (0, utils_1.requestAnimationFrame)(function () { + if (_this.status !== 'enter') { + return; + } + _this.transitionEnded = false; + _this.setData({ classes: classNames['enter-to'] }); + }); + }); + }, + leave: function () { + var _this = this; + if (!this.data.display) { + return; + } + var _a = this.data, duration = _a.duration, name = _a.name; + var classNames = getClassNames(name); + var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration; + this.status = 'leave'; + this.$emit('before-leave'); + (0, utils_1.requestAnimationFrame)(function () { + if (_this.status !== 'leave') { + return; + } + _this.$emit('leave'); + _this.setData({ + classes: classNames.leave, + currentDuration: currentDuration, + }); + (0, utils_1.requestAnimationFrame)(function () { + if (_this.status !== 'leave') { + return; + } + _this.transitionEnded = false; + setTimeout(function () { return _this.onTransitionEnd(); }, currentDuration); + _this.setData({ classes: classNames['leave-to'] }); + }); + }); + }, + onTransitionEnd: function () { + if (this.transitionEnded) { + return; + } + this.transitionEnded = true; + this.$emit("after-".concat(this.status)); + var _a = this.data, show = _a.show, display = _a.display; + if (!show && display) { + this.setData({ display: false }); + } + }, + }, + }); +} +exports.transition = transition; diff --git a/miniprogram_npm/@vant/weapp/nav-bar/index.d.ts b/miniprogram_npm/@vant/weapp/nav-bar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/nav-bar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/nav-bar/index.js b/miniprogram_npm/@vant/weapp/nav-bar/index.js new file mode 100644 index 0000000..376b561 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/nav-bar/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + classes: ['title-class'], + props: { + title: String, + fixed: { + type: Boolean, + observer: 'setHeight', + }, + placeholder: { + type: Boolean, + observer: 'setHeight', + }, + leftText: String, + rightText: String, + customStyle: String, + leftArrow: Boolean, + border: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 1, + }, + safeAreaInsetTop: { + type: Boolean, + value: true, + }, + }, + data: { + height: 46, + }, + created: function () { + var statusBarHeight = (0, utils_1.getSystemInfoSync)().statusBarHeight; + this.setData({ + statusBarHeight: statusBarHeight, + height: 46 + statusBarHeight, + }); + }, + mounted: function () { + this.setHeight(); + }, + methods: { + onClickLeft: function () { + this.$emit('click-left'); + }, + onClickRight: function () { + this.$emit('click-right'); + }, + setHeight: function () { + var _this = this; + if (!this.data.fixed || !this.data.placeholder) { + return; + } + wx.nextTick(function () { + (0, utils_1.getRect)(_this, '.van-nav-bar').then(function (res) { + if (res && 'height' in res) { + _this.setData({ height: res.height }); + } + }); + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/nav-bar/index.json b/miniprogram_npm/@vant/weapp/nav-bar/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/nav-bar/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/nav-bar/index.wxml b/miniprogram_npm/@vant/weapp/nav-bar/index.wxml new file mode 100644 index 0000000..b6405fd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/nav-bar/index.wxml @@ -0,0 +1,42 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view wx:if="{{ fixed && placeholder }}" style="height: {{ height }}px;" /> + +<view + class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}" + style="{{ computed.barStyle({ zIndex, statusBarHeight, safeAreaInsetTop }) }}; {{ customStyle }}" +> + <view class="van-nav-bar__content"> + <view class="van-nav-bar__left" bind:tap="onClickLeft"> + <block wx:if="{{ leftArrow || leftText }}"> + <van-icon + wx:if="{{ leftArrow }}" + size="16px" + name="arrow-left" + custom-class="van-nav-bar__arrow" + /> + <view + wx:if="{{ leftText }}" + class="van-nav-bar__text" + hover-class="van-nav-bar__text--hover" + hover-stay-time="70" + >{{ leftText }}</view> + </block> + <slot wx:else name="left" /> + </view> + <view class="van-nav-bar__title title-class van-ellipsis"> + <block wx:if="{{ title }}">{{ title }}</block> + <slot wx:else name="title" /> + </view> + <view class="van-nav-bar__right" bind:tap="onClickRight"> + <view + wx:if="{{ rightText }}" + class="van-nav-bar__text" + hover-class="van-nav-bar__text--hover" + hover-stay-time="70" + >{{ rightText }}</view> + <slot wx:else name="right" /> + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/nav-bar/index.wxs b/miniprogram_npm/@vant/weapp/nav-bar/index.wxs new file mode 100644 index 0000000..55b4158 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/nav-bar/index.wxs @@ -0,0 +1,13 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function barStyle(data) { + return style({ + 'z-index': data.zIndex, + 'padding-top': data.safeAreaInsetTop ? data.statusBarHeight + 'px' : 0, + }); +} + +module.exports = { + barStyle: barStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/nav-bar/index.wxss b/miniprogram_npm/@vant/weapp/nav-bar/index.wxss new file mode 100644 index 0000000..94c5b44 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/nav-bar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-nav-bar{background-color:var(--nav-bar-background-color,#fff);height:var(--nav-bar-height,46px);line-height:var(--nav-bar-height,46px);position:relative;text-align:center;-webkit-user-select:none;user-select:none}.van-nav-bar__content{height:100%;position:relative}.van-nav-bar__text{color:var(--nav-bar-text-color,#1989fa);display:inline-block;margin:0 calc(var(--padding-md, 16px)*-1);padding:0 var(--padding-md,16px);vertical-align:middle}.van-nav-bar__text--hover{background-color:#f2f3f5}.van-nav-bar__arrow{color:var(--nav-bar-icon-color,#1989fa)!important;font-size:var(--nav-bar-arrow-size,16px)!important;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.van-nav-bar__title{color:var(--nav-bar-title-text-color,#323233);font-size:var(--nav-bar-title-font-size,16px);font-weight:var(--font-weight-bold,500);margin:0 auto;max-width:60%}.van-nav-bar__left,.van-nav-bar__right{align-items:center;bottom:0;display:flex;font-size:var(--font-size-md,14px);position:absolute;top:0}.van-nav-bar__left{left:var(--padding-md,16px)}.van-nav-bar__right{right:var(--padding-md,16px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/notice-bar/index.d.ts b/miniprogram_npm/@vant/weapp/notice-bar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notice-bar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/notice-bar/index.js b/miniprogram_npm/@vant/weapp/notice-bar/index.js new file mode 100644 index 0000000..9f2d84e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notice-bar/index.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + props: { + text: { + type: String, + value: '', + observer: 'init', + }, + mode: { + type: String, + value: '', + }, + url: { + type: String, + value: '', + }, + openType: { + type: String, + value: 'navigate', + }, + delay: { + type: Number, + value: 1, + }, + speed: { + type: Number, + value: 60, + observer: 'init', + }, + scrollable: null, + leftIcon: { + type: String, + value: '', + }, + color: String, + backgroundColor: String, + background: String, + wrapable: Boolean, + }, + data: { + show: true, + }, + created: function () { + this.resetAnimation = wx.createAnimation({ + duration: 0, + timingFunction: 'linear', + }); + }, + destroyed: function () { + this.timer && clearTimeout(this.timer); + }, + mounted: function () { + this.init(); + }, + methods: { + init: function () { + var _this = this; + (0, utils_1.requestAnimationFrame)(function () { + Promise.all([ + (0, utils_1.getRect)(_this, '.van-notice-bar__content'), + (0, utils_1.getRect)(_this, '.van-notice-bar__wrap'), + ]).then(function (rects) { + var contentRect = rects[0], wrapRect = rects[1]; + var _a = _this.data, speed = _a.speed, scrollable = _a.scrollable, delay = _a.delay; + if (contentRect == null || + wrapRect == null || + !contentRect.width || + !wrapRect.width || + scrollable === false) { + return; + } + if (scrollable || wrapRect.width < contentRect.width) { + var duration = ((wrapRect.width + contentRect.width) / speed) * 1000; + _this.wrapWidth = wrapRect.width; + _this.contentWidth = contentRect.width; + _this.duration = duration; + _this.animation = wx.createAnimation({ + duration: duration, + timingFunction: 'linear', + delay: delay, + }); + _this.scroll(); + } + }); + }); + }, + scroll: function () { + var _this = this; + this.timer && clearTimeout(this.timer); + this.timer = null; + this.setData({ + animationData: this.resetAnimation + .translateX(this.wrapWidth) + .step() + .export(), + }); + (0, utils_1.requestAnimationFrame)(function () { + _this.setData({ + animationData: _this.animation + .translateX(-_this.contentWidth) + .step() + .export(), + }); + }); + this.timer = setTimeout(function () { + _this.scroll(); + }, this.duration); + }, + onClickIcon: function (event) { + if (this.data.mode === 'closeable') { + this.timer && clearTimeout(this.timer); + this.timer = null; + this.setData({ show: false }); + this.$emit('close', event.detail); + } + }, + onClick: function (event) { + this.$emit('click', event); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/notice-bar/index.json b/miniprogram_npm/@vant/weapp/notice-bar/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notice-bar/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/notice-bar/index.wxml b/miniprogram_npm/@vant/weapp/notice-bar/index.wxml new file mode 100644 index 0000000..21b0973 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notice-bar/index.wxml @@ -0,0 +1,38 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + wx:if="{{ show }}" + class="custom-class {{ utils.bem('notice-bar', { withicon: mode, wrapable }) }}" + style="{{ computed.rootStyle({ color, backgroundColor, background }) }}" + bind:tap="onClick" +> + <van-icon + wx:if="{{ leftIcon }}" + name="{{ leftIcon }}" + class="van-notice-bar__left-icon" + /> + <slot wx:else name="left-icon" /> + + <view class="van-notice-bar__wrap"> + <view class="van-notice-bar__content {{ scrollable === false && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}"> + {{ text }} + <slot wx:if="{{ !text }}"></slot> + </view> + </view> + + <van-icon + wx:if="{{ mode === 'closeable' }}" + class="van-notice-bar__right-icon" + name="cross" + catch:tap="onClickIcon" + /> + <navigator + wx:elif="{{ mode === 'link' }}" + url="{{ url }}" + open-type="{{ openType }}" + > + <van-icon class="van-notice-bar__right-icon" name="arrow" /> + </navigator> + <slot wx:else name="right-icon" /> +</view> diff --git a/miniprogram_npm/@vant/weapp/notice-bar/index.wxs b/miniprogram_npm/@vant/weapp/notice-bar/index.wxs new file mode 100644 index 0000000..11e6456 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notice-bar/index.wxs @@ -0,0 +1,15 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style({ + color: data.color, + 'background-color': data.backgroundColor, + background: data.background, + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/notice-bar/index.wxss b/miniprogram_npm/@vant/weapp/notice-bar/index.wxss new file mode 100644 index 0000000..497636c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notice-bar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-notice-bar{align-items:center;background-color:var(--notice-bar-background-color,#fffbe8);color:var(--notice-bar-text-color,#ed6a0c);display:flex;font-size:var(--notice-bar-font-size,14px);height:var(--notice-bar-height,40px);line-height:var(--notice-bar-line-height,24px);padding:var(--notice-bar-padding,0 16px)}.van-notice-bar--withicon{padding-right:40px;position:relative}.van-notice-bar--wrapable{height:auto;padding:var(--notice-bar-wrapable-padding,8px 16px)}.van-notice-bar--wrapable .van-notice-bar__wrap{height:auto}.van-notice-bar--wrapable .van-notice-bar__content{position:relative;white-space:normal}.van-notice-bar__left-icon{align-items:center;display:flex;margin-right:4px;vertical-align:middle}.van-notice-bar__left-icon,.van-notice-bar__right-icon{font-size:var(--notice-bar-icon-size,16px);min-width:var(--notice-bar-icon-min-width,22px)}.van-notice-bar__right-icon{position:absolute;right:15px;top:10px}.van-notice-bar__wrap{flex:1;height:var(--notice-bar-line-height,24px);overflow:hidden;position:relative}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/notify/index.d.ts b/miniprogram_npm/@vant/weapp/notify/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/notify/index.js b/miniprogram_npm/@vant/weapp/notify/index.js new file mode 100644 index 0000000..a9526aa --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var color_1 = require("../common/color"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + props: { + message: String, + background: String, + type: { + type: String, + value: 'danger', + }, + color: { + type: String, + value: color_1.WHITE, + }, + duration: { + type: Number, + value: 3000, + }, + zIndex: { + type: Number, + value: 110, + }, + safeAreaInsetTop: { + type: Boolean, + value: false, + }, + top: null, + }, + data: { + show: false, + onOpened: null, + onClose: null, + onClick: null, + }, + created: function () { + var statusBarHeight = (0, utils_1.getSystemInfoSync)().statusBarHeight; + this.setData({ statusBarHeight: statusBarHeight }); + }, + methods: { + show: function () { + var _this = this; + var _a = this.data, duration = _a.duration, onOpened = _a.onOpened; + clearTimeout(this.timer); + this.setData({ show: true }); + wx.nextTick(onOpened); + if (duration > 0 && duration !== Infinity) { + this.timer = setTimeout(function () { + _this.hide(); + }, duration); + } + }, + hide: function () { + var onClose = this.data.onClose; + clearTimeout(this.timer); + this.setData({ show: false }); + wx.nextTick(onClose); + }, + onTap: function (event) { + var onClick = this.data.onClick; + if (onClick) { + onClick(event.detail); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/notify/index.json b/miniprogram_npm/@vant/weapp/notify/index.json new file mode 100644 index 0000000..c14a65f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-transition": "../transition/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/notify/index.wxml b/miniprogram_npm/@vant/weapp/notify/index.wxml new file mode 100644 index 0000000..42d913e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/index.wxml @@ -0,0 +1,21 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<van-transition + name="slide-down" + show="{{ show }}" + custom-class="van-notify__container" + custom-style="{{ computed.rootStyle({ zIndex, top }) }}" + bind:tap="onTap" +> + <view + class="van-notify van-notify--{{ type }}" + style="{{ computed.notifyStyle({ background, color }) }}" + > + <view + wx:if="{{ safeAreaInsetTop }}" + style="height: {{ statusBarHeight }}px" + /> + <text>{{ message }}</text> + </view> +</van-transition> diff --git a/miniprogram_npm/@vant/weapp/notify/index.wxs b/miniprogram_npm/@vant/weapp/notify/index.wxs new file mode 100644 index 0000000..bbb94c2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/index.wxs @@ -0,0 +1,22 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style({ + 'z-index': data.zIndex, + top: addUnit(data.top), + }); +} + +function notifyStyle(data) { + return style({ + background: data.background, + color: data.color, + }); +} + +module.exports = { + rootStyle: rootStyle, + notifyStyle: notifyStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/notify/index.wxss b/miniprogram_npm/@vant/weapp/notify/index.wxss new file mode 100644 index 0000000..c030e9b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-notify{word-wrap:break-word;font-size:var(--notify-font-size,14px);line-height:var(--notify-line-height,20px);padding:var(--notify-padding,6px 15px);text-align:center}.van-notify__container{box-sizing:border-box;left:0;position:fixed;top:0;width:100%}.van-notify--primary{background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:var(--notify-warning-background-color,#ff976a)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/notify/notify.d.ts b/miniprogram_npm/@vant/weapp/notify/notify.d.ts new file mode 100644 index 0000000..f6ee08f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/notify.d.ts @@ -0,0 +1,20 @@ +interface NotifyOptions { + type?: 'primary' | 'success' | 'danger' | 'warning'; + color?: string; + zIndex?: number; + top?: 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 | undefined) => void; +} +export default Notify; diff --git a/miniprogram_npm/@vant/weapp/notify/notify.js b/miniprogram_npm/@vant/weapp/notify/notify.js new file mode 100644 index 0000000..1b57b1c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/notify/notify.js @@ -0,0 +1,60 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var color_1 = require("../common/color"); +var defaultOptions = { + selector: '#van-notify', + type: 'danger', + message: '', + background: '', + duration: 3000, + zIndex: 110, + top: 0, + color: color_1.WHITE, + safeAreaInsetTop: false, + onClick: function () { }, + onOpened: function () { }, + onClose: function () { }, +}; +function parseOptions(message) { + if (message == null) { + return {}; + } + return typeof message === 'string' ? { message: message } : message; +} +function getContext() { + var pages = getCurrentPages(); + return pages[pages.length - 1]; +} +function Notify(options) { + options = __assign(__assign({}, defaultOptions), parseOptions(options)); + var context = options.context || getContext(); + var notify = context.selectComponent(options.selector); + delete options.context; + delete options.selector; + if (notify) { + notify.setData(options); + notify.show(); + return notify; + } + console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确'); +} +exports.default = Notify; +Notify.clear = function (options) { + options = __assign(__assign({}, defaultOptions), parseOptions(options)); + var context = options.context || getContext(); + var notify = context.selectComponent(options.selector); + if (notify) { + notify.hide(); + } +}; diff --git a/miniprogram_npm/@vant/weapp/overlay/index.d.ts b/miniprogram_npm/@vant/weapp/overlay/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/overlay/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/overlay/index.js b/miniprogram_npm/@vant/weapp/overlay/index.js new file mode 100644 index 0000000..1828343 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/overlay/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + show: Boolean, + customStyle: String, + duration: { + type: null, + value: 300, + }, + zIndex: { + type: Number, + value: 1, + }, + lockScroll: { + type: Boolean, + value: true, + }, + }, + methods: { + onClick: function () { + this.$emit('click'); + }, + // for prevent touchmove + noop: function () { }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/overlay/index.json b/miniprogram_npm/@vant/weapp/overlay/index.json new file mode 100644 index 0000000..c14a65f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/overlay/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-transition": "../transition/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/overlay/index.wxml b/miniprogram_npm/@vant/weapp/overlay/index.wxml new file mode 100644 index 0000000..92734a0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/overlay/index.wxml @@ -0,0 +1,21 @@ +<van-transition + wx:if="{{ lockScroll }}" + show="{{ show }}" + custom-class="van-overlay" + custom-style="z-index: {{ zIndex }}; {{ customStyle }}" + duration="{{ duration }}" + bind:tap="onClick" + catch:touchmove="noop" +> + <slot></slot> +</van-transition> +<van-transition + wx:else + show="{{ show }}" + custom-class="van-overlay" + custom-style="z-index: {{ zIndex }}; {{ customStyle }}" + duration="{{ duration }}" + bind:tap="onClick" +> + <slot></slot> +</van-transition> diff --git a/miniprogram_npm/@vant/weapp/overlay/index.wxss b/miniprogram_npm/@vant/weapp/overlay/index.wxss new file mode 100644 index 0000000..d1ad81a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/overlay/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-overlay{background-color:var(--overlay-background-color,rgba(0,0,0,.7));height:100%;left:0;position:fixed;top:0;width:100%} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/panel/index.d.ts b/miniprogram_npm/@vant/weapp/panel/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/panel/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/panel/index.js b/miniprogram_npm/@vant/weapp/panel/index.js new file mode 100644 index 0000000..818b8c5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/panel/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + classes: ['header-class', 'footer-class'], + props: { + desc: String, + title: String, + status: String, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/panel/index.json b/miniprogram_npm/@vant/weapp/panel/index.json new file mode 100644 index 0000000..0e5425c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/panel/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/panel/index.wxml b/miniprogram_npm/@vant/weapp/panel/index.wxml new file mode 100644 index 0000000..1843703 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/panel/index.wxml @@ -0,0 +1,19 @@ +<view class="van-panel van-hairline--top-bottom custom-class"> + <van-cell + wx:if="{{ title || desc || status }}" + title="{{ title }}" + label="{{ desc }}" + value="{{ status }}" + custom-class="header-class" + value-class="van-panel__header-value" + /> + <slot wx:else name="header" /> + + <view class="van-panel__content"> + <slot /> + </view> + + <view class="van-panel__footer van-hairline--top footer-class"> + <slot name="footer" /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/panel/index.wxss b/miniprogram_npm/@vant/weapp/panel/index.wxss new file mode 100644 index 0000000..485edcd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/panel/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-panel{background:var(--panel-background-color,#fff)}.van-panel__header-value{color:var(--panel-header-value-color,#ee0a24)}.van-panel__footer{padding:var(--panel-footer-padding,8px 16px)}.van-panel__footer:empty{display:none} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/picker-column/index.d.ts b/miniprogram_npm/@vant/weapp/picker-column/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker-column/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/picker-column/index.js b/miniprogram_npm/@vant/weapp/picker-column/index.js new file mode 100644 index 0000000..9dbf17c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker-column/index.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var utils_1 = require("../common/utils"); +var validator_1 = require("../common/validator"); +var DEFAULT_DURATION = 200; +(0, component_1.VantComponent)({ + classes: ['active-class'], + props: { + valueKey: String, + className: String, + itemHeight: Number, + visibleItemCount: Number, + initialOptions: { + type: Array, + value: [], + }, + defaultIndex: { + type: Number, + value: 0, + observer: function (value) { + this.setIndex(value); + }, + }, + }, + data: { + startY: 0, + offset: 0, + duration: 0, + startOffset: 0, + options: [], + currentIndex: 0, + }, + created: function () { + var _this = this; + var _a = this.data, defaultIndex = _a.defaultIndex, initialOptions = _a.initialOptions; + this.set({ + currentIndex: defaultIndex, + options: initialOptions, + }).then(function () { + _this.setIndex(defaultIndex); + }); + }, + methods: { + getCount: function () { + return this.data.options.length; + }, + onTouchStart: function (event) { + this.setData({ + startY: event.touches[0].clientY, + startOffset: this.data.offset, + duration: 0, + }); + }, + onTouchMove: function (event) { + var data = this.data; + var deltaY = event.touches[0].clientY - data.startY; + this.setData({ + offset: (0, utils_1.range)(data.startOffset + deltaY, -(this.getCount() * data.itemHeight), data.itemHeight), + }); + }, + onTouchEnd: function () { + var data = this.data; + if (data.offset !== data.startOffset) { + this.setData({ duration: DEFAULT_DURATION }); + var index = (0, utils_1.range)(Math.round(-data.offset / data.itemHeight), 0, this.getCount() - 1); + this.setIndex(index, true); + } + }, + onClickItem: function (event) { + var index = event.currentTarget.dataset.index; + this.setIndex(index, true); + }, + adjustIndex: function (index) { + var data = this.data; + var count = this.getCount(); + index = (0, utils_1.range)(index, 0, count); + for (var i = index; i < count; i++) { + if (!this.isDisabled(data.options[i])) + return i; + } + for (var i = index - 1; i >= 0; i--) { + if (!this.isDisabled(data.options[i])) + return i; + } + }, + isDisabled: function (option) { + return (0, validator_1.isObj)(option) && option.disabled; + }, + getOptionText: function (option) { + var data = this.data; + return (0, validator_1.isObj)(option) && data.valueKey in option + ? option[data.valueKey] + : option; + }, + setIndex: function (index, userAction) { + var _this = this; + var data = this.data; + index = this.adjustIndex(index) || 0; + var offset = -index * data.itemHeight; + if (index !== data.currentIndex) { + return this.set({ offset: offset, currentIndex: index }).then(function () { + userAction && _this.$emit('change', index); + }); + } + return this.set({ offset: offset }); + }, + setValue: function (value) { + var options = this.data.options; + for (var i = 0; i < options.length; i++) { + if (this.getOptionText(options[i]) === value) { + return this.setIndex(i); + } + } + return Promise.resolve(); + }, + getValue: function () { + var data = this.data; + return data.options[data.currentIndex]; + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/picker-column/index.json b/miniprogram_npm/@vant/weapp/picker-column/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker-column/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/picker-column/index.wxml b/miniprogram_npm/@vant/weapp/picker-column/index.wxml new file mode 100644 index 0000000..f2c8da2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker-column/index.wxml @@ -0,0 +1,23 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="van-picker-column custom-class" + style="{{ computed.rootStyle({ itemHeight, visibleItemCount }) }}" + bind:touchstart="onTouchStart" + catch:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" +> + <view style="{{ computed.wrapperStyle({ offset, itemHeight, visibleItemCount, duration }) }}"> + <view + wx:for="{{ options }}" + wx:for-item="option" + wx:key="index" + data-index="{{ index }}" + style="height: {{ itemHeight }}px" + class="van-ellipsis {{ utils.bem('picker-column__item', { disabled: option && option.disabled, selected: index === currentIndex }) }} {{ index === currentIndex ? 'active-class' : '' }}" + bindtap="onClickItem" + >{{ computed.optionText(option, valueKey) }}</view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/picker-column/index.wxs b/miniprogram_npm/@vant/weapp/picker-column/index.wxs new file mode 100644 index 0000000..2d5a611 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker-column/index.wxs @@ -0,0 +1,36 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function isObj(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} + +function optionText(option, valueKey) { + return isObj(option) && option[valueKey] != null ? option[valueKey] : option; +} + +function rootStyle(data) { + return style({ + height: addUnit(data.itemHeight * data.visibleItemCount), + }); +} + +function wrapperStyle(data) { + var offset = addUnit( + data.offset + (data.itemHeight * (data.visibleItemCount - 1)) / 2 + ); + + return style({ + transition: 'transform ' + data.duration + 'ms', + 'line-height': addUnit(data.itemHeight), + transform: 'translate3d(0, ' + offset + ', 0)', + }); +} + +module.exports = { + optionText: optionText, + rootStyle: rootStyle, + wrapperStyle: wrapperStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/picker-column/index.wxss b/miniprogram_npm/@vant/weapp/picker-column/index.wxss new file mode 100644 index 0000000..519a438 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker-column/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-picker-column{color:var(--picker-option-text-color,#000);font-size:var(--picker-option-font-size,16px);overflow:hidden;text-align:center}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{color:var(--picker-option-selected-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-picker-column__item--disabled{opacity:var(--picker-option-disabled-opacity,.3)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/picker/index.d.ts b/miniprogram_npm/@vant/weapp/picker/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/picker/index.js b/miniprogram_npm/@vant/weapp/picker/index.js new file mode 100644 index 0000000..06d1826 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/index.js @@ -0,0 +1,161 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var shared_1 = require("./shared"); +(0, component_1.VantComponent)({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { valueKey: { + type: String, + value: 'text', + }, toolbarPosition: { + type: String, + value: 'top', + }, defaultIndex: { + type: Number, + value: 0, + }, columns: { + type: Array, + value: [], + observer: function (columns) { + if (columns === void 0) { columns = []; } + this.simple = columns.length && !columns[0].values; + if (Array.isArray(this.children) && this.children.length) { + this.setColumns().catch(function () { }); + } + }, + } }), + beforeCreate: function () { + var _this = this; + Object.defineProperty(this, 'children', { + get: function () { return _this.selectAllComponents('.van-picker__column') || []; }, + }); + }, + methods: { + noop: function () { }, + setColumns: function () { + var _this = this; + var data = this.data; + var columns = this.simple ? [{ values: data.columns }] : data.columns; + var stack = columns.map(function (column, index) { + return _this.setColumnValues(index, column.values); + }); + return Promise.all(stack); + }, + emit: function (event) { + var type = event.currentTarget.dataset.type; + 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: function (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: function (index) { + return this.children[index]; + }, + // get column value by index + getColumnValue: function (index) { + var column = this.getColumn(index); + return column && column.getValue(); + }, + // set column value by index + setColumnValue: function (index, value) { + var 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: function (columnIndex) { + return (this.getColumn(columnIndex) || {}).data.currentIndex; + }, + // set column option index by column index + setColumnIndex: function (columnIndex, optionIndex) { + var column = this.getColumn(columnIndex); + if (column == null) { + return Promise.reject(new Error('setColumnIndex: 对应列不存在')); + } + return column.setIndex(optionIndex); + }, + // get options of column by index + getColumnValues: function (index) { + return (this.children[index] || {}).data.options; + }, + // set options of column by index + setColumnValues: function (index, options, needReset) { + if (needReset === void 0) { needReset = true; } + var column = this.children[index]; + if (column == null) { + return Promise.reject(new Error('setColumnValues: 对应列不存在')); + } + var isSame = JSON.stringify(column.data.options) === JSON.stringify(options); + if (isSame) { + return Promise.resolve(); + } + return column.set({ options: options }).then(function () { + if (needReset) { + column.setIndex(0); + } + }); + }, + // get values of all columns + getValues: function () { + return this.children.map(function (child) { return child.getValue(); }); + }, + // set values of all columns + setValues: function (values) { + var _this = this; + var stack = values.map(function (value, index) { + return _this.setColumnValue(index, value); + }); + return Promise.all(stack); + }, + // get indexes of all columns + getIndexes: function () { + return this.children.map(function (child) { return child.data.currentIndex; }); + }, + // set indexes of all columns + setIndexes: function (indexes) { + var _this = this; + var stack = indexes.map(function (optionIndex, columnIndex) { + return _this.setColumnIndex(columnIndex, optionIndex); + }); + return Promise.all(stack); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/picker/index.json b/miniprogram_npm/@vant/weapp/picker/index.json new file mode 100644 index 0000000..2fcec89 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "picker-column": "../picker-column/index", + "loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/picker/index.wxml b/miniprogram_npm/@vant/weapp/picker/index.wxml new file mode 100644 index 0000000..8564ccc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/index.wxml @@ -0,0 +1,37 @@ +<wxs src="./index.wxs" module="computed" /> + +<view class="van-picker custom-class"> + <include wx:if="{{ toolbarPosition === 'top' }}" src="./toolbar.wxml" /> + + <view wx:if="{{ loading }}" class="van-picker__loading"> + <loading color="#1989fa"/> + </view> + + <view + class="van-picker__columns" + style="{{ computed.columnsStyle({ itemHeight, visibleItemCount }) }}" + catch:touchmove="noop" + > + <picker-column + class="van-picker__column" + wx:for="{{ computed.columns(columns) }}" + wx:key="index" + data-index="{{ index }}" + custom-class="column-class" + value-key="{{ valueKey }}" + initial-options="{{ item.values }}" + default-index="{{ item.defaultIndex || defaultIndex }}" + item-height="{{ itemHeight }}" + visible-item-count="{{ visibleItemCount }}" + active-class="active-class" + bind:change="onChange" + /> + <view class="van-picker__mask" style="{{ computed.maskStyle({ itemHeight, visibleItemCount }) }}" /> + <view + class="van-picker__frame van-hairline--top-bottom" + style="{{ computed.frameStyle({ itemHeight }) }}" + /> + </view> + + <include wx:if="{{ toolbarPosition === 'bottom' }}" src="./toolbar.wxml" /> +</view> diff --git a/miniprogram_npm/@vant/weapp/picker/index.wxs b/miniprogram_npm/@vant/weapp/picker/index.wxs new file mode 100644 index 0000000..0abbd10 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/index.wxs @@ -0,0 +1,42 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); +var array = require('../wxs/array.wxs'); + +function columnsStyle(data) { + return style({ + height: addUnit(data.itemHeight * data.visibleItemCount), + }); +} + +function maskStyle(data) { + return style({ + 'background-size': + '100% ' + addUnit((data.itemHeight * (data.visibleItemCount - 1)) / 2), + }); +} + +function frameStyle(data) { + return style({ + height: addUnit(data.itemHeight), + }); +} + +function columns(columns) { + if (!array.isArray(columns)) { + return []; + } + + if (columns.length && !columns[0].values) { + return [{ values: columns }]; + } + + return columns; +} + +module.exports = { + columnsStyle: columnsStyle, + frameStyle: frameStyle, + maskStyle: maskStyle, + columns: columns, +}; diff --git a/miniprogram_npm/@vant/weapp/picker/index.wxss b/miniprogram_npm/@vant/weapp/picker/index.wxss new file mode 100644 index 0000000..d924abb --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-picker{-webkit-text-size-adjust:100%;background-color:var(--picker-background-color,#fff);overflow:hidden;position:relative;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:flex;height:var(--picker-toolbar-height,44px);justify-content:space-between;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{font-size:var(--picker-action-font-size,14px);padding:var(--picker-action-padding,0 16px)}.van-picker__cancel--hover,.van-picker__confirm--hover{opacity:.7}.van-picker__confirm{color:var(--picker-confirm-action-color,#576b95)}.van-picker__cancel{color:var(--picker-cancel-action-color,#969799)}.van-picker__title{font-size:var(--picker-option-font-size,16px);font-weight:var(--font-weight-bold,500);max-width:50%;text-align:center}.van-picker__columns{display:flex;position:relative}.van-picker__column{flex:1 1;width:0}.van-picker__loading{align-items:center;background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9));bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:4}.van-picker__mask{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-position:top,bottom;background-repeat:no-repeat;height:100%;left:0;top:0;width:100%;z-index:2}.van-picker__frame,.van-picker__mask{pointer-events:none;position:absolute}.van-picker__frame{left:16px;right:16px;top:50%;transform:translateY(-50%);z-index:1} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/picker/shared.d.ts b/miniprogram_npm/@vant/weapp/picker/shared.d.ts new file mode 100644 index 0000000..c548045 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/shared.d.ts @@ -0,0 +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; + }; +}; diff --git a/miniprogram_npm/@vant/weapp/picker/shared.js b/miniprogram_npm/@vant/weapp/picker/shared.js new file mode 100644 index 0000000..3d40a8c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/shared.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pickerProps = void 0; +exports.pickerProps = { + title: String, + loading: Boolean, + showToolbar: Boolean, + cancelButtonText: { + type: String, + value: '取消', + }, + confirmButtonText: { + type: String, + value: '确认', + }, + visibleItemCount: { + type: Number, + value: 6, + }, + itemHeight: { + type: Number, + value: 44, + }, +}; diff --git a/miniprogram_npm/@vant/weapp/picker/toolbar.wxml b/miniprogram_npm/@vant/weapp/picker/toolbar.wxml new file mode 100644 index 0000000..414f612 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/picker/toolbar.wxml @@ -0,0 +1,23 @@ +<view wx:if="{{ showToolbar }}" class="van-picker__toolbar toolbar-class"> + <view + class="van-picker__cancel" + hover-class="van-picker__cancel--hover" + hover-stay-time="70" + data-type="cancel" + bindtap="emit" + > + {{ cancelButtonText }} + </view> + <view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ + title + }}</view> + <view + class="van-picker__confirm" + hover-class="van-picker__confirm--hover" + hover-stay-time="70" + data-type="confirm" + bindtap="emit" + > + {{ confirmButtonText }} + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/popup/index.d.ts b/miniprogram_npm/@vant/weapp/popup/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/popup/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/popup/index.js b/miniprogram_npm/@vant/weapp/popup/index.js new file mode 100644 index 0000000..56367a4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/popup/index.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var transition_1 = require("../mixins/transition"); +(0, component_1.VantComponent)({ + classes: [ + 'enter-class', + 'enter-active-class', + 'enter-to-class', + 'leave-class', + 'leave-active-class', + 'leave-to-class', + 'close-icon-class', + ], + mixins: [(0, transition_1.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, + }, + lockScroll: { + type: Boolean, + value: true, + }, + }, + created: function () { + this.observeClass(); + }, + methods: { + onClickCloseIcon: function () { + this.$emit('close'); + }, + onClickOverlay: function () { + this.$emit('click-overlay'); + if (this.data.closeOnClickOverlay) { + this.$emit('close'); + } + }, + observeClass: function () { + var _a = this.data, transition = _a.transition, position = _a.position, duration = _a.duration; + var updateData = { + name: transition || position, + }; + if (transition === 'none') { + updateData.duration = 0; + this.originDuration = duration; + } + else if (this.originDuration != null) { + updateData.duration = this.originDuration; + } + this.setData(updateData); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/popup/index.json b/miniprogram_npm/@vant/weapp/popup/index.json new file mode 100644 index 0000000..88a6eab --- /dev/null +++ b/miniprogram_npm/@vant/weapp/popup/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-overlay": "../overlay/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/popup/index.wxml b/miniprogram_npm/@vant/weapp/popup/index.wxml new file mode 100644 index 0000000..ea7d696 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/popup/index.wxml @@ -0,0 +1,26 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<van-overlay + wx:if="{{ overlay }}" + show="{{ show }}" + z-index="{{ zIndex }}" + custom-style="{{ overlayStyle }}" + duration="{{ duration }}" + bind:click="onClickOverlay" + lock-scroll="{{ lockScroll }}" +/> +<view + wx:if="{{ inited }}" + class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}" + style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}" + bind:transitionend="onTransitionEnd" +> + <slot /> + <van-icon + wx:if="{{ closeable }}" + name="{{ closeIcon }}" + class="close-icon-class van-popup__close-icon van-popup__close-icon--{{ closeIconPosition }}" + bind:tap="onClickCloseIcon" + /> +</view> diff --git a/miniprogram_npm/@vant/weapp/popup/index.wxs b/miniprogram_npm/@vant/weapp/popup/index.wxs new file mode 100644 index 0000000..8d59f24 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/popup/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function popupStyle(data) { + return style([ + { + 'z-index': data.zIndex, + '-webkit-transition-duration': data.currentDuration + 'ms', + 'transition-duration': data.currentDuration + 'ms', + }, + data.display ? null : 'display: none', + data.customStyle, + ]); +} + +module.exports = { + popupStyle: popupStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/popup/index.wxss b/miniprogram_npm/@vant/weapp/popup/index.wxss new file mode 100644 index 0000000..a840541 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/popup/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,#fff);box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.van-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:var(--popup-round-border-radius,16px)}.van-popup--top{left:0;top:0;width:100%}.van-popup--top.van-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--bottom{bottom:0;left:0;width:100%}.van-popup--bottom.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.van-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,18px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.van-popup__close-icon--top-left{left:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{right:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,16px);left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,16px);right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,transform}.van-scale-enter,.van-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:transform}.van-bottom-enter,.van-bottom-leave-to{transform:translate3d(0,100%,0)}.van-top-enter,.van-top-leave-to{transform:translate3d(0,-100%,0)}.van-left-enter,.van-left-leave-to{transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{transform:translate3d(100%,-50%,0)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/progress/index.d.ts b/miniprogram_npm/@vant/weapp/progress/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/progress/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/progress/index.js b/miniprogram_npm/@vant/weapp/progress/index.js new file mode 100644 index 0000000..3bca928 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/progress/index.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var color_1 = require("../common/color"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + props: { + inactive: Boolean, + percentage: { + type: Number, + observer: 'setLeft', + }, + pivotText: String, + pivotColor: String, + trackColor: String, + showPivot: { + type: Boolean, + value: true, + }, + color: { + type: String, + value: color_1.BLUE, + }, + textColor: { + type: String, + value: '#fff', + }, + strokeWidth: { + type: null, + value: 4, + }, + }, + data: { + right: 0, + }, + mounted: function () { + this.setLeft(); + }, + methods: { + setLeft: function () { + var _this = this; + Promise.all([ + (0, utils_1.getRect)(this, '.van-progress'), + (0, utils_1.getRect)(this, '.van-progress__pivot'), + ]).then(function (_a) { + var portion = _a[0], pivot = _a[1]; + if (portion && pivot) { + _this.setData({ + right: (pivot.width * (_this.data.percentage - 100)) / 100, + }); + } + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/progress/index.json b/miniprogram_npm/@vant/weapp/progress/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/progress/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/progress/index.wxml b/miniprogram_npm/@vant/weapp/progress/index.wxml new file mode 100644 index 0000000..e81514d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/progress/index.wxml @@ -0,0 +1,20 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="van-progress custom-class" + style="{{ computed.rootStyle({ strokeWidth, trackColor }) }}" +> + <view + class="van-progress__portion" + style="{{ computed.portionStyle({ percentage, inactive, color }) }}" + > + <view + wx:if="{{ showPivot && computed.pivotText(pivotText, percentage) }}" + style="{{ computed.pivotStyle({ textColor, pivotColor, inactive, color, right }) }}" + class="van-progress__pivot" + > + {{ computed.pivotText(pivotText, percentage) }} + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/progress/index.wxs b/miniprogram_npm/@vant/weapp/progress/index.wxs new file mode 100644 index 0000000..5b1e8e6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/progress/index.wxs @@ -0,0 +1,36 @@ +/* eslint-disable */ +var utils = require('../wxs/utils.wxs'); +var style = require('../wxs/style.wxs'); + +function pivotText(pivotText, percentage) { + return pivotText || percentage + '%'; +} + +function rootStyle(data) { + return style({ + 'height': data.strokeWidth ? utils.addUnit(data.strokeWidth) : '', + 'background': data.trackColor, + }); +} + +function portionStyle(data) { + return style({ + background: data.inactive ? '#cacaca' : data.color, + width: data.percentage ? data.percentage + '%' : '', + }); +} + +function pivotStyle(data) { + return style({ + color: data.textColor, + right: data.right + 'px', + background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color, + }); +} + +module.exports = { + pivotText: pivotText, + rootStyle: rootStyle, + portionStyle: portionStyle, + pivotStyle: pivotStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/progress/index.wxss b/miniprogram_npm/@vant/weapp/progress/index.wxss new file mode 100644 index 0000000..a08972a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/progress/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-progress{background:var(--progress-background-color,#ebedf0);border-radius:var(--progress-height,4px);height:var(--progress-height,4px);position:relative}.van-progress__portion{background:var(--progress-color,#1989fa);border-radius:inherit;height:100%;left:0;position:absolute}.van-progress__pivot{background-color:var(--progress-pivot-background-color,#1989fa);border-radius:1em;box-sizing:border-box;color:var(--progress-pivot-text-color,#fff);font-size:var(--progress-pivot-font-size,10px);line-height:var(--progress-pivot-line-height,1.6);min-width:3.6em;padding:var(--progress-pivot-padding,0 5px);position:absolute;text-align:center;top:50%;transform:translateY(-50%);word-break:keep-all} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/radio-group/index.d.ts b/miniprogram_npm/@vant/weapp/radio-group/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/radio-group/index.js b/miniprogram_npm/@vant/weapp/radio-group/index.js new file mode 100644 index 0000000..ddb2a60 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio-group/index.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useChildren)('radio'), + props: { + value: { + type: null, + observer: 'updateChildren', + }, + direction: String, + disabled: { + type: Boolean, + observer: 'updateChildren', + }, + }, + methods: { + updateChildren: function () { + this.children.forEach(function (child) { return child.updateFromParent(); }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/radio-group/index.json b/miniprogram_npm/@vant/weapp/radio-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/radio-group/index.wxml b/miniprogram_npm/@vant/weapp/radio-group/index.wxml new file mode 100644 index 0000000..0ab17af --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio-group/index.wxml @@ -0,0 +1,5 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="{{ utils.bem('radio-group', [direction]) }}"> + <slot></slot> +</view> diff --git a/miniprogram_npm/@vant/weapp/radio-group/index.wxss b/miniprogram_npm/@vant/weapp/radio-group/index.wxss new file mode 100644 index 0000000..4e3b5d4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-radio-group--horizontal{display:flex;flex-wrap:wrap} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/radio/index.d.ts b/miniprogram_npm/@vant/weapp/radio/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/radio/index.js b/miniprogram_npm/@vant/weapp/radio/index.js new file mode 100644 index 0000000..61a86d5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var version_1 = require("../common/version"); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + field: true, + relation: (0, relation_1.useParent)('radio-group', function () { + this.updateFromParent(); + }), + classes: ['icon-class', 'label-class'], + props: { + name: null, + value: null, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right', + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round', + }, + iconSize: { + type: null, + value: 20, + }, + }, + data: { + direction: '', + parentDisabled: false, + }, + methods: { + updateFromParent: function () { + if (!this.parent) { + return; + } + var _a = this.parent.data, value = _a.value, parentDisabled = _a.disabled, direction = _a.direction; + this.setData({ + value: value, + direction: direction, + parentDisabled: parentDisabled, + }); + }, + emitChange: function (value) { + var instance = this.parent || this; + instance.$emit('input', value); + instance.$emit('change', value); + if ((0, version_1.canIUseModel)()) { + instance.setData({ value: value }); + } + }, + onChange: function () { + if (!this.data.disabled && !this.data.parentDisabled) { + this.emitChange(this.data.name); + } + }, + onClickLabel: function () { + var _a = this.data, disabled = _a.disabled, parentDisabled = _a.parentDisabled, labelDisabled = _a.labelDisabled, name = _a.name; + if (!(disabled || parentDisabled) && !labelDisabled) { + this.emitChange(name); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/radio/index.json b/miniprogram_npm/@vant/weapp/radio/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/radio/index.wxml b/miniprogram_npm/@vant/weapp/radio/index.wxml new file mode 100644 index 0000000..5f898c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio/index.wxml @@ -0,0 +1,30 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="{{ utils.bem('radio', [direction]) }} custom-class"> + <view + wx:if="{{ labelPosition === 'left' }}" + class="{{ utils.bem('radio__label', [labelPosition, { disabled: disabled || parentDisabled }]) }} label-class" + bindtap="onClickLabel" + > + <slot /> + </view> + <view class="van-radio__icon-wrap" style="font-size: {{ utils.addUnit(iconSize) }}" bindtap="onChange"> + <slot wx:if="{{ useIconSlot }}" name="icon" /> + <van-icon + wx:else + name="success" + class="{{ utils.bem('radio__icon', [shape, { disabled: disabled || parentDisabled, checked: value === name }]) }}" + style="{{ computed.iconStyle({ iconSize, checkedColor, disabled, parentDisabled, value, name }) }}" + custom-class="icon-class" + custom-style="{{ computed.iconCustomStyle({ iconSize }) }}" + /> + </view> + <view + wx:if="{{ labelPosition === 'right' }}" + class="label-class {{ utils.bem('radio__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" + bindtap="onClickLabel" + > + <slot /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/radio/index.wxs b/miniprogram_npm/@vant/weapp/radio/index.wxs new file mode 100644 index 0000000..a428aad --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio/index.wxs @@ -0,0 +1,33 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function iconStyle(data) { + var styles = { + 'font-size': addUnit(data.iconSize), + }; + + if ( + data.checkedColor && + !(data.disabled || data.parentDisabled) && + data.value === data.name + ) { + styles['border-color'] = data.checkedColor; + styles['background-color'] = data.checkedColor; + } + + return style(styles); +} + +function iconCustomStyle(data) { + return style({ + 'line-height': addUnit(data.iconSize), + 'font-size': '.8em', + display: 'block', + }); +} + +module.exports = { + iconStyle: iconStyle, + iconCustomStyle: iconCustomStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/radio/index.wxss b/miniprogram_npm/@vant/weapp/radio/index.wxss new file mode 100644 index 0000000..257b0c7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/radio/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-radio{align-items:center;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-radio__icon-wrap{flex:none}.van-radio--horizontal{margin-right:var(--padding-sm,12px)}.van-radio__icon{align-items:center;border:1px solid var(--radio-border-color,#c8c9cc);box-sizing:border-box;color:transparent;display:flex;font-size:var(--radio-size,20px);height:1em;justify-content:center;text-align:center;transition-duration:var(--radio-transition-duration,.2s);transition-property:color,border-color,background-color;width:1em}.van-radio__icon--round{border-radius:100%}.van-radio__icon--checked{background-color:var(--radio-checked-icon-color,#1989fa);border-color:var(--radio-checked-icon-color,#1989fa);color:#fff}.van-radio__icon--disabled{background-color:var(--radio-disabled-background-color,#ebedf0);border-color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__icon--disabled.van-radio__icon--checked{color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__label{word-wrap:break-word;color:var(--radio-label-color,#323233);line-height:var(--radio-size,20px);padding-left:var(--radio-label-margin,10px)}.van-radio__label--left{float:left;margin:0 var(--radio-label-margin,10px) 0 0}.van-radio__label--disabled{color:var(--radio-disabled-label-color,#c8c9cc)}.van-radio__label:empty{margin:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/rate/index.d.ts b/miniprogram_npm/@vant/weapp/rate/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/rate/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/rate/index.js b/miniprogram_npm/@vant/weapp/rate/index.js new file mode 100644 index 0000000..30a96de --- /dev/null +++ b/miniprogram_npm/@vant/weapp/rate/index.js @@ -0,0 +1,93 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = require("../common/utils"); +var component_1 = require("../common/component"); +var version_1 = require("../common/version"); +(0, component_1.VantComponent)({ + field: true, + classes: ['icon-class'], + props: { + value: { + type: Number, + observer: function (value) { + if (value !== this.data.innerValue) { + this.setData({ innerValue: value }); + } + }, + }, + readonly: Boolean, + disabled: Boolean, + allowHalf: Boolean, + size: null, + icon: { + type: String, + value: 'star', + }, + voidIcon: { + type: String, + value: 'star-o', + }, + color: String, + voidColor: String, + disabledColor: String, + count: { + type: Number, + value: 5, + observer: function (value) { + this.setData({ innerCountArray: Array.from({ length: value }) }); + }, + }, + gutter: null, + touchable: { + type: Boolean, + value: true, + }, + }, + data: { + innerValue: 0, + innerCountArray: Array.from({ length: 5 }), + }, + methods: { + onSelect: function (event) { + var _this = this; + var data = this.data; + var score = event.currentTarget.dataset.score; + if (!data.disabled && !data.readonly) { + this.setData({ innerValue: score + 1 }); + if ((0, version_1.canIUseModel)()) { + this.setData({ value: score + 1 }); + } + wx.nextTick(function () { + _this.$emit('input', score + 1); + _this.$emit('change', score + 1); + }); + } + }, + onTouchMove: function (event) { + var _this = this; + var touchable = this.data.touchable; + if (!touchable) + return; + var clientX = event.touches[0].clientX; + (0, utils_1.getAllRect)(this, '.van-rate__icon').then(function (list) { + var target = list + .sort(function (cur, next) { return cur.dataset.score - next.dataset.score; }) + .find(function (item) { return clientX >= item.left && clientX <= item.right; }); + if (target != null) { + _this.onSelect(__assign(__assign({}, event), { currentTarget: target })); + } + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/rate/index.json b/miniprogram_npm/@vant/weapp/rate/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/rate/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/rate/index.wxml b/miniprogram_npm/@vant/weapp/rate/index.wxml new file mode 100644 index 0000000..049714c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/rate/index.wxml @@ -0,0 +1,35 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="../wxs/style.wxs" module="style" /> + +<view + class="{{ utils.bem('rate') }} custom-class" + bind:touchmove="onTouchMove" +> + <view + class="{{ utils.bem('rate__item') }}" + wx:for="{{ innerCountArray }}" + wx:key="index" + style="{{ style({ paddingRight: index !== count - 1 ? utils.addUnit(gutter) : null }) }}" + > + <van-icon + name="{{ index + 1 <= innerValue ? icon : voidIcon }}" + class="{{ utils.bem('rate__icon', [{ disabled, full: index + 1 <= innerValue }])}}" + style="{{ style({ fontSize: utils.addUnit(size) }) }}" + custom-class="icon-class" + data-score="{{ index }}" + color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}" + bind:click="onSelect" + /> + + <van-icon + wx:if="{{ allowHalf }}" + name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}" + class="{{ utils.bem('rate__icon', ['half', { disabled, full: index + 0.5 <= innerValue }]) }}" + style="{{ style({ fontSize: utils.addUnit(size) }) }}" + custom-class="icon-class" + data-score="{{ index - 0.5 }}" + color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}" + bind:click="onSelect" + /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/rate/index.wxss b/miniprogram_npm/@vant/weapp/rate/index.wxss new file mode 100644 index 0000000..e2a517e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/rate/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-rate{display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{padding:0 var(--rate-horizontal-padding,2px);position:relative}.van-rate__item:not(:last-child){padding-right:var(--rate-icon-gutter,4px)}.van-rate__icon{color:var(--rate-icon-void-color,#c8c9cc);display:block;font-size:var(--rate-icon-size,20px);height:1em}.van-rate__icon--half{left:var(--rate-horizontal-padding,2px);overflow:hidden;position:absolute;top:0;width:.5em}.van-rate__icon--full,.van-rate__icon--half{color:var(--rate-icon-full-color,#ee0a24)}.van-rate__icon--disabled{color:var(--rate-icon-disabled-color,#c8c9cc)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/row/index.d.ts b/miniprogram_npm/@vant/weapp/row/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/row/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/row/index.js b/miniprogram_npm/@vant/weapp/row/index.js new file mode 100644 index 0000000..c27acd6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/row/index.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('col', function (target) { + var gutter = this.data.gutter; + if (gutter) { + target.setData({ gutter: gutter }); + } + }), + props: { + gutter: { + type: Number, + observer: 'setGutter', + }, + }, + methods: { + setGutter: function () { + var _this = this; + this.children.forEach(function (col) { + col.setData(_this.data); + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/row/index.json b/miniprogram_npm/@vant/weapp/row/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/row/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/row/index.wxml b/miniprogram_npm/@vant/weapp/row/index.wxml new file mode 100644 index 0000000..69a4359 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/row/index.wxml @@ -0,0 +1,5 @@ +<wxs src="./index.wxs" module="computed" /> + +<view class="van-row custom-class" style="{{ computed.rootStyle({ gutter }) }}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/row/index.wxs b/miniprogram_npm/@vant/weapp/row/index.wxs new file mode 100644 index 0000000..f5c5958 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/row/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + if (!data.gutter) { + return ''; + } + + return style({ + 'margin-right': addUnit(-data.gutter / 2), + 'margin-left': addUnit(-data.gutter / 2), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/row/index.wxss b/miniprogram_npm/@vant/weapp/row/index.wxss new file mode 100644 index 0000000..bb8946b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/row/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-row:after{clear:both;content:"";display:table} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/search/index.d.ts b/miniprogram_npm/@vant/weapp/search/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/search/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/search/index.js b/miniprogram_npm/@vant/weapp/search/index.js new file mode 100644 index 0000000..d954ca3 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/search/index.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var version_1 = require("../common/version"); +(0, component_1.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, + }, + clearTrigger: { + type: String, + value: 'focus', + }, + clearIcon: { + type: String, + value: 'clear', + }, + }, + methods: { + onChange: function (event) { + if ((0, version_1.canIUseModel)()) { + this.setData({ value: event.detail }); + } + this.$emit('change', event.detail); + }, + onCancel: function () { + var _this = this; + /** + * 修复修改输入框值时,输入框失焦和赋值同时触发,赋值失效 + * https://github.com/youzan/@vant/weapp/issues/1768 + */ + setTimeout(function () { + if ((0, version_1.canIUseModel)()) { + _this.setData({ value: '' }); + } + _this.$emit('cancel'); + _this.$emit('change', ''); + }, 200); + }, + onSearch: function (event) { + this.$emit('search', event.detail); + }, + onFocus: function (event) { + this.$emit('focus', event.detail); + }, + onBlur: function (event) { + this.$emit('blur', event.detail); + }, + onClear: function (event) { + this.$emit('clear', event.detail); + }, + onClickInput: function (event) { + this.$emit('click-input', event.detail); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/search/index.json b/miniprogram_npm/@vant/weapp/search/index.json new file mode 100644 index 0000000..b4cfe91 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/search/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-field": "../field/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/search/index.wxml b/miniprogram_npm/@vant/weapp/search/index.wxml new file mode 100644 index 0000000..0068cfe --- /dev/null +++ b/miniprogram_npm/@vant/weapp/search/index.wxml @@ -0,0 +1,53 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ utils.bem('search', { withaction: showAction || useActionSlot }) }} custom-class" + style="background: {{ background }}" +> + <view class="{{ utils.bem('search__content', [shape]) }}"> + <view class="van-search__label" wx:if="{{ label }}">{{ label }}</view> + <slot wx:else name="label" /> + + <van-field + type="search" + left-icon="{{ !useLeftIconSlot ? leftIcon : '' }}" + right-icon="{{ !useRightIconSlot ? rightIcon : '' }}" + focus="{{ focus }}" + error="{{ error }}" + border="{{ false }}" + confirm-type="search" + class="van-search__field field-class" + value="{{ value }}" + disabled="{{ disabled }}" + readonly="{{ readonly }}" + clearable="{{ clearable }}" + clear-trigger="{{ clearTrigger }}" + clear-icon="{{ clearIcon }}" + maxlength="{{ maxlength }}" + input-align="{{ inputAlign }}" + input-class="input-class" + placeholder="{{ placeholder }}" + placeholder-style="{{ placeholderStyle }}" + custom-style="padding: 5px 10px 5px 0; background-color: transparent;" + bind:blur="onBlur" + bind:focus="onFocus" + bind:change="onChange" + bind:confirm="onSearch" + bind:clear="onClear" + bind:click-input="onClickInput" + > + <slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" /> + <slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" /> + </van-field> + </view> + + <view + wx:if="{{ showAction || useActionSlot }}" + class="van-search__action" + hover-class="van-search__action--hover" + hover-stay-time="70" + > + <slot wx:if="{{ useActionSlot }}" name="action" /> + <view wx:else bind:tap="onCancel" class="cancel-class">{{ actionText }}</view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/search/index.wxss b/miniprogram_npm/@vant/weapp/search/index.wxss new file mode 100644 index 0000000..212f7aa --- /dev/null +++ b/miniprogram_npm/@vant/weapp/search/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-search{align-items:center;box-sizing:border-box;display:flex;padding:var(--search-padding,10px 12px)}.van-search__content{background-color:var(--search-background-color,#f7f8fa);border-radius:2px;display:flex;flex:1;padding-left:var(--padding-sm,12px)}.van-search__content--round{border-radius:999px}.van-search__label{color:var(--search-label-color,#323233);font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,34px);padding:var(--search-label-padding,0 5px)}.van-search__field{flex:1}.van-search__field__left-icon{color:var(--search-left-icon-color,#969799)}.van-search--withaction{padding-right:0}.van-search__action{color:var(--search-action-text-color,#323233);font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,34px);padding:var(--search-action-padding,0 8px)}.van-search__action--hover{background-color:#f2f3f5} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/share-sheet/index.d.ts b/miniprogram_npm/@vant/weapp/share-sheet/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/share-sheet/index.js b/miniprogram_npm/@vant/weapp/share-sheet/index.js new file mode 100644 index 0000000..669ca0d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/index.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + // whether to show popup + show: Boolean, + // overlay custom style + overlayStyle: String, + // z-index + zIndex: { + type: Number, + value: 100, + }, + title: String, + cancelText: { + type: String, + value: '取消', + }, + description: String, + options: { + type: Array, + value: [], + }, + overlay: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + duration: { + type: null, + value: 300, + }, + }, + methods: { + onClickOverlay: function () { + this.$emit('click-overlay'); + }, + onCancel: function () { + this.onClose(); + this.$emit('cancel'); + }, + onSelect: function (event) { + this.$emit('select', event.detail); + }, + onClose: function () { + this.$emit('close'); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/share-sheet/index.json b/miniprogram_npm/@vant/weapp/share-sheet/index.json new file mode 100644 index 0000000..15a7c22 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "options": "./options" + } +} diff --git a/miniprogram_npm/@vant/weapp/share-sheet/index.wxml b/miniprogram_npm/@vant/weapp/share-sheet/index.wxml new file mode 100644 index 0000000..cefc3af --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/index.wxml @@ -0,0 +1,46 @@ +<wxs src="./index.wxs" module="computed" /> + +<van-popup + round + class="van-share-sheet" + show="{{ show }}" + position="bottom" + overlay="{{ overlay }}" + duration="{{ duration }}" + z-index="{{ zIndex }}" + overlay-style="{{ overlayStyle }}" + close-on-click-overlay="{{ closeOnClickOverlay }}" + safe-area-inset-bottom="{{ safeAreaInsetBottom }}" + bind:close="onClose" + bind:click-overlay="onClickOverlay" +> + <view class="van-share-sheet__header"> + <view class="van-share-sheet__title"> + <slot name="title" /> + </view> + <view wx:if="{{ title }}" class="van-share-sheet__title">{{ title }}</view> + + <view class="van-share-sheet__description"> + <slot name="description" /> + </view> + <view wx:if="{{ description }}" class="van-share-sheet__description"> + {{ description }} + </view> + </view> + + <block wx:if="{{ computed.isMulti(options) }}"> + <options + wx:for="{{ options }}" + show-border="{{ index !== 0 }}" + wx:key="index" + options="{{ item }}" + bind:select="onSelect" + /> + </block> + + <options wx:else options="{{ options }}" bind:select="onSelect" /> + + <button type="button" class="van-share-sheet__cancel" bindtap="onCancel"> + {{ cancelText }} + </button> +</van-popup> diff --git a/miniprogram_npm/@vant/weapp/share-sheet/index.wxs b/miniprogram_npm/@vant/weapp/share-sheet/index.wxs new file mode 100644 index 0000000..2149ee9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/index.wxs @@ -0,0 +1,12 @@ +/* eslint-disable */ +function isMulti(options) { + if (options == null || options[0] == null) { + return false; + } + + return "Array" === options.constructor && "Array" === options[0].constructor; +} + +module.exports = { + isMulti: isMulti +}; diff --git a/miniprogram_npm/@vant/weapp/share-sheet/index.wxss b/miniprogram_npm/@vant/weapp/share-sheet/index.wxss new file mode 100644 index 0000000..e8d8dae --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-share-sheet__header{padding:12px 16px 4px;text-align:center}.van-share-sheet__title{color:#323233;font-size:14px;font-weight:400;line-height:20px;margin-top:8px}.van-share-sheet__title:empty,.van-share-sheet__title:not(:empty)+.van-share-sheet__title{display:none}.van-share-sheet__description{color:#969799;display:block;font-size:12px;line-height:16px;margin-top:8px}.van-share-sheet__description:empty,.van-share-sheet__description:not(:empty)+.van-share-sheet__description{display:none}.van-share-sheet__cancel{background:#fff;border:none;box-sizing:initial;display:block;font-size:16px;height:auto;line-height:48px;padding:0;text-align:center;width:100%}.van-share-sheet__cancel:before{background-color:#f7f8fa;content:" ";display:block;height:8px}.van-share-sheet__cancel:after{display:none}.van-share-sheet__cancel:active{background-color:#f2f3f5} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/share-sheet/options.d.ts b/miniprogram_npm/@vant/weapp/share-sheet/options.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/options.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/share-sheet/options.js b/miniprogram_npm/@vant/weapp/share-sheet/options.js new file mode 100644 index 0000000..0432d4f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/options.js @@ -0,0 +1,27 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + options: Array, + showBorder: Boolean, + }, + methods: { + onSelect: function (event) { + var index = event.currentTarget.dataset.index; + var option = this.data.options[index]; + this.$emit('select', __assign(__assign({}, option), { index: index })); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/share-sheet/options.json b/miniprogram_npm/@vant/weapp/share-sheet/options.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/options.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/share-sheet/options.wxml b/miniprogram_npm/@vant/weapp/share-sheet/options.wxml new file mode 100644 index 0000000..2983ebb --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/options.wxml @@ -0,0 +1,20 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./options.wxs" module="computed" /> + +<view class="{{ utils.bem('share-sheet__options', { border: showBorder }) }}"> + <view + wx:for="{{ options }}" + wx:key="index" + class="van-share-sheet__option" + data-index="{{ index }}" + bindtap="onSelect" + > + <button class="van-share-sheet__button" open-type="{{ item.openType }}"> + <image src="{{ computed.getIconURL(item.icon) }}" class="van-share-sheet__icon" /> + <view wx:if="{{ item.name }}" class="van-share-sheet__name">{{ item.name }}</view> + <view wx:if="{{ item.description }}" class="van-share-sheet__option-description"> + {{ item.description }} + </view> + </button> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/share-sheet/options.wxs b/miniprogram_npm/@vant/weapp/share-sheet/options.wxs new file mode 100644 index 0000000..a116d32 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/options.wxs @@ -0,0 +1,14 @@ +/* eslint-disable */ +var PRESET_ICONS = ['qq', 'link', 'weibo', 'wechat', 'poster', 'qrcode', 'weapp-qrcode', 'wechat-moments']; + +function getIconURL(icon) { + if (PRESET_ICONS.indexOf(icon) !== -1) { + return 'https://img.yzcdn.cn/vant/share-sheet-' + icon + '.png'; + } + + return icon; +} + +module.exports = { + getIconURL: getIconURL, +}; diff --git a/miniprogram_npm/@vant/weapp/share-sheet/options.wxss b/miniprogram_npm/@vant/weapp/share-sheet/options.wxss new file mode 100644 index 0000000..b7f5455 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/share-sheet/options.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-share-sheet__options{-webkit-overflow-scrolling:touch;display:flex;overflow-x:auto;overflow-y:visible;padding:16px 0 16px 8px;position:relative}.van-share-sheet__options--border:before{border-top:1px solid #ebedf0;box-sizing:border-box;content:" ";left:16px;pointer-events:none;position:absolute;right:0;top:0;transform:scaleY(.5);transform-origin:center}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{align-items:center;display:flex;flex-direction:column;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{background-color:initial;border:0;height:auto;line-height:inherit;padding:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{height:48px;margin:0 16px;width:48px}.van-share-sheet__name{color:#646566;font-size:12px;margin-top:8px;padding:0 4px}.van-share-sheet__option-description{color:#c8c9cc;font-size:12px;padding:0 4px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/sidebar-item/index.d.ts b/miniprogram_npm/@vant/weapp/sidebar-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/sidebar-item/index.js b/miniprogram_npm/@vant/weapp/sidebar-item/index.js new file mode 100644 index 0000000..eac568f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar-item/index.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + classes: ['active-class', 'disabled-class'], + relation: (0, relation_1.useParent)('sidebar'), + props: { + dot: Boolean, + badge: null, + info: null, + title: String, + disabled: Boolean, + }, + methods: { + onClick: function () { + var _this = this; + var parent = this.parent; + if (!parent || this.data.disabled) { + return; + } + var index = parent.children.indexOf(this); + parent.setActive(index).then(function () { + _this.$emit('click', index); + parent.$emit('change', index); + }); + }, + setActive: function (selected) { + return this.setData({ selected: selected }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/sidebar-item/index.json b/miniprogram_npm/@vant/weapp/sidebar-item/index.json new file mode 100644 index 0000000..bf0ebe0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-info": "../info/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/sidebar-item/index.wxml b/miniprogram_npm/@vant/weapp/sidebar-item/index.wxml new file mode 100644 index 0000000..c5c08a6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar-item/index.wxml @@ -0,0 +1,18 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ utils.bem('sidebar-item', { selected, disabled }) }} {{ selected ? 'active-class' : '' }} {{ disabled ? 'disabled-class' : '' }} custom-class" + hover-class="van-sidebar-item--hover" + hover-stay-time="70" + bind:tap="onClick" +> + <view class="van-sidebar-item__text"> + <van-info + wx:if="{{ badge != null || info !== null || dot }}" + dot="{{ dot }}" + info="{{ badge != null ? badge : info }}" + /> + <view wx:if="{{ title }}">{{ title }}</view> + <slot wx:else name="title" /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/sidebar-item/index.wxss b/miniprogram_npm/@vant/weapp/sidebar-item/index.wxss new file mode 100644 index 0000000..f1ce421 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-sidebar-item{background-color:var(--sidebar-background-color,#f7f8fa);border-left:3px solid transparent;box-sizing:border-box;color:var(--sidebar-text-color,#323233);display:block;font-size:var(--sidebar-font-size,14px);line-height:var(--sidebar-line-height,20px);overflow:hidden;padding:var(--sidebar-padding,20px 12px 20px 8px);-webkit-user-select:none;user-select:none}.van-sidebar-item__text{display:inline-block;position:relative;word-break:break-all}.van-sidebar-item--hover:not(.van-sidebar-item--disabled){background-color:var(--sidebar-active-color,#f2f3f5)}.van-sidebar-item:after{border-bottom-width:1px}.van-sidebar-item--selected{border-color:var(--sidebar-selected-border-color,#ee0a24);color:var(--sidebar-selected-text-color,#323233);font-weight:var(--sidebar-selected-font-weight,500)}.van-sidebar-item--selected:after{border-right-width:1px}.van-sidebar-item--selected,.van-sidebar-item--selected.van-sidebar-item--hover{background-color:var(--sidebar-selected-background-color,#fff)}.van-sidebar-item--disabled{color:var(--sidebar-disabled-text-color,#c8c9cc)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/sidebar/index.d.ts b/miniprogram_npm/@vant/weapp/sidebar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/sidebar/index.js b/miniprogram_npm/@vant/weapp/sidebar/index.js new file mode 100644 index 0000000..f3e0a58 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar/index.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('sidebar-item', function () { + this.setActive(this.data.activeKey); + }), + props: { + activeKey: { + type: Number, + value: 0, + observer: 'setActive', + }, + }, + beforeCreate: function () { + this.currentActive = -1; + }, + methods: { + setActive: function (activeKey) { + var _a = this, children = _a.children, currentActive = _a.currentActive; + if (!children.length) { + return Promise.resolve(); + } + this.currentActive = activeKey; + var 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/miniprogram_npm/@vant/weapp/sidebar/index.json b/miniprogram_npm/@vant/weapp/sidebar/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/sidebar/index.wxml b/miniprogram_npm/@vant/weapp/sidebar/index.wxml new file mode 100644 index 0000000..96b11c7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar/index.wxml @@ -0,0 +1,3 @@ +<view class="van-sidebar custom-class"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/sidebar/index.wxss b/miniprogram_npm/@vant/weapp/sidebar/index.wxss new file mode 100644 index 0000000..5a2d44f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sidebar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-sidebar{width:var(--sidebar-width,80px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/skeleton/index.d.ts b/miniprogram_npm/@vant/weapp/skeleton/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/skeleton/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/skeleton/index.js b/miniprogram_npm/@vant/weapp/skeleton/index.js new file mode 100644 index 0000000..2ab3175 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/skeleton/index.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + classes: ['avatar-class', 'title-class', 'row-class'], + props: { + row: { + type: Number, + value: 0, + observer: function (value) { + this.setData({ rowArray: Array.from({ length: value }) }); + }, + }, + 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: function (val) { + this.setData({ isArray: val instanceof Array }); + }, + }, + }, + data: { + isArray: false, + rowArray: [], + }, +}); diff --git a/miniprogram_npm/@vant/weapp/skeleton/index.json b/miniprogram_npm/@vant/weapp/skeleton/index.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/skeleton/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/miniprogram_npm/@vant/weapp/skeleton/index.wxml b/miniprogram_npm/@vant/weapp/skeleton/index.wxml new file mode 100644 index 0000000..058e2ef --- /dev/null +++ b/miniprogram_npm/@vant/weapp/skeleton/index.wxml @@ -0,0 +1,29 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + wx:if="{{ loading }}" + class="custom-class {{ utils.bem('skeleton', [{animate}]) }}" +> + <view + wx:if="{{ avatar }}" + class="avatar-class {{ utils.bem('skeleton__avatar', [avatarShape])}}" + style="{{ 'width:' + avatarSize + ';height:' + avatarSize }}" + /> + <view class="{{ utils.bem('skeleton__content')}}"> + <view + wx:if="{{ title }}" + class="title-class {{ utils.bem('skeleton__title') }}" + style="{{ 'width:' + titleWidth }}" + /> + <view + wx:for="{{ rowArray }}" + wx:key="index" + wx:for-index="index" + class="row-class {{ utils.bem('skeleton__row') }}" + style="{{ 'width:' + (isArray ? rowWidth[index] : rowWidth) }}" + /> + </view> +</view> +<view wx:else class="{{ utils.bem('skeleton__content')}}"> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/skeleton/index.wxss b/miniprogram_npm/@vant/weapp/skeleton/index.wxss new file mode 100644 index 0000000..d59a5ed --- /dev/null +++ b/miniprogram_npm/@vant/weapp/skeleton/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-skeleton{box-sizing:border-box;display:flex;padding:var(--skeleton-padding,0 16px);width:100%}.van-skeleton__avatar{background-color:var(--skeleton-avatar-background-color,#f2f3f5);flex-shrink:0;margin-right:var(--padding-md,16px)}.van-skeleton__avatar--round{border-radius:100%}.van-skeleton__content{flex:1}.van-skeleton__avatar+.van-skeleton__content{padding-top:var(--padding-xs,8px)}.van-skeleton__row,.van-skeleton__title{background-color:var(--skeleton-row-background-color,#f2f3f5);height:var(--skeleton-row-height,16px)}.van-skeleton__title{margin:0}.van-skeleton__row:not(:first-child){margin-top:var(--skeleton-row-margin-top,12px)}.van-skeleton__title+.van-skeleton__row{margin-top:20px}.van-skeleton--animate{animation:van-skeleton-blink 1.2s ease-in-out infinite}@keyframes van-skeleton-blink{50%{opacity:.6}} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/slider/index.d.ts b/miniprogram_npm/@vant/weapp/slider/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/slider/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/slider/index.js b/miniprogram_npm/@vant/weapp/slider/index.js new file mode 100644 index 0000000..9fa3790 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/slider/index.js @@ -0,0 +1,189 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var touch_1 = require("../mixins/touch"); +var version_1 = require("../common/version"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + mixins: [touch_1.touch], + props: { + range: Boolean, + 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: null, + value: 0, + observer: function (val) { + if (val !== this.value) { + this.updateValue(val); + } + }, + }, + vertical: Boolean, + barHeight: null, + }, + created: function () { + this.updateValue(this.data.value); + }, + methods: { + onTouchStart: function (event) { + var _this = this; + if (this.data.disabled) + return; + var index = event.currentTarget.dataset.index; + if (typeof index === 'number') { + this.buttonIndex = index; + } + this.touchStart(event); + this.startValue = this.format(this.value); + this.newValue = this.value; + if (this.isRange(this.newValue)) { + this.startValue = this.newValue.map(function (val) { return _this.format(val); }); + } + else { + this.startValue = this.format(this.newValue); + } + this.dragStatus = 'start'; + }, + onTouchMove: function (event) { + var _this = this; + if (this.data.disabled) + return; + if (this.dragStatus === 'start') { + this.$emit('drag-start'); + } + this.touchMove(event); + this.dragStatus = 'draging'; + (0, utils_1.getRect)(this, '.van-slider').then(function (rect) { + var vertical = _this.data.vertical; + var delta = vertical ? _this.deltaY : _this.deltaX; + var total = vertical ? rect.height : rect.width; + var diff = (delta / total) * _this.getRange(); + if (_this.isRange(_this.startValue)) { + _this.newValue[_this.buttonIndex] = + _this.startValue[_this.buttonIndex] + diff; + } + else { + _this.newValue = _this.startValue + diff; + } + _this.updateValue(_this.newValue, false, true); + }); + }, + onTouchEnd: function () { + if (this.data.disabled) + return; + if (this.dragStatus === 'draging') { + this.updateValue(this.newValue, true); + this.$emit('drag-end'); + } + }, + onClick: function (event) { + var _this = this; + if (this.data.disabled) + return; + var min = this.data.min; + (0, utils_1.getRect)(this, '.van-slider').then(function (rect) { + var vertical = _this.data.vertical; + var touch = event.touches[0]; + var delta = vertical + ? touch.clientY - rect.top + : touch.clientX - rect.left; + var total = vertical ? rect.height : rect.width; + var value = Number(min) + (delta / total) * _this.getRange(); + if (_this.isRange(_this.value)) { + var _a = _this.value, left = _a[0], right = _a[1]; + var middle = (left + right) / 2; + if (value <= middle) { + _this.updateValue([value, right], true); + } + else { + _this.updateValue([left, value], true); + } + } + else { + _this.updateValue(value, true); + } + }); + }, + isRange: function (val) { + var range = this.data.range; + return range && Array.isArray(val); + }, + handleOverlap: function (value) { + if (value[0] > value[1]) { + return value.slice(0).reverse(); + } + return value; + }, + updateValue: function (value, end, drag) { + var _this = this; + if (this.isRange(value)) { + value = this.handleOverlap(value).map(function (val) { return _this.format(val); }); + } + else { + value = this.format(value); + } + this.value = value; + var vertical = this.data.vertical; + var mainAxis = vertical ? 'height' : 'width'; + this.setData({ + wrapperStyle: "\n background: ".concat(this.data.inactiveColor || '', ";\n ").concat(vertical ? 'width' : 'height', ": ").concat((0, utils_1.addUnit)(this.data.barHeight) || '', ";\n "), + barStyle: "\n ".concat(mainAxis, ": ").concat(this.calcMainAxis(), ";\n left: ").concat(vertical ? 0 : this.calcOffset(), ";\n top: ").concat(vertical ? this.calcOffset() : 0, ";\n ").concat(drag ? 'transition: none;' : '', "\n "), + }); + if (drag) { + this.$emit('drag', { value: value }); + } + if (end) { + this.$emit('change', value); + } + if ((drag || end) && (0, version_1.canIUseModel)()) { + this.setData({ value: value }); + } + }, + getScope: function () { + return Number(this.data.max) - Number(this.data.min); + }, + getRange: function () { + var _a = this.data, max = _a.max, min = _a.min; + return max - min; + }, + // 计算选中条的长度百分比 + calcMainAxis: function () { + var value = this.value; + var min = this.data.min; + var scope = this.getScope(); + if (this.isRange(value)) { + return "".concat(((value[1] - value[0]) * 100) / scope, "%"); + } + return "".concat(((value - Number(min)) * 100) / scope, "%"); + }, + // 计算选中条的开始位置的偏移量 + calcOffset: function () { + var value = this.value; + var min = this.data.min; + var scope = this.getScope(); + if (this.isRange(value)) { + return "".concat(((value[0] - Number(min)) * 100) / scope, "%"); + } + return '0%'; + }, + format: function (value) { + var _a = this.data, max = _a.max, min = _a.min, step = _a.step; + return Math.round(Math.max(min, Math.min(value, max)) / step) * step; + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/slider/index.json b/miniprogram_npm/@vant/weapp/slider/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/slider/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/slider/index.wxml b/miniprogram_npm/@vant/weapp/slider/index.wxml new file mode 100644 index 0000000..7c0184f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/slider/index.wxml @@ -0,0 +1,68 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="../wxs/style.wxs" module="style" /> + +<view + class="custom-class {{ utils.bem('slider', { disabled, vertical }) }}" + style="{{ wrapperStyle }}" + bind:tap="onClick" +> + <view + class="{{ utils.bem('slider__bar') }}" + style="{{ barStyle }}; {{ style({ backgroundColor: activeColor }) }}" + > + <view + wx:if="{{ range }}" + class="{{ utils.bem('slider__button-wrapper-left') }}" + data-index="{{ 0 }}" + bind:touchstart="onTouchStart" + catch:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" + > + <slot + wx:if="{{ useButtonSlot }}" + name="left-button" + /> + <view + wx:else + class="{{ utils.bem('slider__button') }}" + /> + </view> + <view + wx:if="{{ range }}" + class="{{ utils.bem('slider__button-wrapper-right') }}" + data-index="{{ 1 }}" + bind:touchstart="onTouchStart" + catch:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" + > + <slot + wx:if="{{ useButtonSlot }}" + name="right-button" + /> + <view + wx:else + class="{{ utils.bem('slider__button') }}" + /> + </view> + + <view + wx:if="{{ !range }}" + class="{{ utils.bem('slider__button-wrapper') }}" + bind:touchstart="onTouchStart" + catch:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" + > + <slot + wx:if="{{ useButtonSlot }}" + name="button" + /> + <view + wx:else + class="{{ utils.bem('slider__button') }}" + /> + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/slider/index.wxs b/miniprogram_npm/@vant/weapp/slider/index.wxs new file mode 100644 index 0000000..7c43e6e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/slider/index.wxs @@ -0,0 +1,14 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function barStyle(barHeight, activeColor) { + return style({ + height: addUnit(barHeight), + background: activeColor, + }); +} + +module.exports = { + barStyle: barStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/slider/index.wxss b/miniprogram_npm/@vant/weapp/slider/index.wxss new file mode 100644 index 0000000..d1587de --- /dev/null +++ b/miniprogram_npm/@vant/weapp/slider/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-slider{background-color:var(--slider-inactive-background-color,#ebedf0);border-radius:999px;height:var(--slider-bar-height,2px);position:relative}.van-slider:before{bottom:calc(var(--padding-xs, 8px)*-1);content:"";left:0;position:absolute;right:0;top:calc(var(--padding-xs, 8px)*-1)}.van-slider__bar{background-color:var(--slider-active-background-color,#1989fa);border-radius:inherit;height:100%;position:relative;transition:all .2s;width:100%}.van-slider__button{background-color:var(--slider-button-background-color,#fff);border-radius:var(--slider-button-border-radius,50%);box-shadow:var(--slider-button-box-shadow,0 1px 2px rgba(0,0,0,.5));height:var(--slider-button-height,24px);width:var(--slider-button-width,24px)}.van-slider__button-wrapper,.van-slider__button-wrapper-right{position:absolute;right:0;top:50%;transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper-left{left:0;position:absolute;top:50%;transform:translate3d(-50%,-50%,0)}.van-slider--disabled{opacity:var(--slider-disabled-opacity,.5)}.van-slider--vertical{display:inline-block;height:100%;width:var(--slider-bar-height,2px)}.van-slider--vertical .van-slider__button-wrapper,.van-slider--vertical .van-slider__button-wrapper-right{bottom:0;right:50%;top:auto;transform:translate3d(50%,50%,0)}.van-slider--vertical .van-slider__button-wrapper-left{left:auto;right:50%;top:0;transform:translate3d(50%,-50%,0)}.van-slider--vertical:before{bottom:0;left:-8px;right:-8px;top:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/stepper/index.d.ts b/miniprogram_npm/@vant/weapp/stepper/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/stepper/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/stepper/index.js b/miniprogram_npm/@vant/weapp/stepper/index.js new file mode 100644 index 0000000..409517b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/stepper/index.js @@ -0,0 +1,200 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var validator_1 = require("../common/validator"); +var LONG_PRESS_START_TIME = 600; +var LONG_PRESS_INTERVAL = 200; +// add num and avoid float number +function add(num1, num2) { + var cardinal = Math.pow(10, 10); + return Math.round((num1 + num2) * cardinal) / cardinal; +} +function equal(value1, value2) { + return String(value1) === String(value2); +} +(0, component_1.VantComponent)({ + field: true, + classes: ['input-class', 'plus-class', 'minus-class'], + props: { + value: { + type: null, + observer: 'observeValue', + }, + integer: { + type: Boolean, + observer: 'check', + }, + disabled: Boolean, + inputWidth: String, + buttonSize: String, + asyncChange: Boolean, + disableInput: Boolean, + decimalLength: { + type: Number, + value: null, + observer: 'check', + }, + min: { + type: null, + value: 1, + observer: 'check', + }, + max: { + type: null, + value: Number.MAX_SAFE_INTEGER, + observer: 'check', + }, + step: { + type: null, + value: 1, + }, + showPlus: { + type: Boolean, + value: true, + }, + showMinus: { + type: Boolean, + value: true, + }, + disablePlus: Boolean, + disableMinus: Boolean, + longPress: { + type: Boolean, + value: true, + }, + theme: String, + alwaysEmbed: Boolean, + }, + data: { + currentValue: '', + }, + created: function () { + this.setData({ + currentValue: this.format(this.data.value), + }); + }, + methods: { + observeValue: function () { + var _a = this.data, value = _a.value, currentValue = _a.currentValue; + if (!equal(value, currentValue)) { + this.setData({ currentValue: this.format(value) }); + } + }, + check: function () { + var val = this.format(this.data.currentValue); + if (!equal(val, this.data.currentValue)) { + this.setData({ currentValue: val }); + } + }, + isDisabled: function (type) { + var _a = this.data, disabled = _a.disabled, disablePlus = _a.disablePlus, disableMinus = _a.disableMinus, currentValue = _a.currentValue, max = _a.max, min = _a.min; + if (type === 'plus') { + return disabled || disablePlus || currentValue >= max; + } + return disabled || disableMinus || currentValue <= min; + }, + onFocus: function (event) { + this.$emit('focus', event.detail); + }, + onBlur: function (event) { + var value = this.format(event.detail.value); + this.emitChange(value); + this.$emit('blur', __assign(__assign({}, event.detail), { value: value })); + }, + // filter illegal characters + filter: function (value) { + value = String(value).replace(/[^0-9.-]/g, ''); + if (this.data.integer && value.indexOf('.') !== -1) { + value = value.split('.')[0]; + } + return value; + }, + // limit value range + format: function (value) { + value = this.filter(value); + // format range + value = value === '' ? 0 : +value; + value = Math.max(Math.min(this.data.max, value), this.data.min); + // format decimal + if ((0, validator_1.isDef)(this.data.decimalLength)) { + value = value.toFixed(this.data.decimalLength); + } + return value; + }, + onInput: function (event) { + var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a; + // allow input to be empty + if (value === '') { + return; + } + var formatted = this.filter(value); + // limit max decimal length + if ((0, validator_1.isDef)(this.data.decimalLength) && formatted.indexOf('.') !== -1) { + var pair = formatted.split('.'); + formatted = "".concat(pair[0], ".").concat(pair[1].slice(0, this.data.decimalLength)); + } + this.emitChange(formatted); + }, + emitChange: function (value) { + if (!this.data.asyncChange) { + this.setData({ currentValue: value }); + } + this.$emit('change', value); + }, + onChange: function () { + var type = this.type; + if (this.isDisabled(type)) { + this.$emit('overlimit', type); + return; + } + var diff = type === 'minus' ? -this.data.step : +this.data.step; + var value = this.format(add(+this.data.currentValue, diff)); + this.emitChange(value); + this.$emit(type); + }, + longPressStep: function () { + var _this = this; + this.longPressTimer = setTimeout(function () { + _this.onChange(); + _this.longPressStep(); + }, LONG_PRESS_INTERVAL); + }, + onTap: function (event) { + var type = event.currentTarget.dataset.type; + this.type = type; + this.onChange(); + }, + onTouchStart: function (event) { + var _this = this; + if (!this.data.longPress) { + return; + } + clearTimeout(this.longPressTimer); + var type = event.currentTarget.dataset.type; + this.type = type; + this.isLongPress = false; + this.longPressTimer = setTimeout(function () { + _this.isLongPress = true; + _this.onChange(); + _this.longPressStep(); + }, LONG_PRESS_START_TIME); + }, + onTouchEnd: function () { + if (!this.data.longPress) { + return; + } + clearTimeout(this.longPressTimer); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/stepper/index.json b/miniprogram_npm/@vant/weapp/stepper/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/stepper/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/stepper/index.wxml b/miniprogram_npm/@vant/weapp/stepper/index.wxml new file mode 100644 index 0000000..6a58fd2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/stepper/index.wxml @@ -0,0 +1,44 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="{{ utils.bem('stepper', [theme]) }} custom-class"> + <view + wx:if="{{ showMinus }}" + data-type="minus" + style="{{ computed.buttonStyle({ buttonSize }) }}" + class="minus-class {{ utils.bem('stepper__minus', { disabled: disabled || disableMinus || currentValue <= min }) }}" + hover-class="van-stepper__minus--hover" + hover-stay-time="70" + bind:tap="onTap" + bind:touchstart="onTouchStart" + bind:touchend="onTouchEnd" + > + <slot name="minus" /> + </view> + <input + always-embed="{{ false }}" + type="{{ integer ? 'number' : 'digit' }}" + class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}" + style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}" + value="{{ currentValue }}" + focus="{{ focus }}" + disabled="{{ disabled || disableInput }}" + always-embed="{{ alwaysEmbed }}" + bindinput="onInput" + bind:focus="onFocus" + bind:blur="onBlur" + /> + <view + wx:if="{{ showPlus }}" + data-type="plus" + style="{{ computed.buttonStyle({ buttonSize }) }}" + class="plus-class {{ utils.bem('stepper__plus', { disabled: disabled || disablePlus || currentValue >= max }) }}" + hover-class="van-stepper__plus--hover" + hover-stay-time="70" + bind:tap="onTap" + bind:touchstart="onTouchStart" + bind:touchend="onTouchEnd" + > + <slot name="plus" /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/stepper/index.wxs b/miniprogram_npm/@vant/weapp/stepper/index.wxs new file mode 100644 index 0000000..a13e818 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/stepper/index.wxs @@ -0,0 +1,22 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function buttonStyle(data) { + return style({ + width: addUnit(data.buttonSize), + height: addUnit(data.buttonSize), + }); +} + +function inputStyle(data) { + return style({ + width: addUnit(data.inputWidth), + height: addUnit(data.buttonSize), + }); +} + +module.exports = { + buttonStyle: buttonStyle, + inputStyle: inputStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/stepper/index.wxss b/miniprogram_npm/@vant/weapp/stepper/index.wxss new file mode 100644 index 0000000..2561a7e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/stepper/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{background-color:var(--stepper-background-color,#f2f3f5);border:0;box-sizing:border-box;color:var(--stepper-button-icon-color,#323233);display:inline-block;height:var(--stepper-input-height,28px);margin:1px;padding:var(--padding-base,4px);position:relative;vertical-align:middle;width:var(--stepper-input-height,28px)}.van-stepper__minus:before,.van-stepper__plus:before{height:1px;width:9px}.van-stepper__minus:after,.van-stepper__plus:after{height:9px;width:1px}.van-stepper__minus:empty.van-stepper__minus:after,.van-stepper__minus:empty.van-stepper__minus:before,.van-stepper__minus:empty.van-stepper__plus:after,.van-stepper__minus:empty.van-stepper__plus:before,.van-stepper__plus:empty.van-stepper__minus:after,.van-stepper__plus:empty.van-stepper__minus:before,.van-stepper__plus:empty.van-stepper__plus:after,.van-stepper__plus:empty.van-stepper__plus:before{background-color:currentColor;bottom:0;content:"";left:0;margin:auto;position:absolute;right:0;top:0}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:var(--stepper-border-radius,var(--stepper-border-radius,4px)) 0 0 var(--stepper-border-radius,var(--stepper-border-radius,4px))}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 var(--stepper-border-radius,var(--stepper-border-radius,4px)) var(--stepper-border-radius,var(--stepper-border-radius,4px)) 0}.van-stepper--round .van-stepper__input{background-color:initial!important}.van-stepper--round .van-stepper__minus,.van-stepper--round .van-stepper__plus{border-radius:100%}.van-stepper--round .van-stepper__minus:active,.van-stepper--round .van-stepper__plus:active{opacity:.7}.van-stepper--round .van-stepper__minus--disabled,.van-stepper--round .van-stepper__minus--disabled:active,.van-stepper--round .van-stepper__plus--disabled,.van-stepper--round .van-stepper__plus--disabled:active{opacity:.3}.van-stepper--round .van-stepper__plus{background-color:#ee0a24;color:#fff}.van-stepper--round .van-stepper__minus{background-color:#fff;border:1px solid #ee0a24;color:#ee0a24}.van-stepper__input{-webkit-appearance:none;background-color:var(--stepper-background-color,#f2f3f5);border:0;border-radius:0;border-width:1px 0;box-sizing:border-box;color:var(--stepper-input-text-color,#323233);display:inline-block;font-size:var(--stepper-input-font-size,14px);height:var(--stepper-input-height,28px);margin:1px;min-height:0;padding:1px;text-align:center;vertical-align:middle;width:var(--stepper-input-width,32px)}.van-stepper__input--disabled{background-color:var(--stepper-input-disabled-background-color,#f2f3f5);color:var(--stepper-input-disabled-text-color,#c8c9cc)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/steps/index.d.ts b/miniprogram_npm/@vant/weapp/steps/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/steps/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/steps/index.js b/miniprogram_npm/@vant/weapp/steps/index.js new file mode 100644 index 0000000..1a9986a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/steps/index.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var color_1 = require("../common/color"); +(0, component_1.VantComponent)({ + classes: ['desc-class'], + props: { + icon: String, + steps: Array, + active: Number, + direction: { + type: String, + value: 'horizontal', + }, + activeColor: { + type: String, + value: color_1.GREEN, + }, + inactiveColor: { + type: String, + value: color_1.GRAY_DARK, + }, + activeIcon: { + type: String, + value: 'checked', + }, + inactiveIcon: String, + }, + methods: { + onClick: function (event) { + var index = event.currentTarget.dataset.index; + this.$emit('click-step', index); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/steps/index.json b/miniprogram_npm/@vant/weapp/steps/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/steps/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/steps/index.wxml b/miniprogram_npm/@vant/weapp/steps/index.wxml new file mode 100644 index 0000000..6180b41 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/steps/index.wxml @@ -0,0 +1,54 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="custom-class {{ utils.bem('steps', [direction]) }}"> + <view class="van-step__wrapper"> + <view + wx:for="{{ steps }}" + wx:key="index" + bindtap="onClick" + data-index="{{ index }}" + class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline" + style="{{ status(index, active) === 'inactive' ? 'color: ' + inactiveColor: '' }}" + > + <view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}"> + <view>{{ item.text }}</view> + <view class="desc-class">{{ item.desc }}</view> + </view> + <view class="van-step__circle-container"> + <block wx:if="{{ index !== active }}"> + <van-icon + wx:if="{{ item.inactiveIcon || inactiveIcon }}" + color="{{ status(index, active) === 'inactive' ? inactiveColor: activeColor }}" + name="{{ item.inactiveIcon || inactiveIcon }}" + custom-class="van-step__icon" + /> + <view + wx:else + class="van-step__circle" + style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}" + /> + </block> + + <van-icon wx:else name="{{ item.activeIcon || activeIcon }}" color="{{ activeColor }}" custom-class="van-step__icon" /> + </view> + <view + wx:if="{{ index !== steps.length - 1 }}" + class="van-step__line" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}" + /> + </view> + </view> +</view> + +<wxs module="status"> +function get(index, active) { + if (index < active) { + return 'finish'; + } else if (index === active) { + return 'process'; + } + + return 'inactive'; +} + +module.exports = get; +</wxs> diff --git a/miniprogram_npm/@vant/weapp/steps/index.wxss b/miniprogram_npm/@vant/weapp/steps/index.wxss new file mode 100644 index 0000000..48b7665 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/steps/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/sticky/index.d.ts b/miniprogram_npm/@vant/weapp/sticky/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sticky/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/sticky/index.js b/miniprogram_npm/@vant/weapp/sticky/index.js new file mode 100644 index 0000000..6f50dd3 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sticky/index.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = require("../common/utils"); +var component_1 = require("../common/component"); +var validator_1 = require("../common/validator"); +var page_scroll_1 = require("../mixins/page-scroll"); +var ROOT_ELEMENT = '.van-sticky'; +(0, component_1.VantComponent)({ + props: { + zIndex: { + type: Number, + value: 99, + }, + offsetTop: { + type: Number, + value: 0, + observer: 'onScroll', + }, + disabled: { + type: Boolean, + observer: 'onScroll', + }, + container: { + type: null, + observer: 'onScroll', + }, + scrollTop: { + type: null, + observer: function (val) { + this.onScroll({ scrollTop: val }); + }, + }, + }, + mixins: [ + (0, page_scroll_1.pageScrollMixin)(function (event) { + if (this.data.scrollTop != null) { + return; + } + this.onScroll(event); + }), + ], + data: { + height: 0, + fixed: false, + transform: 0, + }, + mounted: function () { + this.onScroll(); + }, + methods: { + onScroll: function (_a) { + var _this = this; + var _b = _a === void 0 ? {} : _a, scrollTop = _b.scrollTop; + var _c = this.data, container = _c.container, offsetTop = _c.offsetTop, disabled = _c.disabled; + if (disabled) { + this.setDataAfterDiff({ + fixed: false, + transform: 0, + }); + return; + } + this.scrollTop = scrollTop || this.scrollTop; + if (typeof container === 'function') { + Promise.all([ + (0, utils_1.getRect)(this, ROOT_ELEMENT), + this.getContainerRect(), + ]).then(function (_a) { + var root = _a[0], container = _a[1]; + if (offsetTop + root.height > container.height + container.top) { + _this.setDataAfterDiff({ + fixed: false, + transform: container.height - root.height, + }); + } + else if (offsetTop >= root.top) { + _this.setDataAfterDiff({ + fixed: true, + height: root.height, + transform: 0, + }); + } + else { + _this.setDataAfterDiff({ fixed: false, transform: 0 }); + } + }); + return; + } + (0, utils_1.getRect)(this, ROOT_ELEMENT).then(function (root) { + if (!(0, validator_1.isDef)(root)) { + return; + } + if (offsetTop >= root.top) { + _this.setDataAfterDiff({ fixed: true, height: root.height }); + _this.transform = 0; + } + else { + _this.setDataAfterDiff({ fixed: false }); + } + }); + }, + setDataAfterDiff: function (data) { + var _this = this; + wx.nextTick(function () { + var diff = Object.keys(data).reduce(function (prev, key) { + if (data[key] !== _this.data[key]) { + prev[key] = data[key]; + } + return prev; + }, {}); + if (Object.keys(diff).length > 0) { + _this.setData(diff); + } + _this.$emit('scroll', { + scrollTop: _this.scrollTop, + isFixed: data.fixed || _this.data.fixed, + }); + }); + }, + getContainerRect: function () { + var nodesRef = this.data.container(); + return new Promise(function (resolve) { return nodesRef.boundingClientRect(resolve).exec(); }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/sticky/index.json b/miniprogram_npm/@vant/weapp/sticky/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sticky/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/sticky/index.wxml b/miniprogram_npm/@vant/weapp/sticky/index.wxml new file mode 100644 index 0000000..15e9f4a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sticky/index.wxml @@ -0,0 +1,8 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class van-sticky" style="{{ computed.containerStyle({ fixed, height, zIndex }) }}"> + <view class="{{ utils.bem('sticky-wrap', { fixed }) }}" style="{{ computed.wrapStyle({ fixed, offsetTop, transform, zIndex }) }}"> + <slot /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/sticky/index.wxs b/miniprogram_npm/@vant/weapp/sticky/index.wxs new file mode 100644 index 0000000..be99d89 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sticky/index.wxs @@ -0,0 +1,25 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function wrapStyle(data) { + return style({ + transform: data.transform + ? 'translate3d(0, ' + data.transform + 'px, 0)' + : '', + top: data.fixed ? addUnit(data.offsetTop) : '', + 'z-index': data.zIndex, + }); +} + +function containerStyle(data) { + return style({ + height: data.fixed ? addUnit(data.height) : '', + 'z-index': data.zIndex, + }); +} + +module.exports = { + wrapStyle: wrapStyle, + containerStyle: containerStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/sticky/index.wxss b/miniprogram_npm/@vant/weapp/sticky/index.wxss new file mode 100644 index 0000000..34d76aa --- /dev/null +++ b/miniprogram_npm/@vant/weapp/sticky/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{left:0;position:fixed;right:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/submit-bar/index.d.ts b/miniprogram_npm/@vant/weapp/submit-bar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/submit-bar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/submit-bar/index.js b/miniprogram_npm/@vant/weapp/submit-bar/index.js new file mode 100644 index 0000000..d3bfc25 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/submit-bar/index.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.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: function () { + var _a = this.data, price = _a.price, decimalLength = _a.decimalLength; + var priceStrArr = typeof price === 'number' && + (price / 100).toFixed(decimalLength).split('.'); + this.setData({ + hasPrice: typeof price === 'number', + integerStr: priceStrArr && priceStrArr[0], + decimalStr: decimalLength && priceStrArr ? ".".concat(priceStrArr[1]) : '', + }); + }, + updateTip: function () { + this.setData({ hasTip: typeof this.data.tip === 'string' }); + }, + onSubmit: function (event) { + this.$emit('submit', event.detail); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/submit-bar/index.json b/miniprogram_npm/@vant/weapp/submit-bar/index.json new file mode 100644 index 0000000..bda9b8d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/submit-bar/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-button": "../button/index", + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/submit-bar/index.wxml b/miniprogram_npm/@vant/weapp/submit-bar/index.wxml new file mode 100644 index 0000000..a56dd46 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/submit-bar/index.wxml @@ -0,0 +1,44 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view class="van-submit-bar custom-class"> + <slot name="top" /> + + <view class="van-submit-bar__tip"> + <van-icon + wx:if="{{ tipIcon }}" + size="12px" + name="{{ tipIcon }}" + custom-class="van-submit-bar__tip-icon" + /> + <view wx:if="{{ hasTip }}" class="van-submit-bar__tip-text"> + {{ tip }} + </view> + <slot name="tip" /> + </view> + + <view class="bar-class van-submit-bar__bar"> + <slot /> + <view wx:if="{{ hasPrice }}" class="van-submit-bar__text"> + <text>{{ label || '合计:' }}</text> + <text class="van-submit-bar__price price-class"> + <text class="van-submit-bar__currency">{{ currency }} </text> + <text class="van-submit-bar__price-integer">{{ integerStr }}</text><text>{{decimalStr}}</text> + </text> + <text class="van-submit-bar__suffix-label">{{ suffixLabel }}</text> + </view> + <van-button + round + type="{{ buttonType }}" + loading="{{ loading }}" + disabled="{{ disabled }}" + class="van-submit-bar__button" + custom-class="button-class" + custom-style="width: 100%;" + bind:click="onSubmit" + > + {{ loading ? '' : buttonText }} + </van-button> + </view> + + <view wx:if="{{ safeAreaInsetBottom }}" class="van-submit-bar__safe" /> +</view> diff --git a/miniprogram_npm/@vant/weapp/submit-bar/index.wxss b/miniprogram_npm/@vant/weapp/submit-bar/index.wxss new file mode 100644 index 0000000..8379a30 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/submit-bar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-submit-bar{background-color:var(--submit-bar-background-color,#fff);bottom:0;left:0;position:fixed;-webkit-user-select:none;user-select:none;width:100%;z-index:var(--submit-bar-z-index,100)}.van-submit-bar__tip{background-color:var(--submit-bar-tip-background-color,#fff7cc);color:var(--submit-bar-tip-color,#f56723);font-size:var(--submit-bar-tip-font-size,12px);line-height:var(--submit-bar-tip-line-height,1.5);padding:var(--submit-bar-tip-padding,10px)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{margin-right:4px;vertical-align:middle}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{align-items:center;background-color:var(--submit-bar-background-color,#fff);display:flex;font-size:var(--submit-bar-text-font-size,14px);height:var(--submit-bar-height,50px);justify-content:flex-end;padding:var(--submit-bar-padding,0 16px)}.van-submit-bar__safe{height:constant(safe-area-inset-bottom);height:env(safe-area-inset-bottom)}.van-submit-bar__text{color:var(--submit-bar-text-color,#323233);flex:1;font-weight:var(--font-weight-bold,500);padding-right:var(--padding-sm,12px);text-align:right}.van-submit-bar__price{color:var(--submit-bar-price-color,#ee0a24);font-size:var(--submit-bar-price-font-size,12px);font-weight:var(--font-weight-bold,500)}.van-submit-bar__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-size:20px}.van-submit-bar__currency{font-size:var(--submit-bar-currency-font-size,12px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{--button-default-height:var(--submit-bar-button-height,40px)!important;--button-line-height:var(--submit-bar-button-height,40px)!important;font-weight:var(--font-weight-bold,500);width:var(--submit-bar-button-width,110px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/swipe-cell/index.d.ts b/miniprogram_npm/@vant/weapp/swipe-cell/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/swipe-cell/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/swipe-cell/index.js b/miniprogram_npm/@vant/weapp/swipe-cell/index.js new file mode 100644 index 0000000..1582b6c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/swipe-cell/index.js @@ -0,0 +1,135 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var touch_1 = require("../mixins/touch"); +var utils_1 = require("../common/utils"); +var THRESHOLD = 0.3; +var ARRAY = []; +(0, component_1.VantComponent)({ + props: { + disabled: Boolean, + leftWidth: { + type: Number, + value: 0, + observer: function (leftWidth) { + if (leftWidth === void 0) { leftWidth = 0; } + if (this.offset > 0) { + this.swipeMove(leftWidth); + } + }, + }, + rightWidth: { + type: Number, + value: 0, + observer: function (rightWidth) { + if (rightWidth === void 0) { rightWidth = 0; } + if (this.offset < 0) { + this.swipeMove(-rightWidth); + } + }, + }, + asyncClose: Boolean, + name: { + type: null, + value: '', + }, + }, + mixins: [touch_1.touch], + data: { + catchMove: false, + wrapperStyle: '', + }, + created: function () { + this.offset = 0; + ARRAY.push(this); + }, + destroyed: function () { + var _this = this; + ARRAY = ARRAY.filter(function (item) { return item !== _this; }); + }, + methods: { + open: function (position) { + var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth; + var offset = position === 'left' ? leftWidth : -rightWidth; + this.swipeMove(offset); + this.$emit('open', { + position: position, + name: this.data.name, + }); + }, + close: function () { + this.swipeMove(0); + }, + swipeMove: function (offset) { + if (offset === void 0) { offset = 0; } + this.offset = (0, utils_1.range)(offset, -this.data.rightWidth, this.data.leftWidth); + var transform = "translate3d(".concat(this.offset, "px, 0, 0)"); + var transition = this.dragging + ? 'none' + : 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)'; + this.setData({ + wrapperStyle: "\n -webkit-transform: ".concat(transform, ";\n -webkit-transition: ").concat(transition, ";\n transform: ").concat(transform, ";\n transition: ").concat(transition, ";\n "), + }); + }, + swipeLeaveTransition: function () { + var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth; + var offset = this.offset; + 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: function (event) { + if (this.data.disabled) { + return; + } + this.startOffset = this.offset; + this.touchStart(event); + }, + noop: function () { }, + onDrag: function (event) { + var _this = this; + if (this.data.disabled) { + return; + } + this.touchMove(event); + if (this.direction !== 'horizontal') { + return; + } + this.dragging = true; + ARRAY.filter(function (item) { return item !== _this && item.offset !== 0; }).forEach(function (item) { return item.close(); }); + this.setData({ catchMove: true }); + this.swipeMove(this.startOffset + this.deltaX); + }, + endDrag: function () { + if (this.data.disabled) { + return; + } + this.dragging = false; + this.swipeLeaveTransition(); + }, + onClick: function (event) { + var _a = event.currentTarget.dataset.key, position = _a === void 0 ? 'outside' : _a; + this.$emit('click', position); + if (!this.offset) { + return; + } + if (this.data.asyncClose) { + this.$emit('close', { + position: position, + instance: this, + name: this.data.name, + }); + } + else { + this.swipeMove(0); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/swipe-cell/index.json b/miniprogram_npm/@vant/weapp/swipe-cell/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/swipe-cell/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/swipe-cell/index.wxml b/miniprogram_npm/@vant/weapp/swipe-cell/index.wxml new file mode 100644 index 0000000..3f7f726 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/swipe-cell/index.wxml @@ -0,0 +1,20 @@ +<view + class="van-swipe-cell custom-class" + data-key="cell" + catchtap="onClick" + bindtouchstart="startDrag" + catchtouchmove="{{ catchMove ? 'noop' : '' }}" + capture-bind:touchmove="onDrag" + bindtouchend="endDrag" + bindtouchcancel="endDrag" +> + <view style="{{ wrapperStyle }}"> + <view wx:if="{{ leftWidth }}" class="van-swipe-cell__left" data-key="left" catch:tap="onClick"> + <slot name="left" /> + </view> + <slot /> + <view wx:if="{{ rightWidth }}" class="van-swipe-cell__right" data-key="right" catch:tap="onClick"> + <slot name="right" /> + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/swipe-cell/index.wxss b/miniprogram_npm/@vant/weapp/swipe-cell/index.wxss new file mode 100644 index 0000000..3a265bf --- /dev/null +++ b/miniprogram_npm/@vant/weapp/swipe-cell/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-swipe-cell{overflow:hidden;position:relative}.van-swipe-cell__left,.van-swipe-cell__right{height:100%;position:absolute;top:0}.van-swipe-cell__left{left:0;transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;transform:translate3d(100%,0,0)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/switch/index.d.ts b/miniprogram_npm/@vant/weapp/switch/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/switch/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/switch/index.js b/miniprogram_npm/@vant/weapp/switch/index.js new file mode 100644 index 0000000..1d2317f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/switch/index.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + field: true, + classes: ['node-class'], + props: { + checked: null, + loading: Boolean, + disabled: Boolean, + activeColor: String, + inactiveColor: String, + size: { + type: String, + value: '30', + }, + activeValue: { + type: null, + value: true, + }, + inactiveValue: { + type: null, + value: false, + }, + }, + methods: { + onClick: function () { + var _a = this.data, activeValue = _a.activeValue, inactiveValue = _a.inactiveValue, disabled = _a.disabled, loading = _a.loading; + if (disabled || loading) { + return; + } + var checked = this.data.checked === activeValue; + var value = checked ? inactiveValue : activeValue; + this.$emit('input', value); + this.$emit('change', value); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/switch/index.json b/miniprogram_npm/@vant/weapp/switch/index.json new file mode 100644 index 0000000..01077f5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/switch/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/switch/index.wxml b/miniprogram_npm/@vant/weapp/switch/index.wxml new file mode 100644 index 0000000..4e9789b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/switch/index.wxml @@ -0,0 +1,16 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class" + style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}" + bind:tap="onClick" +> + <view class="van-switch__node node-class"> + <van-loading + wx:if="{{ loading }}" + color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}" + custom-class="van-switch__loading" + /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/switch/index.wxs b/miniprogram_npm/@vant/weapp/switch/index.wxs new file mode 100644 index 0000000..3ae387a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/switch/index.wxs @@ -0,0 +1,26 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + var currentColor = data.checked === data.activeValue ? data.activeColor : data.inactiveColor; + + return style({ + 'font-size': addUnit(data.size), + 'background-color': currentColor, + }); +} + +var BLUE = '#1989fa'; +var GRAY_DARK = '#969799'; + +function loadingColor(data) { + return data.checked === data.activeValue + ? data.activeColor || BLUE + : data.inactiveColor || GRAY_DARK; +} + +module.exports = { + rootStyle: rootStyle, + loadingColor: loadingColor, +}; diff --git a/miniprogram_npm/@vant/weapp/switch/index.wxss b/miniprogram_npm/@vant/weapp/switch/index.wxss new file mode 100644 index 0000000..35929de --- /dev/null +++ b/miniprogram_npm/@vant/weapp/switch/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-switch{background-color:var(--switch-background-color,#fff);border:var(--switch-border,1px solid rgba(0,0,0,.1));border-radius:var(--switch-node-size,1em);box-sizing:initial;display:inline-block;height:var(--switch-height,1em);position:relative;transition:background-color var(--switch-transition-duration,.3s);width:var(--switch-width,2em)}.van-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,1em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,1em);z-index:var(--switch-node-z-index,1)}.van-switch__loading{height:50%;left:25%;position:absolute!important;top:25%;width:50%}.van-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.van-switch--on .van-switch__node{transform:translateX(calc(var(--switch-width, 2em) - var(--switch-node-size, 1em)))}.van-switch--disabled{opacity:var(--switch-disabled-opacity,.4)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/tab/index.d.ts b/miniprogram_npm/@vant/weapp/tab/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tab/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/tab/index.js b/miniprogram_npm/@vant/weapp/tab/index.js new file mode 100644 index 0000000..ae4d06b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tab/index.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var relation_1 = require("../common/relation"); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useParent)('tabs'), + props: { + dot: { + type: Boolean, + observer: 'update', + }, + info: { + type: null, + observer: 'update', + }, + title: { + type: String, + observer: 'update', + }, + disabled: { + type: Boolean, + observer: 'update', + }, + titleStyle: { + type: String, + observer: 'update', + }, + name: { + type: null, + value: '', + }, + }, + data: { + active: false, + }, + methods: { + getComputedName: function () { + if (this.data.name !== '') { + return this.data.name; + } + return this.index; + }, + updateRender: function (active, parent) { + var parentData = parent.data; + this.inited = this.inited || active; + this.setData({ + active: active, + shouldRender: this.inited || !parentData.lazyRender, + shouldShow: active || parentData.animated, + }); + }, + update: function () { + if (this.parent) { + this.parent.updateTabs(); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/tab/index.json b/miniprogram_npm/@vant/weapp/tab/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tab/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/tab/index.wxml b/miniprogram_npm/@vant/weapp/tab/index.wxml new file mode 100644 index 0000000..f5e99f2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tab/index.wxml @@ -0,0 +1,8 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="custom-class {{ utils.bem('tab__pane', { active, inactive: !active }) }}" + style="{{ shouldShow ? '' : 'display: none;' }}" +> + <slot wx:if="{{ shouldRender }}" /> +</view> diff --git a/miniprogram_npm/@vant/weapp/tab/index.wxss b/miniprogram_npm/@vant/weapp/tab/index.wxss new file mode 100644 index 0000000..1c90c88 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tab/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';:host{box-sizing:border-box;flex-shrink:0;width:100%}.van-tab__pane{-webkit-overflow-scrolling:touch;box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/tabbar-item/index.d.ts b/miniprogram_npm/@vant/weapp/tabbar-item/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/tabbar-item/index.js b/miniprogram_npm/@vant/weapp/tabbar-item/index.js new file mode 100644 index 0000000..1a88d4e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar-item/index.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + props: { + info: null, + name: null, + icon: String, + dot: Boolean, + iconPrefix: { + type: String, + value: 'van-icon', + }, + }, + relation: (0, relation_1.useParent)('tabbar'), + data: { + active: false, + activeColor: '', + inactiveColor: '', + }, + methods: { + onClick: function () { + var parent = this.parent; + if (parent) { + var index = parent.children.indexOf(this); + var active = this.data.name || index; + if (active !== this.data.active) { + parent.$emit('change', active); + } + } + this.$emit('click'); + }, + updateFromParent: function () { + var parent = this.parent; + if (!parent) { + return; + } + var index = parent.children.indexOf(this); + var parentData = parent.data; + var data = this.data; + var active = (data.name || index) === parentData.active; + var 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; + } + if (Object.keys(patch).length > 0) { + this.setData(patch); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/tabbar-item/index.json b/miniprogram_npm/@vant/weapp/tabbar-item/index.json new file mode 100644 index 0000000..16f174c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar-item/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-info": "../info/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/tabbar-item/index.wxml b/miniprogram_npm/@vant/weapp/tabbar-item/index.wxml new file mode 100644 index 0000000..524728f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar-item/index.wxml @@ -0,0 +1,28 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ utils.bem('tabbar-item', { active }) }} custom-class" + style="color: {{ active ? activeColor : inactiveColor }}" + bindtap="onClick" +> + <view class="van-tabbar-item__icon"> + <van-icon + wx:if="{{ icon }}" + name="{{ icon }}" + class-prefix="{{ iconPrefix }}" + custom-class="van-tabbar-item__icon__inner" + /> + <block wx:else> + <slot wx:if="{{ active }}" name="icon-active" /> + <slot wx:else name="icon" /> + </block> + <van-info + dot="{{ dot }}" + info="{{ info }}" + custom-class="van-tabbar-item__info" + /> + </view> + <view class="van-tabbar-item__text"> + <slot /> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/tabbar-item/index.wxss b/miniprogram_npm/@vant/weapp/tabbar-item/index.wxss new file mode 100644 index 0000000..21ee224 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';:host{flex:1}.van-tabbar-item{align-items:center;color:var(--tabbar-item-text-color,#646566);display:flex;flex-direction:column;font-size:var(--tabbar-item-font-size,12px);height:100%;justify-content:center;line-height:var(--tabbar-item-line-height,1)}.van-tabbar-item__icon{font-size:var(--tabbar-item-icon-size,22px);margin-bottom:var(--tabbar-item-margin-bottom,4px);position:relative}.van-tabbar-item__icon__inner{display:block;min-width:1em}.van-tabbar-item--active{color:var(--tabbar-item-active-color,#1989fa)}.van-tabbar-item__info{margin-top:2px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/tabbar/index.d.ts b/miniprogram_npm/@vant/weapp/tabbar/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/tabbar/index.js b/miniprogram_npm/@vant/weapp/tabbar/index.js new file mode 100644 index 0000000..3db793d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var relation_1 = require("../common/relation"); +var utils_1 = require("../common/utils"); +(0, component_1.VantComponent)({ + relation: (0, relation_1.useChildren)('tabbar-item', function () { + this.updateChildren(); + }), + props: { + active: { + type: null, + observer: 'updateChildren', + }, + activeColor: { + type: String, + observer: 'updateChildren', + }, + inactiveColor: { + type: String, + observer: 'updateChildren', + }, + fixed: { + type: Boolean, + value: true, + observer: 'setHeight', + }, + placeholder: { + type: Boolean, + observer: 'setHeight', + }, + border: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 1, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, + data: { + height: 50, + }, + methods: { + updateChildren: function () { + var children = this.children; + if (!Array.isArray(children) || !children.length) { + return; + } + children.forEach(function (child) { return child.updateFromParent(); }); + }, + setHeight: function () { + var _this = this; + if (!this.data.fixed || !this.data.placeholder) { + return; + } + wx.nextTick(function () { + (0, utils_1.getRect)(_this, '.van-tabbar').then(function (res) { + _this.setData({ height: res.height }); + }); + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/tabbar/index.json b/miniprogram_npm/@vant/weapp/tabbar/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/tabbar/index.wxml b/miniprogram_npm/@vant/weapp/tabbar/index.wxml new file mode 100644 index 0000000..43bb111 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar/index.wxml @@ -0,0 +1,10 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> + +<view + class="{{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }} custom-class" + style="{{ zIndex ? 'z-index: ' + zIndex : '' }}" +> + <slot /> +</view> + +<view wx:if="{{ fixed && placeholder }}" style="height: {{ height }}px;"></view> diff --git a/miniprogram_npm/@vant/weapp/tabbar/index.wxss b/miniprogram_npm/@vant/weapp/tabbar/index.wxss new file mode 100644 index 0000000..42b6c1e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabbar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-tabbar{background-color:var(--tabbar-background-color,#fff);box-sizing:initial;display:flex;height:var(--tabbar-height,50px);width:100%}.van-tabbar--fixed{bottom:0;left:0;position:fixed}.van-tabbar--safe{padding-bottom:env(safe-area-inset-bottom)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/tabs/index.d.ts b/miniprogram_npm/@vant/weapp/tabs/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabs/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/tabs/index.js b/miniprogram_npm/@vant/weapp/tabs/index.js new file mode 100644 index 0000000..625dde0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabs/index.js @@ -0,0 +1,282 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var touch_1 = require("../mixins/touch"); +var utils_1 = require("../common/utils"); +var validator_1 = require("../common/validator"); +var relation_1 = require("../common/relation"); +(0, component_1.VantComponent)({ + mixins: [touch_1.touch], + classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'], + relation: (0, relation_1.useChildren)('tab', function () { + this.updateTabs(); + }), + props: { + sticky: Boolean, + border: Boolean, + swipeable: Boolean, + titleActiveColor: String, + titleInactiveColor: String, + color: String, + animated: { + type: Boolean, + observer: function () { + var _this = this; + this.children.forEach(function (child, index) { + return child.updateRender(index === _this.data.currentIndex, _this); + }); + }, + }, + lineWidth: { + type: null, + value: 40, + observer: 'resize', + }, + lineHeight: { + type: null, + value: -1, + }, + active: { + type: null, + value: 0, + observer: function (name) { + if (name !== this.getCurrentName()) { + this.setCurrentIndexByName(name); + } + }, + }, + type: { + type: String, + value: 'line', + }, + ellipsis: { + type: Boolean, + value: true, + }, + duration: { + type: Number, + value: 0.3, + }, + zIndex: { + type: Number, + value: 1, + }, + swipeThreshold: { + type: Number, + value: 5, + observer: function (value) { + this.setData({ + scrollable: this.children.length > value || !this.data.ellipsis, + }); + }, + }, + offsetTop: { + type: Number, + value: 0, + }, + lazyRender: { + type: Boolean, + value: true, + }, + }, + data: { + tabs: [], + scrollLeft: 0, + scrollable: false, + currentIndex: 0, + container: null, + skipTransition: true, + scrollWithAnimation: false, + lineOffsetLeft: 0, + }, + mounted: function () { + var _this = this; + (0, utils_1.requestAnimationFrame)(function () { + _this.swiping = true; + _this.setData({ + container: function () { return _this.createSelectorQuery().select('.van-tabs'); }, + }); + _this.resize(); + _this.scrollIntoView(); + }); + }, + methods: { + updateTabs: function () { + var _a = this, _b = _a.children, children = _b === void 0 ? [] : _b, data = _a.data; + this.setData({ + tabs: children.map(function (child) { return child.data; }), + scrollable: this.children.length > data.swipeThreshold || !data.ellipsis, + }); + this.setCurrentIndexByName(data.active || this.getCurrentName()); + }, + trigger: function (eventName, child) { + var currentIndex = this.data.currentIndex; + var currentChild = child || this.children[currentIndex]; + if (!(0, validator_1.isDef)(currentChild)) { + return; + } + this.$emit(eventName, { + index: currentChild.index, + name: currentChild.getComputedName(), + title: currentChild.data.title, + }); + }, + onTap: function (event) { + var _this = this; + var index = event.currentTarget.dataset.index; + var child = this.children[index]; + if (child.data.disabled) { + this.trigger('disabled', child); + } + else { + this.setCurrentIndex(index); + (0, utils_1.nextTick)(function () { + _this.trigger('click'); + }); + } + }, + // correct the index of active tab + setCurrentIndexByName: function (name) { + var _a = this.children, children = _a === void 0 ? [] : _a; + var matched = children.filter(function (child) { return child.getComputedName() === name; }); + if (matched.length) { + this.setCurrentIndex(matched[0].index); + } + }, + setCurrentIndex: function (currentIndex) { + var _this = this; + var _a = this, data = _a.data, _b = _a.children, children = _b === void 0 ? [] : _b; + if (!(0, validator_1.isDef)(currentIndex) || + currentIndex >= children.length || + currentIndex < 0) { + return; + } + (0, utils_1.groupSetData)(this, function () { + children.forEach(function (item, index) { + var active = index === currentIndex; + if (active !== item.data.active || !item.inited) { + item.updateRender(active, _this); + } + }); + }); + if (currentIndex === data.currentIndex) { + return; + } + var shouldEmitChange = data.currentIndex !== null; + this.setData({ currentIndex: currentIndex }); + (0, utils_1.requestAnimationFrame)(function () { + _this.resize(); + _this.scrollIntoView(); + }); + (0, utils_1.nextTick)(function () { + _this.trigger('input'); + if (shouldEmitChange) { + _this.trigger('change'); + } + }); + }, + getCurrentName: function () { + var activeTab = this.children[this.data.currentIndex]; + if (activeTab) { + return activeTab.getComputedName(); + } + }, + resize: function () { + var _this = this; + if (this.data.type !== 'line') { + return; + } + var _a = this.data, currentIndex = _a.currentIndex, ellipsis = _a.ellipsis, skipTransition = _a.skipTransition; + Promise.all([ + (0, utils_1.getAllRect)(this, '.van-tab'), + (0, utils_1.getRect)(this, '.van-tabs__line'), + ]).then(function (_a) { + var _b = _a[0], rects = _b === void 0 ? [] : _b, lineRect = _a[1]; + var rect = rects[currentIndex]; + if (rect == null) { + return; + } + var lineOffsetLeft = rects + .slice(0, currentIndex) + .reduce(function (prev, curr) { return prev + curr.width; }, 0); + lineOffsetLeft += + (rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8); + _this.setData({ lineOffsetLeft: lineOffsetLeft }); + _this.swiping = true; + if (skipTransition) { + (0, utils_1.nextTick)(function () { + _this.setData({ skipTransition: false }); + }); + } + }); + }, + // scroll active tab into view + scrollIntoView: function () { + var _this = this; + var _a = this.data, currentIndex = _a.currentIndex, scrollable = _a.scrollable, scrollWithAnimation = _a.scrollWithAnimation; + if (!scrollable) { + return; + } + Promise.all([ + (0, utils_1.getAllRect)(this, '.van-tab'), + (0, utils_1.getRect)(this, '.van-tabs__nav'), + ]).then(function (_a) { + var tabRects = _a[0], navRect = _a[1]; + var tabRect = tabRects[currentIndex]; + var offsetLeft = tabRects + .slice(0, currentIndex) + .reduce(function (prev, curr) { return prev + curr.width; }, 0); + _this.setData({ + scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2, + }); + if (!scrollWithAnimation) { + (0, utils_1.nextTick)(function () { + _this.setData({ scrollWithAnimation: true }); + }); + } + }); + }, + onTouchScroll: function (event) { + this.$emit('scroll', event.detail); + }, + onTouchStart: function (event) { + if (!this.data.swipeable) + return; + this.swiping = true; + this.touchStart(event); + }, + onTouchMove: function (event) { + if (!this.data.swipeable || !this.swiping) + return; + this.touchMove(event); + }, + // watch swipe touch end + onTouchEnd: function () { + if (!this.data.swipeable || !this.swiping) + return; + var _a = this, direction = _a.direction, deltaX = _a.deltaX, offsetX = _a.offsetX; + var minSwipeDistance = 50; + if (direction === 'horizontal' && offsetX >= minSwipeDistance) { + var index = this.getAvaiableTab(deltaX); + if (index !== -1) { + this.setCurrentIndex(index); + } + } + this.swiping = false; + }, + getAvaiableTab: function (direction) { + var _a = this.data, tabs = _a.tabs, currentIndex = _a.currentIndex; + var step = direction > 0 ? -1 : 1; + for (var i = step; currentIndex + i < tabs.length && currentIndex + i >= 0; i += step) { + var index = currentIndex + i; + if (index >= 0 && + index < tabs.length && + tabs[index] && + !tabs[index].disabled) { + return index; + } + } + return -1; + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/tabs/index.json b/miniprogram_npm/@vant/weapp/tabs/index.json new file mode 100644 index 0000000..19c0bc3 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabs/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-info": "../info/index", + "van-sticky": "../sticky/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/tabs/index.wxml b/miniprogram_npm/@vant/weapp/tabs/index.wxml new file mode 100644 index 0000000..f76dd63 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabs/index.wxml @@ -0,0 +1,63 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="custom-class {{ utils.bem('tabs', [type]) }}"> + <van-sticky + disabled="{{ !sticky }}" + z-index="{{ zIndex }}" + offset-top="{{ offsetTop }}" + container="{{ container }}" + bind:scroll="onTouchScroll" + > + <view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }}"> + <slot name="nav-left" /> + + <scroll-view + scroll-x="{{ scrollable }}" + scroll-with-animation="{{ scrollWithAnimation }}" + scroll-left="{{ scrollLeft }}" + class="{{ utils.bem('tabs__scroll', [type]) }}" + style="{{ color ? 'border-color: ' + color : '' }}" + > + <view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}"> + <view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth }) }}" /> + <view + wx:for="{{ tabs }}" + wx:key="index" + data-index="{{ index }}" + class="{{ computed.tabClass(index === currentIndex, ellipsis) }} {{ utils.bem('tab', { active: index === currentIndex, disabled: item.disabled, complete: !ellipsis }) }}" + style="{{ computed.tabStyle({ active: index === currentIndex, ellipsis, color, type, disabled: item.disabled, titleActiveColor, titleInactiveColor, swipeThreshold, scrollable }) }}" + bind:tap="onTap" + > + <view class="{{ ellipsis ? 'van-ellipsis' : '' }}" style="{{ item.titleStyle }}"> + {{ item.title }} + <van-info + wx:if="{{ item.info !== null || item.dot }}" + info="{{ item.info }}" + dot="{{ item.dot }}" + custom-class="van-tab__title__info" + /> + </view> + </view> + </view> + </scroll-view> + + <slot name="nav-right" /> + </view> + </van-sticky> + + <view + class="van-tabs__content" + bind:touchstart="onTouchStart" + bind:touchmove="onTouchMove" + bind:touchend="onTouchEnd" + bind:touchcancel="onTouchEnd" + > + <view + class="{{ utils.bem('tabs__track', [{ animated }]) }} van-tabs__track" + style="{{ computed.trackStyle({ duration, currentIndex, animated }) }}" + > + <slot /> + </view> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/tabs/index.wxs b/miniprogram_npm/@vant/weapp/tabs/index.wxs new file mode 100644 index 0000000..a027c7b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabs/index.wxs @@ -0,0 +1,82 @@ +/* eslint-disable */ +var utils = require('../wxs/utils.wxs'); +var style = require('../wxs/style.wxs'); + +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(data) { + var titleColor = data.active + ? data.titleActiveColor + : data.titleInactiveColor; + + var ellipsis = data.scrollable && data.ellipsis; + + // card theme color + if (data.type === 'card') { + return style({ + 'border-color': data.color, + 'background-color': !data.disabled && data.active ? data.color : null, + color: titleColor || (!data.disabled && !data.active ? data.color : null), + 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null, + }); + } + + return style({ + color: titleColor, + 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null, + }); +} + +function navStyle(color, type) { + return style({ + 'border-color': type === 'card' && color ? color : null, + }); +} + +function trackStyle(data) { + if (!data.animated) { + return ''; + } + + return style({ + left: -100 * data.currentIndex + '%', + 'transition-duration': data.duration + 's', + '-webkit-transition-duration': data.duration + 's', + }); +} + +function lineStyle(data) { + return style({ + width: utils.addUnit(data.lineWidth), + transform: 'translateX(' + data.lineOffsetLeft + 'px)', + '-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)', + 'background-color': data.color, + height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, + 'border-radius': + data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, + 'transition-duration': !data.skipTransition ? data.duration + 's' : null, + '-webkit-transition-duration': !data.skipTransition + ? data.duration + 's' + : null, + }); +} + +module.exports = { + tabClass: tabClass, + tabStyle: tabStyle, + trackStyle: trackStyle, + lineStyle: lineStyle, + navStyle: navStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/tabs/index.wxss b/miniprogram_npm/@vant/weapp/tabs/index.wxss new file mode 100644 index 0000000..bb592c3 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tabs/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{display:inline-block;position:relative!important;top:-1px!important;transform:translateX(0)!important} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/tag/index.d.ts b/miniprogram_npm/@vant/weapp/tag/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tag/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/tag/index.js b/miniprogram_npm/@vant/weapp/tag/index.js new file mode 100644 index 0000000..ec4069a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tag/index.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.VantComponent)({ + props: { + size: String, + mark: Boolean, + color: String, + plain: Boolean, + round: Boolean, + textColor: String, + type: { + type: String, + value: 'default', + }, + closeable: Boolean, + }, + methods: { + onClose: function () { + this.$emit('close'); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/tag/index.json b/miniprogram_npm/@vant/weapp/tag/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tag/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/tag/index.wxml b/miniprogram_npm/@vant/weapp/tag/index.wxml new file mode 100644 index 0000000..59352dd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tag/index.wxml @@ -0,0 +1,15 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view + class="custom-class {{ utils.bem('tag', [type, size, { mark, plain, round }]) }}" + style="{{ computed.rootStyle({ plain, color, textColor }) }}" +> + <slot /> + <van-icon + wx:if="{{ closeable }}" + name="cross" + custom-class="van-tag__close" + bind:click="onClose" + /> +</view> diff --git a/miniprogram_npm/@vant/weapp/tag/index.wxs b/miniprogram_npm/@vant/weapp/tag/index.wxs new file mode 100644 index 0000000..12d1668 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tag/index.wxs @@ -0,0 +1,13 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + return style({ + 'background-color': data.plain ? '' : data.color, + color: data.textColor || data.plain ? data.textColor || data.color : '', + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/tag/index.wxss b/miniprogram_npm/@vant/weapp/tag/index.wxss new file mode 100644 index 0000000..0f0cbae --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tag/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-tag{align-items:center;border-radius:var(--tag-border-radius,2px);color:var(--tag-text-color,#fff);display:inline-flex;font-size:var(--tag-font-size,12px);line-height:var(--tag-line-height,16px);padding:var(--tag-padding,0 4px);position:relative}.van-tag--default{background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{border:1px solid;border-radius:inherit;bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.van-tag--medium{padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{border-radius:var(--tag-large-border-radius,4px);font-size:var(--tag-large-font-size,14px);padding:var(--tag-large-padding,4px 8px)}.van-tag--mark{border-radius:0 var(--tag-round-border-radius,var(--tag-round-border-radius,999px)) var(--tag-round-border-radius,var(--tag-round-border-radius,999px)) 0}.van-tag--mark:after{content:"";display:block;width:2px}.van-tag--round{border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{margin-left:2px;min-width:1em} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/toast/index.d.ts b/miniprogram_npm/@vant/weapp/toast/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/toast/index.js b/miniprogram_npm/@vant/weapp/toast/index.js new file mode 100644 index 0000000..0c01366 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/index.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.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: function () { }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/toast/index.json b/miniprogram_npm/@vant/weapp/toast/index.json new file mode 100644 index 0000000..9b1b78c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index", + "van-overlay": "../overlay/index", + "van-transition": "../transition/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/toast/index.wxml b/miniprogram_npm/@vant/weapp/toast/index.wxml new file mode 100644 index 0000000..69f143e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/index.wxml @@ -0,0 +1,36 @@ +<van-overlay + wx:if="{{ mask || forbidClick }}" + show="{{ show }}" + z-index="{{ zIndex }}" + custom-style="{{ mask ? '' : 'background-color: transparent;' }}" +/> +<van-transition + show="{{ show }}" + custom-style="z-index: {{ zIndex }}" + custom-class="van-toast__container" +> + <view + class="van-toast van-toast--{{ (type === 'text' || type === 'html') ? 'text' : 'icon' }} van-toast--{{ position }}" + catch:touchmove="noop" + > + <!-- text only --> + <text wx:if="{{ type === 'text' }}">{{ message }}</text> + + <!-- html only --> + <rich-text wx:elif="{{ type === 'html' }}" nodes="{{ message }}"></rich-text> + + <!-- with icon --> + <block wx:else> + <van-loading + wx:if="{{ type === 'loading' }}" + color="white" + type="{{ loadingType }}" + custom-class="van-toast__loading" + /> + <van-icon wx:else class="van-toast__icon" name="{{ type }}" /> + <text wx:if="{{ message }}" class="van-toast__text">{{ message }}</text> + </block> + + <slot /> + </view> +</van-transition> diff --git a/miniprogram_npm/@vant/weapp/toast/index.wxss b/miniprogram_npm/@vant/weapp/toast/index.wxss new file mode 100644 index 0000000..3b7a34e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-toast{word-wrap:break-word;align-items:center;background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:var(--toast-border-radius,8px);box-sizing:initial;color:var(--toast-text-color,#fff);display:flex;flex-direction:column;font-size:var(--toast-font-size,14px);justify-content:center;line-height:var(--toast-line-height,20px);white-space:pre-wrap}.van-toast__container{left:50%;max-width:var(--toast-max-width,70%);position:fixed;top:50%;transform:translate(-50%,-50%);width:-webkit-fit-content;width:fit-content}.van-toast--text{min-width:var(--toast-text-min-width,96px);padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{min-height:var(--toast-default-min-height,88px);padding:var(--toast-default-padding,16px);width:var(--toast-default-width,88px)}.van-toast--icon .van-toast__icon{font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{transform:translateY(-30vh)}.van-toast--bottom{transform:translateY(30vh)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/toast/toast.d.ts b/miniprogram_npm/@vant/weapp/toast/toast.d.ts new file mode 100644 index 0000000..db3f40e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/toast.d.ts @@ -0,0 +1,26 @@ +/// <reference types="miniprogram-api-typings" /> +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 | undefined; +declare namespace Toast { + var loading: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined; + var success: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined; + var fail: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined; + var clear: () => void; + var setDefaultOptions: (options: ToastOptions) => void; + var resetDefaultOptions: () => void; +} +export default Toast; diff --git a/miniprogram_npm/@vant/weapp/toast/toast.js b/miniprogram_npm/@vant/weapp/toast/toast.js new file mode 100644 index 0000000..4fdb2da --- /dev/null +++ b/miniprogram_npm/@vant/weapp/toast/toast.js @@ -0,0 +1,81 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var validator_1 = require("../common/validator"); +var defaultOptions = { + type: 'text', + mask: false, + message: '', + show: true, + zIndex: 1000, + duration: 2000, + position: 'middle', + forbidClick: false, + loadingType: 'circular', + selector: '#van-toast', +}; +var queue = []; +var currentOptions = __assign({}, defaultOptions); +function parseOptions(message) { + return (0, validator_1.isObj)(message) ? message : { message: message }; +} +function getContext() { + var pages = getCurrentPages(); + return pages[pages.length - 1]; +} +function Toast(toastOptions) { + var options = __assign(__assign({}, currentOptions), parseOptions(toastOptions)); + var context = options.context || getContext(); + var toast = context.selectComponent(options.selector); + if (!toast) { + console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确'); + return; + } + delete options.context; + delete options.selector; + toast.clear = function () { + toast.setData({ show: false }); + if (options.onClose) { + options.onClose(); + } + }; + queue.push(toast); + toast.setData(options); + clearTimeout(toast.timer); + if (options.duration != null && options.duration > 0) { + toast.timer = setTimeout(function () { + toast.clear(); + queue = queue.filter(function (item) { return item !== toast; }); + }, options.duration); + } + return toast; +} +var createMethod = function (type) { return function (options) { + return Toast(__assign({ type: type }, parseOptions(options))); +}; }; +Toast.loading = createMethod('loading'); +Toast.success = createMethod('success'); +Toast.fail = createMethod('fail'); +Toast.clear = function () { + queue.forEach(function (toast) { + toast.clear(); + }); + queue = []; +}; +Toast.setDefaultOptions = function (options) { + Object.assign(currentOptions, options); +}; +Toast.resetDefaultOptions = function () { + currentOptions = __assign({}, defaultOptions); +}; +exports.default = Toast; diff --git a/miniprogram_npm/@vant/weapp/transition/index.d.ts b/miniprogram_npm/@vant/weapp/transition/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/transition/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/transition/index.js b/miniprogram_npm/@vant/weapp/transition/index.js new file mode 100644 index 0000000..55fc8b8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/transition/index.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var transition_1 = require("../mixins/transition"); +(0, component_1.VantComponent)({ + classes: [ + 'enter-class', + 'enter-active-class', + 'enter-to-class', + 'leave-class', + 'leave-active-class', + 'leave-to-class', + ], + mixins: [(0, transition_1.transition)(true)], +}); diff --git a/miniprogram_npm/@vant/weapp/transition/index.json b/miniprogram_npm/@vant/weapp/transition/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/transition/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/transition/index.wxml b/miniprogram_npm/@vant/weapp/transition/index.wxml new file mode 100644 index 0000000..2743785 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/transition/index.wxml @@ -0,0 +1,10 @@ +<wxs src="./index.wxs" module="computed" /> + +<view + wx:if="{{ inited }}" + class="van-transition custom-class {{ classes }}" + style="{{ computed.rootStyle({ currentDuration, display, customStyle }) }}" + bind:transitionend="onTransitionEnd" +> + <slot /> +</view> diff --git a/miniprogram_npm/@vant/weapp/transition/index.wxs b/miniprogram_npm/@vant/weapp/transition/index.wxs new file mode 100644 index 0000000..e0babf6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/transition/index.wxs @@ -0,0 +1,17 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + return style([ + { + '-webkit-transition-duration': data.currentDuration + 'ms', + 'transition-duration': data.currentDuration + 'ms', + }, + data.display ? null : 'display: none', + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/transition/index.wxss b/miniprogram_npm/@vant/weapp/transition/index.wxss new file mode 100644 index 0000000..3a3d37f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/transition/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-transition{transition-timing-function:ease}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-fade-down-enter-active,.van-fade-down-leave-active,.van-fade-left-enter-active,.van-fade-left-leave-active,.van-fade-right-enter-active,.van-fade-right-leave-active,.van-fade-up-enter-active,.van-fade-up-leave-active{transition-property:opacity,transform}.van-fade-up-enter,.van-fade-up-leave-to{opacity:0;transform:translate3d(0,100%,0)}.van-fade-down-enter,.van-fade-down-leave-to{opacity:0;transform:translate3d(0,-100%,0)}.van-fade-left-enter,.van-fade-left-leave-to{opacity:0;transform:translate3d(-100%,0,0)}.van-fade-right-enter,.van-fade-right-leave-to{opacity:0;transform:translate3d(100%,0,0)}.van-slide-down-enter-active,.van-slide-down-leave-active,.van-slide-left-enter-active,.van-slide-left-leave-active,.van-slide-right-enter-active,.van-slide-right-leave-active,.van-slide-up-enter-active,.van-slide-up-leave-active{transition-property:transform}.van-slide-up-enter,.van-slide-up-leave-to{transform:translate3d(0,100%,0)}.van-slide-down-enter,.van-slide-down-leave-to{transform:translate3d(0,-100%,0)}.van-slide-left-enter,.van-slide-left-leave-to{transform:translate3d(-100%,0,0)}.van-slide-right-enter,.van-slide-right-leave-to{transform:translate3d(100%,0,0)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.d.ts b/miniprogram_npm/@vant/weapp/tree-select/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tree-select/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.js b/miniprogram_npm/@vant/weapp/tree-select/index.js new file mode 100644 index 0000000..b6f69b2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tree-select/index.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +(0, component_1.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: null, + value: 300, + }, + max: { + type: Number, + value: Infinity, + }, + selectedIcon: { + type: String, + value: 'success', + }, + }, + data: { + subItems: [], + }, + methods: { + // 当一个子项被选择时 + onSelectItem: function (event) { + var item = event.currentTarget.dataset.item; + var isArray = Array.isArray(this.data.activeId); + // 判断有没有超出右侧选择的最大数 + var isOverMax = isArray && this.data.activeId.length >= this.data.max; + // 判断该项有没有被选中, 如果有被选中,则忽视是否超出的条件 + var 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: function (event) { + var index = event.detail; + var item = this.data.items[index]; + if (!item.disabled) { + this.$emit('click-nav', { index: index }); + } + }, + // 更新子项列表 + updateSubItems: function () { + var _a = this.data, items = _a.items, mainActiveIndex = _a.mainActiveIndex; + var _b = (items[mainActiveIndex] || {}).children, children = _b === void 0 ? [] : _b; + this.setData({ subItems: children }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.json b/miniprogram_npm/@vant/weapp/tree-select/index.json new file mode 100644 index 0000000..42991a2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tree-select/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-sidebar": "../sidebar/index", + "van-sidebar-item": "../sidebar-item/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.wxml b/miniprogram_npm/@vant/weapp/tree-select/index.wxml new file mode 100644 index 0000000..2663e52 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tree-select/index.wxml @@ -0,0 +1,41 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="wxs" /> + +<view + class="van-tree-select" + style="height: {{ utils.addUnit(height) }}" +> + <scroll-view scroll-y class="van-tree-select__nav"> + <van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner"> + <van-sidebar-item + wx:for="{{ items }}" + wx:key="index" + custom-class="main-item-class" + active-class="main-active-class" + disabled-class="main-disabled-class" + badge="{{ item.badge }}" + dot="{{ item.dot }}" + title="{{ item.text }}" + disabled="{{ item.disabled }}" + /> + </van-sidebar> + </scroll-view> + <scroll-view scroll-y class="van-tree-select__content"> + <slot name="content" /> + <view + wx:for="{{ subItems }}" + wx:key="id" + class="van-ellipsis content-item-class {{ utils.bem('tree-select__item', { active: wxs.isActive(activeId, item.id), disabled: item.disabled }) }} {{ wxs.isActive(activeId, item.id) ? 'content-active-class' : '' }} {{ item.disabled ? 'content-disabled-class' : '' }}" + data-item="{{ item }}" + bind:tap="onSelectItem" + > + {{ item.text }} + <van-icon + wx:if="{{ wxs.isActive(activeId, item.id) }}" + name="{{ selectedIcon }}" + size="16px" + class="van-tree-select__selected" + /> + </view> + </scroll-view> +</view> diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.wxs b/miniprogram_npm/@vant/weapp/tree-select/index.wxs new file mode 100644 index 0000000..b1cbb39 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tree-select/index.wxs @@ -0,0 +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; diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.wxss b/miniprogram_npm/@vant/weapp/tree-select/index.wxss new file mode 100644 index 0000000..5bef0ac --- /dev/null +++ b/miniprogram_npm/@vant/weapp/tree-select/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-tree-select{display:flex;font-size:var(--tree-select-font-size,14px);position:relative;-webkit-user-select:none;user-select:none}.van-tree-select__nav{--sidebar-padding:12px 8px 12px 12px;background-color:var(--tree-select-nav-background-color,#f7f8fa);flex:1}.van-tree-select__nav__inner{height:100%;width:100%!important}.van-tree-select__content{background-color:var(--tree-select-content-background-color,#fff);flex:2}.van-tree-select__item{font-weight:700;line-height:var(--tree-select-item-height,44px);padding:0 32px 0 var(--padding-md,16px);position:relative}.van-tree-select__item--active{color:var(--tree-select-item-active-color,#ee0a24)}.van-tree-select__item--disabled{color:var(--tree-select-item-disabled-color,#c8c9cc)}.van-tree-select__selected{position:absolute;right:var(--padding-md,16px);top:50%;transform:translateY(-50%)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/uploader/index.d.ts b/miniprogram_npm/@vant/weapp/uploader/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/miniprogram_npm/@vant/weapp/uploader/index.js b/miniprogram_npm/@vant/weapp/uploader/index.js new file mode 100644 index 0000000..3f1895f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/index.js @@ -0,0 +1,170 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var component_1 = require("../common/component"); +var utils_1 = require("./utils"); +var shared_1 = require("./shared"); +var validator_1 = require("../common/validator"); +(0, component_1.VantComponent)({ + props: __assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: { + type: null, + value: 80, + }, name: { + type: null, + 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, + }, showUpload: { + type: Boolean, + value: true, + }, previewImage: { + type: Boolean, + value: true, + }, previewFullImage: { + type: Boolean, + value: true, + }, imageFit: { + type: String, + value: 'scaleToFill', + }, uploadIcon: { + type: String, + value: 'photograph', + } }, shared_1.chooseImageProps), shared_1.chooseVideoProps), + data: { + lists: [], + isInCount: true, + }, + methods: { + formatFileList: function () { + var _a = this.data, _b = _a.fileList, fileList = _b === void 0 ? [] : _b, maxCount = _a.maxCount; + var lists = fileList.map(function (item) { return (__assign(__assign({}, item), { isImage: (0, utils_1.isImageFile)(item), isVideo: (0, utils_1.isVideoFile)(item), deletable: (0, validator_1.isBoolean)(item.deletable) ? item.deletable : true })); }); + this.setData({ lists: lists, isInCount: lists.length < maxCount }); + }, + getDetail: function (index) { + return { + name: this.data.name, + index: index == null ? this.data.fileList.length : index, + }; + }, + startUpload: function () { + var _this = this; + var _a = this.data, maxCount = _a.maxCount, multiple = _a.multiple, lists = _a.lists, disabled = _a.disabled; + if (disabled) + return; + (0, utils_1.chooseFile)(__assign(__assign({}, this.data), { maxCount: maxCount - lists.length })) + .then(function (res) { + _this.onBeforeRead(multiple ? res : res[0]); + }) + .catch(function (error) { + _this.$emit('error', error); + }); + }, + onBeforeRead: function (file) { + var _this = this; + var _a = this.data, beforeRead = _a.beforeRead, useBeforeRead = _a.useBeforeRead; + var res = true; + if (typeof beforeRead === 'function') { + res = beforeRead(file, this.getDetail()); + } + if (useBeforeRead) { + res = new Promise(function (resolve, reject) { + _this.$emit('before-read', __assign(__assign({ file: file }, _this.getDetail()), { callback: function (ok) { + ok ? resolve() : reject(); + } })); + }); + } + if (!res) { + return; + } + if ((0, validator_1.isPromise)(res)) { + res.then(function (data) { return _this.onAfterRead(data || file); }); + } + else { + this.onAfterRead(file); + } + }, + onAfterRead: function (file) { + var _a = this.data, maxSize = _a.maxSize, afterRead = _a.afterRead; + var oversize = Array.isArray(file) + ? file.some(function (item) { return item.size > maxSize; }) + : file.size > maxSize; + if (oversize) { + this.$emit('oversize', __assign({ file: file }, this.getDetail())); + return; + } + if (typeof afterRead === 'function') { + afterRead(file, this.getDetail()); + } + this.$emit('after-read', __assign({ file: file }, this.getDetail())); + }, + deleteItem: function (event) { + var index = event.currentTarget.dataset.index; + this.$emit('delete', __assign(__assign({}, this.getDetail(index)), { file: this.data.fileList[index] })); + }, + onPreviewImage: function (event) { + if (!this.data.previewFullImage) + return; + var index = event.currentTarget.dataset.index; + var lists = this.data.lists; + var item = lists[index]; + wx.previewImage({ + urls: lists.filter(function (item) { return (0, utils_1.isImageFile)(item); }).map(function (item) { return item.url; }), + current: item.url, + fail: function () { + wx.showToast({ title: '预览图片失败', icon: 'none' }); + }, + }); + }, + onPreviewVideo: function (event) { + if (!this.data.previewFullImage) + return; + var index = event.currentTarget.dataset.index; + var lists = this.data.lists; + wx.previewMedia({ + sources: lists + .filter(function (item) { return (0, utils_1.isVideoFile)(item); }) + .map(function (item) { return (__assign(__assign({}, item), { type: 'video' })); }), + current: index, + fail: function () { + wx.showToast({ title: '预览视频失败', icon: 'none' }); + }, + }); + }, + onPreviewFile: function (event) { + var index = event.currentTarget.dataset.index; + wx.openDocument({ + filePath: this.data.lists[index].url, + showMenu: true, + }); + }, + onClickPreview: function (event) { + var index = event.currentTarget.dataset.index; + var item = this.data.lists[index]; + this.$emit('click-preview', __assign(__assign({}, item), this.getDetail(index))); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/uploader/index.json b/miniprogram_npm/@vant/weapp/uploader/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/uploader/index.wxml b/miniprogram_npm/@vant/weapp/uploader/index.wxml new file mode 100644 index 0000000..50fb0c8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/index.wxml @@ -0,0 +1,83 @@ +<wxs src="../wxs/utils.wxs" module="utils" /> +<wxs src="./index.wxs" module="computed" /> + +<view class="van-uploader"> + <view class="van-uploader__wrapper"> + <!-- 预览样式 --> + <view + wx:if="{{ previewImage }}" + wx:for="{{ lists }}" + wx:key="index" + class="van-uploader__preview" + data-index="{{ index }}" + bindtap="onClickPreview" + > + <image + wx:if="{{ item.isImage }}" + mode="{{ imageFit }}" + src="{{ item.thumb || item.url }}" + alt="{{ item.name || ('图片' + index) }}" + class="van-uploader__preview-image" + style="{{ computed.sizeStyle({ previewSize }) }}" + data-index="{{ index }}" + bindtap="onPreviewImage" + /> + <video + wx:elif="{{ item.isVideo }}" + src="{{ item.url }}" + title="{{ item.name || ('视频' + index) }}" + poster="{{ item.thumb }}" + autoplay="{{ item.autoplay }}" + class="van-uploader__preview-image" + style="{{ computed.sizeStyle({ previewSize }) }}" + data-index="{{ index }}" + bindtap="onPreviewVideo" + > + </video> + <view + wx:else + class="van-uploader__file" + style="{{ computed.sizeStyle({ previewSize }) }}" + data-index="{{ index }}" + bindtap="onPreviewFile" + > + <van-icon name="description" class="van-uploader__file-icon" /> + <view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url }}</view> + </view> + <view + wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}" + class="van-uploader__mask" + > + <van-icon wx:if="{{ item.status === 'failed' }}" name="close" class="van-uploader__mask-icon" /> + <van-loading wx:else custom-class="van-uploader__loading" /> + <text wx:if="{{ item.message }}" class="van-uploader__mask-message">{{ item.message }}</text> + </view> + <view + wx:if="{{ deletable && item.deletable }}" + data-index="{{ index }}" + class="van-uploader__preview-delete" + catch:tap="deleteItem" + > + <van-icon name="cross" class="van-uploader__preview-delete-icon" /> + </view> + </view> + + <!-- 上传样式 --> + <block wx:if="{{ isInCount }}"> + <view class="van-uploader__slot" bindtap="startUpload"> + <slot /> + </view> + + <!-- 默认上传样式 --> + <view + wx:if="{{ showUpload }}" + class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}" + style="{{ computed.sizeStyle({ previewSize }) }}" + bindtap="startUpload" + > + <van-icon name="{{ uploadIcon }}" class="van-uploader__upload-icon" /> + <text wx:if="{{ uploadText }}" class="van-uploader__upload-text">{{ uploadText }}</text> + </view> + </block> + </view> +</view> diff --git a/miniprogram_npm/@vant/weapp/uploader/index.wxs b/miniprogram_npm/@vant/weapp/uploader/index.wxs new file mode 100644 index 0000000..257c780 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/index.wxs @@ -0,0 +1,14 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function sizeStyle(data) { + return style({ + width: addUnit(data.previewSize), + height: addUnit(data.previewSize), + }); +} + +module.exports = { + sizeStyle: sizeStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/uploader/index.wxss b/miniprogram_npm/@vant/weapp/uploader/index.wxss new file mode 100644 index 0000000..11f8696 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-uploader{display:inline-block;position:relative}.van-uploader__wrapper{display:flex;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{align-items:center;background-color:var(--uploader-upload-background-color,#f7f8fa);box-sizing:border-box;display:flex;flex-direction:column;height:var(--uploader-size,80px);justify-content:center;margin:0 8px 8px 0;position:relative;width:var(--uploader-size,80px)}.van-uploader__upload:active{background-color:var(--uploader-upload-active-color,#f2f3f5)}.van-uploader__upload-icon{color:var(--uploader-icon-color,#dcdee0);font-size:var(--uploader-icon-size,24px)}.van-uploader__upload-text{color:var(--uploader-text-color,#969799);font-size:var(--uploader-text-font-size,12px);margin-top:var(--padding-xs,8px)}.van-uploader__upload--disabled{opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{cursor:pointer;margin:0 8px 8px 0;position:relative}.van-uploader__preview-image{display:block;height:var(--uploader-size,80px);overflow:hidden;width:var(--uploader-size,80px)}.van-uploader__preview-delete,.van-uploader__preview-delete:after{height:var(--uploader-delete-icon-size,14px);position:absolute;right:0;top:0;width:var(--uploader-delete-icon-size,14px)}.van-uploader__preview-delete:after{background-color:var(--uploader-delete-background-color,rgba(0,0,0,.7));border-radius:0 0 0 12px;content:""}.van-uploader__preview-delete-icon{color:var(--uploader-delete-color,#fff);font-size:var(--uploader-delete-icon-size,14px);position:absolute;right:0;top:0;transform:scale(.7) translate(10%,-10%);z-index:1}.van-uploader__file{align-items:center;background-color:var(--uploader-file-background-color,#f7f8fa);display:flex;flex-direction:column;height:var(--uploader-size,80px);justify-content:center;width:var(--uploader-size,80px)}.van-uploader__file-icon{color:var(--uploader-file-icon-color,#646566);font-size:var(--uploader-file-icon-size,20px)}.van-uploader__file-name{box-sizing:border-box;color:var(--uploader-file-name-text-color,#646566);font-size:var(--uploader-file-name-font-size,12px);margin-top:var(--uploader-file-name-margin-top,8px);padding:var(--uploader-file-name-padding,0 4px);text-align:center;width:100%}.van-uploader__mask{align-items:center;background-color:var(--uploader-mask-background-color,rgba(50,50,51,.88));bottom:0;color:#fff;display:flex;flex-direction:column;justify-content:center;left:0;position:absolute;right:0;top:0}.van-uploader__mask-icon{font-size:var(--uploader-mask-icon-size,22px)}.van-uploader__mask-message{font-size:var(--uploader-mask-message-font-size,12px);line-height:var(--uploader-mask-message-line-height,14px);margin-top:6px;padding:0 var(--padding-base,4px)}.van-uploader__loading{color:var(--uploader-loading-icon-color,#fff)!important;height:var(--uploader-loading-icon-size,22px);width:var(--uploader-loading-icon-size,22px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/uploader/shared.d.ts b/miniprogram_npm/@vant/weapp/uploader/shared.d.ts new file mode 100644 index 0000000..85d5034 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/shared.d.ts @@ -0,0 +1,28 @@ +export declare const chooseImageProps: { + sizeType: { + type: ArrayConstructor; + value: string[]; + }; + capture: { + type: ArrayConstructor; + value: string[]; + }; +}; +export declare const chooseVideoProps: { + capture: { + type: ArrayConstructor; + value: string[]; + }; + compressed: { + type: BooleanConstructor; + value: boolean; + }; + maxDuration: { + type: NumberConstructor; + value: number; + }; + camera: { + type: StringConstructor; + value: string; + }; +}; diff --git a/miniprogram_npm/@vant/weapp/uploader/shared.js b/miniprogram_npm/@vant/weapp/uploader/shared.js new file mode 100644 index 0000000..c5df55e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/shared.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.chooseVideoProps = exports.chooseImageProps = void 0; +// props for choose image +exports.chooseImageProps = { + sizeType: { + type: Array, + value: ['original', 'compressed'], + }, + capture: { + type: Array, + value: ['album', 'camera'], + }, +}; +// props for choose video +exports.chooseVideoProps = { + capture: { + type: Array, + value: ['album', 'camera'], + }, + compressed: { + type: Boolean, + value: true, + }, + maxDuration: { + type: Number, + value: 60, + }, + camera: { + type: String, + value: 'back', + }, +}; diff --git a/miniprogram_npm/@vant/weapp/uploader/utils.d.ts b/miniprogram_npm/@vant/weapp/uploader/utils.d.ts new file mode 100644 index 0000000..d5c9ab7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/utils.d.ts @@ -0,0 +1,22 @@ +export interface File { + url: string; + size?: number; + name?: string; + type: string; + duration?: number; + time?: number; + isImage?: boolean; + isVideo?: boolean; +} +export declare function isImageFile(item: File): boolean; +export declare function isVideoFile(item: File): boolean; +export declare function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, }: { + accept: any; + multiple: any; + capture: any; + compressed: any; + maxDuration: any; + sizeType: any; + camera: any; + maxCount: any; +}): Promise<File | File[]>; diff --git a/miniprogram_npm/@vant/weapp/uploader/utils.js b/miniprogram_npm/@vant/weapp/uploader/utils.js new file mode 100644 index 0000000..96291b0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/uploader/utils.js @@ -0,0 +1,102 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.chooseFile = exports.isVideoFile = exports.isImageFile = void 0; +var utils_1 = require("../common/utils"); +var validator_1 = require("../common/validator"); +function isImageFile(item) { + if (item.isImage != null) { + return item.isImage; + } + if (item.type) { + return item.type === 'image'; + } + if (item.url) { + return (0, validator_1.isImageUrl)(item.url); + } + return false; +} +exports.isImageFile = isImageFile; +function isVideoFile(item) { + if (item.isVideo != null) { + return item.isVideo; + } + if (item.type) { + return item.type === 'video'; + } + if (item.url) { + return (0, validator_1.isVideoUrl)(item.url); + } + return false; +} +exports.isVideoFile = isVideoFile; +function formatImage(res) { + return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { type: 'image', url: item.path, thumb: item.path })); }); +} +function formatVideo(res) { + return [ + __assign(__assign({}, (0, utils_1.pickExclude)(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])), { type: 'video', url: res.tempFilePath, thumb: res.thumbTempFilePath }), + ]; +} +function formatMedia(res) { + return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: res.type, url: item.tempFilePath, thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath })); }); +} +function formatFile(res) { + return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); }); +} +function chooseFile(_a) { + var accept = _a.accept, multiple = _a.multiple, capture = _a.capture, compressed = _a.compressed, maxDuration = _a.maxDuration, sizeType = _a.sizeType, camera = _a.camera, maxCount = _a.maxCount; + return new Promise(function (resolve, reject) { + switch (accept) { + case 'image': + wx.chooseImage({ + count: multiple ? Math.min(maxCount, 9) : 1, + sourceType: capture, + sizeType: sizeType, + success: function (res) { return resolve(formatImage(res)); }, + fail: reject, + }); + break; + case 'media': + wx.chooseMedia({ + count: multiple ? Math.min(maxCount, 9) : 1, + sourceType: capture, + maxDuration: maxDuration, + sizeType: sizeType, + camera: camera, + success: function (res) { return resolve(formatMedia(res)); }, + fail: reject, + }); + break; + case 'video': + wx.chooseVideo({ + sourceType: capture, + compressed: compressed, + maxDuration: maxDuration, + camera: camera, + success: function (res) { return resolve(formatVideo(res)); }, + fail: reject, + }); + break; + default: + wx.chooseMessageFile({ + count: multiple ? maxCount : 1, + type: accept, + success: function (res) { return resolve(formatFile(res)); }, + fail: reject, + }); + break; + } + }); +} +exports.chooseFile = chooseFile; diff --git a/miniprogram_npm/@vant/weapp/wxs/add-unit.wxs b/miniprogram_npm/@vant/weapp/wxs/add-unit.wxs new file mode 100644 index 0000000..4f33462 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/add-unit.wxs @@ -0,0 +1,12 @@ +/* eslint-disable */ +var REGEXP = getRegExp('^-?\d+(\.\d+)?$'); + +function addUnit(value) { + if (value == null) { + return undefined; + } + + return REGEXP.test('' + value) ? value + 'px' : value; +} + +module.exports = addUnit; diff --git a/miniprogram_npm/@vant/weapp/wxs/array.wxs b/miniprogram_npm/@vant/weapp/wxs/array.wxs new file mode 100644 index 0000000..610089c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/array.wxs @@ -0,0 +1,5 @@ +function isArray(array) { + return array && array.constructor === 'Array'; +} + +module.exports.isArray = isArray; diff --git a/miniprogram_npm/@vant/weapp/wxs/bem.wxs b/miniprogram_npm/@vant/weapp/wxs/bem.wxs new file mode 100644 index 0000000..1efa129 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/bem.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +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; diff --git a/miniprogram_npm/@vant/weapp/wxs/memoize.wxs b/miniprogram_npm/@vant/weapp/wxs/memoize.wxs new file mode 100644 index 0000000..8f7f46d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/memoize.wxs @@ -0,0 +1,55 @@ +/** + * Simple memoize + * wxs doesn't support fn.apply, so this memoize only support up to 2 args + */ +/* eslint-disable */ + +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; diff --git a/miniprogram_npm/@vant/weapp/wxs/object.wxs b/miniprogram_npm/@vant/weapp/wxs/object.wxs new file mode 100644 index 0000000..e077107 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/object.wxs @@ -0,0 +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; diff --git a/miniprogram_npm/@vant/weapp/wxs/style.wxs b/miniprogram_npm/@vant/weapp/wxs/style.wxs new file mode 100644 index 0000000..d88ca7c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/style.wxs @@ -0,0 +1,42 @@ +/* eslint-disable */ +var object = require('./object.wxs'); +var array = require('./array.wxs'); + +function kebabCase(word) { + var newWord = word + .replace(getRegExp("[A-Z]", 'g'), function (i) { + return '-' + i; + }) + .toLowerCase() + + return newWord; +} + +function style(styles) { + if (array.isArray(styles)) { + return styles + .filter(function (item) { + return item != null && item !== ''; + }) + .map(function (item) { + return style(item); + }) + .join(';'); + } + + if ('Object' === styles.constructor) { + return object + .keys(styles) + .filter(function (key) { + return styles[key] != null && styles[key] !== ''; + }) + .map(function (key) { + return [kebabCase(key), [styles[key]]].join(':'); + }) + .join(';'); + } + + return styles; +} + +module.exports = style; diff --git a/miniprogram_npm/@vant/weapp/wxs/utils.wxs b/miniprogram_npm/@vant/weapp/wxs/utils.wxs new file mode 100644 index 0000000..f66d33a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/wxs/utils.wxs @@ -0,0 +1,10 @@ +/* eslint-disable */ +var bem = require('./bem.wxs'); +var memoize = require('./memoize.wxs'); +var addUnit = require('./add-unit.wxs'); + +module.exports = { + bem: memoize(bem), + memoize: memoize, + addUnit: addUnit +}; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..48e341a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +} diff --git a/pages/AIAide/index.js b/pages/AIAide/index.js new file mode 100644 index 0000000..e4ed3d3 --- /dev/null +++ b/pages/AIAide/index.js @@ -0,0 +1,214 @@ +// pages/AIAide/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +function getawApi(submitData) { + return $$.request({ + url: 'case-law/get-law', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} +// 获取案例 +function getCaseApi(submitData) { + return $$.request({ + url: 'case-law/get-case', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} + +// 提交评价 +function submitEvaluationApi(submitData) { + return $$.request({ + url: '/api/wechat/caseAdviceEvaluate/save', + type: 'post', + submitData, + service: 'mediate', + }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + AIData: [], //法条 + caseData: [], //案例 + showEvaluation: false, // 是否显示评价弹窗 + evaluation: { + similarity: 0, + helpfulness: 0, + satisfaction: 0, + inspiration: 0, + comments: '' + } + }, + + async getaw(data) { + let newData = { + caseDes: data.caseDes, + caseClaim: data.caseClaim, + caseId: data.caseId, + } + $$.showLoading(); + const res = await getawApi(newData); + $$.hideLoading(); + if (res.type) { + let nowData = res.data || [] + this.setData({ + AIData: nowData.map(i => ({ + ...i, + show: false + })) + }) + } + }, + + // 案例 + async getCase(data) { + let newData = { + caseDes: data.caseDes, + caseClaim: data.caseClaim, + caseId: data.caseId, + } + $$.showLoading(); + const res = await getCaseApi(newData); + $$.hideLoading(); + if (res.type) { + this.setData({ + caseData: res.data || [] + }) + } + }, + + // 打开折叠法条 + lawClick(e) { + let item = e.currentTarget.dataset.item; + let index = e.currentTarget.dataset.index; + this.setData({ + AIData: this.data.AIData.map((i, idx) => ({ + ...i, + show: idx === index ? i.show ? false : true : false, + })) + }) + }, + + // 跳转案例详情 + caseClick(e) { + let url = e.currentTarget.dataset.url; + let caseId = e.currentTarget.dataset.caseid; + let caseType = e.currentTarget.dataset.casetype; + let caseName = e.currentTarget.dataset.casename; + + wx.navigateTo({ + url: url + '?caseId=' + caseId + '&type=' + caseType + '&caseName=' + caseName, + }); + }, + + // 显示评价弹窗 + showEvaluationPopup() { + this.setData({ + showEvaluation: true, + evaluation: { + similarity: 0, + helpfulness: 0, + satisfaction: 0, + inspiration: 0, + comments: '' + } + }); + }, + + // 关闭评价弹窗 + closeEvaluationPopup() { + this.setData({ + showEvaluation: false + }); + }, + + // 设置评分 + setRating(e) { + const type = e.currentTarget.dataset.type; + const value = e.currentTarget.dataset.value; + + this.setData({ + [`evaluation.${type}`]: value + }); + }, + + // 设置评价意见 + setComments(e) { + this.setData({ + 'evaluation.comments': e.detail.value + }); + }, + + // 提交评价 + async submitEvaluation() { + const { similarity, helpfulness, satisfaction, inspiration } = this.data.evaluation; + + // 验证评分是否都已填写 + if (!similarity || !helpfulness || !satisfaction || !inspiration) { + $$.showToast('请完成所有评分项'); + return; + } + + // 准备提交数据 + const submitData = { + ...this.data.evaluation, + caseId: this.caseId || '', + createBy: app.globalData.userInfo?.id || '', + createTime: new Date() + }; + + $$.showLoading('提交中...'); + try { + const res = await submitEvaluationApi(submitData); + $$.hideLoading(); + + if (res.type) { + // 先关闭评价弹窗 + $$.showToast('评价提交成功'); + this.closeEvaluationPopup(); + + } else { + $$.showToast(res.message || '提交失败,请重试'); + } + } catch (error) { + $$.hideLoading(); + $$.showToast('提交失败,请重试'); + console.error('评价提交错误:', error); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log('options', options); + let { + caseDes, + caseClaim, + caseId, + } = options; + + this.caseId = caseId; + + this.getaw({ + caseDes, + caseClaim, + caseId, + }) + this.getCase({ + caseDes, + caseClaim, + caseId, + }) + }, +}) \ No newline at end of file diff --git a/pages/AIAide/index.json b/pages/AIAide/index.json new file mode 100644 index 0000000..5efc99c --- /dev/null +++ b/pages/AIAide/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "解纷数智人", + "usingComponents": { + "van-popup": "@vant/weapp/popup/index" + } +} \ No newline at end of file diff --git a/pages/AIAide/index.wxml b/pages/AIAide/index.wxml new file mode 100644 index 0000000..54a23ae --- /dev/null +++ b/pages/AIAide/index.wxml @@ -0,0 +1,114 @@ +<!--pages/AIAide/index.wxml--> + +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<view class="card"> + <view class="card_main"> + <block wx:if="{{caseData.length>0}}"> + <view class="caseList_head"> + <van-icon size="22" name="/img/AIAide_1.png" />为您推荐与申请相似的典型案例({{caseData.length}}) + </view> + <view class="caseList" bindtap="caseClick" data-caseId="{{item.caseId}}" data-caseName="{{item.caseName}}" data-caseType="{{item.caseType}}" data-url="../../pages/AIAideDetail/index" wx:for="{{caseData}}" wx:key="index"> + <view class="caseList_flex"> + <text class="ellipsis">{{item.caseName}}</text> + <view class="cell-arrow"> + <van-icon color="#1A6FB8" size="14" name="arrow" /> + </view> + </view> + <!-- <view class="caseList_title">相似度:{{'-'}}% | 发生地:广东省 广州市</view> --> + </view> + </block> + <block wx:if="{{AIData.length>0}}"> + <view class="line"></view> + <view class="caseList_head"> + <van-icon size="22" name="/img/AIAide_2.png" />为您推荐与申请相关的专业法条({{AIData.length}}) + </view> + <view class="caseList" wx:for="{{AIData}}" wx:key="index"> + <view bindtap="lawClick" data-item="{{item}}" data-index="{{index}}" class="caseList_flex"> + <text class="ellipsis">《{{item.lawTitle}}》{{item.lawIndex}}</text> + <view wx:if="{{item.show}}" class="cell-arrow"> + <van-icon color="#1A6FB8" size="14" name="arrow-down" /> + </view> + <view wx:else class="cell-arrow"> + <van-icon color="#1A6FB8" size="14" name="arrow-up" /> + </view> + </view> + <view wx:if="{{item.show}}" class="show-line"> + + </view> + <view wx:if="{{item.show}}" class="show-Law"> + {{item.lawDesc}} + </view> + </view> + <view class="assess"> + <van-icon size="18" name="/img/AIAide_4.png" bindtap="showEvaluationPopup" /> + </view> + </block> + <view wx:if="{{caseData.length}}" class="flex_end">以上内容均由人工智能模型生成,其生成内容的准确性和完整性无法保证,不代表我们的态度或观点</view> + </view> +</view> + +<!-- 评价弹窗 --> +<van-popup show="{{ showEvaluation }}" round position="center" custom-style="width: 90%; max-height: 85vh; padding: 20px;" bind:close="closeEvaluationPopup"> + <view class="evaluation-popup"> + <view class="evaluation-title">评价反馈</view> + + <view class="evaluation-item"> + <view class="item-title">1、推荐内容与您选到的情况相似程度如何</view> + <view class="stars"> + <van-icon wx:for="{{ 5 }}" wx:key="index" name="{{ evaluation.similarity > index ? 'star' : 'star-o' }}" + size="20" color="{{ evaluation.similarity > index ? '#FFCC00' : '#CCCCCC' }}" + data-type="similarity" data-value="{{ index + 1 }}" bindtap="setRating" /> + </view> + </view> + + <view class="evaluation-item"> + <view class="item-title">2、推荐内容给您带来的帮助程度如何</view> + <view class="stars"> + <van-icon wx:for="{{ 5 }}" wx:key="index" name="{{ evaluation.helpfulness > index ? 'star' : 'star-o' }}" + size="20" color="{{ evaluation.helpfulness > index ? '#FFCC00' : '#CCCCCC' }}" + data-type="helpfulness" data-value="{{ index + 1 }}" bindtap="setRating" /> + </view> + </view> + + <view class="evaluation-item"> + <view class="item-title">3、您对推荐内容的整体满意度如何</view> + <view class="stars"> + <van-icon wx:for="{{ 5 }}" wx:key="index" name="{{ evaluation.satisfaction > index ? 'star' : 'star-o' }}" + size="20" color="{{ evaluation.satisfaction > index ? '#FFCC00' : '#CCCCCC' }}" + data-type="satisfaction" data-value="{{ index + 1 }}" bindtap="setRating" /> + </view> + </view> + + <view class="evaluation-item"> + <view class="item-title">4、推荐案例给您带来的启发程度如何</view> + <view class="stars"> + <van-icon wx:for="{{ 5 }}" wx:key="index" name="{{ evaluation.inspiration > index ? 'star' : 'star-o' }}" + size="20" color="{{ evaluation.inspiration > index ? '#FFCC00' : '#CCCCCC' }}" + data-type="inspiration" data-value="{{ index + 1 }}" bindtap="setRating" /> + </view> + </view> + + <view class="evaluation-item"> + <view class="item-title">5、改进意见</view> + <view class="comments-area"> + <textarea placeholder="您认为推荐系统可以怎样改进来帮您获得您希望获得的更多信息" bindinput="setComments" value="{{ evaluation.comments }}"></textarea> + </view> + </view> + + <button class="submit-btn" bindtap="submitEvaluation">提交评价</button> + </view> +</van-popup> + +<!-- 关闭按钮 --> +<view class="close-btn" wx:if="{{showEvaluation}}" bindtap="closeEvaluationPopup"> + <image src="/img/close.png" mode="aspectFit" /> +</view> + +<!-- 感谢评价提示 --> +<view class="custom-toast {{showThankToast ? 'show-toast' : ''}}" wx:if="{{showThankToast}}"> + <view class="toast-content"> + <icon type="success" size="24" color="#FFFFFF"/> + <text>感谢评价</text> + </view> +</view> \ No newline at end of file diff --git a/pages/AIAide/index.wxss b/pages/AIAide/index.wxss new file mode 100644 index 0000000..484bdaa --- /dev/null +++ b/pages/AIAide/index.wxss @@ -0,0 +1,191 @@ +/* pages/AIAide/index.wxss */ + +.card { + padding: 24rpx; + height: 100%; + background-color: #fff; + position: relative; +} + +.card_main { + background-color: #F6F7FB; + border-radius: 8px; +} + +.flex_end { + /* position: fixed; + bottom: 40rpx; */ + color: rgba(23, 26, 29, 0.24); + font-size: 28rpx; + /* padding: 0 52rpx; */ + text-align: center; + padding: 24rpx 0; +} + +.caseList { + border-radius: 4px; + background-color: #fff; + padding: 24rpx; + margin: 0 24rpx 16rpx 24rpx; +} + +.caseList_flex { + display: flex; + justify-content: space-between; + margin-bottom: 8rpx; +} + +.cell-arrow { + width: 16px; + height: 16px; + background: #f6f7fb; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + padding: 6rpx; +} + +.caseList_title { + color: rgba(23, 26, 29, 0.60); + font-size: 24rpx; + line-height: 40rpx; +} + +.caseList_head { + display: flex; + gap: 8rpx; + padding: 24rpx 24rpx; + margin-top: 24rpx; +} + +.line { + border: 1px dashed #e5e6eb; + margin: 32rpx 24rpx 0; +} + +.assess { + display: flex; + gap: 32rpx; + justify-content: flex-end; + padding: 12rpx 24rpx 32rpx; +} + +.ellipsis { + overflow: hidden; + /* 确保超出容器的文本会被裁剪 */ + white-space: nowrap; + /* 保证文本在一行内显示 */ + text-overflow: ellipsis; + /* 使用省略号表示文本超出 */ +} + +.show-line { + margin: 24rpx 0; + border-top: 1px solid #F0F0F0; +} + +.show-Law { + color: var(--main-color); +} + +/* 评价弹窗样式 */ +.evaluation-popup { + position: relative; + width: 100%; +} + +.evaluation-title { + text-align: center; + font-weight: bold; + font-size: 18px; + margin-bottom: 20px; +} + +.evaluation-item { + margin-bottom: 15px; +} + +.item-title { + margin-bottom: 8px; + font-size: 14px; +} + +.stars { + display: flex; + justify-content: flex-start; + gap: 8px; +} + +.comments-area { + width: 100%; + background-color: #F5F5F5; + border-radius: 4px; + padding: 10px; +} + +.comments-area textarea { + width: 100%; + height: 80px; + font-size: 14px; + line-height: 1.5; +} + +.submit-btn { + width: 100%; + background-color: #1A6FB8; + color: white; + border-radius: 4px; + margin-top: 20px; + font-size: 16px; + height: 44px; + line-height: 44px; +} + +.close-btn { + position: fixed; + bottom: 8vh; + left: 50%; + transform: translateX(-50%); + z-index: 9999; +} + +.close-btn image { + width: 30px; + height: 30px; +} + +/* 禁止弹窗滚动 */ +.van-popup { + overflow: hidden !important; +} + +/* 自定义toast样式 */ +.custom-toast { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: rgba(51, 51, 51, 0.9); + border-radius: 8px; + padding: 16px 24px; + z-index: 10000; + opacity: 0; + transition: opacity 0.3s ease; +} + +.show-toast { + opacity: 1; +} + +.toast-content { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} + +.toast-content text { + color: #FFFFFF; + font-size: 16px; +} \ No newline at end of file diff --git a/pages/AIAideDetail/index.js b/pages/AIAideDetail/index.js new file mode 100644 index 0000000..4681911 --- /dev/null +++ b/pages/AIAideDetail/index.js @@ -0,0 +1,97 @@ +// pages/AIAideDetail/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +function getCaseDetail(submitData) { + return $$.request({ + url: 'case-law/get-case-detail', + type: 'get', + ai: true, + submitData, + service: 'mediate', + }); +} + +Page({ + + /** + * 页面的初始数据 + */ + data: { + data: {}, + lastData: {} + }, + + async getaw(data) { + $$.showLoading(); + const res = await getCaseDetail(data); + $$.hideLoading(); + if (res.type) { + this.setData({ + data: res.data || {} + }) + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let nowData = { + ...options + } + this.setData({ + lastData: nowData + }) + this.getaw(nowData) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/AIAideDetail/index.json b/pages/AIAideDetail/index.json new file mode 100644 index 0000000..10a2bec --- /dev/null +++ b/pages/AIAideDetail/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "典型案例", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/AIAideDetail/index.wxml b/pages/AIAideDetail/index.wxml new file mode 100644 index 0000000..f4cb18c --- /dev/null +++ b/pages/AIAideDetail/index.wxml @@ -0,0 +1,32 @@ +<!--pages/AIAideDetail/index.wxml--> +<view class="title">{{lastData.caseName||'-'}}</view> +<view class="line"></view> +<view class="card" wx:if="{{lastData.type==='1'}}"> + <view class="subtitle">【案件描述】</view> + <view class="text"> + {{data.caseDesc||'-'}} + </view> + <view class="subtitle">【群众诉求】</view> + <view class="text"> + {{data.caseClaim||'-'}} + </view> + <view class="subtitle">【和解协议】</view> + <view class="text"> + {{data.agreeContent||'-'}} + </view> +</view> + +<view class="card" wx:if="{{lastData.type==='2'}}"> + <view class="subtitle">【案件描述】</view> + <view class="text"> + {{data.caseDesc||'-'}} + </view> + <view class="subtitle">【判决结果】</view> + <view class="text"> + {{data.agreeContent||'-'}} + </view> + <view class="subtitle">【立案依据】</view> + <view class="text"> + {{data.legalBasis||'-'}} + </view> +</view> \ No newline at end of file diff --git a/pages/AIAideDetail/index.wxss b/pages/AIAideDetail/index.wxss new file mode 100644 index 0000000..8c90eaa --- /dev/null +++ b/pages/AIAideDetail/index.wxss @@ -0,0 +1,25 @@ +/* pages/AIAideDetail/index.wxss */ +.card { + padding: 24rpx; +} + +.title { + text-align: center; + padding: 24rpx; + font-size: 34rpx; + line-height: 50rpx; + font-weight: 600; +} + +.line { + border: 1px dashed #e5e6eb; + margin: 0 24rpx 24rpx 24rpx; +} + +.subtitle { + color: var(--main-color); +} + +.text { + padding-bottom: 24rpx; +} \ No newline at end of file diff --git a/pages/DetailPerson/index.js b/pages/DetailPerson/index.js new file mode 100644 index 0000000..1c26238 --- /dev/null +++ b/pages/DetailPerson/index.js @@ -0,0 +1,79 @@ +// pages/DetailPerson/index.js +const $$ = require('../../utils/util'); + +// 详情接口 +function getByIdApi(param) { + return $$.request({ + url: 'casePerson/getById', + type: 'get', + submitData: param || {}, + service: 'mediate' + }) +} + +function getByIdAgentApi(param) { + return $$.request({ + url: 'caseAgent/getById', + type: 'get', + submitData: param || {}, + service: 'mediate' + }) +} +Page({ + + /** + * 页面的初始数据 + */ + data: { + data: {} + }, + + + //获取申请人详情 + async getById(id) { + $$.showLoading(); + const res = await getByIdApi({ + id + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + data + }); + } + }, + + + //获取被申请人详情 + async getagenById(id) { + $$.showLoading(); + const res = await getByIdAgentApi({ + id + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + data + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let id = options.id; + let perType = options.perType; + // 15_020008-1申请方 24_00006-1 申请方代理人 15_020008-2被申请方 24_00006-2 被申请方代理人 + if (perType === '15_020008-1' || perType === '15_020008-2') { + this.getById(id) + } + if (perType === '24_00006-1' || perType === '24_00006-2') { + this.getagenById(id) + } + }, + + +}) \ No newline at end of file diff --git a/pages/DetailPerson/index.json b/pages/DetailPerson/index.json new file mode 100644 index 0000000..95018e3 --- /dev/null +++ b/pages/DetailPerson/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "当事人信息", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/DetailPerson/index.wxml b/pages/DetailPerson/index.wxml new file mode 100644 index 0000000..d8b9179 --- /dev/null +++ b/pages/DetailPerson/index.wxml @@ -0,0 +1,43 @@ +<!--pages/DetailPerson/index.wxml--> +<view class="card"> + <view class="cell3"> + <view class="cell-title-placeholder">人员类型</view> + <view>{{ data.perTypeName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">姓名</view> + <view>{{ data.trueName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">联系方式</view> + <view>{{ data.mobile || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">证件类型</view> + <view>{{ data.certiTypeName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">证件号码</view> + <view>{{ data.certiNo || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">联系地址</view> + <view>{{ data.addr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">户籍地址</view> + <view>{{ data.placeAddr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">工作单位</view> + <view>{{ data.workUnit || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">民族</view> + <view>{{ data.nationName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">性别</view> + <view>{{ data.sexName || '-' }}</view> + </view> +</view> \ No newline at end of file diff --git a/pages/DetailPerson/index.wxss b/pages/DetailPerson/index.wxss new file mode 100644 index 0000000..661923c --- /dev/null +++ b/pages/DetailPerson/index.wxss @@ -0,0 +1,16 @@ +/* pages/DetailPerson/index.wxss */ + +.card { + background-color: #fff; + padding: 24rpx; +} + +.cell3 { + margin-bottom: 16rpx; +} + +.cell-title-placeholder { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(0, 0, 0, 0.5); +} \ No newline at end of file diff --git a/pages/addAddress/index.js b/pages/addAddress/index.js new file mode 100644 index 0000000..4116e15 --- /dev/null +++ b/pages/addAddress/index.js @@ -0,0 +1,66 @@ +// pages/addAddress/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/addAddress/index.json b/pages/addAddress/index.json new file mode 100644 index 0000000..ef3eb97 --- /dev/null +++ b/pages/addAddress/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "选择纠纷发生地", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/addAddress/index.wxml b/pages/addAddress/index.wxml new file mode 100644 index 0000000..ed7cdbf --- /dev/null +++ b/pages/addAddress/index.wxml @@ -0,0 +1,2 @@ +<!--pages/addAddress/index.wxml--> +<text>pages/addAddress/index.wxml</text> diff --git a/pages/addAddress/index.wxss b/pages/addAddress/index.wxss new file mode 100644 index 0000000..221957e --- /dev/null +++ b/pages/addAddress/index.wxss @@ -0,0 +1 @@ +/* pages/addAddress/index.wxss */ \ No newline at end of file diff --git a/pages/addAgent/index.js b/pages/addAgent/index.js new file mode 100644 index 0000000..339b59b --- /dev/null +++ b/pages/addAgent/index.js @@ -0,0 +1,322 @@ +// pages/addPerson/index.js +const $$ = require('../../utils/util'); +const app = getApp(); +import Toast from '../../components/vant/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + select: {}, // 下拉框数据 + data: { + imgUrl: $$.url.img, + popup: { + formtype: '', + index: 0, + }, + personTypes: [{ + title: '自然人', + imgUrl: $$.url.img + 'person-types_1.png', + imgUrlActive: $$.url.img + 'person-types_1_active.png', + }, { + title: '法人', + imgUrl: $$.url.img + 'person-types_2.png', + imgUrlActive: $$.url.img + 'person-types_2_active.png', + }, { + title: '非法人组织', + imgUrl: $$.url.img + 'person-types_3.png', + imgUrlActive: $$.url.img + 'person-types_3_active.png', + }], + personTypesActive: 0, // 人员类型切换 + perType: '', + formData: { + trueName: '', + mobile: '', + certiType: '09_00015-1', + certiTypeName: '身份证', + certiNo: '', + addr: '', + placeAddr: '', + workUnit: '', + nation: '', + nationName: '', + sex: '09_00003-1', + sexName: '男', + }, //表单存储对象 + frData: {}, + ffrData: {} + }, + + // 保存 + handleNext(e) { + let personTypesActive = this.data.personTypesActive; + let data = { + ...this.data.formData, + perType: this.data.perType, + agentCode: this.data.radio, + perTypeName: this.data.perTypeName, + perClass: personTypesActive === 0 ? '09_01001-1' : personTypesActive === 1 ? '09_01001-2' : personTypesActive === 2 ? '09_01001-3' : "", + perClassName: personTypesActive === 0 ? '自然人' : personTypesActive === 1 ? '法人' : personTypesActive === 2 ? '非法人组织' : "", + } + // 获取当前页面栈 + var pages = getCurrentPages(); + + // 上一个页面 + var prevPage = pages[pages.length - 2]; + // 直接设置数据对象到上一页面的data中 + prevPage.setData({ + oneData: data, + editIndex: this.data.editIndex || false, + }); + + wx.navigateBack({ + delta: 1, + }) + + }, + + // 选择法人或非法人组织 + selectUnit(e) { + let type = e.currentTarget.dataset.type; + // 法人信息 非法人组织 + if (type === 'person' || type === 'units') { + wx.navigateTo({ + url: '../../pages/addUnit/index?type=' + type, + }); + } + }, + + // 获取手机号码 + async _handleGetPhoneNumber(e) { + let that = this; + let phone = await that.selectComponent('#common-page').handleGetPhoneNumber(e.detail.code); + that.data.formData.mobile = phone; + that.setData({ + formData: that.data.formData + }); + }, + + // 身份证ocr + handleOCR(e) { + let that = this; + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success(res2) { + const tempFiles = res2.tempFiles[0]; + $$.showLoading(); + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/wechat/fileInfo/wecatRecognition`, + filePath: tempFiles.tempFilePath, + name: 'file', + header: { + Authorization: app.globalData.token + }, + complete(res3) { + $$.hideLoading(); + if (res3.errMsg === 'uploadFile:ok') { + let { + code, + data + } = JSON.parse(res3.data); + if (code == -1) { + $$.errorModal({ + content: '识别失败' + }); + return; + } + that.data.formData.certiNo = data?.ocrResult.certiNo; + that.data.formData.certiType = data?.ocrResult.certiType; + that.data.formData.certiTypeName = data?.ocrResult.certiTypeName; + that.data.formData.trueName = data?.ocrResult.trueName; + that.data.formData.placeAddr = data?.ocrResult.placeAddr; + that.data.formData.sex = data?.ocrResult.sex; + that.data.formData.sexName = data?.ocrResult.sexName; + that.data.formData.nation = data?.ocrResult.nation; + that.data.formData.nationName = data?.ocrResult.nationName; + that.setData({ + formData: that.data.formData + }); + } + }, + }); + }, + }); + }, + + // 表单修改 + handleChange(e) { + let key = e.currentTarget.dataset.key, + value = e.detail; + if (key === 'sex') { + this.data.formData[key] = value; + this.data.formData[key + 'Name'] = value === '09_00003-2' ? '女' : value === '09_00003-1' ? '男' : ''; + } else { + this.data.formData[key] = value; + } + this.setData({ + formData: this.data.formData + }); + }, + + + // 人员类型切换 + _handleSelectData(e) { + let index = e.currentTarget.dataset.index; + this.setData({ + personTypesActive: index + }) + if (index === 1) { + this.setData({ + ffrData: {}, + formData: { + trueName: '', + mobile: '', + certiType: '09_00015-1', + certiTypeName: '身份证', + certiNo: '', + addr: '', + placeAddr: '', + workUnit: '', + nation: '', + nationName: '', + sex: '09_00003-1', + sexName: '男', + } + }) + } + if (index === 2) { + this.setData({ + frData: {}, + formData: { + trueName: '', + mobile: '', + certiType: '09_00015-1', + certiTypeName: '身份证', + certiNo: '', + addr: '', + placeAddr: '', + workUnit: '', + nation: '', + nationName: '', + sex: '09_00003-1', + sexName: '男', + } + }) + } + }, + + // 下拉框选择开启 + handleShowPopup(e) { + let type = e.currentTarget.dataset.type; + let selectData = []; + let selectOption = this.select[type]; + selectData = [{ + values: selectOption, + defaultIndex: 0 + }]; + this.setData({ + popup: { + formtype: e.currentTarget.dataset.key, + index: e.currentTarget.dataset.index, + visible: true, + title: e.currentTarget.dataset.title, + type: type, + selectData: selectData, + }, + }); + }, + + // 关闭下拉框选择 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + // 下拉框选择确认 + handleConfirmPicker({ + detail + }) { + let formtype = this.data.popup.formtype; + let value = detail.detail.value, + arr = []; + this.data.popup.visible = false; + this.data.formData[formtype] = value[0].value; + this.data.formData[formtype + 'Name'] = value[0].label; + this.setData({ + popup: this.data.popup, + formData: this.data.formData + }); + }, + + // 请求下拉框资源 + async getSelectOptionData() { + const res = await $$.commonRequest({ + url: `${$$.url.assets}selectOption.json`, + type: 'get' + }); + if (res) { + this.select.cardType = res.data.cardType || []; + this.select.nation = res.data.nation || []; + } + }, + + + onChange(event) { + console.log('event.detail', event.detail); + this.setData({ + radio: event.detail, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let { + perType, + perTypeName, + data, + index, + objs, + } = options; + let selectList = JSON.parse(objs) + console.log('selectList', selectList); + if (data) { + data = JSON.parse(data); + wx.setNavigationBarTitle({ + title: "修改" + data.perTypeName + }) + this.setData({ + selectList, + editIndex: index, + radio: data.agentCode, + formData: data, + perType: data.perType, + perTypeName: data.perTypeName, + personTypesActive: data.perClass === '09_01001-1' ? 0 : data.perClass === '09_01001-2' ? 1 : data.perClass === '09_01001-3' ? 2 : 0, + }) + } else { + wx.setNavigationBarTitle({ + title: "添加" + perTypeName + }) + this.setData({ + selectList, + radio: selectList[0]?.agentCode, + perType, + perTypeName + }) + } + this.getSelectOptionData(); + }, + + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, +}) \ No newline at end of file diff --git a/pages/addAgent/index.json b/pages/addAgent/index.json new file mode 100644 index 0000000..a0812ee --- /dev/null +++ b/pages/addAgent/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/addAgent/index.wxml b/pages/addAgent/index.wxml new file mode 100644 index 0000000..801f23f --- /dev/null +++ b/pages/addAgent/index.wxml @@ -0,0 +1,103 @@ +<!--pages/addPerson/index.wxml--> + +<common-page id="common-page" bind:onCancelPicker="handleClosePopup" bind:onChangePicker="handleChangeColumns" bind:onClosePopup="handleClosePopup" bind:onConfirmPicker="handleConfirmPicker" popup="{{ popup }}"> + <view class="addPerson-main"> + <!-- 人员类型切换 --> + <view class="person-type-select"> + <view class="person-type-select-person"><text><text class="cell-required">*</text> 代理对象</text></view> + <van-radio-group value="{{ radio }}" bind:change="onChange"> + <van-radio class="person-type-radio" wx:for="{{selectList}}" name="{{item.agentCode}}">{{item.trueName}}</van-radio> + </van-radio-group> + </view> + <!-- 表单-自然人 --> + <view class="popupMsg-form"> + <view class="cell-item"> + <view class="cell-title"> + <text><text class="cell-required">*</text> 代理人姓名</text> + <view bindtap="handleOCR" class="cell-idCard"> + <image src="{{imgUrl}}card.png" mode="" /> 身份证识别 + </view> + </view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="trueName" input-align="right" placeholder="请输入" value="{{ formData.trueName || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title"> + <text><text class="cell-required">*</text> 联系方式</text> + <van-button open-type="getPhoneNumber" bindgetphonenumber="_handleGetPhoneNumber" style="font-weight: 400;" class="cell-phone">本机号码</van-button> + </view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="mobile" input-align="right" placeholder="请填写手机号码" value="{{ formData.mobile || '' }}" /> + </view> + </view> + <view bindtap="handleShowPopup" class="cell cell-item" data-title="证件类型" data-key="certiType" data-type="cardType"> + <view class="cell-title"><text><text class="cell-required">*</text> 证件类型</text></view> + <view class="{{ !formData.certiTypeName ? 'cell-placeholder' : '' }} cell-select">{{ formData.certiTypeName ? formData.certiTypeName : '未选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title"> + <text><text class="cell-required">*</text> 证件号码</text> + </view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="certiNo" input-align="right" placeholder="请填写完整证件号码" value="{{ formData.certiNo || '' }}" /> + </view> + </view> + <view style="height: 16rpx;"></view> + <view class="cell-item"> + <view class="cell-title1">联系地址</view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="addr" input-align="right" placeholder="请填写详细地址" value="{{ formData.addr || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title1">户籍地址</view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="placeAddr" input-align="right" placeholder="请填写户籍地址" value="{{ formData.placeAddr || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title1">工作单位</view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="workUnit" input-align="right" placeholder="请填写单位全名" value="{{ formData.workUnit || '' }}" /> + </view> + </view> + + <view bindtap="handleShowPopup" class="cell cell-item" data-title="民族" data-key="nation" data-type="nation"> + <view class="cell-title1">民族</view> + <view class="{{ !formData.nationName ? 'cell-placeholder' : '' }} cell-select">{{ formData.nationName ? formData.nationName : '未选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="cell cell-item"> + <view style="flex:1" class="cell-title1">性别</view> + <view class="cell-radio"> + <van-radio-group bind:change="handleChange" data-key="sex" value="{{ formData.sex }}"> + <view class="cell-radio"> + <view> + <van-radio name="09_00003-2">女</van-radio> + </view> + <view> + <van-radio name="09_00003-1">男</van-radio> + </view> + </view> + </van-radio-group> + </view> + </view> + </view> + + <!-- 保存 --> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <van-button bind:click="handleNext" block data-type="next" type="primary">保存</van-button> + <view class="safeHeight" /> + </view> + </view> + </view> + + +</common-page> \ No newline at end of file diff --git a/pages/addAgent/index.wxss b/pages/addAgent/index.wxss new file mode 100644 index 0000000..50e445e --- /dev/null +++ b/pages/addAgent/index.wxss @@ -0,0 +1,202 @@ +/* pages/addAgent/index.wxss */ +/* pages/addPerson/index.wxss */ +@import '../../styles/public_components.wxss'; + +.submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + padding: 32rpx var(--padding-my); + background-color: #fff; + z-index: 99; +} + +.cell-item { + padding: 24rpx 32rpx 24rpx 12rpx; + background-color: #fff; +} + +.cell-item-select {} + +.addPerson-main { + display: flex; + flex-direction: column; +} + +.cell-idCard { + color: var(--main-color); + display: flex; + align-items: center; + font-weight: 400; +} + +.cell-phone .van-button { + color: var(--main-color); + border: none !important; + padding: 0 !important; +} + +.cell-idCard image { + width: 34rpx; + height: 32rpx; + margin-right: 8rpx; +} + +.cell-title { + margin-bottom: 8rpx; + display: flex; + justify-content: space-between; +} + +.cell-radio { + display: flex; + gap: 27rpx; +} + +.cell-title1 { + font-weight: 600; + font-size: 30rpx; + line-height: 46rpx; + padding-left: 20rpx; +} + +.cell-select { + padding: 0 20rpx; +} + +.cell-required { + color: #d1021c; + font-size: 30rpx; +} + +.cell-item .van-field__control--right { + text-align: left +} + +.popupMsg-form { + margin-top: 16rpx; + flex: 1; + margin-bottom: 162rpx; +} + +.person-type-select { + background-color: #fff; + +} +.one-list-r { + flex: 1; +} + +.person-type-select-person { + padding: 24rpx 10rpx 16rpx; +} + +.person-type-radio .van-radio { + padding: 0 24rpx 16rpx; +} + +/* components/personTypes/index.wxss */ +.personTypes { + display: flex; + align-items: center; + background-color: #ffffff; + gap: 32rpx; + padding: 0 32rpx 32rpx; +} + +.personTypes-item { + position: relative; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + color: rgba(23, 26, 29, 0.40); + border: 1px solid #E5E6EB; + border-radius: 12rpx; + padding: 18rpx 0 10rpx; + position: relative; +} + +.personTypes-item-active, +.personTypes-item-active .personTypes-item-icon { + color: var(--main-color); + border: 1px solid #1a6fb8; +} + + + +.personTypes-item-line {} + +.personTypes-item-hoverLine { + width: 168rpx; + border: 1px solid var(--main-color); +} + +.personTypes-item-line { + width: 168rpx; + border: 1px solid #E5E6EB; +} + +.personTypes-item-active .personTypes-item-number1 { + background-color: var(--main-color); + color: var(--white); +} + +.personTypes-item-round { + position: relative; + width: 60rpx; + height: 60rpx; + color: #86909C; + margin-bottom: 8rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.personTypes-item-round image { + width: 100%; + height: 100%; +} + +.personTypes-item-sueecss { + position: absolute; + right: 10rpx; + top: 10rpx; +} + +.personTypes-item-icon { + position: absolute; + z-index: 889; + top: 50%; + margin-top: -24rpx; + right: -88rpx; + color: #cccccc; +} + +.card { + padding: 24rpx 32rpx; + background-color: #ffffff; + border-radius: var(--border-radius-card); + margin: 12rpx 32rpx; + border-radius: 8rpx; +} + +.cell3 { + margin-bottom: 16rpx; +} + +.cell-title-placeholder { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(0, 0, 0, 0.5); +} + +.cell-bottom { + border-top: 1px solid #f0f0f0; + padding: 24rpx 0 0; + text-align: center; + font-size: 32rpx; + line-height: 44rpx; +} \ No newline at end of file diff --git a/pages/addFilesList/index.js b/pages/addFilesList/index.js new file mode 100644 index 0000000..eb1160f --- /dev/null +++ b/pages/addFilesList/index.js @@ -0,0 +1,66 @@ +// pages/addFilesList/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/addFilesList/index.json b/pages/addFilesList/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/addFilesList/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/addFilesList/index.wxml b/pages/addFilesList/index.wxml new file mode 100644 index 0000000..253ae03 --- /dev/null +++ b/pages/addFilesList/index.wxml @@ -0,0 +1,2 @@ +<!--pages/addFilesList/index.wxml--> +<text>pages/addFilesList/index.wxml</text> \ No newline at end of file diff --git a/pages/addFilesList/index.wxss b/pages/addFilesList/index.wxss new file mode 100644 index 0000000..756e3f5 --- /dev/null +++ b/pages/addFilesList/index.wxss @@ -0,0 +1 @@ +/* pages/addFilesList/index.wxss */ \ No newline at end of file diff --git a/pages/addPerson/index.js b/pages/addPerson/index.js new file mode 100644 index 0000000..7d2d83f --- /dev/null +++ b/pages/addPerson/index.js @@ -0,0 +1,344 @@ +// pages/addPerson/index.js +const $$ = require('../../utils/util'); +const app = getApp(); +import Toast from '../../components/vant/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + select: {}, // 下拉框数据 + data: { + imgUrl: $$.url.img, + popup: { + formtype: '', + index: 0, + }, + personTypes: [{ + title: '自然人', + imgUrl: $$.url.img + 'person-types_1.png', + imgUrlActive: $$.url.img + 'person-types_1_active.png', + }, { + title: '法人', + imgUrl: $$.url.img + 'person-types_2.png', + imgUrlActive: $$.url.img + 'person-types_2_active.png', + }, { + title: '非法人组织', + imgUrl: $$.url.img + 'person-types_3.png', + imgUrlActive: $$.url.img + 'person-types_3_active.png', + }], + personTypesActive: 0, // 人员类型切换 + perType: '', + formData: { + trueName: '', + mobile: '', + certiType: '09_00015-1', + certiTypeName: '身份证', + certiNo: '', + addr: '', + placeAddr: '', + workUnit: '', + nation: '', + nationName: '', + sex: '09_00003-1', + sexName: '男', + }, //表单存储对象 + frData: {}, + ffrData: {} + }, + + // 保存 + handleNext(e) { + let personTypesActive = this.data.personTypesActive; + let data = {} + // 自然人 + if (personTypesActive === 0) { + data = { + ...this.data.formData, + perType: this.data.perType, + perTypeName: this.data.perTypeName, + agentCode: this.data.formData.certiNo || '', + perClass: personTypesActive === 0 ? '09_01001-1' : personTypesActive === 1 ? '09_01001-2' : personTypesActive === 2 ? '09_01001-3' : "", + perClassName: personTypesActive === 0 ? '自然人' : personTypesActive === 1 ? '法人' : personTypesActive === 2 ? '非法人组织' : "", + } + } + // 法人 + if (personTypesActive === 1) { + data = { + ...this.data.frData, + perType: this.data.perType, + perTypeName: this.data.perTypeName, + agentCode: this.data.frData.orgaCode || '', + perClass: '09_01001-2', + perClassName: '法定代表人', + } + } + // 非法人组织 + if (personTypesActive === 2) { + data = { + ...this.data.ffrData, + perType: this.data.perType, + perTypeName: this.data.perTypeName, + agentCode: this.data.frData.orgaCode || '', + perClass: '09_01001-3', + perClassName: '机构代表人', + } + } + // 获取当前页面栈 + var pages = getCurrentPages(); + + // 上一个页面 + var prevPage = pages[pages.length - 2]; + // 直接设置数据对象到上一页面的data中 + prevPage.setData({ + oneData: data, + editIndex: this.data.editIndex || false, + }); + + wx.navigateBack({ + delta: 1, + }) + + }, + + // 选择法人或非法人组织 + selectUnit(e) { + let type = e.currentTarget.dataset.type; + // 法人信息 非法人组织 + if (type === 'person' || type === 'units') { + wx.navigateTo({ + url: '../../pages/addUnit/index?type=' + type, + }); + } + }, + + // 获取手机号码 + async _handleGetPhoneNumber(e) { + let that = this; + let phone = await that.selectComponent('#common-page').handleGetPhoneNumber(e.detail.code); + that.data.formData.mobile = phone; + that.setData({ + formData: that.data.formData + }); + }, + + // 身份证ocr + handleOCR(e) { + let that = this; + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success(res2) { + const tempFiles = res2.tempFiles[0]; + $$.showLoading(); + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/wechat/fileInfo/wecatRecognition`, + filePath: tempFiles.tempFilePath, + name: 'file', + header: { + Authorization: app.globalData.token + }, + complete(res3) { + $$.hideLoading(); + if (res3.errMsg === 'uploadFile:ok') { + let { + code, + data + } = JSON.parse(res3.data); + if (code == -1) { + $$.errorModal({ + content: '识别失败' + }); + return; + } + that.data.formData.certiNo = data?.ocrResult.certiNo; + that.data.formData.certiType = data?.ocrResult.certiType; + that.data.formData.certiTypeName = data?.ocrResult.certiTypeName; + that.data.formData.trueName = data?.ocrResult.trueName; + that.data.formData.placeAddr = data?.ocrResult.placeAddr; + that.data.formData.sex = data?.ocrResult.sex; + that.data.formData.sexName = data?.ocrResult.sexName; + that.data.formData.nation = data?.ocrResult.nation; + that.data.formData.nationName = data?.ocrResult.nationName; + that.setData({ + formData: that.data.formData + }); + } + }, + }); + }, + }); + }, + + // 表单修改 + handleChange(e) { + let key = e.currentTarget.dataset.key, + value = e.detail; + if (key === 'sex') { + this.data.formData[key] = value; + this.data.formData[key + 'Name'] = value === '09_00003-2' ? '女' : value === '09_00003-1' ? '男' : ''; + } else { + this.data.formData[key] = value; + } + this.setData({ + formData: this.data.formData + }); + }, + + + // 人员类型切换 + _handleSelectData(e) { + let index = e.currentTarget.dataset.index; + this.setData({ + personTypesActive: index + }) + if (index === 1) { + this.setData({ + ffrData: {}, + formData: { + trueName: '', + mobile: '', + certiType: '09_00015-1', + certiTypeName: '身份证', + certiNo: '', + addr: '', + placeAddr: '', + workUnit: '', + nation: '', + nationName: '', + sex: '09_00003-1', + sexName: '男', + } + }) + } + if (index === 2) { + this.setData({ + frData: {}, + formData: { + trueName: '', + mobile: '', + certiType: '09_00015-1', + certiTypeName: '身份证', + certiNo: '', + addr: '', + placeAddr: '', + workUnit: '', + nation: '', + nationName: '', + sex: '09_00003-1', + sexName: '男', + } + }) + } + }, + + // 下拉框选择开启 + handleShowPopup(e) { + let type = e.currentTarget.dataset.type; + let selectData = []; + let selectOption = this.select[type]; + selectData = [{ + values: selectOption, + defaultIndex: 0 + }]; + this.setData({ + popup: { + formtype: e.currentTarget.dataset.key, + index: e.currentTarget.dataset.index, + visible: true, + title: e.currentTarget.dataset.title, + type: type, + selectData: selectData, + }, + }); + }, + + // 关闭下拉框选择 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + // 下拉框选择确认 + handleConfirmPicker({ + detail + }) { + let formtype = this.data.popup.formtype; + let value = detail.detail.value, + arr = []; + this.data.popup.visible = false; + this.data.formData[formtype] = value[0].value; + this.data.formData[formtype + 'Name'] = value[0].label; + this.setData({ + popup: this.data.popup, + formData: this.data.formData + }); + }, + + // 请求下拉框资源 + async getSelectOptionData() { + const res = await $$.commonRequest({ + url: `${$$.url.assets}selectOption.json`, + type: 'get' + }); + if (res) { + this.select.cardType = res.data.cardType || []; + this.select.nation = res.data.nation || []; + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let { + perType, + perTypeName, + data, + index + } = options; + if (data) { + data = JSON.parse(data); + wx.setNavigationBarTitle({ + title: "修改" + data.perTypeName + }) + this.setData({ + editIndex: index, + formData: data, + perType: data.perType, + perTypeName: data.perTypeName, + personTypesActive: data.perClass === '09_01001-1' ? 0 : data.perClass === '09_01001-2' ? 1 : data.perClass === '09_01001-3' ? 2 : 0, + }) + } else { + wx.setNavigationBarTitle({ + title: "添加" + perTypeName + }) + this.setData({ + perType, + perTypeName + }) + } + this.getSelectOptionData(); + }, + + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + if (this.data.frData?.trueName) { + let data = this.data.frData; + this.setData({ + frData: data, + }) + } + if (this.data.ffrData?.trueName) { + let data = this.data.ffrData; + this.setData({ + ffrData: data, + }) + } + }, +}) \ No newline at end of file diff --git a/pages/addPerson/index.json b/pages/addPerson/index.json new file mode 100644 index 0000000..5010db8 --- /dev/null +++ b/pages/addPerson/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "", + "usingComponents": { + } +} \ No newline at end of file diff --git a/pages/addPerson/index.wxml b/pages/addPerson/index.wxml new file mode 100644 index 0000000..eb82ab7 --- /dev/null +++ b/pages/addPerson/index.wxml @@ -0,0 +1,195 @@ +<!--pages/addPerson/index.wxml--> + +<common-page id="common-page" bind:onCancelPicker="handleClosePopup" bind:onChangePicker="handleChangeColumns" bind:onClosePopup="handleClosePopup" bind:onConfirmPicker="handleConfirmPicker" popup="{{ popup }}"> + <view class="addPerson-main"> + <!-- 人员类型切换 --> + <view class="person-type-select"> + <view class="person-type-select-person">人员类型</view> + <view class="personTypes"> + <view bindtap="_handleSelectData" data-index="{{index}}" class="personTypes-item {{ index === personTypesActive && 'personTypes-item-active' }}" wx:for="{{ personTypes }}" wx:key="index"> + <view class="personTypes-item-round" wx:if="{{ index === personTypesActive }}"> + <image src="{{item.imgUrlActive}}" mode="" /> + </view> + <view class="personTypes-item-round" wx:else> + <image src="{{item.imgUrl}}" mode="" /> + </view> + <view class="personTypes-item-text">{{ item.title }}</view> + <view wx:if="{{ index === personTypesActive }}" class="personTypes-item-sueecss"> + <van-icon size="20" name="checked" /> + </view> + </view> + </view> + </view> + <!-- 表单-自然人 --> + <view wx:if="{{personTypesActive===0}}" class="popupMsg-form"> + <view class="cell-item"> + <view class="cell-title"> + <text><text class="cell-required">*</text> 姓名</text> + <view bindtap="handleOCR" class="cell-idCard"> + <image src="{{imgUrl}}card.png" mode="" /> 身份证识别 + </view> + </view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="trueName" input-align="right" placeholder="请输入" value="{{ formData.trueName || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title"> + <text><text class="cell-required">*</text> 联系方式</text> + <van-button open-type="getPhoneNumber" bindgetphonenumber="_handleGetPhoneNumber" style="font-weight: 400;" class="cell-phone">本机号码</van-button> + </view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="mobile" input-align="right" placeholder="请填写手机号码" value="{{ formData.mobile || '' }}" /> + </view> + </view> + <view bindtap="handleShowPopup" class="cell cell-item" data-title="证件类型" data-key="certiType" data-type="cardType"> + <view class="cell-title"><text><text class="cell-required">*</text> 证件类型</text></view> + <view class="{{ !formData.certiTypeName ? 'cell-placeholder' : '' }} cell-select">{{ formData.certiTypeName ? formData.certiTypeName : '未选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title"> + <text><text class="cell-required">*</text> 证件号码</text> + </view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="certiNo" input-align="right" placeholder="请填写完整证件号码" value="{{ formData.certiNo || '' }}" /> + </view> + </view> + <view style="height: 16rpx;"></view> + <view class="cell-item"> + <view class="cell-title1">联系地址</view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="addr" input-align="right" placeholder="请填写详细地址" value="{{ formData.addr || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title1">户籍地址</view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="placeAddr" input-align="right" placeholder="请填写户籍地址" value="{{ formData.placeAddr || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title1">工作单位</view> + <view class="cell-select"> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="workUnit" input-align="right" placeholder="请填写单位全名" value="{{ formData.workUnit || '' }}" /> + </view> + </view> + + <view bindtap="handleShowPopup" class="cell cell-item" data-title="民族" data-key="nation" data-type="nation"> + <view class="cell-title1">民族</view> + <view class="{{ !formData.nationName ? 'cell-placeholder' : '' }} cell-select">{{ formData.nationName ? formData.nationName : '未选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="cell cell-item"> + <view style="flex:1" class="cell-title1">性别</view> + <view class="cell-radio"> + <van-radio-group bind:change="handleChange" data-key="sex" value="{{ formData.sex }}"> + <view class="cell-radio"> + <view> + <van-radio name="09_00003-2">女</van-radio> + </view> + <view> + <van-radio name="09_00003-1">男</van-radio> + </view> + </view> + </van-radio-group> + </view> + </view> + </view> + <!-- 法人 --> + <view wx:if="{{personTypesActive===1}}" class="popupMsg-form"> + <view wx:if="{{!frData.trueName}}" bindtap="selectUnit" data-type="person" class="cell cell-item" data-title="企业信息"> + <view class="cell-title"><text><text class="cell-required">*</text> 企业信息</text></view> + <view class="{{ !formData.socialCreditCode ? 'cell-placeholder' : '' }} cell-select">{{ formData.socialCreditCode ? formData.socialCreditCode : '选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="card" wx:else> + <view class="cell3"> + <view class="cell-title-placeholder">企业名称</view> + <view>{{ frData.trueName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">联系方式</view> + <view>{{ frData.mobile || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">企业所在地</view> + <view>{{ frData.addr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">统计社会信用代码</view> + <view>{{ frData.orgaCode || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">法定代表人</view> + <view>{{ frData.deputy || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">企业类型</view> + <view>{{ frData.orgaType || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">住所</view> + <view>{{ frData.placeAddr || '-' }}</view> + </view> + <view bindtap="selectUnit" data-type="person" class="cell-bottom public-color">重新选择</view> + </view> + </view> + <!-- 非法人组织 --> + <view wx:if="{{personTypesActive===2}}" class="popupMsg-form"> + <view wx:if="{{!ffrData.trueName}}" bindtap="selectUnit" data-type="units" class="cell cell-item" data-title="机构信息"> + <view class="cell-title"><text><text class="cell-required">*</text> 机构信息</text></view> + <view class="{{ !formData.socialCreditCode ? 'cell-placeholder' : '' }} cell-select">{{ formData.socialCreditCode ? formData.socialCreditCode : '选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="card" wx:else> + <view class="cell3"> + <view class="cell-title-placeholder">企业名称</view> + <view>{{ ffrData.trueName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">联系方式</view> + <view>{{ ffrData.mobile || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">企业所在地</view> + <view>{{ ffrData.addr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">统计社会信用代码</view> + <view>{{ frData.orgaCode || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">法定代表人</view> + <view>{{ ffrData.deputy || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">企业类型</view> + <view>{{ ffrData.orgaType || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">住所</view> + <view>{{ ffrData.placeAddr || '-' }}</view> + </view> + <view bindtap="selectUnit" data-type="units" class="cell-bottom public-color">重新选择</view> + </view> + </view> + <!-- 保存 --> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <van-button bind:click="handleNext" block data-type="next" type="primary">保存</van-button> + <view class="safeHeight" /> + </view> + </view> + </view> + + +</common-page> \ No newline at end of file diff --git a/pages/addPerson/index.wxss b/pages/addPerson/index.wxss new file mode 100644 index 0000000..f0c8d3e --- /dev/null +++ b/pages/addPerson/index.wxss @@ -0,0 +1,194 @@ +/* pages/addPerson/index.wxss */ +@import '../../styles/public_components.wxss'; + +.submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + padding: 32rpx var(--padding-my); + background-color: #fff; + z-index: 99; +} + +.cell-item { + padding: 24rpx 32rpx 24rpx 12rpx; + background-color: #fff; +} + +.cell-item-select {} + +.addPerson-main { + display: flex; + flex-direction: column; +} + +.cell-idCard { + color: var(--main-color); + display: flex; + align-items: center; + font-weight: 400; +} + +.cell-phone .van-button { + color: var(--main-color); + border: none !important; + padding: 0 !important; +} + +.cell-idCard image { + width: 34rpx; + height: 32rpx; + margin-right: 8rpx; +} + +.cell-title { + margin-bottom: 8rpx; + display: flex; + justify-content: space-between; +} + +.cell-radio { + display: flex; + gap: 27rpx; +} + +.cell-title1 { + font-weight: 600; + font-size: 30rpx; + line-height: 46rpx; + padding-left: 20rpx; +} + +.cell-select { + padding: 0 20rpx; +} + +.cell-required { + color: #d1021c; + font-size: 30rpx; +} + +.cell-item .van-field__control--right { + text-align: left +} + +.popupMsg-form { + margin-top: 16rpx; + flex: 1; + margin-bottom: 162rpx; +} + +.person-type-select { + background-color: #fff; + +} + +.person-type-select-person { + padding: 24rpx 32rpx 16rpx; +} + +/* components/personTypes/index.wxss */ +.personTypes { + display: flex; + align-items: center; + background-color: #ffffff; + gap: 32rpx; + padding: 0 32rpx 32rpx; +} + +.personTypes-item { + position: relative; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + color: rgba(23, 26, 29, 0.40); + border: 1px solid #E5E6EB; + border-radius: 12rpx; + padding: 18rpx 0 10rpx; + position: relative; +} + +.personTypes-item-active, +.personTypes-item-active .personTypes-item-icon { + color: var(--main-color); + border: 1px solid #1a6fb8; +} + + + +.personTypes-item-line {} + +.personTypes-item-hoverLine { + width: 168rpx; + border: 1px solid var(--main-color); +} + +.personTypes-item-line { + width: 168rpx; + border: 1px solid #E5E6EB; +} + +.personTypes-item-active .personTypes-item-number1 { + background-color: var(--main-color); + color: var(--white); +} + +.personTypes-item-round { + position: relative; + width: 60rpx; + height: 60rpx; + color: #86909C; + margin-bottom: 8rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.personTypes-item-round image { + width: 100%; + height: 100%; +} + +.personTypes-item-sueecss { + position: absolute; + right: 10rpx; + top: 10rpx; +} + +.personTypes-item-icon { + position: absolute; + z-index: 889; + top: 50%; + margin-top: -24rpx; + right: -88rpx; + color: #cccccc; +} + +.card { + padding: 24rpx 32rpx; + background-color: #ffffff; + border-radius: var(--border-radius-card); + margin: 12rpx 32rpx; + border-radius: 8rpx; +} + +.cell3 { + margin-bottom: 16rpx; +} + +.cell-title-placeholder { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(0, 0, 0, 0.5); +} + +.cell-bottom { + border-top: 1px solid #f0f0f0; + padding: 24rpx 0 0; + text-align: center; + font-size: 32rpx; + line-height: 44rpx; +} \ No newline at end of file diff --git a/pages/addUnit/index.js b/pages/addUnit/index.js new file mode 100644 index 0000000..87ef692 --- /dev/null +++ b/pages/addUnit/index.js @@ -0,0 +1,199 @@ +const $$ = require('../../utils/util'); +const app = getApp(); + +function pageZzQueryApi(param) { + return $$.request({ + url: 'company/pageQuery', + type: 'get', + submitData: param || {}, + service: 'sys' + }) +} +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + search: { + integratedQuery: '', + page: 1, + size: 10, + }, // 查询条件 + data: [], // 数据 + total: 0, // 总数 + }, + + searchButton() { + this.pageZzQuery(this.data.search) + }, + + handleChange(e) { + let key = e.currentTarget.dataset.key + let value = e.detail; + this.setData({ + search: { + page: 1, + size: 10, + integratedQuery: value + } + }); + }, + + async pageZzQuery(params, type) { + $$.showLoading(); + const res = await pageZzQueryApi(params); + $$.hideLoading(); + if (this.data.loading) { + this.setData({ + loading: false + }); + } + if (res.type) { + if (params.page === 1) { + this.data.data = res.data.content || []; + } else { + this.data.data = this.data.data.concat(res.data.content || []); + } + this.setData({ + search: params, + data: this.data.data, + total: res.data.totalElements || 0 + }); + if (type === 'onPullDownRefresh') { + $$.showToast({ + title: '已是最新记录', + duration: 1000 + }); + wx.stopPullDownRefresh(); + } + } + }, + + // 滚动到底部获取案件 + handlescrolltolower() { + if (this.data.data.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ + loading: this.data.loading + }); + let submitData = { + ...this.data.search + }; + submitData.page = submitData.page + 1; + this.pageZzQuery(submitData); + } + }, + + // 跳转详情 + _handleGoPage(e) { + let item = e.currentTarget.dataset.item; + // 获取当前页面栈 + var pages = getCurrentPages(); + + // 上一个页面 + var prevPage = pages[pages.length - 2]; + // 直接设置数据对象到上一页面的data中 + if (this.data.type === 'person') { + prevPage.setData({ + frData: { + ...item, + companyId: item.id || '', + trueName: item.name || '', + mobile: item.legalPersonTelephone || '', + addr: item.businessRegAddress || '', + orgaCode: item.socialCreditCode || '', + deputy: item.legalRepresent || '', + orgaType: item.orgaType || '', + placeAddr: item.placeAddr || '', + }, + }); + } + if (this.data.type === 'units') { + prevPage.setData({ + ffrData: { + ...item, + companyId: item.id || '', + trueName: item.name || '', + mobile: item.legalPersonTelephone || '', + addr: item.businessRegAddress || '', + orgaCode: item.socialCreditCode || '', + deputy: item.legalRepresent || '', + orgaType: item.orgaType || '', + placeAddr: item.placeAddr || '', + }, + }); + } + wx.navigateBack({ + delta: 1, + }) + }, + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // 页面加载时设置标题 + wx.setNavigationBarTitle({ + title: options.type === 'person' ? '选择企业' : options.type === 'units' ? '选择机构' : '选择' + }); + this.setData({ + type: options.type + }) + this.pageZzQuery(this.data.search) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/addUnit/index.json b/pages/addUnit/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/addUnit/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/addUnit/index.wxml b/pages/addUnit/index.wxml new file mode 100644 index 0000000..418c3a1 --- /dev/null +++ b/pages/addUnit/index.wxml @@ -0,0 +1,53 @@ +<!--pages/addUnit/index.wxml--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> +<wxs module="tool"> + function indexOf(array, value) { + return array.indexOf(value) + } + module.exports.indexOf = indexOf; +</wxs> +<van-toast id="van-toast" /> + +<common-page> + <view class="ssimList"> + <view class="card"> + <view class="cell"> + <view class="cell-right"> + <view class="cell-right-l"> + <van-icon name="search" /> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0;background-color:#f2f3f5" data-key="keyword" placeholder="输入企业名称/统一社会信用代码" value="{{ search.integratedQuery }}" /> + </view> + <view bindtap="searchButton" class="ssimList-title public-color">查询</view> + </view> + </view> + </view> + + <!-- 列表 --> + <van-empty image="{{ imgUrl }}addUnit_1.png" description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="ssim-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view class="card-box" wx:for="{{ data }}" wx:key="index"> + <view class="card-list" bindtap="_handleGoPage" data-id="{{ item.id }}" data-item="{{ item }}"> + <!-- todo --> + <!-- <view wx:if="{{search.integratedQuery}}" class="card-title"> + <text class="1" wx:if="{{tool.indexOf(item.name,integratedQuery)}}">{{item.name.substring(0 ,item.name.indexOf(search.integratedQuery))}}<text style='color:red'>{{search.integratedQuery}}</text> {{item.name.slice(item.name.indexOf(search.integratedQuery) + search.integratedQuery.length)}}</text> + <text class="2" wx:else>{{item.name.indexOf(search.integratedQuery)}}22222</text> + </view> + <view wx:else class="card-title">{{item.name}}</view> --> + <view class="card-title">{{item.name}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">联系方式:</text>{{item.legalPersonTelephone||'-'}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">法定代表人:</text>{{item.legalRepresent||'-'}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">企业所在地:</text>{{item.businessRegAddress||'-'}}</view> + </view> + </view> + <block> + <van-divider contentPosition="center" custom-style="margin-top: 12px;" wx:if="{{ data.length >= total && data.length !== 0 }}">没有更多了</van-divider> + <view class="myMediate-scroll-loading" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> \ No newline at end of file diff --git a/pages/addUnit/index.wxss b/pages/addUnit/index.wxss new file mode 100644 index 0000000..613b66a --- /dev/null +++ b/pages/addUnit/index.wxss @@ -0,0 +1,95 @@ +/* pages/addUnit/index.wxss */ + +@import '../../styles/public_components.wxss'; + + +.myMediate-scroll-loading { + text-align: center; + margin: 4px 0; +} + +.ssimList { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + left: 0; + right: 0; +} + +.card { + background-color: #ffffff; + padding: 0 24rpx; +} + +.cell-left { + display: flex; + width: 28%; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; +} + +.cell-left-l { + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: var(--font-size-md, 14px); +} + +.cell-right { + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; + font-size: var(--font-size-md, 14px); +} + +.cell-right-l { + display: flex; + gap: 16rpx; + align-items: center; +} + +.cell-right-l .van-field__control { + min-width: 440rpx !important; +} + +.card-box { + padding: 24rpx 24rpx 0 24rpx; +} + +.card-list { + border-radius: 2px; + background-color: #fff; + padding: 24rpx +} + +.ssim-scroll { + flex: 1; + overflow: hidden; +} + +.card-title { + font-size: 30rpx; + line-height: 46rpx; +} + +.card-subTitle { + padding-top: 8rpx; +} + +.card-subTitle-l { + color: rgba(23, 26, 29, 0.60); +} + +.ssimList-title { + font-size: 32rpx; + white-space: nowrap; +} \ No newline at end of file diff --git a/pages/agreement/index.js b/pages/agreement/index.js new file mode 100644 index 0000000..dc6e889 --- /dev/null +++ b/pages/agreement/index.js @@ -0,0 +1,33 @@ +// pages/agreement/index.js +const $$ = require('../../utils/util'); + +Page({ + /** + * 页面的初始数据 + */ + data: { + contentHtml: '', + }, + + // 返回 + handleBack() { + wx.navigateBack({ + delta: 1, + }); + }, + + // 获取服务协议 + async getAgreement() { + const res = await $$.commonRequest({ url: `${$$.url.txt}agree.txt`, type: 'get' }); + if (res) { + this.setData({ contentHtml: `<pre class="pre">${res || '-'}</pre>` }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getAgreement(); + }, +}); diff --git a/pages/agreement/index.json b/pages/agreement/index.json new file mode 100644 index 0000000..e9127fa --- /dev/null +++ b/pages/agreement/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "服务协议", + "usingComponents": {} +} diff --git a/pages/agreement/index.wxml b/pages/agreement/index.wxml new file mode 100644 index 0000000..902f402 --- /dev/null +++ b/pages/agreement/index.wxml @@ -0,0 +1,11 @@ +<!--服务协议--> +<scroll-view class="main" scroll-y> + <view class="content"> + <rich-text nodes="{{ contentHtml }}"></rich-text> + <view class="safeHeight" /> + </view> +</scroll-view> +<view class="back"> + <van-button bind:click="handleBack" block type="primary">返回</van-button> + <view class="safeHeight" /> +</view> diff --git a/pages/agreement/index.wxss b/pages/agreement/index.wxss new file mode 100644 index 0000000..e3a7ff0 --- /dev/null +++ b/pages/agreement/index.wxss @@ -0,0 +1,19 @@ +/* pages/agreement/index.wxss */ +.main { + height: 100%; + padding-bottom: 120rpx; +} + +.content { + padding: 24rpx var(--padding-my); + background-color: #ffffff; +} + +.back { + position: fixed; + left: 0; + right: 0; + bottom: 0; + padding: var(--padding-my); + background-color: var(--bg-color); +} diff --git a/pages/assistMediate/index.js b/pages/assistMediate/index.js new file mode 100644 index 0000000..6d58130 --- /dev/null +++ b/pages/assistMediate/index.js @@ -0,0 +1,64 @@ +// pages/assistMediate/index.js +const $$ = require('../../utils/util'); + +function searchCaseApi(submitData) { + return $$.request({ url: 'paCaseInfo/pageAssistCase', type: 'get', service: 'mediate', submitData }); +} + +Page({ + /** + * 页面的初始数据 + */ + caseId: '', + data: { + img: `${$$.url.img}assist-bg.png`, + searchValue: '', + isSeach: false, // 是否搜索 + caseData: {}, // 案件数据 + }, + + // 搜索邀请码 + handleSearch(e) { + this.setData({ searchValue: e.detail || '' }); + if (!!e.detail) { + this.searchCase(e.detail); + } else { + this.setData({ isSeach: false }); + } + }, + + // 扫描二维码 + handleScan() { + let that = this; + wx.scanCode({ + success(res) { + let caseId = $$.getQueryString(res.result, 'applyId'); + that.caseId = caseId; + that.searchCase(caseId); + }, + }); + }, + + // 查询案件 + async searchCase(submitData, type) { + $$.showLoading(); + const res = await searchCaseApi({ id: submitData, page: 1, size: 10 }); + $$.hideLoading(); + if (res.type) { + this.setData({ isSeach: true, caseData: res.data.content[0] || {} }); + } + if (type === 'onPullDownRefresh') { + $$.showToast({ title: '已是最新记录', duration: 1000 }); + wx.stopPullDownRefresh(); + } + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + if (this.data.isSeach) { + this.searchCase(this.caseId, 'onPullDownRefresh'); + } + }, +}); diff --git a/pages/assistMediate/index.json b/pages/assistMediate/index.json new file mode 100644 index 0000000..c7b438d --- /dev/null +++ b/pages/assistMediate/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "协助调解", + "usingComponents": { + "mediate-card": "../../components/mediate-card/index" + }, + "enablePullDownRefresh": true +} diff --git a/pages/assistMediate/index.wxml b/pages/assistMediate/index.wxml new file mode 100644 index 0000000..813c609 --- /dev/null +++ b/pages/assistMediate/index.wxml @@ -0,0 +1,25 @@ +<!--协助调解--> +<common-page> + <van-search + background + bind:cancel="handleSearch" + bind:search="handleSearch" + placeholder="搜索调解邀请码" + show-action="{{ searchValue ? true : false }}" + value="{{ searchValue }}" + /> + <view class="assist-main" wx:if="{{ !isSeach }}"> + <image class="assist-img" src="{{ img }}" /> + <view class="assist-title">扫一扫协助案件调解</view> + <van-button bindtap="handleScan" custom-class="btn btn-blue" icon="scan">扫一扫</van-button> + </view> + <block wx:else> + <view style="text-align: center;" wx:if="{{ !caseData.id }}"> + <van-empty description="抱歉!无该案件,请确认邀请码正确性" /> + <van-button bindtap="handleScan" custom-class="btn btn-blue" icon="scan">扫一扫</van-button> + </view> + <view class="card-box" wx:else> + <mediate-card caseindex="0" data="{{ caseData }}" pageType="1" /> + </view> + </block> +</common-page> diff --git a/pages/assistMediate/index.wxss b/pages/assistMediate/index.wxss new file mode 100644 index 0000000..431ede3 --- /dev/null +++ b/pages/assistMediate/index.wxss @@ -0,0 +1,24 @@ +/* pages/assistMediate/index.wxss */ +.assist-main { + padding: 144rpx var(--padding-my) 0; + text-align: center; + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 104rpx; +} + +.assist-img { + width: 600rpx; + height: 500rpx; + margin-left: -150rpx; +} + +.assist-title { + padding: 32rpx 0; +} + +.card-box { + padding: 32rpx var(--padding-my) 0; +} diff --git a/pages/autograph/index.js b/pages/autograph/index.js new file mode 100644 index 0000000..8058cb7 --- /dev/null +++ b/pages/autograph/index.js @@ -0,0 +1,37 @@ +// pages/autograph/index.js +const $$ = require('../../utils/util'); + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + cardData: [ + { + icon: `${$$.url.img}toBeSigned.png`, + iconActive: `${$$.url.img}toBeSigned-active.png`, + title: '待签名', + files: [], + }, + { + icon: `${$$.url.img}signed.png`, + iconActive: `${$$.url.img}signed-active.png`, + title: '已签名', + files: [], + }, + ], + activeIndex: 0, // 当前选中的材料下标 + }, + + handleChangeTab(e) { + this.setData({ + activeIndex: e.detail, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, +}); diff --git a/pages/autograph/index.json b/pages/autograph/index.json new file mode 100644 index 0000000..caf56d2 --- /dev/null +++ b/pages/autograph/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "在线签名", + "usingComponents": { + "file-card": "../../components/file-card/index" + } +} diff --git a/pages/autograph/index.wxml b/pages/autograph/index.wxml new file mode 100644 index 0000000..6d0585b --- /dev/null +++ b/pages/autograph/index.wxml @@ -0,0 +1,20 @@ +<!--在线签名--> +<common-page safeBottom="{{ false }}"> + <!-- 文件展示 --> + <view class="card" wx:for="{{ cardData[activeIndex].files }}" wx:key="index"> + <!-- 文件 --> + <file-card backgroundColor="#ffffff" fileInfoList="{{ item.fileList }}" isPreview="{{false}}" /> + </view> + <!-- 空 --> + <view class="empty"> + <van-empty description="暂无数据" image="{{ imgUrl }}empty.png" wx:if="{{ cardData[activeIndex].files.length === 0 }}" /> + </view> + <!-- tabbar --> + <van-tabbar active="{{ activeIndex }}" bind:change="handleChangeTab" myHeight="66" placeholder> + <van-tabbar-item wx:for="{{ cardData }}" wx:key="index"> + <van-icon name="{{ item.icon }}" slot="icon" /> + <van-icon name="{{ item.iconActive }}" slot="icon-active" /> + {{ item.title }} + </van-tabbar-item> + </van-tabbar> +</common-page> diff --git a/pages/autograph/index.wxss b/pages/autograph/index.wxss new file mode 100644 index 0000000..7c2f262 --- /dev/null +++ b/pages/autograph/index.wxss @@ -0,0 +1,13 @@ +/* pages/autograph/index.wxss */ +.card { + border-radius: var(--border-radius-card); + padding: 32rpx var(--padding-my) 0; +} + +.empty { + position: absolute; + top: 50%; + margin-top: -142px; + left: 0; + right: 0; +} diff --git a/pages/caseType/index.js b/pages/caseType/index.js new file mode 100644 index 0000000..7968bff --- /dev/null +++ b/pages/caseType/index.js @@ -0,0 +1,563 @@ +// pages/caseType/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + typeList: [{ + "label": "热点事项", + "value": "24_01-1", + "icon": null, + "parentId": "root", + "children": [{ + "label": "拖欠、克扣工资", + "value": "24_02-9", + "icon": 'caseType-1-18.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "租赁纠纷", + "value": "24_02-46", + "icon": 'caseType-1-15.png', + "parentId": "24_01-7", + "children": null + }, + { + "label": "婚姻家庭纠纷", + "value": "24_02-47", + "icon": 'caseType-1-2.png', + "parentId": "24_01-8", + "children": null + }, + { + "label": "邻里纠纷", + "value": "24_02-48", + "icon": 'caseType-1-3.png', + "parentId": "24_01-8", + "children": null + }, + { + "label": "金融纠纷", + "value": "24_02-6", + "icon": 'caseType-1-16.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "物流快递管理", + "value": "24_02-30", + "icon": 'caseType-1-17.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "车辆乱停放", + "value": "24_02-26", + "icon": 'caseType-1-8.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "旅游消费纠纷", + "value": "24_02-2", + "icon": 'caseType-1-2.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "食品消费纠纷", + "value": "24_02-3", + "icon": 'caseType-1-1.png', + "parentId": "24_01-1", + "children": null + }, + ] + }, { + "label": "劳动社保", + "value": "24_01-2", + "icon": null, + "parentId": "root", + "children": [{ + "label": "拖欠、克扣工资", + "value": "24_02-9", + "icon": 'caseType-1-5.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "社保费用补缴", + "value": "24_02-16", + "icon": 'caseType-1-1.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "异地就医办理", + "value": "24_02-13", + "icon": 'caseType-1-3.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "生育待遇", + "value": "24_02-12", + "icon": 'caseType-1-6.png', + "parentId": "24_01-2", + "children": null + }, + + { + "label": "养老待遇", + "value": "24_02-14", + "icon": 'caseType-1-4.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "参保流程", + "value": "24_02-17", + "icon": 'caseType-1-13.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "失业保险待遇", + "value": "24_02-15", + "icon": 'caseType-1-9.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "港澳青年来穗服务", + "value": "24_02-19", + "icon": 'caseType-1-14.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "医保个人账户", + "value": "24_02-11", + "icon": 'caseType-1-12.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "门诊及住院待遇", + "value": "24_02-10", + "icon": 'caseType-1-11.png', + "parentId": "24_01-2", + "children": null + }, + { + "label": "其他(职业技能、社保补贴等)", + "value": "24_02-18", + "icon": 'caseType-1-7.png', + "parentId": "24_01-2", + "children": null + } + ] + }, + { + "label": "城市管理", + "value": "24_01-3", + "icon": null, + "parentId": "root", + "children": [{ + "label": "施工问题", + "value": "24_02-20", + "icon": 'caseType-1-9.png', + "parentId": "24_01-3", + "children": null + }, + { + "label": "违章建筑", + "value": "24_02-21", + "icon": 'caseType-1-8.png', + "parentId": "24_01-3", + "children": null + }, + { + "label": "路桥坑洼、破损", + "value": "24_02-22", + "icon": 'caseType-1-7.png', + "parentId": "24_01-3", + "children": null + }, + { + "label": "消防隐患举报", + "value": "24_02-23", + "icon": 'caseType-1-6.png', + "parentId": "24_01-3", + "children": null + }, + { + "label": "噪声、气味、污水等环境问题", + "value": "24_02-25", + "icon": 'caseType-1-5.png', + "parentId": "24_01-3", + "children": null + }, + { + "label": "乱摆卖、垃圾清理等街面问题", + "value": "24_02-24", + "icon": 'caseType-1-4.png', + "parentId": "24_01-3", + "children": null + } + ] + }, + { + "label": "家庭邻里", + "value": "24_01-8", + "icon": null, + "parentId": "root", + "children": [{ + "label": "邻里纠纷", + "value": "24_02-48", + "icon": 'caseType-1-3.png', + "parentId": "24_01-8", + "children": null + }, + { + "label": "婚姻家庭纠纷", + "value": "24_02-47", + "icon": 'caseType-1-2.png', + "parentId": "24_01-8", + "children": null + }, + { + "label": "男女情感问题", + "value": "24_02-49", + "icon": 'caseType-1-1.png', + "parentId": "24_01-8", + "children": null + } + ] + }, + { + "label": "交通运输", + "value": "24_01-4", + "icon": null, + "parentId": "root", + "children": [{ + "label": "交通拥堵", + "value": "24_02-27", + "icon": 'caseType-1-8.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "道路违章举报", + "value": "24_02-29", + "icon": 'caseType-1-9.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "物流快递管理", + "value": "24_02-30", + "icon": 'caseType-1-10.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "驾校纠纷", + "value": "24_02-31", + "icon": 'caseType-1-11.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "车辆乱停放", + "value": "24_02-26", + "icon": 'caseType-1-12.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "电动车违规问题", + "value": "24_02-33", + "icon": 'caseType-1-13.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "出租车、公交车、站点等营运问题", + "value": "24_02-32", + "icon": 'caseType-1-14.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "交通灯、电子警察等公安设施", + "value": "24_02-28", + "icon": 'caseType-1-2.png', + "parentId": "24_01-4", + "children": null + }, + { + "label": "其他(社会治安、限行、养犬等)", + "value": "24_02-34", + "icon": 'caseType-1-1.png', + "parentId": "24_01-4", + "children": null + } + ] + }, + { + "label": "教育医疗", + "value": "24_01-5", + "icon": null, + "parentId": "root", + "children": [{ + "label": "教育事务、培训机构投诉", + "value": "24_02-35", + "icon": 'caseType-1-8.png', + "parentId": "24_01-5", + "children": null + }, + { + "label": "医疗服务", + "value": "24_02-36", + "icon": 'caseType-1-9.png', + "parentId": "24_01-5", + "children": null + } + ] + }, + { + "label": "房屋规划", + "value": "24_01-7", + "icon": null, + "parentId": "root", + "children": [{ + "label": "物业/业委会管理", + "value": "24_02-41", + "icon": 'caseType-1-1.png', + "parentId": "24_01-7", + "children": null + }, + { + "label": "不动产登记", + "value": "24_02-42", + "icon": 'caseType-1-2.png', + "parentId": "24_01-7", + "children": null + }, + { + "label": "开发商/中介纠纷", + "value": "24_02-43", + "icon": 'caseType-1-3.png', + "parentId": "24_01-7", + "children": null + }, + { + "label": "电梯加装", + "value": "24_02-44", + "icon": 'caseType-1-4.png', + "parentId": "24_01-7", + "children": null + }, + { + "label": "建设项目规划", + "value": "24_02-45", + "icon": 'caseType-1-5.png', + "parentId": "24_01-7", + "children": null + }, + { + "label": "租赁纠纷", + "value": "24_02-46", + "icon": 'caseType-1-6.png', + "parentId": "24_01-7", + "children": null + } + ] + }, + { + "label": "公共服务", + "value": "24_01-6", + "icon": null, + "parentId": "root", + "children": [{ + "label": "停水/电/气", + "value": "24_02-37", + "icon": 'caseType-1-8.png', + "parentId": "24_01-6", + "children": null + }, + { + "label": "自然灾害", + "value": "24_02-38", + "icon": 'caseType-1-9.png', + "parentId": "24_01-6", + "children": null + }, + { + "label": "个人危险行为", + "value": "24_02-40", + "icon": 'caseType-1-7.png', + "parentId": "24_01-6", + "children": null + }, + { + "label": "公共卫生安全", + "value": "24_02-39", + "icon": 'caseType-1-10.png', + "parentId": "24_01-6", + "children": null + } + ] + }, + { + "label": "市场监管", + "value": "24_01-1", + "icon": null, + "parentId": "root", + "children": [{ + "label": "金融纠纷", + "value": "24_02-6", + "icon": 'caseType-1-11.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "网购及其他消费纠纷", + "value": "24_02-5", + "icon": 'caseType-1-12.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "其他经济违法举报", + "value": "24_02-7", + "icon": 'caseType-1-13.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "食品消费纠纷", + "value": "24_02-3", + "icon": 'caseType-1-1.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "旅游消费纠纷", + "value": "24_02-2", + "icon": 'caseType-1-2.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "通讯、宽带消费纠纷", + "value": "24_02-1", + "icon": 'caseType-1-3.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "电费问题", + "value": "24_02-8", + "icon": 'caseType-1-4.png', + "parentId": "24_01-1", + "children": null + }, + { + "label": "无证/无照/冒用信息等违法经营行为举报", + "value": "24_02-4", + "icon": 'caseType-1-14.png', + "parentId": "24_01-1", + "children": null + }, + ] + } + ], + // [ + // [{ + // title: '邻里纠纷', + // value: '24_000011-1', + // imgUrl: 'caseType-1-1.png' + // }, { + // title: '拖欠、克扣工资', + // value: '24_000011-3', + // imgUrl: 'caseType-1-5.png' + // }, { + // title: '门诊及住院待遇', + // value: '24_000011-4', + // imgUrl: 'caseType-1-10.png' + // }, { + // title: '公共设施', + // imgUrl: 'caseType-1-4.png' + // }, { + // title: '施工问题', + // imgUrl: 'caseType-1-2.png' + // }, { + // title: '违章建筑', + // imgUrl: 'caseType-1-6.png' + // }, { + // title: '港澳青年来穗服务', + // imgUrl: 'caseType-1-7.png' + // }, { + // title: '乱摆卖、垃圾清理...', + // imgUrl: 'caseType-1-8.png' + // }, { + // title: '噪声、气味、污水...', + // imgUrl: 'caseType-1-9.png' + // }, { + // title: '车辆乱停放', + // imgUrl: 'caseType-1-14.png' + // }, { + // title: '出租车、公交车站...', + // imgUrl: 'caseType-1-11.png' + // }, { + // title: '电动车违规问题', + // imgUrl: 'caseType-1-12.png' + // }, { + // title: '教培机构投诉', + // imgUrl: 'caseType-1-13.png' + // }, { + // title: '物业/业委会管理', + // imgUrl: 'caseType-1-3.png' + // }] + // ], + activeKey: '0' + }, + + + onChange(e) { + this.setData({ + activeKey: e.detail + }) + }, + + + onClick(e) { + let item = e.currentTarget.dataset.item; + console.log(item); + // 获取当前页面栈 + var pages = getCurrentPages(); + // 上一个页面 + var prevPage = pages[pages.length - 2]; + // 直接设置数据对象到上一页面的data中 + prevPage.setData({ + twoData: item + }); + wx.navigateBack({ + delta: 1, + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, +}) \ No newline at end of file diff --git a/pages/caseType/index.json b/pages/caseType/index.json new file mode 100644 index 0000000..83d44e0 --- /dev/null +++ b/pages/caseType/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "选择纠纷类型", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/caseType/index.wxml b/pages/caseType/index.wxml new file mode 100644 index 0000000..ce403d2 --- /dev/null +++ b/pages/caseType/index.wxml @@ -0,0 +1,49 @@ +<!--pages/caseType/index.wxml--> +<view class="ssimList"> + <!-- 搜索 --> + <view class="card"> + <view class="cell"> + <view class="cell-right"> + <view style="display: flex;gap:20rpx"> + <van-icon name="search" /> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0;background-color:#f2f3f5" data-key="keyword" placeholder="输入关键词查找纠纷类型" value="{{ search.keyword }}" /> + </view> + <view style="display: flex;"> + <view style="color:#E5E6EB;margin-right: 16rpx;">|</view> + <view bindtap="searchButton" class="public-color">查询</view> + </view> + </view> + </view> + </view> + + <!-- 主体 --> + <view class='caseType-main'> + <view class="sidebar"> + <van-sidebar active-key="{{ activeKey }}" bind:change="onChange"> + <van-sidebar-item wx:for="{{typeList}}" title="{{item.label}}" /> + <!-- <van-sidebar-item title="市场监管" /> + <van-sidebar-item title="劳动社保" /> + <van-sidebar-item title="城市管理" /> + <van-sidebar-item title="交通运输" /> + <van-sidebar-item title="教育医疗" /> + <van-sidebar-item title="公共服务" /> + <van-sidebar-item title="房屋规划" /> --> + </van-sidebar> + </view> + <view class="grid"> + <van-grid border="{{ false }}" column-num="3"> + <van-grid-item bind:click='onClick' class="van-grid-item" data-item="{{item}}" use-slot wx:for="{{typeList[activeKey].children }}" wx:for-item="item"> + <view class="grid-flex"> + <view class="grid-img"> + <image src="{{imgUrl}}{{item.icon}}" mode="" /> + </view> + <view class="grid-title"> + {{item.label}} + </view> + </view> + </van-grid-item> + </van-grid> + </view> + + </view> +</view> \ No newline at end of file diff --git a/pages/caseType/index.wxss b/pages/caseType/index.wxss new file mode 100644 index 0000000..6a98199 --- /dev/null +++ b/pages/caseType/index.wxss @@ -0,0 +1,131 @@ +/* pages/caseType/index.wxss */ + + +.cell-left { + display: flex; + width: 28%; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; +} + +.cell-left-l { + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: var(--font-size-md, 14px); +} + +.cell-right { + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; + font-size: var(--font-size-md, 14px); +} + +.card-box { + padding: 24rpx 24rpx 0 24rpx; +} + +.card { + border-radius: 2px; + background-color: #ffffff; + padding: 24rpx; +} + +.card-list { + border-radius: 2px; + background-color: #fff; + padding: 24rpx +} + +.ssim-scroll { + flex: 1; + overflow: hidden; +} + +.card-title { + font-size: 30rpx; + line-height: 46rpx; +} + +.card-subTitle { + padding-top: 8rpx; +} + +.card-subTitle-l { + color: rgba(23, 26, 29, 0.60); +} + +.ssimList { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + left: 0; + right: 0; +} + +.sidebar { + background: #f2f2f2; +} + +.sidebar .van-sidebar { + width: 216rpx; +} + +.sidebar .van-sidebar-item--selected { + border-color: var(--main-color); + border-width: 8rpx; +} + +.sidebar .van-sidebar-item--selected { + background-color: #fff !important; +} + +.grid { + background-color: #fff; + width: 100%; +} + +.grid-flex { + display: flex; + flex-direction: column; + align-items: center; +} + +.grid-img { + width: 128rpx; + height: 128rpx; + background-color: #eff8ff; + display: flex; + justify-content: center; + align-items: center; +} + +.grid-img image { + width: 64rpx; + height: 64rpx; +} + +.grid-title { + font-size: 28rpx; + line-height: 44rpx; + text-align: center; +} + +.caseType-main { + display: flex; + flex: 1; +} + +.caseType-main .van-sidebar-item { + background-color: #f2f2f2; +} \ No newline at end of file diff --git a/pages/classicCase/index.js b/pages/classicCase/index.js new file mode 100644 index 0000000..1ed84c1 --- /dev/null +++ b/pages/classicCase/index.js @@ -0,0 +1,185 @@ +// pages/classicCase/index.js +const $$ = require('../../utils/util'); + + + + +function getCaseInfoApi(submitData) { + return $$.request({ + url: 'guide/getCaseCpwsDetai', + submitData, + type: 'get', + v1: true, + service: 'mediate' + }); +} + +// 评价 +function rateApi(submitData) { + return $$.request({ + url: 'guideRatings/saveGuideRatings', + submitData, + type: 'post', + v1: true, + service: 'mediate' + }); +} + + + +Page({ + + /** + * 页面的初始数据 + */ + data: { + region:'', + guideCaseTitle: '', + guideText: '', + judgmentDate:'', + caseSimilarity: '', + showModal: false, + rate: '', + NewguideId: '' + + }, + + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options,'options') + const cpwsCaseInfoId = options.guideInfoId; + const cpwsCaseTextId = options.guideId; + this.setData({ + NewguideId: cpwsCaseTextId + }); + + this._classicCase(cpwsCaseInfoId, cpwsCaseTextId); + }, + + async _classicCase(cpwsCaseInfoId, cpwsCaseTextId) { + $$.showLoading(); + + const res = await getCaseInfoApi({ + cpwsCaseInfoId, + cpwsCaseTextId + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + console.log('Data:', data); + this.setData({ + ...data, + guideText: data.fullText || '', + guideCaseTitle: data.caseName || '', + region:data.region||'', + judgmentDate:data.judgmentDate||'', + caseSimilarity: data.caseSimilarity || '', + }); + + } + }, + + openPopup() { + if (this.data.hasEvaluated) { + $$.showToast({ + title: "不可重复评价" + }); + } else { + this.setData({ + showModal: !this.data.showModal // 显示弹出框 + }); + } + }, + + // _r() { + // this.setData({ + // showModal: false, + // hasEvaluated: true + // }); + // $$.showToast({ + // title: "评价完成" + // }); + // }, + + onRateChange(event) { + console.log('event', event.detail); + this.setData({ + rate: event.detail + }) + }, + + async submitCase() { + $$.showLoading(); + const res = await rateApi({ + serviceId: this.data.NewguideId, + rating: this.data.rate, + }); + $$.hideLoading(); + if (res.type) { + $$.showToast({ + icon: 'success', + title: '感谢您的评价' + }); + this.setData({ + showModal: !this.data.showModal // 显示弹出框 + }); + } + + }, + + + + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/classicCase/index.json b/pages/classicCase/index.json new file mode 100644 index 0000000..c5856d6 --- /dev/null +++ b/pages/classicCase/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "navigationBarTitleText": "典型案例", + "usingComponents": { + "ellipsis-text": "/components/ellipsis-text/index", + "van-rate": "../../components/vant/rate", + "time-format": "../../components/time-format/index" + + } +} \ No newline at end of file diff --git a/pages/classicCase/index.wxml b/pages/classicCase/index.wxml new file mode 100644 index 0000000..a8d6dc9 --- /dev/null +++ b/pages/classicCase/index.wxml @@ -0,0 +1,43 @@ +<!--pages/classicCase/index.wxml--> + + +<common-page> + <!-- <view class="header">{{guideCaseTitle}}</view> --> + <view class="headerTitle"> + <ellipsis-text content="{{guideCaseTitle}}" fontsize="32" line="1" style="max-width: 28px;" /> + </view> + + <view class="subTitleBox"> + <view class="subTitle">{{region}} | + <time-format format="YYYY-MM-DD" value="{{judgmentDate}}" /> + </view> + <!-- <image class="img" src="/img/Like_1.png" catch:tap="openPopup"></image> --> + + <view> + <image class="img" src="/img/Like_1.png" catch:tap="openPopup" style="margin-right: 16px;"></image> + </view> + </view> + <view style="margin: 12px 16px 21px 16px;"> + <text decode="{{true}}" style="display: block; "> {{ guideText }} + </text> + </view> + + <view class="popup-box" wx:if="{{showModal}}"> + <view class="overBox"> + <view class="judgment">推荐内容评价</view> + <view class="help">推荐内容对您有什么帮助吗?</view> + <view class="star"> + <van-rate v-model="value" :size="24" bind:change="onRateChange" color="rgba(255,146,0,1)" void-icon="star" void-color="#eee" gutter="16px" /> + </view> + <view class="buttonBox"> + <view class="think" catch:tap="openPopup"> + 我再想想 + </view> + <view class="judgmentFinish" catch:tap="submitCase"> + 评价完成 + </view> + </view> + + </view> + </view> +</common-page> \ No newline at end of file diff --git a/pages/classicCase/index.wxss b/pages/classicCase/index.wxss new file mode 100644 index 0000000..9c3e024 --- /dev/null +++ b/pages/classicCase/index.wxss @@ -0,0 +1,101 @@ +/* pages/classicCase/index.wxss */ + +.header { + font-size: 16px; + display: flex; + font-weight: bolder; + justify-content: center; + margin-top: 12px; + margin-bottom: 8px; +} + +.subTitleBox { + color: rgba(0, 0, 0, 0.6); + margin: 0 16px; + display: flex; + border-bottom: 1px dashed rgba(0, 0, 0, 0.20); + justify-content: space-between; +} + +.subTitle { + font-size: 12px; + margin-right: 120px; + margin-bottom: 12px; + +} + +.img { + height: 12px; + width: 12px; + margin-right: 4px; +} + +.headerTitle { + max-width: 500px; + margin: 12px 60px 0px 60px; + font-weight: 600; +} + +.popup-box { + position: fixed; + z-index: 100; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.5); + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +.overBox { + background-color: #fff; + width: 300px; + z-index: 101; + position: absolute; + box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.16); + border-radius: 8px; +} + +.judgment { + font-size: 17px; + line-height: 24px; + display: flex; + justify-content: center; + margin-top: 20px; +} + +.help { + color: rgba(23, 26, 29, 0.6); + font-size: 14px; + margin: 12px 20px; +} + +.star { + z-index: 102; + margin: 0px 20px 16PX 20PX; +} + +.buttonBox { + display: flex; + border-top: 1px solid rgba(126, 134, 142, 0.16); + height: 48px; + font-size: 17px; +} + +.think { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + border-right: 1px solid rgba(126, 134, 142, 0.16); +} + +.judgmentFinish { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + color: rgba(209, 2, 28, 1); +} \ No newline at end of file diff --git a/pages/course/index.js b/pages/course/index.js new file mode 100644 index 0000000..c4a5ddd --- /dev/null +++ b/pages/course/index.js @@ -0,0 +1,74 @@ +// pages/course/index.js +const $$ = require('../../utils/util'); + +// 获取案件历程 +function getCourseApi(url, submitData) { + return $$.request({ url, submitData, type: 'get', service: 'mediate' }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + pageType: '', //1为调解历程页面、2为司法历程页面 + contentData: {}, + }, + + // + async _getCourseData(options, modelData) { + let url, params; + if (options.pageType === '1') { + url = 'paCaseInfo/getCourse'; + params = { caseId: options.id }; + } else if (options.pageType === '2') { + url = 'paJudicInfo/getCourse'; + params = { judicId: options.id }; + } + $$.showLoading(); + const res = await getCourseApi(url, params); + $$.hideLoading(); + if (res.type) { + res.data.applyTime = $$.timeFormat(res.data.applyTime); + this.setData({ + pageType: options.pageType, + contentData: res.data, + }); + } + }, + + // 查看附件 + onCheck(e) { + let idx = e.currentTarget.dataset.fileidx; + let fileItem = this.data.contentData.fileInfoList[idx]; + let type = fileItem.cat; + let url = $$.baseUrl + $$.url.fileShowUrl + fileItem.id; + $$.openFiles(type, url, [url]); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + wx.setNavigationBarTitle({ + title: options.pageType === '1' ? '调解历程' : '司法确认历程', + }); + let adjustModel = [ + { title: '调解案号:', value: 'caseNo' }, + { title: '申请渠道:', value: 'sourceName' }, + { title: '申请时间:', value: 'applyTime' }, + { title: '申请人:', value: 'plaintiffs' }, + { title: '被申请人:', value: 'defendants' }, + ]; + let judicialModel = [ + { title: '司法确认案号:', value: 'judicNo' }, + { title: '申请时间:', value: 'applyTime' }, + { title: '调解组织:', value: 'applyUnitName' }, + { title: '申请人:', value: 'plaintiffs' }, + { title: '被申请人:', value: 'defendants' }, + ]; + let con = options.pageType === '1' ? adjustModel : judicialModel; + this._getCourseData(options, con); + }, +}); diff --git a/pages/course/index.json b/pages/course/index.json new file mode 100644 index 0000000..50292bd --- /dev/null +++ b/pages/course/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} diff --git a/pages/course/index.wxml b/pages/course/index.wxml new file mode 100644 index 0000000..294114e --- /dev/null +++ b/pages/course/index.wxml @@ -0,0 +1,270 @@ +<!--pages/course/index.wxml--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<!--调解历程 or 司法确认历程--> +<common-page> + <view class="course" wx:if="{{contentData.courseInfoList}}"> + <view class="course-item" wx:if="{{ contentData.fileInfoList && contentData.fileInfoList.length!=0}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg course-item-imgBg-color"> + <image class="course-item-img" src="{{ imgUrl }}link2.png" /> + </view> + <view class="course-item-flex-box"> + <view class="course-item-flex" wx:for="{{ contentData.fileInfoList }}" wx:key="index"> + <view style="font-weight:600;">{{(item.name&&item.suffix)? item.name+'.'+item.suffix : '附件信息'}}</view> + <van-button bind:click="onCheck" custom-class="course-button" data-fileidx="{{index}}" plain type="primary">查看</van-button> + </view> + </view> + </view> + + <!-- 司法step --> + <block wx:for="{{ contentData.courseInfoList}}" wx:if="{{ pageType==2 }}" wx:key="index"> + <!-- 提交申请 --> + <view class="course-item" wx:if="{{item.process == 1}}"> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}{{item.status==2?'writing.png':'seleted.png'}}" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">{{item.applyContent || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 待开始 --> + <view class="course-item" wx:if="{{item.process == 2}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}{{item.status==2?'seal.png':'seleted.png'}}" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content"> + 预约司法确认时间: + <time-format value="{{ item.orderStartTime }}" />~ + <time-format value="{{ item.orderEndTime }}" /> + </view> + <view class="course-item-content-content">预约司法确认地点:{{item.meetAddr || '-'}}</view> + <view class="course-item-content-content">预约司法确认方式:{{item.meetWayName || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 进行中 --> + <view class="course-item" wx:if="{{item.process == 3}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}{{item.status==2?'clock.png':'seleted.png'}}" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">司法确认地点:{{item.meetAddr || '-'}}</view> + <view class="course-item-content-content">司法确认方式:{{item.meetWayName || '-'}}</view> + <view class="course-item-content-content">房间号:{{item.roomNo || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 已结束 --> + <view class="course-item" wx:if="{{item.process == 4}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}seleted.png" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">受理法院:{{item.courtName || '-'}}</view> + <view class="course-item-content-content">承办法官:{{item.judgeName || '-'}}</view> + <view class="course-item-content-content"> + 司法确认结果: + <text style="color: {{ item.judicResult === '22_00028-1' ? '#07c160' : '#ee0a24' }};">{{item.judicResultName || '-'}}</text> + </view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 不予受理 --> + <view class="course-item" wx:if="{{item.process == 5}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}fail.png" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">受理法院:{{item.courtName || '-'}}</view> + <view class="course-item-content-content">承办法官:{{item.judgeName || '-'}}</view> + <view class="course-item-content-content">终止原因:{{item.errorContent || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 异常终止 --> + <view class="course-item" wx:if="{{item.process == 6}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}fail.png" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">受理法院:{{item.courtName || '-'}}</view> + <view class="course-item-content-content">承办法官:{{item.judgeName || '-'}}</view> + <view class="course-item-content-content">终止原因:{{item.errorContent || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 子节点 --> + <view class="course-item" wx:for="{{ item.childList }}" wx:for-item="childItem" wx:if="{{ item.childList}}" wx:key="index"> + <view class="course-item-divider" /> + <view class="course-item-imgBg-2 {{item.status==1 && 'course-item-imgBg-color'}}" /> + <view class="course-item-content"> + <view class="course-item-content-title">{{ childItem.title || '-' }}</view> + <block wx:if="{{ childItem.type==1}}"> + <view class="course-item-content-content">受理法院:{{childItem.courtName || '-'}}</view> + <view class="course-item-content-content">承办法官:{{childItem.judgeName || '-'}}</view> + </block> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + </block> + + <!-- 调解step --> + <block wx:for="{{ contentData.courseInfoList }}" wx:if="{{ pageType==1 }}" wx:key="index"> + <!-- 提交申请 --> + <view class="course-item" wx:if="{{item.process == 1}}"> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}{{item.status==2?'writing.png':'seleted.png'}}" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">申请渠道:{{item.sourceName || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 待调解 --> + <view class="course-item" wx:if="{{item.process == 2}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}{{item.status==2?'seal.png':'seleted.png'}}" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content"> + 预约调解时间: + <time-format value="{{ item.orderStartTime }}" />~ + <time-format value="{{ item.orderEndTime }}" /> + </view> + <view class="course-item-content-content">预约调解地点:{{item.meetAddr || '-'}}</view> + <view class="course-item-content-content">预约调解方式:{{item.meetWayName || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 调解中 --> + <view class="course-item" wx:if="{{item.process == 3}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}{{item.status==2?'clock.png':'seleted.png'}}" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">调解地点:{{item.meetAddr || '-'}}</view> + <view class="course-item-content-content">调解方式:{{item.meetWayName || '-'}}</view> + <view class="course-item-content-content">房间号:{{item.roomNo || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 调解结束 --> + <view class="course-item" wx:if="{{item.process == 4}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}seleted.png" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">调解组织:{{item.mediateUnitName || '-'}}</view> + <view class="course-item-content-content">调解员:{{item.mediator || '-'}}</view> + <view class="course-item-content-content"> + 调解结果: + <text style="color: {{ item.mediResult === '22_00025-1' ? '#07c160' : '#ee0a24' }};">{{item.mediResultName || '-'}}</text> + </view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 不予受理 --> + <view class="course-item" wx:if="{{item.process == 5}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}fail.png" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">调解组织:{{item.mediateUnitName || '-'}}</view> + <view class="course-item-content-content">调解员:{{item.mediator || '-'}}</view> + <view class="course-item-content-content">终止原因:{{item.errorContent || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 异常终止 --> + <view class="course-item" wx:if="{{item.process == 6}}"> + <view class="course-item-divider" /> + <view class="course-item-imgBg {{item.status==1 && 'course-item-imgBg-color'}}"> + <image class="course-item-img" src="{{ imgUrl }}fail.png" /> + </view> + <view class="course-item-content"> + <view class="course-item-content-title">{{item.title || '-'}}</view> + <view class="course-item-content-content">调解组织:{{item.mediateUnitName || '-'}}</view> + <view class="course-item-content-content">调解员:{{item.mediator || '-'}}</view> + <view class="course-item-content-content">终止原因:{{item.errorContent || '-'}}</view> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + + <!-- 子节点 --> + <view class="course-item" wx:for="{{ item.childList }}" wx:for-item="childItem" wx:if="{{ item.childList}}" wx:key="index"> + <view class="course-item-divider" /> + <view class="course-item-imgBg-2 {{item.status==1 && 'course-item-imgBg-color'}}" /> + <view class="course-item-content"> + <view class="course-item-content-title">{{ childItem.title }}</view> + <block wx:if="{{ childItem.type==1}}"> + <view class="course-item-content-content">调解组织:{{childItem.mediateUnitName || '-'}}</view> + <view class="course-item-content-content">调解员:{{childItem.mediator || '-'}}</view> + </block> + <view class="course-item-content-content"> + <time-format value="{{ item.finishTime }}" /> + </view> + </view> + </view> + </block> + </view> +</common-page> diff --git a/pages/course/index.wxss b/pages/course/index.wxss new file mode 100644 index 0000000..ee01c2e --- /dev/null +++ b/pages/course/index.wxss @@ -0,0 +1,110 @@ +/* pages/course/index.wxss */ +@import '../../styles/public_components.wxss'; + +.course { + padding: 24rpx 32rpx; + padding-bottom: 0; + background-color: #ffffff; + margin: 0 var(--padding-my); + border-radius: var(--border-radius-card); + margin-top: 24rpx; +} + +.course .course-button { + width: auto; + height: 40rpx; + font-size: 24rpx; + line-height: 40rpx; + border-radius: 22rpx; + padding: 0 16rpx; + margin-left: 16rpx; +} + +.course-item { + display: flex; + position: relative; + padding-bottom: 24rpx; +} + +.course-item-divider { + position: absolute; + background-color: rgba(0, 0, 0, 0.2); + width: 2rpx; + height: 100%; + left: 17rpx; + top: 17rpx; +} + +.course-item-imgBg { + position: relative; + height: 36rpx; + width: 36rpx; + border-radius: 50%; + background-color: #8c8c8c; + display: flex; + align-items: center; + justify-content: center; + margin: 2rpx 0; +} + +.course-item-imgBg-color { + background-color: var(--main-color); +} + +.course-item-imgBg-2 { + position: relative; + height: 36rpx; + width: 36rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin: 2rpx 0; +} + +.course-item-imgBg-2::after { + content: ''; + position: absolute; + width: 20rpx; + height: 20rpx; + background-color: #8c8c8c; + left: 50%; + top: 50%; + margin-left: -10rpx; + margin-top: -10rpx; + border-radius: 50%; +} + +.course-item-img { + width: 24rpx; + height: 24rpx; +} + +.course-item-content { + flex: 1; + padding-left: 16rpx; +} + +.course-item-content-title { + font-weight: 600; +} + +.course-item-content-content { + font-weight: 24rpx; + line-height: 40rpx; + color: var(--second-text-color); +} + +.course-item-flex-box { + flex: 1; +} + +.course-item-flex { + flex: 1; + display: flex; + padding-left: 16rpx; +} + +.card-cell-title { + max-width: 6.2em; +} diff --git a/pages/evaluate/index.js b/pages/evaluate/index.js new file mode 100644 index 0000000..77922fd --- /dev/null +++ b/pages/evaluate/index.js @@ -0,0 +1,97 @@ +// pages/evaluate/index.js +const $$ = require('../../utils/util'); +const app = getApp(); +import Toast from '../../components/vant/toast/toast'; + +function saveCaseApi(submitData) { + return $$.request({ + url: 'caseEvaluate/saveCaseEvaluate', + type: 'post', + submitData, + service: 'mediate', + }); +} +Page({ + + /** + * 页面的初始数据 + */ + data: { + data: [false, false, false, false, false, false], + dataName: [{ + value: true, + label: '工作人员态度好' + }, { + value: false, + label: '办理效率高' + }, { + value: false, + label: '工作人员认真负责' + }, { + value: false, + label: '结案严谨' + }, { + value: false, + label: '结案结果符合预期' + }, { + value: false, + label: '处理方式符合预期' + }] + }, + + onChange(e) { + let key = e.currentTarget.dataset.key; + this.data.dataName[key].value = e.detail; + console.log('e.detail', e.detail); + this.setData({ + dataName: this.data.dataName + }) + }, + + inputonChange(e) { + let key = e.currentTarget.dataset.key; + this.setData({ + [key]: e.detail + }) + }, + + + // 提交评价 + async handleNext() { + let arr = this.data.dataName.filter(item => (item.value === true)); + let newData = { + caseId: this.data.id, + evaluateGrade: this.data.evaluateGrade, + evaluateRemark: arr?.length > 0 ? arr?.map(i => i.label).join(',') : '', + evaluateContent: this.data.evaluateContent, //评价建议 + } + + $$.showLoading(); + const res = await saveCaseApi(newData); + $$.hideLoading(); + if (res.type) { + Toast('提交成功'); + wx.navigateBack({ + delta: 1, + success: function (res) { + // 返回页面刷新接口 + wx.emitEvent('getUserInfo', {}); + } + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let { + id + } = options; + this.setData({ + id + }) + }, + + +}) \ No newline at end of file diff --git a/pages/evaluate/index.json b/pages/evaluate/index.json new file mode 100644 index 0000000..6d3321e --- /dev/null +++ b/pages/evaluate/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "去评价", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/evaluate/index.wxml b/pages/evaluate/index.wxml new file mode 100644 index 0000000..96574bd --- /dev/null +++ b/pages/evaluate/index.wxml @@ -0,0 +1,39 @@ +<!--pages/evaluate/index.wxml--> +<view class="card"> + <view class="flex"> + <view class="cell3"> + <view class="cell-title-placeholder">评价等级</view> + <view class=""> + <van-rate value="{{ evaluateGrade }}" size="{{ 18 }}" color="#ffd21e" void-icon="star" void-color="#eee" data-key="evaluateGrade" bind:change="inputonChange" /> + </view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">评语</view> + <view> + <view class="view-flex"> + <view class="view-flex-1">工作人员态度好<van-checkbox value="{{ dataName[0].value }}" data-key="0" data-name="工作人员态度好" bind:change="onChange" icon-size="18px"></van-checkbox> + </view> + <view class="view-flex-1">办理效率高<van-checkbox value="{{ dataName[1].value }}" data-key="1" data-name="办理效率高" bind:change="onChange" icon-size="18px"></van-checkbox> + </view> + <view class="view-flex-1">工作人员认真负责<van-checkbox value="{{ dataName[2].value }}" data-key="2" data-name="工作人员认真负责" bind:change="onChange" icon-size="18px"></van-checkbox> + </view> + <view class="view-flex-1">结案严谨<van-checkbox value="{{ dataName[3].value }}" data-key="3" data-name="结案严谨" bind:change="onChange" icon-size="18px"></van-checkbox> + </view> + <view class="view-flex-1">结案结果符合预期<van-checkbox value="{{ dataName[4].value }}" data-key="4" data-name="结案结果符合预期" bind:change="onChange" icon-size="18px"></van-checkbox> + </view> + <view class="view-flex-1">处理方式符合预期<van-checkbox value="{{ dataName[5].value }}" data-key="5" data-name="处理方式符合预期" bind:change="onChange" icon-size="18px"></van-checkbox> + </view> + </view> + <view class="cell-item"> + <van-field custom-style="padding:0 20rpx;line-height:90rpx" autosize="{{ { maxHeight: 110, minHeight: 110 } }}" bind:change="inputonChange" border="{{ false }}" maxlength='500' data-key="evaluateContent" placeholder="如果有其他意见或建议,请反馈给我们" type="textarea" value="{{ evaluateContent }}" /> + </view> + </view> + </view> + </view> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <van-button bind:click="handleNext" block data-type="next" type="primary">提交评价</van-button> + <view class="safeHeight" /> + </view> + </view> +</view> \ No newline at end of file diff --git a/pages/evaluate/index.wxss b/pages/evaluate/index.wxss new file mode 100644 index 0000000..64b85f3 --- /dev/null +++ b/pages/evaluate/index.wxss @@ -0,0 +1,69 @@ +/* pages/evaluate/index.wxss */ + +.card { + display: flex; + flex-direction: column; +} + +.flex { + flex: 1; + padding: 24rpx; + background-color: #fff; +} + +.cell-title-placeholder { + margin-bottom: 8rpx; +} + +.cell3 { + margin-bottom: 24rpx; +} + +.view-flex { + display: flex; + gap: 32rpx; + flex-wrap: wrap; + justify-content: space-between; +} + +.view-flex-1 { + width: 47%; + height: 76rpx; + border: 1px solid #1a6fb8; + border-radius: 4px; + text-align: center; + /* padding: 16rpx 16rpx; */ + font-size: 28rpx; + line-height: 44rpx; + display: flex; + align-items: center; + justify-content: center; + gap: 24rpx; +} + +.cell-item { + margin-top: 32rpx; + padding: 16rpx 0; + background: #f2f3f5; + border-radius: 8px; +} + +.cell-item .van-cell { + background-color: #f2f3f5; +} + +.flex-view { + margin-bottom: 24rpx; +} + + +.submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + padding: 32rpx var(--padding-my); + background-color: #fff; + z-index: 99; +} \ No newline at end of file diff --git a/pages/findAdjust/index.js b/pages/findAdjust/index.js new file mode 100644 index 0000000..15e77ea --- /dev/null +++ b/pages/findAdjust/index.js @@ -0,0 +1,264 @@ +/* pages/findAdjust/index.js */ +const $$ = require('../../utils/util'); + +// 获取调解类型 +function getMediateTypeApi() { + return $$.request({ url: 'ctUser/getMediUnitType', type: 'get', service: 'cust' }); +} + +// 获取调解员 or 调解组织数据 +function getListDataApi(param) { + return $$.request({ url: 'ctUser/pageFindMediate', type: 'get', submitData: param, service: 'cust' }); +} + +function getSaveGuessDataApi(param) { + return $$.request({ url: 'paUser/updatePaUser', type: 'POST', submitData: param || {}, service: 'cust' }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + selectModel: [ + { + name: '全部', + key: 'type', + data: [ + { label: '全部', value: '', span: 24 }, + { label: '调解员', value: '1' }, + { label: '调解组织', value: '2' }, + ], + }, + { + name: '擅长', + key: 'goodField', + data: [ + { label: '擅长', value: '', span: 24 }, + {label: '劳动纠纷', value: '22_00039-0001'}, + {label: '合同纠纷', value: '22_00039-0002'}, + {label: '借贷纠纷', value: '22_00039-0003'}, + {label: '邻里纠纷', value: '22_00039-0004'}, + {label: '家庭婚姻纠纷', value: '22_00039-0005'}, + {label: '机动车交通事故责任纠纷', value: '22_00039-0006'}, + {label: '医疗损伤责任纠纷', value: '22_00039-0007'}, + {label: '侵害商标权纠纷', value: '22_00039-0008'}, + {label: '经济纠纷', value: '22_00039-0018'}, + {label: '所有权纠纷', value: '22_00039-0009'}, + {label: '继承纠纷', value: '22_00039-0010'}, + {label: '人格权纠纷', value: '22_00039-0011'}, + {label: '股权转让纠纷', value: '22_00039-0012'}, + {label: '财产损害赔偿纠纷', value: '22_00039-0013'}, + {label: '建设用地使用权纠纷', value: '22_00039-0014'}, + {label: '土地承包经营权确认纠纷', value: '22_00039-0015'}, + {label: '承包地征收补偿费用分配纠纷', value: '22_00039-0016'}, + {label: '其他', value: '22_00039-0017'}, + ], + }, + { + name: '调解类型', + key: 'unitId', + data: [], + }, + ], + showGuessDialog: false, + guessModel: [ + { + value: '22_00039-0001', + label: '劳动纠纷', + isChoose: false, + }, + { + value: '22_00039-0002', + label: '合同纠纷', + isChoose: false, + }, + { + value: '22_00039-0003', + label: '借贷纠纷', + isChoose: false, + }, + { + value: '22_00039-0004', + label: '邻里纠纷', + isChoose: false, + }, + { + value: '22_00039-0005', + label: '家庭婚姻纠纷', + isChoose: false, + }, + { + value: '22_00039-0006', + label: '机动车交通事故责任纠纷', + isChoose: false, + }, + { + value: '22_00039-0007', + label: '医疗损伤责任纠纷', + isChoose: false, + }, + { + value: '22_00039-0008', + label: '侵害商标权纠纷', + isChoose: false, + }, + { + value: '22_00039-0018', + label: '经济纠纷', + isChoose: false, + }, + { + value: '22_00039-0009', + label: '所有权纠纷', + isChoose: false, + }, + { + value: '22_00039-0010', + label: '继承纠纷', + isChoose: false, + }, + { + value: '22_00039-0011', + label: '人格权纠纷', + isChoose: false, + }, + { + value: '22_00039-0012', + label: '股权转让纠纷', + isChoose: false, + }, + { + value: '22_00039-0013', + label: '财产损害赔偿纠纷', + isChoose: false, + }, + { + value: '22_00039-0014', + label: '建设用地使用权纠纷', + isChoose: false, + }, + { + value: '22_00039-0015', + label: '土地承包经营权确认纠纷', + isChoose: false, + }, + { + value: '22_00039-0016', + label: '承包地征收补偿费用分配纠纷', + isChoose: false, + }, + { + value: '22_00039-0017', + label: '其他', + isChoose: false, + }, + ], + search: { + page: 1, + size: 20, + lng: '', //经度 + lat: '', //纬度 + name: '', // 调解员或调解组织名字 + goodField: '', // 擅长 + type: '', // 调解员或者调解组织身份 + unitId: '', + }, + loading: false, // 滚动到底部分页的加载状态 + data: [], // 数据 + total: 0, // 总数 + }, + + // 搜索 + handleSearch(e) { + this.getListData({ ...this.data.search, name: e.detail || '' }); + }, + + // 筛选 + handleScreen(e) { + let value = e.detail; + this.getListData({ ...this.data.search, goodField: value.goodField, type: value.type, unitId: value.unitId, page: 1 }); + }, + + // 找他调 + onFindAdjust(e) { + const idx = e.currentTarget.dataset.index; + const { type, id, name } = this.data.data[idx]; + if ($$.userTest('realName')) { + wx.navigateTo({ url: `../../pages/register/index?type=${type}&id=${id}&name=${name}` }); + } + }, + + // 帮我推荐 + onConfirm() {}, + + // 暂不选择 + onClose() { + this.setData({ showGuessDialog: false }); + }, + + // 滚动到底部获取数据 + handlescrolltolower() { + if (this.data.data.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ loading: this.data.loading }); + let submitData = { ...this.data.search }; + submitData.page = submitData.page + 1; + this.getListData(submitData); + } + }, + + // 获取列表数据 + async getListData(submitData) { + $$.showLoading(); + const res = await getListDataApi(submitData); + $$.hideLoading(); + if (this.data.loading) { + // 取消滚动底部的加载状态 + this.setData({ loading: false }); + } + if (res.type) { + if (submitData.page === 1) { + this.data.data = res.data.content || []; + } else { + this.data.data = this.data.data.concat(res.data.content || []); + } + this.setData({ search: submitData, data: this.data.data, total: res.data.totalElements || 0 }); + } + }, + + // 获取调解类型 + async getMediateType(type) { + $$.showLoading(); + const res = await getMediateTypeApi(); + $$.hideLoading(); + let unitId = ''; + let selectModel = this.data.selectModel[2]; + if (res.type) { + selectModel.data.push({ label: '全部', value: 'all', span: 24, children: [{ label: '不限', value: '' }] }); + let arr = res.data?.unitType?.map((x, t) => { + return { label: x.label, value: x.value, span: 24, children: x.children }; + }); + selectModel.data = selectModel.data.concat(arr); + selectModel.name = res.data?.selectName || '调解类型'; + unitId = res.data?.selectValue || ''; + } + this.setData({ selectModel: this.data.selectModel }); + this.getListData({ ...this.data.search, unitId, type }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (options.type) { + this.data.selectModel[0].name = options.type === '1' ? '调解员' : '调解组织'; + this.setData({ selectModel: this.data.selectModel }); + } + this.getMediateType(options.type || ''); + }, +}); diff --git a/pages/findAdjust/index.json b/pages/findAdjust/index.json new file mode 100644 index 0000000..6588b4a --- /dev/null +++ b/pages/findAdjust/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "找调解", + "usingComponents": { + "drop-down-select": "../../components/drop-down-select/index", + "common-page": "../../components/common-page/index" + } +} \ No newline at end of file diff --git a/pages/findAdjust/index.wxml b/pages/findAdjust/index.wxml new file mode 100644 index 0000000..8f0f68e --- /dev/null +++ b/pages/findAdjust/index.wxml @@ -0,0 +1,69 @@ +<!-- 调解员 and 调解组织页面 --> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<common-page> + <view class="findAdjust"> + <van-search background bind:cancel="handleSearch" bind:search="handleSearch" placeholder="搜索" show-action="{{ search.name ? true : false }}" value="{{ search.name }}" /> + + <view style="margin-top: 16rpx;"> + <drop-down-select class="findAdjust-drop" bind:ongetvalue="handleScreen" data="{{ selectModel }}" active="{{ search }}" menuTextAlign /> + </view> + + <van-empty description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="findAdjust-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view bindtap="onFindAdjust" data-index="{{listIdx}}" class="find-adjust-list-item" wx:for="{{data}}" wx:for-index="listIdx" wx:for-item="listItem" wx:key="listIdx"> + <view class="avatar-img-box"> + <image alt="头像" class="avatar-img" src="{{listItem.avatar || imgUrl + (listItem.type == 2 ? 'mediation-organization.png' : 'man.png')}}" /> + </view> + <view class="list-item-right"> + <view class="avatar-name">{{listItem.name}}</view> + <view class="avatar-subTitle"> + <view>累计调解{{ listItem.countCase || '0' }}件</view> + <view class="avatar-subTitle-divider"></view> + <view>{{ listItem.addr }}</view> + </view> + <view class="avatar-subTitle avatar-subTitle-tagBox"> + <view style="margin-right: 8rpx;margin-bottom: 8rpx;">擅长调解</view> + <view class="avatar-subTitle-tag" wx:for="{{ wxs.strArr(listItem.goodFieldName) }}" wx:key="index">{{ item }}</view> + </view> + <view class="list-item-btn"> + <image alt class="find-icon" src="{{imgUrl}}mediate-active.png" srcset /> + <text>找他调</text> + </view> + </view> + </view> + <block> + <van-divider contentPosition="center" custom-style="margin-top: 0;" wx:if="{{ data.length >= total && data.length !== 0 }}">已加载全部数据</van-divider> + <view style="text-align: center;" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> + +<!-- TODO: 功能屏蔽,此功能暂无作用 --> +<van-popup bind:close="onClose" closeable custom-style="max-height: 90%" position="bottom" round show="{{ showGuessDialog }}" title="猜您关注" zIndex="999"> + <view class="guess-main"> + <view class="guess-subTitle">选择您关注的纠纷类型,平台将为您推荐匹配的调解资源,以帮助您尽快调解成功!</view> + <view> + <van-row gutter="23"> + <van-col span="{{ index < 12 ? 12 : 24 }}" wx:for="{{ guessModel }}" wx:key="index"> + <view bindtap="onChooseMyTag" class="guess-item {{ item.isChoose && 'guess-item-active' }}" data-index="{{ index }}" data-label="{{ item.label }}" data-value="{{ item.value }}"> + <text>{{ item.label }}</text> + <view class="guess-check" wx:if="{{ item.isChoose }}"> + <van-icon name="checked" size="18" /> + </view> + </view> + </van-col> + </van-row> + </view> + </view> + <view class="popup-bottom-button"> + <van-button bind:click="onConfirm" block type="primary">帮我推荐</van-button> + <view class="safeHeight" /> + </view> +</van-popup> \ No newline at end of file diff --git a/pages/findAdjust/index.wxss b/pages/findAdjust/index.wxss new file mode 100644 index 0000000..ad5a66a --- /dev/null +++ b/pages/findAdjust/index.wxss @@ -0,0 +1,139 @@ +/* pages/findAdjust/index.wxss */ +.findAdjust { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + left: 0; + right: 0; +} + +.findAdjust-scroll { + flex: 1; + overflow: hidden; + padding: 24rpx; +} + +.find-adjust-list-item { + position: relative; + background-color: #ffffff; + padding: 32rpx; + border-radius: var(--border-radius-card-sm); + margin-bottom: 16rpx; + display: flex; +} + +.find-adjust-list-item:last-child { + margin-bottom: 0; +} + +.find-adjust-list-item:last-child { + margin-bottom: 0; +} + +.avatar-img-box { + height: 116rpx; + width: 116rpx; + margin-right: 32rpx; +} + +.avatar-img { + width: 100%; + height: 100%; +} + +.list-item-right { + flex: 1; + overflow: hidden; +} + +.avatar-name { + font-weight: 550; + margin-bottom: 16rpx; +} + +.avatar-subTitle { + color: var(--second-text-color); + font-size: 24rpx; + line-height: 24rpx; + margin-bottom: 16rpx; + display: flex; + flex-wrap: wrap; +} + +.avatar-subTitle-divider { + margin: 0 8rpx; + width: 2rpx; + background-color: var(--border-color); +} + +.avatar-subTitle-tagBox { + margin-bottom: 8rpx; + align-items: center; +} + +.avatar-subTitle-tag { + padding: 8rpx; + background: rgba(0, 0, 0, 0.1); + border-radius: 4rpx; + margin-right: 8rpx; + margin-bottom: 8rpx; +} + +.list-item-btn { + padding: 6rpx; + border-radius: 6rpx; + border: 2rpx solid var(--main-color); + font-size: 22rpx; + line-height: 22rpx; + color: var(--main-color); + display: inline-block; +} + +.find-icon { + width: 20rpx; + height: 20rpx; + margin-right: 8rpx; +} + +.guess-subTitle { + padding: 32rpx 0; +} + +.guess-main { + margin-bottom: 146rpx; + padding: 0 32rpx; +} + +.guess-item { + position: relative; + border: 2rpx solid rgba(0, 0, 0, 0.2); + border-radius: 40rpx; + text-align: center; + padding: 24rpx 0; + line-height: 28rpx; + margin-bottom: 32rpx; +} + +.guess-item-active { + border-color: var(--main-color); + color: var(--main-color); + background-color: var(--red-1); +} + +.guess-check { + position: absolute; + top: -16rpx; + right: 0; + color: var(--main-color); + background: #fff; + border-radius: 50%; +} + +.guess-bottom .btn:first-child { + margin-right: 32rpx; +} + +.drop-down-select-submenu { + overflow: hidden !important; +} \ No newline at end of file diff --git a/pages/floatImagePage/index.js b/pages/floatImagePage/index.js new file mode 100644 index 0000000..3d8ff1c --- /dev/null +++ b/pages/floatImagePage/index.js @@ -0,0 +1,663 @@ +/* + * @Company: hugeInfo + * @Author: lwh + * @Date: 2025-04-15 20:04:56 + * @LastEditTime: 2025-04-18 11:11:09 + * @LastEditors: lwh + * @Version: 1.0.0 + * @Description: + */ +const app = getApp(); + +const $$ = require('../../utils/util'); + +// 详情接口 +function getByIdApi(param) { + return $$.request({ + url: 'caseInfo/getCaseInfo', + type: 'get', + submitData: param || {}, + service: 'mediate', + }); +} + +// 获取用户信息 +function getUserInfoApi() { + return $$.request({ + url: 'paUser/personal', + type: 'get', + service: 'cust', + }); +} + +function getawApi(submitData) { + return $$.request({ + url: 'case-law/get-law', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} +// 获取案例 +function getCaseApi(submitData) { + return $$.request({ + url: 'case-law/get-case', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} + +// 获取调解策略 +function getMediateStrategypi(submitData) { + return $$.request({ + url: 'case-law/getMediateStrategy', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} + +// AI对话接口 +function getStreamChatApi(submitData) { + return $$.request({ + url: 'case-law/streamChat', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} + +Page({ + recordMannager: wx.getRecorderManager(), + data: { + chatList: [], + inputValue: '', + scrollToView: '', + userInfo: {}, + imageUrl: $$.url.img, + imgUrl: app.globalData.imgUrl, + demoImgUrl: $$.url.img + 'Aimge.png', + demoAIImgUrl: $$.url.img + '1.gif', + typingMessage: null, + typingIndex: 0, + typingTimer: null, + isTyping: false, + isRecording: false, + showModal: false, //按住说话显示 + recordManager: null, + caseId: '', // 案件ID + caseDes: '', // 案件描述 + isCardExpanded: false, // 控制卡片展开/收起状态 + }, + + onLoad(options) { + // 接收传入的参数 + this.getById(options); + + // 初始化录音管理器 + this.recordManager = wx.getRecorderManager(); + + // 监听录音结束事件 + this.recordManager.onStop((res) => { + this.setData({ + isRecording: false, + }); + if (res.duration < 1000) { + wx.showToast({ + title: '录音时间太短', + icon: 'none', + }); + return; + } + + // 调用语音识别接口 + wx.showLoading({ + title: '识别中...', + }); + + // 这里需要替换为实际的语音识别接口 + // 模拟语音识别结果 + setTimeout(() => { + wx.hideLoading(); + this.setData({ + inputValue: '这是一段模拟的语音识别结果', + }); + }, 1500); + }); + }, + + // 获取纠纷案件详情 + async getById(props) { + $$.showLoading(); + const res = await getByIdApi({ + id: props.caseId, + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + submitData: data, + oneList: [...data.personList, ...data.agentList], + caseId: props.caseId, + }); + this.getFilesId(data.id); + } + }, + + // 开始录音 + startRecord() { + this.setData({ + isRecording: true, + }); + this.recordManager.start({ + duration: 60000, // 最长录音时间 + sampleRate: 16000, + numberOfChannels: 1, + encodeBitRate: 48000, + format: 'mp3', + }); + }, + + // 停止录音 + stopRecord() { + this.recordManager.stop(); + }, + + // 获取用户信息 + async getUserInfo() { + $$.showLoading(); + const res = await getUserInfoApi(); + $$.hideLoading(); + if (res.type) { + this.setData({ + userInfo: res.data, + }); + } + }, + + // 输入框内容变化 + onInputChange(e) { + this.setData({ + inputValue: e.detail.value, + }); + }, + + // 发送消息 + async sendMessage() { + const { inputValue, chatList } = this.data; + if (!inputValue.trim()) return; + + // 清空相关数据 + this.setData({ + caseData: [], + AIData: [], + chatList: [], + }); + + // 添加用户消息 + this.addMessage('user', inputValue); + + // 清空输入框 + this.setData({ + inputValue: '', + }); + + // 调用AI对话接口 + const res = await getStreamChatApi({ + // caseText: this.data?.submitData?.caseDes, + caseText: + '在广州市白云区松洲街松南菜市场,张平云因隔壁档口苏振昌把泡沫箱摆在其档口旁边,双方因泡沫箱摆放位置发生纠纷,苏振昌故意损坏了张平云档口的灯泡,张平云报警求助。民警将双方带回派出所进行调解。', + query: inputValue, + // conversationId: this.data.caseId, + }); + + if (res.type) { + // this.setData({ + // chatList: [...chatList, { type: 'ai', content: res.data, time: new Date().getTime() }], + // }); + } + + // 模拟AI回复 + setTimeout(() => { + this.startTyping('感谢您的咨询,我会尽快为您解答。'); + }, 1000); + }, + + // 开始逐字显示 + startTyping(content) { + // 清除之前的定时器 + if (this.data.typingTimer) { + clearInterval(this.data.typingTimer); + } + + // 设置正在打字状态 + this.setData({ + isTyping: true, + }); + + // 添加一条空消息 + const newMessage = { + type: 'ai', + content: '', + time: new Date().getTime(), + }; + + // 只保留最新的两条消息 + const chatList = [...this.data.chatList, newMessage].slice(-2); + this.setData({ + chatList, + typingMessage: content, + typingIndex: 0, + }); + + // 开始逐字显示 + const timer = setInterval(() => { + const { typingIndex, typingMessage, chatList } = this.data; + if (typingIndex < typingMessage.length) { + const newContent = typingMessage.substring(0, typingIndex + 1); + // 更新最后一条消息的内容 + const updatedChatList = [...chatList]; + updatedChatList[updatedChatList.length - 1].content = newContent; + this.setData({ + chatList: updatedChatList, + typingIndex: typingIndex + 1, + }); + + // 减少滚动频率,只在段落结束或每30个字符时滚动一次 + if (typingIndex % 30 === 0 || typingMessage.charAt(typingIndex) === '\n' || typingIndex === typingMessage.length - 1) { + this.scrollToBottom(false); + } + } else { + clearInterval(timer); + this.setData({ + typingMessage: null, + typingIndex: 0, + typingTimer: null, + isTyping: false, + }); + + // 完成打字后滚动到底部(使用平滑滚动) + this.scrollToBottom(true); + } + }, 50); + + this.setData({ + typingTimer: timer, + }); + }, + + // 添加消息 + addMessage(type, content) { + const { chatList } = this.data; + const newMessage = { + type, + content, + time: new Date().getTime(), + }; + + // 只保留最新的两条消息 + const newChatList = [...chatList, newMessage].slice(-2); + + this.setData({ + chatList: newChatList, + scrollToView: `msg-${newChatList.length - 1}`, + }); + + // 自动滚动到底部 + this.scrollToBottom(); + }, + + // 滚动到底部 + scrollToBottom(smooth = true) { + setTimeout(() => { + // 设置滚动位置 + this.setData({ + scrollToView: 'card-bottom', + }); + + // 阻止频繁滚动引起的抖动 + if (!this._scrollDebounce) { + this._scrollDebounce = true; + setTimeout(() => { + this._scrollDebounce = false; + }, 300); + } + }, 50); + }, + + // 录音结束触发 + _endRecord(e) { + this._transferText(e); + }, + + touchStart(e) { + let that = this; + wx.getSetting({ + success(res) { + if (res.authSetting['scope.record'] === false) { + $$.hideLoading(); + $$.showModal({ + content: '抱歉!此功能需授权麦克风录音功能', + confirmText: '跳转授权', + success: (res) => { + if (res.confirm) { + wx.openSetting({ + success(res) { + if (res.authSetting['scope.record']) { + $$.showToast({ + title: '授权成功', + }); + } else { + $$.showToast({ + title: '授权失败', + }); + } + }, + }); + } + }, + }); + return false; + } + that.setData({ + showModal: true, + }); + // 开始说话 + const options = { + duration: 60000, + sampleRate: 16000, + numberOfChannels: 1, + encodeBitRate: 96000, + format: 'pcm', + }; + that.recordMannager.start(options); + that.recordMannager.onStart(() => console.log('开始录音')); + that.recordMannager.onError((e) => { + console.log('onError', e); + $$.showToast({ + title: '抱歉!录音时间过短,请重新录入', + }); + that.setData({ + second: 60, + showModal: false, + }); + }); + }, + }); + }, + + touchEnd() { + let that = this; + that.recordMannager.onStop((e) => that._endRecord(e)); + that.recordMannager.stop(); + that.setData({ + showModal: false, + }); + console.log('结束录音'); + }, + + // 语音转文字 + _transferText(e) { + console.log('开始识别', e); + $$.showLoading(); + let speakUrl = e.tempFilePath; + let that = this; + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/wechat/xfyun/speech`, + filePath: speakUrl, + name: 'fileNames', + header: { + Authorization: app.globalData.token, + }, + complete(res) { + $$.hideLoading(); + if (res.errMsg === 'uploadFile:ok') { + const { code, data, msg } = JSON.parse(res.data); + if (code === '0' || code === 0) { + that.setData({ + inputValue: that.data.inputValue + data || '', + // number: (that.data.value + data || '').length, + }); + } else { + $$.showToast({ + icon: 'error', + title: msg, + }); + } + } else { + $$.showToast({ + icon: 'error', + title: '录音转写失败', + }); + } + }, + }); + }, + + // 返回上一页 + handleBack() { + wx.navigateBack(); + }, + + onShow() { + this.getUserInfo(); + // 添加欢迎消息,使用逐字显示效果 + setTimeout(() => { + this.startTyping('您好,我是解纷数智人,有什么可以帮您?'); + }, 500); + }, + + onUnload() { + // 清除定时器 + if (this.data.typingTimer) { + clearInterval(this.data.typingTimer); + } + }, + + // 处理快捷按钮点击 + async handleQuickButton(e) { + const { type } = e.currentTarget.dataset; + let message = ''; + + // 清空相关数据 + this.setData({ + caseData: [], + AIData: [], + chatList: [], + }); + + switch (type) { + case 'case': + message = '请帮我推荐一些类似的案例'; + break; + case 'law': + message = '请提供相关的法律条文'; + break; + case 'strategy': + message = '请给出调解策略建议'; + break; + } + + // 添加用户消息 + this.addMessage('user', message); + + try { + // 模拟AI回复 + if (type === 'case') { + const res = await getCaseApi({ + caseClaim: this.data?.submitData?.caseClaim, + caseDes: this.data?.submitData?.caseDes, + caseId: this.data?.caseId, + }); + if (res.type) { + if (!res.data || res.data.length === 0) { + this.startTyping('抱歉,未找到相似的案例。'); + return; + } + // 先显示正在分析的提示 + await this.startTypingPromise('正在为您分析相似案例...\n\n'); + // 设置数据并逐字显示 + this.setData({ + caseData: res.data, + }); + // 构建要显示的文本 + const caseText = `为您找到${res.data.length}个相似案例,请点击查看详情。`; + await this.startTypingPromise(caseText); + } else { + this.startTyping('抱歉,获取案例信息失败,请稍后重试。'); + } + } + + if (type === 'law') { + const res = await getawApi({ + caseId: this.data.caseId, + }); + if (res.type) { + if (!res.data || res.data.length === 0) { + this.startTyping('抱歉,未找到相关的法律条文。'); + return; + } + // 先显示正在分析的提示 + await this.startTypingPromise('正在为您查找相关法条...\n\n'); + // 设置数据并逐字显示 + this.setData({ + AIData: res.data, + }); + // 构建要显示的文本 + const lawText = `为您找到${res.data.length}条相关法律条文,请展开查看详情。`; + await this.startTypingPromise(lawText); + } else { + this.startTyping('抱歉,获取法律条文失败,请稍后重试。'); + } + } + + if (type === 'strategy') { + // 先展示提示信息 + await this.startTypingPromise('正在为您分析调解策略...\n\n'); + + // 调用接口获取数据 + const res = await getMediateStrategypi({ + caseText: this.data?.submitData?.caseDes, + // caseId: this.data.caseId, + }); + + // 展示接口返回的数据 + if (res.type) { + // 确保上一条消息已完全展示后再显示新消息 + setTimeout(() => { + this.startTyping(res.data || ''); + }, 500); + } else { + setTimeout(() => { + this.startTyping('抱歉,获取调解策略失败,请稍后重试。'); + }, 500); + } + } + } catch (error) { + console.error('请求失败:', error); + this.startTyping('抱歉,服务器出现异常,请稍后重试。'); + } + }, + + // 返回Promise的逐字显示方法 + startTypingPromise(content) { + return new Promise((resolve) => { + // 清除之前的定时器 + if (this.data.typingTimer) { + clearInterval(this.data.typingTimer); + } + + // 设置正在打字状态 + this.setData({ + isTyping: true, + }); + + // 添加一条空消息 + const newMessage = { + type: 'ai', + content: '', + time: new Date().getTime(), + }; + + // 只保留最新的两条消息 + const chatList = [...this.data.chatList, newMessage].slice(-2); + this.setData({ + chatList, + typingMessage: content, + typingIndex: 0, + }); + + // 开始逐字显示 + const timer = setInterval(() => { + const { typingIndex, typingMessage, chatList } = this.data; + if (typingIndex < typingMessage.length) { + const newContent = typingMessage.substring(0, typingIndex + 1); + // 更新最后一条消息的内容 + const updatedChatList = [...chatList]; + updatedChatList[updatedChatList.length - 1].content = newContent; + this.setData({ + chatList: updatedChatList, + typingIndex: typingIndex + 1, + }); + + // 减少滚动频率,只在段落结束或每30个字符时滚动一次 + if (typingIndex % 30 === 0 || typingMessage.charAt(typingIndex) === '\n' || typingIndex === typingMessage.length - 1) { + this.scrollToBottom(false); + } + } else { + clearInterval(timer); + this.setData({ + typingMessage: null, + typingIndex: 0, + typingTimer: null, + isTyping: false, + }); + + // 完成打字后滚动到底部(使用平滑滚动) + this.scrollToBottom(true); + resolve(); // 完成打字效果后解析Promise + } + }, 50); + + this.setData({ + typingTimer: timer, + }); + }); + }, + + // 打开折叠法条 + lawClick(e) { + let item = e.currentTarget.dataset.item; + let index = e.currentTarget.dataset.index; + this.setData({ + AIData: this.data.AIData.map((i, idx) => ({ + ...i, + show: idx === index ? (i.show ? false : true) : false, + })), + }); + }, + + // 跳转案例详情 + caseClick(e) { + let url = e.currentTarget.dataset.url; + let caseId = e.currentTarget.dataset.caseid; + let caseType = e.currentTarget.dataset.casetype; + let caseName = e.currentTarget.dataset.casename; + + wx.navigateTo({ + url: url + '?caseId=' + caseId + '&type=' + caseType + '&caseName=' + caseName, + }); + }, + + // 切换卡片展开/收起状态 + toggleCard() { + this.setData({ + isCardExpanded: !this.data.isCardExpanded, + }); + }, +}); diff --git a/pages/floatImagePage/index.json b/pages/floatImagePage/index.json new file mode 100644 index 0000000..87473a1 --- /dev/null +++ b/pages/floatImagePage/index.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "解纷数智人", + "usingComponents": { + "van-icon": "@vant/weapp/icon/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index" + } +} \ No newline at end of file diff --git a/pages/floatImagePage/index.wxml b/pages/floatImagePage/index.wxml new file mode 100644 index 0000000..bef0dd6 --- /dev/null +++ b/pages/floatImagePage/index.wxml @@ -0,0 +1,176 @@ +<!-- 悬浮图片页面 --> +<view class="float-image-page"> + <!-- 案件信息卡片 --> + <view class="case-info-card"> + <view class="card-title" bindtap="toggleCard"> + <!-- <image src="/static/images/case-icon.png" class="case-icon"></image> --> + <text>案件信息</text> + <view class="expand-icon {{isCardExpanded ? 'expanded' : ''}}"></view> + </view> + <view class="card-content {{isCardExpanded ? 'expanded' : ''}}"> + <!-- 基本信息,始终显示 --> + <view class="info-item"> + <text class="label">案件编号:</text> + <text class="value">{{submitData.caseNo || '--'}}</text> + </view> + <!-- 展开后显示的详细信息 --> + <block wx:if="{{isCardExpanded}}"> + <view class="divider"></view> + <view class="info-item"> + <text class="label">纠纷类型:</text> + <text class="value">{{submitData.caseTypeName || '--'}}</text> + </view> + <view class="info-item"> + <text class="label">纠纷地点:</text> + <text class="value">{{submitData.addr || '--'}}</text> + </view> + <view class="info-item"> + <text class="label">事项概况:</text> + <text class="value">{{submitData.caseDes || '--'}}</text> + </view> + <view class="info-item"> + <text class="label">事项申请:</text> + <text class="value">{{submitData.caseClaim || '--'}}</text> + </view> + </block> + </view> + </view> + + <view class="float-image-page-content"> + <!-- 聊天记录区域 --> + <scroll-view + scroll-y + class="{{isCardExpanded ? 'chat-list1' : 'chat-list' }}" + scroll-into-view="{{scrollToView}}" + scroll-with-animation="{{true}}" + enable-passive="{{true}}" + enable-back-to-top="{{true}}" + bounces="{{false}}" + refresher-enabled="{{false}}" + show-scrollbar="{{false}}" + scroll-anchoring="{{true}}"> + <block wx:for="{{chatList}}" wx:key="index"> + <!-- AI消息 --> + <view class="chat-item ai" wx:if="{{item.type === 'ai'}}" id="msg-{{index}}"> + <!-- <image class="avatar" src="{{demoImgUrl}}" /> --> + <view style="padding-left: 24rpx;"></view> + <view class="message"> + <view class="message-content">{{item.content}}</view> + </view> + </view> + <!-- 用户消息 --> + <view class="chat-item user" wx:if="{{item.type === 'user'}}" id="msg-{{index}}"> + <view class="user-message-container"> + <view class="message"> + <view class="message-content">{{item.content}}</view> + </view> + <image class="avatar" src="{{userInfo.avatar || imgUrl}}" /> + </view> + </view> + </block> + <view class="card" id="card-bottom"> + <view class="card_main"> + <block wx:if="{{caseData.length>0}}"> + <view class="caseList_head"> + <van-icon size="22" name="/img/AIAide_1.png" />为您推荐与申请相似的典型案例({{caseData.length}}) + </view> + <view class="caseList" bindtap="caseClick" data-caseId="{{item.caseId}}" data-caseName="{{item.caseName}}" data-caseType="{{item.caseType}}" data-url="../../pages/AIAideDetail/index" wx:for="{{caseData}}" wx:key="index"> + <view class="caseList_flex"> + <text class="ellipsis">{{item.caseName}}</text> + <view class="cell-arrow"> + <van-icon color="#1A6FB8" size="14" name="arrow" /> + </view> + </view> + <!-- <view class="caseList_title">相似度:{{'-'}}% | 发生地:广东省 广州市</view> --> + </view> + </block> + <block wx:if="{{AIData.length>0}}"> + <view class="line"></view> + <view class="caseList_head"> + <van-icon size="22" name="/img/AIAide_2.png" />为您推荐与申请相关的专业法条({{AIData.length}}) + </view> + <view class="caseList" wx:for="{{AIData}}" wx:key="index"> + <view bindtap="lawClick" data-item="{{item}}" data-index="{{index}}" class="caseList_flex"> + <text class="ellipsis">《{{item.lawTitle}}》{{item.lawIndex}}</text> + <view wx:if="{{item.show}}" class="cell-arrow"> + <van-icon color="#1A6FB8" size="14" name="arrow-down" /> + </view> + <view wx:else class="cell-arrow"> + <van-icon color="#1A6FB8" size="14" name="arrow-up" /> + </view> + </view> + <view wx:if="{{item.show}}" class="show-line"> + + </view> + <view wx:if="{{item.show}}" class="show-Law"> + {{item.lawDesc}} + </view> + </view> + <view class="assess"> + <van-icon size="18" name="/img/AIAide_4.png" bindtap="showEvaluationPopup" /> + </view> + </block> + <!-- <view wx:if="{{caseData.length}}" class="flex_end">以上内容均由人工智能模型生成,其生成内容的准确性和完整性无法保证,不代表我们的态度或观点</view> --> + <view wx:if="{{caseData.length}}" class="flex_end"></view> + </view> + </view> + </scroll-view> + + <!-- 动图展示区域 --> + <view class="gif-container"> + <image class="gif-image" src="{{isTyping ? demoAIImgUrl : demoImgUrl}}" /> + <view class="quick-buttons"> + <view class="quick-button" bindtap="handleQuickButton" data-type="case">类案推荐</view> + <view class="quick-button" bindtap="handleQuickButton" data-type="law">相关法条</view> + <view class="quick-button" bindtap="handleQuickButton" data-type="strategy">调解策略</view> + </view> + </view> + + <!-- 输入区域 --> + <view class="input-area"> + <view bindtouchstart="touchStart" bindtouchend="touchEnd" class="voice-btn"> + <image src="{{imageUrl}}voiceOcr.png" mode="" /> + </view> + <view class="input-wrapper"> + <input class="input-field" value="{{ inputValue }}" placeholder="请输入您的问题" bindinput="onInputChange" /> + <view class="send-btn" bindtap="sendMessage" wx:if="{{inputValue}}">发送</view> + </view> + </view> + </view> + + <view wx:if="{{showModal}}" class="modal-card"> + <!-- <image class="modal-img" src="{{imgUrl}}speechToText.png" mode="" /> --> + <view class="recording"> + <!-- 语音动画 --> + <block> + <view class="time-box"> + <view class="time-box-top"> + <view class="hr hr1" /> + <view class="hr hr2" /> + <view class="hr hr3" /> + <view class="hr hr4" /> + <view class="hr hr5" /> + <view class="hr hr6" /> + <view class="hr hr7" /> + <view class="hr hr8" /> + <view class="hr hr9" /> + <view class="hr hr10" /> + </view> + <view class="time-box-bottom"> + <view class="hr hr1" /> + <view class="hr hr2" /> + <view class="hr hr3" /> + <view class="hr hr4" /> + <view class="hr hr5" /> + <view class="hr hr6" /> + <view class="hr hr7" /> + <view class="hr hr8" /> + <view class="hr hr9" /> + <view class="hr hr10" /> + </view> + </view> + <view class="recording-title">松开结束,上滑取消</view> + </block> + </view> + </view> +</view> \ No newline at end of file diff --git a/pages/floatImagePage/index.wxss b/pages/floatImagePage/index.wxss new file mode 100644 index 0000000..99dfc5a --- /dev/null +++ b/pages/floatImagePage/index.wxss @@ -0,0 +1,711 @@ +.float-image-page { + min-height: 100vh; + background-color: #fff; + display: flex; + flex-direction: column; +} + +.float-image-page-header { + display: flex; + align-items: center; + padding: 20rpx; + border-bottom: 1rpx solid #eee; + position: fixed; + top: 0; + left: 0; + right: 0; + background: #fff; + z-index: 100; +} + +.float-image-page-title { + flex: 1; + text-align: center; + font-size: 32rpx; + font-weight: bold; +} + +.float-image-page-content { + flex: 1; + display: flex; + flex-direction: column; + padding-bottom: 120rpx; +} + +.chat-list { + flex: 1; + padding-top: 24rpx; + max-height: 50vh; + overflow-y: auto; +} + +.chat-list1 { + flex: 1; + padding-top: 24rpx; + max-height: calc(50vh - 294rpx); + overflow-y: auto; +} + +.chat-item { + display: flex; + margin-bottom: 30rpx; + align-items: flex-start; +} + +.chat-item .avatar { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + margin: 0 20rpx; +} + +.chat-item .message { + max-width: 60%; +} + +.chat-item .message-content { + padding: 20rpx; + border-radius: 10rpx; + font-size: 28rpx; + line-height: 1.5; + position: relative; +} + +.chat-item.ai .message-content { + background-color: #fff; + color: #333; + border: 1rpx solid #eee; + box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05); +} + +.chat-item.ai .message-content::before { + content: ''; + position: absolute; + left: -8rpx; + top: 20rpx; + width: 16rpx; + height: 16rpx; + background: #fff; + transform: rotate(45deg); + border-left: 1rpx solid #eee; + border-bottom: 1rpx solid #eee; +} + +.chat-item.user { + justify-content: flex-end; + padding-right: 20rpx; +} + +.user-message-container { + display: flex; + align-items: flex-start; + justify-content: flex-end; +} + +.user-message-container .message { + margin-right: 20rpx; +} + +.user-message-container .avatar { + margin: 0; +} + +.chat-item.user .message-content { + background-color: #1A6FB8; + color: #fff; +} + +.chat-item.user .message-content::before { + content: ''; + position: absolute; + right: -8rpx; + top: 20rpx; + width: 16rpx; + height: 16rpx; + background: #1A6FB8; + transform: rotate(45deg); +} + +.input-area { + position: fixed; + bottom: 0; + left: 0; + right: 0; + padding: 16rpx 24rpx; + background: #fff; + border-top: 1rpx solid #eee; + display: flex; + align-items: center; + gap: 20rpx; +} + +.voice-btn { + width: 56rpx; + height: 56rpx; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.voice-btn image { + width: 40rpx; + height: 40rpx; +} + +.input-wrapper { + flex: 1; + height: 72rpx; + background: #f5f5f5; + border-radius: 36rpx; + display: flex; + align-items: center; + padding-left: 24rpx; +} + +.input-field { + flex: 1; + height: 72rpx; + font-size: 28rpx; + background: transparent; + line-height: 72rpx; +} + +.send-btn { + color: #fff; + background-color: #1A6FB8; + border-radius: 0 36rpx 36rpx 0; + font-size: 28rpx; + padding: 0 24rpx; + border-left: 1rpx solid #ddd; + height: 72rpx; + line-height: 72rpx; + display: flex; + align-items: center; +} + +.send-btn:active { + opacity: 0.8; +} + +.gif-container { + position: absolute; + left: 24rpx; + bottom: 180rpx; + width: auto; + padding: 0; + display: flex; + align-items: center; +} + +.gif-image { + width: 400rpx; + height: 400rpx; + object-fit: contain; +} + +.quick-buttons { + display: flex; + flex-direction: column; + margin-left: 20rpx; + gap: 20rpx; + height: 400rpx; + justify-content: center; +} + +.quick-button { + padding: 16rpx 32rpx; + background: #fff; + border: 1px solid #1A6FB8; + color: #1A6FB8; + border-radius: 40rpx; + font-size: 28rpx; + text-align: center; + min-width: 160rpx; + box-shadow: 0 4rpx 8rpx rgba(26, 111, 184, 0.2); +} + +.quick-button:active { + opacity: 0.8; +} + +.voice-button { + width: 60rpx; + height: 60rpx; + display: flex; + align-items: center; + justify-content: center; + margin-right: 20rpx; + border-radius: 50%; + background: #f5f5f5; +} + +@keyframes pulse { + 0% { + transform: scale(1); + } + + 50% { + transform: scale(1.1); + } + + 100% { + transform: scale(1); + } +} + +.textarea-img { + display: flex; + align-items: center; + justify-content: center; + width: 64rpx; + height: 64rpx; + margin-right: 20rpx; + background: #f5f5f5; + border-radius: 50%; + padding: 12rpx; +} + +.textarea-img:active { + background: #e5e5e5; +} + +.textarea-img image { + width: 40rpx; + height: 40rpx; +} + +.time-box { + position: relative; + height: 120rpx; + left: 50%; + margin-left: -86rpx; +} + +.time-box-top { + position: absolute; + bottom: 50%; +} + +.time-box-bottom { + position: absolute; + top: 50%; + transform: rotateX(180deg); +} + +.hr { + background-color: red; + width: 10rpx; + height: 10rpx; + bottom: 0; + position: absolute; + background: #ffffff; + animation: bodong 0.5s infinite ease; + border-top-left-radius: 5rpx; + border-top-right-radius: 5rpx; +} + +.hr1 { + left: 0; + animation-delay: 1s; + animation-duration: 1s; +} + +.hr2 { + left: 18rpx; + animation-delay: 0.9s; + animation-duration: 0.9s; +} + +.hr3 { + left: 36rpx; + animation-delay: 0.8s; + animation-duration: 0.8s; +} + +.hr4 { + left: 54rpx; + animation-delay: 0.7s; + animation-duration: 0.7s; +} + +.hr5 { + left: 72rpx; + animation-delay: 0.6s; + animation-duration: 0.6s; +} + +.hr6 { + left: 90rpx; + animation-delay: 0.5s; + animation-duration: 0.5s; +} + +.hr7 { + left: 108rpx; + animation-delay: 0.7s; + animation-duration: 0.7s; +} + +.hr8 { + left: 126rpx; + animation-delay: 0.6s; + animation-duration: 0.6s; +} + +.hr9 { + left: 144rpx; + animation-delay: 0.8s; + animation-duration: 0.8s; +} + +.hr10 { + left: 162rpx; + animation-delay: 1s; + animation-duration: 1s; +} + +@keyframes bodong { + 0% { + height: 10rpx; + } + + 20% { + height: 20rpx; + } + + 30% { + height: 30rpx; + } + + 60% { + height: 60rpx; + } + + 80% { + height: 30rpx; + } + + 100% { + height: 10rpx; + } +} + +.recording { + position: absolute; + width: 350rpx; + padding: 48rpx 0; + top: 2%; + left: 50%; + margin-left: -175rpx; + text-align: center; + color: #ffffff; + font-size: 28rpx; +} + +.cell-phone .van-button { + color: var(--main-color); + border: none !important; + padding: 0 !important; +} + +.modal-img { + width: 144px; + height: 120px; +} + +.modal-card { + position: absolute; + width: 200px; + height: 140px; + background: rgba(95, 166, 212, 0.80); + color: #fff; + border-radius: 4px; + top: 40%; + left: 23%; + text-align: center; +} + +.case-info-card { + margin: 24rpx; + background: #FFFFFF; + border-radius: 12rpx; + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1); +} + +.card-title { + display: flex; + align-items: center; + padding: 20rpx 24rpx; + background: #F7F8FA; + border-bottom: 2rpx solid #E5E6EB; + position: relative; +} + +.case-icon { + width: 32rpx; + height: 32rpx; + margin-right: 12rpx; +} + +.card-title text { + font-size: 28rpx; + color: #1D2129; + font-weight: 500; + flex: 1; +} + +.expand-icon { + width: 32rpx; + height: 32rpx; + position: relative; + transition: transform 0.3s ease; +} + +.expand-icon::after { + content: ''; + position: absolute; + width: 12rpx; + height: 12rpx; + border-right: 2rpx solid #86909C; + border-bottom: 2rpx solid #86909C; + transform: rotate(45deg); + top: 6rpx; + left: 10rpx; + transition: transform 0.3s ease; +} + +.expand-icon.expanded::after { + transform: rotate(-135deg); + top: 12rpx; +} + +.card-content { + height: 0; + overflow: hidden; + transition: height 0.3s ease-in-out; + min-height: 0; + max-height: 0; +} + +.card-content.expanded { + height: auto; + padding: 20rpx 24rpx; + min-height: 294rpx; + max-height: 294rpx; + overflow-y: auto; +} + +.info-item { + display: flex; + margin-bottom: 16rpx; + line-height: 1.5; +} + +.info-item:last-child { + margin-bottom: 0; +} + +.info-item .label { + width: 160rpx; + color: #86909C; + font-size: 26rpx; + flex-shrink: 0; +} + +.info-item .value { + flex: 1; + color: #1D2129; + font-size: 26rpx; + word-break: break-all; +} + +.card { + padding: 24rpx; + height: 100%; + background-color: #fff; + position: relative; +} + +.card_main { + background-color: #F6F7FB; + border-radius: 8px; +} + +.flex_end { + /* position: fixed; + bottom: 40rpx; */ + color: rgba(23, 26, 29, 0.24); + font-size: 28rpx; + /* padding: 0 52rpx; */ + text-align: center; + padding: 24rpx 0; +} + +.caseList { + border-radius: 4px; + background-color: #fff; + padding: 24rpx; + margin: 0 24rpx 16rpx 24rpx; +} + +.caseList_flex { + display: flex; + justify-content: space-between; + margin-bottom: 8rpx; +} + +.cell-arrow { + width: 16px; + height: 16px; + background: #f6f7fb; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + padding: 6rpx; +} + +.caseList_title { + color: rgba(23, 26, 29, 0.60); + font-size: 24rpx; + line-height: 40rpx; +} + +.caseList_head { + display: flex; + gap: 8rpx; + padding: 24rpx 24rpx; + margin-top: 24rpx; +} + +.line { + border: 1px dashed #e5e6eb; + margin: 32rpx 24rpx 0; +} + +.assess { + display: flex; + gap: 32rpx; + justify-content: flex-end; + padding: 12rpx 24rpx 32rpx; +} + +.ellipsis { + overflow: hidden; + /* 确保超出容器的文本会被裁剪 */ + white-space: nowrap; + /* 保证文本在一行内显示 */ + text-overflow: ellipsis; + /* 使用省略号表示文本超出 */ +} + +.show-line { + margin: 24rpx 0; + border-top: 1px solid #F0F0F0; +} + +.show-Law { + color: var(--main-color); +} + +/* 评价弹窗样式 */ +.evaluation-popup { + position: relative; + width: 100%; +} + +.evaluation-title { + text-align: center; + font-weight: bold; + font-size: 18px; + margin-bottom: 20px; +} + +.evaluation-item { + margin-bottom: 15px; +} + +.item-title { + margin-bottom: 8px; + font-size: 14px; +} + +.stars { + display: flex; + justify-content: flex-start; + gap: 8px; +} + +.comments-area { + width: 100%; + background-color: #F5F5F5; + border-radius: 4px; + padding: 10px; +} + +.comments-area textarea { + width: 100%; + height: 80px; + font-size: 14px; + line-height: 1.5; +} + +.submit-btn { + width: 100%; + background-color: #1A6FB8; + color: white; + border-radius: 4px; + margin-top: 20px; + font-size: 16px; + height: 44px; + line-height: 44px; +} + +.close-btn { + position: fixed; + bottom: 8vh; + left: 50%; + transform: translateX(-50%); + z-index: 9999; +} + +.close-btn image { + width: 30px; + height: 30px; +} + +/* 禁止弹窗滚动 */ +.van-popup { + overflow: hidden !important; +} + +/* 自定义toast样式 */ +.custom-toast { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: rgba(51, 51, 51, 0.9); + border-radius: 8px; + padding: 16px 24px; + z-index: 10000; + opacity: 0; + transition: opacity 0.3s ease; +} + +.show-toast { + opacity: 1; +} + +.toast-content { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} + +.toast-content text { + color: #FFFFFF; + font-size: 16px; +} \ No newline at end of file diff --git a/pages/homePage/index.js b/pages/homePage/index.js new file mode 100644 index 0000000..3b6bd1c --- /dev/null +++ b/pages/homePage/index.js @@ -0,0 +1,400 @@ +// pages/homePage/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +// 咨询动态 +function getVideoAndMessageApi(param) { + return $$.request({ + url: 'paHotNews/listShow', + type: 'get', + submitData: param || {}, + service: 'sys', + noToken: true + }); +} + +// 调解资源 +function getResourseApi(param) { + return $$.request({ + url: 'ctUnit/countUnit', + type: 'get', + submitData: param || {}, + service: 'cust' + }); +} + +function loginApi(submitData) { + return $$.request({ + url: 'paAccount/tryRegister', + type: 'post', + submitData, + service: 'cust', + noToken: true + }); +} + +function registerApi(submitData) { + return $$.request({ + url: 'paAccount/empower', + type: 'post', + submitData, + service: 'cust', + noToken: true + }); +} + +Page({ + /** + * 页面的初始数据 + */ + msgCheckId: null, // 已经阅读过的提示不在弹出 + data: { + visible: true, + imgUrl: $$.url.img, + demoImgUrl: $$.url.img + 'Aimge.png', + agreementMsg: '', // 服务协议 + popupVisible: false, + banner: [{ + image: `${$$.url.img}Banner1.png`, + image1: `${$$.url.img}banner4.png` + }, { + image: `${$$.url.img}Banner2.png`, + image1: `${$$.url.img}banner3.png` + }], // 轮播图 + // banner: [`${$$.url.img}Banner1.png`, `${$$.url.img}Banner2.png`, `${$$.url.img}banner3.png`, `${$$.url.img}banner4.png`], // 轮播图 + countUnitData: {}, //化解资源 + userInfo: {}, //用户信息 + video: [], // 热门视频 + videoMore: false, + newMessage: [], // 最新资讯 + newMessageMore: false, + message: [{}], // 消息通知 + // 底部弹窗消息 + popupMsg: [{ + show: false, + type: 1, + title: '实名认证提醒', + subTitle: '您尚未通过实名认证,请尽快前往认证', + buttonText: '前往认证', + }], + }, + + // 跳转资讯链接 + goSeeMessage(e) { + let url = e.currentTarget.dataset.url; + console.log('url', url); + wx.navigateTo({ + url: '../webview/index?showUrl=' + url + }); + }, + + // 调解资源去看看 + handleNavigateTo(e) { + let type = e.currentTarget.dataset.type; + let url = e.currentTarget.dataset.url; + if (type === 'register') { + if (!$$.userTest('all', 'bottom')) { + this.setData({ + popupMsg: [{ + show: true, + type: 1, + title: '实名认证提醒', + subTitle: '您尚未通过实名认证,请尽快前往认证', + buttonText: '前往认证', + }, ], + }); + return; + } + wx.navigateTo({ + url: url, + }); + } else { + if ($$.userTest('login')) { + wx.navigateTo({ + url: '../../pages/findAdjust/index?type=' + (type === 'mediater' ? '1' : '2'), + }); + } + } + }, + + // 查看更多 + handleGetMore(e) { + let type = e.currentTarget.dataset.type; + wx.navigateTo({ + url: `../../pages/homePageInfo/index?type=${type}`, + }); + }, + + // 跳转 + _handleGoPage(e) { + let url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url, + }); + }, + + // 平台协议操作 + handleAgree(e) { + let type = e.currentTarget.dataset.type; + if (type === 'noAgree') { + this.selectComponent('#tabbar-page').loginOut(); + $$.loginOutClearData(); + } else { + // 同意协议之后退出登录后不重复弹出 + wx.setStorage({ + key: 'agreement', + data: 1 + }); + } + this.setData({ + popupVisible: false + }); + }, + + // 跳转至我的消息 + handleGoToMessageCenter() { + wx.navigateTo({ + url: '../../pages/messageCenter/index', + }); + }, + + // 关闭消息弹窗 + handleClosePopupMsg(e) { + let index = e.currentTarget.dataset.index; + this.data.popupMsg[index].show = false; + this.data.popupMsg[index].content?.forEach((x) => { + this.msgCheckId = [...(this.msgCheckId || []), x.caseId]; + }); + this.setData({ + popupMsg: this.data.popupMsg + }); + }, + + // 消息弹窗操作, TODO:跳转至详情页面的代码屏蔽,暂无用到,后续不用可删除 + handleClickPopupMsg(e) { + let value = e.currentTarget.dataset.item; + // let t = e.currentTarget.dataset.t; + if (e.currentTarget.dataset.type === 'more' && value.content.length === 1) { + return; + } + this.handleClosePopupMsg(e); + if (value.type === 1) { + wx.navigateTo({ + url: '../../pages/realNameAuthentication/index' + }); + return; + } + if (value.type === 2 || (value.type === 3 && value.content[t].meetType === '22_00020-1')) { + wx.navigateTo({ + url: '../../pages/myMediate/index' + }); + return; + } + if (value.type === 4 || (value.type === 3 && value.content[t].meetType === '22_00020-2')) { + wx.navigateTo({ + url: '../../pages/myJudicialConfirmation/index' + }); + return; + } + }, + + + // 获取首页视频资讯数据 + async getVideoAndMessage(param) { + const res = await getVideoAndMessageApi(param); + if (res.type) { + let hotVideoList = res.data.hotVideoList || []; + let hotNewsList = res.data.hotNewsList || []; + wx.setStorage({ + key: 'homePageNewMsgTime', + data: $$.timeFormat(new Date(), 'YYYY-MM-DD HH:mm:ss'), + }); + this.setData({ + video: hotVideoList.filter((item, index) => index < 2), + videoMore: hotVideoList.length > 2 ? true : false, + newMessage: hotNewsList.filter((item, index) => index < 2), + newMessageMore: hotNewsList.length > 2 ? true : false, + }); + } + }, + + // 获取首页调解资源数量 + async getResourse(param) { + const res = await getResourseApi(param); + this.setData({ + countUnitData: res.data + }); + }, + + // 获取服务协议 + async getAgreement() { + const res = await $$.commonRequest({ + url: `${$$.url.txt}agree.txt`, + type: 'get' + }); + if (res) { + this.data.popupVisible = true; + this.setData({ + popupVisible: true, + agreementMsg: `<pre class="pre">${res || '-'}</pre>` + }); + } + }, + + // 前往查看 + AiModalClick(e) { + let item = e.currentTarget.dataset.item; + wx.navigateTo({ + url: '../../pages/AIAide/index?caseDes=' + item.caseDes + '&caseClaim=' + item.caseClaim + '&caseId=' + item.caseId + }); + this.setData({ + AiModal: false + }) + }, + + // 关闭AI弹窗 + addClosePopup() { + this.setData({ + AiModal: false + }) + }, + + // 登录,获取用户信息 + async handleGetUserInfo() { + + wx.getUserProfile({ + desc: '完善用户信息', + complete(res) { + if (res.errMsg === 'getUserProfile:ok') { + wx.login({ + async success(res2) { + if (res2.code) { + const accountInfo = wx.getAccountInfoSync(); + const submitData = { + appid: accountInfo.miniProgram.appId, + code: res2.code, + avatar: res?.userInfo.avatarUrl, + encryptedData: res.encryptedData, + ivStr: res.iv, + }; + $$.showLoading(); + const res3 = await registerApi(submitData); + $$.hideLoading(); + if (res3.type) { + wx.setStorage({ + key: 'userInfo', + data: res3.data + }); + app.globalData.token = res3.data.token; + $$.showToast({ + title: '登录成功', + icon: 'success' + }); + await $$.sleep(); + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + } + } else { + $$.hideLoading(); + $$.showToast('登录失败,请稍后重试'); + } + }, + }); + } else { + $$.hideLoading(); + $$.showToast({ + title: '抱歉!授权失败' + }); + } + }, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) {}, + + onShow(options) { + if (!app.globalData.token) { + $$.showModal({ + content: '抱歉您未登录,是否前往登录?', + success: (res) => { + if (res.confirm) { + this.handleGetUserInfo(); + } + }, + }); + return; + } + // this.getUserInfo() + let userInfo = wx.getStorageSync('userInfo') || {}; + let AICase = wx.getStorageSync('AICase') || ''; + if (AICase) { + this.setData({ + AiModal: AICase + }) + wx.removeStorage({ + key: 'AICase' + }) + } + let appid = wx.getAccountInfoSync().miniProgram.appId; + this.setData({ + userInfo + }); + + + let that = this; + wx.getStorage({ + key: 'homePageNewMsgTime', + complete: (res) => { + if (that.data.video.length === 0 || !that.data.countUnitData) { + this.getVideoAndMessage({ + appid + }); + this.getResourse({ + appid + }); + return; + } + if (res.data && $$.moment().diff($$.moment(res.data), 'minute') > 60) { + this.getVideoAndMessage({ + appid + }); + this.getResourse({ + appid + }); + } + }, + }); + + // 获取弹窗信息提醒 + if (app.globalData.token) { + + if (!$$.userTest('realName', 'bottom')) { + this.setData({ + popupMsg: [{ + show: true, + type: 1, + title: '实名认证提醒', + subTitle: '您尚未通过实名认证,请尽快前往认证', + buttonText: '前往认证', + }, ], + }); + return; + } + } + }, + + onHide() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () {}, + + +}); \ No newline at end of file diff --git a/pages/homePage/index.json b/pages/homePage/index.json new file mode 100644 index 0000000..420077d --- /dev/null +++ b/pages/homePage/index.json @@ -0,0 +1,6 @@ +{ + + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} diff --git a/pages/homePage/index.wxml b/pages/homePage/index.wxml new file mode 100644 index 0000000..8c3054c --- /dev/null +++ b/pages/homePage/index.wxml @@ -0,0 +1,183 @@ +<!-- 首页 --> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<page-meta page-style="{{ popupMsg.show ? 'overflow: hidden;' : '' }}" /> + + + +<!-- 幻灯片 --> +<view class="homePage-main"> + <view class="swiper-bg"> + <swiper autoplay="{{ true }}" class="swiper" indicator-dots="{{ true }}"> + <swiper-item class="swiper-main"> + <view class="swiper-main-image"> + <image class="swiper-item" src="{{ imgUrl }}Banner1.png" /> + <image class="swiper-item1" src="{{ imgUrl }}banner4.png" /> + </view> + </swiper-item> + <swiper-item class="swiper-main"> + <view class="swiper-main-image"> + <image class="swiper-item" src="{{ imgUrl }}Banner2.png" /> + <image class="swiper-item2" src="{{ imgUrl }}banner3.png" /> + </view> + </swiper-item> + </swiper> + <view class="swiper-head"> + <view class="mediate"> + <view>你好,{{userInfo.trueName||'游客'}}</view> + <view bindtap="_handleGoPage" data-url="../../pages/me/index" wx:if="{{userInfo.realStatus===1}}" class="public-color">个人中心</view> + <view wx:else bindtap="handleNavigateTo" data-url="../../pages/realNameAuthentication/index" data-type="register" class="public-color">实名认证</view> + </view> + </view> + </view> + <view class="main"> + <view style="height: 32rpx;"> + + </view> + <!-- 服务申请 --> + <view> + <view class="main_title">服务申请</view> + <view class="flex"> + <view bindtap="handleNavigateTo" data-url="../../pages/register/index" data-type="register" class="flex_1 flex_blue"> + <view> + <view class="main_subTitle">反映诉求</view> + <!-- <view>轻松来访</view> --> + </view> + <image class="home-image" src="{{imgUrl}}home_3.png" mode="" /> + </view> + <view bindtap="handleNavigateTo" data-url="../../pages/myRegisterList/index" data-type="register" class="flex_1 flex_orange"> + <view> + <view class="main_subTitle">进度查询</view> + <!-- <view>申请进度查询</view> --> + </view> + <image class="home-image" src="{{imgUrl}}home_4.png" mode="" /> + </view> + </view> + <!-- <view class="flex marginTop_12"> + <view class="flex_1 flex_green"> + <view class="main_subTitle">事项咨询</view> + <view>解决您身边的问题</view> + </view> + </view> --> + </view> + <!-- 化解资源 --> + <view> + <view class="main_title">化解资源</view> + <view class="flex" style="gap:16rpx"> + <view class="flex_2" bindtap="_handleGoPage" data-url="../../pages/ssimList/index"> + <image class="flex_2_image" src="{{imgUrl}}home_1.png" mode="" /> + <view> + <view class="flex_zy_title">综治中心</view> + <view class="flex_num">{{countUnitData.zzUnitNum||0}}</view> + </view> + </view> + <view class="flex_2" bindtap="_handleGoPage" data-url="../../pages/organizeList/index"> + <image class="flex_2_image1" src="{{imgUrl}}home_2.png" mode="" /> + <view> + <view class="flex_zy_title">调解组织</view> + <view class="flex_num">{{countUnitData.tzUnitNum||0}}</view> + </view> + </view> + </view> + </view> + + <!-- 咨询动态 --> + <view> + <view class="flex_dt"> + <view class="main_title">资讯动态</view> + <view bindtap="handleGetMore" data-type="newMsg" wx:if="{{ newMessageMore }}" class=" flex_dt_more"> + <text>查看更多</text> + <van-icon name="arrow" size="16" /> + </view> + </view> + <view class="dt_card" bindtap="goSeeMessage" data-url="{{item.showUrl}}" wx:for="{{ newMessage }}" style="margin-top:{{index===0?0:'8px'}}" wx:key="index"> + <view class="dt_card_l"> + <view class="dt_card_title">{{item.title}}</view> + <view class="dt_card_time"> + <time-format format="YYYY-MM-DD" value="{{ item.pushTime }}" /> {{item.playNum}}人阅读 + </view> + </view> + <view class="dt_card_r"> + <image src="{{item.imageUrl}}" mode="" /> + </view> + </view> + </view> + </view> + +</view> + + +<!-- 底部弹窗 --> +<block wx:for="{{ popupMsg }}" wx:key="index"> + <van-popup bind:close="handleClosePopupMsg" closeable data-index="{{ index }}" position="bottom" round show="{{ item.show }}" title="{{ item.title || '' }}" zIndex="1000"> + <view class="homePage-popupMsg"> + <view class="homePage-popupMsg-subTitle" wx:if="{{ item.subTitle }}">{{ item.subTitle }}</view> + <image class="homePage-popupMsg-realNamePng" src="{{ imgUrl }}msg-realName.png" wx:if="{{ item.type === 1 }}" /> + <scroll-view scroll-y="{{true}}" style="max-height:600rpx" wx:elif="{{ item.type === 3 }}"> + <view bind:tap="handleClickPopupMsg" class="homePage-popupMsg-content-item" data-index="{{ index }}" data-item="{{ item }}" data-t="{{ t }}" data-type="more" wx:for="{{ item.content }}" wx:for-index="t" wx:for-item="x" wx:key="t"> + <image class="homePage-popupMsg-content-itemImg" src="{{ imgUrl }}msg-order.png" /> + <view class="homePage-popupMsg-content-itemTitle second-font"> + <view> + 预约事项:{{ x.meetWayName }} + <text class="tag tag-green-border" style="margin-left:16rpx">{{x.meetTypeName}}</text> + </view> + <view> + 预约时间:今天 + <time-format format="HH:mm" value="{{ x.orderStartTime }}" /> + <text>~</text> + <time-format format="HH:mm" value="{{ x.orderEndTime }}" /> + </view> + <view>预约地点:{{ x.meetAddr || '-' }}</view> + </view> + <van-icon name="arrow" size="16" wx:if="{{ item.content.length > 1 }}" /> + </view> + </scroll-view> + <scroll-view scroll-y="{{true}}" style="max-height:600rpx" wx:else> + <view bind:tap="handleClickPopupMsg" class="homePage-popupMsg-content-item" data-index="{{ index }}" data-item="{{ item }}" data-t="{{ t }}" data-type="more" wx:for="{{ item.content }}" wx:for-index="t" wx:for-item="x" wx:key="t"> + <image class="homePage-popupMsg-content-itemImg" src="{{ imgUrl }}msg-mediate-ing.png" /> + <view class="homePage-popupMsg-content-itemTitle"> + <view>{{ x[ item.type === 2 ? 'caseTitle' : 'judicTitle' ] || '-' }}</view> + <text class="tag tag-orange">进行中</text> + </view> + <van-icon name="arrow" size="16" wx:if="{{ item.content.length > 1 }}" /> + </view> + </scroll-view> + </view> + <view class="homePage-popupMsg-button" wx:if="{{ item.type === 1 || item.content.length === 1 }}"> + <van-button bind:click="handleClickPopupMsg" block data-index="{{ index }}" data-t="0" data-item="{{ item }}" type="primary">{{ item.buttonText }}</van-button> + </view> + </van-popup> +</block> + +<!-- AI弹窗 --> + +<van-overlay show="{{ AiModal.caseDes?true:false }}" bind:click="addClosePopup"> + +</van-overlay> + +<view wx:if="{{ AiModal.caseDes?true:false }}" class="AiModal-search"> + <view class="AiModal"> + <image src="{{imgUrl}}AICase.png" mode="" /> + <view class="AiModal-title">解纷数智人提醒您</view> + <view class="AiModal-subTitle">为了更好的帮助您解决问题,向您推荐了与您反映问题相似的典型案例和相关法条</view> + <van-button bind:click="AiModalClick" class="AiModal-button" round block data-item="{{ AiModal }}" type="primary">前往查看</van-button> + </view> +</view> + +<van-overlay show="{{ showModal }}" bind:click="addClosePopup"> + +</van-overlay> + +<view wx:if="{{ showModal }}" class="showModal-search"> + <view bindtap="searchChange" class="search"> + <view class="search-title">{{searchValue}}</view> + <van-icon size='9' name="{{imgUrl}}down.png" /> + </view> + <view class="showModal-select"> + <view class="showModal-select-title">办理进度</view> + <view bindtap="searchSelect" class="showModal-select-flex" wx:for="{{processStatusList}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view class="showModal-select-flex-text {{item.hover&& 'public-color'}}">{{item.label}}</view> + <van-icon wx:if="{{item.hover}}" size='15' name="{{imgUrl}}myRegisterList_5.png" /> + </view> + </view> +</view> \ No newline at end of file diff --git a/pages/homePage/index.wxss b/pages/homePage/index.wxss new file mode 100644 index 0000000..bf1953e --- /dev/null +++ b/pages/homePage/index.wxss @@ -0,0 +1,504 @@ +/* pages/homePage/index.wxss */ +@import '../../styles/public_components.wxss'; + +.radius { + border-radius: var(--border-radius-card); +} + +.pre { + font-size: 28rpx; + line-height: 1.5; +} + +.swiper { + height: 300rpx; +} + +.swiper-main-image { + position: relative; + height: 100%; + width: 100%; +} + +.swiper-item { + height: 100%; + width: 100%; +} + +.swiper-item1 { + position: absolute; + top: 60px; + left: 10px; + height: 42px; +} + +.swiper-item2 { + position: absolute; + top: 72rpx; + left: 20px; + width: 200px; + height: 61px; +} + +.homePage-main { + height: 100vh; + background-color: #EFF8FF; +} + +.main { + padding: 16rpx var(--padding-my); +} + +.main_title { + padding: var(--padding-my) 0 24rpx; + font-size: 32rpx; + line-height: 48rpx; +} + +.main_subTitle { + font-size: 32rpx; + line-height: 48rpx; +} + +.main_color { + color: var(--main-color); +} + +.flex { + display: flex; + gap: 30rpx; + +} + +.home-image { + width: 112rpx; + height: 100rpx; + position: absolute; + right: 10rpx; + bottom: 0; +} + +.flex_1 { + flex: 1; + color: #fff; + padding: 12px; + border-radius: 4px; + display: flex; + justify-content: space-between; + position: relative; + align-items: center; +} + +.flex_2 { + flex: 1; + padding: 12px; + border-radius: 4px; + display: flex; + gap: 16rpx; +} + +.flex_2_image { + width: 166rpx; + height: 100rpx; +} + +.flex_2_image1 { + width: 96rpx; + height: 96rpx; +} + +.flex_dt { + display: flex; + justify-content: space-between; +} + +.flex_zy_title { + color: rgba(23, 26, 29, 0.60); + font-size: 28rpx; + white-space: nowrap; +} + +.flex_num { + font-family: DingTalk; + color: var(--main-color); + font-size: 20px; + line-height: 28px; +} + +.flex_dt_more { + color: rgba(26, 111, 184, 0.60); + display: flex; + align-items: center; +} + +.flex_dt_more_img { + width: 14px; + height: 14px; +} + +.dt_card { + border-radius: 2px; + background-color: #fff; + display: flex; + justify-content: space-between; + padding: 8px 12px; +} + +.dt_card_l { + flex: 2; +} + +.dt_card_time { + color: rgba(23, 26, 29, 0.40); +} + +.dt_card_r { + flex: 1; + width: 184rpx; + height: 136rpx; +} + +.dt_card_r image { + width: 100%; + height: 100%; +} + +.dt_card_title { + margin-bottom: 4px; +} + +.flex_blue { + height: 80rpx; + background: linear-gradient(90deg, #5fa6d4, #3a8ac6 50%, #1a6fb8 100%); +} + +.flex_orange { + height: 80rpx; + background: linear-gradient(90deg, #ffa940, #fa8c16 50%, #ef6c24 100%); +} + +.flex_green { + background: linear-gradient(90deg, #36cfc9, #13c2c2 50%, #08979c 100%); +} + +.marginTop_12 { + margin-top: 24rpx; +} + +.mediate { + height: 92rpx; + background-color: #fff; + border-radius: 4px; + display: flex; + align-items: center; + padding: 0 32rpx; + justify-content: space-between; + margin: 0 32rpx; +} + +.swiper-head { + position: absolute; + width: 100%; + z-index: 1; + bottom: -64rpx; +} + +.mediate-image { + height: 140rpx; + width: 100%; +} + +.message-bg { + height: 24rpx; + padding: 16rpx; + background-color: #ffffff; + margin-top: 16rpx; + border-radius: 10rpx; +} + +.message { + height: 24rpx; + font-size: 24rpx; + line-height: 24rpx; + display: flex; + align-items: center; +} + +.message-content { + flex: 1; + overflow: hidden; + padding-right: 8rpx; +} + +.message-item { + display: flex; + align-items: center; +} + +.message-item:last-child { + margin-bottom: 0; +} + +.message-item-round { + width: 12rpx; + height: 12rpx; + border-radius: 50%; + background-color: #000000; +} + +.message-item-text { + flex: 1; + padding: 0 16rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.message-item-time { + color: rgba(0, 0, 0, 0.5); +} + +.resources { + background-color: #ffffff; + margin-top: 16rpx; + padding: 16rpx; +} + +.item-resources { + display: flex; + overflow-x: auto; + margin: 0 -12rpx; +} + +.item-resources-item-bg { + min-width: 33%; + max-width: 33%; + overflow: hidden; +} + +.item-resources-item { + display: flex; + flex-direction: column; + align-items: center; + padding: 32rpx 0 16rpx; +} + +.item-resources-num { + font-size: 24rpx; + padding: 8rpx 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 100%; + text-align: center; +} + +.item-resources-title { + font-size: 24rpx; + margin-bottom: 12rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 100%; + text-align: center; +} + +.item-resources-image { + height: 80rpx; + width: 80rpx; +} + +.item-resources-btn { + font-size: 24rpx; + padding: 8rpx; + border: 1rpx solid; + border-radius: 21rpx; + line-height: 24rpx; +} + +.itemTitle { + display: flex; + align-items: center; + color: var(--main-color); + font-weight: 600; +} + +.itemTitle-image { + width: 28rpx; + height: 28rpx; + margin-right: 16rpx; +} + +.item-video { + height: 132rpx; + width: 184rpx; + border-radius: 4rpx; +} + +.item-cell-group { + background-color: #ffffff; + margin-top: 16rpx; + padding: 16rpx 16rpx 0; +} + +.item-cell-video { + display: flex; + align-items: center; +} + +.item-cell { + padding: 24rpx 0; + border-bottom: 2rpx solid rgba(0, 0, 0, 0.03); +} + +.item-cell:last-child { + border: none; +} + +.item-cell-content { + display: flex; + flex-direction: column; + justify-content: space-between; + flex: 1; + padding-right: 66rpx; +} + +.item-cell-text { + margin-top: 24rpx; + font-size: 24rpx; + line-height: 40rpx; + color: #c8c9cc; + display: flex; +} + +.van-cell-group--inset { + margin: 0 !important; + border-radius: 8rpx !important; +} + +.popup-scroll { + height: 800rpx; + width: 600rpx; + padding: 24rpx; + background-color: #ffffff; +} + +.popup-button { + padding: 0 64rpx 24rpx; +} + +.popup-button-no { + font-size: 28rpx; + text-align: center; + padding: 24rpx 0 0; + text-decoration: underline; +} + +.homePage-popupMsg { + padding: 32rpx; +} + +.homePage-popupMsg-realNamePng { + width: 340rpx; + height: 300rpx; + position: relative; + left: 50%; + margin-left: -170rpx; +} + +.homePage-popupMsg-content-item { + display: flex; + align-items: center; + margin-bottom: 16rpx; +} + +.homePage-popupMsg-content-item:last-child { + margin-bottom: 0; +} + +.homePage-popupMsg-content-itemImg { + width: 100rpx; + height: 100rpx; +} + +.homePage-popupMsg-content-itemTitle { + flex: 1; + padding-left: 16rpx; +} + +.homePage-popupMsg-subTitle { + margin-bottom: 32rpx; +} + +.homePage-popupMsg-button { + padding: 32rpx 0; + margin: 0 32rpx; + border-top: 2rpx solid var(--border-color); +} + +.AiModal { + display: flex; + background-color: #fff; + flex-direction: column; + margin: 120rpx 94rpx 0; + padding: 24rpx 40rpx; + align-items: center; + border-radius: 8px; +} + +.AiModal image { + width: 264rpx; + height: 352rpx; + margin-bottom: 20rpx; +} + +.AiModal-search { + position: absolute; + top: 96rpx; + width: 100%; + z-index: 991; +} + +.AiModal-title { + font-size: 34rpx; + line-height: 50rpx; + color: var(--main-color); + margin-bottom: 24rpx; +} + +.AiModal-subTitle { + color: rgba(23, 26, 29, 0.60); + text-align: center; + margin-bottom: 24rpx; +} + +.AiModal-button { + width: 100%; +} + +.swiper { + padding: 32rpx; +} + +.swiper-bg { + position: relative; + background: linear-gradient(106deg, #5fa6d4 0%, #1a6fb8 100%); +} + +.swiper-bg::after { + content: ''; + position: absolute; + width: 100%; + height: 20px; + border-radius: 100%; + background: inherit; + /*继承父级背景*/ + bottom: 0; + left: 50%; + transform: translate(-50%, 50%); +} + +.swiper-main { + position: absolute; + top: 0; +} \ No newline at end of file diff --git a/pages/homePageInfo/index.js b/pages/homePageInfo/index.js new file mode 100644 index 0000000..6a03049 --- /dev/null +++ b/pages/homePageInfo/index.js @@ -0,0 +1,47 @@ +// pages/homePageInfo/index.js +const $$ = require('../../utils/util'); + +// 热门资讯 与 视频 +function getVideoAndMessageApi(param) { + return $$.request({ url: 'paHotNews/listShow', type: 'get', submitData: param || {}, service: 'sys', noToken: true }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + searchValue: '', + type: '', // 'newMsg':最新资讯 'hotVideo':'热门视频' + data: [], + }, + + // 跳转资讯链接 + goSeeMessage(e) { + let url = e.currentTarget.dataset.url; + wx.navigateTo({ url: '../webview/index?showUrl=' + url }); + }, + + // 获取最新资讯 和 热门视频 + async getVideoAndMessage({ appid, type }) { + $$.showLoading(); + const res = await getVideoAndMessageApi({ appid }); + if (res.type) { + let hotVideoList = res.data.hotVideoList || []; + let hotNewsList = res.data.hotNewsList || []; + this.setData({ data: type === 'newMsg' ? hotNewsList : hotVideoList, type }); + } + $$.hideLoading(); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let appid = wx.getAccountInfoSync().miniProgram.appId; + this.getVideoAndMessage({ appid, type: options.type }); + wx.setNavigationBarTitle({ + title: options.type === 'newMsg' ? '最新资讯' : '热门视频', + }); + }, +}); diff --git a/pages/homePageInfo/index.json b/pages/homePageInfo/index.json new file mode 100644 index 0000000..50292bd --- /dev/null +++ b/pages/homePageInfo/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} diff --git a/pages/homePageInfo/index.wxml b/pages/homePageInfo/index.wxml new file mode 100644 index 0000000..fe294d4 --- /dev/null +++ b/pages/homePageInfo/index.wxml @@ -0,0 +1,24 @@ +<!--更多资讯和更多视频页面--> +<view class="homePageInfo-main"> + <block wx:if="{{ type === 'newMsg' }}"> + <view class="homePageInfo-main-item" wx:for="{{ data }}" wx:key="index"> + <view bindtap="goSeeMessage" class="van-multi-ellipsis--l3" data-url="{{ item.showUrl }}">{{ item.title }}</view> + <view class="homePageInfo-main-item-text"> + 发布时间: + <time-format format="YYYY-MM-DD" value="{{ item.pushTime }}" /> + </view> + </view> + </block> + <block wx:else> + <view class="homePageInfo-main-item homePageInfo-main-itemVideo" wx:for="{{ data }}" wx:key="index"> + <view class="homePageInfo-main-itemVideo-content"> + <view class="van-multi-ellipsis--l2">{{ item.title }}</view> + <view class="homePageInfo-main-item-text"> + 发布时间: + <time-format format="YYYY-MM-DD" value="{{ item.pushTime }}" /> + </view> + </view> + <video class="homePageInfo-main-itemVideo-video" id="myVideo-{{index}}" show-mute-btn="{{ true }}" src="{{ item.showUrl }}" /> + </view> + </block> +</view> diff --git a/pages/homePageInfo/index.wxss b/pages/homePageInfo/index.wxss new file mode 100644 index 0000000..e5d2e6d --- /dev/null +++ b/pages/homePageInfo/index.wxss @@ -0,0 +1,40 @@ +/* pages/homePageInfo/index.wxss */ + +.homePageInfo-main { + margin: 32rpx 0; + padding: 0 var(--padding-my); +} + +.homePageInfo-main-item { + border-radius: var(--border-radius-card); + padding: 24rpx 32rpx; + background-color: #ffffff; + margin-bottom: 24rpx; +} + +.homePageInfo-main-item-text { + margin-top: 24rpx; + font-size: 24rpx; + line-height: 40rpx; + color: #c8c9cc; + display: flex; +} + +.homePageInfo-main-itemVideo { + display: flex; + align-items: center; +} + +.homePageInfo-main-itemVideo-content { + display: flex; + flex-direction: column; + justify-content: space-between; + flex: 1; + padding-right: 66rpx; +} + +.homePageInfo-main-itemVideo-video { + height: 132rpx; + width: 184rpx; + border-radius: 4rpx; +} diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000..168b0db --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,67 @@ +// pages/login/index.js +const app = getApp(); +const $$ = require('../../utils/util'); + +// 登录 +function loginApi(submitData) { + return $$.request({ url: 'paAccount/empower', type: 'post', submitData, service: 'cust', noToken: true }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, // icon图片地址 + }, + + // 登录,获取用户信息 + async handleGetUserInfo() { + $$.showLoading(); + wx.getUserProfile({ + desc: '完善用户信息', + complete(res) { + if (res.errMsg === 'getUserProfile:ok') { + wx.login({ + async success(res2) { + if (res2.code) { + const accountInfo = wx.getAccountInfoSync(); + const submitData = { + appid: accountInfo.miniProgram.appId, + code: res2.code, + avatar: res?.userInfo.avatarUrl, + encryptedData: res.encryptedData, + ivStr: res.iv, + }; + const res3 = await loginApi(submitData); + $$.hideLoading(); + if (res3.type) { + wx.setStorage({ key: 'userInfo', data: res3.data }); + app.globalData.token = res3.data.token; + $$.showToast({ title: '登录成功', icon: 'success' }); + await $$.sleep(); + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + } + } else { + $$.hideLoading(); + $$.showToast('登录失败,请稍后重试'); + } + }, + }); + } else { + $$.hideLoading(); + $$.showToast({ title: '抱歉!授权失败' }); + } + }, + }); + }, + + // 返回首页 + handleGoToHomePage() { + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + }, +}); diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000..bb0259c --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,11 @@ +<!--pages/login/index.wxml--> +<view class="noLogin"> + <view class="noLogin-content"> + <image class="noLogin-image" src="./../../img/me-center.png" /> + <view>请先登录账号</view> + </view> + <van-button bind:click="handleGetUserInfo" block type="primary">登录</van-button> + <view style="margin-top: 32rpx;"> + <van-button bind:click="handleGoToHomePage" block>返回首页</van-button> + </view> +</view> diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000..f74b7a9 --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1,16 @@ +/* pages/login/index.wxss */ +.noLogin { + background-color: #ffffff; + padding: 48rpx var(--padding-my); + text-align: center; + margin-top: 64rpx; +} + +.noLogin-image { + width: 200rpx; + height: 200rpx; +} + +.noLogin-content { + margin-bottom: 48rpx; +} diff --git a/pages/materialShow/index.js b/pages/materialShow/index.js new file mode 100644 index 0000000..95b1747 --- /dev/null +++ b/pages/materialShow/index.js @@ -0,0 +1,169 @@ +// pages/materialUpload/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +// 获取附件 +function getCaseFilesApi(id) { + return $$.request({ url: 'paCaseInfo/listCaseFile?caseId=' + id, type: 'get', service: 'mediate' }); +} +// 删除附件 +function delfileApi(id) { + return $$.request({ url: 'fileInfo/deleteById?id=' + id, type: 'get', service: 'sys', v1: true }); +} + +Page({ + /** + * 页面的初始数据 + */ + settimeout: null, + previewImageVisible: false, // 判断是否进入查看图片 + touchstarttime: '', //触摸开始时间 + caseId: '', + data: { + imgUrl: $$.url.img, + material_data: [ + { + icon: `${$$.url.img}material-evidence.png`, + iconActive: `${$$.url.img}material-evidence-active.png`, + num: 0, + title: '证据材料', + type: '22_00018-102', + explain: '证据材料:包括但不限于物证、书证、证词、鉴定结论等内容,可作为纠纷的重要判断依据,形式主要为图片、word、pdf等。', + files: [], + }, + { + icon: `${$$.url.img}material-apply.png`, + iconActive: `${$$.url.img}material-apply-active.png`, + num: 0, + title: '申请材料', + type: '22_00018-101', + explain: '申请材料:申请材料包括但不限于纠纷登记表、送达地址确认书、司法确认申请表等,形式主要为图片、word、pdf等。', + files: [], + }, + { + icon: `${$$.url.img}material-identity.png`, + iconActive: `${$$.url.img}material-identity-active.png`, + num: 0, + title: '身份材料', + type: '22_00018-202', + explain: + '身份材料:包括但不限于居民身份证、企业工商登记证明(法人时需要)、组织机构代码证(非法人组织时需要)、代理人授权委托书(代理人时需要)等,形式主要为图片、word、pdf等。', + files: [], + }, + { + icon: `${$$.url.img}material-other.png`, + iconActive: `${$$.url.img}material-other-active.png`, + num: 0, + title: '其他材料', + type: '22_00018-199', + explain: '其他材料:与案件关系密切的其他材料,形式主要为图片、word、pdf等。', + files: [], + }, + ], + activeMaterial: 0, // 当前选中的材料下标 + editVisible: true, // 是否编辑状态 + }, + + // 切换显示文件 + handleChangeTab(e) { + this.setData({ + activeMaterial: e.detail, + }); + }, + + // 长按删除文件 + handleTouchstart(e) { + this.touchstarttime = e.timeStamp; + let item = e.detail; + let that = this; + this.settimeout = setTimeout(() => { + if (this.touchstarttime && that.data.editVisible) { + $$.showModal({ + content: '确定删除' + item.name + '吗?', + success: (res) => { + if (res.confirm) { + that.delfile(item.id); + } + }, + }); + } + }, 1500); + }, + + // 长按结束 + handleTouchend(e) { + let item = e.detail; + if (e.timeStamp - this.touchstarttime < 1000) { + // 判断用户为点击 + let imgUrl = $$.baseUrl + $$.url.fileShowUrl + item.id; + const visible = $$.openFiles(item.cat, imgUrl, [imgUrl]); + if (visible) { + this.previewImageVisible = true; + } + } + if (this.settimeout) { + clearTimeout(this.settimeout); + } + this.touchstarttime = false; + }, + + // 跳转至上传文件页面 + handleGoUpload() { + wx.navigateTo({ + url: '../../pages/materialUpload/index?activeMaterial=' + this.data.activeMaterial + '&caseId=' + this.caseId, + }); + }, + + // 删除附件 + async delfile(id) { + $$.showLoading(); + const res = await delfileApi(id); + $$.hideLoading(); + if (res.type) { + this.getCaseFiles(this.caseId, 'delete'); + } + }, + + // 查询案件附件 + async getCaseFiles(id, type) { + $$.showLoading(); + const res = await getCaseFilesApi(id); + $$.hideLoading(); + if (res.type) { + if (type) { + $$.showToast({ icon: 'success', title: '删除成功', duration: 500 }); + } + let arr = ['evidenceFile', 'applyFile', 'identityFile', 'otherFile']; + arr.forEach((x, t) => { + this.data.material_data[t].num = res.data[x]?.size || 0; + this.data.material_data[t].files = res.data[x]?.dataList || []; + }); + app.globalData.material.data = this.data.material_data; + this.setData({ activeMaterial: this.data.activeMaterial || 0, material_data: this.data.material_data }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (options.caseId) { + this.caseId = options.caseId; + this.getCaseFiles(this.caseId); + }L + this.setData({ editVisible: !!options?.editVisible }); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + if (this.caseId && !this.previewImageVisible && app.globalData.material.uploadVisible) { + app.globalData.material.uploadVisible = false; + this.getCaseFiles(this.caseId); + } + if (this.previewImageVisible) { + this.previewImageVisible = false; + } + }, +}); diff --git a/pages/materialShow/index.json b/pages/materialShow/index.json new file mode 100644 index 0000000..d085bba --- /dev/null +++ b/pages/materialShow/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "纠纷材料", + "usingComponents": { + "file-card": "../../components/file-card/index" + } +} diff --git a/pages/materialShow/index.wxml b/pages/materialShow/index.wxml new file mode 100644 index 0000000..0a75384 --- /dev/null +++ b/pages/materialShow/index.wxml @@ -0,0 +1,43 @@ +<!--文件展示页面--> +<common-page safeBottom="{{ false }}"> + <view class="header second-font">{{ material_data[activeMaterial].explain }}</view> + <view class="header-title" wx:if="{{ material_data[activeMaterial].num > 0 }}">{{ material_data[activeMaterial].title }}:{{ material_data[activeMaterial].num }}</view> + <!-- 文件展示 --> + <view class="card {{ activeMaterial === 2 ? 'card2' : '' }}" wx:for="{{ material_data[activeMaterial].files }}" wx:for-index="t" wx:for-item="x" wx:key="t"> + <view class="card-header" wx:if="{{ activeMaterial === 2 }}"> + <image class="card-header-img" src="{{ imgUrl }}avatar-{{ x.perType === '15_020008-1' ? 'sqr' : 'bsqr' }}.png" /> + <view> + <view class="card-header-title">{{ x.ownerName }}</view> + <view class="card-header-subTitle">{{ x.perType === '15_020008-1' ? '申请方' : '被申请方' }} | {{ x.agentStatus || '当事人' }}</view> + </view> + </view> + <!-- 文件 --> + <file-card backgroundColor="{{ activeMaterial === 2 ? '' : '#ffffff' }}" bind:ontouchend="handleTouchend" bind:ontouchstart="handleTouchstart" fileInfoList="{{ x.fileList }}" isPreview="{{false}}" /> + </view> + <view class="case"> + <view class="img-case_2"> + <image src="/img/case_1.png" class="img"></image> + </view> + <view> + 通过与相似类案的大数据分析,建议您优先选择案件调解方式。这将有效为您节约时间和金钱成本,以更容易保持双方关系的方式让您收获满意的结果。 + </view> + </view> + + <!-- 空 --> + <view class="empty"> + <van-empty description="暂无材料" image="{{ imgUrl }}empty.png" wx:if="{{ material_data[activeMaterial].files.length === 0 }}" /> + </view> + <!-- 上传按钮 --> + <view bindtap="handleGoUpload" class="upload-icon" wx:if="{{ editVisible }}"> + <van-icon name="{{ imgUrl }}material-upload.png" size="24" /> + <view class="second-font">上传</view> + </view> + <!-- tabbar --> + <van-tabbar active="{{ activeMaterial }}" bind:change="handleChangeTab" myHeight="66" placeholder> + <van-tabbar-item wx:for="{{ material_data }}" wx:key="index"> + <van-icon name="{{ item.icon }}" slot="icon" /> + <van-icon name="{{ item.iconActive }}" slot="icon-active" /> + {{ item.title }} + </van-tabbar-item> + </van-tabbar> +</common-page> \ No newline at end of file diff --git a/pages/materialShow/index.wxss b/pages/materialShow/index.wxss new file mode 100644 index 0000000..e82895b --- /dev/null +++ b/pages/materialShow/index.wxss @@ -0,0 +1,92 @@ +/* pages/materialUpload/index.wxss */ +.header { + padding: 24rpx var(--padding-my); + background-color: #ffffff; +} + +.header-title { + padding: 24rpx var(--padding-my); + font-weight: 600; +} + +.empty { + position: absolute; + top: 50%; + margin-top: -142px; + left: 0; + right: 0; +} + +.upload-icon { + color: #ffffff; + position: fixed; + right: 32rpx; + bottom: 164rpx; + width: 128rpx; + height: 128rpx; + background: linear-gradient(139deg, var(--main-color) 0%, var(--main-color) 100%); + border-radius: 50%; + box-shadow: 2rpx 2rpx 12rpx 0px rgba(0, 0, 0, 0.25); + margin-bottom: env(safe-area-inset-bottom); + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; +} + +.card { + padding: 0 var(--padding-my); + margin-bottom: 16rpx; +} + +.card2 { + background-color: #ffffff; + border-radius: var(--border-radius-card); + padding: 32rpx 32rpx 16rpx; + margin-left: var(--padding-my); + margin-right: var(--padding-my); +} + +.card-header { + display: flex; + align-items: center; + margin-bottom: 16rpx; +} + +.card-header-img { + height: 88rpx; + width: 88rpx; + margin-right: 16rpx; +} + +.card-header-title { + font-weight: 600; +} + +.card-header-subTitle { + font-size: 24rpx; + line-height: 40rpx; + color: var(--second-text-color); +} + +.case { + background-color: #FFEAE3; + padding: 4px 0; + margin-bottom: 8px; + font-size: 14px; + display: flex; + justify-content: space-between; + padding: 4px 8px 4px 8px; + color: #FF5219; +} + +.img-case_2 { + display: flex; + margin-top: 4px; +} + +.img { + height: 12px; + width: 12px; + margin-right: 4px; +} diff --git a/pages/materialUpload/index.js b/pages/materialUpload/index.js new file mode 100644 index 0000000..d6738f0 --- /dev/null +++ b/pages/materialUpload/index.js @@ -0,0 +1,297 @@ +// pages/materialUpload/index.js +const app = getApp(); +const $$ = require('../../utils/util'); + +// 删除附件 +function delfileApi(id) { + return $$.request({ url: 'fileInfo/deleteById?id=' + id, type: 'get', service: 'sys', v1: true }); +} + +Page({ + /** + * 页面的初始数据 + */ + previewImageVisible: false, // 判断是否进入查看图片 + filesArr: [], + data: { + popup: {}, // 下拉弹出框数据 + data: [], // 材料数据 + activeMaterial: 0, // 当前选中的材料下标 + person: [], // 身份证明材料中选择的人员数据 + activePerson: 0, // 人员数据下标 + formatData: { + fileList: [], + personFile: [], + }, // 调整展示数据格式 + caseId: 0, // 案件id + fileUrl: $$.baseUrl + $$.url.fileShowUrl, + }, + + // 展示弹出层 + handleShowPopup(e) { + let data = + e.currentTarget.dataset.type === 'materialtype' + ? this.data.data.map((x) => { + delete x.fileList; + x.label = x.title; + return x; + }) + : this.data.person.map((x) => { + x.label = x.trueName; + return x; + }); + let index = 0; + foreach: for (let i = 0; i <= data.length; i++) { + if (data[i].label === e.currentTarget.dataset.value) { + index = i; + break foreach; + } + } + this.setData({ + popup: { + visible: true, + title: e.currentTarget.dataset.title, + selectData: data, + type: e.currentTarget.dataset.type, + noPicker: true, + activeIndex: index, + }, + }); + }, + + // 关闭弹出层 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ popup: this.data.popup }); + }, + + // 下拉框确认选择 + handleConfirmPicker({ detail }) { + let type = this.data.popup.type; + let index = detail.detail.index; + this.data.popup.visible = false; + if (type === 'materialtype') { + this.data.activeMaterial = index; + } else { + this.data.activePerson = index; + } + this.setData({ popup: this.data.popup, activeMaterial: this.data.activeMaterial, activePerson: this.data.activePerson }, () => { + this.formatData(); + }); + }, + + // 预览图片 + handlePreviewImage(e) { + let index = e.currentTarget.dataset.index; + let personindex = e.currentTarget.dataset.personindex; + let urls = []; + let arr = this.data.activeMaterial !== 2 ? this.data.formatData.fileList : this.data.formatData.personFile[personindex].fileList; + arr.forEach((x) => { + urls.push(x.wxurl ? x.wxurl : `${this.data.fileUrl}${x.id}`); + }); + wx.previewImage({ + current: arr[index].wxurl || `${this.data.fileUrl}${arr[index].id}`, + urls: urls, + }); + this.previewImageVisible = true; + }, + + // 删除图片 + async handleDelImage(e) { + let ownerType = e.currentTarget.dataset.ownertype; + let ownerId = e.currentTarget.dataset.ownerid; + let id = e.currentTarget.dataset.id; + $$.showLoading(); + const res = await delfileApi(id); + if (res.type) { + $$.showToast({ icon: 'success', title: '删除成功', duration: 500 }); + let files = this.data.data[this.data.activeMaterial].files; + let num = this.data.data[this.data.activeMaterial].num; + let fileList = []; + if (this.data.activeMaterial !== 2) { + fileList = files.filter((item) => item.ownerType === ownerType)[0].fileList; + } else { + fileList = files.filter((item) => item.ownerId === ownerId)[0].fileList; + } + fileList.forEach((x, t) => { + if (x.id === id) { + fileList.splice(t, 1); + num = num - 1; + } + }); + this.data.data[this.data.activeMaterial].num = num; + this.setData({ data: this.data.data }, () => { + app.globalData.material.data = this.data.data; + this.formatData(); + }); + } + }, + + // 数据格式化显示 + formatData() { + let fileList = []; + let personFile = []; + if (this.data.activeMaterial !== 2) { + fileList = this.data.data[this.data.activeMaterial].files[0]?.fileList || []; + } else { + let person = this.data.person; + let files = this.data.data[this.data.activeMaterial].files; + let personId = person[this.data.activePerson].id; + let personFiles = files.filter((item) => item.ownerId === personId)[0]?.fileList || []; + if (person[this.data.activePerson].agent) { + // 代理人 + personFile = [ + { + ownerId: personId, + value: '22_00018-205', + title: '身份证明材料', + fileList: personFiles.filter((item) => item.ownerType === '22_00018-205'), + text: '请上传“居民身份证”', + }, + { + ownerId: personId, + value: '22_00018-207', + title: '授权委托书', + fileList: personFiles.filter((item) => item.ownerType === '22_00018-207'), + text: '请上传代理人的“授权委托书”', + }, + ]; + } else { + // 当事人 + if (person[this.data.activePerson].perClass === '09_01001-1') { + // 申请人 or 被申请人的人员类型:自然人 + personFile = [ + { + ownerId: personId, + value: '22_00018-202', + title: '身份证明材料', + fileList: personFiles.filter((item) => item.ownerType === '22_00018-202'), + text: '请上传“居民身份证”', + }, + ]; + } else if (person[this.data.activePerson].perClass === '09_01001-2' || person[this.data.activePerson].perClass === '09_01001-3') { + // 申请人 or 被申请人的人员类型:法人,非法人组织 + let name = person[this.data.activePerson].perClass === '09_01001-2' ? '法定' : '机构'; + personFile = [ + { + ownerId: personId, + value: '22_00018-204', + title: name + '代表人身份证明', + text: + person[this.data.activePerson].perClass === '09_01001-2' + ? '请上传“法定代表人居民身份证”和“法定代表人证明书”' + : '请上传“机构代表人居民身份证”', + fileList: personFiles.filter((item) => item.ownerType === '22_00018-204'), + }, + { + ownerId: personId, + value: '22_00018-203', + title: name + '登记材料', + text: '可上传“工商登记证明”或“组织机构代码证”', + fileList: personFiles.filter((item) => item.ownerType === '22_00018-203'), + }, + ]; + } + } + } + this.setData({ formatData: { fileList, personFile } }); + }, + + // 上传文件图片 + async handleUploadFile(e) { + let id = e.currentTarget.dataset.id; + let type = e.currentTarget.dataset.type; + let that = this; + this.filesArr = []; + wx.chooseMedia({ + mediaType: ['image'], + success(res2) { + const tempFiles = res2.tempFiles; + // 多个文件逐一上传 + tempFiles.forEach((x, t) => { + $$.showLoading('上传中...'); + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/v1/fileInfo/wechatUpload/${id}/${type}`, + filePath: x.tempFilePath, + name: 'file', + header: { Authorization: app.globalData.token }, + complete(res) { + $$.hideLoading(); + if (res.errMsg === 'uploadFile:ok') { + const data = { ...JSON.parse(res.data), wxurl: x.tempFilePath }; + that.filesArr.splice(t, 0, data); + } else { + that.filesArr.splice(t, 0, { code: '400' }); + } + if (tempFiles.length === that.filesArr.length) { + let errNum = 0; + let files = that.data.data[that.data.activeMaterial].files; + let num = that.data.data[that.data.activeMaterial].num; + that.filesArr.forEach((y) => { + if (y.code == 0) { + // 将文件数据回填展示 + let file = y.data[0]; + file.wxurl = y.tempFilePath; + let fileList = []; + // 判断是否是人员的身份材料上传 + if (that.data.activeMaterial !== 2) { + if (files.length === 0) { + // 当无时添加默认 + files[0] = { ownerType: type, fileList: [] }; + } + fileList = files.filter((item) => item.ownerType === type)[0].fileList; + } else { + let personFiles = files.filter((item) => item.ownerId === id); + if (personFiles.length === 0) { + // 当无时添加默认 + files.push({ ownerId: id, ownerName: that.data.person[that.data.activePerson].trueName, fileList: [] }); + } + fileList = files.filter((item) => item.ownerId === id)[0].fileList; + } + num = num + 1; + fileList.push(file); + } else { + errNum = errNum + 1; + } + }); + if (errNum !== 0) { + $$.showToast({ title: `已上传:${tempFiles.length - errNum},失败:${errNum}`, duration: 500 }); + } else { + $$.showToast({ icon: 'success', title: '上传成功', duration: 500 }); + } + app.globalData.material.uploadVisible = true; + that.data.data[that.data.activeMaterial].num = num; + that.setData({ data: that.data.data }, () => { + app.globalData.material.data = that.data.data; + that.formatData(); + }); + } + }, + }); + }); + }, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (!this.previewImageVisible) { + this.setData( + { + data: app.globalData.material.data, + activeMaterial: parseInt(options.activeMaterial), + person: app.globalData.material.person, + caseId: options.caseId, + }, + () => { + this.formatData(); + } + ); + } + if (this.previewImageVisible) { + this.previewImageVisible = false; + } + }, +}); diff --git a/pages/materialUpload/index.json b/pages/materialUpload/index.json new file mode 100644 index 0000000..f2e3acb --- /dev/null +++ b/pages/materialUpload/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "上传材料", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/materialUpload/index.wxml b/pages/materialUpload/index.wxml new file mode 100644 index 0000000..b54175a --- /dev/null +++ b/pages/materialUpload/index.wxml @@ -0,0 +1,104 @@ +<!--材料附件上传页面--> +<common-page + bind:onCancelPicker="handleClosePopup" + bind:onClosePopup="handleClosePopup" + bind:onConfirmPicker="handleConfirmPicker" + popup="{{ popup }}" +> + <view class="upload-card"> + <view bindtap="handleShowPopup" class="cell" data-title="材料类型" data-type="materialtype" data-value="{{ data[activeMaterial].title }}"> + <view class="cell-title">材料类型</view> + <view class="cell-select">{{ data[activeMaterial].title || '' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view class="upload-card-text">{{ data[activeMaterial].explain }}</view> + </view> + <view class="upload-card" wx:if="{{ activeMaterial === 2 }}"> + <view bindtap="handleShowPopup" class="cell" data-title="选择对象" data-type="person" data-value="{{ person[activePerson].trueName }}"> + <view class="cell-title">选择对象</view> + <view class="cell-select">{{ person[activePerson].trueName || '' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + </view> + <view class="upload-card" wx:if="{{ activeMaterial !== 2 }}"> + <!-- 证据材料 or 申请材料 or 其他材料 --> + <view class="cell2"> + <view class="cell-title">材料上传</view> + <view class="upload-main"> + <view class="upload-main-item" wx:for="{{ formatData.fileList }}" wx:if="{{ !!item.id }}" wx:key="index"> + <view bindtap="handleDelImage" class="upload-main-item-close" data-id="{{ item.id }}" data-ownertype="{{ item.ownerType }}"> + <van-icon name="clear" size="14" /> + </view> + <van-image + bind:click="handlePreviewImage" + data-index="{{ index }}" + fit="contain" + height="84rpx" + radius="2" + src="{{ item.wxurl }}" + width="84rpx" + wx:if="{{ !!item.wxurl }}" + /> + <van-image + bind:click="handlePreviewImage" + data-index="{{ index }}" + fit="contain" + height="84rpx" + radius="2" + src="{{ fileUrl }}{{ item.id }}" + width="84rpx" + wx:else + /> + </view> + <view bindtap="handleUploadFile" class="upload-main-add" data-id="{{ caseId }}" data-type="{{ data[activeMaterial].type }}"> + <van-icon name="plus" size="44rpx" /> + </view> + </view> + </view> + </view> + <!-- 身份材料 --> + <block wx:else> + <view class="upload-card" wx:for="{{ formatData.personFile }}" wx:key="index"> + <view class="cell2"> + <view class="cell-title">{{ item.title }}</view> + <view class="upload-main"> + <view class="upload-main-item" wx:for="{{ item.fileList }}" wx:for-index="t" wx:for-item="x" wx:if="{{ !!x.id }}" wx:key="t"> + <view bindtap="handleDelImage" class="upload-main-item-close" data-id="{{ x.id }}" data-ownerid="{{ item.ownerId }}"> + <van-icon name="clear" size="14" /> + </view> + <van-image + bind:click="handlePreviewImage" + data-index="{{ t }}" + data-personindex="{{ index }}" + fit="contain" + height="84rpx" + radius="2" + src="{{ x.wxurl }}" + width="84rpx" + wx:if="{{ !!x.wxurl }}" + /> + <van-image + bind:click="handlePreviewImage" + data-index="{{ t }}" + data-personindex="{{ index }}" + fit="contain" + height="84rpx" + radius="2" + src="{{ fileUrl }}{{ x.id }}" + width="84rpx" + wx:else + /> + </view> + <view bindtap="handleUploadFile" class="upload-main-add" data-id="{{ person[activePerson].id }}" data-type="{{ item.value }}"> + <van-icon name="plus" size="44rpx" /> + </view> + </view> + <view class="upload-card-text upload-card-text2">{{ item.text }}</view> + </view> + </view> + </block> +</common-page> diff --git a/pages/materialUpload/index.wxss b/pages/materialUpload/index.wxss new file mode 100644 index 0000000..b3d8ed3 --- /dev/null +++ b/pages/materialUpload/index.wxss @@ -0,0 +1,58 @@ +/* pages/materialUpload/index.wxss */ +@import '../../styles/public_components.wxss'; + +.upload-card { + padding: 0 32rpx; + margin: 32rpx var(--padding-my) 0; + background-color: #ffffff; + border-radius: var(--border-radius-card); +} + +.upload-card-text { + font-size: 24rpx; + line-height: 40rpx; + color: var(--second-text-color); + padding: 24rpx 0; + border-top: 2rpx solid var(--border-color); +} + +.upload-card-text2 { + padding: 8rpx 0 0; + margin-top: 32rpx; +} + +.upload-main { + display: flex; + flex-wrap: wrap; +} + +.upload-main-item { + position: relative; + margin-right: 54rpx; + margin-top: 32rpx; +} + +.upload-main-item-close { + position: absolute; + right: -14rpx; + z-index: 99; + top: -14rpx; + color: var(--red); + background-color: #ffffff; + border-radius: 50%; +} + +.upload-main-add { + margin-top: 32rpx; + width: 84rpx; + height: 84rpx; + border: 2rpx dashed rgba(0, 0, 0, 0.5); + border-radius: 4rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.van-image { + background-color: #f2f2f2; +} diff --git a/pages/me/index.js b/pages/me/index.js new file mode 100644 index 0000000..c2006b3 --- /dev/null +++ b/pages/me/index.js @@ -0,0 +1,72 @@ +/* + * @Company: hugeInfo + * @Author: ldh + * @Date: 2022-06-06 15:33:48 + * @LastEditTime: 2022-06-15 17:10:03 + * @LastEditors: ldh + * @Version: 1.0.0 + * @Description: + */ +// pages/me/index.js +const $$ = require('../../utils/util'); + +// 获取用户信息 +function getUserInfoApi() { + return $$.request({ + url: 'paUser/personal', + type: 'get', + service: 'cust' + }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, // icon图片地址 + userInfo: {}, // 用户信息 + }, + + // 点击完善资料 + handleGo() { + let visible = this.data.userInfo.realStatus === '1'; + wx.navigateTo({ + url: visible ? '../../pages/perfectInformation/index?type=improvedata' : '../../pages/perfectInformation/index' + }); + }, + + // 退出登录 + handleLoginOut() { + $$.showModal({ + content: '是否确认退出登录?', + success: (res) => { + if (res.confirm) { + $$.loginOutClearData(); + $$.showToast('已退出登录'); + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + } + }, + }); + }, + + // 获取用户信息 + async getUserInfo() { + $$.showLoading(); + const res = await getUserInfoApi(); + $$.hideLoading(); + if (res.type) { + this.setData({ + userInfo: res.data + }); + } + }, + + onLoad: function () {}, + + onShow(options) { + this.getUserInfo(); + }, +}); \ No newline at end of file diff --git a/pages/me/index.json b/pages/me/index.json new file mode 100644 index 0000000..3fc5110 --- /dev/null +++ b/pages/me/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "个人中心", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/me/index.wxml b/pages/me/index.wxml new file mode 100644 index 0000000..8e1ac24 --- /dev/null +++ b/pages/me/index.wxml @@ -0,0 +1,61 @@ +<!--个人中心--> +<common-page id="common-page"> + <view> + <view class="header"> + <view class="header-img"> + <image class="header-img-image" src="{{ userInfo.avatar }}" wx:if="{{ userInfo.avatar }}" /> + <van-icon name="user-circle-o" size="100rpx" wx:else /> + </view> + <view> + <view bindtap="handleGo" class="header-title"> + <text>{{ userInfo.trueName || '游客'}}</text> + <image class="main-card-item-edit" src="../../images/me_3.png" mode="" /> + </view> + + <view wx:if="{{realStatus === '1'}}" class="header-subTitle"><text>最近登录时间: + <time-format format="YYYY年MM月DD日" value="{{ userInfo.loginTime }}" /> + </text></view> + </view> + </view> + <view class="main-card"> + <van-cell-group inset> + <!-- <van-cell wx:if="{{realStatus === '1'}}" is-link link-type="navigateTo" url="../../pages/messageCenter/index"> --> + <van-cell is-link link-type="navigateTo" url="../../pages/messageCenter/index"> + <view class="main-card-item" slot="title"> + <image class="main-card-item-image" src="../../images/me_2.png" /> + <text>我的消息</text> + </view> + <view class="main-msgRound" wx:if="{{ userInfo.msgCount }}">{{ userInfo.msgCount }}</view> + </van-cell> + <van-cell is-link link-type="navigateTo" url="{{userInfo.realStatus === '1' ? '../../pages/perfectInformation/index?isCheck=true' : '../../pages/realNameAuthentication/index'}}"> + <view class="main-card-item" slot="title"> + <image class="main-card-item-image" src="../../images/me_1.png" /> + <text>实名认证</text> + </view> + <view class="main-realName {{ userInfo.realStatus === 1 ? 'main-realName-green' : 'main-realName-red'}}">{{ userInfo.realStatus === 1 ? '已认证' : '未认证' }}</view> + </van-cell> + </van-cell-group> + </view> + <view class="main-card"> + <van-cell-group inset> + <!-- <van-cell border="{{ false }}" is-link link-type="navigateTo" url="../../pages/agreement/index"> + <view class="main-card-item" slot="title"> + <image class="main-card-item-image" src="{{ imgUrl }}agreement.png" /> + <text>服务协议</text> + </view> + </van-cell> --> + <!-- TODO:后期需求添加 --> + <!-- <van-cell is-link border="{{ false }}"> + <view slot="title" class="main-card-item"> + <image class="main-card-item-image" src="{{ imgUrl }}proposal.png" /> + <text>反馈建议</text> + </view> + <view wx:if="{{ userInfo.opinionCount }}" class="main-msgRound">{{ userInfo.opinionCount }}</view> + </van-cell>--> + </van-cell-group> + </view> + <!-- <view class="loginOut"> + <van-button bind:click="handleLoginOut" block type="default">退出登录</van-button> + </view> --> + </view> +</common-page> \ No newline at end of file diff --git a/pages/me/index.wxss b/pages/me/index.wxss new file mode 100644 index 0000000..947108e --- /dev/null +++ b/pages/me/index.wxss @@ -0,0 +1,97 @@ +/* pages/me/index.wxss */ +.header { + padding: 0 var(--padding-my); + background-color: var(--main-color); + display: flex; + align-items: center; + color: #ffffff; + height: 524rpx; + justify-content: center; + flex-direction: column; +} + +.header-img { + overflow: hidden; +} + +.header-img-image { + height: 256rpx; + width: 256rpx; + border-radius: 50%; +} + +.header-title { + font-size: 36rpx; + margin-bottom: 16rpx; + margin-top: 32rpx; + text-align: center; +} + +.header-subTitle { + color: var(--gray-1); +} + +.header-subTitle text { + font-size: 28rpx; + margin-right: 8rpx; +} + +.main-card { + margin-top: 48rpx; +} + +.main-card-item { + display: flex; + align-items: center; +} + +.main-card-item-image { + height: 30rpx; + width: 30rpx; + margin-right: 16rpx; +} + +.main-card-item-edit { + height: 30rpx; + width: 30rpx; + margin-left: 16rpx; +} + +.main-msgRound { + width: 40rpx; + height: 40rpx; + border-radius: 50%; + background-color: var(--red); + color: #ffffff; + line-height: 40rpx; + text-align: center; + margin-right: 16rpx; + font-size: 28rpx; +} + +.main-realName { + margin-right: 16rpx; +} + +.main-realName-red { + color: var(--red); +} + +.main-realName-green { + color: var(--green); +} + +.van-cell { + align-items: center; +} + +.van-cell__value { + display: flex; + align-items: center; + justify-content: flex-end; +} + +.loginOut { + margin-top: 48rpx; + padding: 0 var(--padding-my); +} diff --git a/pages/mediateDetail/index.js b/pages/mediateDetail/index.js new file mode 100644 index 0000000..7fcf4f7 --- /dev/null +++ b/pages/mediateDetail/index.js @@ -0,0 +1,110 @@ +// pages/mediateDetail/index.js +const $$ = require('../../utils/util'); + +// 获取案件详情 +function getCaseDetailApi(submitData, pageType) { + if (pageType === '1') { + // 调解 + return $$.request({ url: 'paCaseInfo/getCaseInfo?id=' + submitData, type: 'get', service: 'mediate' }); + } else { + // 司法确认 + return $$.request({ url: 'paJudicInfo/getJudicInfo?judicId=' + submitData, type: 'get', service: 'mediate' }); + } +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + pageType: '1', // '1':我的调解; '2':我的司法确认 + type: '1', // '1':待受理;'2':待调解(待开始);'3':调解中(进行中);'4':调解结束(已结束);'5':调解-退回;'6':不予受理;'7':异常终止 + steps: [], + stepsActive: 0, + caseData: {}, // 案件详情数据 + }, + + // 数据处理 + setMediateData(caseData, pageType) { + let type = '1'; + if (caseData.process) { + if (caseData.process === '5') { + type = '5'; + } else if (caseData.process === '6') { + type = '6'; + } else { + type = caseData.process || '1'; + } + } + if (pageType === '1') { + this.formatTime(caseData); + } + if (pageType === '2') { + this.formatTime(caseData.caseInfo); + this.formatTime(caseData.judicInfo); + } + this.setData({ caseData: caseData, type, stepsActive: ['5', '6', '7'].includes(type) ? 0 : parseInt(type) - 1 }); + }, + + // 格式化时间 + formatTime(data, pageType) { + if (pageType === '1') { + let arr = ['applyTime', 'mediStartTime', 'mediEndTime'], + arr2 = ['orderStartTime', 'orderEndTime']; + data.meetInfo = data.meetInfo || {}; + arr.forEach((x) => { + if (data[x]) { + data[x] = $$.timeFormat(data[x]); + } + }); + arr2.forEach((x) => { + if (data.meetInfo[x]) { + data.meetInfo[x] = $$.timeFormat(data.meetInfo[x]); + } + }); + } else { + let arr = ['orderEndTime', 'orderStartTime']; + arr.forEach((x) => { + if (data[x]) { + data[x] = $$.timeFormat(data[x]); + } + }); + } + }, + + // 获取案件信息 + getTypeData(data) { + wx.setNavigationBarTitle({ + title: data.pageType === '1' ? '调解详情' : '司法确认详情', + }); + let arr = data.pageType === '1' ? ['待受理', '待调解', '调解中', '调解结束'] : ['待受理', '待开始', '进行中', '已结束']; + this.setData({ + pageType: data.pageType, + steps: [ + { title: arr[0], icon: '', activeIcon: 'steps-detail-1-active.png' }, + { title: arr[1], icon: 'steps-detail-2.png', activeIcon: 'steps-detail-2-active.png' }, + { title: arr[2], icon: 'steps-detail-3.png', activeIcon: 'steps-detail-3-active.png' }, + { title: arr[3], icon: 'steps-detail-4.png', activeIcon: 'steps-detail-4-active.png' }, + ], + stepsActive: parseInt(data.type || 1) - 1, + }); + this.getCaseDetail(data.id, data.pageType); + }, + + // 获取纠纷案件详情 + async getCaseDetail(id, pageType) { + $$.showLoading(); + const res = await getCaseDetailApi(id, pageType); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setMediateData(data, pageType); + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getTypeData(options); + }, +}); diff --git a/pages/mediateDetail/index.json b/pages/mediateDetail/index.json new file mode 100644 index 0000000..d6eaef0 --- /dev/null +++ b/pages/mediateDetail/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "steps": "../../components/steps/index", + "mediate-detail": "../../components/mediate-detail/index" + } +} \ No newline at end of file diff --git a/pages/mediateDetail/index.wxml b/pages/mediateDetail/index.wxml new file mode 100644 index 0000000..f8a74cf --- /dev/null +++ b/pages/mediateDetail/index.wxml @@ -0,0 +1,9 @@ +<!--我的调解详情 or 我的司法确认详情--> +<common-page> + <!-- 步骤条 --> + <view class="steps"> + <steps stepsActive="{{ stepsActive }}" stepsData="{{ steps }}" stepsType="picture" /> + </view> + <view class="steps-height" /> + <mediate-detail caseData="{{ caseData }}" pageType="{{ pageType }}" type="{{ type }}" /> +</common-page> diff --git a/pages/mediateDetail/index.wxss b/pages/mediateDetail/index.wxss new file mode 100644 index 0000000..4a16dc1 --- /dev/null +++ b/pages/mediateDetail/index.wxss @@ -0,0 +1,14 @@ +/* pages/mediateDetail/index.wxss */ +.steps { + padding: 20rpx 0 12rpx; + background-color: #ffffff; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 99; +} + +.steps-height { + height: 140rpx; +} diff --git a/pages/messageCenter/index.js b/pages/messageCenter/index.js new file mode 100644 index 0000000..03c44df --- /dev/null +++ b/pages/messageCenter/index.js @@ -0,0 +1,124 @@ +// pages/messageCenter/index.js +const $$ = require('../../utils/util'); + +// 获取我的消息 +function getMessageDataApi(submitData) { + return $$.request({ url: 'noticeParty/pageMyNotice', type: 'get', submitData, service: 'mediate' }); +} +// 阅读我的消息,将消息标记为已读 +function setMessageReadApi(submitData) { + return $$.request({ url: 'noticeParty/readNotice?id=' + submitData, type: 'get', service: 'mediate' }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + tab: [ + { title: '未读', name: '1' }, + { title: '已读', name: '2' }, + ], + loading: false, // 滚动到底部分页的加载状态 + search: { + page: 1, + size: 20, + readStatus: '1', + }, + listData: [], + total: 0, // 数据总数 + popup: { + show: false, + buttonText: '我知道了', + }, + }, + + // 切换tab + handleChangeTab(e) { + this.getMessageData({ ...this.data.search, readStatus: e.detail.name, page: 1 }); + }, + + // 点击查看信息 + handleRead(e) {}, + + // 点击开启弹窗 + handleOpenPopup(e) { + let item = e.currentTarget.dataset.item; + let index = e.currentTarget.dataset.index; + this.setData({ popup: { ...item, index, show: true, buttonText: item.visitUrl ? '前往操作' : '我知道了' } }); + }, + + // 消息弹窗操作 + async handleClickPopup() { + if (this.data.popup.visitUrl) { + this.setData({ popup: { show: false } }); + wx.navigateTo({ + url: '../../' + this.data.popup.visitUrl, + }); + } else { + const res = await setMessageReadApi(this.data.popup.id); + if (res.type) { + if (this.data.listData[this.data.popup.index]) { + this.data.listData[this.data.popup.index].readStatus = '2'; + } + this.setData({ listData: this.data.listData, popup: { show: false } }); + } + } + }, + + // 关闭弹窗 + handleClosePopup() { + this.setData({ popup: { show: false } }); + }, + + // 滚动到底部获取数据 + handlescrolltolower() { + if (this.data.listData.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ loading: this.data.loading }); + let submitData = { ...this.data.search }; + submitData.page = submitData.page + 1; + this.getMessageData(submitData); + } + }, + + // 获取消息数据 + async getMessageData(submitData) { + $$.showLoading(); + const res = await getMessageDataApi(submitData); + $$.hideLoading(); + if (this.data.loading) { + // 取消滚动底部的加载状态 + this.setData({ loading: false }); + } + if (res.type) { + if (submitData.page === 1) { + this.data.listData = res.data?.content || []; + } else { + this.data.listData = this.data.listData.concat(res.data?.content || []); + } + this.setData({ + tab: this.data.tab.map((x) => { + if (x.name == submitData.readStatus) { + x.title = `${x.name === '1' ? '未读' : '已读'}(${res.data?.totalElements || 0})`; + } + return x; + }), + search: submitData, + listData: this.data.listData, + total: res.data?.totalElements || 0, + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getMessageData(this.data.search); + }, +}); diff --git a/pages/messageCenter/index.json b/pages/messageCenter/index.json new file mode 100644 index 0000000..f7ab5e1 --- /dev/null +++ b/pages/messageCenter/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "我的消息", + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} diff --git a/pages/messageCenter/index.wxml b/pages/messageCenter/index.wxml new file mode 100644 index 0000000..bdba6d8 --- /dev/null +++ b/pages/messageCenter/index.wxml @@ -0,0 +1,53 @@ +<!--pages/messageCenter/index.wxml--> +<common-page> + <view class="messageCenter"> + <view class="messageCenter-tabs"> + <van-tabs active="{{ search.readStatus }}" bind:change="handleChangeTab" line-width="54rpx" nav-class="tab-nav-class" tab-active-class="tab-active-class"> + <van-tab name="{{item.name}}" title="{{item.title}}" wx:for="{{ tab }}" wx:key="index" /> + </van-tabs> + </view> + <van-empty description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="messageCenter-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view bind:tap="handleOpenPopup" class="msg-item {{ listData.length - 1 === index ? 'msg-item-last' : '' }} {{ item.readStatus === '2' ? 'msg-item-read' : '' }}" data-item="{{ item }}" data-index="{{ index }}" wx:for="{{ listData }}" wx:key="index"> + <van-icon name="{{ imgUrl }}msg-{{ item.noticeType === '1' ? 'tongZhi' : 'gongGao' }}.png" size="44" /> + <view class="msg-item-content"> + <view class="msg-item-content-header"> + <view class="msg-item-content-title">{{item.noticeType === '1' ? '系统通知' : '平台公告'}}</view> + <view class="msg-item-content-time"> + <time-format fromtype="messageCenter" value="{{item.createTime}}" /> + </view> + </view> + <view class="msg-item-content-text">{{item.content || '无'}}</view> + </view> + </view> + <block> + <van-divider contentPosition="center" wx:if="{{ listData.length >= total && dalistDatata.length !== 0 }}">已加载全部数据</van-divider> + <view style="text-align: center;" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> + +<!-- 消息提示弹窗查看 --> +<van-popup bind:close="handleClosePopup" closeable position="bottom" round show="{{ popup.show }}" title="消息详情" zIndex="999"> + <view class="popup"> + <view class="popup-header"> + <van-icon name="{{ imgUrl }}msg-{{ popup.noticeType === '1' ? 'tongZhi' : 'gongGao' }}.png" size="44" /> + <view class="popup-header-content"> + <view class="popup-header-content-title">{{popup.noticeType === '1' ? '系统通知' : '平台公告'}}</view> + <view class="popup-header-content-text"> + <time-format fromtype="messageCenter" value="{{popup.createTime}}" /> + </view> + </view> + </view> + <view class="popup-content">{{popup.content || '无'}}</view> + </view> + <view class="popup-button"> + <van-button bind:click="handleClickPopup" block type="primary">{{ popup.buttonText }}</van-button> + </view> +</van-popup> \ No newline at end of file diff --git a/pages/messageCenter/index.wxss b/pages/messageCenter/index.wxss new file mode 100644 index 0000000..22610d0 --- /dev/null +++ b/pages/messageCenter/index.wxss @@ -0,0 +1,104 @@ +/* pages/messageCenter/index.wxss */ +.messageCenter { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + top: 0; + left: 0; + right: 0; +} + +.messageCenter-tabs { + padding: 40rpx 0; +} + +.messageCenter-scroll { + flex: 1; + overflow: hidden; +} + +.msg-item { + position: relative; + display: flex; + padding: 32rpx 20rpx; + background-color: #ffffff; +} + +.msg-item::after { + content: ''; + position: absolute; + border-top: 2rpx solid var(--border-color); + bottom: 0; + left: 20rpx; + right: 20rpx; +} + +.msg-item-last::after { + border: none; +} + +.msg-item-read { + color: rgba(0, 0, 0, 0.5); +} + +.msg-item-content { + flex: 1; + padding-left: 16rpx; +} + +.msg-item-content-header { + flex: 1; + display: flex; + align-items: center; +} + +.msg-item-content-title { + font-weight: 600; + flex: 1; +} + +.msg-item-content-time { + font-size: 24rpx; + color: rgba(0, 0, 0, 0.5); +} + +.msg-item-content-text { + font-size: 24rpx; + line-height: 40rpx; + margin-top: 8rpx; +} + +.popup { + padding: 0 32rpx; +} + +.popup-header { + display: flex; + align-items: center; + padding: 32rpx 0; +} + +.popup-header-content { + margin-left: 16rpx; +} + +.popup-header-content-title { + font-weight: 600; +} + +.popup-header-content-text { + font-size: 24rpx; + line-height: 40rpx; + color: rgba(0, 0, 0, 0.5); +} + +.popup-button { + padding: 32rpx 0; + margin: 0 32rpx; + border-top: 2rpx solid var(--border-color); +} + +.popup-content { + margin-bottom: 32rpx; +} diff --git a/pages/myJudicialConfirmation/index.js b/pages/myJudicialConfirmation/index.js new file mode 100644 index 0000000..4d5723b --- /dev/null +++ b/pages/myJudicialConfirmation/index.js @@ -0,0 +1,174 @@ +// pages/judicialComfirmation/index.js +const $$ = require('../../utils/util'); + +// 获取我的司法确认 +function getMyJudicialComfirmationApi(submitData) { + return $$.request({ url: 'paJudicInfo/pageMyJudic', type: 'get', service: 'mediate', submitData }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + tab: [ + { title: '我是申请人', name: '15_020008-1' }, + { title: '我是被申请人', name: '15_020008-2' }, + ], + selectModel: [ + { + name: '全部', + key: 'process', + data: [ + { label: '全部', value: '', span: 24 }, + { label: '待受理', value: '1' }, + { label: '待开始', value: '2' }, + { label: '进行中', value: '3' }, + { label: '已结束', value: '4' }, + { label: '不予受理', value: '5' }, + { label: '异常终止', value: '6' }, + ], + }, + ], + loading: false, + search: { + page: 1, + size: 10, + perType: '15_020008-1', + process: '', + }, + data: [], // 数据 + total: 0, // 总数 + scrollTop: 0, + popupMsg: { + show: false, + title: '', + data: null, + }, + }, + + // 获取搜索参数 + handleGetType(e) { + this.getMyJudicialComfirmation({ ...this.data.search, page: 1, process: e.detail.process }); + }, + + // 切换tab + handleChangeTab(e) { + let type = null; + if (e.detail.name === '15_020008-1') { + type = [ + { label: '全部', value: '', sapn: 24 }, + { label: '待受理', value: '1' }, + { label: '待开始', value: '2' }, + { label: '进行中', value: '3' }, + { label: '已结束', value: '4' }, + { label: '不予受理', value: '5' }, + { label: '异常终止', value: '6' }, + ]; + } else { + type = [ + { label: '全部', value: '', span: 24 }, + { label: '待开始', value: '2' }, + { label: '进行中', value: '3' }, + { label: '已结束', value: '4' }, + { label: '异常终止', value: '6' }, + ]; + } + let submitData = { + page: 1, + size: 10, + perType: e.detail.name, + process: '', + }; + let that = this; + this.setData({ data: [], selectModel: [{ name: '全部', key: 'process', data: type }], search: submitData }, () => { + that.getMyJudicialComfirmation(submitData); + }); + }, + + // 滚动到底部获取案件 + handlescrolltolower() { + if (this.data.data.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ loading: this.data.loading }); + let submitData = { ...this.data.search }; + submitData.page = submitData.page + 1; + this.getMyJudicialComfirmation(submitData); + } + }, + + // 打开底部弹窗 + handleOpenBottomPopup(e) { + let type = e.detail.type; + if (type === 'roomNo') { + this.setData({ popupMsg: { show: true, data: e.detail.data, title: '线上司法确认房间号' } }); + } + }, + + // 底部弹窗显隐 + _handleClosePopupMsg() { + this.setData({ popupMsg: { show: false } }); + }, + + // 复制房间号 + _handleCopy() { + let that = this; + wx.setClipboardData({ + data: that.data.popupMsg.data, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + $$.showToast({ title: '复制成功' }); + that.setData({ popupMsg: { show: false } }); + }, + }); + }, + }); + }, + + // 获取我的司法确认案件 + async getMyJudicialComfirmation(submitData, type) { + $$.showLoading(); + const res = await getMyJudicialComfirmationApi(submitData); + $$.hideLoading(); + if (this.data.loading) { + this.setData({ loading: false }); + } + if (res.type) { + if (submitData.page === 1) { + this.data.data = res.data.content || []; + } else { + this.data.data = this.data.data.concat(res.data.content || []); + } + this.setData({ search: submitData, data: this.data.data, total: res.data.totalElements || 0 }); + if (type === 'onPullDownRefresh') { + $$.showToast({ title: '已是最新记录', duration: 1000 }); + wx.stopPullDownRefresh(); + } + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getMyJudicialComfirmation(this.data.search); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + let search = { + page: 1, + size: 10, + perType: this.data.search.perType, + process: '', + }; + this.getMyJudicialComfirmation(search, 'onPullDownRefresh'); + }, +}); diff --git a/pages/myJudicialConfirmation/index.json b/pages/myJudicialConfirmation/index.json new file mode 100644 index 0000000..a86a270 --- /dev/null +++ b/pages/myJudicialConfirmation/index.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "我的司法确认", + "usingComponents": { + "drop-down-select": "../../components/drop-down-select/index", + "mediate-card": "../../components/mediate-card/index" + }, + "enablePullDownRefresh": true +} diff --git a/pages/myJudicialConfirmation/index.wxml b/pages/myJudicialConfirmation/index.wxml new file mode 100644 index 0000000..b285d1f --- /dev/null +++ b/pages/myJudicialConfirmation/index.wxml @@ -0,0 +1,46 @@ +<!--pages/judicialComfirmation/index.wxml--> +<common-page> + <view class="myMediate"> + <view class="myMediate-fixed"> + <van-tabs active="{{ tabActive }}" bind:change="handleChangeTab" line-width="54rpx" nav-class="tab-nav-class" tab-active-class="tab-active-class"> + <van-tab name="{{item.name}}" title="{{item.title}}" wx:for="{{ tab }}" wx:key="index" /> + </van-tabs> + <view class="divide-div" /> + <drop-down-select bind:ongetvalue="handleGetType" data="{{ selectModel }}" active="{{ search }}" /> + </view> + <van-empty description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="myMediate-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view class="card-box" wx:for="{{ data }}" wx:key="index"> + <mediate-card bind:onOpenBottomPopup="handleOpenBottomPopup" caseindex="{{ index }}" data="{{ item }}" pageType="2" /> + </view> + <block> + <van-divider contentPosition="center" custom-style="margin-top: 0;" wx:if="{{ data.length >= total && data.length !== 0 }}">已加载全部数据</van-divider> + <view class="myMediate-scroll-loading" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> + +<!-- 底部弹窗 --> +<van-popup + bind:close="_handleClosePopupMsg" + closeable + position="bottom" + round + show="{{ popupMsg.show }}" + title="{{ popupMsg.title || '' }}" + zIndex="999" +> + <view class="popup-roomNo"> + <view>{{ popupMsg.data || '-' }}</view> + <view bind:tap="_handleCopy" class="popup-roomNo-copy"> + <van-icon name="{{ imgUrl }}copy-active.png" size="12" /> + <view style="padding-left:8rpx">复制</view> + </view> + </view> +</van-popup> diff --git a/pages/myJudicialConfirmation/index.wxss b/pages/myJudicialConfirmation/index.wxss new file mode 100644 index 0000000..0df693f --- /dev/null +++ b/pages/myJudicialConfirmation/index.wxss @@ -0,0 +1,2 @@ +/* pages/judicialComfirmation/index.wxss */ +@import '../myMediate/index.wxss'; diff --git a/pages/myMediate/index.js b/pages/myMediate/index.js new file mode 100644 index 0000000..2381d6a --- /dev/null +++ b/pages/myMediate/index.js @@ -0,0 +1,223 @@ +// pages/myMediate/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +// 获取我的调解 +function getMyMediateApi(submitData) { + return $$.request({ url: 'paCaseInfo/pageMyMediation', type: 'get', service: 'mediate', submitData }); +} + +// 撤销申请 +function cancelCaseApi(submitData) { + return $$.request({ url: 'paCaseInfo/revokeApply?id=' + submitData, type: 'get', service: 'mediate' }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + tab: [ + { title: '我是申请人', name: '15_020008-1' }, + { title: '我是被申请人', name: '15_020008-2' }, + ], + selectModel: [ + { + name: '全部', + key: 'process', + data: [ + { label: '全部', value: '', span: 24 }, + { label: '待受理', value: '1' }, + { label: '待调解', value: '2' }, + { label: '调解中', value: '3' }, + { label: '调解结束', value: '4' }, + { label: '退回', value: '5' }, + { label: '不予受理', value: '6' }, + { label: '申请人撤回', value: '7' }, + ], + }, + ], + loading: false, // 滚动到底部分页的加载状态 + search: { + page: 1, + size: 10, + perType: '15_020008-1', + process: '', + caseStatus: '', + }, + data: [], // 数据 + total: 0, // 总数 + popupMsg: { + show: false, + title: '', + data: null, + }, + }, + + // 获取搜索参数 + handleGetType(e) { + this.getMyMediate({ ...this.data.search, page: 1, process: e.detail.process }); + }, + + // 切换tab + handleChangeTab(e) { + let type = null; + if (e.detail.name === '15_020008-1') { + type = [ + { label: '全部', value: '', span: 24 }, + { label: '待受理', value: '1' }, + { label: '待调解', value: '2' }, + { label: '调解中', value: '3' }, + { label: '调解结束', value: '4' }, + { label: '退回', value: '5' }, + { label: '不予受理', value: '6' }, + { label: '申请人撤回', value: '7' }, + ]; + } else { + type = [ + { label: '全部', value: '', span: 24 }, + { label: '待调解', value: '2' }, + { label: '调解中', value: '3' }, + { label: '调解结束', value: '4' }, + { label: '申请人撤回', value: '7' }, + ]; + } + let submitData = { + page: 1, + size: 10, + perType: e.detail.name, + process: '', + caseStatus: '', + }; + let that = this; + this.setData({ data: [], selectModel: [{ name: '全部', key: 'process', data: type }], search: submitData }, () => { + that.getMyMediate(submitData); + }); + }, + + // 滚动到底部获取案件 + handlescrolltolower() { + if (this.data.data.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ loading: this.data.loading }); + let submitData = { ...this.data.search }; + submitData.page = submitData.page + 1; + this.getMyMediate(submitData); + } + }, + + // 打开底部弹窗 + handleOpenBottomPopup(e) { + let type = e.detail.type; + if (type === 'roomNo') { + this.setData({ popupMsg: { show: true, data: e.detail.data, title: '线上调解房间号' } }); + } + }, + + // 底部弹窗显隐 + _handleClosePopupMsg() { + this.setData({ popupMsg: { show: false } }); + }, + + // 复制房间号 + _handleCopy() { + let that = this; + wx.setClipboardData({ + data: that.data.popupMsg.data, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + $$.showToast({ title: '复制成功' }); + that.setData({ popupMsg: { show: false } }); + }, + }); + }, + }); + }, + + // 撤销申请 + async handleCancelCase(e) { + let caseId = e.detail; + $$.showLoading(); + const res = await cancelCaseApi(caseId); + $$.hideLoading(); + if (res.type) { + $$.showToast({ icon: 'success', title: '撤销成功' }); + await $$.sleep(); + this.getMyMediate(this.data.search); + } + }, + + // 获取我的调解案件 + async getMyMediate(submitData, caseMsg, type) { + $$.showLoading(); + const res = await getMyMediateApi(submitData); + $$.hideLoading(); + if (this.data.loading) { + // 取消滚动底部的加载状态 + this.setData({ loading: false }); + } + if (res.type) { + if (caseMsg) { + forEach: for (let i = 0; i <= res.data.content.length - 1; i++) { + if (res.data.content[i].id === caseMsg.id) { + this.data.data[caseMsg.caseIndex] = { ...res.data.content[i] }; + this.setData({ data: JSON.parse(JSON.stringify(this.data.data)) }); + break forEach; + } + } + } else { + if (submitData.page === 1) { + this.data.data = res.data.content || []; + } else { + this.data.data = this.data.data.concat(res.data.content || []); + } + this.setData({ search: submitData, data: this.data.data, total: res.data.totalElements || 0 }); + if (type === 'onPullDownRefresh') { + $$.showToast({ title: '已是最新记录', duration: 1000 }); + wx.stopPullDownRefresh(); + } + } + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getMyMediate(this.data.search); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 当其他页面返回时更新数据,caseIndex:判断那个案件的下标精确更新该案件,handleVisible:表示是否在其他页面操作了之后返回 + let caseMsg = app.globalData.caseMsg; + if (caseMsg.id && caseMsg.caseIndex !== undefined && caseMsg.handleVisible) { + let search = this.data.search; + search.size = search.page * 10; + search.page = 1; + this.getMyMediate(search, caseMsg); + app.globalData.caseMsg = {}; + } + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + let search = { + page: 1, + size: 10, + perType: this.data.search.perType, + process: '', + caseStatus: '', + }; + this.getMyMediate(search, '', 'onPullDownRefresh'); + }, +}); diff --git a/pages/myMediate/index.json b/pages/myMediate/index.json new file mode 100644 index 0000000..eca674b --- /dev/null +++ b/pages/myMediate/index.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "我的调解", + "usingComponents": { + "drop-down-select": "../../components/drop-down-select/index", + "mediate-card": "../../components/mediate-card/index" + }, + "enablePullDownRefresh": true +} diff --git a/pages/myMediate/index.wxml b/pages/myMediate/index.wxml new file mode 100644 index 0000000..fb0c965 --- /dev/null +++ b/pages/myMediate/index.wxml @@ -0,0 +1,40 @@ +<!--我的调解--> +<common-page> + <view class="myMediate"> + <view class="myMediate-fixed"> + <van-tabs active="{{ search.perType }}" bind:change="handleChangeTab" line-width="54rpx" nav-class="tab-nav-class" tab-active-class="tab-active-class"> + <van-tab name="{{item.name}}" title="{{item.title}}" wx:for="{{ tab }}" wx:key="index" /> + </van-tabs> + <view class="divide-div" /> + <drop-down-select bind:ongetvalue="handleGetType" data="{{ selectModel }}" active="{{ search }}" /> + </view> + <van-empty description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="myMediate-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view class="card-box" wx:for="{{ data }}" wx:key="index"> + <mediate-card bind:load="onLoad" bind:onOpenBottomPopup="handleOpenBottomPopup" bind:onCancelCase="handleCancelCase" caseindex="{{ index }}" data="{{ item }}" pageType="1" /> + </view> + <block> + <van-divider contentPosition="center" custom-style="margin-top: 0;" wx:if="{{ data.length >= total && data.length !== 0 }}">已加载全部数据</van-divider> + <view class="myMediate-scroll-loading" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> + +<!-- 底部弹窗 --> +<van-popup bind:close="_handleClosePopupMsg" closeable position="bottom" round show="{{ popupMsg.show }}" title="{{ popupMsg.title || '' }}" zIndex="999"> + <view class="popup-roomNo"> + <view>{{ popupMsg.data || '-' }}</view> + <view bind:tap="_handleCopy" class="popup-roomNo-copy"> + <van-icon name="{{ imgUrl }}copy-active.png" size="12" /> + <view style="padding-left:8rpx">复制</view> + </view> + </view> + + +</van-popup> \ No newline at end of file diff --git a/pages/myMediate/index.wxss b/pages/myMediate/index.wxss new file mode 100644 index 0000000..e36dd8f --- /dev/null +++ b/pages/myMediate/index.wxss @@ -0,0 +1,41 @@ +/* pages/myMediate/index.wxss */ +@import '../../styles/public_components.wxss'; + +.myMediate { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + left: 0; + right: 0; +} + +.myMediate-fixed { + background-color: var(--bg-color, #f0f2f5); + padding-top: 28rpx; +} + +.myMediate-scroll { + flex: 1; + overflow: hidden; + padding-top: 32rpx; +} + +.myMediate-scroll-loading { + text-align: center; +} + +.divide-div { + position: relative; + height: 32rpx; + background-color: var(--bg-color, #f0f2f5); + z-index: 99; +} + +.card-box { + padding: 0 var(--padding-my, 20rpx) 32rpx; +} + +.card-box-active { + background-color: var(--red-1); +} diff --git a/pages/myRegisterDetail/index.js b/pages/myRegisterDetail/index.js new file mode 100644 index 0000000..05fc310 --- /dev/null +++ b/pages/myRegisterDetail/index.js @@ -0,0 +1,115 @@ +// pages/myRegisterDetail/index.js +const $$ = require('../../utils/util'); + +// 详情接口 +function getByIdApi(param) { + return $$.request({ + url: 'caseInfo/getCaseInfo', + type: 'get', + submitData: param || {}, + service: 'mediate' + }) +} + +// 附件查询接口 +function getfilesApi(param) { + return $$.request({ + url: 'fileInfo/listByMainId', + type: 'get', + submitData: param || {}, + service: 'sys' + }) +} + + +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + fileUrl: $$.baseUrl + $$.url.fileShowUrl, + submitData: {}, + oneList: [], + fileList: [] + }, + + // 获取附件信息 + async getFilesId(id) { + $$.showLoading(); + const res = await getfilesApi({ + mainId: id + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + fileList: data + }); + } + }, + + detailPerson(e) { + let item = e.currentTarget.dataset.item; + console.log('item', item); + wx.navigateTo({ + url: '../../pages/DetailPerson/index?id=' + item.id + '&perType=' + item.perType, + }); + }, + + // 预览图片 + handlePreviewImage(e) { + let item = e.currentTarget.dataset.item; + let index = e.currentTarget.dataset.index; + console.log('item,', item); + console.log('item,', `${this.data.fileUrl}${item.showUrl}`); + wx.previewImage({ + current: `${this.data.fileUrl}${item.showUrl}`, + urls: [`${this.data.fileUrl}${item.showUrl}`] // 需要预览的图片http链接列表 + }); + }, + + // 获取纠纷案件详情 + async getById(data) { + $$.showLoading(); + const res = await getByIdApi({ + id: data.id + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + submitData: data, + oneList: [...data.personList, ...data.agentList] + }); + this.getFilesId(data.id) + + } + }, + + //选择纠纷类型 、跳转事项概况语音描述,跳转事项申请语音描述 + caseTypeGoPage(e) { + let url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url + '?id=' + this.data.caseId, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getById(options); + this.setData({ + caseId: data.id + }) + }, + // 处理悬浮图片点击 + handleFloatImageClick() { + wx.navigateTo({ + url: `/pages/floatImagePage/index?caseId=${this.data?.submitData?.id}&caseDes=${this.data?.submitData?.caseDes}` + }) + }, + +}) \ No newline at end of file diff --git a/pages/myRegisterDetail/index.json b/pages/myRegisterDetail/index.json new file mode 100644 index 0000000..2f4869c --- /dev/null +++ b/pages/myRegisterDetail/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "事项详情", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/myRegisterDetail/index.wxml b/pages/myRegisterDetail/index.wxml new file mode 100644 index 0000000..09a84a9 --- /dev/null +++ b/pages/myRegisterDetail/index.wxml @@ -0,0 +1,95 @@ +<!--pages/myRegisterDetail/index.wxml--> +<!-- 悬浮图片 --> +<view class="float-image" bindtap="handleFloatImageClick"> + <image src="{{imgUrl}}Aimge.png" mode="widthFix" /> + <text class="float-image-text">解纷数智人</text> +</view> +<view class="three-tag"> + <van-tabs line-width='33%' animated bind:click="threeTagChange" active="{{threeAvtice}}"> + <!-- 人员信息 --> + <van-tab title="人员信息" name="1"> + <view style="padding:24rpx"> + <view wx:for="{{oneList}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view class='one-list' bindtap="detailPerson" data-item="{{ item }}" wx:if="{{item.perType==='15_020008-1'||item.perType==='24_00006-1'}}"> + <view class="one-list-l green">申请方</view> + <view class="one-list-r"> + <view class="one-list-r-t"> + <view class="one-list-text">{{item.trueName||'-'}}</view> + <view class="one-list-phone">{{item.mobile||'-'}}</view> + <view wx:if="{{item.perType==='24_00006-1'}}" class="one-list-tag">代理人</view> + </view> + <view wx:if="{{item.perClass==='09_01001-1'}}" class="one-list-r-b">{{item.perClassName}} | {{item.certiNo}} </view> + <view wx:if="{{item.perClass!=='09_01001-1'}}" class="one-list-r-b">{{item.perClassName}} | {{item.legalRepresent}} | {{item.socialCreditCode}} </view> + </view> + </view> + <view class='one-list' bindtap="detailPerson" data-item="{{ item }}" wx:else> + <view class="one-list-l orange"><text>被申\n请方</text></view> + <view class="one-list-r"> + <view class="one-list-r-t"> + <view class="one-list-text">{{item.trueName||'-'}}</view> + <view class="one-list-phone">{{item.mobile||'-'}}</view> + <view wx:if="{{item.perType==='24_00006-2'}}" class="one-list-tag-orange">代理人</view> + </view> + <view wx:if="{{item.perClass==='09_01001-1'}}" class="one-list-r-b">{{item.perClassName||'-'}} |{{item.certiNo||'-'}}</view> + <view wx:if="{{item.perClass!=='09_01001-1'}}" class="one-list-r-b">{{item.perClassName}} | {{item.legalRepresent}} | {{item.socialCreditCode}} </view> + </view> + </view> + </view> + </view> + </van-tab> + <van-tab title="纠纷信息" name="2"> + <view class="three-tag2"> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷类型</view> + <view>{{ submitData.caseTypeName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷发生时间</view> + <view>{{ submitData.occurTime || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷发生地点</view> + <view>{{ submitData.addr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">涉及人数(人)</view> + <view>{{ submitData.peopleNum || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">涉及金额(元)</view> + <view>{{ submitData.amount || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">事项概况</view> + <view>{{ submitData.caseDes || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">事项申请</view> + <view>{{ submitData.caseClaim || '-' }}</view> + </view> + <!-- todo 人工智能提醒 --> + </view> + + </van-tab> + <van-tab title="事件材料" name="3"> + <view style="height: 16rpx;"> + + </view> + <view style="padding: 24rpx 32rpx 0; background-color: #fff;" wx:for="{{fileList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}"> + <view class="fileList_border"> + <image class="fileList_img" src="{{imgUrl}}image_1.png" mode="" /> + <view class="flex_1"> + <view style="margin-bottom: 10rpx;">{{item.name}}</view> + <view style="display: flex;gap:16rpx"><text class="fileList_title">{{item.size}}{{item.unit}}</text><text data-item="{{item}}" data-index="{{index}}" bindtap="handlePreviewImage" class="public-color">预览</text></view> + </view> + </view> + </view> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <van-button bind:click="caseTypeGoPage" data-url="../../pages/addFilesList/index" block data-type="next" type="primary">补充材料</van-button> + <view class="safeHeight" /> + </view> + </view> + </van-tab> + </van-tabs> +</view> \ No newline at end of file diff --git a/pages/myRegisterDetail/index.wxss b/pages/myRegisterDetail/index.wxss new file mode 100644 index 0000000..073ee32 --- /dev/null +++ b/pages/myRegisterDetail/index.wxss @@ -0,0 +1,169 @@ +/* pages/myRegisterDetail/index.wxss */ +@import '../../styles/public_components.wxss'; + +.one-list { + background: #fff; + padding: 24rpx; + display: flex; + position: relative; + gap: 8px; + margin-bottom: 12px; + border-radius: 8px; +} + +.one-list-l { + height: 96rpx; + width: 96rpx; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + font-size: 28rpx; + text-align: center; +} + +.one-list-r-t { + display: flex; + gap: 8px; + font-size: 28rpx; + line-height: 44rpx; +} + +.one-list-phone { + color: rgba(23, 26, 29, 0.60); +} + +.one-list-tag { + font-size: 24rpx; + line-height: 40rpx; + border-radius: 2px; + background: #e6fffb; + color: #13C2C2; + padding: 0 8rpx; +} + +.one-list-tag-orange { + font-size: 24rpx; + line-height: 40rpx; + border-radius: 2px; + background: #FFF2E6; + color: #EF6C24; + padding: 0 8rpx; +} + +.one-list-r { + flex: 1; +} + +.one-list-r-b { + color: rgba(23, 26, 29, 0.60); + font-size: 24rpx; + line-height: 40rpx; + margin-top: 8rpx; +} + +.three-tag {} + +.three-tag .van-tabs__wrap { + height: 96rpx !important; +} + +.van-tabs__wrap .van-tab--active { + color: var(--main-color) !important; +} + +.three-tag .van-tabs__nav { + height: 100%; +} + +.three-tag .van-tabs__scroll--line { + height: 100%; +} + +.three-tag .van-tab { + height: 100%; + line-height: 96rpx !important; +} + +.three-tag2 { + background-color: #fff; + margin-top: 16rpx; + padding: 24rpx 32rpx; +} + +.green { + background-color: #13C2C2; +} + +.orange { + background-color: #EF6C24; +} + +.fileList { + background-color: #fff; + padding: 24rpx 32rpx; + display: flex; + gap: 32rpx; + align-items: center; +} + +.fileList_border { + padding-bottom: 24rpx; + display: flex; + gap: 32rpx; + align-items: center; + border-bottom: 1px solid rgba(126, 134, 142, 0.16); +} + +.fileList_img { + width: 84rpx; + height: 96rpx; +} + +.fileList_title { + color: rgba(23, 26, 29, 0.40); + font-size: 28rpx; +} + +.fileList_img_del { + width: 32rpx; + height: 32rpx; +} + +.flex_1 { + flex: 1; +} + +.submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + padding: 32rpx var(--padding-my); + background-color: #fff; + z-index: 99; +} + +.float-image { + position: fixed; + right: 32rpx; + bottom: 200rpx; + display: flex; + flex-direction: column; + align-items: center; + z-index: 999; +} + +.float-image image { + width: 100rpx; + height: auto; +} + +.float-image-text { + font-size: 24rpx; + color: #1A6FB8; + margin-top: 8rpx; + font-weight: 500; +} \ No newline at end of file diff --git a/pages/myRegisterFlow/index.js b/pages/myRegisterFlow/index.js new file mode 100644 index 0000000..252e9e9 --- /dev/null +++ b/pages/myRegisterFlow/index.js @@ -0,0 +1,146 @@ +// pages/myRegisterFlow/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +// 详情接口 +function getByIdApi(param) { + return $$.request({ + url: 'caseTask/listCaseFlow', + type: 'get', + submitData: param || {}, + service: 'mediate' + }) +} + +// 催办 +function saveCaseUrgingApi(submitData) { + return $$.request({ + url: 'caseUrging/saveCaseUrging', + type: 'post', + submitData, + service: 'mediate' + }) +} + +// 催办回复量 +function countByCaseIdApi(submitData) { + return $$.request({ + url: 'caseUrging/countByCaseId', + type: 'get', + submitData, + service: 'mediate' + }) +} + + +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + flows: [{ + title: '提交申请', + status: '1', + name1: '线上', + name2: '2024-7-12 12:00', + name3: '金融纠纷' + }, { + title: '事项办理', + status: '2', + name4: '2024-7-12 12:00', + name5: '白云区新市街司法所' + }, { + title: '事项办结', + status: '3', + name6: '2024-7-12 12:00', + name7: '1', + name7_1: '化解成功' + } + // , { + // title: '事项评价', + // status: '4', + // name8: '2024-7-12 12:00', + // name9: '张孟宇', + // name10: '4', + // name11: '工作人员认真负责结案结果符合预期' + // } + ] + }, + + // 获取纠纷案件详情 + async getById(data) { + $$.showLoading(); + const res = await getByIdApi({ + caseId: data.caseId + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || []; + let urgingShow = res.data.findIndex(i => i.processStep === 3) > -1 ? false : true + this.setData({ + flows: data, + urgingShow + }); + } + }, + + // 催办任务 + async urgingClick() { + $$.showLoading(); + const res = await saveCaseUrgingApi({ + caseId: this.data.caseId + }); + $$.hideLoading(); + if (res.type) { + let data = res.data; + if (!data) { + $$.showToast({ + icon: 'success', + title: '催办成功', + duration: 1000 + }); + } else { + $$.showToast({ + title: '您的操作过于频繁,请稍后再试', + duration: 1000 + }); + } + } + }, + + // 催办任务 + async countByCaseId(caseId) { + $$.showLoading(); + const res = await countByCaseIdApi({ + caseId + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || 0; + this.setData({ + flowNumber: data + }) + } + }, + + // 查看催办回复 + GoPage(e) { + let url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getById(options); + this.countByCaseId(options.caseId) + this.setData({ + caseId: options.caseId + }) + }, +}) \ No newline at end of file diff --git a/pages/myRegisterFlow/index.json b/pages/myRegisterFlow/index.json new file mode 100644 index 0000000..11492b8 --- /dev/null +++ b/pages/myRegisterFlow/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "办理流程", + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} \ No newline at end of file diff --git a/pages/myRegisterFlow/index.wxml b/pages/myRegisterFlow/index.wxml new file mode 100644 index 0000000..b6acbda --- /dev/null +++ b/pages/myRegisterFlow/index.wxml @@ -0,0 +1,69 @@ +<!--pages/myRegisterFlow/index.wxml--> +<view class="main"> + <view class="flex" wx:for="{{flows}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view class="left"> + <view class="icon"> + <image class="icon-image" src="{{imgUrl}}myRegisterList_5.png" mode="" /> + </view> + <view wx:if="{{index < 3}}" class="line"></view> + </view> + <view class="right" style="margin-bottom:{{index<flows.length-1 ?'32rpx':'0'}}"> + <view class="list-content-flex margin-top"> + <view class="list-content-value">{{item.processName||'-'}}</view> + </view> + <view wx:if="{{item.processStep===1}}" class="list-content-flex margin-top"> + <view class="list-content-title">反映形式:</view> + <view class="list-content-value">{{item.visitWayName||'-'}}</view> + </view> + <view wx:if="{{item.processStep===1}}" class="list-content-flex margin-top"> + <view class="list-content-title">申请时间:</view> + <time-format format="YYYY-MM-DD HH:mm" value="{{item.showTime||'-'}}" /> + </view> + <view wx:if="{{item.processStep===1}}" class="list-content-flex margin-top"> + <view class="list-content-title">纠纷类型:</view> + <view class="list-content-value">{{item.caseTypeName||'-'}}</view> + </view> + <view wx:if="{{item.processStep===2}}" class="list-content-flex margin-top"> + <view class="list-content-title">受理时间:</view> + <time-format format="YYYY-MM-DD HH:mm" value="{{item.showTime||''}}" /> + </view> + <view wx:if="{{item.processStep===2}}" class="list-content-flex margin-top"> + <view class="list-content-title">承办部门:</view> + <view class="list-content-value">{{item.mediateUnitName||'-'}}</view> + </view> + <view wx:if="{{item.processStep===3}}" class="list-content-flex margin-top"> + <view class="list-content-title">办结时间:</view> + <time-format format="YYYY-MM-DD HH:mm" value="{{item.showTime||''}}" /> + </view> + <view wx:if="{{item.processStep===3}}" class="list-content-flex margin-top"> + <view class="list-content-title">化解结果:</view> + <view class="list-content-value {{item.mediResult==='22_00025-1'? 'green':item.mediResult==='22_00025-2'? 'red':''}}">{{item.mediResultName||'-'}}</view> + </view> + <view wx:if="{{item.processStep===4}}" class="list-content-flex margin-top"> + <view class="list-content-title">评价时间:</view> + <time-format format="YYYY-MM-DD HH:mm" value="{{item.showTime}}" /> + </view> + <view wx:if="{{item.processStep===4}}" class="list-content-flex margin-top"> + <view class="list-content-title">评价人:</view> + <view class="list-content-value">{{item.evaluateUserName||'-'}}</view> + </view> + <view wx:if="{{item.processStep===4}}" class="list-content-flex margin-top"> + <view class="list-content-title">评价等级:</view> + <view class="list-content-value"> + <van-rate value="{{item.evaluateGrade||0}}" size="{{ 18 }}" count="5" color="#ffd21e" void-icon="star" void-color="#C9CDD4" bind:change="onChange" /> + </view> + </view> + <view wx:if="{{item.processStep===4}}" class="list-content-flex margin-top"> + <view class="list-content-title">评语:</view> + <view class="list-content-value">{{item.evaluateRemark||'-'}}</view> + </view> + </view> + </view> +</view> +<view class="myRegisterFlow_bind public-color" wx:if="{{urgingShow}}"> + <text bindtap="urgingClick">进展太慢,催一下? </text> + <view bindtap="GoPage" data-url="{{'../../pages/urgingList/index?caseId='+caseId}}" wx:if="{{flowNumber>0}}" class="text-with-dot public-color"> + 催办回复 + <view class="dot"></view> + </view> +</view> \ No newline at end of file diff --git a/pages/myRegisterFlow/index.wxss b/pages/myRegisterFlow/index.wxss new file mode 100644 index 0000000..214dcf7 --- /dev/null +++ b/pages/myRegisterFlow/index.wxss @@ -0,0 +1,88 @@ +/* pages/myRegisterFlow/index.wxss */ +.main { + padding: 32rpx 24rpx; +} + +.flex { + display: flex; + gap: 24rpx; +} + +.icon { + width: 36rpx; + height: 36rpx; + background: #e8f3ff; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + padding: 12rpx; +} + +.icon-image { + width: 24rpx; + height: 24rpx; +} + +.line { + height: 100%; + border-left: 1px solid #1a6fb8; +} + +.left { + display: flex; + flex-direction: column; + align-items: center; + gap: 8rpx; +} + +.list-content-flex { + display: flex; + align-items: flex-start; +} + +.margin-top { + margin-top: 8rpx; +} + +.list-content-title { + width: 140rpx; + font-size: 28rpx; + color: rgba(23, 26, 29, 0.60); +} + +.list-content-value { + font-size: 28rpx; + flex: 1; +} + +.green { + color: #00B42A; +} + +.myRegisterFlow_bind { + padding: 0 24rpx; + text-align: center; + display: flex; + justify-content: center; + gap: 24rpx; +} + +.text-with-dot { + position: relative; + font-size: 16px; + /* 根据需要调整字体大小 */ +} + +.dot { + position: absolute; + top: -2px; + right: -4px; + width: 6px; + /* 红点直径 */ + height: 6px; + /* 红点直径 */ + background: #f53f3f; + border-radius: 50%; + /* 红点是圆形 */ +} \ No newline at end of file diff --git a/pages/myRegisterList/index.js b/pages/myRegisterList/index.js new file mode 100644 index 0000000..be40cdc --- /dev/null +++ b/pages/myRegisterList/index.js @@ -0,0 +1,253 @@ +// pages/myRegisterList/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + + +function pageQueryApi(param) { + return $$.request({ + url: 'caseInfo/pageCard', + type: 'get', + submitData: param || {}, + service: 'mediate' + }) +} + +function getfilesApi(param) { + return $$.request({ + url: 'fileInfo/listByMainIdAndType', + type: 'get', + submitData: param || {}, + service: 'sys' + }) +} + + + +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: $$.url.img, + fileUrl: $$.baseUrl + $$.url.fileShowUrl, + search: { + page: 1, + size: 10, + processStatus: '', + personType: '1' + }, + searchValue: '全部', + showModal: false, + processStatusList: [{ + label: '全部', + value: '', + hover: true + }, { + label: '待受理', + value: '1' + }, { + label: '办理中', + value: '2' + }, { + label: '已结案', + value: '3' + }, { + label: '不予受理', + value: '4' + }], + dataList: [] + }, + + // 查看 + GoPage(e) { + let url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url, + }); + }, + + // 关闭筛选框 + addClosePopup() { + console.log('111', 11); + this.setData({ + showModal: false + }) + }, + + // 打开筛选条件 + searchChange() { + this.setData({ + showModal: true + }) + }, + + searchSelect(e) { + let idx = e.currentTarget.dataset.index; + let item = e.currentTarget.dataset.item; + console.log('item', item); + let searchData = { + ...this.data.search, + processStatus: item.value + } + this.pageQuery(searchData) + this.setData({ + processStatusList: this.data.processStatusList?.map((item, index) => ({ + ...item, + hover: index === idx ? true : false + })), + searchValue: item.label, + showModal: false + }) + }, + + // 切换tab + threeTagChange(e) { + let value = e.detail; + console.log(value, ); + let data = { + ...this.data.search, + personType: value.name, + } + this.setData({ + search: data + }); + this.pageQuery(data) + }, + + // 折叠列表 + changeShow(e) { + let idx = e.currentTarget.dataset.index; + this.data.dataList[idx].show = !this.data.dataList[idx].show; + this.setData({ + dataList: this.data.dataList + }) + }, + + async pageQuery(params, type) { + $$.showLoading(); + const res = await pageQueryApi(params); + $$.hideLoading(); + if (this.data.loading) { + this.setData({ + loading: false + }); + } + if (res.type) { + let list = [] + if (params.page === 1) { + list = res.data.content || []; + } else { + list = this.data.data.concat(res.data.content || []); + } + this.setData({ + search: params, + dataList: list.map((i, index) => ({ + ...i, + plaintiffNames: i.plaintiffList.length > 0 ? i.plaintiffList.map(i => i.trueName).join('、') : '-', + defendantNames: i.defendantList.length > 0 ? i.defendantList.map(i => i.trueName).join('、') : '-', + show: index === 0 ? true : false, + newAgreeContent: i.agreeContent ? i.agreeContent?.length > 75 ? i.agreeContent.slice(0, 75) + '...' : i.agreeContent : '', + agreeContentShow: i.agreeContent?.length > 75 ? true : false, + })), + total: res.data.totalElements || 0 + }); + if (type === 'onPullDownRefresh') { + $$.showToast({ + title: '已是最新记录', + duration: 1000 + }); + wx.stopPullDownRefresh(); + } + } + }, + + // 前往查看 + AiModalClick(e) { + let item = e.currentTarget.dataset.item; + wx.navigateTo({ + url: '../../pages/AIAide/index?caseDes=' + item.caseDes + '&caseClaim=' + item.caseClaim + '&caseId=' + item.caseId + }); + this.setData({ + AiModal: false + }) + }, + + // 展示协议要点 + agreeContentClick(e) { + let item = e.currentTarget.dataset.item; + this.setData({ + showData: { + visible: true, + title: item.agreeContent + } + }) + }, + // 关闭协议要点 + agreeContentClosePopup(e) { + this.setData({ + showData: { + visible: false, + title: '' + } + }) + }, + + // 查看协议文书 + async agreeClick(e) { + let item = e.currentTarget.dataset.item; + $$.showLoading(); + + const res = await getfilesApi({ + mainId: item.id, + ownerType: '22_00018-302', + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || []; + if (data?.length === 0) { + $$.showToast({ + title: '暂无协议文书', + duration: 1000 + }); + } + wx.previewImage({ + current: `${this.data.fileUrl}${data[0].showUrl}`, + urls: data.map(item => `${this.data.fileUrl}${item.showUrl}`) // 需要预览的图片http链接列表 + }); + } + }, + + // 评价 + evaluate(e) { + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: '../../pages/evaluate/index?id=' + id + }); + }, + + // 关闭AI弹窗 + // addClosePopup() { + // this.setData({ + // AiModal: false + // }) + // }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, + + onShow() { + this.pageQuery(this.data.search) + // let AICase = wx.getStorageSync('AICase') || ''; + // if (AICase) { + // this.setData({ + // AiModal: AICase + // }) + // wx.removeStorage({ + // key: 'AICase' + // }) + // } + } +}) \ No newline at end of file diff --git a/pages/myRegisterList/index.json b/pages/myRegisterList/index.json new file mode 100644 index 0000000..df0995d --- /dev/null +++ b/pages/myRegisterList/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "进度查询", + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} \ No newline at end of file diff --git a/pages/myRegisterList/index.wxml b/pages/myRegisterList/index.wxml new file mode 100644 index 0000000..73cfca0 --- /dev/null +++ b/pages/myRegisterList/index.wxml @@ -0,0 +1,125 @@ +<!--pages/myRegisterList/index.wxml--> +<view class="three-tag"> + <van-tabs line-width='50%' animated bind:click="threeTagChange" active="{{search.personType}}"> + <van-tab title="我是申请方" name="1"></van-tab> + <van-tab title="我是被申请方" name="2"></van-tab> + </van-tabs> +</view> +<!-- 筛选 --> +<view bindtap="searchChange" class="search"> + <view class="search-title">{{searchValue}}</view> + <van-icon size='9' name="{{imgUrl}}down.png" /> +</view> + +<view class="list" wx:for="{{dataList}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view style="{{!item.show&&'border-bottom:none'}}" class="list-top"> + <view> + <time-format format="YYYY年MM月DD日" value="{{item.createTime}}" />反映诉求 + </view> + <view class="list-top-r"> + <view wx:if="{{item.processStatus===1}}" class="list-top-r-tag">{{item.processStatusName||'-'}}</view> + <view wx:if="{{item.processStatus===2}}" class="list-top-r-tag">{{item.processStatusName||'-'}}</view> + <view wx:if="{{item.processStatus===3}}" class="list-top-r-tag list-top-r-tag-grey">{{item.processStatusName||'-'}}</view> + <view wx:if="{{item.processStatus===4}}" class="list-top-r-tag">{{item.processStatusName||'-'}}</view> + <van-icon wx:if="{{item.show}}" size='16' bindtap="changeShow" data-index="{{ index }}" name="{{imgUrl}}myRegisterList_1.png" /> + <van-icon wx:else size='16' bindtap="changeShow" data-index="{{ index }}" name="{{imgUrl}}myRegisterList_4.png" /> + </view> + </view> + <view class="list-content" wx:if="{{item.show}}"> + <view class="list-content-flex"> + <view class="list-content-title">申请时间</view> + <view class="list-content-value"> + <time-format format="YYYY-MM-DD" value="{{item.createTime}}" /> + </view> + </view> + <view class="list-content-flex margin-top"> + <view class="list-content-title">申请方</view> + <view class="list-content-value">{{item.plaintiffNames}}</view> + </view> + <view class="list-content-flex margin-top"> + <view class="list-content-title">被申请方</view> + <view class="list-content-value">{{item.defendantNames}}</view> + </view> + <view wx:if="{{item.processStatus===2||item.processStatus===3}}" class="list-content-flex margin-top"> + <view class="list-content-title">承办部门</view> + <view class="list-content-value">{{item.mediateDeptName||'-'}}</view> + </view> + <view wx:if="{{item.processStatus===3}}" class="list-content-flex margin-top"> + <view class="list-content-title">化解结果</view> + <view wx:if="{{item.mediResult==='22_00025-1'}}" class="list-content-value green-title">{{item.mediResultName||'-'}}</view> + <view wx:if="{{item.mediResult==='22_00025-2'}}" class="list-content-value red-title">{{item.mediResultName||'-'}}</view> + </view> + <view wx:if="{{item.agreeType==='24_00003-1'}}" class="list-content-flex margin-top"> + <view class="list-content-title">协议要点</view> + <view wx:if="{{item.agreeContentShow}}" class="list-content-value">{{item.newAgreeContent||'-'}}<text bindtap="agreeContentClick" data-item="{{item}}" class="public-color">更多</text></view> + </view> + <view wx:if="{{item.agreeType==='24_00003-2'}}" class="list-content-flex margin-top"> + <view class="list-content-title">协议文书</view> + <view bindtap="agreeClick" data-item="{{item}}" class="list-content-value list-detail-r">查看</view> + </view> + <view class="list-border"></view> + <view class="list-detail" bindtap="GoPage" data-url="{{'../../pages/myRegisterDetail/index?id='+item.id}}"> + <view class="list-detail-l"> + <van-icon size='16' name="{{imgUrl}}myRegisterList_6.svg" /> + <view class="list-detail-title">事项详情</view> + </view> + <view class="list-detail-r">查看</view> + </view> + <!-- <view wx:if="{{item.processStatus<3}}" class="list-detail" bindtap="GoPage" data-url="{{'../../pages/AIAide/index?caseDes='+item.caseDes+'&caseClaim='+item.caseClaim+'&caseId='+item.id}}"> + <view class="list-detail-l"> + <van-icon size='16' name="{{imgUrl}}myRegisterList_7.png" /> + <view class="list-detail-title">解纷数智人</view> + </view> + <view class="list-detail-r">查看</view> + </view> --> + <view wx:if="{{item.processStatus>1}}" bindtap="GoPage" data-url="{{'../../pages/myRegisterFlow/index?caseId='+item.id}}" class="list-detail"> + <view class="list-detail-l"> + <van-icon size='16' name="{{imgUrl}}myRegisterList_3.png" /> + <view class="list-detail-title">办理流程</view> + </view> + <view class="list-detail-r">查看</view> + </view> + <view wx:if="{{item.processStatus>2&&item.isEvaluate==='0'}}" class="list-border"></view> + <view wx:if="{{item.processStatus>2&&item.isEvaluate==='0'}}" style="margin: 24rpx 0;"> + <van-button bind:click="evaluate" block data-id="{{item.id}}" type="primary">去评价</van-button> + </view> + </view> +</view> + +<van-overlay show="{{ showModal }}" bind:click="addClosePopup"> + +</van-overlay> + +<view wx:if="{{ showModal }}" class="showModal-search"> + <view bindtap="searchChange" class="search"> + <view class="search-title">{{searchValue}}</view> + <van-icon size='9' name="{{imgUrl}}down.png" /> + </view> + <view class="showModal-select"> + <view class="showModal-select-title">办理进度</view> + <view bindtap="searchSelect" class="showModal-select-flex" wx:for="{{processStatusList}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view class="showModal-select-flex-text {{item.hover&& 'public-color'}}">{{item.label}}</view> + <van-icon wx:if="{{item.hover}}" size='15' name="{{imgUrl}}myRegisterList_5.png" /> + </view> + </view> +</view> + +<!-- <van-overlay show="{{ showData.visible }}" bind:click="agreeContentClosePopup"> + +</van-overlay> + +<view wx:if="{{ showData.visible }}" class="showData-title"> + <view class="showData-title-view"> + <view class="showData-title-label">协议要点</view> + <view>{{showData.title}}</view> + </view> + <view class=""> + </view> +</view> --> + +<van-action-sheet bind:close="agreeContentClosePopup" round='false' show="{{ showData.visible }}"> + <view class="showData-title-view"> + <view class="showData-title-label">协议要点</view> + <view>{{showData.title}}</view> + </view> +</van-action-sheet> \ No newline at end of file diff --git a/pages/myRegisterList/index.wxss b/pages/myRegisterList/index.wxss new file mode 100644 index 0000000..e38347d --- /dev/null +++ b/pages/myRegisterList/index.wxss @@ -0,0 +1,179 @@ +/* pages/myRegisterList/index.wxss */ +.search { + display: flex; + background-color: #fff; + margin: 24rpx; + padding: 24rpx; + align-items: center; + border-radius: 5px; +} + +.showModal-search { + position: absolute; + top: 96rpx; + width: 100%; + z-index: 991; +} + +.showModal-select { + background-color: #fff; + margin: 0 24rpx; + border-radius: 5px; + padding: 32rpx; +} + +.showModal-select-title { + color: rgba(23, 26, 29, 0.60); +} + +.showModal-select-flex { + display: flex; + margin-top: 24rpx; + justify-content: space-between; +} + +.search-title { + margin-right: 16rpx; +} + +.three-tag {} + +.three-tag .van-tabs__wrap { + height: 96rpx !important; +} + +.van-tabs__wrap .van-tab--active { + color: var(--main-color) !important; +} + +.three-tag .van-tabs__nav { + height: 100%; +} + +.three-tag .van-tabs__scroll--line { + height: 100%; +} + +.three-tag .van-tab { + height: 100%; + line-height: 96rpx !important; +} + +.list { + background-color: #fff; + margin: 16rpx 24rpx 0; + border-radius: 4px; +} + +.list-top { + border-bottom: 1px dashed #e5e6eb; + padding: 24rpx; + display: flex; + justify-content: space-between; + align-items: center; +} + +.list-top-r { + display: flex; + align-items: center; + gap: 10rpx; +} + +.list-top-r-tag { + background: #eff8ff; + border-radius: 2px; + padding: 7rpx 12rpx; + color: var(--main-color); +} + +.list-top-r-tag-grey { + background: #f2f3f5; + color: #1d2129; +} + +.green-title { + color: #00B42A; +} + +.red-title { + color: #F53F3F; +} + +.list-content { + padding: 24rpx; +} + +.list-content-flex { + display: flex; + align-items: flex-start; + gap: 48rpx; +} + +.margin-top { + margin-top: 16rpx; +} + +.list-content-title { + width: 120rpx; + color: rgba(23, 26, 29, 0.60); +} + +.list-content-value { + flex: 1; +} + +.list-border { + border-bottom: 1px solid #E5E6EB; + margin-top: 24rpx; +} + +.list-detail { + display: flex; + justify-content: space-between; + background-color: #f7f8fa; + margin-top: 24rpx; + padding: 16rpx 24rpx; +} + +.list-detail-l { + display: flex; + gap: 8rpx; +} + + + +.list-detail-title { + font-size: 28rpx; +} + +.list-detail-r { + color: var(--main-color); + font-size: 28rpx; +} + +.one-add-person-tip .van-popup--round { + width: 90%; +} + +.one-add-person-tip .van-popup--center { + top: 198rpx !important; +} + +.showData-title { + background-color: #fff; + position: absolute; + min-height: 538rpx; + bottom: 0rpx; + width: 100%; + z-index: 991; +} + +.showData-title-view { + padding: 40rpx 32rpx; +} + +.showData-title-label { + font-size: 34rpx; + line-height: 50rpx; + margin-bottom: 24rpx; +} \ No newline at end of file diff --git a/pages/orderConfirm/index.js b/pages/orderConfirm/index.js new file mode 100644 index 0000000..a6baf2d --- /dev/null +++ b/pages/orderConfirm/index.js @@ -0,0 +1,78 @@ +// pages/orderConfirm/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +function orderConfirmApi(submitData) { + return $$.request({ url: 'paMeetInfo/updateReserve', type: 'post', service: 'mediate', submitData }); +} + +Page({ + /** + * 页面的初始数据 + */ + data: { + data: {}, + submitData: { + id: 0, + fixStatus: '2', + fixStatusName: '已确认', + fixContent: '', + }, + editVisible: true, + pageType: null, // '1':我的调解; '2':我的司法确认 + }, + + // 点击修改 or 提交 + handleCickEdit() { + if (!this.data.editVisible) { + this.data.submitData.fixStatus = this.data.data.meetInfo.fixStatus === '1' ? '2' : this.data.data.meetInfo.fixStatus; + this.data.submitData.fixStatusName = this.data.data.meetInfo.fixStatusName || '已确认'; + this.data.submitData.fixContent = this.data.data.meetInfo.fixContent || ''; + this.setData({ editVisible: true, submitData: this.data.submitData }); + return false; + } + this.orderConfirm(); + }, + + // 修改form + handleChange(e) { + let key = e.currentTarget.dataset.key; + let value = e.detail; + if (key === 'fixStatus') { + value = value ? '2' : '3'; + } + this.data.submitData[key] = value; + this.setData({ submitData: this.data.submitData }); + }, + + async orderConfirm() { + $$.showLoading(); + let submitData = this.data.submitData; + submitData.fixStatusName = submitData.fixStatus === '2' ? '已确认' : '无法确认'; + submitData.fixContent = submitData.fixStatus === '2' ? '' : submitData.fixContent; + const res = await orderConfirmApi(submitData); + $$.hideLoading(); + if (res.type) { + app.globalData.caseMsg.handleVisible = true; + $$.showToast({ icon: 'success', title: '提交成功' }); + this.data.data.meetInfo.fixStatus = submitData.fixStatus; + this.data.data.meetInfo.fixContent = submitData.fixContent; + this.setData({ editVisible: false, data: this.data.data }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (options.meetUserId) { + this.data.submitData.id = options.meetUserId; + this.data.pageType = options.pageType; + this.setData({ + submitData: this.data.submitData, + data: app.globalData.caseMsg, + editVisible: app.globalData.caseMsg.meetInfo.fixStatus === '1', + }); + } + }, +}); diff --git a/pages/orderConfirm/index.json b/pages/orderConfirm/index.json new file mode 100644 index 0000000..bb91262 --- /dev/null +++ b/pages/orderConfirm/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "预约确认", + "usingComponents": {} +} diff --git a/pages/orderConfirm/index.wxml b/pages/orderConfirm/index.wxml new file mode 100644 index 0000000..0e00df5 --- /dev/null +++ b/pages/orderConfirm/index.wxml @@ -0,0 +1,62 @@ +<!--预约确认--> +<common-page safeBottom="true"> + <view class="card"> + <view class="cell2"> + <view class="cell-title-placeholder">预约时间</view> + <view>{{ data.meetInfo.orderStartTime || '-' }} ~ {{ data.meetInfo.orderEndTime || '-' }}</view> + </view> + <view class="cell2 cell-noPadding"> + <view class="cell-title-placeholder">预约地点</view> + <view>{{ data.meetInfo.meetAddr || '-' }}</view> + </view> + <view class="cell2 cell-noPadding"> + <view class="cell-title-placeholder">预约方式</view> + <view>{{ data.meetInfo.meetWayName || '-' }}</view> + </view> + <view class="cell2 cell-noPadding"> + <view class="cell-title-placeholder">线上{{ pageType === '1' ? '调解' : '司法确认' }}房间号</view> + <view>{{ data.meetInfo.roomNo || '-' }}</view> + </view> + <view class="cell2 cell-noPadding"> + <view class="cell-title-placeholder">预约说明</view> + <view>{{ data.meetInfo.meetAddr || '-' }}</view> + </view> + </view> + <view class="card" wx:if="{{ !editVisible }}"> + <view class="cell2"> + <view class="cell-title-placeholder">我将</view> + <view>{{ data.meetInfo.fixStatus === '2' ? '按时参与' : '无法参与' }}</view> + </view> + <view class="cell2 cell-noPadding" wx:if="{{ data.meetInfo.fixStatus !== '2' }}"> + <view class="cell-title-placeholder">理由说明</view> + <view>{{ data.meetInfo.fixContent || '-' }}</view> + </view> + </view> + <view class="card" style="padding-top:0;padding-bottom:0;" wx:else> + <view class="orderConfirm-cell"> + <view class="cell-title">我将</view> + <view class="orderConfirm-select"> + <view style="margin-right:16rpx;">{{ submitData.fixStatus === '2' ? '按时参与' : '无法参与' }}</view> + <van-switch bind:change="handleChange" checked="{{ submitData.fixStatus === '2' ? true : false }}" data-key="fixStatus" size="22px" /> + </view> + </view> + <view class="cell2 cell-noPadding" wx:if="{{ submitData.fixStatus !== '2' }}"> + <view class="cell-title">理由说明</view> + <van-field + autosize="{{ { maxHeight: 88, minHeight: 22 } }}" + bind:change="handleChange" + border="{{ false }}" + custom-style="padding:0;" + data-key="fixContent" + placeholder="请简要描述您无法参与的理由" + placeholder-style="color: rgba(0, 0, 0, 0.5)" + type="textarea" + value="{{ submitData.fixContent }}" + /> + </view> + </view> + <view class="orderConfirm-submitButton"> + <van-button bind:click="handleCickEdit" block type="primary">{{ editVisible ? '提交' : '修改' }}</van-button> + <view class="safeHeight" /> + </view> +</common-page> diff --git a/pages/orderConfirm/index.wxss b/pages/orderConfirm/index.wxss new file mode 100644 index 0000000..67fe246 --- /dev/null +++ b/pages/orderConfirm/index.wxss @@ -0,0 +1,32 @@ +/* pages/orderConfirm/index.wxss */ +@import '../../styles/public_components.wxss'; + +.card { + padding: 0 32rpx; + background-color: #ffffff; + margin: 0 var(--padding-my); + border-radius: var(--border-radius-card); + margin-top: 24rpx; +} + +.orderConfirm-cell { + padding: 24rpx 0; + display: flex; + height: 44rpx; +} + +.orderConfirm-select { + display: flex; + flex: 1; + justify-content: flex-end; +} + +.orderConfirm-submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + padding: 32rpx var(--padding-my); + background-color: var(--bg-color); + z-index: 99; +} diff --git a/pages/organizeDetail/index.js b/pages/organizeDetail/index.js new file mode 100644 index 0000000..bb51c26 --- /dev/null +++ b/pages/organizeDetail/index.js @@ -0,0 +1,51 @@ +// pages/organizeDetail/index.js +const $$ = require('../../utils/util'); + +function getByIdApi(param) { + return $$.request({ + url: 'ctUnit/getById', + type: 'get', + submitData: param || {}, + service: 'cust' + }) +} +Page({ + + /** + * 页面的初始数据 + */ + data: { + data: {}, + }, + + + // 获取纠纷案件详情 + async getById(data) { + $$.showLoading(); + const res = await getByIdApi({ + id: data.id + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + data + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getById(options); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + +}) \ No newline at end of file diff --git a/pages/organizeDetail/index.json b/pages/organizeDetail/index.json new file mode 100644 index 0000000..b7c5e36 --- /dev/null +++ b/pages/organizeDetail/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "调解组织详情", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/organizeDetail/index.wxml b/pages/organizeDetail/index.wxml new file mode 100644 index 0000000..c6f7c0e --- /dev/null +++ b/pages/organizeDetail/index.wxml @@ -0,0 +1,28 @@ +<!--pages/ssimDetail/index.wxml--> +<common-page> + <view class="card"> + <view class="cell3"> + <view class="cell-title-placeholder">服务中心名称</view> + <view>{{ data.unitName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">办公地址</view> + <view>{{ data.addr || '-' }}</view> + </view> + <map longitude="113.2038664" latitude="23.1622136" show-location="false" scale="16" style="width: 100%; height: 280rpx;"></map> + <view class="cell3"> + <view class="cell-title-placeholder">邮政编码</view> + <view>{{ data.postalCode || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">联系电话</view> + <view>{{ data.dutyMobile || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">办公时间</view> + <view>{{data.workTimeWeek||'-'}}</view> + <view>{{data.workTimeAm||'-'}}</view> + <view>{{data.workTimePm||'-'}}</view> + </view> + </view> +</common-page> \ No newline at end of file diff --git a/pages/organizeDetail/index.wxss b/pages/organizeDetail/index.wxss new file mode 100644 index 0000000..fa6f248 --- /dev/null +++ b/pages/organizeDetail/index.wxss @@ -0,0 +1,16 @@ +/* pages/organizeDetail/index.wxss *//* pages/ssimDetail/index.wxss */ +.card { + padding: 24rpx 32rpx; + background-color: #ffffff; + border-radius: var(--border-radius-card); +} + +.cell3 { + margin-bottom: 16rpx; +} + +.cell-title-placeholder { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(0, 0, 0, 0.5); +} \ No newline at end of file diff --git a/pages/organizeList/index.js b/pages/organizeList/index.js new file mode 100644 index 0000000..17381bc --- /dev/null +++ b/pages/organizeList/index.js @@ -0,0 +1,259 @@ +const $$ = require('../../utils/util'); +const app = getApp(); + +function pageZzQueryApi(param) { + return $$.request({ + url: 'ctUnit/pageTjQuery', + type: 'get', + submitData: param || {}, + service: 'cust' + }) +} + +Page({ + /** + * 页面的初始数据 + */ + userInfo: {}, + location: [], // 省市区等地理资源 + data: { + imgUrl: $$.url.img, + search: { + prov: '', + provName: '', + city: '', + cityName: '', + area: '', + areaName: '', + road: '', + roadName: '', + keyword: '', + page: 1, + size: 10, + }, // 查询条件 + data: [], // 数据 + total: 0, // 总数 + popup: { + formtype: '', + index: 0, + }, // 下拉弹出框数据 + }, + + // 下拉框选择确认 + handleConfirmPicker({ + detail + }) { + let type = this.data.popup.type, + value = detail.detail.value, + arr = []; + this.data.popup.visible = false; + if (type === 'caseCause') { + arr = ['caseType', 'caseTypeName']; + arr.forEach((x, t) => { + this.data.search[x] = value[0][t === 0 ? 'value' : 'label']; + }); + } else if (type === 'location') { + arr = [ + ['city', 'cityName'], + ['area', 'areaName'], + ['road', 'roadName'], + ]; + arr.forEach((x, t) => { + this.data.search[x[0]] = value[t]?.value || ''; + this.data.search[x[1]] = value[t]?.label || ''; + }); + } + this.setData({ + popup: this.data.popup, + search: this.data.search + }); + }, + + // 多行下拉选择时,省市区选择 + handleChangeColumns(e) { + if (this.data.popup.type === 'location') { + let selectData = $$.changeLocation(e, this.location, this.data.popup.selectData); + this.setData({ + popup: { + ...this.data.popup, + selectData + } + }); + } + }, + + // 下拉框选择开启 + handleShowPopup(e) { + let type = e.currentTarget.dataset.type; + let selectData = []; + if (type === 'location') { + if (this.location.length === 0) { + return false; + } + let selectOption = JSON.parse(JSON.stringify(this.location)); + let arr = $$.getLocationIndex(this.location, this.data.search); // 计算默认的市区县下标 + selectData = [{ + values: selectOption, + defaultIndex: arr[0] + }, + { + values: selectOption[arr[0]].children, + defaultIndex: arr[1] + }, + { + values: selectOption[arr[0]].children[arr[1]].children || [], + defaultIndex: arr[2] + }, + ]; + selectData.forEach((x) => { + x.values.forEach((y) => { + delete y.children; + }); + }); + } else { + let selectOption = this.select[type]; + selectData = [{ + values: selectOption, + defaultIndex: 0 + }]; + } + this.setData({ + popup: { + formtype: e.currentTarget.dataset.formtype, + index: e.currentTarget.dataset.index, + visible: true, + title: e.currentTarget.dataset.title, + type: type, + selectData: selectData, + }, + }); + }, + + // 关闭下拉框选择 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + searchButton() { + this.pageZzQuery(this.data.search) + }, + + async pageZzQuery(params, type) { + $$.showLoading(); + const res = await pageZzQueryApi(params); + $$.hideLoading(); + if (this.data.loading) { + this.setData({ + loading: false + }); + } + if (res.type) { + if (params.page === 1) { + this.data.data = res.data.content || []; + } else { + this.data.data = this.data.data.concat(res.data.content || []); + } + this.setData({ + search: params, + data: this.data.data, + total: res.data.totalElements || 0 + }); + if (type === 'onPullDownRefresh') { + $$.showToast({ + title: '已是最新记录', + duration: 1000 + }); + wx.stopPullDownRefresh(); + } + } + }, + + // 关闭底部弹窗 + handleClosePopupMsg() { + if (this.data.popupMsg.type === 1) { + this.getUserInfo(this.data.popupMsg.intentionObj); + } else { + this.setData({ + popupMsg: { + show: false + } + }); + } + }, + + // 滚动到底部获取案件 + handlescrolltolower() { + if (this.data.data.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ + loading: this.data.loading + }); + let submitData = { + ...this.data.search + }; + submitData.page = submitData.page + 1; + this.pageZzQuery(submitData); + } + }, + + // 返回首页 + handleGoHomepage() { + if (this.data.changeVisible) { + wx.navigateBack({ + delta: 1, + }); + return false; + } + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + }, + + // 获取省市区等地理资源 + async getLocationData() { + $$.showLoading(); + const res = await $$.commonRequest({ + url: `${$$.url.assets}locationSelect.json`, + type: 'get' + }); + $$.hideLoading(); + if (res) { + let location = []; + $$.province.forEach((x) => { + location.push(res[x][0]); + }); + this.location = location; + } + }, + + // 跳转详情 + _handleGoPage(e) { + let url = e.currentTarget.dataset.url; + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: url + '?id=' + id, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.pageZzQuery(this.data.search) + this.getLocationData(); + }, + + onShow: function () { + // this.pageZzQuery(this.data.search); + }, + + onHide: function () {}, + + onUnload: function () {}, +}); \ No newline at end of file diff --git a/pages/organizeList/index.json b/pages/organizeList/index.json new file mode 100644 index 0000000..99ee6f3 --- /dev/null +++ b/pages/organizeList/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "调解组织查询", + "usingComponents": { + } +} \ No newline at end of file diff --git a/pages/organizeList/index.wxml b/pages/organizeList/index.wxml new file mode 100644 index 0000000..4d2222d --- /dev/null +++ b/pages/organizeList/index.wxml @@ -0,0 +1,41 @@ +<common-page bind:onCancelPicker="handleClosePopup" bind:onChangePicker="handleChangeColumns" bind:onClosePopup="handleClosePopup" bind:onConfirmPicker="handleConfirmPicker" popup="{{ popup }}"> + <view class="ssimList"> + <!-- 综治中心查询 --> + <view class="card"> + <view class="cell"> + <view bindtap="handleShowPopup" data-type="location" class="cell-arrow cell-left"> + <view class="cell-left-l">{{ search.roadName ? search.roadName : '未选择' }}</view> + <van-icon name="arrow-down" /> + </view> + <view style="width:16rpx"></view> + <view class="cell-right"> + <van-icon name="search" /> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0;background-color:#f2f3f5" data-key="keyword" placeholder="请输入中心名称" value="{{ search.keyword }}" /> + <view style="color:#E5E6EB">|</view> + <view bindtap="searchButton" class="ssimList-title public-color">查询</view> + </view> + </view> + </view> + + <!-- 列表 --> + <van-empty description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="ssim-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view class="card-box" wx:for="{{ data }}" wx:key="index"> + <view class="card-list" bindtap="_handleGoPage" data-id="{{ item.id }}" data-url="../../pages/organizeDetail/index"> + <view class="card-title">{{item.unitName}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">办公地址:</text>{{item.addr||'-'}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">联系电话:</text>{{item.dutyMobile||'-'}}</view> + </view> + </view> + <block> + <van-divider contentPosition="center" custom-style="margin-top: 12px;" wx:if="{{ data.length >= total && data.length !== 0 }}">没有更多了</van-divider> + <view class="myMediate-scroll-loading" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> \ No newline at end of file diff --git a/pages/organizeList/index.wxss b/pages/organizeList/index.wxss new file mode 100644 index 0000000..1bacc7f --- /dev/null +++ b/pages/organizeList/index.wxss @@ -0,0 +1,83 @@ + +@import '../../styles/public_components.wxss'; + +.ssimList { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + left: 0; + right: 0; +} + +.card { + background-color: #ffffff; + padding: 0 24rpx; +} + +.cell-left { + display: flex; + width: 28%; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; +} + +.cell-left-l { + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: var(--font-size-md, 14px); +} + +.cell-right { + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; + font-size: var(--font-size-md, 14px); +} + +.card-box { + padding: 24rpx 24rpx 0 24rpx; +} + +.card { + border-radius: 2px; + background-color: #fff; +} + +.card-list { + border-radius: 2px; + background-color: #fff; + padding: 24rpx +} + +.ssim-scroll { + flex: 1; + overflow: hidden; +} + +.card-title { + font-size: 30rpx; + line-height: 46rpx; +} + +.card-subTitle { + padding-top: 8rpx; +} + +.card-subTitle-l { + color: rgba(23, 26, 29, 0.60); +} + +.ssimList-title { + font-size: 32rpx; + white-space: nowrap; +} \ No newline at end of file diff --git a/pages/perfectInformation/index.js b/pages/perfectInformation/index.js new file mode 100644 index 0000000..2e6408a --- /dev/null +++ b/pages/perfectInformation/index.js @@ -0,0 +1,211 @@ +// pages/perfectInformation/index.js +const $$ = require('../../utils/util'); + +// 保存信息 +function setUserInfoApi(submitData) { + return $$.request({ + url: 'paUser/perfectInfo', + type: 'post', + submitData, + service: 'cust' + }); +} + +Page({ + /** + * 页面的初始数据 + */ + copySubmitData: {}, // 数据复制 + isCheck: false, + data: { + submitData: { + trueName: '', + mobile: '', + sex: '09_00003-1', + sexName: '男', + idcardType: '09_00015-1', + idcardTypeName: '身份证', + idcard: '', + city: '', + cityName: '', + area: '', + areaName: '', + road: '', + roadName: '', + village: '', + villageName: '', + addr: '', + }, + popup: {}, // 下拉弹出框数据 + isCheck: false, // 是否只是查看 + isImproveData: false, // 是否是完善资料进入,则不显示身份证的修改 + }, + + // 展示弹出层 + handleShowPopup(e) { + this.setData({ + popup: e.detail + }); + }, + + // 关闭弹出层 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + // 下拉框确认选择 + handleConfirmPicker({ + detail + }) { + let type = this.data.popup.type; + let value = detail.detail.value; + let arr = []; + this.data.popup.visible = false; + if (type === 'location') { + arr = [ + ['city', 'cityName'], + ['area', 'areaName'], + ['road', 'roadName'], + ]; + arr.forEach((x, t) => { + this.data.submitData[x[0]] = value[t]?.value || ''; + this.data.submitData[x[1]] = value[t]?.label || ''; + }); + } else { + if (type === 'cardType') { + arr = ['idcardType', 'idcardTypeName']; + } else if (type === 'sex') { + arr = ['sex', 'sexName']; + } + arr.forEach((x, t) => { + this.data.submitData[x] = value[t === 0 ? 'value' : 'label']; + }); + } + this.setData({ + submitData: this.data.submitData, + popup: this.data.popup + }); + }, + + // form的change + handleChange(e) { + const { + key, + value + } = e.detail; + this.data.submitData[key] = value; + this.setData({ + submitData: this.data.submitData + }); + }, + + // 修改picker的列时触发 + handleChangeColumns(e) { + if (this.data.popup.type === 'location') { + let selectData = $$.changeLocation(e, this.selectComponent('#personal-data-dom').location, this.data.popup.selectData); + this.setData({ + popup: { + ...this.data.popup, + selectData + } + }); + } + }, + + // 验证 + checkSubmitData() { + if (this.data.submitData.mobile && !$$.mobileRegExp(this.data.submitData.mobile)) { + $$.showToast({ + title: '请输入正确的手机号码' + }); + return false; + } + let userInfo = wx.getStorageSync('userInfo'); + let that = this; + if (userInfo.realStatus === '1' && this.data.submitData.trueName !== this.copySubmitData.trueName) { + $$.showModal({ + content: '您修改了姓名,修改后需重新实名认证,是否继续操作?', + success: (res) => { + if (res.confirm) { + userInfo.realStatus = '99'; + wx.setStorageSync('userInfo', userInfo); + that.handleSave(); + } + }, + }); + return false; + } + if (userInfo.realStatus === '1' && this.data.submitData.idcard !== this.copySubmitData.idcard) { + $$.showModal({ + content: '您修改了身份证号码,修改后需重新实名认证,是否继续操作?', + success: (res) => { + if (res.confirm) { + userInfo.realStatus = '99'; + wx.setStorageSync('userInfo', userInfo); + that.handleSave(); + } + }, + }); + return false; + } + that.handleSave(); + }, + + // 保存 + async handleSave() { + $$.showLoading(); + const res = await setUserInfoApi(this.data.submitData); + $$.hideLoading(); + if (res.type) { + $$.showToast({ + title: '操作成功', + icon: 'success' + }); + await $$.sleep(); + wx.navigateBack({ + delta: 1, + }); + } + }, + + // 获取个人信息 + getUserInfo(e) { + let data = e.detail || {}; + let keys = Object.keys(this.data.submitData); + keys.forEach((x) => { + if (data[x]) { + this.data.submitData[x] = data[x]; + } + }); + if (this.isCheck && this.data.submitData.idcardType === '09_00015-1') { + this.data.submitData.idcard = `${this.data.submitData.idcard?.substring(0, 6)}********${this.data.submitData.idcard?.substring(14)}`; + } + this.setData({ + submitData: this.data.submitData + }); + this.copySubmitData = Object.assign({}, this.data.submitData); + }, + + // 获取手机号码 + async handleGetPhoneNumber(e) { + let phone = await this.selectComponent('#common-page').handleGetPhoneNumber(e.detail); + this.data.submitData.mobile = phone; + this.setData({ + submitData: this.data.submitData + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + isCheck: !!options.isCheck, + isImproveData: !!options.type + }); + this.isCheck = !!options.isCheck; + }, +}); \ No newline at end of file diff --git a/pages/perfectInformation/index.json b/pages/perfectInformation/index.json new file mode 100644 index 0000000..f97dbcc --- /dev/null +++ b/pages/perfectInformation/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "个人信息", + "usingComponents": { + "personal-data-dom": "../../components/personal-data-dom/index" + } +} diff --git a/pages/perfectInformation/index.wxml b/pages/perfectInformation/index.wxml new file mode 100644 index 0000000..e29728f --- /dev/null +++ b/pages/perfectInformation/index.wxml @@ -0,0 +1,28 @@ +<!--完善资料--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<common-page + bind:onCancelPicker="handleClosePopup" + bind:onChangePicker="handleChangeColumns" + bind:onClosePopup="handleClosePopup" + bind:onConfirmPicker="handleConfirmPicker" + popup="{{ popup }}" + id="common-page" +> + <!-- 表单 --> + <personal-data-dom + bind:getUserInfo="getUserInfo" + bind:handleChange="handleChange" + bind:handleGetPhoneNumber="handleGetPhoneNumber" + bind:handleShowPopup="handleShowPopup" + id="personal-data-dom" + isCheck="{{ isCheck }}" + submitData="{{ submitData }}" + type="perfectInformation" + isImproveData="{{ isImproveData }}" + /> + <view class="submit" wx:if="{{ !isCheck }}"> + <van-button bind:click="handleSave" block type="primary">更新</van-button> + <view class="safeHeight" /> + </view> +</common-page> diff --git a/pages/perfectInformation/index.wxss b/pages/perfectInformation/index.wxss new file mode 100644 index 0000000..c3eac46 --- /dev/null +++ b/pages/perfectInformation/index.wxss @@ -0,0 +1,9 @@ +/* pages/perfectInformation/index.wxss */ +.submit { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background: #fff; + padding: var(--padding-my); +} diff --git a/pages/realNameAuthentication/index.js b/pages/realNameAuthentication/index.js new file mode 100644 index 0000000..9e38c3b --- /dev/null +++ b/pages/realNameAuthentication/index.js @@ -0,0 +1,216 @@ +// pages/realNameAuthentication/index.js +const $$ = require('../../utils/util'); + +// 实名认证 +function realNameAuthenticationApi(submitData) { + return $$.request({ + url: 'paUser/realAuth', + type: 'post', + submitData, + service: 'cust' + }); +} + +Page({ + /** + * 页面的初始数据 + */ + backNum: 1, // 如果从完善资料进入则返回两级到个人中心 + data: { + steps: ['完善信息', '刷脸认证'], + submitData: { + trueName: '', + mobile: '', + idcardType: '09_00015-1', + idcardTypeName: '身份证', + idcard: '', + prov: '', + provName: '', + city: '', + cityName: '', + area: '', + areaName: '', + road: '', + roadName: '', + village: '', + villageName: '', + addr: '', + agree: false, + }, + popup: {}, // 下拉弹出框数据 + }, + + // 展示弹出层 + handleShowPopup(e) { + this.setData({ + popup: e.detail + }); + }, + + // 关闭弹出层 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + // 下拉框确认选择 + handleConfirmPicker({ + detail + }) { + let type = this.data.popup.type; + let value = detail.detail.value; + let arr = []; + this.data.popup.visible = false; + if (type === 'location') { + arr = [ + ['prov', 'provName'], + ['city', 'cityName'], + ['area', 'areaName'], + ['road', 'roadName'], + ['village', 'villageName'], + ]; + arr.forEach((x, t) => { + this.data.submitData[x[0]] = value[t]?.value || ''; + this.data.submitData[x[1]] = value[t]?.label || ''; + }); + } else { + if (type === 'cardType') { + arr = ['idcardType', 'idcardTypeName']; + } else if (type === 'sex') { + arr = ['sex', 'sexName']; + } + arr.forEach((x, t) => { + this.data.submitData[x] = value[t === 0 ? 'value' : 'label']; + }); + } + this.setData({ + popup: this.data.popup, + submitData: this.data.submitData + }); + }, + + // form的change + handleChange(e) { + const { + key, + value + } = e.detail; + this.data.submitData[key] = value; + this.setData({ + submitData: this.data.submitData + }); + }, + + // 修改picker的列时触发 + handleChangeColumns(e) { + if (this.data.popup.type === 'location') { + let selectData = $$.changeLocation(e, this.selectComponent('#personal-data-dom').location, this.data.popup.selectData); + this.setData({ + popup: { + ...this.data.popup, + selectData + } + }); + } + }, + + // 进行刷脸认证 + handleRealName() { + let submitData = this.data.submitData; + let msg = ''; + if (!submitData.trueName) { + msg = '请输入姓名'; + } else if (!submitData.idcard) { + msg = '请输入证件号码'; + } else if (!$$.mobileRegExp(submitData.mobile)) { + msg = '请输入正确的手机号码'; + } else if (!submitData.agree) { + msg = '请勾选确认信息'; + } + if (msg) { + $$.showToast({ + title: msg + }); + return false; + } + let that = this; + wx.checkIsSupportFacialRecognition({ + success() { + wx.startFacialRecognitionVerify({ + name: that.data.submitData.trueName, + idCardNumber: that.data.submitData.idcard, + success() { + console.log('识别成功'); + that.realNameAuthentication(); + }, + fail() { + $$.showToast({ + title: '抱歉!识别失败,请稍后重试' + }); + }, + }); + }, + fail(res) { + console.log(res); + $$.showToast({ + title: '抱歉!请求失败,稍后重试' + }); + }, + }); + }, + + // 上传实名认证数据 + async realNameAuthentication() { + $$.showLoading(); + const res = await realNameAuthenticationApi(this.data.submitData); + $$.hideLoading(); + if (res.type) { + this.getUserInfo() + $$.showToast({ + icon: 'success', + title: '实名认证成功' + }); + wx.removeStorage({ + key: 'access_token' + }); + await $$.sleep(); + wx.navigateBack({ + delta: this.backNum || 1, + }); + } + }, + + // 获取个人信息 + async getUserInfo(e) { + let data = e.detail || {}; + let keys = Object.keys(this.data.submitData); + keys.forEach((x) => { + if (data[x]) { + this.data.submitData[x] = data[x]; + } + }); + this.setData({ + submitData: this.data.submitData + }); + }, + + // 获取手机号码 + async handleGetPhoneNumber(e) { + let phone = await this.selectComponent('#common-page').handleGetPhoneNumber(e.detail); + this.data.submitData.mobile = phone; + this.setData({ + submitData: this.data.submitData + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (options.backNum) { + this.backNum = 2; + } + }, +}); \ No newline at end of file diff --git a/pages/realNameAuthentication/index.json b/pages/realNameAuthentication/index.json new file mode 100644 index 0000000..0c344c4 --- /dev/null +++ b/pages/realNameAuthentication/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "实名认证", + "usingComponents": { + "steps": "../../components/steps/index", + "personal-data-dom": "../../components/personal-data-dom/index" + } +} diff --git a/pages/realNameAuthentication/index.wxml b/pages/realNameAuthentication/index.wxml new file mode 100644 index 0000000..6bd275e --- /dev/null +++ b/pages/realNameAuthentication/index.wxml @@ -0,0 +1,33 @@ +<!--实名认证--> +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<common-page + bind:onCancelPicker="handleClosePopup" + bind:onChangePicker="handleChangeColumns" + bind:onClosePopup="handleClosePopup" + bind:onConfirmPicker="handleConfirmPicker" + popup="{{ popup }}" + id="common-page" +> + <!-- 步骤条 --> + <view class="steps"> + <steps stepsData="{{steps}}" /> + </view> + <!-- 表单 --> + <view class="form"> + <view class="form-title">为了享受更完善的调解服务,请如实完善以下信息</view> + <personal-data-dom + bind:getUserInfo="getUserInfo" + bind:handleChange="handleChange" + bind:handleGetPhoneNumber="handleGetPhoneNumber" + bind:handleShowPopup="handleShowPopup" + id="personal-data-dom" + submitData="{{ submitData }}" + type="realNameAuthentication" + > + <van-cell border="{{ false }}"> + <van-button bind:click="handleRealName" block slot="title" type="primary">进入刷脸认证</van-button> + </van-cell> + </personal-data-dom> + </view> +</common-page> diff --git a/pages/realNameAuthentication/index.wxss b/pages/realNameAuthentication/index.wxss new file mode 100644 index 0000000..170e41e --- /dev/null +++ b/pages/realNameAuthentication/index.wxss @@ -0,0 +1,19 @@ +/* pages/realNameAuthentication/index.wxss */ +.steps { + padding: 24rpx 0; + background-color: #ffffff; +} + +.form { + background-color: #ffffff; + margin-top: var(--padding-my); +} + +.form-title { + padding: 24rpx var(--padding-my); +} + +.form-text { + font-size: 28rpx; + color: #646566; +} diff --git a/pages/register/index.js b/pages/register/index.js new file mode 100644 index 0000000..0bce11f --- /dev/null +++ b/pages/register/index.js @@ -0,0 +1,947 @@ +// pages/register/index.js +const $$ = require('../../utils/util'); +const app = getApp(); +import Toast from '../../components/vant/toast/toast'; + +// 获取个人信息 +function getUserInfoApi() { + return $$.request({ + url: 'paUser/getUserInfo', + type: 'get', + service: 'cust' + }); +} + +// 附件上传的id +function getByIdApi(param) { + return $$.request({ + url: 'caseUtils/getNewTimeCaseId', + type: 'get', + submitData: param || {}, + service: 'utils' + }); +} + +// 删除附件 +function delfileApi(id) { + return $$.request({ + url: 'fileInfo/deleteFileById?id=' + id, + type: 'get', + service: 'sys', + }); +} + +function getawApi(submitData) { + return $$.request({ + url: 'case-law/get-clain-rise-case', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} + +// 获取案例 +function getCaseApi(submitData) { + return $$.request({ + url: 'case-law/get-case', + type: 'post', + ai: true, + submitData, + service: 'mediate', + }); +} + +function caseRegisterSaveApi(submitData) { + return $$.request({ + url: 'caseInfo/caseRegister', + type: 'post', + submitData, + service: 'mediate' + }); +} + +// 限制选择地图位置在白云区内 +function checkRegisterAreaApi(submitData) { + return $$.request({ + url: 'syRegion/checkRegisterArea', + type: 'get', + submitData, + service: 'sys' + }); +} + +Page({ + /** + * 页面的初始数据 + */ + userInfo: {}, + location: [], // 省市区等地理资源 + select: {}, // 下拉框数据 + goToMaterialSave: false, // 避免跳转到材料上传页面重复保存草稿 + agreementMsg: '', // 服务协议 + ownerId: '', //附件上传id + data: { + stepText: 5, //用户须知倒计时5秒 + timer: null, // 用于存储定时器的引用 + popupVisibleText: false, //是否滚动到底部 + imgUrl: $$.url.img, + steps: [{ + title: '填写人员', + number: '1', + activeIcon: 'steps-register-1-active.png' + }, + { + title: '描述纠纷', + number: '2', + activeIcon: 'steps-register-2-active.png' + }, + { + title: '提交申请', + number: '3', + activeIcon: 'steps-register-3-active.png' + }, + ], + saveStatus: false, //未提交,已提交 + oneList: [], + titleShow: { + '09_01001-1': ['自然人', '姓名', '真实姓名'], + '09_01001-2': ['法人', '企业名称', '企业全名', '法定代表人姓名'], + '09_01001-3': ['机构代表人', '机构名称', '机构全名', '机构代表人姓名'], + }, // 用于判断显示的输入框标题 + stepsActive: 0, // 步骤条当前下标 + submitData: { + occurTime: new Date().getTime(), + occurTimeName: $$.moment(new Date().getTime()).format('YYYY-MM-DD'), + caseType: '', + caseTypeName: '', + addr: '', + lat: '', + lng: '', + peopleNum: '', + amount: '', + caseDes: '', + caseClaim: '', + }, // 表单数据 + fileList: [], //表单附件 + addPersonData: {}, //添加的当事人 + materialNum: 0, // 纠纷材料总数量 + userInfoVisible: false, // 是否采用个人信息更新申请人信息 + timePicker: false, //时间选择展示 + maxDate: new Date().getTime(), + popup: { + formtype: '', // 控制在纠纷信息 or 申请人信息 or 被申请人添加数据 + index: 0, // 如为申请人信息 or 被申请人确认下拉选择此参数为下标 + }, // 下拉弹出框数据 + changeVisible: false, // 是否是修改 + recordingVisible: false, // 录音界面是否显示 + popupMsg: { + show: false, + title: '', + type: 1, + editType: 'add', + buttonText: '' + }, // 弹窗, type: 1'恢复草稿',2'申请人',3'被申请人', editType: 'add'新增,'edit'修改 + tipData: { + caseList: [].join("\n"), + guideList: [], + }, + caseText: '', + caseTitle: '', + similarity: '', + showCase: false, + popupSelect: { + show: false, + data: [], + activeIndex: null + }, // 选择人员 + threeAvtice: '1', + caseDesNum: 0, //事项概况字数 + caseClaimNum: 0, //事项申请字数 + }, + + // 获取服务协议 + async getAgreement() { + var that = this; + const res = await $$.commonRequest({ + url: `${$$.url.txt}agree.txt`, + type: 'get' + }); + if (res) { + that.data.popupVisible = true; + that.setData({ + popupVisible: true, + }); + this.startCountdown(); // 启动倒计时 + } + }, + + //须知弹窗倒计时 + startCountdown: function () { + let that = this; + that.setData({ + timer: setInterval(function () { + if (that.data.stepText > 0) { + that.data.stepText--; + that.setData({ + stepText: that.data.stepText + }); + } else { + clearInterval(that.data.timer); // 倒计时结束,清除定时器 + // 在这里执行销毁操作,比如隐藏或删除倒计时组件 + } + }, 1000) + }) + }, + + + + // 表单修改 + handleChange(e) { + let key = e.currentTarget.dataset.key, + value = e.detail; + this.data.submitData[key] = value; + this.setData({ + submitData: this.data.submitData + }); + if (key === 'caseDes' || key === 'caseClaim') { + this.setData({ + [key + 'Num']: value.length + }); + } + }, + + threeTagChange(e) { + value = e.detail; + this.setData({ + threeAvtice: value + }); + }, + // 下拉框选择确认 + handleConfirmPicker({ + detail + }) { + let type = this.data.popup.type, + value = detail.detail.value, + arr = []; + this.data.popup.visible = false; + if (type === 'caseCause') { + arr = ['caseType', 'caseTypeName']; + arr.forEach((x, t) => { + this.data.submitData[x] = value[0][t === 0 ? 'value' : 'label']; + }); + } else if (type === 'location') { + arr = [ + ['city', 'cityName'], + ['area', 'areaName'], + ['road', 'roadName'] + ]; + arr.forEach((x, t) => { + this.data.submitData[x[0]] = value[t]?.value || ''; + this.data.submitData[x[1]] = value[t]?.label || ''; + }); + } + this.setData({ + popup: this.data.popup, + submitData: this.data.submitData + }); + }, + + + // 下拉框选择开启 + handleShowPopup(e) { + let type = e.currentTarget.dataset.type; + let selectData = []; + if (type === 'location') { + if (this.location.length === 0) { + return false; + } + let selectOption = JSON.parse(JSON.stringify(this.location)); + let arr = $$.getLocationIndex(this.location, this.data.submitData); // 计算默认的市区县下标 + selectData = [{ + values: selectOption, + defaultIndex: arr[0] + }, + { + values: selectOption[arr[0]].children, + defaultIndex: arr[1] + }, + { + values: selectOption[arr[0]].children[arr[1]].children || [], + defaultIndex: arr[2] + }, + ]; + selectData.forEach((x) => { + x.values.forEach((y) => { + delete y.children; + }); + }); + } else if (type === 'occurTime') { + this.setData({ + timePicker: true + }) + return; + } else { + let selectOption = this.select[type]; + selectData = [{ + values: selectOption, + defaultIndex: 0 + }]; + } + this.setData({ + popup: { + formtype: e.currentTarget.dataset.formtype, + index: e.currentTarget.dataset.index, + visible: true, + title: e.currentTarget.dataset.title, + type: type, + selectData: selectData, + }, + }); + }, + // 关闭下拉框选择 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + + + // 滚动到底部事件 + handlescrolltolower() { + this.setData({ + popupVisibleText: true + }) + }, + + // 用户须知 + handleAgree(e) { + let type = e.currentTarget.dataset.type; + if (!this.data.popupVisibleText) { + Toast('请阅读完整的用户须知'); + return; + } + if (type === 'agree') { + // 同意协议之后退出登录后不重复弹出 + wx.setStorage({ + key: 'agreement', + data: 1 + }); + } + this.setData({ + popupVisible: false + }); + if (this.data.oneList?.length === 0) { + this.setData({ + addMePlaintiff: true + }) + } + }, + + // 下一步 or 上一步 + handleNext(e) { + let type = e.currentTarget.dataset.type; + if (type === 'next' && this.data.stepsActive === 0) { + if (this.data.oneList?.length <= 0) { + $$.showToast({ + title: '请至少添加一名当事人', + duration: 500 + }); + } else { + this.setData({ + stepsActive: 1 + }); + this.getById(); + } + return; + } + if (type === 'back' && this.data.stepsActive === 1) { + this.setData({ + stepsActive: 0 + }); + return; + } + if (type === 'next' && this.data.stepsActive === 1) { + let newData = this.data.submitData; + if (!newData.caseType) { + $$.showToast({ + title: '请选择纠纷类型', + duration: 500 + }); + return; + } + if (!newData.occurTime) { + $$.showToast({ + title: '请选择纠纷发生时间', + duration: 500 + }); + return; + } + if (!newData.addr) { + $$.showToast({ + title: '请选择纠纷发生地', + duration: 500 + }); + return; + } + if (!newData.caseDes) { + $$.showToast({ + title: '请填写事项概况', + duration: 500 + }); + return; + } + if (!newData.caseClaim) { + $$.showToast({ + title: '请填写事项申请', + duration: 500 + }); + return; + } + // 提交AI接口 + // this.getaw(newData); + if (this.data.fileList?.length <= 0) { + // 附件上传提示 + this.setData({ + showFileTip: true + }) + return; + } + this.setData({ + stepsActive: 2 + }); + return; + } + if (type === 'back' && this.data.stepsActive === 2) { + this.setData({ + stepsActive: 1 + }); + return; + } + // 申请提交 + if (type === 'next' && this.data.stepsActive === 2) { + let data = this.data.submitData; + let list = this.data.oneList; + let personList = []; //"15_020008-1" 申请方当事人 ,"15_020008-2" 被申请方当事人 + let agentList = []; //"24_00006-1" 申请方代理人 ,"24_00006-2" 被申请方代理人 + personList = list.filter(item => item.perType === '15_020008-1' || item.perType === '15_020008-2'); + agentList = list.filter(item => item.perType === '24_00006-1' || item.perType === '24_00006-2'); + this.caseRegisterSave({ + ...data, + personList, + agentList, + id: this.data.ownerId, + }); + } + }, + + async getaw(data) { + let newData = { + caseDes: data.caseDes, + caseClaim: data.caseClaim, + caseId: this.data.ownerId, + } + const res = await getawApi(newData); + if (res.type) { + this.setData({ + AIData: res.data || {} + }) + } + }, + + async getById() { + $$.showLoading(); + const res = await getByIdApi(); + $$.hideLoading(); + if (res.type) { + this.setData({ + ownerId: res.data || '' + }) + } + }, + + async caseRegisterSave(params) { + $$.showLoading(); + const res = await caseRegisterSaveApi(params); + $$.hideLoading(); + if (res.type) { + // Toast('提交成功'); + this.setData({ + saveStatus: true + }) + } + const res1 = await getCaseApi({ + caseDes: params.caseDes, + caseClaim: params.caseClaim, + caseId: params.id, + }); + if (res1.type) { + wx.setStorage({ + key: 'AICase', + data: { + caseDes: params.caseDes, + caseClaim: params.caseClaim, + caseId: params.id, + } + }); + } + }, + + //选择纠纷类型 、跳转事项概况语音描述,跳转事项申请语音描述 + caseTypeGoPage(e) { + let url = e.currentTarget.dataset.url; + let type = e.currentTarget.dataset.type; + let value = e.currentTarget.dataset.value; + wx.navigateTo({ + url: url + '?type=' + type + '&value=' + value, + }); + }, + + // 图片识别 + ocrClick(e) { + let key = e.currentTarget.dataset.key; + let keyNum = e.currentTarget.dataset.keynum; + let that = this; + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success(res2) { + const tempFiles = res2.tempFiles[0]; + $$.showLoading(); + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/wechat/fileInfo/recognitionText`, + filePath: tempFiles.tempFilePath, + name: 'file', + header: { + Authorization: app.globalData.token + }, + complete(res3) { + $$.hideLoading(); + if (res3.errMsg === 'uploadFile:ok') { + let { + code, + data + } = JSON.parse(res3.data); + if (code == -1) { + $$.errorModal({ + content: '识别失败' + }); + return; + } + let wordsResult = data?.ocrResult?.wordsResult.join(''); + let wordsResultNum = data?.ocrResult?.wordsResultNum; + that.setData({ + submitData: { + ...that.data.submitData, + [key]: that.data.submitData[key] + wordsResult + }, + [keyNum]: (that.data.submitData[keyNum] + wordsResult).length + }); + } + }, + }); + }, + }); + }, + + //选择地址 + async openmap(e) { + var that = this; + console.log('latitude') + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function (res) { + wx.chooseLocation({ + success: function (res) { + that.checkRegisterArea(res) + + }, + + }) + } + }) + }, + + async checkRegisterArea(item) { + $$.showLoading(); + const res = await checkRegisterAreaApi({ + lng: item.longitude, + lat: item.latitude + }); + $$.hideLoading(); + if (res.type) { + console.log('res', res); + if (res.data) { + this.setData({ + submitData: { + ...this.data.submitData, + addr: item.address, + lng: item.longitude, + lat: item.latitude, + } + }) + } else { + $$.errorModal({ + title: '提示信息', + content: res.msg, + success: () => { + + }, + }); + } + } + }, + + delAddress() { + this.setData({ + submitData: { + ...this.data.submitData, + addr: '', + lng: '', + lat: '' + } + }) + }, + + // 上传文件图片 + async handleUploadFile(e) { + let id = e.currentTarget.dataset.id; + let type = e.currentTarget.dataset.type; + let key = e.currentTarget.dataset.key; + if (key) { + this.setData({ + showFileTip: false + }) + } + let that = this; + this.filesArr = []; + wx.chooseMedia({ + mediaType: ['image'], + success(res2) { + const tempFiles = res2.tempFiles; + // 多个文件逐一上传 + tempFiles.forEach((x, t) => { + $$.showLoading('上传中...'); + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/wechat/fileInfo/upload?mainId=${id}&ownerId=${id}&ownerType=${type}`, + filePath: x.tempFilePath, + name: 'file', + header: { + Authorization: app.globalData.token + }, + complete(res) { + $$.hideLoading(); + if (res.errMsg === 'uploadFile:ok') { + const getData = JSON.parse(res.data) + const file = { + ...getData.data[0], + wxurl: x.tempFilePath + }; + that.setData({ + fileList: that.data.fileList.concat(file) + }) + $$.showToast({ + icon: 'success', + title: '上传成功', + duration: 500 + }); + } else { + $$.showToast({ + title: '上传失败', + duration: 500 + }); + } + + }, + }); + }); + }, + }); + }, + + // 弹窗取消上传附件 + noUploadNext() { + this.setData({ + stepsActive: 2, + showFileTip: false + }); + }, + + // 预览图片 + handlePreviewImage(e) { + let item = e.currentTarget.dataset.item; + console.log('item', item); + let index = e.currentTarget.dataset.index; + wx.previewImage({ + current: item.wxurl, + urls: [item.wxurl] // 需要预览的图片http链接列表 + }); + }, + + // 删除图片 + async handleDelImage(e) { + let item = e.currentTarget.dataset.item; + let index = e.currentTarget.dataset.index; + let id = e.currentTarget.dataset.id; + let type = e.currentTarget.dataset.type; + $$.showModal({ + title: '删除材料确认', + content: '确定删除材料' + item.name + '吗?', + cancelText: '我再想想', + confirmText: '确定删除', + success: async (res) => { + if (res.confirm) { + $$.showLoading(); + const res = await delfileApi(id); + if (res.type) { + $$.showToast({ + icon: 'success', + title: '删除成功', + duration: 500 + }); + let list = this.data.fileList.filter((i, idx) => idx !== index); + console.log('list', list); + this.setData({ + fileList: list + }) + } + } + }, + }); + + }, + + // 请求下拉框资源 + async getSelectOptionData() { + const res = await $$.commonRequest({ + url: `${$$.url.assets}selectOption.json`, + type: 'get' + }); + if (res) { + this.select.cardType = res.data.cardType || []; + this.select.caseCause = this.data.caseCause || []; + this.select.personClass = res.data.personClass || []; + } + }, + + + // 获取个人信息 + async getUserInfo() { + $$.showLoading(); + const res = await getUserInfoApi(); + $$.hideLoading(); + if (res.type) { + let data = res.data || {} + this.setData({ + oneList: [{ + ...data, + perType: '15_020008-1', + perTypeName: '申请方当事人', + perClass: '09_01001-1', + perClassName: '自然人', + certiNo: data.idcard || '', + certiType: data.certiType || '09_00015-1', + certiTypeName: data.certiTypeName || '身份证', + agentCode: data.idcard || '', + }] + }) + }; + }, + + // 自动添加申请人提醒 + oneAddMe(e) { + let formtype = e.currentTarget.dataset.formtype; + if (formtype === 'yes') { + this.getUserInfo() + } + this.setData({ + addMePlaintiff: false + }) + }, + + // 填写人员 + oneDelPerson(e) { + console.log('e', e); + let index = e.currentTarget.dataset.index; + let item = e.currentTarget.dataset.item; + + $$.showModal({ + title: '删除人员确认', + content: '确定删除当事人' + item.trueName + '吗?', + cancelText: '我再想想', + confirmText: '确定删除', + success: (res) => { + if (res.confirm) { + this.setData({ + oneList: this.data.oneList.filter((i, idx) => idx !== index) + }) + } + }, + }); + }, + + // 添加当事人 + oneAddPerson(e) { + let perType = e.currentTarget.dataset.pertype; + let perTypeName = e.currentTarget.dataset.pertypename; + let oneList = this.data.oneList; + if (!perType) { + this.setData({ + addPerson: true + }) + } else { + this.setData({ + addPerson: false + }) + if (perTypeName === '申请方代理人') { + // 申请方 或 被申请方 + let newList = oneList.filter(item => item.perType === "15_020008-1"); + let objs = newList.map(i => ({ + trueName: i.trueName, + agentCode: i.agentCode, + })); + wx.navigateTo({ + url: `../../pages/addAgent/index?perType=${perType}&perTypeName=${perTypeName}&objs=${JSON.stringify(objs)}`, + }); + } else if (perTypeName === '被申请方代理人') { + // 申请方 或 被申请方 + let newList = oneList.filter(item => item.perType === "15_020008-2"); + let objs = newList.map(i => ({ + trueName: i.trueName, + agentCode: i.agentCode, + })); + wx.navigateTo({ + url: `../../pages/addAgent/index?perType=${perType}&perTypeName=${perTypeName}&objs=${JSON.stringify(objs)}`, + }); + } else { + wx.navigateTo({ + url: `../../pages/addPerson/index?perType=${perType}&perTypeName=${perTypeName}`, + }); + } + } + }, + + // 修改当事人 + oneEditPerson(e) { + let item = e.currentTarget.dataset.item; + let index = e.currentTarget.dataset.index; + let oneList = this.data.oneList; + if (item.perType === '24_00006-1') { + let newList = oneList.filter(item => item.perType === "15_020008-1"); + let objs = newList.map(i => ({ + trueName: i.trueName, + agentCode: i.agentCode, + })); + wx.navigateTo({ + url: `../../pages/addAgent/index?data=${JSON.stringify(item)}&index=${index}&objs=${JSON.stringify(objs)}`, + }); + } else if (item.perType === '24_00006-2') { + let newList = oneList.filter(item => item.perType === "15_020008-2"); + let objs = newList.map(i => ({ + trueName: i.trueName, + agentCode: i.agentCode, + })); + wx.navigateTo({ + url: `../../pages/addAgent/index?data=${JSON.stringify(item)}&index=${index}&objs=${JSON.stringify(objs)}`, + }); + } else { + wx.navigateTo({ + url: `../../pages/addPerson/index?data=${JSON.stringify(item)}&index=${index}`, + }); + } + }, + + // 关闭自定义弹窗 + addClosePopup(e) { + let key = e.currentTarget.dataset.key; + this.setData({ + [key]: false + }) + }, + + // 选择发生事件确定 + onInput(e) { + let key = e.currentTarget.dataset.key; + let value = e.detail; + this.setData({ + [key]: false, + submitData: { + ...this.data.submitData, + occurTime: value, + occurTimeName: $$.moment(value).format('YYYY-MM-DD'), + } + }) + }, + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function () { + let agreement = wx.getStorageSync('agreement'); + if (!agreement) { + this.getAgreement(); + } else { + if (this.data.oneList?.length === 0) { + this.setData({ + addMePlaintiff: true + }) + } + } + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if (this.data.oneData?.trueName) { + let list = this.data.oneList; + if (this.data.editIndex) { + list[this.data.editIndex] = this.data.oneData; + } else { + list = list.concat(this.data.oneData) + } + console.log('list', list); + this.setData({ + oneList: list, + oneData: {}, + editIndex: false, + }) + } + + if (this.data.twoData?.label) { + this.setData({ + submitData: { + ...this.data.submitData, + caseType: this.data.twoData.value, + caseTypeName: this.data.twoData.label, + }, + twoData: {} + }) + } + if (this.data.twoValue) { + console.log('this.data.twoValue', this.data.twoValue); + console.log('this.data.twoKey', this.data.twoKey); + this.setData({ + submitData: { + ...this.data.submitData, + [this.data.twoKey]: this.data.submitData[this.data.twoKey] + this.data.twoValue, + }, + [this.data.twoKey + 'Num']: (this.data.submitData[this.data.twoKey] + this.data.twoValue).length, + twoValue: '', + twoKey: '' + }) + } + }, + + onHide: function () { + // this.handleCheckSave(); + }, + + onUnload: function () { + // this.handleCheckSave(); + }, +}); \ No newline at end of file diff --git a/pages/register/index.json b/pages/register/index.json new file mode 100644 index 0000000..989ee32 --- /dev/null +++ b/pages/register/index.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "反映诉求", + "usingComponents": { + "steps": "../../components/steps/index", + "mediate-detail": "../../components/mediate-detail/index", + "ellipsis-text": "../../components/ellipsis-text/index" + } +} \ No newline at end of file diff --git a/pages/register/index.wxml b/pages/register/index.wxml new file mode 100644 index 0000000..e79c43c --- /dev/null +++ b/pages/register/index.wxml @@ -0,0 +1,411 @@ +<!--申请调解--> +<page-meta page-style="{{ popup.visible || recordingVisible || popupMsg.show ? 'overflow: hidden;' : '' }}" /> + +<wxs module="wxs" src="../../utils/wxs/util.wxs" /> + +<van-toast id="van-toast" /> + +<common-page bind:onCancelPicker="handleClosePopup" bind:onChangePicker="handleChangeColumns" bind:onClosePopup="handleClosePopup" bind:onConfirmPicker="handleConfirmPicker" popup="{{ popup }}"> + + <!-- 未提交 --> + <block wx:if="{{ !saveStatus }}"> + <!-- 步骤条 --> + <view class="steps"> + <steps stepsActive="{{ stepsActive }}" stepsData="{{ steps }}" stepsType="picture" /> + </view> + + <!-- 填写人员--> + <block wx:if="{{ stepsActive === 0 }}"> + <view style="padding:24rpx"> + <view wx:for="{{oneList}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view class='one-list' wx:if="{{item.perType==='15_020008-1'||item.perType==='24_00006-1'}}"> + <view bindtap="oneEditPerson" data-item="{{ item }}" data-index="{{ index }}" class="one-list-l green">申请方</view> + <view bindtap="oneEditPerson" data-item="{{ item }}" data-index="{{ index }}" class="one-list-r"> + <view class="one-list-r-t"> + <view class="one-list-text">{{item.trueName}}</view> + <view class="one-list-phone">{{item.mobile}}</view> + <view wx:if="{{item.perType==='24_00006-1'}}" class="one-list-tag">代理人</view> + </view> + <view wx:if="{{item.perClass==='09_01001-1'}}" class="one-list-r-b">{{item.perClassName}} | {{item.certiNo}} </view> + <view wx:if="{{item.perClass!=='09_01001-1'}}" class="one-list-r-b">{{item.perClassName}} | {{item.legalRepresent}} | {{item.socialCreditCode}} </view> + </view> + <view class="one-list-del"> + <image class="one-list-del-2" src="{{ imgUrl }}del_bg.png" mode="" /> + </view> + <view class="one-list-del-1" data-index="{{index}}" data-item="{{item}}" bindtap="oneDelPerson"> + <image class="one-list-del-1" src="{{ imgUrl }}del.png" mode="" /> + </view> + </view> + <view class='one-list' wx:else> + <view bindtap="oneEditPerson" data-item="{{ item }}" data-index="{{ index }}" class="one-list-l orange"><text>被申\n请方</text></view> + <view bindtap="oneEditPerson" data-item="{{ item }}" data-index="{{ index }}" class="one-list-r"> + <view class="one-list-r-t"> + <view class="one-list-text">{{item.trueName}}</view> + <view class="one-list-phone">{{item.mobile}}</view> + <view wx:if="{{item.perType==='24_00006-2'}}" class="one-list-tag-orange">代理人</view> + </view> + <view class="one-list-r-b">{{item.perClassName}} |{{item.certiNo}}</view> + </view> + <view class="one-list-del"> + <image class="one-list-del-2" src="{{ imgUrl }}del_bg.png" mode="" /> + </view> + <view class="one-list-del-1" data-index="{{index}}" data-item="{{item}}" bindtap="oneDelPerson"> + <image class="one-list-del-1" src="{{ imgUrl }}del.png" mode="" /> + </view> + </view> + </view> + <view class="party-oneAdd"> + <van-button bind:click="oneAddPerson" block custom-style="border: 1px dashed #1a6fb8; color:#1A6FB8" icon="{{ imgUrl }}add.png">添加当事人</van-button> + </view> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <van-button bind:click="handleNext" block data-type="next" type="primary">下一步</van-button> + <view class="safeHeight" /> + </view> + </view> + </view> + </block> + + <!-- 描述纠纷 --> + <view class="page-flex" wx:elif="{{stepsActive === 1}}"> + <view class="popupMsg-form"> + <view bindtap="caseTypeGoPage" data-url="../../pages/caseType/index" class="cell cell-item" data-title="纠纷类型" data-key="certiType" data-type="cardType"> + <view class="cell-title"><text><text class="cell-required">*</text> 纠纷类型</text></view> + <view class="{{ !submitData.caseTypeName ? 'cell-placeholder' : '' }} cell-select">{{ submitData.caseTypeName ? submitData.caseTypeName : '未选择' }}</view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view bindtap="handleShowPopup" class="cell cell-item" data-title="纠纷发生时间" data-key="occurTime" data-type="occurTime"> + <view class="cell-title"><text><text class="cell-required">*</text> 纠纷发生时间</text></view> + <view class="{{ !submitData.occurTimeName ? 'cell-placeholder' : '' }} cell-select"> + {{ submitData.occurTimeName ? submitData.occurTimeName: '未选择' }} + </view> + <view class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view wx:if="{{!submitData.addr}}" bindtap="openmap" data-url="../../pages/caseType/index" class="cell cell-item" data-title="纠纷发生地" data-type="location"> + <view class="cell-title"><text><text class="cell-required">*</text> 纠纷发生地</text></view> + <view class="cell-placeholder cell-select">未选择</view> + <view wx:if="{{!submitData.addr}}" class="cell-arrow"> + <van-icon name="arrow" /> + </view> + </view> + <view wx:else class="cell-item" data-title="纠纷发生地" data-type="location"> + <view bindtap="openmap" class="cell-title"><text><text class="cell-required">*</text> 纠纷发生地</text></view> + <view class="two-addr"> + <view> + {{submitData.addr}} + </view> + <view bindtap="delAddress" class="two-addr-img"> + <image src="{{imgUrl}}address-del.png" mode="" /> + </view> + </view> + </view> + <view class="cell-item"> + <view class="cell-title1">涉及人数(人)</view> + <view class="cell-select"> + <van-field type='number' bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="peopleNum" input-align="right" placeholder="请填写" value="{{ submitData.peopleNum || '' }}" /> + </view> + </view> + <view class="cell-item"> + <view class="cell-title1">涉及金额(元)</view> + <view class="cell-select"> + <van-field type='number' bind:change="handleChange" border="{{ false }}" custom-style="padding:0" data-key="amount" input-align="right" placeholder="请填写" value="{{ submitData.amount || '' }}" /> + </view> + </view> + <view style="height: 16rpx;"></view> + <block> + <view class="cell-item"> + <view class="cell-title"><text><text class="cell-required">*</text> 事项概况</text></view> + <van-field class="textarea-Input" autosize="{{true}}" custom-style="padding:0 20rpx;line-height:90rpx" bind:change="handleChange" border="{{ false }}" maxlength='2000' data-key="caseDes" placeholder="请完整描述事项概况,应具备5要素:发生时间+发生地点+人物情况+事项起因+事项经过" type="textarea" value="{{ submitData.caseDes }}" /> + </view> + <view class="textarea-foot"> + <view class="textarea-limit">{{caseDesNum||0}}/2000字</view> + <view class="textarea-ability"> + <view bindtap="ocrClick" data-keyNum="caseDesNum" data-key="caseDes" class=" textarea-img"> + <image src="{{imgUrl}}imgOcr.png" mode="" />识别图片 + </view> + <view style="padding: 0 8rpx;">|</view> + <view bindtap="caseTypeGoPage" data-type="caseDes" data-value="{{submitData.caseDes}}" data-url="../../pages/speechToText/index" class="textarea-img"> + <image src="{{imgUrl}}voiceOcr.png" mode="" />语音描述 + </view> + </view> + </view> + </block> + <view style="height: 16rpx;"></view> + <block> + <view class="cell-item"> + <view class="cell-title"><text><text class="cell-required">*</text> 事项申请</text></view> + <van-field class="textarea-Input" custom-style="padding:0 20rpx;line-height:90rpx" autosize="{{true}}" bind:change="handleChange" border="{{ false }}" maxlength='500' data-key="caseClaim" placeholder="希望相关部门如何处理,建议分条描述,如请求1,请求2..." type="textarea" value="{{ submitData.caseClaim }}" /> + </view> + <view class="textarea-foot"> + <view class="textarea-limit">{{caseClaimNum||0}}/500字</view> + <view class="textarea-ability"> + <view bindtap="ocrClick" data-keyNum="caseClaimNum" data-key="caseClaim" class="textarea-img"> + <image src="{{imgUrl}}imgOcr.png" mode="" />识别图片 + </view> + <view style="padding: 0 8rpx;">|</view> + <view bindtap="caseTypeGoPage" data-type="caseClaim" data-value="{{submitData.caseClaim}}" data-url="../../pages/speechToText/index" class="textarea-img"> + <image src="{{imgUrl}}voiceOcr.png" mode="" />语音描述 + </view> + </view> + </view> + </block> + <view style="height: 16rpx;"></view> + <block> + <view style="padding-left: 32rpx;" bindtap="handleUploadFile" data-id="{{ownerId}}" data-type="22_00018-101" class="cell-item"> + <view class="upload-title"> + 事件材料 + <image src="{{imgUrl}}upload-add.png" mode="" /> + </view> + <view class="upload-text"> + 说明:请上传与您的申请事项相关的证据材料,如合同、转账记录、聊天记录、鉴定结果等 + </view> + </view> + <view class="fileList" wx:for="{{fileList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}"> + <image class="fileList_img" src="{{imgUrl}}image_1.png" mode="" /> + <view class="flex_1"> + <view style="margin-bottom: 10rpx;">{{item.name}}</view> + <view style="display: flex;gap:16rpx"><text class="fileList_title">{{item.size}}{{item.unit}}</text><text data-item="{{item}}" data-index="{{index}}" bindtap="handlePreviewImage" class="public-color">预览</text></view> + </view> + <image data-id="{{item.id}}" data-type="22_00018-101" data-item="{{item}}" data-index="{{index}}" bindtap="handleDelImage" class="fileList_img_del" src="{{imgUrl}}image_del.png" mode="" /> + </view> + </block> + </view> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <view class="two-button"> + <view class="two-button-flex1"> + <van-button color="#1A6FB8" plain bind:click="handleNext" block data-type="back">上一步</van-button> + </view> + <view class="two-button-flex2"> + <van-button bind:click="handleNext" block data-type="next" type="primary">下一步</van-button> + </view> + </view> + <view class="safeHeight" /> + </view> + </view> + </view> + + <!-- 提交申请 --> + <view class="page-flex" wx:elif="{{stepsActive === 2}}"> + <view class="popupMsg-form"> + <view class="three-tag"> + <van-tabs line-width='33%' animated bind:click="threeTagChange" active="{{threeAvtice}}"> + <!-- 人员信息 --> + <van-tab title="人员信息" name="1"> + <view style="padding:24rpx"> + <view wx:for="{{oneList}}" data-item="{{ item }}" data-index="{{ index }}" wx:key="index"> + <view class='one-list' wx:if="{{item.perType==='15_020008-1'||item.perType==='24_00006-1'}}"> + <view class="one-list-l green">申请方</view> + <view class="one-list-r"> + <view class="one-list-r-t"> + <view class="one-list-text">{{item.trueName}}</view> + <view class="one-list-phone">{{item.mobile}}</view> + <view wx:if="{{item.perType==='24_00006-1'}}" class="one-list-tag">代理人</view> + </view> + <view class="one-list-r-b">{{item.perClassName}} | {{item.certiNo}} </view> + </view> + </view> + <view class='one-list' wx:else> + <view class="one-list-l orange"><text>被申\n请方</text></view> + <view class="one-list-r"> + <view class="one-list-r-t"> + <view class="one-list-text">{{item.trueName}}</view> + <view class="one-list-phone">{{item.mobile}}</view> + <view wx:if="{{item.perType==='24_00006-2'}}" class="one-list-tag-orange">代理人</view> + </view> + <view class="one-list-r-b">{{item.perClassName}} |{{item.certiNo}}</view> + </view> + </view> + </view> + </view> + </van-tab> + <van-tab title="纠纷信息" name="2"> + <view class="three-tag2"> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷类型</view> + <view>{{ submitData.caseTypeName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷发生时间</view> + <view>{{ submitData.occurTimeName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">纠纷发生地点</view> + <view>{{ submitData.addr || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">涉及人数(人)</view> + <view>{{ submitData.peopleNum || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">涉及金额(元)</view> + <view>{{ submitData.amount || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">事项概况</view> + <view>{{ submitData.caseDes || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">事项申请</view> + <view>{{ submitData.caseClaim || '-' }}</view> + </view> + <!-- 人工智能提醒 --> + <!-- <view class="Ai_tip"> --> + <view class="Ai_tip" wx:if="{{AIData.isClaimRisk===1}}"> + <view class="Ai_tip_title">{{AIData.analysisProcess||''}}</view> + <view class="Ai_tip_line"></view> + <view class="Ai_tip_text">内容依据人工智能技术和相关法律数据提供,仅供参考</view> + </view> + </view> + + </van-tab> + <van-tab title="事件材料" name="3"> + <view style="height: 16rpx;"> + + </view> + <view style="padding: 24rpx 32rpx 0; background-color: #fff;" wx:for="{{fileList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}"> + <view class="fileList_border"> + <image class="fileList_img" src="{{imgUrl}}image_1.png" mode="" /> + <view class="flex_1"> + <view style="margin-bottom: 10rpx;">{{item.name}}</view> + <view style="display: flex;gap:16rpx"><text class="fileList_title">{{item.size}}{{item.unit}}</text><text data-item="{{item}}" data-index="{{index}}" bindtap="handlePreviewImage" class="public-color">预览</text></view> + </view> + </view> + </view> + </van-tab> + </van-tabs> + </view> + </view> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <view class="two-button"> + <view class="two-button-flex1"> + <van-button color="#1A6FB8" plain bind:click="handleNext" block data-type="back">上一步</van-button> + </view> + <view class="two-button-flex2"> + <van-button bind:click="handleNext" block data-type="next" type="primary">提交申请</van-button> + </view> + </view> + <view class="safeHeight" /> + </view> + </view> + </view> + </block> + + <!-- 已提交 --> + <block wx:else> + <view class="success"> + <van-icon name="{{imgUrl}}success.png" size="200rpx" /> + <view class="success-title">申请已提交</view> + <view class="success-subTitle">您已成功提交申请,请保持联系方式畅通。您可以通过微信公众号了解处理进度</view> + <view style="margin-top: 40rpx;"> + <navigator class="success-link" style="display: inline;" url="/pages/homePage/index">返回首页</navigator> + </view> + <!-- <view class="success-button"> + <van-button bind:click="handleGoHomepage" custom-class="btn btn-white" type="primary">{{ changeVisible ? '返回我的调解' : '返回首页' }}</van-button> + </view> --> + </view> + </block> +</common-page> + +<!-- 用户须知 --> +<van-popup class="popup-scroll-xz" round show="{{ popupVisible }}" z-index="990"> + <view class="popup-scroll"> + <view style='padding: 32rpx;'> + <view class="popup-scroll-head">广州解纷码<text class="public-color">用户须知</text></view> + <scroll-view bindscrolltolower="handlescrolltolower" style="height:980rpx" scroll-y> + <view>尊敬的用户,您好!</view> + <view>欢迎使用“广州解纷码”微信小程序,在使用广州解纷码提供的服务之前,请仔细阅读并理解以下条款。一旦您开始使用广州解纷码的服务,即表示您同意遵守以下所有规定:</view> + <view>1、个人信息保护</view> + <view>(1)我们承诺尊重并保护您的隐私。我们会按照相关法律法规的规定收集、使用和保护您的个人信息。</view> + <view>(2)在调解过程中,您提供的个人信息将仅用于解决您所涉及的纠纷,不会用于任何其他目的或被泄露给第三方,除非法律另有要求。</view> + <view>2、服务范围</view> + <view>(1)广州解纷码主要提供线上调解服务,包括但不限于在线咨询、申请事项进度查询等。</view> + <view>(2)平台不提供法律意见或代表任何一方参与法律诉讼过程。</view> + <view>3、用户行为规范</view> + <view>(1)用户应当诚实、准确地提供信息,并对所提供信息的真实性负责。</view> + <view>(2)用户不得上传或传播任何违法、侵犯他人权利的内容。</view> + <view>(3)用户在使用过程中应遵守国家法律法规和社会公德。</view> + <view>4、调解程序</view> + <view>(1)调解过程遵循自愿原则,双方均需同意参与调解才能启动程序。</view> + <view>(2)调解结果不具备强制执行力,但达成协议后,双方应自觉履行协议内容。</view> + <view>5、免责声明</view> + <view>(1)广州解纷码尽力提供准确的信息和服务,但不对调解结果承担任何法律责任。</view> + <view>(2)如有任何疑问或争议,建议咨询专业法律顾问。</view> + <view>6、知识产权声明</view> + <view>(1)广州解纷码的所有内容,包括但不限于文字、图片、音频、视频等,均受著作权法保护。</view> + <view>(2)未经广州解纷码书面许可,任何人不得复制、转载、改编或以其他方式使用上述内容。 通过点击“同意”按钮或继续使用广州解纷码的服务,即视为接受并同意上述所有条款。如果您不同意上述任何一项内容,将无法使用广州解纷码的相关服务。</view> + </scroll-view> + </view> + </view> + <view class="popup-button"> + <van-button custom-style="border-radius:8px" disabled="{{stepText > 0}}" bind:click="handleAgree" block data-type="agree" round type="primary"> + 我已阅读并接受用户须知{{stepText>0?'('+stepText+'秒)':''}}</van-button> + </view> +</van-popup> + +<!-- 自动添加申请人提醒 --> +<van-popup class="one-add-me-tip" round show="{{ addMePlaintiff }}" z-index="990"> + <view class="one-add-me"> + <view class="one-add-me-title"> + 自动添加申请人提醒 + </view> + <view class="one-add-me-content"> + 是否将您自动登记为申请方当事人? + </view> + <view class="one-add-me-button"> + <van-button type="primary" bind:click="oneAddMe" block round data-formtype="yes">是</van-button> + <view bindtap="oneAddMe" data-formtype="no"> 否 </view> + </view> + </view> +</van-popup> + +<!-- 添加当事人 --> +<van-popup class="one-add-person-tip" bind:close="addClosePopup" data-key='addPerson' round show="{{ addPerson }}" z-index="990"> + <view class="one-add-person"> + <view class="one-add-person-title">添加当事人</view> + <view class="one-add-person-flex"> + <text class="one-add-person-text">申请方当事人</text> + <van-button class="one-add-person-button" type="primary" bind:click="oneAddPerson" block data-perTypeName="申请方当事人" data-perType="15_020008-1">添加</van-button> + </view> + <view class="one-add-person-flex"> + <text class="one-add-person-text">申请方代理人</text> + <van-button class="one-add-person-button" type="primary" bind:click="oneAddPerson" block data-perTypeName="申请方代理人" data-perType="24_00006-1">添加</van-button> + </view> + <view class="one-add-person-flex"> + <text class="one-add-person-text">被申请方当事人</text> + <van-button class="one-add-person-button" type="primary" bind:click="oneAddPerson" block data-perTypeName="被申请方当事人" data-perType="15_020008-2">添加</van-button> + </view> + <view class="one-add-person-flex"> + <text class="one-add-person-text">被申请方代理人</text> + <van-button class="one-add-person-button" type="primary" bind:click="oneAddPerson" block data-perTypeName="被申请方代理人" data-perType="24_00006-2">添加</van-button> + </view> + </view> +</van-popup> + +<!-- 未上传材料提醒 --> +<van-popup class="one-add-file-tip" bind:close="addClosePopup" data-key='showFileTip' round show="{{ showFileTip }}" z-index="990"> + <view class="one-add-me"> + <view style="text-align: left;" class="one-add-me-title"> + 提示 + </view> + <view class="one-add-me-content" style="text-align: left;margin-bottom: 40rpx;"> + 您尚未上传事件材料,建议您上传与诉求相关的证据材料(如合同、转账记录、聊天记录、鉴定结果等),以帮助我们更有效的了解您的诉求 + </view> + <view style="display: flex;justify-content: flex-end;margin-top: 48rpx;"> + <view style="display: flex;gap: 56rpx;"> + <view bindtap="noUploadNext">暂不上传</view> + <view bindtap="handleUploadFile" data-key='showFileTip' data-id="{{ownerId}}" data-type="22_00018-101" class="public-color">去上传</view> + </view> + </view> + </view> +</van-popup> + +<!-- 时间选择器 --> +<van-popup position="bottom" bind:close="addClosePopup" data-key='timePicker' show="{{timePicker}}" z-index="990"> + <van-datetime-picker type="date" value="{{ submitData.occurTime}}" data-key='timePicker' bind:confirm="onInput" max-date="{{ maxDate }}" /> +</van-popup> \ No newline at end of file diff --git a/pages/register/index.wxss b/pages/register/index.wxss new file mode 100644 index 0000000..b844a5f --- /dev/null +++ b/pages/register/index.wxss @@ -0,0 +1,905 @@ +/* pages/register/index.wxss */ +@import '../../styles/public_components.wxss'; + +.steps { + padding: 20rpx 0 12rpx; + background-color: #ffffff; +} + +.one-list { + background: #fff; + padding: 24rpx; + display: flex; + position: relative; + gap: 8px; + margin-bottom: 12px; + border-radius: 8px; +} + +.one-list-l { + height: 96rpx; + width: 96rpx; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + font-size: 28rpx; + text-align: center; +} + +.one-list-r-t { + display: flex; + gap: 8px; + font-size: 28rpx; + line-height: 44rpx; +} + +.one-list-phone { + color: rgba(23, 26, 29, 0.60); +} + +.one-list-tag { + font-size: 24rpx; + line-height: 40rpx; + border-radius: 2px; + background: #e6fffb; + color: #13C2C2; + padding: 0 8rpx; +} + +.one-list-tag-orange { + font-size: 24rpx; + line-height: 40rpx; + border-radius: 2px; + background: #FFF2E6; + color: #EF6C24; + padding: 0 8rpx; +} + +.one-list-r-b { + color: rgba(23, 26, 29, 0.60); + font-size: 24rpx; + line-height: 40rpx; + margin-top: 8rpx; +} + +.one-list-del { + position: absolute; + right: 0; + top: 0; + width: 44rpx; + height: 44rpx; +} + +.one-list-del-1 { + position: absolute; + right: 0; + top: 0; + width: 44rpx; + height: 44rpx; + display: flex; + justify-content: center; + align-items: center; + text-align: center; +} + +.one-list-del image { + width: 100%; + height: 100%; +} + +.one-list-del-1 image { + width: 28rpx; + height: 28rpx; +} + +.green { + background-color: #13C2C2; +} + +.orange { + background-color: #EF6C24; +} + +.one-add-me { + /* background-color: #fff; */ + text-align: center; + padding: 40rpx 32rpx 28rpx; +} + +.one-add-me-tip .van-popup--round { + width: 80%; +} + +.one-add-me-title { + font-size: 34rpx; + line-height: 50rpx; + margin-bottom: 24rpx; +} + +.one-add-me-content { + color: rgba(23, 26, 29, 0.60); + margin-bottom: 28rpx; +} + +.one-add-me-button { + display: flex; + flex-direction: column; + gap: 16rpx; +} + +.one-add-person-tip .van-popup--round { + width: 90%; +} + +.one-add-file-tip .van-popup--round { + width: 70%; +} + +.one-add-person { + text-align: center; + padding: 0rpx 32rpx; +} + +.one-add-person-flex { + display: flex; +} + +.one-add-person-tip { + position: relative; +} + +.one-add-person-icon { + position: absolute; + bottom: -40rpx; + z-index: 991; +} + +.one-add-person-title { + border-bottom: 1px dashed rgba(126, 134, 142, 0.24); + padding: 24rpx 0 16rpx; + margin-bottom: 32rpx; +} + +.one-add-person-flex { + background: #f2f2f6; + margin-bottom: 24rpx; + padding: 24rpx; + display: flex; + justify-content: space-between; + align-items: center; +} + +.one-add-person-text { + font-size: 32rpx; + line-height: 48rpx; +} + +.one-add-person-button .van-button { + height: 60rpx; +} + +.two-button { + display: flex; + justify-content: space-between; + width: 100%; + gap: 24px; +} + +.two-button-flex1 { + flex: 1; +} + +.two-button-flex2 { + flex: 2; +} + +.two-addr { + padding: 16rpx 20rpx; + background: #f2f3f5; + height: 98rpx; + border-radius: 4rpx; + display: flex; + justify-content: space-between; +} + +.two-addr-img { + height: 23px; + display: flex; + align-items: center; +} + +.two-addr-img image { + width: 15px; + height: 15px; +} + +.fileList { + background-color: #fff; + padding: 24rpx 32rpx; + display: flex; + gap: 32rpx; + align-items: center; +} + +.fileList_border { + padding-bottom: 24rpx; + display: flex; + gap: 32rpx; + align-items: center; + border-bottom: 1px solid rgba(126, 134, 142, 0.16); +} + +.fileList_img { + width: 84rpx; + height: 96rpx; +} + +.fileList_title { + color: rgba(23, 26, 29, 0.40); + font-size: 28rpx; +} + +.fileList_img_del { + width: 32rpx; + height: 32rpx; +} + +.flex_1 { + flex: 1; +} + +.three-tag { + margin-top: 16rpx; +} + +.three-tag .van-tabs__wrap { + height: 96rpx !important; +} + +.van-tabs__wrap .van-tab--active { + color: var(--main-color) !important; +} + +.three-tag .van-tabs__nav { + height: 100%; +} + +.three-tag .van-tabs__scroll--line { + height: 100%; +} + +.three-tag .van-tab { + height: 100%; + line-height: 96rpx !important; +} + +.three-tag2 { + background-color: #fff; + margin-top: 16rpx; + padding: 24rpx 32rpx; +} + + +.textarea-foot { + display: flex; + justify-content: space-between; + background-color: #fff; + align-items: center; + padding-left: 32rpx; +} + +.Ai_tip { + background: #FFECE8; + padding: 8px 12px; + border-radius: 4px; +} + +.Ai_tip_title { + color: #F53F3F; + line-height: 46rpx; +} + +.page-flex { + display: flex; + flex-direction: column; +} + +.Ai_tip_line { + margin: 16rpx 0; + border-bottom: 1px solid rgba(245, 63, 63, 0.60); +} + +.Ai_tip_text { + color: rgba(245, 63, 63, 0.60); + font-size: 24rpx; + line-height: 40rpx; +} + +.textarea-limit { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(23, 26, 29, 0.40); +} + +.textarea-ability { + display: flex; + align-items: center; + background-color: rgba(182, 221, 241, 0.46); + padding: 16rpx; + border-radius: 20px 0px 0px 0px; + color: var(--main-color); + font-weight: 400; +} + +.textarea-img { + display: flex; + align-items: center; + gap: 8rpx; +} + +.textarea-img image { + width: 28rpx; + height: 28rpx; +} + +.upload-title { + display: flex; + align-items: center; + justify-content: space-between; +} + +.upload-title image { + width: 32rpx; + height: 32rpx; +} + +.upload-text { + margin-top: 8rpx; + font-size: 28rpx; + line-height: 44rpx; + color: rgba(23, 26, 29, 0.40); +} + +.card { + background-color: #ffffff; + margin: 0 var(--padding-my); + margin-top: 16rpx; + border-radius: var(--border-radius-card); + padding: 0 32rpx; +} + +.cell-item { + padding: 24rpx 32rpx 24rpx 12rpx; + background-color: #fff; +} + +.cell-item-select {} + +.cell-idCard { + color: var(--main-color); + display: flex; + align-items: center; + font-weight: 400; +} + +.cell-phone .van-button { + color: var(--main-color); + border: none !important; + padding: 0 !important; +} + +.cell-idCard image { + width: 34rpx; + height: 32rpx; + margin-right: 8rpx; +} + +.cell-title { + margin-bottom: 8rpx; + display: flex; + justify-content: space-between; +} + +.cell-radio { + display: flex; + gap: 27rpx; +} + +.cell-title1 { + font-weight: 600; + font-size: 30rpx; + line-height: 46rpx; + padding-left: 20rpx; +} + +.cell-select { + padding: 0 20rpx; +} + +.cell-required { + color: #d1021c; + font-size: 30rpx; +} + +.cell-item .van-field__control--right { + text-align: left +} + +.popupMsg-form { + margin-top: 16rpx; + flex: 1; + margin-bottom: 162rpx; +} + +.person-type-select { + background-color: #fff; + +} + +.person-type-select-person { + padding: 24rpx 32rpx 16rpx; +} + +/* components/personTypes/index.wxss */ +.personTypes { + display: flex; + align-items: center; + background-color: #ffffff; + gap: 32rpx; + padding: 0 32rpx 32rpx; +} + +.personTypes-item { + position: relative; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + color: rgba(23, 26, 29, 0.40); + border: 1px solid #E5E6EB; + border-radius: 12rpx; + padding: 18rpx 0 10rpx; + position: relative; +} + +.personTypes-item-active, +.personTypes-item-active .personTypes-item-icon { + color: var(--main-color); + border: 1px solid #1a6fb8; +} + + + +.personTypes-item-line {} + +.personTypes-item-hoverLine { + width: 168rpx; + border: 1px solid var(--main-color); +} + +.personTypes-item-line { + width: 168rpx; + border: 1px solid #E5E6EB; +} + +.personTypes-item-active .personTypes-item-number1 { + background-color: var(--main-color); + color: var(--white); +} + +.personTypes-item-round { + position: relative; + width: 60rpx; + height: 60rpx; + color: #86909C; + margin-bottom: 8rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.personTypes-item-round image { + width: 100%; + height: 100%; +} + +.personTypes-item-sueecss { + position: absolute; + right: 10rpx; + top: 10rpx; +} + +.personTypes-item-icon { + position: absolute; + z-index: 889; + top: 50%; + margin-top: -24rpx; + right: -88rpx; + color: #cccccc; +} + +.party-add, +.wantUser-delete { + padding: 0 16rpx; + border-left: 2rpx solid var(--border-color); + margin-left: 16rpx; + color: var(--main-color); +} + + + +.party-oneAdd { + flex: 1; + color: var(--main-color); +} + +.popupMsg-draft { + padding: 32rpx; + margin-bottom: 140rpx; +} + +.popupMsg { + margin-bottom: 140rpx; +} + +.popupMsg-tab { + width: 292rpx; + padding: 24rpx 0 32rpx 0; +} + +.popupMsg-tab .popupMsg-nav-class { + background-color: #e5e5e5; +} + +.popupMsg-tab .popupMsg-nav-class2 { + background-color: #ffffff; +} + +.popupMsg-tab-card { + display: flex; + align-items: flex-end; +} + +.popupMsg-tab-card-item { + flex: 1; + background-color: #ffffff; + text-align: center; + line-height: 80rpx; + height: 80rpx; + position: relative; +} + +/* .popupMsg-tab-card-item::before { + content: ''; + position: absolute; + height: 60rpx; + border-right: 1rpx solid var(--border-color); + left: 0; + top: 10rpx; +} */ + +.popupMsg-tab-card-item:first-child { + border-radius: 0px 0px 0px 20rpx; +} + +.popupMsg-tab-card-item:last-child { + border-radius: 0px 20rpx 0px 0px; +} + +.popupMsg-tab-card-item-active { + height: 100rpx; + line-height: 100rpx; + font-size: 32rpx; + font-weight: 600; + border-radius: 20rpx 20rpx 0px 0px !important; +} + +.popupMsg-tab-card-item-bg { + background-color: #f2f2f2; +} + +.popupMsg-tab-card-item-active .popupMsg-tab-card-item-bg { + border-radius: 20rpx 20rpx 0px 0px; + background-color: #ffffff; +} + +.popupMsg-check { + padding-left: 16rpx; + border-left: 2rpx solid var(--border-color); + color: var(--main-color); + margin-left: 16rpx; +} + +.popupMsg-ocrButton { + padding: 0 32rpx 40rpx; + background-color: #ffffff; +} + +.popupMsg-agent { + background-color: #ffffff; + padding: 0 32rpx; +} + +.popupMsg-agent-content { + padding: 8rpx 28rpx; +} + +.popupMsg-agent-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 8rpx 0; +} + +.popupMsg-agent-item-active { + color: var(--main-color); +} + +.popupMsg-agent-none .van-empty__image { + width: 288rpx; + height: 288rpx; +} + +.popupMsg-agent-none .van-empty { + padding: 0; +} + +.popupMsg-agent-none .van-empty__bottom { + margin-top: 32rpx; +} + +.popupMsg-button { + padding: 32rpx; + position: fixed; + bottom: 0; + left: 0; + right: 0; + background-color: #ffffff; + display: flex; +} + +.popupMsg-button::before { + content: ''; + position: absolute; + top: 0; + left: 32rpx; + right: 32rpx; + height: 2rpx; + background-color: var(--border-color); +} + +.submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + padding: 32rpx var(--padding-my); + background-color: #fff; + z-index: 99; +} + +.height-none { + height: calc(var(--padding-my) + var(--padding-my) + var(--padding-my) + var(--button-default-height)); +} + +.success { + text-align: center; + margin-top: 180rpx; +} + +.success-title { + font-size: 32rpx; + line-height: 48rpx; + padding: 32rpx 0; +} + +.success-subTitle { + width: 498rpx; + color: var(--second-text-color); + margin: auto; +} + +.success-button { + position: absolute; + bottom: 240rpx; + left: 50%; + margin-left: -200rpx; +} + + +.popupSelect { + width: 640rpx; +} + +.popupSelect-button { + display: flex; +} + +.popupSelect-button-item { + flex: 1; + text-align: center; + line-height: 112rpx; + border-top: 2rpx solid var(--border-color); +} + +.popupSelect-button-item:first-child { + border-right: 2rpx solid var(--border-color); +} + +.popupSelect-button-item:last-child { + color: var(--main-color); +} + +.popupSelect-item { + display: flex; + align-items: center; + padding: 20rpx 32rpx; +} + +.popupSelect-item-content { + flex: 1; +} + +.popupSelect-item-icon { + color: var(--main-color); +} + +.popupSelect-item-content-subTitle { + color: rgba(0, 0, 0, 0.3); +} + +.success-link { + color: #fff; + width: 116px; + height: 36px; + background: #1a6fb8; + border-radius: 6px; + padding: 6px 26px; + margin-top: 32px; +} + +.success-NewButton { + display: flex; + justify-content: center; + align-items: center; + margin-top: 40rpx; + margin-bottom: 24rpx; +} + +.success-RedButton { + background-color: #D1021C; + width: 198rpx; + height: 80rpx; + display: flex; + justify-content: center; + align-items: center; + border-radius: 12rpx; +} + +.case { + border-top: 1px solid #E41100; + padding: 4px 0; + font-size: 14px; + display: flex; + justify-content: space-between; + color: #E41100; +} + +.img-case_2 { + display: flex; + margin-top: 4px; +} + +.img { + height: 12px; + width: 12px; + margin-right: 4px; +} + +.img1 { + height: 12px; + width: 12px; + margin-right: 3px; + margin-top: 4px; +} + +.caseLegalBox-dot { + height: 6px; + width: 6px; + border-radius: 50%; + background-color: rgba(217, 217, 217, 0.6); + margin-left: 8px; + margin-right: 4px; +} + + +.caseBox-Item { + font-size: 12px; + margin: 8px 19px 8px 6px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 250px; +} + +.caseBox-arrow { + width: 16px; + height: 16px; + border-radius: 50%; + background-color: rgba(246, 247, 251, 1); + display: flex; + justify-content: center; + align-items: center; +} + +.caseBox-content { + background-color: #fff; + display: flex; + align-items: center; + justify-content: center; +} + + + +.caseBox-dot { + display: flex; + background-color: #ffe6e6; + padding: 0px 4px; + font-size: 12px; + color: #d1021c; + border-radius: 4px; +} + +.popup-scroll { + height: 1100rpx; + width: 100%; + background-color: #ffffff; +} + +.popup-scroll { + height: 1100rpx; + width: 100%; + background-color: #ffffff; +} + +.popup-scroll-xz .van-popup--round { + width: 100%; + border-radius: 0 !important; +} + +.popup-scroll-main { + display: flex; + flex-direction: column; +} + +.popup-scroll-body { + flex: 1; +} + +.popup-scroll-head { + text-align: center; + padding: 0 32rpx 16rpx; + border-bottom: 2rpx dashed rgba(126, 134, 142, 0.24); + margin-bottom: 24rpx; + font-size: 34rpx; +} + +.popup-button { + padding: 32rpx 32rpx 24rpx; + margin-top: 24rpx; + border-top: 1rpx solid #E5E6EB; +} + +.popup-button-no { + font-size: 28rpx; + text-align: center; + padding: 24rpx 0 0; + text-decoration: underline; +} + +.textarea-Input .van-field__control--textarea { + min-height: 88px; +} \ No newline at end of file diff --git a/pages/signIn/index.js b/pages/signIn/index.js new file mode 100644 index 0000000..b645075 --- /dev/null +++ b/pages/signIn/index.js @@ -0,0 +1,72 @@ +// pages/signIn/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +// 签到 +function signInApi(submitData) { + return $$.request({ url: 'paMeetInfo/updateSign', type: 'post', service: 'mediate', submitData: { id: submitData } }); +} +// 获取个人信息 +function getUserInfoApi() { + return $$.request({ url: 'paUser/getUserInfo', type: 'get', service: 'cust' }); +} + +Page({ + /** + * 页面的初始数据 + */ + meetUserId: 0, // 会议id + data: { + imgUrl: $$.url.img, + userInfo: {}, + signInResult: '', + }, + + // 刷脸 + handleRealName() { + this.signIn(); + }, + + // 返回调解 or 重新签到 + handleClickNext() { + if (this.data.signInResult === 'success') { + wx.navigateBack({ + delta: 1, + }); + } else { + this.handleRealName(); + } + }, + + // 签到 + async signIn() { + $$.showLoading(); + const res = await signInApi(this.meetUserId); + $$.hideLoading(); + if (res.type) { + app.globalData.caseMsg.handleVisible = true; + this.setData({ signInResult: 'success' }); + } else { + app.globalData.caseMsg.handleVisible = true; + this.setData({ signInResult: 'fail' }); + } + }, + + // 获取用户个人信息 + async getUserInfo() { + $$.showLoading(); + const res = await getUserInfoApi(); + $$.hideLoading(); + if (res.type) { + this.setData({ userInfo: res.data }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.meetUserId = options.meetUserId; + this.getUserInfo(); + }, +}); diff --git a/pages/signIn/index.json b/pages/signIn/index.json new file mode 100644 index 0000000..c796644 --- /dev/null +++ b/pages/signIn/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "签到", + "usingComponents": {} +} diff --git a/pages/signIn/index.wxml b/pages/signIn/index.wxml new file mode 100644 index 0000000..39efea9 --- /dev/null +++ b/pages/signIn/index.wxml @@ -0,0 +1,36 @@ +<!--签到--> +<common-page> + <block wx:if="{{ !signInResult }}"> + <view class="header"> + <image class="header-image" src="{{ imgUrl }}women.png" /> + <view class="header-title">签到操作需要确保参与人的身份的真实性,请核对以下信息:</view> + </view> + <view class="main"> + <view class="card-cell"> + <view class="card-cell-title">真实姓名:</view> + <view class="card-cell-value">{{ userInfo.trueName || '-' }}</view> + </view> + <view class="card-cell card-cell-border"> + <view class="card-cell-title">证件类型:</view> + <view class="card-cell-value">{{ userInfo.idcardTypeName || '-' }}</view> + </view> + <view class="card-cell card-cell-border"> + <view class="card-cell-title">证件号码:</view> + <view class="card-cell-value">{{ userInfo.idcard || '-' }}</view> + </view> + <view class="submit-button"> + <van-button bind:click="handleRealName" block type="primary">签到</van-button> + </view> + </view> + </block> + <block wx:else> + <view class="result"> + <block wx:if="{{ signInResult === 'success' }}"> + <van-icon color="#07c160" name="checked" size="150rpx" /> + </block> + <image class="result-image" src="{{ imgUrl }}cry.png" wx:else /> + <view class="result-title">{{ signInResult === 'success' ? '签到成功' : '签到失败' }}</view> + <van-button bind:click="handleClickNext" type="primary">{{ signInResult === 'success' ? '返回' : '重新签到' }}</van-button> + </view> + </block> +</common-page> diff --git a/pages/signIn/index.wxss b/pages/signIn/index.wxss new file mode 100644 index 0000000..8424326 --- /dev/null +++ b/pages/signIn/index.wxss @@ -0,0 +1,40 @@ +/* pages/signIn/index.wxss */ +@import '../../styles/public_components.wxss'; + +.header { + background-color: #ffffff; + display: flex; + align-items: center; + padding: 32rpx 32rpx 24rpx; +} + +.header-image { + width: 120rpx; + height: 120rpx; +} + +.header-title { + flex: 1; + padding-left: 32rpx; +} + +.main { + background-color: #ffffff; + padding-top: 32rpx; +} + +.result { + background-color: #ffffff; + padding: 100rpx 32rpx; + text-align: center; +} + +.result-title { + margin: 48rpx 0; + font-weight: 600; +} + +.result-image { + width: 150rpx; + height: 150rpx; +} diff --git a/pages/speechToText/index.js b/pages/speechToText/index.js new file mode 100644 index 0000000..28eafb2 --- /dev/null +++ b/pages/speechToText/index.js @@ -0,0 +1,207 @@ +// pages/speechToText/index.js +const $$ = require('../../utils/util'); +const app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + recordMannager: wx.getRecorderManager(), + data: { + imgUrl: $$.url.img, + key: '', + value: '', + showModal: false, //按住说话显示 + }, + + // 录音结束触发 + _endRecord(e) { + this._transferText(e); + }, + + touchStart(e) { + let that = this; + wx.getSetting({ + success(res) { + if (res.authSetting['scope.record'] === false) { + $$.hideLoading(); + $$.showModal({ + content: '抱歉!此功能需授权麦克风录音功能', + confirmText: '跳转授权', + success: (res) => { + if (res.confirm) { + wx.openSetting({ + success(res) { + if (res.authSetting['scope.record']) { + $$.showToast({ + title: '授权成功' + }); + } else { + $$.showToast({ + title: '授权失败' + }); + } + }, + }); + } + }, + }); + return false; + } + that.setData({ + showModal: true + }); + // 开始说话 + const options = { + duration: 60000, + sampleRate: 16000, + numberOfChannels: 1, + encodeBitRate: 96000, + format: 'pcm', + }; + that.recordMannager.start(options); + that.recordMannager.onStart(() => console.log('开始录音')); + that.recordMannager.onError((e) => { + console.log('onError', e); + $$.showToast({ + title: '抱歉!录音时间过短,请重新录入' + }); + that.setData({ + second: 60, + showModal: false + }); + }); + + }, + }); + }, + + touchEnd() { + let that = this; + that.recordMannager.onStop((e) => that._endRecord(e)); + that.recordMannager.stop(); + that.setData({ + showModal: false + }) + console.log('结束录音'); + }, + + + + // 语音转文字 + _transferText(e) { + console.log('开始识别', e); + $$.showLoading(); + let speakUrl = e.tempFilePath; + let that = this; + wx.uploadFile({ + url: `${$$.baseUrl}${$$.url.sys}/api/wechat/xfyun/speech`, + filePath: speakUrl, + name: 'fileNames', + header: { + Authorization: app.globalData.token + }, + complete(res) { + $$.hideLoading(); + if (res.errMsg === 'uploadFile:ok') { + const { + code, + data, + msg + } = JSON.parse(res.data); + if (code === '0' || code === 0) { + that.setData({ + value: that.data.value + data || '', + number: (that.data.value + data || '').length, + }); + } else { + $$.showToast({ + icon: 'error', + title: msg + }); + } + } else { + $$.showToast({ + icon: 'error', + title: '录音转写失败' + }); + } + }, + }); + }, + + // 表单修改 + handleChange(e) { + let key = e.currentTarget.dataset.key, + value = e.detail; + this.setData({ + value: value, + [key]: value.length + }); + }, + + // 下一步 or 上一步 + handleNext(e) { + // 获取当前页面栈 + var pages = getCurrentPages(); + + console.log('this.data.value', this.data.value); + console.log('this.data.key', this.data.key); + // 上一个页面 + var prevPage = pages[pages.length - 2]; + // 直接设置数据对象到上一页面的data中 + prevPage.setData({ + twoValue: this.data.value, + twoKey: this.data.key, + }); + wx.navigateBack({ + delta: 1, + }) + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let { + type, + value + } = options + console.log('type', type); + this.setData({ + key: type, + value, + number: value?.length || 0, + }) + wx.getSetting({ + success(res) { + if (res.authSetting['scope.record'] === false) { + $$.hideLoading(); + $$.showModal({ + content: '抱歉!此功能需授权麦克风录音功能', + confirmText: '跳转授权', + success: (res) => { + if (res.confirm) { + wx.openSetting({ + success(res) { + if (res.authSetting['scope.record']) { + $$.showToast({ + title: '授权成功' + }); + } else { + $$.showToast({ + title: '授权失败' + }); + } + }, + }); + } + }, + }); + } + } + }) + }, +}) \ No newline at end of file diff --git a/pages/speechToText/index.json b/pages/speechToText/index.json new file mode 100644 index 0000000..3cc835c --- /dev/null +++ b/pages/speechToText/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "按住说话", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/speechToText/index.wxml b/pages/speechToText/index.wxml new file mode 100644 index 0000000..65fdd88 --- /dev/null +++ b/pages/speechToText/index.wxml @@ -0,0 +1,79 @@ +<!--pages/speechToText/index.wxml--> +<block class="card"> + <view class="speechToText-main"> + <block wx:if="{{key==='caseDes'}}"> + <view class="cell-item"> + <view class="cell-title"><text><text class="cell-required">*</text>事项概况</text></view> + <van-field custom-style="padding:0 20rpx;line-height:90rpx; margin-bottom:32rpx" autosize="{{ { maxHeight: 470, minHeight: 470 } }}" bind:change="handleChange" border="{{ false }}" maxlength='2000' data-key="number" placeholder="请完整描述事项概况,应具备5要素:发生时间+发生地点+人物情况+事项起因+事项经过" type="textarea" value="{{ value }}" /> + </view> + <view class="textarea-foot"> + <view class="textarea-limit">{{number||0}}/2000字</view> + <view class="textarea-ability"> + <!-- <view bindtouchstart="touchStart" bindtouchend="touchEnd" class="textarea-img"> --> + <view bindtouchstart="touchStart" bindtouchend="touchEnd" class="textarea-img"> + <image src="{{imgUrl}}voiceOcr.png" mode="" />按住说话 + </view> + </view> + </view> + </block> + <block wx:else> + <view class="cell-item"> + <view class="cell-title"><text><text class="cell-required">*</text>事项申请</text></view> + <van-field custom-style="padding:0 20rpx;line-height:90rpx" autosize="{{ { maxHeight: 470, minHeight: 470 } }}" bind:change="handleChange" border="{{ false }}" maxlength='500' data-key="number" placeholder="希望相关部门如何处理,建议分条描述,如请求1,请求2..." type="textarea" value="{{ value }}" /> + </view> + <view class="textarea-foot"> + <view class="textarea-limit">{{number||0}}/500字</view> + <view class="textarea-ability"> + <view bindtouchstart="touchStart" bindtouchend="touchEnd" class="textarea-img"> + <image src="{{imgUrl}}voiceOcr.png" mode="" />按住说话 + </view> + </view> + </view> + </block> + <view wx:if="{{showModal}}" class="modal-card"> + <!-- <image class="modal-img" src="{{imgUrl}}speechToText.png" mode="" /> --> + <view class="recording"> + <!-- 语音动画 --> + <block> + <view class="time-box"> + <view class="time-box-top"> + <view class="hr hr1" /> + <view class="hr hr2" /> + <view class="hr hr3" /> + <view class="hr hr4" /> + <view class="hr hr5" /> + <view class="hr hr6" /> + <view class="hr hr7" /> + <view class="hr hr8" /> + <view class="hr hr9" /> + <view class="hr hr10" /> + </view> + <view class="time-box-bottom"> + <view class="hr hr1" /> + <view class="hr hr2" /> + <view class="hr hr3" /> + <view class="hr hr4" /> + <view class="hr hr5" /> + <view class="hr hr6" /> + <view class="hr hr7" /> + <view class="hr hr8" /> + <view class="hr hr9" /> + <view class="hr hr10" /> + </view> + </view> + <view class="recording-title">松开结束,上滑取消</view> + </block> + </view> + </view> + </view> + <view class="submitButton" catch:tap=""> + <view style="flex: 1;"> + <van-button bind:click="handleNext" block data-type="next" type="primary">保存</van-button> + <view class="safeHeight" /> + </view> + </view> + + <view class="modal"> + + </view> +</block> \ No newline at end of file diff --git a/pages/speechToText/index.wxss b/pages/speechToText/index.wxss new file mode 100644 index 0000000..b8dc374 --- /dev/null +++ b/pages/speechToText/index.wxss @@ -0,0 +1,227 @@ +/* pages/speechToText/index.wxss */ + +.submitButton { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + padding: 32rpx var(--padding-my); + background-color: #fff; + z-index: 99; +} + +.speechToText-main { + position: relative; +} + +.cell-item { + padding: 24rpx 32rpx 24rpx 12rpx; + background-color: #fff; +} + +.cell-title { + margin-bottom: 8rpx; + display: flex; + justify-content: space-between; +} + +.cell-required { + color: #d1021c; + font-size: 30rpx; +} + +.textarea-foot { + display: flex; + justify-content: space-between; + background-color: #fff; + align-items: center; + padding-left: 32rpx; + /* margin-bottom: 96rpx; */ +} + +.textarea-limit { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(23, 26, 29, 0.40); +} + +.textarea-ability { + display: flex; + align-items: center; + background-color: rgba(182, 221, 241, 0.46); + padding: 16rpx; + border-radius: 20px 0px 0px 0px; + color: var(--main-color); + font-weight: 400; +} + +.textarea-img { + display: flex; + align-items: center; + gap: 8rpx; +} + +.textarea-img image { + width: 28rpx; + height: 28rpx; +} + +.card { + display: flex; + flex-direction: column; +} + + +.modal-card { + position: absolute; + width: 200px; + height: 140px; + background: rgba(95, 166, 212, 0.80); + color: #fff; + border-radius: 4px; + top: 40%; + left: 23%; + text-align: center; +} + +.modal-img { + width: 144px; + height: 120px; +} + +.modal-title {} + +.time-box { + position: relative; + height: 120rpx; + left: 50%; + margin-left: -86rpx; +} + +.time-box-top { + position: absolute; + bottom: 50%; +} + +.time-box-bottom { + position: absolute; + top: 50%; + transform: rotateX(180deg); +} + +.hr { + background-color: red; + width: 10rpx; + height: 10rpx; + bottom: 0; + position: absolute; + background: #ffffff; + animation: bodong 0.5s infinite ease; + border-top-left-radius: 5rpx; + border-top-right-radius: 5rpx; +} + +.hr1 { + left: 0; + animation-delay: 1s; + animation-duration: 1s; +} + +.hr2 { + left: 18rpx; + animation-delay: 0.9s; + animation-duration: 0.9s; +} + +.hr3 { + left: 36rpx; + animation-delay: 0.8s; + animation-duration: 0.8s; +} + +.hr4 { + left: 54rpx; + animation-delay: 0.7s; + animation-duration: 0.7s; +} + +.hr5 { + left: 72rpx; + animation-delay: 0.6s; + animation-duration: 0.6s; +} + +.hr6 { + left: 90rpx; + animation-delay: 0.5s; + animation-duration: 0.5s; +} + +.hr7 { + left: 108rpx; + animation-delay: 0.7s; + animation-duration: 0.7s; +} + +.hr8 { + left: 126rpx; + animation-delay: 0.6s; + animation-duration: 0.6s; +} + +.hr9 { + left: 144rpx; + animation-delay: 0.8s; + animation-duration: 0.8s; +} + +.hr10 { + left: 162rpx; + animation-delay: 1s; + animation-duration: 1s; +} + +@keyframes bodong { + 0% { + height: 10rpx; + } + + 20% { + height: 20rpx; + } + + 30% { + height: 30rpx; + } + + 60% { + height: 60rpx; + } + + 80% { + height: 30rpx; + } + + 100% { + height: 10rpx; + } +} + +.recording { + position: absolute; + width: 350rpx; + padding: 48rpx 0; + top: 2%; + left: 50%; + margin-left: -175rpx; + text-align: center; + color: #ffffff; + font-size: 28rpx; +} + +.cell-phone .van-button { + color: var(--main-color); + border: none !important; + padding: 0 !important; +} \ No newline at end of file diff --git a/pages/ssimDetail/index.js b/pages/ssimDetail/index.js new file mode 100644 index 0000000..a80c471 --- /dev/null +++ b/pages/ssimDetail/index.js @@ -0,0 +1,51 @@ +// pages/ssimDetail/index.js +const $$ = require('../../utils/util'); + +function getByIdApi(param) { + return $$.request({ + url: 'ctUnit/getById', + type: 'get', + submitData: param || {}, + service: 'cust' + }) +} +Page({ + + /** + * 页面的初始数据 + */ + data: { + data: {}, + }, + + + // 获取纠纷案件详情 + async getById(data) { + $$.showLoading(); + const res = await getByIdApi({ + id: data.id + }); + $$.hideLoading(); + if (res.type) { + let data = res.data || {}; + this.setData({ + data + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getById(options); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + +}) \ No newline at end of file diff --git a/pages/ssimDetail/index.json b/pages/ssimDetail/index.json new file mode 100644 index 0000000..9e0f414 --- /dev/null +++ b/pages/ssimDetail/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "综治中心详情", + "usingComponents": { + } +} \ No newline at end of file diff --git a/pages/ssimDetail/index.wxml b/pages/ssimDetail/index.wxml new file mode 100644 index 0000000..c6f7c0e --- /dev/null +++ b/pages/ssimDetail/index.wxml @@ -0,0 +1,28 @@ +<!--pages/ssimDetail/index.wxml--> +<common-page> + <view class="card"> + <view class="cell3"> + <view class="cell-title-placeholder">服务中心名称</view> + <view>{{ data.unitName || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">办公地址</view> + <view>{{ data.addr || '-' }}</view> + </view> + <map longitude="113.2038664" latitude="23.1622136" show-location="false" scale="16" style="width: 100%; height: 280rpx;"></map> + <view class="cell3"> + <view class="cell-title-placeholder">邮政编码</view> + <view>{{ data.postalCode || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">联系电话</view> + <view>{{ data.dutyMobile || '-' }}</view> + </view> + <view class="cell3"> + <view class="cell-title-placeholder">办公时间</view> + <view>{{data.workTimeWeek||'-'}}</view> + <view>{{data.workTimeAm||'-'}}</view> + <view>{{data.workTimePm||'-'}}</view> + </view> + </view> +</common-page> \ No newline at end of file diff --git a/pages/ssimDetail/index.wxss b/pages/ssimDetail/index.wxss new file mode 100644 index 0000000..f9a7396 --- /dev/null +++ b/pages/ssimDetail/index.wxss @@ -0,0 +1,16 @@ +/* pages/ssimDetail/index.wxss */ +.card { + padding: 24rpx 32rpx; + background-color: #ffffff; + border-radius: var(--border-radius-card); +} + +.cell3 { + margin-bottom: 16rpx; +} + +.cell-title-placeholder { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(0, 0, 0, 0.5); +} \ No newline at end of file diff --git a/pages/ssimList/index.js b/pages/ssimList/index.js new file mode 100644 index 0000000..0c69b3f --- /dev/null +++ b/pages/ssimList/index.js @@ -0,0 +1,269 @@ +const $$ = require('../../utils/util'); +const app = getApp(); +import Toast from '../../components/vant/toast/toast'; + +function pageZzQueryApi(param) { + return $$.request({ + url: 'ctUnit/pageZzQuery', + type: 'get', + submitData: param || {}, + service: 'cust' + }) +} + +Page({ + /** + * 页面的初始数据 + */ + userInfo: {}, + location: [], // 省市区等地理资源 + data: { + imgUrl: $$.url.img, + search: { + prov: '', + provName: '', + city: '', + cityName: '', + area: '', + areaName: '', + road: '', + roadName: '', + keyword: '', + page: 1, + size: 10, + }, // 查询条件 + data: [], // 数据 + total: 0, // 总数 + popup: { + formtype: '', + index: 0, + }, // 下拉弹出框数据 + }, + + + + + + + + + + + // 下拉框选择确认 + handleConfirmPicker({ + detail + }) { + let type = this.data.popup.type, + value = detail.detail.value, + arr = []; + this.data.popup.visible = false; + if (type === 'caseCause') { + arr = ['caseType', 'caseTypeName']; + arr.forEach((x, t) => { + this.data.search[x] = value[0][t === 0 ? 'value' : 'label']; + }); + } else if (type === 'location') { + arr = [ + ['city', 'cityName'], + ['area', 'areaName'], + ['road', 'roadName'], + ]; + arr.forEach((x, t) => { + this.data.search[x[0]] = value[t]?.value || ''; + this.data.search[x[1]] = value[t]?.label || ''; + }); + } + this.setData({ + popup: this.data.popup, + search: this.data.search + }); + }, + + // 多行下拉选择时,省市区选择 + handleChangeColumns(e) { + if (this.data.popup.type === 'location') { + let selectData = $$.changeLocation(e, this.location, this.data.popup.selectData); + this.setData({ + popup: { + ...this.data.popup, + selectData + } + }); + } + }, + + // 下拉框选择开启 + handleShowPopup(e) { + let type = e.currentTarget.dataset.type; + let selectData = []; + if (type === 'location') { + if (this.location.length === 0) { + return false; + } + let selectOption = JSON.parse(JSON.stringify(this.location)); + let arr = $$.getLocationIndex(this.location, this.data.search); // 计算默认的市区县下标 + selectData = [{ + values: selectOption, + defaultIndex: arr[0] + }, + { + values: selectOption[arr[0]].children, + defaultIndex: arr[1] + }, + { + values: selectOption[arr[0]].children[arr[1]].children || [], + defaultIndex: arr[2] + }, + ]; + selectData.forEach((x) => { + x.values.forEach((y) => { + delete y.children; + }); + }); + } else { + let selectOption = this.select[type]; + selectData = [{ + values: selectOption, + defaultIndex: 0 + }]; + } + this.setData({ + popup: { + formtype: e.currentTarget.dataset.formtype, + index: e.currentTarget.dataset.index, + visible: true, + title: e.currentTarget.dataset.title, + type: type, + selectData: selectData, + }, + }); + }, + + // 关闭下拉框选择 + handleClosePopup() { + this.data.popup.visible = false; + this.setData({ + popup: this.data.popup + }); + }, + + searchButton() { + this.pageZzQuery(this.data.search) + }, + + async pageZzQuery(params, type) { + $$.showLoading(); + const res = await pageZzQueryApi(params); + $$.hideLoading(); + if (this.data.loading) { + this.setData({ + loading: false + }); + } + if (res.type) { + if (params.page === 1) { + this.data.data = res.data.content || []; + } else { + this.data.data = this.data.data.concat(res.data.content || []); + } + this.setData({ + search: params, + data: this.data.data, + total: res.data.totalElements || 0 + }); + if (type === 'onPullDownRefresh') { + $$.showToast({ + title: '已是最新记录', + duration: 1000 + }); + wx.stopPullDownRefresh(); + } + } + }, + + // 关闭底部弹窗 + handleClosePopupMsg() { + if (this.data.popupMsg.type === 1) { + this.getUserInfo(this.data.popupMsg.intentionObj); + } else { + this.setData({ + popupMsg: { + show: false + } + }); + } + }, + + // 滚动到底部获取案件 + handlescrolltolower() { + if (this.data.data.length >= this.data.total) { + return false; + } + if (!this.data.loading) { + this.data.loading = true; + this.setData({ + loading: this.data.loading + }); + let submitData = { + ...this.data.search + }; + submitData.page = submitData.page + 1; + this.pageZzQuery(submitData); + } + }, + + // 返回首页 + handleGoHomepage() { + if (this.data.changeVisible) { + wx.navigateBack({ + delta: 1, + }); + return false; + } + wx.reLaunch({ + url: '../../pages/homePage/index', + }); + }, + + // 获取省市区等地理资源 + async getLocationData() { + $$.showLoading(); + const res = await $$.commonRequest({ + url: `${$$.url.assets}locationSelect.json`, + type: 'get' + }); + $$.hideLoading(); + if (res) { + let location = []; + $$.province.forEach((x) => { + location.push(res[x][0]); + }); + this.location = location; + } + }, + + // 跳转详情 + _handleGoPage(e) { + let url = e.currentTarget.dataset.url; + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: url + '?id=' + id, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.pageZzQuery(this.data.search) + this.getLocationData(); + }, + + onShow: function () { + // this.pageZzQuery(this.data.search); + }, + + onHide: function () {}, + + onUnload: function () {}, +}); \ No newline at end of file diff --git a/pages/ssimList/index.json b/pages/ssimList/index.json new file mode 100644 index 0000000..1db4266 --- /dev/null +++ b/pages/ssimList/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "综治中心查询", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/ssimList/index.wxml b/pages/ssimList/index.wxml new file mode 100644 index 0000000..4cadeb1 --- /dev/null +++ b/pages/ssimList/index.wxml @@ -0,0 +1,44 @@ +<van-toast id="van-toast" /> + +<common-page bind:onCancelPicker="handleClosePopup" bind:onChangePicker="handleChangeColumns" bind:onClosePopup="handleClosePopup" bind:onConfirmPicker="handleConfirmPicker" popup="{{ popup }}"> + <view class="ssimList"> + <!-- 综治中心查询 --> + <view class="card"> + <view class="cell"> + <view bindtap="handleShowPopup" data-type="location" class="cell-arrow cell-left"> + <view class="cell-left-l">{{ search.roadName ? search.roadName : '未选择' }}</view> + <van-icon name="arrow-down" /> + </view> + <view style="width:16rpx"></view> + <view class="cell-right"> + <van-icon name="search" /> + <van-field bind:change="handleChange" border="{{ false }}" custom-style="padding:0;background-color:#f2f3f5" data-key="keyword" placeholder="请输入中心名称" value="{{ search.keyword }}" /> + <view style="color:#E5E6EB">|</view> + <view bindtap="searchButton" class="ssimList-title public-color">查询</view> + </view> + </view> + </view> + + + <!-- 列表 --> + <van-empty description="暂无数据" wx:if="{{ total === 0 }}" /> + <view class="ssim-scroll" wx:else> + <scroll-view bindscrolltolower="handlescrolltolower" scroll-y="true" style="height: 100%;"> + <view class="card-box" wx:for="{{ data }}" wx:key="index"> + <view class="card-list" bindtap="_handleGoPage" data-id="{{ item.id }}" data-url="../../pages/ssimDetail/index"> + <view class="card-title">{{item.unitName}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">办公地址:</text>{{item.addr||'-'}}</view> + <view class="card-subTitle"><text class="card-subTitle-l">联系电话:</text>{{item.dutyMobile||'-'}}</view> + </view> + </view> + <block> + <van-divider contentPosition="center" custom-style="margin-top: 12px;" wx:if="{{ data.length >= total && data.length !== 0 }}">没有更多了</van-divider> + <view class="myMediate-scroll-loading" wx:if="{{ loading }}"> + <van-loading type="spinner" /> + </view> + </block> + </scroll-view> + </view> + <view class="safeHeight" /> + </view> +</common-page> \ No newline at end of file diff --git a/pages/ssimList/index.wxss b/pages/ssimList/index.wxss new file mode 100644 index 0000000..00ae0b9 --- /dev/null +++ b/pages/ssimList/index.wxss @@ -0,0 +1,82 @@ +@import '../../styles/public_components.wxss'; + +.ssimList { + height: 100%; + display: flex; + flex-direction: column; + position: absolute; + left: 0; + right: 0; +} + +.card { + background-color: #ffffff; + padding: 0 24rpx; +} + +.cell-left { + display: flex; + width: 28%; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; +} + +.cell-left-l { + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: var(--font-size-md, 14px); +} + +.cell-right { + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + background: #f2f3f5; + padding: 12rpx 16rpx; + border-radius: 10rpx; + font-size: var(--font-size-md, 14px); +} + +.card-box { + padding: 24rpx 24rpx 0 24rpx; +} + +.card { + border-radius: 2px; + background-color: #fff; +} + +.card-list { + border-radius: 2px; + background-color: #fff; + padding: 24rpx +} + +.ssim-scroll { + flex: 1; + overflow: hidden; +} + +.card-title { + font-size: 30rpx; + line-height: 46rpx; +} + +.card-subTitle { + padding-top: 8rpx; +} + +.card-subTitle-l { + color: rgba(23, 26, 29, 0.60); +} + +.ssimList-title { + font-size: 32rpx; + white-space: nowrap; +} \ No newline at end of file diff --git a/pages/urgingList/index.js b/pages/urgingList/index.js new file mode 100644 index 0000000..b692102 --- /dev/null +++ b/pages/urgingList/index.js @@ -0,0 +1,44 @@ +// pages/urgingList/index.js +const $$ = require('../../utils/util'); + +function listByCaseIdApi(param) { + return $$.request({ + url: 'caseUrging/listByCaseId', + type: 'get', + submitData: param || {}, + service: 'mediate', + }); +} + +Page({ + + /** + * 页面的初始数据 + */ + data: { + data: [], + }, + + // 获取回复列表 + async listByCaseId(caseId) { + $$.showLoading(); + const res = await listByCaseIdApi({ + caseId + }); + $$.hideLoading(); + if (res.type) { + this.setData({ + data: res.data || [], + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.listByCaseId(options.caseId); + }, + + +}) \ No newline at end of file diff --git a/pages/urgingList/index.json b/pages/urgingList/index.json new file mode 100644 index 0000000..8e2efa0 --- /dev/null +++ b/pages/urgingList/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "催办回复", + "usingComponents": { + "time-format": "../../components/time-format/index" + } +} \ No newline at end of file diff --git a/pages/urgingList/index.wxml b/pages/urgingList/index.wxml new file mode 100644 index 0000000..c52d447 --- /dev/null +++ b/pages/urgingList/index.wxml @@ -0,0 +1,15 @@ +<!--pages/urgingList/index.wxml--> +<!--更多资讯和更多视频页面--> +<view class="homePageInfo-main"> + <block> + <view class="homePageInfo-main-item" wx:for="{{ data }}" wx:key="index"> + <view class="urgingList-title"> + <time-format format="YYYY-MM-DD HH:mm" value="{{ item.replyTime }}" /> + </view> + <view class="urgingList-text"><text class="public-color">{{item.replyUserName}}: </text>{{ item.replyContent }}</view> + </view> + </block> + <view > + <van-divider contentPosition="center" custom-style="margin-top: 12px;">没有更多了</van-divider> + </view> +</view> \ No newline at end of file diff --git a/pages/urgingList/index.wxss b/pages/urgingList/index.wxss new file mode 100644 index 0000000..a4683e0 --- /dev/null +++ b/pages/urgingList/index.wxss @@ -0,0 +1,31 @@ +/* pages/urgingList/index.wxss */ +/* pages/homePageInfo/index.wxss */ + +.homePageInfo-main { + margin: 32rpx 0; + padding: 0 var(--padding-my); +} + +.homePageInfo-main-item { + border: 0.5px solid #1a6fb8; + border-radius: 4px; + padding: 24rpx; + background-color: #ffffff; + margin-bottom: 24rpx; +} + +.homePageInfo-main-item-text { + margin-top: 24rpx; + font-size: 24rpx; + line-height: 40rpx; + color: #c8c9cc; + display: flex; +} + +.urgingList-title { + color: rgba(23, 26, 29, 0.60); +} + +.urgingList-text { + margin-top: 8rpx; +} \ No newline at end of file diff --git a/pages/webview/index.js b/pages/webview/index.js new file mode 100644 index 0000000..5b9c7d5 --- /dev/null +++ b/pages/webview/index.js @@ -0,0 +1,18 @@ +// pages/webview/index.js +Page({ + /** + * 页面的初始数据 + */ + data: { + showUrl: '', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + showUrl: options.showUrl, + }); + }, +}); diff --git a/pages/webview/index.json b/pages/webview/index.json new file mode 100644 index 0000000..00a975f --- /dev/null +++ b/pages/webview/index.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "最新资讯", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/webview/index.wxml b/pages/webview/index.wxml new file mode 100644 index 0000000..606e2ef --- /dev/null +++ b/pages/webview/index.wxml @@ -0,0 +1,2 @@ +<!--pages/webview/index.wxml--> +<web-view src="{{ showUrl }}"></web-view> diff --git a/pages/webview/index.wxss b/pages/webview/index.wxss new file mode 100644 index 0000000..5e3b696 --- /dev/null +++ b/pages/webview/index.wxss @@ -0,0 +1 @@ +/* pages/webview/index.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..0c2c4b1 --- /dev/null +++ b/project.config.json @@ -0,0 +1,55 @@ +{ + "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false, + "minifyWXML": true, + "useStaticServer": true, + "checkInvalidKey": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "disableUseStrict": false, + "useCompilerPlugins": false, + "ignoreUploadUnusedFiles": true, + "condition": false, + "swc": false + }, + "compileType": "miniprogram", + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + }, + "simulatorPluginLibVersion": {}, + "packOptions": { + "ignore": [], + "include": [] + }, + "appid": "wx414ae04ac3f10b4e" +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..be3aa23 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,11 @@ +{ + "projectname": "gz-wxparty", + "setting": { + "compileHotReLoad": true, + "urlCheck": false, + "bigPackageSizeSupport": true, + "autoAudits": false + }, + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "libVersion": "3.7.11" +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/styles/animate.wxss b/styles/animate.wxss new file mode 100644 index 0000000..6974eae --- /dev/null +++ b/styles/animate.wxss @@ -0,0 +1,31 @@ +@import './animate_base.wxss'; + +@keyframes slideInUp { + from { + transform: translate3d(0, 100%, 0); + visibility: visible; + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.slideInUp { + animation-name: slideInUp; +} + +@keyframes slideInDown { + from { + transform: translate3d(0, -100%, 0); + visibility: visible; + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.slideInDown { + animation-name: slideInDown; +} diff --git a/styles/animate_base.wxss b/styles/animate_base.wxss new file mode 100644 index 0000000..d458b44 --- /dev/null +++ b/styles/animate_base.wxss @@ -0,0 +1,62 @@ +page { + --animate-duration: 1s; + --animate-delay: 1s; + --animate-repeat: 1; +} + +.animated { + animation-duration: var(--animate-duration); + animation-fill-mode: both; +} + +.animated.infinite { + animation-iteration-count: infinite; +} + +.animated.repeat-1 { + animation-iteration-count: var(--animate-repeat); +} + +.animated.repeat-2 { + animation-iteration-count: calc(var(--animate-repeat) * 2); +} + +.animated.repeat-3 { + animation-iteration-count: calc(var(--animate-repeat) * 3); +} + +.animated.delay-1s { + animation-delay: var(--animate-delay); +} + +.animated.delay-2s { + animation-delay: calc(var(--animate-delay) * 2); +} + +.animated.delay-3s { + animation-delay: calc(var(--animate-delay) * 3); +} + +.animated.delay-4s { + animation-delay: calc(var(--animate-delay) * 4); +} + +.animated.delay-5s { + animation-delay: calc(var(--animate-delay) * 5); +} + +.animated.faster { + animation-duration: calc(var(--animate-duration) / 2); +} + +.animated.fast { + animation-duration: calc(var(--animate-duration) * 0.8); +} + +.animated.slow { + animation-duration: calc(var(--animate-duration) * 2); +} + +.animated.slower { + animation-duration: calc(var(--animate-duration) * 3); +} diff --git a/styles/public.wxss b/styles/public.wxss new file mode 100644 index 0000000..e39ee4b --- /dev/null +++ b/styles/public.wxss @@ -0,0 +1,253 @@ +page { + /* color */ + /* 主色 */ + --main-color: #1A6FB8; + /* page背景色 */ + --bg-color: #f0f2f5; + /* 主色拓展 */ + --red-1: #ffeae6; + /* Color Palette */ + --black: #000; + --white: #fff; + --gray-1: rgba(255,255,255,0.60); + --gray-2: #f2f3f5; + --gray-3: #ebedf0; + --gray-4: #dcdee0; + --gray-5: #c8c9cc; + --gray-6: #969799; + --gray-7: #646566; + --gray-8: #323233; + --red: #ee0a24; + --blue: #1989fa; + --orange: #ff976a; + --orange-dark: #ed6a0c; + --orange-light: #fffbe8; + --green: #07c160; + /* font-color */ + --text-color: rgba(0, 0, 0, 0.85); + --second-text-color: rgba(0, 0, 0, 0.65); + + /* font */ + --font-size-main: 30rpx; + --line-height-main: 46rpx; + --font-size-xs: 20rpx; + --font-size-sm: 24rpx; + --font-size-md: 30rpx; + --font-size-lg: 32rpx; + --font-weight-bold: 600; + --line-height-xs: 28rpx; + --line-height-sm: 36rpx; + --line-height-md: 44rpx; + --line-height-lg: 44rpx; + --base-font-family: system-ui; + + /* Component Colors */ + --active-color: var(--gray-2); + --active-opacity: 0.7; + --disabled-opacity: 0.5; + --background-color: var(--gray-1); + --background-color-light: #fafafa; + --text-link-color: #576b95; + + /* Animation */ + --animation-duration-base: 0.3s; + --animation-duration-fast: 0.2s; + + /* padding */ + --padding-my: 32rpx; + --padding-base: 8rpx; + --padding-xs: 16rpx; + --padding-sm: 24rpx; + --padding-md: 32rpx; + --padding-lg: 48rpx; + --padding-xl: 64rpx; + + /* Border */ + --border-color: rgba(0, 0, 0, 0.1); + --border-radius-card: 20rpx; + --border-radius-card-sm: 10rpx; + --border-width-base: 2rpx; + --border-radius-sm: 4rpx; + --border-radius-md: 8rpx; + --border-radius-lg: 16rpx; + + /* Button */ + --button-mini-height: 44rpx; + --button-mini-min-width: 100rpx; + --button-mini-font-size: var(--font-size-xs); + --button-small-height: 60rpx; + --button-small-font-size: var(--font-size-sm); + --button-small-min-width: 120rpx; + --button-normal-font-size: var(--font-size-md); + --button-large-height: 100rpx; + --button-default-color: var(--text-color); + --button-default-height: 80rpx; + --button-default-font-size: var(--font-size-lg); + --button-default-background-color: var(--white); + --button-default-border-color: var(--border-color); + --button-primary-color: var(--white); + --button-primary-background-color: var(--main-color); + --button-primary-border-color: var(--main-color); + --button-info-color: var(--white); + --button-info-background-color: var(--blue); + --button-info-border-color: var(--blue); + --button-danger-color: var(--white); + --button-danger-background-color: var(--red); + --button-danger-border-color: var(--red); + --button-warning-color: var(--white); + --button-warning-background-color: var(--orange); + --button-warning-border-color: var(--orange); + --button-line-height: 44rpx; + --button-border-width: 2rpx; + --button-border-radius: var(--border-radius-md); + --button-round-border-radius: var(--border-radius-max); + --button-plain-background-color: var(--white); + --button-disabled-opacity: var(--disabled-opacity); + + /* Tabbar */ + --tabbar-height: 92rpx; + --tabbar-background-color: var(--white); + + /* TabbarItem */ + --tabbar-item-font-size: var(--font-size-sm); + --tabbar-item-text-color: var(--text-color); + --tabbar-item-active-color: var(--main-color); + --tabbar-item-line-height: 1; + --tabbar-item-icon-size: 36rpx; + --tabbar-item-margin-bottom: 8rpx; + + /* Tab */ + --tab-text-color: var(--gray-7); + --tab-active-text-color: var(--text-color); + --tab-disabled-text-color: var(--gray-5); + --tab-font-size: var(--font-size-md); + + /* Tabs */ + --tabs-default-color: var(--main-color); + --tabs-line-height: 48rpx; + --tabs-card-height: 60rpx; + --tabs-nav-background-color: var(--white); + --tabs-bottom-bar-height: 4rpx; + --tabs-bottom-bar-color: var(--tabs-default-color); + + /* Field */ + --field-label-color: var(--gray-7); + --field-input-text-color: var(--text-color); + --field-input-error-text-color: var(--red); + --field-input-disabled-text-color: var(--gray-5); + --field-placeholder-text-color: rgba(0, 0, 0, 0.5); + --field-icon-size: 32rpx; + --field-clear-icon-size: 32rpx; + --field-clear-icon-color: var(--gray-5); + --field-icon-container-color: var(--gray-6); + --field-error-message-color: var(--red); + --field-error-message-text-font-size: var(--font-size-sm); + --field-text-area-min-height: 36rpx; + --field-word-limit-color: var(--gray-7); + --field-word-limit-font-size: var(--font-size-sm); + --field-word-limit-line-height: 32rpx; + --field-word-num-full-color: var(--red); + --field-disabled-text-color: var(--gray-5); + + /* Cell */ + --cell-font-size: var(--font-size-md); + --cell-line-height: var(--line-height-md); + --cell-vertical-padding: var(--padding-sm); + --cell-horizontal-padding: var(--padding-md); + --cell-text-color: var(--text-color); + --cell-background-color: var(--white); + --cell-border-color: var(--border-color); + --cell-active-color: var(--active-color); + --cell-required-color: var(--red); + --cell-label-color: var(--gray-6); + --cell-label-font-size: var(--font-size-sm); + --cell-label-line-height: 36rpx; + --cell-label-margin-top: 6rpx; + --cell-value-color: var(--gray-6); + --cell-icon-size: 32rpx; + --cell-right-icon-color: var(--gray-6); + --cell-large-vertical-padding: var(--padding-sm); + --cell-large-title-font-size: var(--font-size-lg); + --cell-large-value-font-size: var(--font-size-lg); + --cell-large-label-font-size: var(--font-size-md); + + /* CellGroup */ + --cell-group-background-color: var(--white); + --cell-group-title-color: var(--gray-6); + --cell-group-title-padding: var(--padding-md) var(--padding-md) var(--padding-xs); + --cell-group-title-font-size: var(--font-size-md); + --cell-group-title-line-height: 32rpx; + --cell-group-inset-padding: 0 var(--padding-my); + --cell-group-inset-border-radius: var(--border-radius-lg); + --cell-group-inset-title-padding: var(--padding-md) var(--padding-md) var(--padding-xs) var(--padding-xl); + + /* Checkbox */ + --checkbox-size: 40rpx; + --checkbox-border-color: var(--gray-5); + --checkbox-transition-duration: 0.2s; + --checkbox-label-margin: 20rpx; + --checkbox-label-color: --text-color; + --checkbox-checked-icon-color: var(--main-color); + --checkbox-disabled-icon-color: var(--gray-5); + --checkbox-disabled-label-color: var(--gray-5); + --checkbox-disabled-background-color: var(--border-color); + + /* Popup */ + --popup-background-color: var(--white); + --popup-round-border-radius: 20rpx; + --popup-close-icon-size: 36rpx; + --popup-close-icon-color: var(--black); + --popup-close-icon-margin: 32rpx; + --popup-close-icon-z-index: 1; + + /* Search */ + --search-background-color: #ffffff; + --search-padding: 16rpx var(--padding-my); + --search-input-height: 68rpx; + --search-label-padding: 0 10rpx; + --search-label-color: var(--text-color); + --search-label-font-size: var(--font-size-md); + --search-left-icon-color: var(--gray-6); + --search-action-padding: 0 var(--padding-xs); + --search-action-text-color: var(--text-color); + --search-action-font-size: var(--font-size-md); + + /* Toast */ + --toast-max-width: 90%; + --toast-font-size: 28rpx; + --toast-text-color: var(--white); + --toast-line-height: 40rpx; + --toast-border-radius: var(--border-radius-lg); + --toast-background-color: var(--second-text-color); + --toast-icon-size: 72rpx; + --toast-text-min-width: 192rpx; + --toast-text-padding: var(--padding-xs) var(--padding-sm); + --toast-default-padding: var(--padding-md); + --toast-default-width: 176rpx; + --toast-default-min-height: 176rpx; + + /* Radio */ + --radio-size: 40rpx; + --radio-border-color: var(--gray-5); + --radio-transition-duration: 0.2s; + --radio-label-margin: 20rpx; + --radio-label-color: var(--text-color); + --radio-checked-icon-color: var(--main-color); + --radio-disabled-icon-color: var(--gray-5); + --radio-disabled-label-color: var(--gray-5); + --radio-disabled-background-color: var(--border-color); + + /* Switch */ + --switch-width: 2em; + --switch-height: 1em; + --switch-node-size: 1em; + --switch-node-z-index: 1; + --switch-node-background-color: var(--white); + --switch-node-box-shadow: 0 6rpx 2rpx 0 rgba(0, 0, 0, 0.05), 0 4rpx 4rpx 0 rgba(0, 0, 0, 0.1), 0 6rpx 6rpx 0 rgba(0, 0, 0, 0.05); + --switch-background-color: var(--white); + --switch-on-background-color: var(--main-color); + --switch-transition-duration: 0.3s; + --switch-disabled-opacity: 0.4; + --switch-border: 2rpx solid rgba(0, 0, 0, 0.1); +} + diff --git a/styles/public_components.wxss b/styles/public_components.wxss new file mode 100644 index 0000000..8dd6c51 --- /dev/null +++ b/styles/public_components.wxss @@ -0,0 +1,313 @@ +.submit-button { + padding: 32rpx; +} + +.pre { + white-space: pre-wrap; + word-wrap: break-word; + color: var(--text-color); + font-family: var(--base-font-family); + font-size: 28rpx; + line-height: 1.5; +} + +/* 输入框单元格样式 */ +.card-cell { + display: flex; + padding: 0 32rpx 16rpx; +} + +.card-cell-border { + padding-top: 20rpx; + border-top: 2rpx solid var(--border-color); + padding-left: 0; + padding-right: 0; + margin: 0 32rpx; +} + +.card-cell-title { + color: var(--field-label-color); +} + +.card-cell-value { + overflow: hidden; + text-align: left; + vertical-align: middle; + flex: 1; + color: var(--text-color); + word-break: break-word; +} + +/* 预约信息card样式 */ +.order { + background: rgba(82, 196, 26, 0.1); + border-radius: var(--border-radius-card-sm); + display: flex; + align-items: center; + padding: 16rpx; + margin: 0 32rpx ; + font-size: 24rpx; + line-height: 40rpx; +} + +.order-date { + padding: 16rpx; + color: #ffffff; + background: #52c41a; + border-radius: var(--border-radius-card-sm); + text-align: center; + margin-right: 16rpx; +} + +.order-date-day { + font-size: 32rpx; + line-height: 32rpx; + margin-bottom: 8rpx; +} + +.order-date-month { + font-size: 24rpx; + line-height: 24rpx; +} + +.order-date-time { + display: flex; + align-items: center; +} + +.order-date-type { + color: #52c41a; + border: 1rpx solid #73d13d; + border-radius: 4rpx; + padding: 6rpx; + font-size: 22rpx; + line-height: 22rpx; + margin-left: 8rpx; +} + +/* 展示的单元格样式 */ +.cell { + display: flex; + align-items: center; + padding: 24rpx 0; +} + +.cell2 { + padding: 24rpx 0; +} + +.cell3 { + margin-bottom: 16rpx; +} + +.cell-noPadding { + margin-top: -24rpx; +} + +.cell-title, +.cell-title-line { + font-size: 30rpx; + line-height: 46rpx; + font-weight: 600; +} + +.cell-title-line { + margin-bottom: 4px; +} + +.cell-title-placeholder { + font-size: 28rpx; + line-height: 44rpx; + color: rgba(0, 0, 0, 0.5); +} + +.cell-required { + font-size: 24rpx; + line-height: 40rpx; + color: rgba(0, 0, 0, 0.5); + font-weight: 500; +} + +.cell-placeholder { + flex: 1; + font-size: 30rpx; + line-height: 46rpx; + color: rgba(0, 0, 0, 0.5); +} + +.cell-select { + flex: 1; + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.cell-arrow { + font-size: 32rpx; + color: rgba(0, 0, 0, 0.5); + padding-left: 16rpx; +} + +/* 当事人card样式 */ +.party { + display: flex; + align-items: center; + padding: 16rpx 0; +} + +.party-img { + width: 64rpx; + height: 64rpx; + border-radius: 10rpx; + line-height: 64rpx; + text-align: center; + color: #ffffff; + font-size: 24rpx; +} + +.party-img-shen { + background: #05aeae; +} + +.party-img-bei { + background: #ff5500; +} + +.party-content { + flex: 1; + padding-left: 32rpx; + overflow: hidden; +} + +.party-content-title { + display: flex; + align-items: center; + width: 100%; +} + +.party-content-title-name { + padding-right: 16rpx; + overflow: hidden; +} + +.party-content-subTitle { + font-size: 24rpx; + line-height: 40rpx; + color: var(--second-text-color); +} + +/* 文件card样式 */ +.action-file { + padding: 16rpx; + border-radius: var(--border-radius-card-sm); + display: flex; + align-items: center; + margin-bottom: 24rpx; +} + +.action-file-color1 { + background-color: rgba(5, 174, 174, 0.1); +} + +.action-file-color2 { + background-color: rgba(236, 207, 165, 0.4); +} + +.action-file-name { + border-radius: 5px; + font-size: 32rpx; + line-height: 40rpx; + text-align: center; + color: #ffffff; + padding: 8rpx 20rpx; + margin-right: 16rpx; +} + +.action-file-name-color1 { + background-color: #05aeae; +} + +.action-file-name-color2 { + background-color: #552719; +} + +.action-file-content { + font-size: 24rpx; + line-height: 24rpx; +} + +.action-file-content-name { + margin-bottom: 24rpx; + font-weight: 600; +} + +.action-file-content-btn { + border-radius: 4rpx; + padding: 6rpx; + font-size: 22rpx; + line-height: 22rpx; + display: inline-block; +} + +.action-file-content-btn-color1 { + border: 2rpx solid #05aeae; + color: #05aeae; +} + +.action-file-content-btn-color2 { + border: 2rpx solid #552719; + color: #552719; +} + +/* 我的调解 、 我的司法确认 底部弹窗样式 */ +.popup-roomNo { + display: flex; + align-items: center; + padding: 32rpx; +} + +.popup-roomNo-copy { + display: flex; + align-items: center; + padding-left: 16rpx; + margin-left: 16rpx; + color: var(--main-color); + position: relative; +} + +.popup-roomNo-copy::before { + content: ''; + position: absolute; + left: 0; + height: 24rpx; + width: 2rpx; + background-color: var(--text-color); +} + +/* tag标签样式 */ +.tag { + padding: 0 8rpx; + border-radius: 4rpx; + font-size: 24rpx; + line-height: 40rpx; + display: inline-block; +} + +.tag-cyan { + color: #05aeae; + background-color: #d5ede9; +} + +.tag-orange { + color: #ff5500; + background-color: #fff2e6; +} + +.tag-green-border { + font-size: 22rpx; + line-height: 38rpx; + color: #73d13d; + background-color: #ffffff; + border: 1rpx solid #73d13d; +} diff --git a/utils/moment.js b/utils/moment.js new file mode 100644 index 0000000..ab04eb6 --- /dev/null +++ b/utils/moment.js @@ -0,0 +1,4602 @@ +//! moment.js + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + global.moment = factory() +}(this, (function () { 'use strict'; + + var hookCallback; + + function hooks () { + return hookCallback.apply(null, arguments); + } + + // This is done to register the method called with moment() + // without creating circular dependencies. + function setHookCallback (callback) { + hookCallback = callback; + } + + function isArray(input) { + return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; + } + + function isObject(input) { + // IE8 will treat undefined and null as object if it wasn't for + // input != null + return input != null && Object.prototype.toString.call(input) === '[object Object]'; + } + + function isObjectEmpty(obj) { + if (Object.getOwnPropertyNames) { + return (Object.getOwnPropertyNames(obj).length === 0); + } else { + var k; + for (k in obj) { + if (obj.hasOwnProperty(k)) { + return false; + } + } + return true; + } + } + + function isUndefined(input) { + return input === void 0; + } + + function isNumber(input) { + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; + } + + function isDate(input) { + return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; + } + + function map(arr, fn) { + var res = [], i; + for (i = 0; i < arr.length; ++i) { + res.push(fn(arr[i], i)); + } + return res; + } + + function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + } + + function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } + } + + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; + } + + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; + } + + return a; + } + + function createUTC (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); + } + + function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty : false, + unusedTokens : [], + unusedInput : [], + overflow : -2, + charsLeftOver : 0, + nullInput : false, + invalidMonth : null, + invalidFormat : false, + userInvalidated : false, + iso : false, + parsedDateParts : [], + meridiem : null, + rfc2822 : false, + weekdayMismatch : false + }; + } + + function getParsingFlags(m) { + if (m._pf == null) { + m._pf = defaultParsingFlags(); + } + return m._pf; + } + + var some; + if (Array.prototype.some) { + some = Array.prototype.some; + } else { + some = function (fun) { + var t = Object(this); + var len = t.length >>> 0; + + for (var i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } + + return false; + }; + } + + function isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m); + var parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }); + var isNowValid = !isNaN(m._d.getTime()) && + flags.overflow < 0 && + !flags.empty && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.weekdayMismatch && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated && + (!flags.meridiem || (flags.meridiem && parsedParts)); + + if (m._strict) { + isNowValid = isNowValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; + } + + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } + else { + return isNowValid; + } + } + return m._isValid; + } + + function createInvalid (flags) { + var m = createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } + else { + getParsingFlags(m).userInvalidated = true; + } + + return m; + } + + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + var momentProperties = hooks.momentProperties = []; + + function copyConfig(to, from) { + var i, prop, val; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } + + if (momentProperties.length > 0) { + for (i = 0; i < momentProperties.length; i++) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } + + return to; + } + + var updateInProgress = false; + + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } + } + + function isMoment (obj) { + return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); + } + + function absFloor (number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); + } + } + + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; + + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } + + return value; + } + + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ((dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { + diffs++; + } + } + return diffs + lengthDiff; + } + + function warn(msg) { + if (hooks.suppressDeprecationWarnings === false && + (typeof console !== 'undefined') && console.warn) { + console.warn('Deprecation warning: ' + msg); + } + } + + function deprecate(msg, fn) { + var firstTime = true; + + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + if (firstTime) { + var args = []; + var arg; + for (var i = 0; i < arguments.length; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (var key in arguments[0]) { + arg += key + ': ' + arguments[0][key] + ', '; + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); + } + + var deprecations = {}; + + function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } + + hooks.suppressDeprecationWarnings = false; + hooks.deprecationHandler = null; + + function isFunction(input) { + return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; + } + + function set (config) { + var prop, i; + for (i in config) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + this._dayOfMonthOrdinalParseLenient = new RegExp( + (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + + '|' + (/\d{1,2}/).source); + } + + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + for (prop in parentConfig) { + if (hasOwnProp(parentConfig, prop) && + !hasOwnProp(childConfig, prop) && + isObject(parentConfig[prop])) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + return res; + } + + function Locale(config) { + if (config != null) { + this.set(config); + } + } + + var keys; + + if (Object.keys) { + keys = Object.keys; + } else { + keys = function (obj) { + var i, res = []; + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + return res; + }; + } + + var defaultCalendar = { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' + }; + + function calendar (key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; + } + + var defaultLongDateFormat = { + LTS : 'h:mm:ss A', + LT : 'h:mm A', + L : 'MM/DD/YYYY', + LL : 'MMMM D, YYYY', + LLL : 'MMMM D, YYYY h:mm A', + LLLL : 'dddd, MMMM D, YYYY h:mm A' + }; + + function longDateFormat (key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { + return val.slice(1); + }); + + return this._longDateFormat[key]; + } + + var defaultInvalidDate = 'Invalid date'; + + function invalidDate () { + return this._invalidDate; + } + + var defaultOrdinal = '%d'; + var defaultDayOfMonthOrdinalParse = /\d{1,2}/; + + function ordinal (number) { + return this._ordinal.replace('%d', number); + } + + var defaultRelativeTime = { + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + ss : '%d seconds', + m : 'a minute', + mm : '%d minutes', + h : 'an hour', + hh : '%d hours', + d : 'a day', + dd : '%d days', + M : 'a month', + MM : '%d months', + y : 'a year', + yy : '%d years' + }; + + function relativeTime (number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return (isFunction(output)) ? + output(number, withoutSuffix, string, isFuture) : + output.replace(/%d/i, number); + } + + function pastFuture (diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); + } + + var aliases = {}; + + function addUnitAlias (unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; + } + + function normalizeUnits(units) { + return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; + } + + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; + + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } + + return normalizedInput; + } + + var priorities = {}; + + function addUnitPriority(unit, priority) { + priorities[unit] = priority; + } + + function getPrioritizedUnits(unitsObj) { + var units = []; + for (var u in unitsObj) { + units.push({unit: u, priority: priorities[u]}); + } + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; + } + + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; + } + + var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; + + var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; + + var formatFunctions = {}; + + var formatTokenFunctions = {}; + + // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + function addFormatToken (token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal(func.apply(this, arguments), token); + }; + } + } + + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); + } + + function makeFormatFunction(format) { + var array = format.match(formattingTokens), i, length; + + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } + + return function (mom) { + var output = '', i; + for (i = 0; i < length; i++) { + output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; + } + return output; + }; + } + + // format date using native date object + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } + + format = expandFormat(format, m.localeData()); + formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); + + return formatFunctions[format](m); + } + + function expandFormat(format, locale) { + var i = 5; + + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } + + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); + localFormattingTokens.lastIndex = 0; + i -= 1; + } + + return format; + } + + var match1 = /\d/; // 0 - 9 + var match2 = /\d\d/; // 00 - 99 + var match3 = /\d{3}/; // 000 - 999 + var match4 = /\d{4}/; // 0000 - 9999 + var match6 = /[+-]?\d{6}/; // -999999 - 999999 + var match1to2 = /\d\d?/; // 0 - 99 + var match3to4 = /\d\d\d\d?/; // 999 - 9999 + var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 + var match1to3 = /\d{1,3}/; // 0 - 999 + var match1to4 = /\d{1,4}/; // 0 - 9999 + var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 + + var matchUnsigned = /\d+/; // 0 - inf + var matchSigned = /[+-]?\d+/; // -inf - inf + + var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z + var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z + + var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 + + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months + var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; + + var regexes = {}; + + function addRegexToken (token, regex, strictRegex) { + regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { + return (isStrict && strictRegex) ? strictRegex : regex; + }; + } + + function getParseRegexForToken (token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } + + return regexes[token](config._strict, config._locale); + } + + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function unescapeFormat(s) { + return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + })); + } + + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + var tokens = {}; + + function addParseToken (token, callback) { + var i, func = callback; + if (typeof token === 'string') { + token = [token]; + } + if (isNumber(callback)) { + func = function (input, array) { + array[callback] = toInt(input); + }; + } + for (i = 0; i < token.length; i++) { + tokens[token[i]] = func; + } + } + + function addWeekParseToken (token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); + } + + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } + } + + var YEAR = 0; + var MONTH = 1; + var DATE = 2; + var HOUR = 3; + var MINUTE = 4; + var SECOND = 5; + var MILLISECOND = 6; + var WEEK = 7; + var WEEKDAY = 8; + + // FORMATTING + + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? '' + y : '+' + y; + }); + + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); + + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + + // ALIASES + + addUnitAlias('year', 'y'); + + // PRIORITIES + + addUnitPriority('year', 1); + + // PARSING + + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); + + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); + + // HELPERS + + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + } + + // HOOKS + + hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; + + // MOMENTS + + var getSetYear = makeGetSet('FullYear', true); + + function getIsLeapYear () { + return isLeapYear(this.year()); + } + + function makeGetSet (unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; + } + + function get (mom, unit) { + return mom.isValid() ? + mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; + } + + function set$1 (mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); + } + else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } + } + + // MOMENTS + + function stringGet (units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; + } + + + function stringSet (units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units); + for (var i = 0; i < prioritized.length; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; + } + + function mod(n, x) { + return ((n % x) + x) % x; + } + + var indexOf; + + if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; + } else { + indexOf = function (o) { + // I know + var i; + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; + } + } + return -1; + }; + } + + function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { + return NaN; + } + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2); + } + + // FORMATTING + + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); + + // ALIASES + + addUnitAlias('month', 'M'); + + // PRIORITY + + addUnitPriority('month', 8); + + // PARSING + + addRegexToken('M', match1to2); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } + }); + + // LOCALES + + var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; + var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); + function localeMonths (m, format) { + if (!m) { + return isArray(this._months) ? this._months : + this._months['standalone']; + } + return isArray(this._months) ? this._months[m.month()] : + this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; + } + + var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); + function localeMonthsShort (m, format) { + if (!m) { + return isArray(this._monthsShort) ? this._monthsShort : + this._monthsShort['standalone']; + } + return isArray(this._monthsShort) ? this._monthsShort[m.month()] : + this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; + } + + function handleStrictParse(monthName, format, strict) { + var i, ii, mom, llc = monthName.toLocaleLowerCase(); + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeMonthsParse (monthName, format, strict) { + var i, mom, regex; + + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } + + // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); + this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); + } + if (!strict && !this._monthsParse[i]) { + regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { + return i; + } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } + } + + // MOMENTS + + function setMonth (mom, value) { + var dayOfMonth; + + if (!mom.isValid()) { + // No op + return mom; + } + + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (!isNumber(value)) { + return mom; + } + } + } + + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; + } + + function getSetMonth (value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); + } + } + + function getDaysInMonth () { + return daysInMonth(this.year(), this.month()); + } + + var defaultMonthsShortRegex = matchWord; + function monthsShortRegex (isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; + } + return this._monthsShortStrictRegex && isStrict ? + this._monthsShortStrictRegex : this._monthsShortRegex; + } + } + + var defaultMonthsRegex = matchWord; + function monthsRegex (isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; + } + return this._monthsStrictRegex && isStrict ? + this._monthsStrictRegex : this._monthsRegex; + } + } + + function computeMonthsParse () { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], longPieces = [], mixedPieces = [], + i, mom; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + } + for (i = 0; i < 24; i++) { + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); + this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); + } + + function createDate (y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date; + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); + } + + return date; + } + + function createUTCDate (y) { + var date; + // the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + var args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); + } + + return date; + } + + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + + return -fwdlw + fwd - 1; + } + + // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } + + return { + year: resYear, + dayOfYear: resDayOfYear + }; + } + + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } + + return { + week: resWeek, + year: resYear + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } + + // FORMATTING + + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); + + // ALIASES + + addUnitAlias('week', 'w'); + addUnitAlias('isoWeek', 'W'); + + // PRIORITIES + + addUnitPriority('week', 5); + addUnitPriority('isoWeek', 5); + + // PARSING + + addRegexToken('w', match1to2); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2); + addRegexToken('WW', match1to2, match2); + + addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { + week[token.substr(0, 1)] = toInt(input); + }); + + // HELPERS + + // LOCALES + + function localeWeek (mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } + + var defaultLocaleWeek = { + dow : 0, // Sunday is the first day of the week. + doy : 6 // The week that contains Jan 6th is the first week of the year. + }; + + function localeFirstDayOfWeek () { + return this._week.dow; + } + + function localeFirstDayOfYear () { + return this._week.doy; + } + + // MOMENTS + + function getSetWeek (input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + function getSetISOWeek (input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + // FORMATTING + + addFormatToken('d', 0, 'do', 'day'); + + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); + }); + + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); + + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); + + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); + + // ALIASES + + addUnitAlias('day', 'd'); + addUnitAlias('weekday', 'e'); + addUnitAlias('isoWeekday', 'E'); + + // PRIORITY + addUnitPriority('day', 11); + addUnitPriority('weekday', 11); + addUnitPriority('isoWeekday', 11); + + // PARSING + + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); + }); + addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); + }); + addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); + }); + + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); + + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); + }); + + // HELPERS + + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } + + if (!isNaN(input)) { + return parseInt(input, 10); + } + + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } + + return null; + } + + function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + return isNaN(input) ? null : input; + } + + // LOCALES + function shiftWeekdays (ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } + + var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); + function localeWeekdays (m, format) { + var weekdays = isArray(this._weekdays) ? this._weekdays : + this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone']; + return (m === true) ? shiftWeekdays(weekdays, this._week.dow) + : (m) ? weekdays[m.day()] : weekdays; + } + + var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); + function localeWeekdaysShort (m) { + return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; + } + + var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); + function localeWeekdaysMin (m) { + return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; + } + + function handleStrictParse$1(weekdayName, format, strict) { + var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; + + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeWeekdaysParse (weekdayName, format, strict) { + var i, mom, regex; + + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + + mom = createUTC([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); + this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); + this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); + } + if (!this._weekdaysParse[i]) { + regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } + + // MOMENTS + + function getSetDayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } + } + + function getSetLocaleDayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); + } + + function getSetISODayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + + if (input != null) { + var weekday = parseIsoWeekday(input, this.localeData()); + return this.day(this.day() % 7 ? weekday : weekday - 7); + } else { + return this.day() || 7; + } + } + + var defaultWeekdaysRegex = matchWord; + function weekdaysRegex (isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysStrictRegex; + } else { + return this._weekdaysRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysRegex')) { + this._weekdaysRegex = defaultWeekdaysRegex; + } + return this._weekdaysStrictRegex && isStrict ? + this._weekdaysStrictRegex : this._weekdaysRegex; + } + } + + var defaultWeekdaysShortRegex = matchWord; + function weekdaysShortRegex (isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysShortStrictRegex; + } else { + return this._weekdaysShortRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysShortRegex')) { + this._weekdaysShortRegex = defaultWeekdaysShortRegex; + } + return this._weekdaysShortStrictRegex && isStrict ? + this._weekdaysShortStrictRegex : this._weekdaysShortRegex; + } + } + + var defaultWeekdaysMinRegex = matchWord; + function weekdaysMinRegex (isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysMinStrictRegex; + } else { + return this._weekdaysMinRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysMinRegex')) { + this._weekdaysMinRegex = defaultWeekdaysMinRegex; + } + return this._weekdaysMinStrictRegex && isStrict ? + this._weekdaysMinStrictRegex : this._weekdaysMinRegex; + } + } + + + function computeWeekdaysParse () { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], + i, mom, minp, shortp, longp; + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + minp = this.weekdaysMin(mom, ''); + shortp = this.weekdaysShort(mom, ''); + longp = this.weekdays(mom, ''); + minPieces.push(minp); + shortPieces.push(shortp); + longPieces.push(longp); + mixedPieces.push(minp); + mixedPieces.push(shortp); + mixedPieces.push(longp); + } + // Sorting makes sure if one weekday (or abbr) is a prefix of another it + // will match the longer piece. + minPieces.sort(cmpLenRev); + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 7; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._weekdaysShortRegex = this._weekdaysRegex; + this._weekdaysMinRegex = this._weekdaysRegex; + + this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); + this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); + this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); + } + + // FORMATTING + + function hFormat() { + return this.hours() % 12 || 12; + } + + function kFormat() { + return this.hours() || 24; + } + + addFormatToken('H', ['HH', 2], 0, 'hour'); + addFormatToken('h', ['hh', 2], 0, hFormat); + addFormatToken('k', ['kk', 2], 0, kFormat); + + addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); + }); + + addFormatToken('hmmss', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2); + }); + + addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); + }); + + addFormatToken('Hmmss', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2); + }); + + function meridiem (token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); + }); + } + + meridiem('a', true); + meridiem('A', false); + + // ALIASES + + addUnitAlias('hour', 'h'); + + // PRIORITY + addUnitPriority('hour', 13); + + // PARSING + + function matchMeridiem (isStrict, locale) { + return locale._meridiemParse; + } + + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2); + addRegexToken('h', match1to2); + addRegexToken('k', match1to2); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + addRegexToken('kk', match1to2, match2); + + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); + + addParseToken(['H', 'HH'], HOUR); + addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; + }); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); + + // LOCALES + + function localeIsPM (input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return ((input + '').toLowerCase().charAt(0) === 'p'); + } + + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; + function localeMeridiem (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + } + + + // MOMENTS + + // Setting the hour should keep the time, because the user explicitly + // specified which hour they want. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + var getSetHour = makeGetSet('Hours', true); + + var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, + + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, + + week: defaultLocaleWeek, + + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, + + meridiemParse: defaultLocaleMeridiemParse + }; + + // internal storage for locale config files + var locales = {}; + var localeFamilies = {}; + var globalLocale; + + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } + + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, j, next, locale, split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { + //the next array item is better than a shallower substring of this one + break; + } + j--; + } + i++; + } + return globalLocale; + } + + function loadLocale(name) { + var oldLocale = null; + // TODO: Find a better way to register and load all the locales in Node + if (!locales[name] && (typeof module !== 'undefined') && + module && module.exports) { + try { + oldLocale = globalLocale._abbr; + var aliasedRequire = require; + // aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) {} + } + return locales[name]; + } + + // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + function getSetGlobalLocale (key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = getLocale(key); + } + else { + data = defineLocale(key, values); + } + + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } + else { + if ((typeof console !== 'undefined') && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn('Locale ' + key + ' not found. Did you forget to load it?'); + } + } + } + + return globalLocale._abbr; + } + + function defineLocale (name, config) { + if (config !== null) { + var locale, parentConfig = baseConfig; + config.abbr = name; + if (locales[name] != null) { + deprecateSimple('defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale ' + + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + locale = loadLocale(config.parentLocale); + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config + }); + return null; + } + } + } + locales[name] = new Locale(mergeConfigs(parentConfig, config)); + + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); + } + + // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + getSetGlobalLocale(name); + + + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } + } + + function updateLocale(name, config) { + if (config != null) { + var locale, tmpLocale, parentConfig = baseConfig; + // MERGE + tmpLocale = loadLocale(name); + if (tmpLocale != null) { + parentConfig = tmpLocale._config; + } + config = mergeConfigs(parentConfig, config); + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + + // backwards compat for now: also set the locale + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + } else if (locales[name] != null) { + delete locales[name]; + } + } + } + return locales[name]; + } + + // returns locale data + function getLocale (key) { + var locale; + + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } + + if (!key) { + return globalLocale; + } + + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; + } + key = [key]; + } + + return chooseLocale(key); + } + + function listLocales() { + return keys(locales); + } + + function checkOverflow (m) { + var overflow; + var a = m._a; + + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : + a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : + a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : + a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : + a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : + a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : + -1; + + if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } + + getParsingFlags(m).overflow = overflow; + } + + return m; + } + + // Pick the first defined of two or three arguments. + function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; + } + + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; + } + + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function configFromArray (config) { + var i, date, input = [], currentDate, expectedWeekday, yearToUse; + + if (config._d) { + return; + } + + currentDate = currentDateArray(config); + + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } + + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } + + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } + + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; + } + + // Check for 24:00:00.000 + if (config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); + expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); + + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } + + // check for mismatching day of week + if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { + getParsingFlags(config).weekdayMismatch = true; + } + } + + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + + var curWeek = weekOfYear(createLocal(), dow, doy); + + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); + + // Default to current week. + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from beginning of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to beginning of week + weekday = dow; + } + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + } + + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; + var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; + + var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; + + var isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + // YYYYMM is NOT allowed by the standard + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/] + ]; + + // iso time formats and regexes + var isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/] + ]; + + var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; + + // date from iso format + function configFromISO(config) { + var i, l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, dateFormat, timeFormat, tzFormat; + + if (match) { + getParsingFlags(config).iso = true; + + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } + } + + // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; + + function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10) + ]; + + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } + + return result; + } + + function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + } + + function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; + } + + var obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + + function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10); + var m = hm % 100, h = (hm - m) / 100; + return h * 60 + m; + } + } + + // date and time from ref 2822 format + function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)); + if (match) { + var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); + if (!checkWeekday(match[1], parsedArray, config)) { + return; + } + + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; + } + } + + // date from iso format or fallback + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); + + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } + + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + configFromRFC2822(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + // Final attempt, use Input Fallback + hooks.createFromInputFallback(config); + } + + hooks.createFromInputFallback = deprecate( + 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + + 'discouraged and will be removed in an upcoming major release. Please refer to ' + + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + } + ); + + // constant that refers to the ISO standard + hooks.ISO_8601 = function () {}; + + // constant that refers to the RFC 2822 form + hooks.RFC_2822 = function () {}; + + // date from string and format string + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; + } + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; + } + config._a = []; + getParsingFlags(config).empty = true; + + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, parsedInput, tokens, token, skipped, + stringLength = string.length, + totalParsedInputLength = 0; + + tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; + + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; + // console.log('token', token, 'parsedInput', parsedInput, + // 'regex', getParseRegexForToken(token, config)); + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice(string.indexOf(parsedInput) + parsedInput.length); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } + else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } + else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); + } + } + + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } + + // clear _12h flag if hour is <= 12 + if (config._a[HOUR] <= 12 && + getParsingFlags(config).bigHour === true && + config._a[HOUR] > 0) { + getParsingFlags(config).bigHour = undefined; + } + + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; + // handle meridiem + config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); + + configFromArray(config); + checkOverflow(config); + } + + + function meridiemFixWrap (locale, hour, meridiem) { + var isPm; + + if (meridiem == null) { + // nothing to do + return hour; + } + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; + } + if (!isPm && hour === 12) { + hour = 0; + } + return hour; + } else { + // this is not supposed to happen + return hour; + } + } + + // date from string and array of format strings + function configFromStringAndArray(config) { + var tempConfig, + bestMoment, + + scoreToBeat, + i, + currentScore; + + if (config._f.length === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (!isValid(tempConfig)) { + continue; + } + + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; + + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + + getParsingFlags(tempConfig).score = currentScore; + + if (scoreToBeat == null || currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } + + extend(config, bestMoment || tempConfig); + } + + function configFromObject(config) { + if (config._d) { + return; + } + + var i = normalizeObjectUnits(config._i); + config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { + return obj && parseInt(obj, 10); + }); + + configFromArray(config); + } + + function createFromConfig (config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; + } + + function prepareConfig (config) { + var input = config._i, + format = config._f; + + config._locale = config._locale || getLocale(config._l); + + if (input === null || (format === undefined && input === '')) { + return createInvalid({nullInput: true}); + } + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } + + if (!isValid(config)) { + config._d = null; + } + + return config; + } + + function configFromInput(config) { + var input = config._i; + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } + } + + function createLocalOrUTC (input, format, locale, strict, isUTC) { + var c = {}; + + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } + + if ((isObject(input) && isObjectEmpty(input)) || + (isArray(input) && input.length === 0)) { + input = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; + + return createFromConfig(c); + } + + function createLocal (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); + } + + var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } + } + ); + + var prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + } + ); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + return res; + } + + // TODO: Use [].sort instead? + function min () { + var args = [].slice.call(arguments, 0); + + return pickBy('isBefore', args); + } + + function max () { + var args = [].slice.call(arguments, 0); + + return pickBy('isAfter', args); + } + + var now = function () { + return Date.now ? Date.now() : +(new Date()); + }; + + var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; + + function isDurationValid(m) { + for (var key in m) { + if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { + return false; + } + } + + var unitHasDecimal = false; + for (var i = 0; i < ordering.length; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } + } + + return true; + } + + function isValid$1() { + return this._isValid; + } + + function createInvalid$1() { + return createDuration(NaN); + } + + function Duration (duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || normalizedInput.isoWeek || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + + this._isValid = isDurationValid(normalizedInput); + + // representation for dateAddRemove + this._milliseconds = +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + + weeks * 7; + // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + + quarters * 3 + + years * 12; + + this._data = {}; + + this._locale = getLocale(); + + this._bubble(); + } + + function isDuration (obj) { + return obj instanceof Duration; + } + + function absRound (number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } + } + + // FORMATTING + + function offset (token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(); + var sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; + } + return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); + }); + } + + offset('Z', ':'); + offset('ZZ', ''); + + // PARSING + + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); + + // HELPERS + + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + var chunkOffset = /([\+\-]|\d\d)/gi; + + function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher); + + if (matches === null) { + return null; + } + + var chunk = matches[matches.length - 1] || []; + var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + var minutes = +(parts[1] * 60) + toInt(parts[2]); + + return minutes === 0 ? + 0 : + parts[0] === '+' ? minutes : -minutes; + } + + // Return a moment from input, that is local/utc/zone equivalent to model. + function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); + // Use low-level api, because this fn is low-level api. + res._d.setTime(res._d.valueOf() + diff); + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); + } + } + + function getDateOffset (m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset() / 15) * 15; + } + + // HOOKS + + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + hooks.updateOffset = function () {}; + + // MOMENTS + + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + function getSetOffset (input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; + } + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract(this, createDuration(input - offset, 'm'), 1, false); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } + } + + function getSetZone (input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + + return this; + } else { + return -this.utcOffset(); + } + } + + function setOffsetToUTC (keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal (keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } + } + return this; + } + + function setOffsetToParsedOffset () { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + if (tZone != null) { + this.utcOffset(tZone); + } + else { + this.utcOffset(0, true); + } + } + return this; + } + + function hasAlignedHourOffset (input) { + if (!this.isValid()) { + return false; + } + input = input ? createLocal(input).utcOffset() : 0; + + return (this.utcOffset() - input) % 60 === 0; + } + + function isDaylightSavingTime () { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); + } + + function isDaylightSavingTimeShifted () { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } + + var c = {}; + + copyConfig(c, this); + c = prepareConfig(c); + + if (c._a) { + var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = this.isValid() && + compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } + + return this._isDSTShifted; + } + + function isLocal () { + return this.isValid() ? !this._isUTC : false; + } + + function isUtcOffset () { + return this.isValid() ? this._isUTC : false; + } + + function isUtc () { + return this.isValid() ? this._isUTC && this._offset === 0 : false; + } + + // ASP.NET json date format regex + var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; + + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; + + function createDuration (input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms : input._milliseconds, + d : input._days, + M : input._months + }; + } else if (isNumber(input)) { + duration = {}; + if (key) { + duration[key] = input; + } else { + duration.milliseconds = input; + } + } else if (!!(match = aspNetRegex.exec(input))) { + sign = (match[1] === '-') ? -1 : 1; + duration = { + y : 0, + d : toInt(match[DATE]) * sign, + h : toInt(match[HOUR]) * sign, + m : toInt(match[MINUTE]) * sign, + s : toInt(match[SECOND]) * sign, + ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match + }; + } else if (!!(match = isoRegex.exec(input))) { + sign = (match[1] === '-') ? -1 : 1; + duration = { + y : parseIso(match[2], sign), + M : parseIso(match[3], sign), + w : parseIso(match[4], sign), + d : parseIso(match[5], sign), + h : parseIso(match[6], sign), + m : parseIso(match[7], sign), + s : parseIso(match[8], sign) + }; + } else if (duration == null) {// checks for null or undefined + duration = {}; + } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { + diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); + + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + return ret; + } + + createDuration.fn = Duration.prototype; + createDuration.invalid = createInvalid$1; + + function parseIso (inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; + } + + function positiveMomentsDifference(base, other) { + var res = {}; + + res.months = other.month() - base.month() + + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + + res.milliseconds = +other - +(base.clone().add(res.months, 'M')); + + return res; + } + + function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return {milliseconds: 0, months: 0}; + } + + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; + } + + // TODO: remove 'name' arg after deprecation is removed + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); + tmp = val; val = period; period = tmp; + } + + val = typeof val === 'string' ? +val : val; + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; + } + + function addSubtract (mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); + + if (!mom.isValid()) { + // No op + return; + } + + updateOffset = updateOffset == null ? true : updateOffset; + + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); + } + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + } + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + } + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } + } + + var add = createAdder(1, 'add'); + var subtract = createAdder(-1, 'subtract'); + + function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 ? 'sameElse' : + diff < -1 ? 'lastWeek' : + diff < 0 ? 'lastDay' : + diff < 1 ? 'sameDay' : + diff < 2 ? 'nextDay' : + diff < 7 ? 'nextWeek' : 'sameElse'; + } + + function calendar$1 (time, formats) { + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse'; + + var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); + + return this.format(output || this.localeData().calendar(format, this, createLocal(now))); + } + + function clone () { + return new Moment(this); + } + + function isAfter (input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); + } else { + return localInput.valueOf() < this.clone().startOf(units).valueOf(); + } + } + + function isBefore (input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); + } else { + return this.clone().endOf(units).valueOf() < localInput.valueOf(); + } + } + + function isBetween (from, to, units, inclusivity) { + var localFrom = isMoment(from) ? from : createLocal(from), + localTo = isMoment(to) ? to : createLocal(to); + if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { + return false; + } + inclusivity = inclusivity || '()'; + return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && + (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)); + } + + function isSame (input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); + } + } + + function isSameOrAfter (input, units) { + return this.isSame(input, units) || this.isAfter(input, units); + } + + function isSameOrBefore (input, units) { + return this.isSame(input, units) || this.isBefore(input, units); + } + + function diff (input, units, asFloat) { + var that, + zoneDelta, + output; + + if (!this.isValid()) { + return NaN; + } + + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; + } + + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; + + units = normalizeUnits(units); + + switch (units) { + case 'year': output = monthDiff(this, that) / 12; break; + case 'month': output = monthDiff(this, that); break; + case 'quarter': output = monthDiff(this, that) / 3; break; + case 'second': output = (this - that) / 1e3; break; // 1000 + case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 + case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 + case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst + case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: output = this - that; + } + + return asFloat ? output : absFloor(output); + } + + function monthDiff (a, b) { + // difference in months + var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, adjust; + + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); + } + + //check for negative zero, return zero if negative zero + return -(wholeMonthDiff + adjust) || 0; + } + + hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + + function toString () { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + function toISOString(keepOffset) { + if (!this.isValid()) { + return null; + } + var utc = keepOffset !== true; + var m = utc ? this.clone().utc() : this; + if (m.year() < 0 || m.year() > 9999) { + return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); + } + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + if (utc) { + return this.toDate().toISOString(); + } else { + return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z')); + } + } + return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); + } + + /** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ + function inspect () { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; + } + var func = 'moment'; + var zone = ''; + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; + } + var prefix = '[' + func + '("]'; + var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; + var datetime = '-MM-DD[T]HH:mm:ss.SSS'; + var suffix = zone + '[")]'; + + return this.format(prefix + year + datetime + suffix); + } + + function format (inputString) { + if (!inputString) { + inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; + } + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); + } + + function from (time, withoutSuffix) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + createLocal(time).isValid())) { + return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function fromNow (withoutSuffix) { + return this.from(createLocal(), withoutSuffix); + } + + function to (time, withoutSuffix) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + createLocal(time).isValid())) { + return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function toNow (withoutSuffix) { + return this.to(createLocal(), withoutSuffix); + } + + // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + function locale (key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; + } + return this; + } + } + + var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + } + ); + + function localeData () { + return this._locale; + } + + var MS_PER_SECOND = 1000; + var MS_PER_MINUTE = 60 * MS_PER_SECOND; + var MS_PER_HOUR = 60 * MS_PER_MINUTE; + var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return (dividend % divisor + divisor) % divisor; + } + + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } + } + + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } + } + + function startOf (units) { + var time; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year(), 0, 1); + break; + case 'quarter': + time = startOfDate(this.year(), this.month() - this.month() % 3, 1); + break; + case 'month': + time = startOfDate(this.year(), this.month(), 1); + break; + case 'week': + time = startOfDate(this.year(), this.month(), this.date() - this.weekday()); + break; + case 'isoWeek': + time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date()); + break; + case 'hour': + time = this._d.valueOf(); + time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR); + break; + case 'minute': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; + case 'second': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function endOf (units) { + var time; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; + break; + case 'isoWeek': + time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function valueOf () { + return this._d.valueOf() - ((this._offset || 0) * 60000); + } + + function unix () { + return Math.floor(this.valueOf() / 1000); + } + + function toDate () { + return new Date(this.valueOf()); + } + + function toArray () { + var m = this; + return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; + } + + function toObject () { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds() + }; + } + + function toJSON () { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } + + function isValid$2 () { + return isValid(this); + } + + function parsingFlags () { + return extend({}, getParsingFlags(this)); + } + + function invalidAt () { + return getParsingFlags(this).overflow; + } + + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict + }; + } + + // FORMATTING + + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken (token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + + // ALIASES + + addUnitAlias('weekYear', 'gg'); + addUnitAlias('isoWeekYear', 'GG'); + + // PRIORITY + + addUnitPriority('weekYear', 1); + addUnitPriority('isoWeekYear', 1); + + + // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + + addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { + week[token.substr(0, 2)] = toInt(input); + }); + + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); + }); + + // MOMENTS + + function getSetWeekYear (input) { + return getSetWeekYearHelper.call(this, + input, + this.week(), + this.weekday(), + this.localeData()._week.dow, + this.localeData()._week.doy); + } + + function getSetISOWeekYear (input) { + return getSetWeekYearHelper.call(this, + input, this.isoWeek(), this.isoWeekday(), 1, 4); + } + + function getISOWeeksInYear () { + return weeksInYear(this.year(), 1, 4); + } + + function getWeeksInYear () { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } + + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; + } else { + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; + } + return setWeekAll.call(this, input, week, weekday, dow, doy); + } + } + + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; + } + + // FORMATTING + + addFormatToken('Q', 0, 'Qo', 'quarter'); + + // ALIASES + + addUnitAlias('quarter', 'Q'); + + // PRIORITY + + addUnitPriority('quarter', 7); + + // PARSING + + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); + + // MOMENTS + + function getSetQuarter (input) { + return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); + } + + // FORMATTING + + addFormatToken('D', ['DD', 2], 'Do', 'date'); + + // ALIASES + + addUnitAlias('date', 'D'); + + // PRIORITY + addUnitPriority('date', 9); + + // PARSING + + addRegexToken('D', match1to2); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict ? + (locale._dayOfMonthOrdinalParse || locale._ordinalParse) : + locale._dayOfMonthOrdinalParseLenient; + }); + + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0]); + }); + + // MOMENTS + + var getSetDayOfMonth = makeGetSet('Date', true); + + // FORMATTING + + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + + // ALIASES + + addUnitAlias('dayOfYear', 'DDD'); + + // PRIORITY + addUnitPriority('dayOfYear', 4); + + // PARSING + + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); + + // HELPERS + + // MOMENTS + + function getSetDayOfYear (input) { + var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; + return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); + } + + // FORMATTING + + addFormatToken('m', ['mm', 2], 0, 'minute'); + + // ALIASES + + addUnitAlias('minute', 'm'); + + // PRIORITY + + addUnitPriority('minute', 14); + + // PARSING + + addRegexToken('m', match1to2); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); + + // MOMENTS + + var getSetMinute = makeGetSet('Minutes', false); + + // FORMATTING + + addFormatToken('s', ['ss', 2], 0, 'second'); + + // ALIASES + + addUnitAlias('second', 's'); + + // PRIORITY + + addUnitPriority('second', 15); + + // PARSING + + addRegexToken('s', match1to2); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); + + // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); + + // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); + + + // ALIASES + + addUnitAlias('millisecond', 'ms'); + + // PRIORITY + + addUnitPriority('millisecond', 16); + + // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + + var token; + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); + } + + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); + } + + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } + // MOMENTS + + var getSetMillisecond = makeGetSet('Milliseconds', false); + + // FORMATTING + + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); + + // MOMENTS + + function getZoneAbbr () { + return this._isUTC ? 'UTC' : ''; + } + + function getZoneName () { + return this._isUTC ? 'Coordinated Universal Time' : ''; + } + + var proto = Moment.prototype; + + proto.add = add; + proto.calendar = calendar$1; + proto.clone = clone; + proto.diff = diff; + proto.endOf = endOf; + proto.format = format; + proto.from = from; + proto.fromNow = fromNow; + proto.to = to; + proto.toNow = toNow; + proto.get = stringGet; + proto.invalidAt = invalidAt; + proto.isAfter = isAfter; + proto.isBefore = isBefore; + proto.isBetween = isBetween; + proto.isSame = isSame; + proto.isSameOrAfter = isSameOrAfter; + proto.isSameOrBefore = isSameOrBefore; + proto.isValid = isValid$2; + proto.lang = lang; + proto.locale = locale; + proto.localeData = localeData; + proto.max = prototypeMax; + proto.min = prototypeMin; + proto.parsingFlags = parsingFlags; + proto.set = stringSet; + proto.startOf = startOf; + proto.subtract = subtract; + proto.toArray = toArray; + proto.toObject = toObject; + proto.toDate = toDate; + proto.toISOString = toISOString; + proto.inspect = inspect; + proto.toJSON = toJSON; + proto.toString = toString; + proto.unix = unix; + proto.valueOf = valueOf; + proto.creationData = creationData; + proto.year = getSetYear; + proto.isLeapYear = getIsLeapYear; + proto.weekYear = getSetWeekYear; + proto.isoWeekYear = getSetISOWeekYear; + proto.quarter = proto.quarters = getSetQuarter; + proto.month = getSetMonth; + proto.daysInMonth = getDaysInMonth; + proto.week = proto.weeks = getSetWeek; + proto.isoWeek = proto.isoWeeks = getSetISOWeek; + proto.weeksInYear = getWeeksInYear; + proto.isoWeeksInYear = getISOWeeksInYear; + proto.date = getSetDayOfMonth; + proto.day = proto.days = getSetDayOfWeek; + proto.weekday = getSetLocaleDayOfWeek; + proto.isoWeekday = getSetISODayOfWeek; + proto.dayOfYear = getSetDayOfYear; + proto.hour = proto.hours = getSetHour; + proto.minute = proto.minutes = getSetMinute; + proto.second = proto.seconds = getSetSecond; + proto.millisecond = proto.milliseconds = getSetMillisecond; + proto.utcOffset = getSetOffset; + proto.utc = setOffsetToUTC; + proto.local = setOffsetToLocal; + proto.parseZone = setOffsetToParsedOffset; + proto.hasAlignedHourOffset = hasAlignedHourOffset; + proto.isDST = isDaylightSavingTime; + proto.isLocal = isLocal; + proto.isUtcOffset = isUtcOffset; + proto.isUtc = isUtc; + proto.isUTC = isUtc; + proto.zoneAbbr = getZoneAbbr; + proto.zoneName = getZoneName; + proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); + proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); + proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); + proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); + proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); + + function createUnix (input) { + return createLocal(input * 1000); + } + + function createInZone () { + return createLocal.apply(null, arguments).parseZone(); + } + + function preParsePostFormat (string) { + return string; + } + + var proto$1 = Locale.prototype; + + proto$1.calendar = calendar; + proto$1.longDateFormat = longDateFormat; + proto$1.invalidDate = invalidDate; + proto$1.ordinal = ordinal; + proto$1.preparse = preParsePostFormat; + proto$1.postformat = preParsePostFormat; + proto$1.relativeTime = relativeTime; + proto$1.pastFuture = pastFuture; + proto$1.set = set; + + proto$1.months = localeMonths; + proto$1.monthsShort = localeMonthsShort; + proto$1.monthsParse = localeMonthsParse; + proto$1.monthsRegex = monthsRegex; + proto$1.monthsShortRegex = monthsShortRegex; + proto$1.week = localeWeek; + proto$1.firstDayOfYear = localeFirstDayOfYear; + proto$1.firstDayOfWeek = localeFirstDayOfWeek; + + proto$1.weekdays = localeWeekdays; + proto$1.weekdaysMin = localeWeekdaysMin; + proto$1.weekdaysShort = localeWeekdaysShort; + proto$1.weekdaysParse = localeWeekdaysParse; + + proto$1.weekdaysRegex = weekdaysRegex; + proto$1.weekdaysShortRegex = weekdaysShortRegex; + proto$1.weekdaysMinRegex = weekdaysMinRegex; + + proto$1.isPM = localeIsPM; + proto$1.meridiem = localeMeridiem; + + function get$1 (format, index, field, setter) { + var locale = getLocale(); + var utc = createUTC().set(setter, index); + return locale[field](utc, format); + } + + function listMonthsImpl (format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return get$1(format, index, field, 'month'); + } + + var i; + var out = []; + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + return out; + } + + // () + // (5) + // (fmt, 5) + // (fmt) + // (true) + // (true, 5) + // (true, fmt, 5) + // (true, fmt) + function listWeekdaysImpl (localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } else { + format = localeSorted; + index = format; + localeSorted = false; + + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } + + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0; + + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); + } + + var i; + var out = []; + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); + } + return out; + } + + function listMonths (format, index) { + return listMonthsImpl(format, index, 'months'); + } + + function listMonthsShort (format, index) { + return listMonthsImpl(format, index, 'monthsShort'); + } + + function listWeekdays (localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + } + + function listWeekdaysShort (localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); + } + + function listWeekdaysMin (localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); + } + + getSetGlobalLocale('en', { + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal : function (number) { + var b = number % 10, + output = (toInt(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; + } + }); + + // Side effect imports + + hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); + hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); + + var mathAbs = Math.abs; + + function abs () { + var data = this._data; + + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + + return this; + } + + function addSubtract$1 (duration, input, value, direction) { + var other = createDuration(input, value); + + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + + return duration._bubble(); + } + + // supports only 2.0-style add(1, 's') or add(duration) + function add$1 (input, value) { + return addSubtract$1(this, input, value, 1); + } + + // supports only 2.0-style subtract(1, 's') or subtract(duration) + function subtract$1 (input, value) { + return addSubtract$1(this, input, value, -1); + } + + function absCeil (number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble () { + var milliseconds = this._milliseconds; + var days = this._days; + var months = this._months; + var data = this._data; + var seconds, minutes, hours, years, monthsFromDays; + + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if (!((milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0))) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } + + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; + + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + + hours = absFloor(minutes / 60); + data.hours = hours % 24; + + days += absFloor(hours / 24); + + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + data.days = days; + data.months = months; + data.years = years; + + return this; + } + + function daysToMonths (days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return days * 4800 / 146097; + } + + function monthsToDays (months) { + // the reverse of daysToMonths + return months * 146097 / 4800; + } + + function as (units) { + if (!this.isValid()) { + return NaN; + } + var days; + var months; + var milliseconds = this._milliseconds; + + units = normalizeUnits(units); + + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + switch (units) { + case 'month': return months; + case 'quarter': return months / 3; + case 'year': return months / 12; + } + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week' : return days / 7 + milliseconds / 6048e5; + case 'day' : return days + milliseconds / 864e5; + case 'hour' : return days * 24 + milliseconds / 36e5; + case 'minute' : return days * 1440 + milliseconds / 6e4; + case 'second' : return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': return Math.floor(days * 864e5) + milliseconds; + default: throw new Error('Unknown unit ' + units); + } + } + } + + // TODO: Use this.as('ms')? + function valueOf$1 () { + if (!this.isValid()) { + return NaN; + } + return ( + this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6 + ); + } + + function makeAs (alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'); + var asSeconds = makeAs('s'); + var asMinutes = makeAs('m'); + var asHours = makeAs('h'); + var asDays = makeAs('d'); + var asWeeks = makeAs('w'); + var asMonths = makeAs('M'); + var asQuarters = makeAs('Q'); + var asYears = makeAs('y'); + + function clone$1 () { + return createDuration(this); + } + + function get$2 (units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; + } + + function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; + } + + var milliseconds = makeGetter('milliseconds'); + var seconds = makeGetter('seconds'); + var minutes = makeGetter('minutes'); + var hours = makeGetter('hours'); + var days = makeGetter('days'); + var months = makeGetter('months'); + var years = makeGetter('years'); + + function weeks () { + return absFloor(this.days() / 7); + } + + var round = Math.round; + var thresholds = { + ss: 44, // a few seconds to seconds + s : 45, // seconds to minute + m : 45, // minutes to hour + h : 22, // hours to day + d : 26, // days to month + M : 11 // months to year + }; + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime$1 (posNegDuration, withoutSuffix, locale) { + var duration = createDuration(posNegDuration).abs(); + var seconds = round(duration.as('s')); + var minutes = round(duration.as('m')); + var hours = round(duration.as('h')); + var days = round(duration.as('d')); + var months = round(duration.as('M')); + var years = round(duration.as('y')); + + var a = seconds <= thresholds.ss && ['s', seconds] || + seconds < thresholds.s && ['ss', seconds] || + minutes <= 1 && ['m'] || + minutes < thresholds.m && ['mm', minutes] || + hours <= 1 && ['h'] || + hours < thresholds.h && ['hh', hours] || + days <= 1 && ['d'] || + days < thresholds.d && ['dd', days] || + months <= 1 && ['M'] || + months < thresholds.M && ['MM', months] || + years <= 1 && ['y'] || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } + + // This function allows you to set the rounding function for relative time strings + function getSetRelativeTimeRounding (roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + if (typeof(roundingFunction) === 'function') { + round = roundingFunction; + return true; + } + return false; + } + + // This function allows you to set a threshold for relative time strings + function getSetRelativeTimeThreshold (threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + if (threshold === 's') { + thresholds.ss = limit - 1; + } + return true; + } + + function humanize (withSuffix) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var locale = this.localeData(); + var output = relativeTime$1(this, !withSuffix, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var abs$1 = Math.abs; + + function sign(x) { + return ((x > 0) - (x < 0)) || +x; + } + + function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000; + var days = abs$1(this._days); + var months = abs$1(this._months); + var minutes, hours, years; + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + var Y = years; + var M = months; + var D = days; + var h = hours; + var m = minutes; + var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + var total = this.asSeconds(); + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + var totalSign = total < 0 ? '-' : ''; + var ymSign = sign(this._months) !== sign(total) ? '-' : ''; + var daysSign = sign(this._days) !== sign(total) ? '-' : ''; + var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return totalSign + 'P' + + (Y ? ymSign + Y + 'Y' : '') + + (M ? ymSign + M + 'M' : '') + + (D ? daysSign + D + 'D' : '') + + ((h || m || s) ? 'T' : '') + + (h ? hmsSign + h + 'H' : '') + + (m ? hmsSign + m + 'M' : '') + + (s ? hmsSign + s + 'S' : ''); + } + + var proto$2 = Duration.prototype; + + proto$2.isValid = isValid$1; + proto$2.abs = abs; + proto$2.add = add$1; + proto$2.subtract = subtract$1; + proto$2.as = as; + proto$2.asMilliseconds = asMilliseconds; + proto$2.asSeconds = asSeconds; + proto$2.asMinutes = asMinutes; + proto$2.asHours = asHours; + proto$2.asDays = asDays; + proto$2.asWeeks = asWeeks; + proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; + proto$2.asYears = asYears; + proto$2.valueOf = valueOf$1; + proto$2._bubble = bubble; + proto$2.clone = clone$1; + proto$2.get = get$2; + proto$2.milliseconds = milliseconds; + proto$2.seconds = seconds; + proto$2.minutes = minutes; + proto$2.hours = hours; + proto$2.days = days; + proto$2.weeks = weeks; + proto$2.months = months; + proto$2.years = years; + proto$2.humanize = humanize; + proto$2.toISOString = toISOString$1; + proto$2.toString = toISOString$1; + proto$2.toJSON = toISOString$1; + proto$2.locale = locale; + proto$2.localeData = localeData; + + proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); + proto$2.lang = lang; + + // Side effect imports + + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); + + // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input, 10) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); + + // Side effect imports + + + hooks.version = '2.24.0'; + + setHookCallback(createLocal); + + hooks.fn = proto; + hooks.min = min; + hooks.max = max; + hooks.now = now; + hooks.utc = createUTC; + hooks.unix = createUnix; + hooks.months = listMonths; + hooks.isDate = isDate; + hooks.locale = getSetGlobalLocale; + hooks.invalid = createInvalid; + hooks.duration = createDuration; + hooks.isMoment = isMoment; + hooks.weekdays = listWeekdays; + hooks.parseZone = createInZone; + hooks.localeData = getLocale; + hooks.isDuration = isDuration; + hooks.monthsShort = listMonthsShort; + hooks.weekdaysMin = listWeekdaysMin; + hooks.defineLocale = defineLocale; + hooks.updateLocale = updateLocale; + hooks.locales = listLocales; + hooks.weekdaysShort = listWeekdaysShort; + hooks.normalizeUnits = normalizeUnits; + hooks.relativeTimeRounding = getSetRelativeTimeRounding; + hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; + hooks.calendarFormat = getCalendarFormat; + hooks.prototype = proto; + + // currently HTML5 input type only supports 24-hour formats + hooks.HTML5_FMT = { + DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" /> + DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" /> + DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" /> + DATE: 'YYYY-MM-DD', // <input type="date" /> + TIME: 'HH:mm', // <input type="time" /> + TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" /> + TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" /> + WEEK: 'GGGG-[W]WW', // <input type="week" /> + MONTH: 'YYYY-MM' // <input type="month" /> + }; + + return hooks; + +}))); \ No newline at end of file diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..dd99247 --- /dev/null +++ b/utils/util.js @@ -0,0 +1,500 @@ +const moment = require('./moment'); +const api = require('../api/api'); + +// 是否是开发环境 +const isDebug = true; + +// url +const url = isDebug ? api.testUrl : api.url; +const mainUrl = url; +const baseUrl = url.web; + +//版本号 +const version = '1.0.0'; + +// 当前用户省id, 默认广东19,海南23 +const province = ['19']; + +// request +const request = ({ + url, + type, + submitData, + service, + v1, + ai, + noToken +}) => { + const app = getApp(); + + let token = app.globalData.token; + if (!token && !noToken) { + if (!app.globalData.access_token) { + showModal({ + title: '提示信息', + content: '抱歉!登录状态已失效,请重新登录', + confirmText: '重新登录', + showCancel: false, + success: (res) => { + if (res.confirm) { + loginOutClearData(); + wx.navigateTo({ + url: '../../pages/login/index', + }); + } + }, + }); + return false; + } + } + + let visitUrl = `${baseUrl}${mainUrl[service] || ''}/api/${v1 ? 'v1' :ai ? 'ai' : 'wechat'}/${url}`; + + return new Promise((resolve, reject) => { + wx.request({ + url: visitUrl, + data: submitData, + method: type, + header: { + Authorization: token, + }, + success: (res) => { + if (res.errMsg === 'request:ok') { + const { + statusCode + } = res; + if (statusCode >= 400) { + errorModal({ + content: '抱歉!请求失败,稍后重试' + }); + resolve({ + type: false + }); + return false; + } + const { + code, + data, + msg + } = res.data; + let obj = {}; + if (code === '0' || code === 0) { + obj = { + type: true, + data, + msg + }; + } else if (code === 401 || code === '401') { + if (app.globalData.access_token !== 1) { + errorModal({ + title: '提示信息', + content: '抱歉!登录状态已失效,请重新登录', + confirmText: '重新登录', + success: () => { + loginOutClearData(); + wx.navigateTo({ + url: '../../pages/login/index' + }); + }, + }); + + } + obj = { + type: false + }; + } else { + errorModal({ + content: msg + }); + obj = { + type: false + }; + } + resolve(obj); + } else { + errorModal({ + content: '抱歉!请求失败,稍后重试' + }); + resolve({ + type: false + }); + } + }, + fail: () => { + errorModal({ + content: '抱歉!服务器出现错误,稍后重试' + }); + resolve({ + type: false + }); + }, + }); + }); +}; + +// +const commonRequest = ({ + url, + submitData, + type +}) => { + return new Promise((resolve, reject) => { + wx.request({ + url: url, + data: submitData, + method: type, + header: { + 'content-type': 'application/json; charset=utf-8', // 默认值 + }, + scriptCharset: 'utf-8', + success: (res) => { + const { + statusCode, + errMsg, + data + } = res; + if (statusCode >= 400) { + errorModal({ + content: '抱歉!请求错误,稍后重试' + }); + resolve(false); + return false; + } + if (errMsg === 'request:ok') { + resolve(data); + } else { + resolve(false); + } + }, + fail: () => { + resolve(false); + }, + }); + }); +}; + +// 消息提示框 +const showToast = ({ + title, + icon = 'none', + mask = true, + duration = 2000, + success +}) => { + return wx.showToast({ + title: title, + icon: icon, + mask: mask, + duration: duration, + success: (res) => { + success && success(res); + }, + }); +}; + +// 超出文字使用省略号 +const ellipsis = ({ + value, + len +}) => { + if (!value) return ''; + + if (value.length > len) { + return value.slice(0, len) + '...'; + } + return value; +}; + +//api错误modal框消息提示 +let errorNum = false; //控制报错信息不会重复弹出 +const errorModal = ({ + title, + content, + confirmText, + success, + className +}) => { + if (errorNum) { + return false; + } + errorNum = true; + return wx.showModal({ + title: title || '错误提示', + content: content, + className: className, + showCancel: false, + confirmColor: '#1A6FB8', + confirmText: confirmText || '知道了', + success: (res) => { + if (res.confirm) { + errorNum = false; + success && success(res); + } + }, + }); +}; + +//modal提示操作 +const showModal = ({ + title = '温馨提示', + content, + showCancel = true, + cancelText = '取消', + confirmText = '确定', + success +}) => { + return wx.showModal({ + content: content, + showCancel: showCancel, + confirmColor: '#1A6FB8', + title: title, + cancelText: cancelText, + confirmText: confirmText, + success: (res) => { + success && success(res); + }, + }); +}; + +//loading +let loadingVisible = 0; +const showLoading = (title = '加载中...', mask = true) => { + if (loadingVisible) { + loadingVisible = loadingVisible + 1; + return; + } + loadingVisible = 1; + return wx.showLoading({ + title: title, + mask: mask, + }); +}; + +const hideLoading = () => { + loadingVisible = loadingVisible - 1; + if (loadingVisible) return; + return wx.hideLoading(); +}; + +// 时间格式化 +const timeFormat = (time, type) => { + let formatType = type ? type : 'YYYY-MM-DD HH:mm'; + return time ? moment(time).format(formatType) : ''; +}; + +// 计算消息时间距离当前时间 +const getMsgTime = (endTime, startTime = new Date()) => { + let end = moment(endTime), + start = moment(startTime), + minDiff = end.diff(start, 'minute'); + if (minDiff < 60) { + return `${minDiff}分钟`; + } + let hoursDiff = minDiff / 60; + if (hoursDiff < 24) { + return `${hoursDiff}小时`; + } + let dayDiff = hoursDiff / 24; + return `${dayDiff}天`; +}; + +// 退出登录清除数据 +const loginOutClearData = () => { + const app = getApp(); + app.globalData.token = ''; + wx.removeStorage({ + key: 'userInfo' + }); +}; + +// 手机号码正则 +const mobileRegExp = (value) => { + return /^1(3[0-9]|5[0-3,5-9]|7[1-3,5-8]|8[0-9]|9[0-9])\d{8}$/g.test(value); +}; + +// 睡眠 +const sleep = (timeout = 500) => { + return new Promise((resolve) => setTimeout(resolve, timeout)); +}; + +// 获取唯一的key +const getBusinessId = () => { + let four = `${parseInt(Math.random() * 10)}${parseInt(Math.random() * 10)}${parseInt(Math.random() * 10)}${parseInt(Math.random() * 10)}`; + let result = `${moment().format('YYYYMMDDHHmmss')}${four}`; + return result; +}; + +// 省市区选择 +const changeLocation = (e, location, selectData) => { + const { + value, + index + } = e.detail.detail; + let value_id = value[index].value; + let faterArr = location; + for (let i = 0; i < index; i++) { + faterArr = faterArr[selectData[i].defaultIndex].children || []; + } + faterForEach: for (let i = 0; i <= faterArr.length - 1; i++) { + if (faterArr[i].value === value_id) { + selectData[index].defaultIndex = i; + let arr = faterArr[i]; + for (let y = index + 1; y < value.length; y++) { + selectData[y].values = JSON.parse(JSON.stringify(arr.children)) || []; + selectData[y].defaultIndex = 0; + // 当children不存在时赋值 + if (arr.children) { + arr = arr.children[0]; + } + selectData[y].values.forEach((x) => { + delete x.children; + }); + } + break faterForEach; + } + } + return selectData; +}; + +// 计算默认的省市区下标 +const getLocationIndex = (data, currentData) => { + let selectOption = JSON.parse(JSON.stringify(data)); + let submitData = currentData; + let arr = [0, 0, 0]; + if (submitData.city) { + forEach: for (let i = 0; i < selectOption.length; i++) { + if (selectOption[i].value === submitData.city) { + arr[0] = i; + break forEach; + } + } + } + if (submitData.area) { + forEach: for (let i = 0; i < selectOption[arr[0]].children.length; i++) { + if (selectOption[arr[0]].children[i].value === submitData.area) { + arr[1] = i; + break forEach; + } + } + } + if (submitData.road) { + forEach: for (let i = 0; i < selectOption[arr[0]].children[arr[1]].children.length; i++) { + if (selectOption[arr[0]].children[arr[1]].children[i].value === submitData.road) { + arr[2] = i; + break forEach; + } + } + } + return arr; +}; + +// 判断附件打开形式 +const openFiles = (type, url, urls) => { + let visible = false; + if (type === '22_00017-3') { + wx.previewImage({ + current: url, + urls: urls, + }); + visible = true; + } else if (['22_00017-4', '22_00017-5', '22_00017-6', '22_00017-9'].includes(type)) { + showLoading(); + wx.downloadFile({ + url: url, + success: function (res) { + const filePath = res.tempFilePath; + wx.openDocument({ + filePath: filePath, + complete: () => { + hideLoading(); + }, + }); + }, + }); + visible = true; + } else { + showToast({ + title: '抱歉!您所点击的附件暂不支持查看' + }); + visible = false; + } + return visible; +}; + +// 校验登录'login' and 实名'realName' and 'all' +const userTest = (type, direction) => { + const app = getApp(); + if (!app.globalData.token && (type === 'login' || type === 'all')) { + showModal({ + content: '抱歉您未登录,是否前往登录?', + success: (res) => { + if (res.confirm) { + // wx.navigateTo({ + // url: '../../pages/login/index', + // }); + } + }, + }); + return false; + } + let realStatus = wx.getStorageSync('userInfo')?.realStatus; + if (realStatus !== 1 && (type === 'realName' || type === 'all')) { + if (direction !== 'bottom') { + showModal({ + content: '检测到您未进行实名认证,该操作需先进行实名认证,是否前往认证?', + success: (res) => { + if (res.confirm) { + wx.navigateTo({ + url: '../../pages/realNameAuthentication/index', + }); + } + }, + }); + } + return false; + } + return true; +}; + +// 地址栏截取 +function getQueryString(href, name) { + let result = href.match(new RegExp('[?&]' + name + '=([^&]+)', 'i')); + if (!result || result.length < 1) { + return null; + } + return decodeURI(result[1]); +} + +// 清除字符串中的空格,用于判断是否为空 +function verifyEmpty(value) { + return value?.replace(/\s+/g, ''); +} + +module.exports = { + moment, + url, + request, + commonRequest, + isDebug, + baseUrl, + version, + province, + showToast, + errorModal, + showModal, + ellipsis, + showLoading, + hideLoading, + timeFormat, + getMsgTime, + loginOutClearData, + mobileRegExp, + sleep, + getBusinessId, + changeLocation, + getLocationIndex, + openFiles, + userTest, + getQueryString, + verifyEmpty, +}; \ No newline at end of file diff --git a/utils/wxs/util.wxs b/utils/wxs/util.wxs new file mode 100644 index 0000000..34b4acc --- /dev/null +++ b/utils/wxs/util.wxs @@ -0,0 +1,55 @@ +// 组合省市区街道展示 +function showLocation(value) { + var villageName = value.villageName ? '/' + value.villageName : ''; + // return value.provName + '/' + value.cityName + '/' + value.areaName + '/' + value.roadName + villageName; + return value.cityName + '/' + value.areaName + '/' + value.roadName + villageName; +} +// 判断文件类型 +function fileType(value) { + var obj = { + '22_00017-0': '未分类', + '22_00017-1': '音频', + '22_00017-2': '视频', + '22_00017-3': '图片', + '22_00017-4': 'Word文档', + '22_00017-5': 'Excel文档', + '22_00017-6': 'PDF文件', + '22_00017-7': 'txt文本', + '22_00017-8': '压缩文件', + '22_00017-9': 'PPT文件', + '22_00017-99': '其它文件', + }; + return obj[value]; +} +// 字符串转变数组 +function strArr(value) { + if (!value) { + return ['无']; + } + var arr = value.split(','); + return arr; +} + +function highlightText(name, keyword) { + +} + + +// 搜索后头部的高亮显示 +function searchTitle(strTitle, searchValue) { + if (!searchValue) { + return ['', strTitle, '']; + } else { + let index = searchValue ? strTitle.indexOf(searchValue) : -2; + let beforeStr = searchValue ? strTitle.substring(0, index) : ''; + let afterStr = index > -1 ? strTitle.slice(index + searchValue.length) : -1; + return [beforeStr, searchValue, afterStr]; + } +} + +module.exports = { + showLocation: showLocation, + fileType: fileType, + strArr: strArr, + searchTitle: searchTitle +}; \ No newline at end of file -- Gitblit v1.8.0