@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,188 @@
|
|
|
1
|
+
/* components/mapChoose/index.wxss */
|
|
2
|
+
.map-choose {
|
|
3
|
+
position: fixed;
|
|
4
|
+
z-index: 100;
|
|
5
|
+
width: 100vw;
|
|
6
|
+
height: 100vh;
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
left: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.map-choose-footer {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: self-start;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
height: 60px;
|
|
17
|
+
padding-top: 8px;
|
|
18
|
+
left: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.map-choose-footer button {
|
|
25
|
+
width: 90px;
|
|
26
|
+
margin: 0 10px;
|
|
27
|
+
font-weight: normal;
|
|
28
|
+
color: #006eff;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
border-radius: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.map-choose-footer button:nth-child(1) {
|
|
34
|
+
background-color: #006eff;
|
|
35
|
+
color: #fff;
|
|
36
|
+
}
|
|
37
|
+
.map-choose-footer button:nth-child(2) {
|
|
38
|
+
border: 1px solid #cfd5de;
|
|
39
|
+
background-color: #fff;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.map-choose-header {
|
|
43
|
+
height: 30px;
|
|
44
|
+
margin: 0 20px;
|
|
45
|
+
line-height: 30px;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
position: relative;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.cross {
|
|
51
|
+
width: 20px;
|
|
52
|
+
height: 20px;
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 51%;
|
|
55
|
+
right: 0;
|
|
56
|
+
transform: translate(0, -48%);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cross::before,
|
|
60
|
+
.cross::after {
|
|
61
|
+
content: '';
|
|
62
|
+
width: 2px;
|
|
63
|
+
height: 18px;
|
|
64
|
+
background: #93979b;
|
|
65
|
+
position: absolute;
|
|
66
|
+
right: 10px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.cross::before {
|
|
70
|
+
transform: rotate(45deg);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.cross::after {
|
|
74
|
+
transform: rotate(-45deg);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.map-choose-body {
|
|
78
|
+
height: calc(100% - 98px);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.map-choose-body-saerch {
|
|
82
|
+
padding: 8px 20px;
|
|
83
|
+
position: relative;
|
|
84
|
+
border-bottom: 1px solid #d3d3d3;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.map-choose-header_search_input {
|
|
88
|
+
height: 30px;
|
|
89
|
+
background-color: #ebebeb;
|
|
90
|
+
padding-left: 10px;
|
|
91
|
+
padding-right: 10px;
|
|
92
|
+
color: #b4b4b4;
|
|
93
|
+
font-size: 15px;
|
|
94
|
+
line-height: 31px;
|
|
95
|
+
border-radius: 5px;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
position: relative;
|
|
100
|
+
display: flex;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.map-choose-header_search_input_value {
|
|
104
|
+
padding-right: 60px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.map-choose-header_search_input input {
|
|
108
|
+
height: 30px;
|
|
109
|
+
line-height: 30px;
|
|
110
|
+
width: 100%;
|
|
111
|
+
position: relative;
|
|
112
|
+
z-index: 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.map-choose-header_search_input_cancle {
|
|
116
|
+
color: #006eff;
|
|
117
|
+
position: absolute;
|
|
118
|
+
height: 30px;
|
|
119
|
+
line-height: 30px;
|
|
120
|
+
top: 8px;
|
|
121
|
+
right: 20px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.map-choose-header_search_place {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 0;
|
|
127
|
+
left: 50%;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
transform: translate(-50%, 0);
|
|
131
|
+
}
|
|
132
|
+
.map-choose-header_search_place image {
|
|
133
|
+
width: 14px;
|
|
134
|
+
height: 14px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.map-choose-search,
|
|
138
|
+
.map-choose-explore {
|
|
139
|
+
width: 100%;
|
|
140
|
+
height: calc(100% - 47px);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.map-choose-explore_ul {
|
|
144
|
+
height: calc(100% - 200px);
|
|
145
|
+
overflow-y: scroll;
|
|
146
|
+
padding: 0 20px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.map-choose-search_ul {
|
|
150
|
+
height: 100%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.map-choose-explore_li {
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 46px;
|
|
156
|
+
padding-top: 6px;
|
|
157
|
+
position: relative;
|
|
158
|
+
border-bottom: 1px solid #d3d3d3;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
position: relative;
|
|
161
|
+
font-size: 12px;
|
|
162
|
+
padding-bottom: 3px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.map-choose-explore_li_arow {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.map-choose-explore_li_choosed .map-choose-explore_li_arow {
|
|
170
|
+
display: block;
|
|
171
|
+
position: absolute;
|
|
172
|
+
right: 20px;
|
|
173
|
+
top: 50%;
|
|
174
|
+
transform: translate(0, -50%);
|
|
175
|
+
width: 16px;
|
|
176
|
+
height: 16px;
|
|
177
|
+
display: block !important;
|
|
178
|
+
background-image: url('https://qcloudimg.tencent-cloud.cn/raw/354c15c0cb845120ac3e9c474e6737b3.png');
|
|
179
|
+
background-size: 100% 100%;
|
|
180
|
+
background-repeat: no-repeat;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.map-choose-explore_li_con {
|
|
184
|
+
width: 98%;
|
|
185
|
+
text-overflow: ellipsis;
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
overflow: hidden;
|
|
188
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
/**
|
|
3
|
+
* 组件的属性列表
|
|
4
|
+
*/
|
|
5
|
+
properties: {
|
|
6
|
+
className: {
|
|
7
|
+
type: String,
|
|
8
|
+
value: '',
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
type: String,
|
|
12
|
+
value: '',
|
|
13
|
+
},
|
|
14
|
+
label: {
|
|
15
|
+
type: String,
|
|
16
|
+
value: '标题',
|
|
17
|
+
},
|
|
18
|
+
labelVisible: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
value: true,
|
|
21
|
+
},
|
|
22
|
+
source: {
|
|
23
|
+
type: String,
|
|
24
|
+
value: '',
|
|
25
|
+
},
|
|
26
|
+
showLngLat: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
value: true,
|
|
29
|
+
},
|
|
30
|
+
showMap: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
value: true,
|
|
33
|
+
},
|
|
34
|
+
defauleShowLocation: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
value: true,
|
|
37
|
+
},
|
|
38
|
+
drag: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
value: true,
|
|
41
|
+
},
|
|
42
|
+
zoom: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
value: true,
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
value: false,
|
|
49
|
+
},
|
|
50
|
+
requiredFlag: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
value: true,
|
|
53
|
+
},
|
|
54
|
+
value: {
|
|
55
|
+
type: Object,
|
|
56
|
+
value: {
|
|
57
|
+
latitude: 39.98410411,
|
|
58
|
+
longitude: 116.307503,
|
|
59
|
+
poiname: '',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
locationType: {
|
|
63
|
+
type: Number,
|
|
64
|
+
value: 1,
|
|
65
|
+
},
|
|
66
|
+
customLocation: {
|
|
67
|
+
type: Object,
|
|
68
|
+
value: {
|
|
69
|
+
latitude: 22.540366,
|
|
70
|
+
longitude: 113.934559,
|
|
71
|
+
poiname: '深圳市南山区深南大道10000号腾讯大厦',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
lifetimes: {
|
|
77
|
+
attached: function () {
|
|
78
|
+
const wxClientApi = wx;
|
|
79
|
+
const apiName = [
|
|
80
|
+
'g',
|
|
81
|
+
'e',
|
|
82
|
+
't',
|
|
83
|
+
'L',
|
|
84
|
+
'o',
|
|
85
|
+
'c',
|
|
86
|
+
'a',
|
|
87
|
+
't',
|
|
88
|
+
'i',
|
|
89
|
+
'o',
|
|
90
|
+
'n',
|
|
91
|
+
].join('');
|
|
92
|
+
|
|
93
|
+
// 在组件实例进入页面节点树时执行
|
|
94
|
+
const getCurrentLocation = (locationType) => {
|
|
95
|
+
wxClientApi[apiName]({
|
|
96
|
+
isHighAccuracy: true, //高精度定位
|
|
97
|
+
success: (res) => {
|
|
98
|
+
let { latitude, longitude } = res;
|
|
99
|
+
let location = {
|
|
100
|
+
latitude,
|
|
101
|
+
longitude,
|
|
102
|
+
poiname: '',
|
|
103
|
+
};
|
|
104
|
+
let marker = {
|
|
105
|
+
id: 887,
|
|
106
|
+
latitude,
|
|
107
|
+
longitude,
|
|
108
|
+
width: 25,
|
|
109
|
+
height: 35,
|
|
110
|
+
};
|
|
111
|
+
this.setData({
|
|
112
|
+
location,
|
|
113
|
+
markers: [marker],
|
|
114
|
+
currentLocations: location,
|
|
115
|
+
currentPosition: {
|
|
116
|
+
status: true,
|
|
117
|
+
message: '',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
this.setLocation(location);
|
|
121
|
+
if (locationType === 1) {
|
|
122
|
+
this.triggerEvent('change', {
|
|
123
|
+
value: null,
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
this.setData({
|
|
127
|
+
isAddrShow: true,
|
|
128
|
+
});
|
|
129
|
+
this.changeValueFormat(location);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
fail: ({ errMsg }) => {
|
|
133
|
+
console.log('getlocation', errMsg);
|
|
134
|
+
let currentPositionMsg = errMsg;
|
|
135
|
+
this.triggerEvent('change', {
|
|
136
|
+
value: null,
|
|
137
|
+
});
|
|
138
|
+
if (
|
|
139
|
+
errMsg ===
|
|
140
|
+
'getLocation:fail 频繁调用会增加电量损耗,可考虑使用 wx.onLocationChange 监听地理位置变化'
|
|
141
|
+
) {
|
|
142
|
+
currentPositionMsg = '频繁获取当前定位会增加电量损耗请稍后再选择';
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
getCurrentLocation(locationType);
|
|
145
|
+
}, 3000);
|
|
146
|
+
}
|
|
147
|
+
this.setData({
|
|
148
|
+
currentPosition: {
|
|
149
|
+
status: false,
|
|
150
|
+
message: currentPositionMsg,
|
|
151
|
+
},
|
|
152
|
+
currentLocations: {},
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
const { locationType, customLocation } = this.properties;
|
|
158
|
+
if (locationType === 1 || locationType === 2) {
|
|
159
|
+
getCurrentLocation(locationType);
|
|
160
|
+
} else if (locationType === 3) {
|
|
161
|
+
this.setData({
|
|
162
|
+
currentPosition: {
|
|
163
|
+
status: true,
|
|
164
|
+
message: '',
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
if (this.checkCustomLocation(customLocation)) {
|
|
168
|
+
wx.showToast({
|
|
169
|
+
icon: 'none',
|
|
170
|
+
title: '位置输入格式错误 请检查',
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
} else {
|
|
174
|
+
this.setLocation(customLocation);
|
|
175
|
+
this.changeValueFormat(customLocation);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
detached: function () {
|
|
180
|
+
// 在组件实例被从页面节点树移除时执行
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* 组件的初始数据
|
|
186
|
+
*/
|
|
187
|
+
data: {
|
|
188
|
+
location: {
|
|
189
|
+
latitude: 39.98410411,
|
|
190
|
+
longitude: 116.307503,
|
|
191
|
+
poiname: '',
|
|
192
|
+
},
|
|
193
|
+
markers: [],
|
|
194
|
+
isAddrShow: false,
|
|
195
|
+
currentPosition: {
|
|
196
|
+
status: false,
|
|
197
|
+
message: '获取当前定位中',
|
|
198
|
+
},
|
|
199
|
+
currentLocations: {},
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 组件的方法列表
|
|
204
|
+
*/
|
|
205
|
+
methods: {
|
|
206
|
+
chooseSite() {
|
|
207
|
+
let { latitude, longitude } = this.data.location;
|
|
208
|
+
let currentPosition = this.data.currentPosition;
|
|
209
|
+
if (this.properties.disabled || !currentPosition.status) {
|
|
210
|
+
return wx.showToast({
|
|
211
|
+
icon: 'none',
|
|
212
|
+
title: currentPosition.status ? '已禁用' : currentPosition.message,
|
|
213
|
+
duration: 2000,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
const wxClientApi = wx;
|
|
217
|
+
const apiName = [
|
|
218
|
+
'c',
|
|
219
|
+
'h',
|
|
220
|
+
'o',
|
|
221
|
+
'o',
|
|
222
|
+
's',
|
|
223
|
+
'e',
|
|
224
|
+
'L',
|
|
225
|
+
'o',
|
|
226
|
+
'c',
|
|
227
|
+
'a',
|
|
228
|
+
't',
|
|
229
|
+
'i',
|
|
230
|
+
'o',
|
|
231
|
+
'n',
|
|
232
|
+
].join('');
|
|
233
|
+
wxClientApi[apiName]({
|
|
234
|
+
latitude,
|
|
235
|
+
longitude,
|
|
236
|
+
success: (res) => {
|
|
237
|
+
if (res.name) {
|
|
238
|
+
this.changeLocation({
|
|
239
|
+
...res,
|
|
240
|
+
poiname: res.name,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
fail: (err) => {
|
|
245
|
+
console.log('chooseLocation err', err);
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
changeLocation(location) {
|
|
250
|
+
let isAddrShow = this.data.isAddrShow;
|
|
251
|
+
if (!isAddrShow) {
|
|
252
|
+
this.setData({
|
|
253
|
+
isAddrShow: true,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
let marker = {
|
|
257
|
+
id: 887,
|
|
258
|
+
latitude: location.latitude,
|
|
259
|
+
longitude: location.longitude,
|
|
260
|
+
width: 25,
|
|
261
|
+
height: 35,
|
|
262
|
+
};
|
|
263
|
+
this.setData({
|
|
264
|
+
location,
|
|
265
|
+
markers: [marker],
|
|
266
|
+
});
|
|
267
|
+
this.changeValueFormat(location);
|
|
268
|
+
},
|
|
269
|
+
checkCustomLocation(params) {
|
|
270
|
+
let { latitude, longitude } = params;
|
|
271
|
+
let message = '';
|
|
272
|
+
if (Object.prototype.toString.call(params) !== '[object Object]') {
|
|
273
|
+
return (message = '位置输入格式错误 请检查');
|
|
274
|
+
} else if (!latitude || !Number(latitude)) {
|
|
275
|
+
return (message = '位置输入格式错误 请检查');
|
|
276
|
+
} else if (!longitude || !Number(longitude)) {
|
|
277
|
+
return (message = '位置输入格式错误 请检查');
|
|
278
|
+
} else if (!params) {
|
|
279
|
+
return (message = '位置输入格式错误 请检查');
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
setLocation(value) {
|
|
283
|
+
const { latitude, longitude } = value;
|
|
284
|
+
let marker = {
|
|
285
|
+
id: 887,
|
|
286
|
+
latitude,
|
|
287
|
+
longitude,
|
|
288
|
+
width: 25,
|
|
289
|
+
height: 35,
|
|
290
|
+
};
|
|
291
|
+
this.setData({
|
|
292
|
+
location: value,
|
|
293
|
+
markers: [marker],
|
|
294
|
+
});
|
|
295
|
+
this.changeValueFormat(value);
|
|
296
|
+
},
|
|
297
|
+
changeValueFormat(value) {
|
|
298
|
+
const { latitude, longitude, poiname } = value;
|
|
299
|
+
let location = {
|
|
300
|
+
address: poiname,
|
|
301
|
+
geopoint: {
|
|
302
|
+
coordinates: [latitude, longitude],
|
|
303
|
+
type: 'Point',
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
this.triggerEvent('change', {
|
|
307
|
+
value: location,
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
observers: {
|
|
312
|
+
value: function (value) {
|
|
313
|
+
const currentLocations = this.data.currentLocations;
|
|
314
|
+
if (value || !currentLocations.latitude) return;
|
|
315
|
+
const locationType = this.properties.locationType;
|
|
316
|
+
const { latitude, longitude } = currentLocations;
|
|
317
|
+
let marker = {
|
|
318
|
+
id: 887,
|
|
319
|
+
latitude,
|
|
320
|
+
longitude,
|
|
321
|
+
width: 25,
|
|
322
|
+
height: 35,
|
|
323
|
+
};
|
|
324
|
+
this.setData({
|
|
325
|
+
location: currentLocations,
|
|
326
|
+
markers: [marker],
|
|
327
|
+
isAddrShow: false,
|
|
328
|
+
});
|
|
329
|
+
if (locationType === 1) {
|
|
330
|
+
this.triggerEvent('change', {
|
|
331
|
+
value: null,
|
|
332
|
+
});
|
|
333
|
+
} else if (locationType === 2) {
|
|
334
|
+
this.changeValueFormat(currentLocations);
|
|
335
|
+
this.setData({
|
|
336
|
+
isAddrShow: true,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!--components/location/location.wxml-->
|
|
2
|
+
|
|
3
|
+
<view class="form-location">
|
|
4
|
+
<view class="form-location-warp">
|
|
5
|
+
<view class="form-location-label form-location_cell" wx:if="{{labelVisible}}">
|
|
6
|
+
{{label}}
|
|
7
|
+
</view>
|
|
8
|
+
<view class="form-location-con form-location_cell" bindtap="chooseSite" data-value="{{true}}" >
|
|
9
|
+
<image class="form-location-con_img" src="https://qcloudimg.tencent-cloud.cn/raw/6542e1ce1dd36a90085b2eb979801df9.png"></image>
|
|
10
|
+
<text class="form-location-con-text">选择地理位置</text>
|
|
11
|
+
</view>
|
|
12
|
+
</view>
|
|
13
|
+
<view class="form-location-addr" wx:if="{{isAddrShow}}">
|
|
14
|
+
<image wx:if="{{isAddrShow&&location.poiname}}" class="form-location-addr-image" src="https://qcloudimg.tencent-cloud.cn/raw/f9729e0b091f394110a6e12d3f4e7290.png" alt="" />
|
|
15
|
+
<view class="form-location-addr-box" >
|
|
16
|
+
<view class="form-location-addr-title">{{location.poiname}}</view>
|
|
17
|
+
<view class="form-location-addr-lat" wx:if="{{showLngLat}}">
|
|
18
|
+
{{location.longitude}}N,{{location.latitude}}E
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
<view style="padding-left: 32px;padding-right: 32px;margin-top: 8px;padding-bottom: 16px;" wx:if="{{showMap&&isAddrShow}}">
|
|
23
|
+
<map id="map" longitude="{{location.longitude}}" latitude="{{location.latitude}}" markers="{{markers}}" scale="16" enable-zoom="{{zoom}}" enable-scroll="{{drag}}" style="width: 100%; height: 200px;"></map>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* components/location/location.wxss */
|
|
2
|
+
|
|
3
|
+
.form-location {
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.form-location-warp {
|
|
7
|
+
display: flex;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
position: relative;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.form-location::before,
|
|
14
|
+
.form-location::after {
|
|
15
|
+
left: 32px;
|
|
16
|
+
right: 32px;
|
|
17
|
+
content: ' ';
|
|
18
|
+
position: absolute;
|
|
19
|
+
height: 0px;
|
|
20
|
+
z-index: 2;
|
|
21
|
+
color: #e2e1e1;
|
|
22
|
+
border-top: 1px solid #e2e1e1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.form-location-warp::after {
|
|
26
|
+
bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.form-location-con {
|
|
30
|
+
flex: 1;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.form-location-label_flag {
|
|
36
|
+
display: inline-block;
|
|
37
|
+
margin-right: 4px;
|
|
38
|
+
font-family: SimSun;
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
color: #f60;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.form-location-label {
|
|
44
|
+
max-width: 150px;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
text-overflow: ellipsis;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.form-location-con_img {
|
|
51
|
+
min-width: 18px;
|
|
52
|
+
width: 18px;
|
|
53
|
+
height: 18px;
|
|
54
|
+
}
|
|
55
|
+
.form-location-con-text {
|
|
56
|
+
color: #006eff;
|
|
57
|
+
margin-left: 8px;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.form-location_cell {
|
|
62
|
+
padding: 16px 32px;
|
|
63
|
+
line-height: 1.41176471;
|
|
64
|
+
font-size: 17px;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.form-location-addr {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: flex-start;
|
|
72
|
+
padding-left: 32px;
|
|
73
|
+
padding-right: 32px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.form-location-addr-title {
|
|
77
|
+
font-size: 16px;
|
|
78
|
+
}
|
|
79
|
+
.form-location-addr-lat {
|
|
80
|
+
font-size: 12px;
|
|
81
|
+
color: rgba(0, 0, 0, 0.4);
|
|
82
|
+
line-height: 20px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.form-location-addr-image {
|
|
86
|
+
width: 19px;
|
|
87
|
+
height: 19px;
|
|
88
|
+
}
|
|
89
|
+
.form-location-addr-box {
|
|
90
|
+
margin-left: 12px;
|
|
91
|
+
}
|