@cloudbase/weda-ui 0.2.15 → 0.2.16
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/package.json +10 -7
- package/src/configs/components/calendar.json +75 -0
- package/src/configs/components/carousel.json +273 -0
- package/src/configs/components/chart/statisticsCard.json +331 -0
- package/src/configs/components/dataView.json +139 -0
- package/src/configs/components/form/location.json +152 -0
- package/src/configs/components/form/uploaderFile.json +2 -1
- package/src/configs/components/graphicCard.json +399 -0
- package/src/configs/components/link.json +2 -2
- package/src/configs/components/listView.json +230 -0
- package/src/configs/components/navLayout.json +350 -0
- package/src/configs/components/swiper.json +3 -3
- package/src/configs/index.js +16 -0
- package/src/mp/components/button/index.js +12 -13
- package/src/mp/components/button/index.wxml +1 -1
- package/src/mp/components/calendar/arrowright--line.svg +11 -0
- package/src/mp/components/calendar/index.js +238 -0
- package/src/mp/components/calendar/index.json +4 -0
- package/src/mp/components/calendar/index.wxml +37 -0
- package/src/mp/components/calendar/index.wxss +178 -0
- package/src/mp/components/carousel/index.js +88 -0
- package/src/mp/components/carousel/index.json +7 -0
- package/src/mp/components/carousel/index.wxml +6 -0
- package/src/mp/components/chart/statisticsCard/index.js +226 -0
- package/src/mp/components/chart/statisticsCard/index.json +4 -0
- package/src/mp/components/chart/statisticsCard/index.wxml +9 -0
- package/src/mp/components/chart/statisticsCard/index.wxss +45 -0
- package/src/mp/components/dataView/index.js +34 -0
- package/src/mp/components/dataView/index.json +7 -0
- package/src/mp/components/dataView/index.wxml +15 -0
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/location/components/mapChoose/index.js +201 -0
- package/src/mp/components/form/location/components/mapChoose/index.json +4 -0
- package/src/mp/components/form/location/components/mapChoose/index.wxml +42 -0
- package/src/mp/components/form/location/components/mapChoose/index.wxss +188 -0
- package/src/mp/components/form/location/index.js +341 -0
- package/src/mp/components/form/location/index.json +6 -0
- package/src/mp/components/form/location/index.wxml +25 -0
- package/src/mp/components/form/location/index.wxss +91 -0
- package/src/mp/components/form/uploader/index.js +39 -35
- package/src/mp/components/form/uploaderFile/index.js +61 -14
- package/src/mp/components/graphicCard/chevron-right.svg +3 -0
- package/src/mp/components/graphicCard/index.js +205 -0
- package/src/mp/components/graphicCard/index.json +4 -0
- package/src/mp/components/graphicCard/index.wxml +29 -0
- package/src/mp/components/graphicCard/index.wxss +157 -0
- package/src/mp/components/image/index.js +0 -1
- package/src/mp/components/listView/arrow-right-line.svg +3 -0
- package/src/mp/components/listView/index.js +286 -0
- package/src/mp/components/listView/index.json +4 -0
- package/src/mp/components/listView/index.wxml +40 -0
- package/src/mp/components/listView/index.wxss +150 -0
- package/src/mp/components/listView/more-line.svg +3 -0
- package/src/mp/components/navLayout/index.js +123 -0
- package/src/mp/components/navLayout/index.json +7 -0
- package/src/mp/components/navLayout/index.wxml +25 -0
- package/src/mp/components/navLayout/index.wxss +1193 -0
- package/src/mp/components/swiper/index.wxml +2 -0
- package/src/mp/index.json +9 -1
- package/src/mp/utils/debounce.js +133 -0
- package/src/mp/utils/dr_square_point.js +25 -0
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +1336 -0
- package/src/mp/utils/spark-md5.js +776 -0
- package/src/mp/utils/tcb.js +18 -0
- package/src/web/components/calendar/index.css +382 -0
- package/src/web/components/calendar/index.jsx +312 -0
- package/src/web/components/calendar/util.js +90 -0
- package/src/web/components/carousel/index.css +119 -0
- package/src/web/components/carousel/index.tsx +417 -0
- package/src/web/components/chart/statisticsCard/index.css +62 -0
- package/src/web/components/chart/statisticsCard/index.tsx +286 -0
- package/src/web/components/chart/statisticsCard/interface.ts +14 -0
- package/src/web/components/dataView/index.tsx +20 -0
- package/src/web/components/dataView/interface.ts +6 -0
- package/src/web/components/form/location/common/mapChoose.css +178 -0
- package/src/web/components/form/location/common/mapChoose.jsx +343 -0
- package/src/web/components/form/location/common/mapView.jsx +190 -0
- package/src/web/components/form/location/common/propsConfig.js +54 -0
- package/src/web/components/form/location/common/selectModal.css +44 -0
- package/src/web/components/form/location/common/selectModal.jsx +82 -0
- package/src/web/components/form/location/common/useLocationInfo.js +100 -0
- package/src/web/components/form/location/components/LocationH5/index.css +243 -0
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +403 -0
- package/src/web/components/form/location/components/LocationPC/Header.jsx +109 -0
- package/src/web/components/form/location/components/LocationPC/index.css +44 -0
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +323 -0
- package/src/web/components/form/location/constants.js +4 -0
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +25 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +16 -10
- package/src/web/components/form/uploader/uploader.pc.tsx +15 -11
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +122 -107
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +22 -19
- package/src/web/components/graphicCard/index.css +163 -0
- package/src/web/components/graphicCard/index.tsx +309 -0
- package/src/web/components/image/image.tsx +0 -1
- package/src/web/components/index.js +12 -0
- package/src/web/components/listView/arrow-right-line.svg +3 -0
- package/src/web/components/listView/index.css +139 -0
- package/src/web/components/listView/index.tsx +354 -0
- package/src/web/components/listView/interface.ts +98 -0
- package/src/web/components/navLayout/index.css +332 -0
- package/src/web/components/navLayout/index.tsx +247 -0
- package/src/web/components/tabs/index.tsx +2 -2
- package/src/web/components/tabs/tabs.h5.tsx +7 -4
- package/src/web/components/uploaderFileView/index.css +9 -9
- package/src/web/components/uploaderFileView/index.jsx +32 -23
- package/src/web/types.d.ts +15 -14
- package/src/web/utils/debounce.js +98 -0
- package/src/web/utils/platform.js +31 -0
- package/src/web/utils/tcb.js +35 -0
- package/src/web/utils/tmap.js +4 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const { useEffect, useState, useRef } = React;
|
|
3
|
+
|
|
4
|
+
export default function useLocationInfo({
|
|
5
|
+
apiKey: APIKEY,
|
|
6
|
+
locationType,
|
|
7
|
+
eventsChange,
|
|
8
|
+
dataSourceStatus,
|
|
9
|
+
}) {
|
|
10
|
+
const [location, setLocation] = useState({
|
|
11
|
+
poiname: '',
|
|
12
|
+
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
13
|
+
});
|
|
14
|
+
const [apiKeyStatus, setApiKeyStatus] = useState({
|
|
15
|
+
status: false,
|
|
16
|
+
message: '"地图定位组件"需进行地图配置,请检查',
|
|
17
|
+
});
|
|
18
|
+
const [currentLocStatus, setCurrentLocStatus] = useState(false);
|
|
19
|
+
const locationPlugRef = useRef();
|
|
20
|
+
const currentLocations = useRef();
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!dataSourceStatus || !APIKEY || APIKEY == '这里是示例') return;
|
|
23
|
+
function loadScript() {
|
|
24
|
+
// 移除之前的
|
|
25
|
+
if (document.getElementById('form-location-plug')) {
|
|
26
|
+
document.body.removeChild(
|
|
27
|
+
document.getElementById('form-location-plug')
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const script = document.createElement('script');
|
|
31
|
+
script.type = 'text/javascript';
|
|
32
|
+
script.src = `https://apis.map.qq.com/tools/geolocation/min?key=${APIKEY}&referer=myapp`;
|
|
33
|
+
script.setAttribute('id', 'form-location-plug');
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
locationPlugRef.current = 'form-location-plug';
|
|
36
|
+
script.onload = () => {
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
let geolocation = new window.qq.maps.Geolocation();
|
|
39
|
+
geolocation.getIpLocation(
|
|
40
|
+
({ city, lat, lng, addr }) => {
|
|
41
|
+
let locations = {
|
|
42
|
+
poiname: city + addr,
|
|
43
|
+
latlng: { lat, lng },
|
|
44
|
+
locationType,
|
|
45
|
+
};
|
|
46
|
+
setLocation(locations);
|
|
47
|
+
eventsChange &&
|
|
48
|
+
eventsChange(
|
|
49
|
+
{
|
|
50
|
+
poiname: city + addr,
|
|
51
|
+
latitude: lat,
|
|
52
|
+
longitude: lng,
|
|
53
|
+
},
|
|
54
|
+
locationType === 1
|
|
55
|
+
);
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
currentLocations.current = locations;
|
|
58
|
+
setApiKeyStatus({ status: true, message: '' });
|
|
59
|
+
setCurrentLocStatus(true);
|
|
60
|
+
},
|
|
61
|
+
(error) => {
|
|
62
|
+
console.log('error loc', error);
|
|
63
|
+
currentLocations.current = null;
|
|
64
|
+
setApiKeyStatus({
|
|
65
|
+
status: false,
|
|
66
|
+
message:
|
|
67
|
+
error.code === 1
|
|
68
|
+
? '请打开定位权限'
|
|
69
|
+
: error.message || '定位失败',
|
|
70
|
+
});
|
|
71
|
+
setCurrentLocStatus(false);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
script.onerror = (error) => {
|
|
76
|
+
console.log('Geolocation script onerror', error);
|
|
77
|
+
setApiKeyStatus({
|
|
78
|
+
status: false,
|
|
79
|
+
message: '定位失败',
|
|
80
|
+
});
|
|
81
|
+
setLocation({
|
|
82
|
+
poiname: '',
|
|
83
|
+
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
locationType,
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
document.body.appendChild(script);
|
|
89
|
+
}
|
|
90
|
+
loadScript();
|
|
91
|
+
}, [APIKEY, locationType]);
|
|
92
|
+
return {
|
|
93
|
+
location,
|
|
94
|
+
setLocation,
|
|
95
|
+
apiKeyStatus,
|
|
96
|
+
setApiKeyStatus,
|
|
97
|
+
currentLocStatus,
|
|
98
|
+
currentLocations,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
.weda-ui_form-location {
|
|
2
|
+
padding: 1.14286rem 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.form-location-warp {
|
|
6
|
+
display: flex;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.form-location-label {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: 0 1.14286rem;
|
|
14
|
+
}
|
|
15
|
+
.form-location-label > span {
|
|
16
|
+
margin-right: 0.28571rem;
|
|
17
|
+
font-family: SimSun;
|
|
18
|
+
font-size: 0.85714rem;
|
|
19
|
+
color: #f60;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.form-location-con {
|
|
23
|
+
padding-left: 1.14286rem;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
.form-location-con > img {
|
|
28
|
+
width: 18px;
|
|
29
|
+
height: 18px;
|
|
30
|
+
}
|
|
31
|
+
.form-location-con > span {
|
|
32
|
+
color: #006eff;
|
|
33
|
+
margin-left: 8px;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.form-location-con_disabled {
|
|
38
|
+
cursor: not-allowed !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.form-location-addr {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
margin-top: 12px;
|
|
45
|
+
padding-left: 1.14286rem;
|
|
46
|
+
padding-right: 1.14286rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.form-location-addr-title {
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
}
|
|
52
|
+
.form-location-addr-lat {
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
color: rgba(0, 0, 0, 0.4);
|
|
55
|
+
line-height: 20px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.form-location-addr > img {
|
|
59
|
+
width: 19px;
|
|
60
|
+
height: 19px;
|
|
61
|
+
}
|
|
62
|
+
.form-location-addr > div {
|
|
63
|
+
margin-left: 12px;
|
|
64
|
+
}
|
|
65
|
+
.form-map-container {
|
|
66
|
+
margin-top: 12px;
|
|
67
|
+
padding-left: 1.14286rem;
|
|
68
|
+
padding-right: 1.14286rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.form-select-map .tea-dialog__inner {
|
|
72
|
+
width: 100vw !important;
|
|
73
|
+
height: 100vh !important;
|
|
74
|
+
min-width: auto !important;
|
|
75
|
+
padding: 0;
|
|
76
|
+
}
|
|
77
|
+
.form-select-map .tea-dialog__header {
|
|
78
|
+
height: 30px;
|
|
79
|
+
margin-bottom: 0;
|
|
80
|
+
margin-left: 15px;
|
|
81
|
+
margin-right: 15px;
|
|
82
|
+
}
|
|
83
|
+
.form-select-map .tea-dialog__header .tea-dialog__headertitle {
|
|
84
|
+
line-height: 30px;
|
|
85
|
+
margin-bottom: 0;
|
|
86
|
+
}
|
|
87
|
+
.form-select-map .tea-dialog__body {
|
|
88
|
+
height: calc(100vh - 90px);
|
|
89
|
+
}
|
|
90
|
+
.form-select-map .tea-dialog__footer {
|
|
91
|
+
height: 30px;
|
|
92
|
+
margin-top: 10px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* mapChoose组件 */
|
|
96
|
+
.weda-ui_map-choose {
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
}
|
|
100
|
+
.map-choose-header {
|
|
101
|
+
width: 100%;
|
|
102
|
+
padding: 8px 15px;
|
|
103
|
+
position: relative;
|
|
104
|
+
border-bottom: 1px solid #d3d3d3;
|
|
105
|
+
}
|
|
106
|
+
.map-choose-header_focus {
|
|
107
|
+
padding-right: 60px;
|
|
108
|
+
}
|
|
109
|
+
.map-choose-header_focus .map-choose-header_search_cancel {
|
|
110
|
+
display: block;
|
|
111
|
+
}
|
|
112
|
+
.map-choose-header_focus .map-choose-header_search_place {
|
|
113
|
+
left: 10px;
|
|
114
|
+
transform: translate(0, 0);
|
|
115
|
+
}
|
|
116
|
+
.map-choose-header_search {
|
|
117
|
+
height: 30px;
|
|
118
|
+
background-color: #ebebeb;
|
|
119
|
+
padding-left: 10px;
|
|
120
|
+
padding-right: 10px;
|
|
121
|
+
color: #b4b4b4;
|
|
122
|
+
font-size: 15px;
|
|
123
|
+
line-height: 31px;
|
|
124
|
+
border-radius: 5px;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
position: relative;
|
|
129
|
+
}
|
|
130
|
+
.map-choose-header_search_place {
|
|
131
|
+
position: absolute;
|
|
132
|
+
top: 0;
|
|
133
|
+
left: 50%;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
transform: translate(-50%, 0);
|
|
137
|
+
}
|
|
138
|
+
.map-choose-header_search_cancel {
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 0;
|
|
141
|
+
right: 0;
|
|
142
|
+
width: 55px;
|
|
143
|
+
height: 46px;
|
|
144
|
+
line-height: 46px;
|
|
145
|
+
text-align: center;
|
|
146
|
+
font-size: 16px;
|
|
147
|
+
color: #0079ff;
|
|
148
|
+
background-color: #fff;
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
display: none;
|
|
151
|
+
}
|
|
152
|
+
.map-choose-header_search img {
|
|
153
|
+
width: 16px;
|
|
154
|
+
height: 16px;
|
|
155
|
+
margin-right: 4px;
|
|
156
|
+
}
|
|
157
|
+
.map-choose-header_search input {
|
|
158
|
+
display: block;
|
|
159
|
+
width: 100%;
|
|
160
|
+
padding-top: 6px;
|
|
161
|
+
padding-bottom: 6px;
|
|
162
|
+
border: 0;
|
|
163
|
+
font-size: 14px;
|
|
164
|
+
line-height: 18px;
|
|
165
|
+
background: 0 0;
|
|
166
|
+
position: relative;
|
|
167
|
+
z-index: 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.map-choose-con {
|
|
171
|
+
width: 100%;
|
|
172
|
+
height: calc(100% - 50px);
|
|
173
|
+
position: relative;
|
|
174
|
+
}
|
|
175
|
+
.map-choose-warp,
|
|
176
|
+
.map-choose-explore {
|
|
177
|
+
width: 100%;
|
|
178
|
+
height: 100%;
|
|
179
|
+
}
|
|
180
|
+
.map-choose-explore {
|
|
181
|
+
display: none;
|
|
182
|
+
}
|
|
183
|
+
.map-choose-explore_show {
|
|
184
|
+
display: block;
|
|
185
|
+
position: absolute;
|
|
186
|
+
z-index: 1000;
|
|
187
|
+
top: 0;
|
|
188
|
+
left: 0;
|
|
189
|
+
background-color: #fff;
|
|
190
|
+
overflow: hidden;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.map-choose-warp_sugges {
|
|
194
|
+
height: 55%;
|
|
195
|
+
width: 100%;
|
|
196
|
+
}
|
|
197
|
+
.map-choose-warp_sugges ul,
|
|
198
|
+
.map-choose-explore_show ul {
|
|
199
|
+
width: 100%;
|
|
200
|
+
height: 100%;
|
|
201
|
+
padding: 0 15px;
|
|
202
|
+
overflow: scroll;
|
|
203
|
+
}
|
|
204
|
+
.map-choose-warp_sugges li,
|
|
205
|
+
.map-choose-explore_show li {
|
|
206
|
+
width: 100%;
|
|
207
|
+
height: 59px;
|
|
208
|
+
padding-top: 6px;
|
|
209
|
+
position: relative;
|
|
210
|
+
border-bottom: 1px solid #d3d3d3;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
position: relative;
|
|
213
|
+
}
|
|
214
|
+
.map-choose-warp_sugges li span {
|
|
215
|
+
display: none;
|
|
216
|
+
}
|
|
217
|
+
.map-choose-warp_sugges_choosed span {
|
|
218
|
+
position: absolute;
|
|
219
|
+
right: 20px;
|
|
220
|
+
top: 50%;
|
|
221
|
+
transform: translate(0, -50%);
|
|
222
|
+
width: 16px;
|
|
223
|
+
height: 16px;
|
|
224
|
+
display: block !important;
|
|
225
|
+
background-image: url('https://qcloudimg.tencent-cloud.cn/raw/354c15c0cb845120ac3e9c474e6737b3.png');
|
|
226
|
+
background-size: 100% 100%;
|
|
227
|
+
background-repeat: no-repeat;
|
|
228
|
+
}
|
|
229
|
+
.map-choose-warp_sugges li div,
|
|
230
|
+
.map-choose-explore_show li div {
|
|
231
|
+
text-overflow: ellipsis;
|
|
232
|
+
white-space: nowrap;
|
|
233
|
+
overflow: hidden;
|
|
234
|
+
width: 98%;
|
|
235
|
+
}
|
|
236
|
+
.map-choose-warp_sugges_title,
|
|
237
|
+
.map-choose-explore_title {
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
line-height: 27px;
|
|
240
|
+
color: #333;
|
|
241
|
+
font-weight: 400;
|
|
242
|
+
display: block;
|
|
243
|
+
}
|