@cloudbase/weda-ui 2.0.28 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset-manifest.json +17 -0
- package/dist/configs/actions/showModal.json +48 -0
- package/dist/configs/actions/showToast.json +41 -0
- package/dist/configs/components/auth.json +16 -0
- package/dist/configs/components/button.json +239 -0
- package/dist/configs/components/calendar.json +81 -0
- package/dist/configs/components/carousel.json +292 -0
- package/dist/configs/components/chart/bar.json +721 -0
- package/dist/configs/components/chart/line.json +674 -0
- package/dist/configs/components/chart/pie.json +494 -0
- package/dist/configs/components/chart/statisticsCard.json +376 -0
- package/dist/configs/components/container.json +50 -0
- package/dist/configs/components/dataView.json +239 -0
- package/dist/configs/components/drawer.json +115 -0
- package/dist/configs/components/form/checkbox.json +178 -0
- package/dist/configs/components/form/form.json +45 -0
- package/dist/configs/components/form/input.json +154 -0
- package/dist/configs/components/form/location.json +216 -0
- package/dist/configs/components/form/radio.json +203 -0
- package/dist/configs/components/form/richText.json +125 -0
- package/dist/configs/components/form/select.json +430 -0
- package/dist/configs/components/form/switch.json +58 -0
- package/dist/configs/components/form/textarea.json +116 -0
- package/dist/configs/components/form/tips.json +34 -0
- package/dist/configs/components/form/uploader.json +171 -0
- package/dist/configs/components/form/uploaderFile.json +158 -0
- package/dist/configs/components/graphicCard.json +413 -0
- package/dist/configs/components/image.json +187 -0
- package/dist/configs/components/link.json +79 -0
- package/dist/configs/components/listView.json +370 -0
- package/dist/configs/components/lottery.json +163 -0
- package/dist/configs/components/modal.json +72 -0
- package/dist/configs/components/navLayout.json +368 -0
- package/dist/configs/components/navigationBar.json +62 -0
- package/dist/configs/components/richtextview.json +26 -0
- package/dist/configs/components/scrollVeiw.json +253 -0
- package/dist/configs/components/slot.json +17 -0
- package/dist/configs/components/swiper.json +90 -0
- package/dist/configs/components/tabs.json +121 -0
- package/dist/configs/components/text.json +95 -0
- package/dist/configs/components/wedaVideo.json +89 -0
- package/dist/configs/components/wxOpenApi/phone.json +127 -0
- package/dist/configs/components/wxOpenApi/phoneCode.json +109 -0
- package/dist/configs/components/wxOpenApi/share.json +157 -0
- package/dist/configs/components/wxOpenApi/userInfo.json +156 -0
- package/dist/configs/index.d.ts +97 -0
- package/{src → dist}/configs/index.js +51 -57
- package/dist/docs/common/format.d.ts +13 -0
- package/dist/docs/common/format.js +103 -0
- package/dist/docs/common/tableView.d.ts +30 -0
- package/dist/docs/common/tableView.js +159 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.html +88 -0
- package/{src → dist}/index.js +0 -1
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +14 -0
- package/dist/static/js/bundle.js +963 -0
- package/dist/static/js/bundle.js.map +1 -0
- package/dist/static/js/main.chunk.js +8841 -0
- package/dist/static/js/main.chunk.js.map +1 -0
- package/dist/static/js/vendors~main.chunk.js +247885 -0
- package/dist/static/js/vendors~main.chunk.js.map +1 -0
- package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +627 -0
- package/dist/web/actions/index.d.ts +2 -0
- package/{src → dist}/web/actions/index.js +0 -0
- package/dist/web/actions/showModal/index.d.ts +3 -0
- package/dist/web/actions/showModal/index.js +66 -0
- package/dist/web/actions/showToast/index.d.ts +1 -0
- package/dist/web/actions/showToast/index.js +3 -0
- package/dist/web/components/auth/index.d.ts +10 -0
- package/dist/web/components/auth/index.js +37 -0
- package/{src → dist}/web/components/button/index.css +2 -2
- package/dist/web/components/button/index.d.ts +32 -0
- package/dist/web/components/button/index.js +48 -0
- package/{src → dist}/web/components/calendar/index.css +29 -29
- package/dist/web/components/calendar/index.d.ts +19 -0
- package/dist/web/components/calendar/index.js +181 -0
- package/dist/web/components/calendar/util.d.ts +13 -0
- package/dist/web/components/calendar/util.js +74 -0
- package/{src → dist}/web/components/carousel/index.css +11 -11
- package/dist/web/components/carousel/index.d.ts +41 -0
- package/dist/web/components/carousel/index.js +240 -0
- package/dist/web/components/chart/bar/index.d.ts +41 -0
- package/dist/web/components/chart/bar/index.js +56 -0
- package/dist/web/components/chart/common/config/bar.d.ts +48 -0
- package/dist/web/components/chart/common/config/bar.js +49 -0
- package/dist/web/components/chart/common/config/global.d.ts +13 -0
- package/dist/web/components/chart/common/config/global.js +16 -0
- package/dist/web/components/chart/common/config/line.d.ts +46 -0
- package/dist/web/components/chart/common/config/line.js +49 -0
- package/dist/web/components/chart/common/config/pie.d.ts +29 -0
- package/dist/web/components/chart/common/config/pie.js +36 -0
- package/dist/web/components/chart/common/core/eChartBar.d.ts +68 -0
- package/dist/web/components/chart/common/core/eChartBar.js +196 -0
- package/dist/web/components/chart/common/core/eChartBase.d.ts +128 -0
- package/dist/web/components/chart/common/core/eChartBase.js +346 -0
- package/dist/web/components/chart/common/core/eChartLine.d.ts +62 -0
- package/dist/web/components/chart/common/core/eChartLine.js +168 -0
- package/dist/web/components/chart/common/core/eChartPie.d.ts +50 -0
- package/dist/web/components/chart/common/core/eChartPie.js +132 -0
- package/dist/web/components/chart/common/core/type.d.ts +35 -0
- package/dist/web/components/chart/common/core/type.js +9 -0
- package/dist/web/components/chart/common/echarts.d.ts +2 -0
- package/{src/web/components/chart/common/echarts.ts → dist/web/components/chart/common/echarts.js} +12 -19
- package/dist/web/components/chart/common/useChart.d.ts +8 -0
- package/dist/web/components/chart/common/useChart.js +60 -0
- package/dist/web/components/chart/line/index.d.ts +39 -0
- package/dist/web/components/chart/line/index.js +53 -0
- package/dist/web/components/chart/pie/index.d.ts +27 -0
- package/dist/web/components/chart/pie/index.js +40 -0
- package/{src → dist}/web/components/chart/statisticsCard/index.css +12 -12
- package/dist/web/components/chart/statisticsCard/index.d.ts +85 -0
- package/dist/web/components/chart/statisticsCard/index.js +203 -0
- package/dist/web/components/chart/statisticsCard/interface.d.ts +13 -0
- package/dist/web/components/chart/statisticsCard/interface.js +1 -0
- package/dist/web/components/container/index.d.ts +6 -0
- package/dist/web/components/container/index.js +6 -0
- package/dist/web/components/dataView/index.d.ts +6 -0
- package/dist/web/components/dataView/index.js +8 -0
- package/{src/web/components/dataView/interface.ts → dist/web/components/dataView/interface.d.ts} +1 -2
- package/dist/web/components/dataView/interface.js +1 -0
- package/dist/web/components/drawer/index.d.ts +13 -0
- package/dist/web/components/drawer/index.js +12 -0
- package/dist/web/components/form/checkbox/index.d.ts +13 -0
- package/dist/web/components/form/checkbox/index.js +167 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.js +52 -0
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
- package/dist/web/components/form/enumSelect/NormalSelect.js +52 -0
- package/dist/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
- package/dist/web/components/form/enumSelect/SelectContainer.js +30 -0
- package/dist/web/components/form/enumSelect/index.d.ts +82 -0
- package/{src/web/components/form/enumSelect/index.jsx → dist/web/components/form/enumSelect/index.js} +1 -4
- package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
- package/dist/web/components/form/enumSelect/props/defaultProps.js +40 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.js +47 -0
- package/{src → dist}/web/components/form/form/index.css +2 -2
- package/dist/web/components/form/form/index.d.ts +13 -0
- package/dist/web/components/form/form/index.js +31 -0
- package/{src → dist}/web/components/form/formcell/index.css +14 -14
- package/dist/web/components/form/formcell/index.d.ts +8 -0
- package/dist/web/components/form/formcell/index.js +40 -0
- package/{src → dist}/web/components/form/input/index.css +3 -3
- package/dist/web/components/form/input/index.d.ts +14 -0
- package/dist/web/components/form/input/index.js +86 -0
- package/dist/web/components/form/location/common/mapChoose.css +477 -0
- package/dist/web/components/form/location/common/mapChoose.d.ts +15 -0
- package/dist/web/components/form/location/common/mapChoose.js +435 -0
- package/dist/web/components/form/location/common/mapView.d.ts +19 -0
- package/dist/web/components/form/location/common/mapView.js +170 -0
- package/dist/web/components/form/location/common/propsConfig.d.ts +59 -0
- package/dist/web/components/form/location/common/propsConfig.js +50 -0
- package/{src → dist}/web/components/form/location/common/selectModal.css +11 -10
- package/dist/web/components/form/location/common/selectModal.d.ts +21 -0
- package/dist/web/components/form/location/common/selectModal.js +44 -0
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +36 -0
- package/dist/web/components/form/location/common/useLocationInfo.js +104 -0
- package/dist/web/components/form/location/components/LocationH5/index.css +100 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +323 -0
- package/dist/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
- package/dist/web/components/form/location/components/LocationPC/Header.js +43 -0
- package/{src → dist}/web/components/form/location/components/LocationPC/index.css +10 -14
- package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +224 -0
- package/dist/web/components/form/location/constants.d.ts +2 -0
- package/{src → dist}/web/components/form/location/constants.js +0 -1
- package/dist/web/components/form/location/index.css +13 -0
- package/dist/web/components/form/location/index.d.ts +1 -0
- package/dist/web/components/form/location/index.js +17 -0
- package/{src → dist}/web/components/form/radio/index.css +0 -0
- package/dist/web/components/form/radio/index.d.ts +11 -0
- package/dist/web/components/form/radio/index.js +115 -0
- package/dist/web/components/form/renderDecorator.d.ts +6 -0
- package/dist/web/components/form/renderDecorator.js +20 -0
- package/dist/web/components/form/select/h5.d.ts +16 -0
- package/dist/web/components/form/select/h5.js +504 -0
- package/{src → dist}/web/components/form/select/index.css +4 -4
- package/dist/web/components/form/select/index.d.ts +65 -0
- package/dist/web/components/form/select/index.js +301 -0
- package/dist/web/components/form/select/region/index.d.ts +6 -0
- package/dist/web/components/form/select/region/index.js +147 -0
- package/dist/web/components/form/select/time.d.ts +9 -0
- package/dist/web/components/form/select/time.js +146 -0
- package/dist/web/components/form/select/year.d.ts +7 -0
- package/dist/web/components/form/select/year.js +72 -0
- package/dist/web/components/form/switch/index.d.ts +6 -0
- package/dist/web/components/form/switch/index.js +57 -0
- package/{src → dist}/web/components/form/textarea/index.css +1 -1
- package/dist/web/components/form/textarea/index.d.ts +12 -0
- package/dist/web/components/form/textarea/index.js +66 -0
- package/{src → dist}/web/components/form/tips/index.css +0 -0
- package/dist/web/components/form/tips/index.d.ts +8 -0
- package/dist/web/components/form/tips/index.js +17 -0
- package/{src → dist}/web/components/form/uploader/index.css +14 -14
- package/dist/web/components/form/uploader/index.d.ts +3 -0
- package/dist/web/components/form/uploader/index.js +42 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +19 -0
- package/dist/web/components/form/uploader/uploader.h5.js +201 -0
- package/dist/web/components/form/uploader/uploader.pc.d.ts +29 -0
- package/dist/web/components/form/uploader/uploader.pc.js +182 -0
- package/{src → dist}/web/components/form/uploaderFile/index.css +62 -62
- package/dist/web/components/form/uploaderFile/index.d.ts +4 -0
- package/dist/web/components/form/uploaderFile/index.js +19 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +315 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +290 -0
- package/{src → dist}/web/components/graphicCard/index.css +15 -15
- package/dist/web/components/graphicCard/index.d.ts +31 -0
- package/dist/web/components/graphicCard/index.js +166 -0
- package/dist/web/components/image/image.d.ts +9 -0
- package/dist/web/components/image/image.js +119 -0
- package/{src → dist}/web/components/image/index.css +2 -2
- package/dist/web/components/image/index.d.ts +13 -0
- package/dist/web/components/image/index.js +91 -0
- package/dist/web/components/index.d.ts +47 -0
- package/{src → dist}/web/components/index.js +25 -26
- package/{src → dist}/web/components/link/index.css +0 -0
- package/dist/web/components/link/index.d.ts +24 -0
- package/dist/web/components/link/index.js +71 -0
- package/{src → dist}/web/components/listView/index.css +17 -17
- package/dist/web/components/listView/index.d.ts +7 -0
- package/dist/web/components/listView/index.js +262 -0
- package/dist/web/components/listView/interface.d.ts +122 -0
- package/dist/web/components/listView/interface.js +1 -0
- package/{src → dist}/web/components/lottery/index.css +98 -72
- package/dist/web/components/lottery/index.d.ts +22 -0
- package/dist/web/components/lottery/index.js +390 -0
- package/dist/web/components/lottery/lotteryUtil.d.ts +23 -0
- package/dist/web/components/lottery/lotteryUtil.js +180 -0
- package/dist/web/components/modal/h5.css +53 -0
- package/dist/web/components/modal/index.d.ts +17 -0
- package/dist/web/components/modal/index.js +11 -0
- package/dist/web/components/modal/modal.h5.d.ts +4 -0
- package/dist/web/components/modal/modal.h5.js +46 -0
- package/dist/web/components/modal/modal.pc.d.ts +3 -0
- package/dist/web/components/modal/modal.pc.js +31 -0
- package/{src → dist}/web/components/navLayout/index.css +15 -15
- package/dist/web/components/navLayout/index.d.ts +46 -0
- package/dist/web/components/navLayout/index.js +116 -0
- package/dist/web/components/navigationBar/common.d.ts +15 -0
- package/dist/web/components/navigationBar/common.js +127 -0
- package/dist/web/components/navigationBar/h5Menu.d.ts +14 -0
- package/dist/web/components/navigationBar/h5Menu.js +72 -0
- package/dist/web/components/navigationBar/horizontalMenu.d.ts +12 -0
- package/dist/web/components/navigationBar/horizontalMenu.js +99 -0
- package/{src → dist}/web/components/navigationBar/index.css +66 -66
- package/dist/web/components/navigationBar/index.d.ts +13 -0
- package/dist/web/components/navigationBar/index.js +157 -0
- package/dist/web/components/navigationBar/verticalMenu.d.ts +13 -0
- package/dist/web/components/navigationBar/verticalMenu.js +38 -0
- package/dist/web/components/phone/index.d.ts +18 -0
- package/dist/web/components/phone/index.js +4 -0
- package/dist/web/components/phoneCode/index.d.ts +18 -0
- package/dist/web/components/phoneCode/index.js +4 -0
- package/dist/web/components/picker/datePicker.d.ts +10 -0
- package/dist/web/components/picker/datePicker.js +31 -0
- package/dist/web/components/picker/picker.d.ts +6 -0
- package/dist/web/components/picker/picker.js +45 -0
- package/dist/web/components/picker/timePicker.d.ts +7 -0
- package/dist/web/components/picker/timePicker.js +42 -0
- package/dist/web/components/richText/const.d.ts +1 -0
- package/dist/web/components/richText/const.js +2 -0
- package/{src → dist}/web/components/richText/index.css +3 -3
- package/dist/web/components/richText/index.d.ts +51 -0
- package/dist/web/components/richText/index.js +298 -0
- package/{src → dist}/web/components/richTextView/index.css +8 -8
- package/dist/web/components/richTextView/index.d.ts +7 -0
- package/dist/web/components/richTextView/index.js +44 -0
- package/dist/web/components/scrollView/index.d.ts +27 -0
- package/dist/web/components/scrollView/index.js +95 -0
- package/dist/web/components/share/index.d.ts +34 -0
- package/dist/web/components/share/index.js +4 -0
- package/dist/web/components/slot/index.d.ts +6 -0
- package/dist/web/components/slot/index.js +9 -0
- package/{src → dist}/web/components/swiper/index.css +10 -10
- package/dist/web/components/swiper/index.d.ts +24 -0
- package/dist/web/components/swiper/index.js +149 -0
- package/{src → dist}/web/components/tabs/index.css +6 -6
- package/dist/web/components/tabs/index.d.ts +13 -0
- package/dist/web/components/tabs/index.js +15 -0
- package/dist/web/components/tabs/tabs.h5.d.ts +4 -0
- package/dist/web/components/tabs/tabs.h5.js +42 -0
- package/dist/web/components/tabs/tabs.pc.d.ts +3 -0
- package/dist/web/components/tabs/tabs.pc.js +40 -0
- package/{src → dist}/web/components/text/index.css +6 -6
- package/dist/web/components/text/index.d.ts +14 -0
- package/dist/web/components/text/index.js +17 -0
- package/{src → dist}/web/components/uploaderFileView/index.css +0 -0
- package/dist/web/components/uploaderFileView/index.d.ts +10 -0
- package/dist/web/components/uploaderFileView/index.js +61 -0
- package/{src → dist}/web/components/uploaderView/index.css +5 -5
- package/dist/web/components/uploaderView/index.d.ts +17 -0
- package/dist/web/components/uploaderView/index.js +48 -0
- package/dist/web/components/userInfo/index.d.ts +26 -0
- package/dist/web/components/userInfo/index.js +4 -0
- package/{src → dist}/web/components/wedaVideo/index.css +2 -2
- package/dist/web/components/wedaVideo/index.d.ts +17 -0
- package/dist/web/components/wedaVideo/index.js +159 -0
- package/dist/web/index.d.ts +8 -0
- package/{src → dist}/web/index.js +1 -1
- package/dist/web/utils/classnames.d.ts +2 -0
- package/dist/web/utils/classnames.js +37 -0
- package/dist/web/utils/constant.d.ts +23 -0
- package/dist/web/utils/constant.js +24 -0
- package/dist/web/utils/debounce.d.ts +2 -0
- package/dist/web/utils/debounce.js +92 -0
- package/dist/web/utils/events.d.ts +1 -0
- package/{src → dist}/web/utils/events.js +1 -1
- package/dist/web/utils/getLocalCounter.d.ts +1 -0
- package/{src → dist}/web/utils/getLocalCounter.js +1 -2
- package/dist/web/utils/isObjectEqual.d.ts +2 -0
- package/dist/web/utils/isObjectEqual.js +12 -0
- package/dist/web/utils/loading-fallback.d.ts +2 -0
- package/dist/web/utils/loading-fallback.js +2 -0
- package/dist/web/utils/lodash.d.ts +1 -0
- package/{src/mp → dist/web}/utils/lodash.js +0 -0
- package/dist/web/utils/platform.d.ts +18 -0
- package/dist/web/utils/platform.js +191 -0
- package/dist/web/utils/tcb.d.ts +23 -0
- package/dist/web/utils/tcb.js +82 -0
- package/dist/web/utils/tmap.d.ts +3 -0
- package/dist/web/utils/tmap.js +21 -0
- package/dist/web/utils/useSetState.d.ts +1 -0
- package/dist/web/utils/useSetState.js +8 -0
- package/dist/web/utils/useSyncValue.d.ts +4 -0
- package/dist/web/utils/useSyncValue.js +15 -0
- package/dist/web/utils/weui.d.ts +1 -0
- package/{src → dist}/web/utils/weui.js +0 -1
- package/{src → dist}/web/weda-ui.css +2 -2
- package/package.json +22 -23
- package/src/configs/actions/showModal.json +0 -48
- package/src/configs/actions/showToast.json +0 -41
- package/src/configs/components/auth.json +0 -16
- package/src/configs/components/button.json +0 -239
- package/src/configs/components/calendar.json +0 -81
- package/src/configs/components/carousel.json +0 -292
- package/src/configs/components/chart/bar.json +0 -721
- package/src/configs/components/chart/line.json +0 -674
- package/src/configs/components/chart/pie.json +0 -494
- package/src/configs/components/chart/statisticsCard.json +0 -376
- package/src/configs/components/container.json +0 -50
- package/src/configs/components/dataView.json +0 -151
- package/src/configs/components/drawer.json +0 -115
- package/src/configs/components/form/checkbox.json +0 -173
- package/src/configs/components/form/form.json +0 -45
- package/src/configs/components/form/input.json +0 -154
- package/src/configs/components/form/label.json +0 -22
- package/src/configs/components/form/location.json +0 -155
- package/src/configs/components/form/radio.json +0 -203
- package/src/configs/components/form/richText.json +0 -125
- package/src/configs/components/form/select.json +0 -411
- package/src/configs/components/form/switch.json +0 -58
- package/src/configs/components/form/textarea.json +0 -116
- package/src/configs/components/form/tips.json +0 -34
- package/src/configs/components/form/uploader.json +0 -169
- package/src/configs/components/form/uploaderFile.json +0 -158
- package/src/configs/components/graphicCard.json +0 -413
- package/src/configs/components/image.json +0 -179
- package/src/configs/components/link.json +0 -79
- package/src/configs/components/listView.json +0 -281
- package/src/configs/components/lottery.json +0 -157
- package/src/configs/components/modal.json +0 -83
- package/src/configs/components/navLayout.json +0 -368
- package/src/configs/components/navigationBar.json +0 -62
- package/src/configs/components/picker/datePicker.json +0 -33
- package/src/configs/components/picker/picker.json +0 -18
- package/src/configs/components/picker/timePicker.json +0 -23
- package/src/configs/components/richtextview.json +0 -26
- package/src/configs/components/scrollVeiw.json +0 -253
- package/src/configs/components/slot.json +0 -17
- package/src/configs/components/swiper.json +0 -90
- package/src/configs/components/tabs.json +0 -121
- package/src/configs/components/text.json +0 -95
- package/src/configs/components/wedaVideo.json +0 -89
- package/src/configs/components/wxOpenApi/phone.json +0 -127
- package/src/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/src/configs/components/wxOpenApi/share.json +0 -157
- package/src/configs/components/wxOpenApi/userInfo.json +0 -156
- package/src/mp/README.md +0 -1
- package/src/mp/actions/showModal/index.js +0 -3
- package/src/mp/actions/showToast/index.js +0 -3
- package/src/mp/components/button/index.js +0 -91
- package/src/mp/components/button/index.json +0 -4
- package/src/mp/components/button/index.wxml +0 -22
- package/src/mp/components/button/index.wxss +0 -13
- package/src/mp/components/calendar/arrowright--line.svg +0 -11
- package/src/mp/components/calendar/index.js +0 -268
- package/src/mp/components/calendar/index.json +0 -5
- package/src/mp/components/calendar/index.wxml +0 -35
- package/src/mp/components/calendar/index.wxss +0 -179
- package/src/mp/components/carousel/index.js +0 -88
- package/src/mp/components/carousel/index.json +0 -7
- package/src/mp/components/carousel/index.wxml +0 -6
- package/src/mp/components/chart/bar/index.js +0 -257
- package/src/mp/components/chart/bar/index.json +0 -6
- package/src/mp/components/chart/bar/index.wxml +0 -3
- package/src/mp/components/chart/bar/index.wxss +0 -9
- package/src/mp/components/chart/common/config/bar.js +0 -50
- package/src/mp/components/chart/common/config/global.js +0 -16
- package/src/mp/components/chart/common/config/line.js +0 -48
- package/src/mp/components/chart/common/config/pie.js +0 -36
- package/src/mp/components/chart/common/core/eChartBar.js +0 -258
- package/src/mp/components/chart/common/core/eChartBase.js +0 -389
- package/src/mp/components/chart/common/core/eChartLine.js +0 -223
- package/src/mp/components/chart/common/core/eChartPie.js +0 -169
- package/src/mp/components/chart/common/lib/echarts.min.js +0 -18
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +0 -277
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +0 -4
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +0 -109
- package/src/mp/components/chart/line/index.js +0 -247
- package/src/mp/components/chart/line/index.json +0 -6
- package/src/mp/components/chart/line/index.wxml +0 -3
- package/src/mp/components/chart/line/index.wxss +0 -9
- package/src/mp/components/chart/pie/index.js +0 -182
- package/src/mp/components/chart/pie/index.json +0 -6
- package/src/mp/components/chart/pie/index.wxml +0 -3
- package/src/mp/components/chart/pie/index.wxss +0 -9
- package/src/mp/components/chart/statisticsCard/index.js +0 -253
- package/src/mp/components/chart/statisticsCard/index.json +0 -4
- package/src/mp/components/chart/statisticsCard/index.wxml +0 -9
- package/src/mp/components/chart/statisticsCard/index.wxss +0 -42
- package/src/mp/components/container/index.js +0 -20
- package/src/mp/components/container/index.json +0 -4
- package/src/mp/components/container/index.wxml +0 -3
- package/src/mp/components/dataView/index.js +0 -34
- package/src/mp/components/dataView/index.json +0 -7
- package/src/mp/components/dataView/index.wxml +0 -3
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/checkbox/index.js +0 -124
- package/src/mp/components/form/checkbox/index.json +0 -7
- package/src/mp/components/form/checkbox/index.wxml +0 -13
- package/src/mp/components/form/checkbox/index.wxss +0 -1
- package/src/mp/components/form/form/index.js +0 -18
- package/src/mp/components/form/form/index.json +0 -4
- package/src/mp/components/form/form/index.wxml +0 -5
- package/src/mp/components/form/form/index.wxss +0 -1
- package/src/mp/components/form/formcell/index.js +0 -54
- package/src/mp/components/form/formcell/index.json +0 -4
- package/src/mp/components/form/formcell/index.wxml +0 -11
- package/src/mp/components/form/formcell/index.wxss +0 -31
- package/src/mp/components/form/input/index.js +0 -110
- package/src/mp/components/form/input/index.json +0 -7
- package/src/mp/components/form/input/index.wxml +0 -24
- package/src/mp/components/form/input/index.wxss +0 -22
- package/src/mp/components/form/location/components/mapChoose/index.js +0 -201
- package/src/mp/components/form/location/components/mapChoose/index.json +0 -4
- package/src/mp/components/form/location/components/mapChoose/index.wxml +0 -42
- package/src/mp/components/form/location/components/mapChoose/index.wxss +0 -188
- package/src/mp/components/form/location/index.js +0 -388
- package/src/mp/components/form/location/index.json +0 -6
- package/src/mp/components/form/location/index.wxml +0 -21
- package/src/mp/components/form/location/index.wxss +0 -89
- package/src/mp/components/form/radio/index.js +0 -124
- package/src/mp/components/form/radio/index.json +0 -7
- package/src/mp/components/form/radio/index.wxml +0 -13
- package/src/mp/components/form/radio/index.wxss +0 -1
- package/src/mp/components/form/select/index.js +0 -677
- package/src/mp/components/form/select/index.json +0 -7
- package/src/mp/components/form/select/index.wxml +0 -12
- package/src/mp/components/form/select/index.wxss +0 -16
- package/src/mp/components/form/select/region/index.js +0 -107
- package/src/mp/components/form/switch/index.js +0 -75
- package/src/mp/components/form/switch/index.json +0 -7
- package/src/mp/components/form/switch/index.wxml +0 -11
- package/src/mp/components/form/switch/index.wxss +0 -1
- package/src/mp/components/form/textarea/index.js +0 -90
- package/src/mp/components/form/textarea/index.json +0 -7
- package/src/mp/components/form/textarea/index.wxml +0 -8
- package/src/mp/components/form/textarea/index.wxss +0 -10
- package/src/mp/components/form/tips/index.js +0 -41
- package/src/mp/components/form/tips/index.json +0 -4
- package/src/mp/components/form/tips/index.wxml +0 -1
- package/src/mp/components/form/tips/index.wxss +0 -1
- package/src/mp/components/form/uploader/index.js +0 -158
- package/src/mp/components/form/uploader/index.json +0 -10
- package/src/mp/components/form/uploader/index.wxml +0 -14
- package/src/mp/components/form/uploader/index.wxss +0 -36
- package/src/mp/components/form/uploader/weui-uploader.js +0 -219
- package/src/mp/components/form/uploader/weui-uploader.json +0 -7
- package/src/mp/components/form/uploader/weui-uploader.wxml +0 -45
- package/src/mp/components/form/uploader/weui-uploader.wxss +0 -1
- package/src/mp/components/form/uploaderFile/index.js +0 -313
- package/src/mp/components/form/uploaderFile/index.json +0 -9
- package/src/mp/components/form/uploaderFile/index.wxml +0 -45
- package/src/mp/components/form/uploaderFile/index.wxss +0 -105
- package/src/mp/components/graphicCard/chevron-right.svg +0 -3
- package/src/mp/components/graphicCard/index.js +0 -203
- package/src/mp/components/graphicCard/index.json +0 -4
- package/src/mp/components/graphicCard/index.wxml +0 -25
- package/src/mp/components/graphicCard/index.wxss +0 -157
- package/src/mp/components/image/index.js +0 -182
- package/src/mp/components/image/index.json +0 -7
- package/src/mp/components/image/index.wxml +0 -9
- package/src/mp/components/image/index.wxss +0 -49
- package/src/mp/components/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/listView/index.js +0 -274
- package/src/mp/components/listView/index.json +0 -4
- package/src/mp/components/listView/index.wxml +0 -38
- package/src/mp/components/listView/index.wxss +0 -155
- package/src/mp/components/listView/more-line.svg +0 -3
- package/src/mp/components/lottery/index.js +0 -270
- package/src/mp/components/lottery/index.json +0 -4
- package/src/mp/components/lottery/index.wxml +0 -41
- package/src/mp/components/lottery/index.wxss +0 -323
- package/src/mp/components/modal/index.js +0 -39
- package/src/mp/components/modal/index.json +0 -4
- package/src/mp/components/modal/index.wxml +0 -1
- package/src/mp/components/navLayout/index.js +0 -120
- package/src/mp/components/navLayout/index.json +0 -7
- package/src/mp/components/navLayout/index.wxml +0 -23
- package/src/mp/components/navLayout/index.wxss +0 -1193
- package/src/mp/components/navigationBar/index.js +0 -204
- package/src/mp/components/navigationBar/index.json +0 -5
- package/src/mp/components/navigationBar/index.wxml +0 -80
- package/src/mp/components/navigationBar/index.wxss +0 -1257
- package/src/mp/components/richText/index.js +0 -67
- package/src/mp/components/richText/index.json +0 -4
- package/src/mp/components/richText/index.wxml +0 -3
- package/src/mp/components/richText/index.wxss +0 -27
- package/src/mp/components/scrollView/index.js +0 -119
- package/src/mp/components/scrollView/index.json +0 -4
- package/src/mp/components/scrollView/index.wxml +0 -38
- package/src/mp/components/slot/index.js +0 -20
- package/src/mp/components/slot/index.json +0 -4
- package/src/mp/components/slot/index.wxml +0 -3
- package/src/mp/components/swiper/index.js +0 -65
- package/src/mp/components/swiper/index.json +0 -4
- package/src/mp/components/swiper/index.wxml +0 -3
- package/src/mp/components/tabs/index.js +0 -59
- package/src/mp/components/tabs/index.json +0 -4
- package/src/mp/components/tabs/index.wxml +0 -12
- package/src/mp/components/tabs/index.wxss +0 -57
- package/src/mp/components/text/index.js +0 -40
- package/src/mp/components/text/index.json +0 -4
- package/src/mp/components/text/index.wxml +0 -1
- package/src/mp/components/text/index.wxss +0 -26
- package/src/mp/components/wedaVideo/index.js +0 -86
- package/src/mp/components/wedaVideo/index.json +0 -4
- package/src/mp/components/wedaVideo/index.wxml +0 -4
- package/src/mp/components/wedaVideo/index.wxss +0 -20
- package/src/mp/components/wxOpenApi/phone/index.js +0 -109
- package/src/mp/components/wxOpenApi/phone/index.json +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/phoneCode/index.js +0 -89
- package/src/mp/components/wxOpenApi/phoneCode/index.json +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/share/index.js +0 -117
- package/src/mp/components/wxOpenApi/share/index.json +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/userInfo/index.js +0 -88
- package/src/mp/components/wxOpenApi/userInfo/index.json +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +0 -22
- package/src/mp/index.json +0 -52
- package/src/mp/package.json +0 -6
- package/src/mp/style/weda-ui.wxss +0 -71
- package/src/mp/utils/classnames.js +0 -39
- package/src/mp/utils/constant.js +0 -20
- package/src/mp/utils/dayjs.min.js +0 -1
- package/src/mp/utils/debounce.js +0 -133
- package/src/mp/utils/deepEqual.js +0 -42
- package/src/mp/utils/destr.js +0 -49
- package/src/mp/utils/dr_square_point.js +0 -29
- package/src/mp/utils/handleEvents.js +0 -32
- package/src/mp/utils/platform.js +0 -45
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +0 -1336
- package/src/mp/utils/spark-md5.js +0 -776
- package/src/mp/utils/tcb.js +0 -90
- package/src/setupTests.js +0 -14
- package/src/web/actions/showModal/index.tsx +0 -118
- package/src/web/actions/showToast/index.js +0 -3
- package/src/web/components/auth/index.css +0 -0
- package/src/web/components/auth/index.js +0 -66
- package/src/web/components/button/index.tsx +0 -119
- package/src/web/components/calendar/index.jsx +0 -312
- package/src/web/components/calendar/util.js +0 -90
- package/src/web/components/carousel/index.tsx +0 -417
- package/src/web/components/chart/bar/index.tsx +0 -140
- package/src/web/components/chart/common/config/bar.js +0 -49
- package/src/web/components/chart/common/config/global.js +0 -16
- package/src/web/components/chart/common/config/line.js +0 -50
- package/src/web/components/chart/common/config/pie.js +0 -37
- package/src/web/components/chart/common/core/eChartBar.js +0 -259
- package/src/web/components/chart/common/core/eChartBase.ts +0 -396
- package/src/web/components/chart/common/core/eChartLine.js +0 -225
- package/src/web/components/chart/common/core/eChartPie.js +0 -173
- package/src/web/components/chart/common/core/type.ts +0 -34
- package/src/web/components/chart/common/echart.css +0 -106
- package/src/web/components/chart/common/useChart.tsx +0 -87
- package/src/web/components/chart/line/index.tsx +0 -136
- package/src/web/components/chart/pie/index.tsx +0 -99
- package/src/web/components/chart/statisticsCard/index.tsx +0 -307
- package/src/web/components/chart/statisticsCard/interface.ts +0 -14
- package/src/web/components/container/index.tsx +0 -34
- package/src/web/components/dataView/index.tsx +0 -20
- package/src/web/components/drawer/index.tsx +0 -68
- package/src/web/components/form/checkbox/index.tsx +0 -210
- package/src/web/components/form/enumSelect/MultipleSelect.jsx +0 -89
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -92
- package/src/web/components/form/enumSelect/SelectContainer.jsx +0 -43
- package/src/web/components/form/enumSelect/props/defaultProps.js +0 -39
- package/src/web/components/form/enumSelect/props/propsTypes.js +0 -50
- package/src/web/components/form/form/index.tsx +0 -51
- package/src/web/components/form/formcell/index.tsx +0 -85
- package/src/web/components/form/input/index.tsx +0 -166
- package/src/web/components/form/location/common/mapChoose.css +0 -180
- package/src/web/components/form/location/common/mapChoose.jsx +0 -343
- package/src/web/components/form/location/common/mapView.jsx +0 -190
- package/src/web/components/form/location/common/propsConfig.js +0 -54
- package/src/web/components/form/location/common/selectModal.jsx +0 -73
- package/src/web/components/form/location/common/useLocationInfo.js +0 -104
- package/src/web/components/form/location/components/LocationH5/index.css +0 -239
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +0 -413
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -96
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +0 -332
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +0 -25
- package/src/web/components/form/radio/index.tsx +0 -179
- package/src/web/components/form/renderDecorator.tsx +0 -28
- package/src/web/components/form/select/h5.tsx +0 -602
- package/src/web/components/form/select/index.tsx +0 -510
- package/src/web/components/form/select/region/index.ts +0 -152
- package/src/web/components/form/select/time.jsx +0 -145
- package/src/web/components/form/select/year.tsx +0 -172
- package/src/web/components/form/switch/index.tsx +0 -100
- package/src/web/components/form/textarea/index.tsx +0 -127
- package/src/web/components/form/tips/index.tsx +0 -34
- package/src/web/components/form/types.d.ts +0 -12
- package/src/web/components/form/uploader/index.tsx +0 -65
- package/src/web/components/form/uploader/uploader.h5.tsx +0 -290
- package/src/web/components/form/uploader/uploader.pc.tsx +0 -287
- package/src/web/components/form/uploaderFile/fail.svg +0 -12
- package/src/web/components/form/uploaderFile/index.jsx +0 -25
- package/src/web/components/form/uploaderFile/pending.svg +0 -18
- package/src/web/components/form/uploaderFile/success.svg +0 -12
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +0 -606
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +0 -520
- package/src/web/components/graphicCard/index.tsx +0 -310
- package/src/web/components/image/image.tsx +0 -187
- package/src/web/components/image/index.tsx +0 -121
- package/src/web/components/link/index.tsx +0 -119
- package/src/web/components/listView/arrow-right-line.svg +0 -3
- package/src/web/components/listView/index.tsx +0 -346
- package/src/web/components/listView/interface.ts +0 -98
- package/src/web/components/lottery/index.tsx +0 -567
- package/src/web/components/lottery/lotteryUtil.ts +0 -130
- package/src/web/components/modal/index.tsx +0 -60
- package/src/web/components/navLayout/index.tsx +0 -247
- package/src/web/components/navigationBar/chevron-right--double.svg +0 -3
- package/src/web/components/navigationBar/common.tsx +0 -203
- package/src/web/components/navigationBar/h5Menu.tsx +0 -179
- package/src/web/components/navigationBar/horizontalMenu.tsx +0 -201
- package/src/web/components/navigationBar/index.tsx +0 -231
- package/src/web/components/navigationBar/type.d.ts +0 -118
- package/src/web/components/navigationBar/verticalMenu.tsx +0 -81
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +0 -22
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +0 -22
- package/src/web/components/picker/datePicker.tsx +0 -48
- package/src/web/components/picker/picker.tsx +0 -59
- package/src/web/components/picker/timePicker.tsx +0 -56
- package/src/web/components/richText/const.ts +0 -3
- package/src/web/components/richText/index.jsx +0 -473
- package/src/web/components/richTextView/index.tsx +0 -63
- package/src/web/components/scrollView/index.tsx +0 -148
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +0 -38
- package/src/web/components/slot/index.tsx +0 -19
- package/src/web/components/swiper/index.tsx +0 -291
- package/src/web/components/tabs/index.tsx +0 -35
- package/src/web/components/tabs/tabs.h5.tsx +0 -84
- package/src/web/components/tabs/tabs.pc.tsx +0 -74
- package/src/web/components/text/index.tsx +0 -60
- package/src/web/components/uploaderFileView/index.jsx +0 -84
- package/src/web/components/uploaderView/index.tsx +0 -92
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +0 -30
- package/src/web/components/wedaVideo/index.tsx +0 -208
- package/src/web/types.d.ts +0 -21
- package/src/web/utils/classnames.js +0 -39
- package/src/web/utils/constant.ts +0 -23
- package/src/web/utils/debounce.js +0 -98
- package/src/web/utils/isObjectEqual.js +0 -15
- package/src/web/utils/loading-fallback.tsx +0 -2
- package/src/web/utils/lodash.ts +0 -2
- package/src/web/utils/platform.js +0 -170
- package/src/web/utils/tcb.js +0 -86
- package/src/web/utils/tmap.js +0 -4
- package/src/web/utils/useSetState.ts +0 -18
- package/src/web/utils/useSyncValue.ts +0 -17
|
@@ -1,1336 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 微信小程序JavaScriptSDK
|
|
3
|
-
*
|
|
4
|
-
* @version 1.2
|
|
5
|
-
* @date 2019-03-06
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
var ERROR_CONF = {
|
|
9
|
-
KEY_ERR: 311,
|
|
10
|
-
KEY_ERR_MSG: 'key格式错误',
|
|
11
|
-
PARAM_ERR: 310,
|
|
12
|
-
PARAM_ERR_MSG: '请求参数信息有误',
|
|
13
|
-
SYSTEM_ERR: 600,
|
|
14
|
-
SYSTEM_ERR_MSG: '系统错误',
|
|
15
|
-
WX_ERR_CODE: 1000,
|
|
16
|
-
WX_OK_CODE: 200,
|
|
17
|
-
};
|
|
18
|
-
var BASE_URL = 'https://apis.map.qq.com/ws/';
|
|
19
|
-
var URL_SEARCH = BASE_URL + 'place/v1/search';
|
|
20
|
-
var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion';
|
|
21
|
-
var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/';
|
|
22
|
-
var URL_CITY_LIST = BASE_URL + 'district/v1/list';
|
|
23
|
-
var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren';
|
|
24
|
-
var URL_DISTANCE = BASE_URL + 'distance/v1/';
|
|
25
|
-
var URL_DIRECTION = BASE_URL + 'direction/v1/';
|
|
26
|
-
var MODE = {
|
|
27
|
-
driving: 'driving',
|
|
28
|
-
transit: 'transit',
|
|
29
|
-
};
|
|
30
|
-
var EARTH_RADIUS = 6378136.49;
|
|
31
|
-
var Utils = {
|
|
32
|
-
/**
|
|
33
|
-
* md5加密方法
|
|
34
|
-
* 版权所有©2011 Sebastian Tschan,https://blueimp.net
|
|
35
|
-
*/
|
|
36
|
-
safeAdd(x, y) {
|
|
37
|
-
var lsw = (x & 0xffff) + (y & 0xffff);
|
|
38
|
-
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
39
|
-
return (msw << 16) | (lsw & 0xffff);
|
|
40
|
-
},
|
|
41
|
-
bitRotateLeft(num, cnt) {
|
|
42
|
-
return (num << cnt) | (num >>> (32 - cnt));
|
|
43
|
-
},
|
|
44
|
-
md5cmn(q, a, b, x, s, t) {
|
|
45
|
-
return this.safeAdd(
|
|
46
|
-
this.bitRotateLeft(
|
|
47
|
-
this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)),
|
|
48
|
-
s
|
|
49
|
-
),
|
|
50
|
-
b
|
|
51
|
-
);
|
|
52
|
-
},
|
|
53
|
-
md5ff(a, b, c, d, x, s, t) {
|
|
54
|
-
return this.md5cmn((b & c) | (~b & d), a, b, x, s, t);
|
|
55
|
-
},
|
|
56
|
-
md5gg(a, b, c, d, x, s, t) {
|
|
57
|
-
return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t);
|
|
58
|
-
},
|
|
59
|
-
md5hh(a, b, c, d, x, s, t) {
|
|
60
|
-
return this.md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
61
|
-
},
|
|
62
|
-
md5ii(a, b, c, d, x, s, t) {
|
|
63
|
-
return this.md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
64
|
-
},
|
|
65
|
-
binlMD5(x, len) {
|
|
66
|
-
/* append padding */
|
|
67
|
-
x[len >> 5] |= 0x80 << len % 32;
|
|
68
|
-
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
|
69
|
-
|
|
70
|
-
var i;
|
|
71
|
-
var olda;
|
|
72
|
-
var oldb;
|
|
73
|
-
var oldc;
|
|
74
|
-
var oldd;
|
|
75
|
-
var a = 1732584193;
|
|
76
|
-
var b = -271733879;
|
|
77
|
-
var c = -1732584194;
|
|
78
|
-
var d = 271733878;
|
|
79
|
-
|
|
80
|
-
for (i = 0; i < x.length; i += 16) {
|
|
81
|
-
olda = a;
|
|
82
|
-
oldb = b;
|
|
83
|
-
oldc = c;
|
|
84
|
-
oldd = d;
|
|
85
|
-
|
|
86
|
-
a = this.md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
87
|
-
d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
88
|
-
c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
89
|
-
b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
90
|
-
a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
91
|
-
d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
92
|
-
c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
93
|
-
b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
94
|
-
a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
95
|
-
d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
96
|
-
c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
97
|
-
b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
98
|
-
a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
99
|
-
d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
100
|
-
c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
101
|
-
b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
102
|
-
|
|
103
|
-
a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
104
|
-
d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
105
|
-
c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
106
|
-
b = this.md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
107
|
-
a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
108
|
-
d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
109
|
-
c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
110
|
-
b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
111
|
-
a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
112
|
-
d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
113
|
-
c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
114
|
-
b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
115
|
-
a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
116
|
-
d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
117
|
-
c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
118
|
-
b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
119
|
-
|
|
120
|
-
a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
121
|
-
d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
122
|
-
c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
123
|
-
b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
124
|
-
a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
125
|
-
d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
126
|
-
c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
127
|
-
b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
128
|
-
a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
129
|
-
d = this.md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
130
|
-
c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
131
|
-
b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
132
|
-
a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
133
|
-
d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
134
|
-
c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
135
|
-
b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
136
|
-
|
|
137
|
-
a = this.md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
138
|
-
d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
139
|
-
c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
140
|
-
b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
141
|
-
a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
142
|
-
d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
143
|
-
c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
144
|
-
b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
145
|
-
a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
146
|
-
d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
147
|
-
c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
148
|
-
b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
149
|
-
a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
150
|
-
d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
151
|
-
c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
152
|
-
b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
153
|
-
|
|
154
|
-
a = this.safeAdd(a, olda);
|
|
155
|
-
b = this.safeAdd(b, oldb);
|
|
156
|
-
c = this.safeAdd(c, oldc);
|
|
157
|
-
d = this.safeAdd(d, oldd);
|
|
158
|
-
}
|
|
159
|
-
return [a, b, c, d];
|
|
160
|
-
},
|
|
161
|
-
binl2rstr(input) {
|
|
162
|
-
var i;
|
|
163
|
-
var output = '';
|
|
164
|
-
var length32 = input.length * 32;
|
|
165
|
-
for (i = 0; i < length32; i += 8) {
|
|
166
|
-
output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff);
|
|
167
|
-
}
|
|
168
|
-
return output;
|
|
169
|
-
},
|
|
170
|
-
rstr2binl(input) {
|
|
171
|
-
var i;
|
|
172
|
-
var output = [];
|
|
173
|
-
output[(input.length >> 2) - 1] = undefined;
|
|
174
|
-
for (i = 0; i < output.length; i += 1) {
|
|
175
|
-
output[i] = 0;
|
|
176
|
-
}
|
|
177
|
-
var length8 = input.length * 8;
|
|
178
|
-
for (i = 0; i < length8; i += 8) {
|
|
179
|
-
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32;
|
|
180
|
-
}
|
|
181
|
-
return output;
|
|
182
|
-
},
|
|
183
|
-
rstrMD5(s) {
|
|
184
|
-
return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8));
|
|
185
|
-
},
|
|
186
|
-
rstrHMACMD5(key, data) {
|
|
187
|
-
var i;
|
|
188
|
-
var bkey = this.rstr2binl(key);
|
|
189
|
-
var ipad = [];
|
|
190
|
-
var opad = [];
|
|
191
|
-
var hash;
|
|
192
|
-
ipad[15] = opad[15] = undefined;
|
|
193
|
-
if (bkey.length > 16) {
|
|
194
|
-
bkey = this.binlMD5(bkey, key.length * 8);
|
|
195
|
-
}
|
|
196
|
-
for (i = 0; i < 16; i += 1) {
|
|
197
|
-
ipad[i] = bkey[i] ^ 0x36363636;
|
|
198
|
-
opad[i] = bkey[i] ^ 0x5c5c5c5c;
|
|
199
|
-
}
|
|
200
|
-
hash = this.binlMD5(
|
|
201
|
-
ipad.concat(this.rstr2binl(data)),
|
|
202
|
-
512 + data.length * 8
|
|
203
|
-
);
|
|
204
|
-
return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128));
|
|
205
|
-
},
|
|
206
|
-
rstr2hex(input) {
|
|
207
|
-
var hexTab = '0123456789abcdef';
|
|
208
|
-
var output = '';
|
|
209
|
-
var x;
|
|
210
|
-
var i;
|
|
211
|
-
for (i = 0; i < input.length; i += 1) {
|
|
212
|
-
x = input.charCodeAt(i);
|
|
213
|
-
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);
|
|
214
|
-
}
|
|
215
|
-
return output;
|
|
216
|
-
},
|
|
217
|
-
str2rstrUTF8(input) {
|
|
218
|
-
return unescape(encodeURIComponent(input));
|
|
219
|
-
},
|
|
220
|
-
rawMD5(s) {
|
|
221
|
-
return this.rstrMD5(this.str2rstrUTF8(s));
|
|
222
|
-
},
|
|
223
|
-
hexMD5(s) {
|
|
224
|
-
return this.rstr2hex(this.rawMD5(s));
|
|
225
|
-
},
|
|
226
|
-
rawHMACMD5(k, d) {
|
|
227
|
-
// eslint-disable-next-line no-undef
|
|
228
|
-
return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d));
|
|
229
|
-
},
|
|
230
|
-
hexHMACMD5(k, d) {
|
|
231
|
-
return this.rstr2hex(this.rawHMACMD5(k, d));
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
md5(string, key, raw) {
|
|
235
|
-
if (!key) {
|
|
236
|
-
if (!raw) {
|
|
237
|
-
return this.hexMD5(string);
|
|
238
|
-
}
|
|
239
|
-
return this.rawMD5(string);
|
|
240
|
-
}
|
|
241
|
-
if (!raw) {
|
|
242
|
-
return this.hexHMACMD5(key, string);
|
|
243
|
-
}
|
|
244
|
-
return this.rawHMACMD5(key, string);
|
|
245
|
-
},
|
|
246
|
-
/**
|
|
247
|
-
* 得到md5加密后的sig参数
|
|
248
|
-
* @param {Object} requestParam 接口参数
|
|
249
|
-
* @param {String} sk签名字符串
|
|
250
|
-
* @param {String} featrue 方法名
|
|
251
|
-
* @return 返回加密后的sig参数
|
|
252
|
-
*/
|
|
253
|
-
getSig(requestParam, sk, feature, mode) {
|
|
254
|
-
var sig = null;
|
|
255
|
-
var requestArr = [];
|
|
256
|
-
Object.keys(requestParam)
|
|
257
|
-
.sort()
|
|
258
|
-
.forEach(function (key) {
|
|
259
|
-
requestArr.push(key + '=' + requestParam[key]);
|
|
260
|
-
});
|
|
261
|
-
if (feature == 'search') {
|
|
262
|
-
sig = '/ws/place/v1/search?' + requestArr.join('&') + sk;
|
|
263
|
-
}
|
|
264
|
-
if (feature == 'suggest') {
|
|
265
|
-
sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk;
|
|
266
|
-
}
|
|
267
|
-
if (feature == 'reverseGeocoder') {
|
|
268
|
-
sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk;
|
|
269
|
-
}
|
|
270
|
-
if (feature == 'geocoder') {
|
|
271
|
-
sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk;
|
|
272
|
-
}
|
|
273
|
-
if (feature == 'getCityList') {
|
|
274
|
-
sig = '/ws/district/v1/list?' + requestArr.join('&') + sk;
|
|
275
|
-
}
|
|
276
|
-
if (feature == 'getDistrictByCityId') {
|
|
277
|
-
sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk;
|
|
278
|
-
}
|
|
279
|
-
if (feature == 'calculateDistance') {
|
|
280
|
-
sig = '/ws/distance/v1/?' + requestArr.join('&') + sk;
|
|
281
|
-
}
|
|
282
|
-
if (feature == 'direction') {
|
|
283
|
-
sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk;
|
|
284
|
-
}
|
|
285
|
-
sig = this.md5(sig);
|
|
286
|
-
return sig;
|
|
287
|
-
},
|
|
288
|
-
/**
|
|
289
|
-
* 得到终点query字符串
|
|
290
|
-
* @param {Array|String} 检索数据
|
|
291
|
-
*/
|
|
292
|
-
location2query(data) {
|
|
293
|
-
if (typeof data == 'string') {
|
|
294
|
-
return data;
|
|
295
|
-
}
|
|
296
|
-
var query = '';
|
|
297
|
-
for (var i = 0; i < data.length; i++) {
|
|
298
|
-
var d = data[i];
|
|
299
|
-
if (query) {
|
|
300
|
-
query += ';';
|
|
301
|
-
}
|
|
302
|
-
if (d.location) {
|
|
303
|
-
query = query + d.location.lat + ',' + d.location.lng;
|
|
304
|
-
}
|
|
305
|
-
if (d.latitude && d.longitude) {
|
|
306
|
-
query = query + d.latitude + ',' + d.longitude;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return query;
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* 计算角度
|
|
314
|
-
*/
|
|
315
|
-
rad(d) {
|
|
316
|
-
return (d * Math.PI) / 180.0;
|
|
317
|
-
},
|
|
318
|
-
/**
|
|
319
|
-
* 处理终点location数组
|
|
320
|
-
* @return 返回终点数组
|
|
321
|
-
*/
|
|
322
|
-
getEndLocation(location) {
|
|
323
|
-
var to = location.split(';');
|
|
324
|
-
var endLocation = [];
|
|
325
|
-
for (var i = 0; i < to.length; i++) {
|
|
326
|
-
endLocation.push({
|
|
327
|
-
lat: parseFloat(to[i].split(',')[0]),
|
|
328
|
-
lng: parseFloat(to[i].split(',')[1]),
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
return endLocation;
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* 计算两点间直线距离
|
|
336
|
-
* @param a 表示纬度差
|
|
337
|
-
* @param b 表示经度差
|
|
338
|
-
* @return 返回的是距离,单位m
|
|
339
|
-
*/
|
|
340
|
-
getDistance(latFrom, lngFrom, latTo, lngTo) {
|
|
341
|
-
var radLatFrom = this.rad(latFrom);
|
|
342
|
-
var radLatTo = this.rad(latTo);
|
|
343
|
-
var a = radLatFrom - radLatTo;
|
|
344
|
-
var b = this.rad(lngFrom) - this.rad(lngTo);
|
|
345
|
-
var distance =
|
|
346
|
-
2 *
|
|
347
|
-
Math.asin(
|
|
348
|
-
Math.sqrt(
|
|
349
|
-
Math.pow(Math.sin(a / 2), 2) +
|
|
350
|
-
Math.cos(radLatFrom) *
|
|
351
|
-
Math.cos(radLatTo) *
|
|
352
|
-
Math.pow(Math.sin(b / 2), 2)
|
|
353
|
-
)
|
|
354
|
-
);
|
|
355
|
-
distance = distance * EARTH_RADIUS;
|
|
356
|
-
distance = Math.round(distance * 10000) / 10000;
|
|
357
|
-
return parseFloat(distance.toFixed(0));
|
|
358
|
-
},
|
|
359
|
-
/**
|
|
360
|
-
* 使用微信接口进行定位
|
|
361
|
-
*/
|
|
362
|
-
getWXLocation(success, fail, complete) {
|
|
363
|
-
const wxClientApi = wx;
|
|
364
|
-
const apiName = [
|
|
365
|
-
'g',
|
|
366
|
-
'e',
|
|
367
|
-
't',
|
|
368
|
-
'L',
|
|
369
|
-
'o',
|
|
370
|
-
'c',
|
|
371
|
-
'a',
|
|
372
|
-
't',
|
|
373
|
-
'i',
|
|
374
|
-
'o',
|
|
375
|
-
'n',
|
|
376
|
-
].join('');
|
|
377
|
-
wxClientApi[apiName]({
|
|
378
|
-
type: 'gcj02',
|
|
379
|
-
success: success,
|
|
380
|
-
fail: fail,
|
|
381
|
-
complete: complete,
|
|
382
|
-
});
|
|
383
|
-
},
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* 获取location参数
|
|
387
|
-
*/
|
|
388
|
-
getLocationParam(location) {
|
|
389
|
-
if (typeof location == 'string') {
|
|
390
|
-
var locationArr = location.split(',');
|
|
391
|
-
if (locationArr.length === 2) {
|
|
392
|
-
location = {
|
|
393
|
-
latitude: location.split(',')[0],
|
|
394
|
-
longitude: location.split(',')[1],
|
|
395
|
-
};
|
|
396
|
-
} else {
|
|
397
|
-
location = {};
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return location;
|
|
401
|
-
},
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* 回调函数默认处理
|
|
405
|
-
*/
|
|
406
|
-
polyfillParam(param) {
|
|
407
|
-
param.success = param.success || function () {};
|
|
408
|
-
param.fail = param.fail || function () {};
|
|
409
|
-
param.complete = param.complete || function () {};
|
|
410
|
-
},
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* 验证param对应的key值是否为空
|
|
414
|
-
*
|
|
415
|
-
* @param {Object} param 接口参数
|
|
416
|
-
* @param {String} key 对应参数的key
|
|
417
|
-
*/
|
|
418
|
-
checkParamKeyEmpty(param, key) {
|
|
419
|
-
if (!param[key]) {
|
|
420
|
-
var errconf = this.buildErrorConfig(
|
|
421
|
-
ERROR_CONF.PARAM_ERR,
|
|
422
|
-
ERROR_CONF.PARAM_ERR_MSG + key + '参数格式有误'
|
|
423
|
-
);
|
|
424
|
-
param.fail(errconf);
|
|
425
|
-
param.complete(errconf);
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
return false;
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* 验证参数中是否存在检索词keyword
|
|
433
|
-
*
|
|
434
|
-
* @param {Object} param 接口参数
|
|
435
|
-
*/
|
|
436
|
-
checkKeyword(param) {
|
|
437
|
-
return !this.checkParamKeyEmpty(param, 'keyword');
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* 验证location值
|
|
442
|
-
*
|
|
443
|
-
* @param {Object} param 接口参数
|
|
444
|
-
*/
|
|
445
|
-
checkLocation(param) {
|
|
446
|
-
var location = this.getLocationParam(param.location);
|
|
447
|
-
if (!location || !location.latitude || !location.longitude) {
|
|
448
|
-
var errconf = this.buildErrorConfig(
|
|
449
|
-
ERROR_CONF.PARAM_ERR,
|
|
450
|
-
ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'
|
|
451
|
-
);
|
|
452
|
-
param.fail(errconf);
|
|
453
|
-
param.complete(errconf);
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
return true;
|
|
457
|
-
},
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* 构造错误数据结构
|
|
461
|
-
* @param {Number} errCode 错误码
|
|
462
|
-
* @param {Number} errMsg 错误描述
|
|
463
|
-
*/
|
|
464
|
-
buildErrorConfig(errCode, errMsg) {
|
|
465
|
-
return {
|
|
466
|
-
status: errCode,
|
|
467
|
-
message: errMsg,
|
|
468
|
-
};
|
|
469
|
-
},
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
*
|
|
473
|
-
* 数据处理函数
|
|
474
|
-
* 根据传入参数不同处理不同数据
|
|
475
|
-
* @param {String} feature 功能名称
|
|
476
|
-
* search 地点搜索
|
|
477
|
-
* suggest关键词提示
|
|
478
|
-
* reverseGeocoder逆地址解析
|
|
479
|
-
* geocoder地址解析
|
|
480
|
-
* getCityList获取城市列表:父集
|
|
481
|
-
* getDistrictByCityId获取区县列表:子集
|
|
482
|
-
* calculateDistance距离计算
|
|
483
|
-
* @param {Object} param 接口参数
|
|
484
|
-
* @param {Object} data 数据
|
|
485
|
-
*/
|
|
486
|
-
handleData(param, data, feature) {
|
|
487
|
-
if (feature == 'search') {
|
|
488
|
-
var searchResult = data.data;
|
|
489
|
-
var searchSimplify = [];
|
|
490
|
-
for (var i = 0; i < searchResult.length; i++) {
|
|
491
|
-
searchSimplify.push({
|
|
492
|
-
id: searchResult[i].id || null,
|
|
493
|
-
title: searchResult[i].title || null,
|
|
494
|
-
latitude:
|
|
495
|
-
(searchResult[i].location && searchResult[i].location.lat) || null,
|
|
496
|
-
longitude:
|
|
497
|
-
(searchResult[i].location && searchResult[i].location.lng) || null,
|
|
498
|
-
address: searchResult[i].address || null,
|
|
499
|
-
category: searchResult[i].category || null,
|
|
500
|
-
tel: searchResult[i].tel || null,
|
|
501
|
-
adcode:
|
|
502
|
-
(searchResult[i].ad_info && searchResult[i].ad_info.adcode) || null,
|
|
503
|
-
city:
|
|
504
|
-
(searchResult[i].ad_info && searchResult[i].ad_info.city) || null,
|
|
505
|
-
district:
|
|
506
|
-
(searchResult[i].ad_info && searchResult[i].ad_info.district) ||
|
|
507
|
-
null,
|
|
508
|
-
province:
|
|
509
|
-
(searchResult[i].ad_info && searchResult[i].ad_info.province) ||
|
|
510
|
-
null,
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
param.success(data, {
|
|
514
|
-
searchResult: searchResult,
|
|
515
|
-
searchSimplify: searchSimplify,
|
|
516
|
-
});
|
|
517
|
-
} else if (feature == 'suggest') {
|
|
518
|
-
var suggestResult = data.data;
|
|
519
|
-
var suggestSimplify = [];
|
|
520
|
-
// eslint-disable-next-line no-redeclare
|
|
521
|
-
for (var i = 0; i < suggestResult.length; i++) {
|
|
522
|
-
suggestSimplify.push({
|
|
523
|
-
adcode: suggestResult[i].adcode || null,
|
|
524
|
-
address: suggestResult[i].address || null,
|
|
525
|
-
category: suggestResult[i].category || null,
|
|
526
|
-
city: suggestResult[i].city || null,
|
|
527
|
-
district: suggestResult[i].district || null,
|
|
528
|
-
id: suggestResult[i].id || null,
|
|
529
|
-
latitude:
|
|
530
|
-
(suggestResult[i].location && suggestResult[i].location.lat) ||
|
|
531
|
-
null,
|
|
532
|
-
longitude:
|
|
533
|
-
(suggestResult[i].location && suggestResult[i].location.lng) ||
|
|
534
|
-
null,
|
|
535
|
-
province: suggestResult[i].province || null,
|
|
536
|
-
title: suggestResult[i].title || null,
|
|
537
|
-
type: suggestResult[i].type || null,
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
param.success(data, {
|
|
541
|
-
suggestResult: suggestResult,
|
|
542
|
-
suggestSimplify: suggestSimplify,
|
|
543
|
-
});
|
|
544
|
-
} else if (feature == 'reverseGeocoder') {
|
|
545
|
-
var reverseGeocoderResult = data.result;
|
|
546
|
-
var reverseGeocoderSimplify = {
|
|
547
|
-
address: reverseGeocoderResult.address || null,
|
|
548
|
-
latitude:
|
|
549
|
-
(reverseGeocoderResult.location &&
|
|
550
|
-
reverseGeocoderResult.location.lat) ||
|
|
551
|
-
null,
|
|
552
|
-
longitude:
|
|
553
|
-
(reverseGeocoderResult.location &&
|
|
554
|
-
reverseGeocoderResult.location.lng) ||
|
|
555
|
-
null,
|
|
556
|
-
adcode:
|
|
557
|
-
(reverseGeocoderResult.ad_info &&
|
|
558
|
-
reverseGeocoderResult.ad_info.adcode) ||
|
|
559
|
-
null,
|
|
560
|
-
city:
|
|
561
|
-
(reverseGeocoderResult.address_component &&
|
|
562
|
-
reverseGeocoderResult.address_component.city) ||
|
|
563
|
-
null,
|
|
564
|
-
district:
|
|
565
|
-
(reverseGeocoderResult.address_component &&
|
|
566
|
-
reverseGeocoderResult.address_component.district) ||
|
|
567
|
-
null,
|
|
568
|
-
nation:
|
|
569
|
-
(reverseGeocoderResult.address_component &&
|
|
570
|
-
reverseGeocoderResult.address_component.nation) ||
|
|
571
|
-
null,
|
|
572
|
-
province:
|
|
573
|
-
(reverseGeocoderResult.address_component &&
|
|
574
|
-
reverseGeocoderResult.address_component.province) ||
|
|
575
|
-
null,
|
|
576
|
-
street:
|
|
577
|
-
(reverseGeocoderResult.address_component &&
|
|
578
|
-
reverseGeocoderResult.address_component.street) ||
|
|
579
|
-
null,
|
|
580
|
-
street_number:
|
|
581
|
-
(reverseGeocoderResult.address_component &&
|
|
582
|
-
reverseGeocoderResult.address_component.street_number) ||
|
|
583
|
-
null,
|
|
584
|
-
recommend:
|
|
585
|
-
(reverseGeocoderResult.formatted_addresses &&
|
|
586
|
-
reverseGeocoderResult.formatted_addresses.recommend) ||
|
|
587
|
-
null,
|
|
588
|
-
rough:
|
|
589
|
-
(reverseGeocoderResult.formatted_addresses &&
|
|
590
|
-
reverseGeocoderResult.formatted_addresses.rough) ||
|
|
591
|
-
null,
|
|
592
|
-
};
|
|
593
|
-
if (reverseGeocoderResult.pois) {
|
|
594
|
-
//判断是否返回周边poi
|
|
595
|
-
var pois = reverseGeocoderResult.pois;
|
|
596
|
-
var poisSimplify = [];
|
|
597
|
-
// eslint-disable-next-line no-redeclare
|
|
598
|
-
for (var i = 0; i < pois.length; i++) {
|
|
599
|
-
poisSimplify.push({
|
|
600
|
-
id: pois[i].id || null,
|
|
601
|
-
title: pois[i].title || null,
|
|
602
|
-
latitude: (pois[i].location && pois[i].location.lat) || null,
|
|
603
|
-
longitude: (pois[i].location && pois[i].location.lng) || null,
|
|
604
|
-
address: pois[i].address || null,
|
|
605
|
-
category: pois[i].category || null,
|
|
606
|
-
adcode: (pois[i].ad_info && pois[i].ad_info.adcode) || null,
|
|
607
|
-
city: (pois[i].ad_info && pois[i].ad_info.city) || null,
|
|
608
|
-
district: (pois[i].ad_info && pois[i].ad_info.district) || null,
|
|
609
|
-
province: (pois[i].ad_info && pois[i].ad_info.province) || null,
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
param.success(data, {
|
|
613
|
-
reverseGeocoderResult: reverseGeocoderResult,
|
|
614
|
-
reverseGeocoderSimplify: reverseGeocoderSimplify,
|
|
615
|
-
pois: pois,
|
|
616
|
-
poisSimplify: poisSimplify,
|
|
617
|
-
});
|
|
618
|
-
} else {
|
|
619
|
-
param.success(data, {
|
|
620
|
-
reverseGeocoderResult: reverseGeocoderResult,
|
|
621
|
-
reverseGeocoderSimplify: reverseGeocoderSimplify,
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
} else if (feature == 'geocoder') {
|
|
625
|
-
var geocoderResult = data.result;
|
|
626
|
-
var geocoderSimplify = {
|
|
627
|
-
title: geocoderResult.title || null,
|
|
628
|
-
latitude:
|
|
629
|
-
(geocoderResult.location && geocoderResult.location.lat) || null,
|
|
630
|
-
longitude:
|
|
631
|
-
(geocoderResult.location && geocoderResult.location.lng) || null,
|
|
632
|
-
adcode:
|
|
633
|
-
(geocoderResult.ad_info && geocoderResult.ad_info.adcode) || null,
|
|
634
|
-
province:
|
|
635
|
-
(geocoderResult.address_components &&
|
|
636
|
-
geocoderResult.address_components.province) ||
|
|
637
|
-
null,
|
|
638
|
-
city:
|
|
639
|
-
(geocoderResult.address_components &&
|
|
640
|
-
geocoderResult.address_components.city) ||
|
|
641
|
-
null,
|
|
642
|
-
district:
|
|
643
|
-
(geocoderResult.address_components &&
|
|
644
|
-
geocoderResult.address_components.district) ||
|
|
645
|
-
null,
|
|
646
|
-
street:
|
|
647
|
-
(geocoderResult.address_components &&
|
|
648
|
-
geocoderResult.address_components.street) ||
|
|
649
|
-
null,
|
|
650
|
-
street_number:
|
|
651
|
-
(geocoderResult.address_components &&
|
|
652
|
-
geocoderResult.address_components.street_number) ||
|
|
653
|
-
null,
|
|
654
|
-
level: geocoderResult.level || null,
|
|
655
|
-
};
|
|
656
|
-
param.success(data, {
|
|
657
|
-
geocoderResult: geocoderResult,
|
|
658
|
-
geocoderSimplify: geocoderSimplify,
|
|
659
|
-
});
|
|
660
|
-
} else if (feature == 'getCityList') {
|
|
661
|
-
var provinceResult = data.result[0];
|
|
662
|
-
var cityResult = data.result[1];
|
|
663
|
-
var districtResult = data.result[2];
|
|
664
|
-
param.success(data, {
|
|
665
|
-
provinceResult: provinceResult,
|
|
666
|
-
cityResult: cityResult,
|
|
667
|
-
districtResult: districtResult,
|
|
668
|
-
});
|
|
669
|
-
} else if (feature == 'getDistrictByCityId') {
|
|
670
|
-
var districtByCity = data.result[0];
|
|
671
|
-
param.success(data, districtByCity);
|
|
672
|
-
} else if (feature == 'calculateDistance') {
|
|
673
|
-
var calculateDistanceResult = data.result.elements;
|
|
674
|
-
var distance = [];
|
|
675
|
-
// eslint-disable-next-line no-redeclare
|
|
676
|
-
for (var i = 0; i < calculateDistanceResult.length; i++) {
|
|
677
|
-
distance.push(calculateDistanceResult[i].distance);
|
|
678
|
-
}
|
|
679
|
-
param.success(data, {
|
|
680
|
-
calculateDistanceResult: calculateDistanceResult,
|
|
681
|
-
distance: distance,
|
|
682
|
-
});
|
|
683
|
-
} else if (feature == 'direction') {
|
|
684
|
-
var direction = data.result.routes;
|
|
685
|
-
param.success(data, direction);
|
|
686
|
-
} else {
|
|
687
|
-
param.success(data);
|
|
688
|
-
}
|
|
689
|
-
},
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* 构造微信请求参数,公共属性处理
|
|
693
|
-
*
|
|
694
|
-
* @param {Object} param 接口参数
|
|
695
|
-
* @param {Object} param 配置项
|
|
696
|
-
* @param {String} feature 方法名
|
|
697
|
-
*/
|
|
698
|
-
buildWxRequestConfig(param, options, feature) {
|
|
699
|
-
var that = this;
|
|
700
|
-
options.header = { 'content-type': 'application/json' };
|
|
701
|
-
options.method = 'GET';
|
|
702
|
-
options.success = function (res) {
|
|
703
|
-
var data = res.data;
|
|
704
|
-
if (data.status === 0) {
|
|
705
|
-
that.handleData(param, data, feature);
|
|
706
|
-
} else {
|
|
707
|
-
param.fail(data);
|
|
708
|
-
}
|
|
709
|
-
};
|
|
710
|
-
options.fail = function (res) {
|
|
711
|
-
res.statusCode = ERROR_CONF.WX_ERR_CODE;
|
|
712
|
-
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
|
|
713
|
-
};
|
|
714
|
-
options.complete = function (res) {
|
|
715
|
-
var statusCode = +res.statusCode;
|
|
716
|
-
switch (statusCode) {
|
|
717
|
-
case ERROR_CONF.WX_ERR_CODE: {
|
|
718
|
-
param.complete(
|
|
719
|
-
that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)
|
|
720
|
-
);
|
|
721
|
-
break;
|
|
722
|
-
}
|
|
723
|
-
case ERROR_CONF.WX_OK_CODE: {
|
|
724
|
-
var data = res.data;
|
|
725
|
-
if (data.status === 0) {
|
|
726
|
-
param.complete(data);
|
|
727
|
-
} else {
|
|
728
|
-
param.complete(that.buildErrorConfig(data.status, data.message));
|
|
729
|
-
}
|
|
730
|
-
break;
|
|
731
|
-
}
|
|
732
|
-
default: {
|
|
733
|
-
param.complete(
|
|
734
|
-
that.buildErrorConfig(
|
|
735
|
-
ERROR_CONF.SYSTEM_ERR,
|
|
736
|
-
ERROR_CONF.SYSTEM_ERR_MSG
|
|
737
|
-
)
|
|
738
|
-
);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
return options;
|
|
743
|
-
},
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
* 处理用户参数是否传入坐标进行不同的处理
|
|
747
|
-
*/
|
|
748
|
-
locationProcess(param, locationsuccess, locationfail, locationcomplete) {
|
|
749
|
-
var that = this;
|
|
750
|
-
locationfail =
|
|
751
|
-
locationfail ||
|
|
752
|
-
function (res) {
|
|
753
|
-
res.statusCode = ERROR_CONF.WX_ERR_CODE;
|
|
754
|
-
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
|
|
755
|
-
};
|
|
756
|
-
locationcomplete =
|
|
757
|
-
locationcomplete ||
|
|
758
|
-
function (res) {
|
|
759
|
-
if (res.statusCode == ERROR_CONF.WX_ERR_CODE) {
|
|
760
|
-
param.complete(
|
|
761
|
-
that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
if (!param.location) {
|
|
766
|
-
that.getWXLocation(locationsuccess, locationfail, locationcomplete);
|
|
767
|
-
} else if (that.checkLocation(param)) {
|
|
768
|
-
var location = Utils.getLocationParam(param.location);
|
|
769
|
-
locationsuccess(location);
|
|
770
|
-
}
|
|
771
|
-
},
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
class QQMapWX {
|
|
775
|
-
/**
|
|
776
|
-
* 构造函数
|
|
777
|
-
*
|
|
778
|
-
* @param {Object} options 接口参数,key 为必选参数
|
|
779
|
-
*/
|
|
780
|
-
constructor(options) {
|
|
781
|
-
if (!options.key) {
|
|
782
|
-
throw Error('key值不能为空');
|
|
783
|
-
}
|
|
784
|
-
this.key = options.key;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* POI周边检索
|
|
789
|
-
*
|
|
790
|
-
* @param {Object} options 接口参数对象
|
|
791
|
-
*
|
|
792
|
-
* 参数对象结构可以参考
|
|
793
|
-
* @see http://lbs.qq.com/webservice_v1/guide-search.html
|
|
794
|
-
*/
|
|
795
|
-
search(options) {
|
|
796
|
-
var that = this;
|
|
797
|
-
options = options || {};
|
|
798
|
-
|
|
799
|
-
Utils.polyfillParam(options);
|
|
800
|
-
|
|
801
|
-
if (!Utils.checkKeyword(options)) {
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
var requestParam = {
|
|
806
|
-
keyword: options.keyword,
|
|
807
|
-
orderby: options.orderby || '_distance',
|
|
808
|
-
page_size: options.page_size || 10,
|
|
809
|
-
page_index: options.page_index || 1,
|
|
810
|
-
output: 'json',
|
|
811
|
-
key: that.key,
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
if (options.address_format) {
|
|
815
|
-
requestParam.address_format = options.address_format;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
if (options.filter) {
|
|
819
|
-
requestParam.filter = options.filter;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
var distance = options.distance || '1000';
|
|
823
|
-
var auto_extend = options.auto_extend || 1;
|
|
824
|
-
var region = null;
|
|
825
|
-
var rectangle = null;
|
|
826
|
-
|
|
827
|
-
//判断城市限定参数
|
|
828
|
-
if (options.region) {
|
|
829
|
-
region = options.region;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
//矩形限定坐标(暂时只支持字符串格式)
|
|
833
|
-
if (options.rectangle) {
|
|
834
|
-
rectangle = options.rectangle;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
var locationsuccess = function (result) {
|
|
838
|
-
if (region && !rectangle) {
|
|
839
|
-
//城市限定参数拼接
|
|
840
|
-
requestParam.boundary =
|
|
841
|
-
'region(' +
|
|
842
|
-
region +
|
|
843
|
-
',' +
|
|
844
|
-
auto_extend +
|
|
845
|
-
',' +
|
|
846
|
-
result.latitude +
|
|
847
|
-
',' +
|
|
848
|
-
result.longitude +
|
|
849
|
-
')';
|
|
850
|
-
if (options.sig) {
|
|
851
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'search');
|
|
852
|
-
}
|
|
853
|
-
} else if (rectangle && !region) {
|
|
854
|
-
//矩形搜索
|
|
855
|
-
requestParam.boundary = 'rectangle(' + rectangle + ')';
|
|
856
|
-
if (options.sig) {
|
|
857
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'search');
|
|
858
|
-
}
|
|
859
|
-
} else {
|
|
860
|
-
requestParam.boundary =
|
|
861
|
-
'nearby(' +
|
|
862
|
-
result.latitude +
|
|
863
|
-
',' +
|
|
864
|
-
result.longitude +
|
|
865
|
-
',' +
|
|
866
|
-
distance +
|
|
867
|
-
',' +
|
|
868
|
-
auto_extend +
|
|
869
|
-
')';
|
|
870
|
-
if (options.sig) {
|
|
871
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'search');
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
wx.request(
|
|
875
|
-
Utils.buildWxRequestConfig(
|
|
876
|
-
options,
|
|
877
|
-
{
|
|
878
|
-
url: URL_SEARCH,
|
|
879
|
-
data: requestParam,
|
|
880
|
-
},
|
|
881
|
-
'search'
|
|
882
|
-
)
|
|
883
|
-
);
|
|
884
|
-
};
|
|
885
|
-
Utils.locationProcess(options, locationsuccess);
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* sug模糊检索
|
|
890
|
-
*
|
|
891
|
-
* @param {Object} options 接口参数对象
|
|
892
|
-
*
|
|
893
|
-
* 参数对象结构可以参考
|
|
894
|
-
* http://lbs.qq.com/webservice_v1/guide-suggestion.html
|
|
895
|
-
*/
|
|
896
|
-
getSuggestion(options) {
|
|
897
|
-
var that = this;
|
|
898
|
-
options = options || {};
|
|
899
|
-
Utils.polyfillParam(options);
|
|
900
|
-
|
|
901
|
-
if (!Utils.checkKeyword(options)) {
|
|
902
|
-
return;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
var requestParam = {
|
|
906
|
-
keyword: options.keyword,
|
|
907
|
-
region: options.region || '全国',
|
|
908
|
-
region_fix: options.region_fix || 0,
|
|
909
|
-
policy: options.policy || 0,
|
|
910
|
-
page_size: options.page_size || 10, //控制显示条数
|
|
911
|
-
page_index: options.page_index || 1, //控制页数
|
|
912
|
-
get_subpois: options.get_subpois || 0, //返回子地点
|
|
913
|
-
output: 'json',
|
|
914
|
-
key: that.key,
|
|
915
|
-
};
|
|
916
|
-
//长地址
|
|
917
|
-
if (options.address_format) {
|
|
918
|
-
requestParam.address_format = options.address_format;
|
|
919
|
-
}
|
|
920
|
-
//过滤
|
|
921
|
-
if (options.filter) {
|
|
922
|
-
requestParam.filter = options.filter;
|
|
923
|
-
}
|
|
924
|
-
//排序
|
|
925
|
-
if (options.location) {
|
|
926
|
-
var locationsuccess = function (result) {
|
|
927
|
-
requestParam.location = result.latitude + ',' + result.longitude;
|
|
928
|
-
if (options.sig) {
|
|
929
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest');
|
|
930
|
-
}
|
|
931
|
-
wx.request(
|
|
932
|
-
Utils.buildWxRequestConfig(
|
|
933
|
-
options,
|
|
934
|
-
{
|
|
935
|
-
url: URL_SUGGESTION,
|
|
936
|
-
data: requestParam,
|
|
937
|
-
},
|
|
938
|
-
'suggest'
|
|
939
|
-
)
|
|
940
|
-
);
|
|
941
|
-
};
|
|
942
|
-
Utils.locationProcess(options, locationsuccess);
|
|
943
|
-
} else {
|
|
944
|
-
if (options.sig) {
|
|
945
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest');
|
|
946
|
-
}
|
|
947
|
-
wx.request(
|
|
948
|
-
Utils.buildWxRequestConfig(
|
|
949
|
-
options,
|
|
950
|
-
{
|
|
951
|
-
url: URL_SUGGESTION,
|
|
952
|
-
data: requestParam,
|
|
953
|
-
},
|
|
954
|
-
'suggest'
|
|
955
|
-
)
|
|
956
|
-
);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* 逆地址解析
|
|
962
|
-
*
|
|
963
|
-
* @param {Object} options 接口参数对象
|
|
964
|
-
*
|
|
965
|
-
* 请求参数结构可以参考
|
|
966
|
-
* http://lbs.qq.com/webservice_v1/guide-gcoder.html
|
|
967
|
-
*/
|
|
968
|
-
reverseGeocoder(options) {
|
|
969
|
-
var that = this;
|
|
970
|
-
options = options || {};
|
|
971
|
-
Utils.polyfillParam(options);
|
|
972
|
-
var requestParam = {
|
|
973
|
-
coord_type: options.coord_type || 5,
|
|
974
|
-
get_poi: options.get_poi || 0,
|
|
975
|
-
output: 'json',
|
|
976
|
-
key: that.key,
|
|
977
|
-
};
|
|
978
|
-
if (options.poi_options) {
|
|
979
|
-
requestParam.poi_options = options.poi_options;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
var locationsuccess = function (result) {
|
|
983
|
-
requestParam.location = result.latitude + ',' + result.longitude;
|
|
984
|
-
if (options.sig) {
|
|
985
|
-
requestParam.sig = Utils.getSig(
|
|
986
|
-
requestParam,
|
|
987
|
-
options.sig,
|
|
988
|
-
'reverseGeocoder'
|
|
989
|
-
);
|
|
990
|
-
}
|
|
991
|
-
wx.request(
|
|
992
|
-
Utils.buildWxRequestConfig(
|
|
993
|
-
options,
|
|
994
|
-
{
|
|
995
|
-
url: URL_GET_GEOCODER,
|
|
996
|
-
data: requestParam,
|
|
997
|
-
},
|
|
998
|
-
'reverseGeocoder'
|
|
999
|
-
)
|
|
1000
|
-
);
|
|
1001
|
-
};
|
|
1002
|
-
Utils.locationProcess(options, locationsuccess);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
/**
|
|
1006
|
-
* 地址解析
|
|
1007
|
-
*
|
|
1008
|
-
* @param {Object} options 接口参数对象
|
|
1009
|
-
*
|
|
1010
|
-
* 请求参数结构可以参考
|
|
1011
|
-
* http://lbs.qq.com/webservice_v1/guide-geocoder.html
|
|
1012
|
-
*/
|
|
1013
|
-
geocoder(options) {
|
|
1014
|
-
var that = this;
|
|
1015
|
-
options = options || {};
|
|
1016
|
-
Utils.polyfillParam(options);
|
|
1017
|
-
|
|
1018
|
-
if (Utils.checkParamKeyEmpty(options, 'address')) {
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
var requestParam = {
|
|
1023
|
-
address: options.address,
|
|
1024
|
-
output: 'json',
|
|
1025
|
-
key: that.key,
|
|
1026
|
-
};
|
|
1027
|
-
|
|
1028
|
-
//城市限定
|
|
1029
|
-
if (options.region) {
|
|
1030
|
-
requestParam.region = options.region;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
if (options.sig) {
|
|
1034
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder');
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
wx.request(
|
|
1038
|
-
Utils.buildWxRequestConfig(
|
|
1039
|
-
options,
|
|
1040
|
-
{
|
|
1041
|
-
url: URL_GET_GEOCODER,
|
|
1042
|
-
data: requestParam,
|
|
1043
|
-
},
|
|
1044
|
-
'geocoder'
|
|
1045
|
-
)
|
|
1046
|
-
);
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* 获取城市列表
|
|
1051
|
-
*
|
|
1052
|
-
* @param {Object} options 接口参数对象
|
|
1053
|
-
*
|
|
1054
|
-
* 请求参数结构可以参考
|
|
1055
|
-
* http://lbs.qq.com/webservice_v1/guide-region.html
|
|
1056
|
-
*/
|
|
1057
|
-
getCityList(options) {
|
|
1058
|
-
var that = this;
|
|
1059
|
-
options = options || {};
|
|
1060
|
-
Utils.polyfillParam(options);
|
|
1061
|
-
var requestParam = {
|
|
1062
|
-
output: 'json',
|
|
1063
|
-
key: that.key,
|
|
1064
|
-
};
|
|
1065
|
-
|
|
1066
|
-
if (options.sig) {
|
|
1067
|
-
requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList');
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
wx.request(
|
|
1071
|
-
Utils.buildWxRequestConfig(
|
|
1072
|
-
options,
|
|
1073
|
-
{
|
|
1074
|
-
url: URL_CITY_LIST,
|
|
1075
|
-
data: requestParam,
|
|
1076
|
-
},
|
|
1077
|
-
'getCityList'
|
|
1078
|
-
)
|
|
1079
|
-
);
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* 获取对应城市ID的区县列表
|
|
1084
|
-
*
|
|
1085
|
-
* @param {Object} options 接口参数对象
|
|
1086
|
-
*
|
|
1087
|
-
* 请求参数结构可以参考
|
|
1088
|
-
* http://lbs.qq.com/webservice_v1/guide-region.html
|
|
1089
|
-
*/
|
|
1090
|
-
getDistrictByCityId(options) {
|
|
1091
|
-
var that = this;
|
|
1092
|
-
options = options || {};
|
|
1093
|
-
Utils.polyfillParam(options);
|
|
1094
|
-
|
|
1095
|
-
if (Utils.checkParamKeyEmpty(options, 'id')) {
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
var requestParam = {
|
|
1100
|
-
id: options.id || '',
|
|
1101
|
-
output: 'json',
|
|
1102
|
-
key: that.key,
|
|
1103
|
-
};
|
|
1104
|
-
|
|
1105
|
-
if (options.sig) {
|
|
1106
|
-
requestParam.sig = Utils.getSig(
|
|
1107
|
-
requestParam,
|
|
1108
|
-
options.sig,
|
|
1109
|
-
'getDistrictByCityId'
|
|
1110
|
-
);
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
wx.request(
|
|
1114
|
-
Utils.buildWxRequestConfig(
|
|
1115
|
-
options,
|
|
1116
|
-
{
|
|
1117
|
-
url: URL_AREA_LIST,
|
|
1118
|
-
data: requestParam,
|
|
1119
|
-
},
|
|
1120
|
-
'getDistrictByCityId'
|
|
1121
|
-
)
|
|
1122
|
-
);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
* 用于单起点到多终点的路线距离(非直线距离)计算:
|
|
1127
|
-
* 支持两种距离计算方式:步行和驾车。
|
|
1128
|
-
* 起点到终点最大限制直线距离10公里。
|
|
1129
|
-
*
|
|
1130
|
-
* 新增直线距离计算。
|
|
1131
|
-
*
|
|
1132
|
-
* @param {Object} options 接口参数对象
|
|
1133
|
-
*
|
|
1134
|
-
* 请求参数结构可以参考
|
|
1135
|
-
* http://lbs.qq.com/webservice_v1/guide-distance.html
|
|
1136
|
-
*/
|
|
1137
|
-
calculateDistance(options) {
|
|
1138
|
-
var that = this;
|
|
1139
|
-
options = options || {};
|
|
1140
|
-
Utils.polyfillParam(options);
|
|
1141
|
-
|
|
1142
|
-
if (Utils.checkParamKeyEmpty(options, 'to')) {
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
var requestParam = {
|
|
1147
|
-
mode: options.mode || 'walking',
|
|
1148
|
-
to: Utils.location2query(options.to),
|
|
1149
|
-
output: 'json',
|
|
1150
|
-
key: that.key,
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
|
-
if (options.from) {
|
|
1154
|
-
options.location = options.from;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
//计算直线距离
|
|
1158
|
-
if (requestParam.mode == 'straight') {
|
|
1159
|
-
var locationsuccess = function (result) {
|
|
1160
|
-
var locationTo = Utils.getEndLocation(requestParam.to); //处理终点坐标
|
|
1161
|
-
var data = {
|
|
1162
|
-
message: 'query ok',
|
|
1163
|
-
result: {
|
|
1164
|
-
elements: [],
|
|
1165
|
-
},
|
|
1166
|
-
status: 0,
|
|
1167
|
-
};
|
|
1168
|
-
for (var i = 0; i < locationTo.length; i++) {
|
|
1169
|
-
data.result.elements.push({
|
|
1170
|
-
//将坐标存入
|
|
1171
|
-
distance: Utils.getDistance(
|
|
1172
|
-
result.latitude,
|
|
1173
|
-
result.longitude,
|
|
1174
|
-
locationTo[i].lat,
|
|
1175
|
-
locationTo[i].lng
|
|
1176
|
-
),
|
|
1177
|
-
duration: 0,
|
|
1178
|
-
from: {
|
|
1179
|
-
lat: result.latitude,
|
|
1180
|
-
lng: result.longitude,
|
|
1181
|
-
},
|
|
1182
|
-
to: {
|
|
1183
|
-
lat: locationTo[i].lat,
|
|
1184
|
-
lng: locationTo[i].lng,
|
|
1185
|
-
},
|
|
1186
|
-
});
|
|
1187
|
-
}
|
|
1188
|
-
var calculateResult = data.result.elements;
|
|
1189
|
-
var distanceResult = [];
|
|
1190
|
-
// eslint-disable-next-line no-redeclare
|
|
1191
|
-
for (var i = 0; i < calculateResult.length; i++) {
|
|
1192
|
-
distanceResult.push(calculateResult[i].distance);
|
|
1193
|
-
}
|
|
1194
|
-
return options.success(data, {
|
|
1195
|
-
calculateResult: calculateResult,
|
|
1196
|
-
distanceResult: distanceResult,
|
|
1197
|
-
});
|
|
1198
|
-
};
|
|
1199
|
-
|
|
1200
|
-
Utils.locationProcess(options, locationsuccess);
|
|
1201
|
-
} else {
|
|
1202
|
-
// eslint-disable-next-line no-redeclare
|
|
1203
|
-
var locationsuccess = function (result) {
|
|
1204
|
-
requestParam.from = result.latitude + ',' + result.longitude;
|
|
1205
|
-
if (options.sig) {
|
|
1206
|
-
requestParam.sig = Utils.getSig(
|
|
1207
|
-
requestParam,
|
|
1208
|
-
options.sig,
|
|
1209
|
-
'calculateDistance'
|
|
1210
|
-
);
|
|
1211
|
-
}
|
|
1212
|
-
wx.request(
|
|
1213
|
-
Utils.buildWxRequestConfig(
|
|
1214
|
-
options,
|
|
1215
|
-
{
|
|
1216
|
-
url: URL_DISTANCE,
|
|
1217
|
-
data: requestParam,
|
|
1218
|
-
},
|
|
1219
|
-
'calculateDistance'
|
|
1220
|
-
)
|
|
1221
|
-
);
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
|
-
Utils.locationProcess(options, locationsuccess);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
/**
|
|
1229
|
-
* 路线规划:
|
|
1230
|
-
*
|
|
1231
|
-
* @param {Object} options 接口参数对象
|
|
1232
|
-
*
|
|
1233
|
-
* 请求参数结构可以参考
|
|
1234
|
-
* https://lbs.qq.com/webservice_v1/guide-road.html
|
|
1235
|
-
*/
|
|
1236
|
-
direction(options) {
|
|
1237
|
-
var that = this;
|
|
1238
|
-
options = options || {};
|
|
1239
|
-
Utils.polyfillParam(options);
|
|
1240
|
-
|
|
1241
|
-
if (Utils.checkParamKeyEmpty(options, 'to')) {
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
var requestParam = {
|
|
1246
|
-
output: 'json',
|
|
1247
|
-
key: that.key,
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
|
-
//to格式处理
|
|
1251
|
-
if (typeof options.to == 'string') {
|
|
1252
|
-
requestParam.to = options.to;
|
|
1253
|
-
} else {
|
|
1254
|
-
requestParam.to = options.to.latitude + ',' + options.to.longitude;
|
|
1255
|
-
}
|
|
1256
|
-
//初始化局部请求域名
|
|
1257
|
-
var SET_URL_DIRECTION = null;
|
|
1258
|
-
//设置默认mode属性
|
|
1259
|
-
options.mode = options.mode || MODE.driving;
|
|
1260
|
-
|
|
1261
|
-
//设置请求域名
|
|
1262
|
-
SET_URL_DIRECTION = URL_DIRECTION + options.mode;
|
|
1263
|
-
|
|
1264
|
-
if (options.from) {
|
|
1265
|
-
options.location = options.from;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
if (options.mode == MODE.driving) {
|
|
1269
|
-
if (options.from_poi) {
|
|
1270
|
-
requestParam.from_poi = options.from_poi;
|
|
1271
|
-
}
|
|
1272
|
-
if (options.heading) {
|
|
1273
|
-
requestParam.heading = options.heading;
|
|
1274
|
-
}
|
|
1275
|
-
if (options.speed) {
|
|
1276
|
-
requestParam.speed = options.speed;
|
|
1277
|
-
}
|
|
1278
|
-
if (options.accuracy) {
|
|
1279
|
-
requestParam.accuracy = options.accuracy;
|
|
1280
|
-
}
|
|
1281
|
-
if (options.road_type) {
|
|
1282
|
-
requestParam.road_type = options.road_type;
|
|
1283
|
-
}
|
|
1284
|
-
if (options.to_poi) {
|
|
1285
|
-
requestParam.to_poi = options.to_poi;
|
|
1286
|
-
}
|
|
1287
|
-
if (options.from_track) {
|
|
1288
|
-
requestParam.from_track = options.from_track;
|
|
1289
|
-
}
|
|
1290
|
-
if (options.waypoints) {
|
|
1291
|
-
requestParam.waypoints = options.waypoints;
|
|
1292
|
-
}
|
|
1293
|
-
if (options.policy) {
|
|
1294
|
-
requestParam.policy = options.policy;
|
|
1295
|
-
}
|
|
1296
|
-
if (options.plate_number) {
|
|
1297
|
-
requestParam.plate_number = options.plate_number;
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
if (options.mode == MODE.transit) {
|
|
1302
|
-
if (options.departure_time) {
|
|
1303
|
-
requestParam.departure_time = options.departure_time;
|
|
1304
|
-
}
|
|
1305
|
-
if (options.policy) {
|
|
1306
|
-
requestParam.policy = options.policy;
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
var locationsuccess = function (result) {
|
|
1311
|
-
requestParam.from = result.latitude + ',' + result.longitude;
|
|
1312
|
-
if (options.sig) {
|
|
1313
|
-
requestParam.sig = Utils.getSig(
|
|
1314
|
-
requestParam,
|
|
1315
|
-
options.sig,
|
|
1316
|
-
'direction',
|
|
1317
|
-
options.mode
|
|
1318
|
-
);
|
|
1319
|
-
}
|
|
1320
|
-
wx.request(
|
|
1321
|
-
Utils.buildWxRequestConfig(
|
|
1322
|
-
options,
|
|
1323
|
-
{
|
|
1324
|
-
url: SET_URL_DIRECTION,
|
|
1325
|
-
data: requestParam,
|
|
1326
|
-
},
|
|
1327
|
-
'direction'
|
|
1328
|
-
)
|
|
1329
|
-
);
|
|
1330
|
-
};
|
|
1331
|
-
|
|
1332
|
-
Utils.locationProcess(options, locationsuccess);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
module.exports = QQMapWX;
|