@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,286 @@
|
|
|
1
|
+
const isNull = (val) => [undefined, null].includes(val);
|
|
2
|
+
const REL_DICT = {
|
|
3
|
+
equal: 'eq', // 等于
|
|
4
|
+
unequal: 'neq', // 不等于
|
|
5
|
+
include: 'search', // 包含
|
|
6
|
+
exclude: '_exclude', // 不包含
|
|
7
|
+
begin_with: '_begin_with', // 开头是
|
|
8
|
+
greater: 'gt', // 大于
|
|
9
|
+
greater_or_equal: 'gte', // 大于等于
|
|
10
|
+
less: 'lt', // 小于
|
|
11
|
+
less_or_equal: 'lte', // 小于等于
|
|
12
|
+
in: 'in', // 多选值
|
|
13
|
+
not_in: 'nin', // 不在多选值
|
|
14
|
+
};
|
|
15
|
+
const ORDERTYPE = ['asc', 'desc'];
|
|
16
|
+
const getWhereList = (where) => {
|
|
17
|
+
let result = [];
|
|
18
|
+
Array.isArray(where) &&
|
|
19
|
+
where.forEach((item1) => {
|
|
20
|
+
if (item1?.groupLogic !== 'or' && Array.isArray(item1?.logicData)) {
|
|
21
|
+
item1?.logicData.forEach((item2) => {
|
|
22
|
+
let [rel, val] = [REL_DICT[item2?.rel], item2?.value];
|
|
23
|
+
if ('_begin_with' === rel) {
|
|
24
|
+
rel = 'regex';
|
|
25
|
+
val = `^${val}`;
|
|
26
|
+
}
|
|
27
|
+
if ('_exclude' === rel) {
|
|
28
|
+
rel = 'regex';
|
|
29
|
+
val = `^((?!${val}).)*$`;
|
|
30
|
+
}
|
|
31
|
+
if (item2?.logic !== 'or' && item2?.key && rel && !isNull(val)) {
|
|
32
|
+
result.push({ key: item2.key, rel, val });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
const DEFAULT_DATA = {
|
|
40
|
+
pageNo: 1,
|
|
41
|
+
loading: false,
|
|
42
|
+
total: 0,
|
|
43
|
+
records: [],
|
|
44
|
+
pageStr: '0/0',
|
|
45
|
+
isVisiableSign: false,
|
|
46
|
+
isFirstScreen: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Component({
|
|
50
|
+
options: {
|
|
51
|
+
virtualHost: true,
|
|
52
|
+
},
|
|
53
|
+
properties: {
|
|
54
|
+
className: {
|
|
55
|
+
type: String,
|
|
56
|
+
value: '',
|
|
57
|
+
},
|
|
58
|
+
style: {
|
|
59
|
+
type: String,
|
|
60
|
+
value: '',
|
|
61
|
+
},
|
|
62
|
+
datasource: {
|
|
63
|
+
type: Object,
|
|
64
|
+
value: {},
|
|
65
|
+
},
|
|
66
|
+
orderBy: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
orderType: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
where: {
|
|
73
|
+
type: Array,
|
|
74
|
+
value: [],
|
|
75
|
+
},
|
|
76
|
+
pageSize: {
|
|
77
|
+
type: Number,
|
|
78
|
+
value: 5,
|
|
79
|
+
},
|
|
80
|
+
template: {
|
|
81
|
+
type: String,
|
|
82
|
+
value: 'simpleList',
|
|
83
|
+
},
|
|
84
|
+
pagination: {
|
|
85
|
+
type: String,
|
|
86
|
+
value: 'loadMoreButton',
|
|
87
|
+
},
|
|
88
|
+
beforeDataChange: {
|
|
89
|
+
type: Function,
|
|
90
|
+
value: (v) => v,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
data: { ...DEFAULT_DATA },
|
|
94
|
+
methods: {
|
|
95
|
+
/**
|
|
96
|
+
* 列表容器拉取数据,放在 setData 的回调函数中执行
|
|
97
|
+
*/
|
|
98
|
+
_fetchData: async function () {
|
|
99
|
+
const { app } = getApp();
|
|
100
|
+
const callDataSource = app?.cloud?.callDataSource;
|
|
101
|
+
const { pageNo, loading } = this.data;
|
|
102
|
+
const { datasource, orderBy, orderType, where, pageSize } =
|
|
103
|
+
this.properties;
|
|
104
|
+
if (loading) return;
|
|
105
|
+
if (!callDataSource) {
|
|
106
|
+
console.warn(`当前环境缺少方法 app.cloud.callDataSource`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.setData({ loading: true });
|
|
110
|
+
const { name: dataSourceName, extra } = datasource || {};
|
|
111
|
+
const methodName =
|
|
112
|
+
typeof extra?.methodName === 'string'
|
|
113
|
+
? extra?.methodName
|
|
114
|
+
: 'wedaGetRecords';
|
|
115
|
+
const tcbParams = {};
|
|
116
|
+
|
|
117
|
+
// tcb分页参数
|
|
118
|
+
if (!isNull(pageNo) && !isNull(pageSize)) {
|
|
119
|
+
tcbParams['pageNo'] = pageNo;
|
|
120
|
+
tcbParams['pageSize'] = pageSize;
|
|
121
|
+
}
|
|
122
|
+
// tcb排序参数
|
|
123
|
+
if (orderBy && ORDERTYPE.includes(orderType)) {
|
|
124
|
+
tcbParams['orderBy'] = orderBy;
|
|
125
|
+
tcbParams['orderType'] = orderType;
|
|
126
|
+
}
|
|
127
|
+
// tcb过滤参数
|
|
128
|
+
const whereEffected = [].concat(getWhereList(where));
|
|
129
|
+
whereEffected.length > 0 && (tcbParams['where'] = whereEffected);
|
|
130
|
+
// tcb结果和事件
|
|
131
|
+
const data = await callDataSource({
|
|
132
|
+
dataSourceName,
|
|
133
|
+
methodName,
|
|
134
|
+
params: tcbParams,
|
|
135
|
+
});
|
|
136
|
+
let records = data?.records || [];
|
|
137
|
+
let total = data?.total || 0;
|
|
138
|
+
if (
|
|
139
|
+
['loadMoreButton', 'bottomLoad'].includes(this.properties.pagination)
|
|
140
|
+
) {
|
|
141
|
+
records = [...this.data.records, ...records]; // TODO 可能存在单次 setData 数据量过大引起小程序性能问题
|
|
142
|
+
}
|
|
143
|
+
this.setData(
|
|
144
|
+
{
|
|
145
|
+
total,
|
|
146
|
+
records,
|
|
147
|
+
loading: false,
|
|
148
|
+
pageStr: `${total > 0 ? pageNo : 0}/${
|
|
149
|
+
Math.ceil(total / pageSize) || 0
|
|
150
|
+
}`,
|
|
151
|
+
},
|
|
152
|
+
() => {
|
|
153
|
+
this._handleEvents(data);
|
|
154
|
+
setTimeout(() => this._firstScreenLoadMore(), 150);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* 下一页
|
|
160
|
+
*/
|
|
161
|
+
handleNext: function () {
|
|
162
|
+
if (
|
|
163
|
+
this.data.loading ||
|
|
164
|
+
!(this.properties.pageSize * this.data.pageNo < this.data.total)
|
|
165
|
+
) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.setData({ pageNo: this.data.pageNo + 1 }, () => this._fetchData());
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* 上一页
|
|
172
|
+
*/
|
|
173
|
+
handlePre: function () {
|
|
174
|
+
if (this.data.loading || !(this.properties.pageNo > 1)) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.setData({ pageNo: this.data.pageNo - 1 }, () => this._fetchData());
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* 向外部传递事件
|
|
181
|
+
*/
|
|
182
|
+
_handleEvents: function (data) {
|
|
183
|
+
const records = this.data.records || [];
|
|
184
|
+
const total = this.data.total || records?.length || 0;
|
|
185
|
+
const beforeDataChange = this.properties.beforeDataChange || ((v) => v);
|
|
186
|
+
this.triggerEvent('onDataChange', {
|
|
187
|
+
data: beforeDataChange(records),
|
|
188
|
+
});
|
|
189
|
+
if (JSON.stringify(data) === '{}') {
|
|
190
|
+
this.triggerEvent('queryFail', {
|
|
191
|
+
datasource: this.properties.datasource,
|
|
192
|
+
data: null,
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
if (total === 0) {
|
|
196
|
+
this.triggerEvent('queryEmpty', {
|
|
197
|
+
datasource: this.properties.datasource,
|
|
198
|
+
data: beforeDataChange([]),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
this.triggerEvent('querySuccess', {
|
|
202
|
+
datasource: this.properties.datasource,
|
|
203
|
+
data: beforeDataChange(records),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* 首屏持续触底加载特殊处理
|
|
209
|
+
*/
|
|
210
|
+
_firstScreenLoadMore: function () {
|
|
211
|
+
if (this.properties.pagination === 'bottomLoad') {
|
|
212
|
+
if (this.data.isFirstScreen) {
|
|
213
|
+
this.setData({ isFirstScreen: false });
|
|
214
|
+
this.contentObserver?.disconnect();
|
|
215
|
+
this._observerContent();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* 开始监听slot
|
|
221
|
+
*/
|
|
222
|
+
_observerContent: function () {
|
|
223
|
+
this.contentObserver = this.createIntersectionObserver();
|
|
224
|
+
this.contentObserver
|
|
225
|
+
.relativeToViewport()
|
|
226
|
+
.observe('#weda-list-view_content', (res) => {
|
|
227
|
+
this.setData({
|
|
228
|
+
isFirstScreen:
|
|
229
|
+
res?.boundingClientRect?.bottom <= res?.relativeRect?.bottom,
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* 开始监听sign
|
|
235
|
+
*/
|
|
236
|
+
_observerSign: function () {
|
|
237
|
+
this.signObserver = this.createIntersectionObserver();
|
|
238
|
+
this.signObserver
|
|
239
|
+
.relativeTo('.weda-list-view__containor', { bottom: 10 })
|
|
240
|
+
.observe('#weda-list-view_sign', (res) => {
|
|
241
|
+
this.setData({ isVisiableSign: res?.intersectionRatio > 0 });
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
observers: {
|
|
246
|
+
'datasource,orderBy,orderType,where,pageSize,pagination': function (
|
|
247
|
+
dDatasource,
|
|
248
|
+
dOrderBy,
|
|
249
|
+
dOrderType,
|
|
250
|
+
dWhere,
|
|
251
|
+
dPageSize,
|
|
252
|
+
dPagination
|
|
253
|
+
) {
|
|
254
|
+
if (
|
|
255
|
+
dDatasource !== this.properties.datasource ||
|
|
256
|
+
dOrderBy !== this.properties.orderBy ||
|
|
257
|
+
dOrderType !== this.properties.orderType ||
|
|
258
|
+
dWhere !== this.properties.where ||
|
|
259
|
+
dPageSize !== this.properties.pageSize ||
|
|
260
|
+
dPagination !== this.properties.pagination
|
|
261
|
+
) {
|
|
262
|
+
this.setData({ ...DEFAULT_DATA }, () => this._fetchData());
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
isVisiableSign: function (dIsVisiableSign) {
|
|
266
|
+
if (dIsVisiableSign && this.properties.pagination === 'bottomLoad') {
|
|
267
|
+
this.handleNext();
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
isFirstScreen: function (dIsFirstScreen) {
|
|
271
|
+
if (dIsFirstScreen && this.properties.pagination === 'bottomLoad') {
|
|
272
|
+
this.handleNext();
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
lifetimes: {
|
|
277
|
+
attached: function () {
|
|
278
|
+
this._fetchData();
|
|
279
|
+
this._observerSign();
|
|
280
|
+
},
|
|
281
|
+
detached: function () {
|
|
282
|
+
this.contentObserver?.disconnect();
|
|
283
|
+
this.signObserver?.disconnect();
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<scroll-view scroll-y scroll-with-animation lower-threshold="5" style="height:97vh;{{style}}"
|
|
2
|
+
class="weda-list-view__containor weda-ui {{className}}">
|
|
3
|
+
<!-- 列表插槽 -->
|
|
4
|
+
<view class="{{template === 'cardList' ? 'weda-list-view-card' : ''}}" id="weda-list-view_content">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</view>
|
|
7
|
+
|
|
8
|
+
<view class="weda-list-view__more">
|
|
9
|
+
<!-- 加载更多 -->
|
|
10
|
+
<block wx:if="{{pagination==='loadMoreButton' && pageSize * pageNo < total}}">
|
|
11
|
+
<view class="weda-list-view__more-text" bindtap="handleNext">加载更多</view>
|
|
12
|
+
</block>
|
|
13
|
+
<!-- 触底刷新 -->
|
|
14
|
+
<block wx:elif="{{pagination==='bottomLoad'}}">
|
|
15
|
+
<view class="weda-list-view__bottom-load" id="weda-list-view_sign">
|
|
16
|
+
<view class="weda-list-view__more-symbol" wx:if="{{loading}}">
|
|
17
|
+
<view class="weda-list-view__symbol-item"></view>
|
|
18
|
+
<view class="weda-list-view__symbol-item"></view>
|
|
19
|
+
<view class="weda-list-view__symbol-item"></view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</block>
|
|
23
|
+
<!-- 分页器 -->
|
|
24
|
+
<block wx:elif="{{pagination==='pagination'}}">
|
|
25
|
+
<view class="weda-list-view__more-pagination">
|
|
26
|
+
<view class="weda-list-view__pagination-pre {{pageNo > 1 ? 'active': ''}}" bindtap="handlePre">
|
|
27
|
+
<image class="weda-list-view__pagination-icon" src='arrow-right-line.svg' />
|
|
28
|
+
上一页
|
|
29
|
+
</view>
|
|
30
|
+
<view class="weda-list-view__pagination-text">{{pageStr}}</view>
|
|
31
|
+
<view class="weda-list-view__pagination-next {{pageSize * pageNo < total ? 'active' : ''}}"
|
|
32
|
+
bindtap="handleNext">
|
|
33
|
+
<image class="weda-list-view__pagination-icon" src='arrow-right-line.svg' />
|
|
34
|
+
下一页
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</block>
|
|
38
|
+
<block wx:else></block>
|
|
39
|
+
</view>
|
|
40
|
+
</scroll-view>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* weda_list_view */
|
|
2
|
+
|
|
3
|
+
.weda-list-view__containor {
|
|
4
|
+
background: #fff;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* 卡片列表 */
|
|
11
|
+
.weda-list-view-card {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
margin-right: 6rpx;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* 加载更多 */
|
|
18
|
+
.weda-list-view__containor .weda-list-view__more {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.weda-list-view__containor .weda-list-view__more .weda-list-view__more-text {
|
|
23
|
+
padding-top: 20rpx;
|
|
24
|
+
padding-bottom: 28rpx;
|
|
25
|
+
font-size: 24rpx;
|
|
26
|
+
line-height: 44rpx;
|
|
27
|
+
color: rgba(0, 0, 0, 0.4);
|
|
28
|
+
text-align: center;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* 加载更多 ... */
|
|
33
|
+
.weda-list-view__containor .weda-list-view__more {
|
|
34
|
+
background: #fff;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.weda-list-view__bottom-load {
|
|
38
|
+
padding-top: 1px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.weda-list-view__containor .weda-list-view__more .weda-list-view__more-symbol {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
padding-top: 40rpx;
|
|
46
|
+
padding-bottom: 36rpx;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.weda-list-view__containor .weda-list-view__more .weda-list-view__symbol-item {
|
|
51
|
+
width: 16rpx;
|
|
52
|
+
height: 16rpx;
|
|
53
|
+
background: #c4c4c4;
|
|
54
|
+
margin-left: 12rpx;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.weda-list-view__containor
|
|
59
|
+
.weda-list-view__more
|
|
60
|
+
.weda-list-view__symbol-item:first-child {
|
|
61
|
+
width: 12rpx;
|
|
62
|
+
height: 12rpx;
|
|
63
|
+
margin-left: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 加载更多 分页 */
|
|
67
|
+
.weda-list-view__containor
|
|
68
|
+
.weda-list-view__more
|
|
69
|
+
.weda-list-view__more-pagination {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: space-between;
|
|
73
|
+
position: relative;
|
|
74
|
+
padding: 20rpx 36rpx 24rpx 32rpx;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.weda-list-view__containor
|
|
79
|
+
.weda-list-view__more
|
|
80
|
+
.weda-list-view__pagination-pre,
|
|
81
|
+
.weda-list-view__containor
|
|
82
|
+
.weda-list-view__more
|
|
83
|
+
.weda-list-view__pagination-next {
|
|
84
|
+
font-size: 24rpx;
|
|
85
|
+
line-height: 48rpx;
|
|
86
|
+
color: rgba(0, 0, 0, 0.4);
|
|
87
|
+
padding: 0 48rpx;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.weda-list-view__containor
|
|
91
|
+
.weda-list-view__more
|
|
92
|
+
.weda-list-view__pagination-pre.active,
|
|
93
|
+
.weda-list-view__containor
|
|
94
|
+
.weda-list-view__more
|
|
95
|
+
.weda-list-view__pagination-next.active {
|
|
96
|
+
color: rgba(0, 0, 0, 0.9);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.weda-list-view__containor
|
|
100
|
+
.weda-list-view__more
|
|
101
|
+
.weda-list-view__pagination-pre
|
|
102
|
+
.weda-list-view__pagination-icon,
|
|
103
|
+
.weda-list-view__containor
|
|
104
|
+
.weda-list-view__more
|
|
105
|
+
.weda-list-view__pagination-next
|
|
106
|
+
.weda-list-view__pagination-icon {
|
|
107
|
+
position: absolute;
|
|
108
|
+
width: 48rpx;
|
|
109
|
+
height: 48rpx;
|
|
110
|
+
top: 20rpx;
|
|
111
|
+
opacity: 0.2;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.weda-list-view__containor
|
|
115
|
+
.weda-list-view__more
|
|
116
|
+
.active.weda-list-view__pagination-pre
|
|
117
|
+
.weda-list-view__pagination-icon,
|
|
118
|
+
.weda-list-view__containor
|
|
119
|
+
.weda-list-view__more
|
|
120
|
+
.active.weda-list-view__pagination-next
|
|
121
|
+
.weda-list-view__pagination-icon {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.weda-list-view__containor
|
|
126
|
+
.weda-list-view__more
|
|
127
|
+
.weda-list-view__pagination-pre
|
|
128
|
+
.weda-list-view__pagination-icon {
|
|
129
|
+
left: 32rpx;
|
|
130
|
+
transform: rotate(180deg);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.weda-list-view__containor
|
|
134
|
+
.weda-list-view__more
|
|
135
|
+
.weda-list-view__pagination-next
|
|
136
|
+
.weda-list-view__pagination-icon {
|
|
137
|
+
right: 36rpx;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.weda-list-view__containor
|
|
141
|
+
.weda-list-view__more
|
|
142
|
+
.weda-list-view__pagination-text {
|
|
143
|
+
font-size: 24rpx;
|
|
144
|
+
line-height: 44rpx;
|
|
145
|
+
color: rgba(0, 0, 0, 0.4);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.split {
|
|
149
|
+
height: 40rpx;
|
|
150
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4.5 10.5C3.675 10.5 3 11.175 3 12C3 12.825 3.675 13.5 4.5 13.5C5.325 13.5 6 12.825 6 12C6 11.175 5.325 10.5 4.5 10.5ZM19.5 10.5C18.675 10.5 18 11.175 18 12C18 12.825 18.675 13.5 19.5 13.5C20.325 13.5 21 12.825 21 12C21 11.175 20.325 10.5 19.5 10.5ZM12 10.5C11.175 10.5 10.5 11.175 10.5 12C10.5 12.825 11.175 13.5 12 13.5C12.825 13.5 13.5 12.825 13.5 12C13.5 11.175 12.825 10.5 12 10.5Z" fill="#09121F"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
virtualHost: true,
|
|
4
|
+
multipleSlots: true,
|
|
5
|
+
},
|
|
6
|
+
properties: {
|
|
7
|
+
className: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: '',
|
|
10
|
+
},
|
|
11
|
+
style: {
|
|
12
|
+
type: String,
|
|
13
|
+
value: '',
|
|
14
|
+
},
|
|
15
|
+
navOption: { type: Array, value: [] },
|
|
16
|
+
mobileCol: {
|
|
17
|
+
type: Number,
|
|
18
|
+
value: 4,
|
|
19
|
+
},
|
|
20
|
+
pcCol: {
|
|
21
|
+
type: Number,
|
|
22
|
+
value: 4,
|
|
23
|
+
},
|
|
24
|
+
iconSize: {
|
|
25
|
+
type: String,
|
|
26
|
+
value: 'default',
|
|
27
|
+
},
|
|
28
|
+
textColor: {
|
|
29
|
+
type: String,
|
|
30
|
+
value: 'rgb(0, 0, 0)"',
|
|
31
|
+
},
|
|
32
|
+
fontWeight: {
|
|
33
|
+
type: String,
|
|
34
|
+
value: 'normal',
|
|
35
|
+
},
|
|
36
|
+
lineHeight: {
|
|
37
|
+
type: String,
|
|
38
|
+
value: 'auto',
|
|
39
|
+
},
|
|
40
|
+
maxLines: {
|
|
41
|
+
type: Number,
|
|
42
|
+
value: 2,
|
|
43
|
+
},
|
|
44
|
+
fontSize: {
|
|
45
|
+
type: Number,
|
|
46
|
+
value: 14,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
data: {
|
|
50
|
+
cls: '',
|
|
51
|
+
optionList: [],
|
|
52
|
+
titleStyle: '',
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
methods: {
|
|
56
|
+
navigaTo: function (itemInfo) {
|
|
57
|
+
const item = itemInfo?.currentTarget?.dataset?.item;
|
|
58
|
+
if (item.tapStatus == 'inside') {
|
|
59
|
+
const paramObj = [];
|
|
60
|
+
if (item.withParams && item?.params) {
|
|
61
|
+
for (let info of item.params) {
|
|
62
|
+
paramObj.push(info.key + '=' + info.value);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
item.paramObj = paramObj;
|
|
66
|
+
if (item.withParams && item.params.length > 0) {
|
|
67
|
+
wx.navigateTo({
|
|
68
|
+
url:
|
|
69
|
+
'/pages/' + item?.insideUrl + '/index?' + item.paramObj.join('&'),
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
wx.navigateTo({
|
|
73
|
+
url: '/pages/' + item?.insideUrl + '/index',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
observers: {
|
|
80
|
+
'navOption,mobileCol': function (navOption, mobileCol) {
|
|
81
|
+
let list = [];
|
|
82
|
+
list.length = Math.floor(navOption.length / mobileCol);
|
|
83
|
+
list.forEach((item, index) => {
|
|
84
|
+
list[index] = [];
|
|
85
|
+
});
|
|
86
|
+
navOption.forEach((item, index) => {
|
|
87
|
+
if (item.icon.includes('td:')) {
|
|
88
|
+
item['tdicon'] = item.icon.split(':')[1];
|
|
89
|
+
}
|
|
90
|
+
const _index = Math.floor(index / mobileCol);
|
|
91
|
+
if (!list[_index] || list[_index].length <= 0) {
|
|
92
|
+
// 保证每个col 的数据都是有的,列入总共7个数据,那么第二行的3, 4,5数据是undefined, 占位
|
|
93
|
+
list[_index] = Array.apply(null, Array(mobileCol));
|
|
94
|
+
}
|
|
95
|
+
list[_index][index - _index * mobileCol] = item;
|
|
96
|
+
});
|
|
97
|
+
const optionList = list;
|
|
98
|
+
this.setData({
|
|
99
|
+
optionList,
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
'textColor,fontWeight,fontSize,lineHeight': function (
|
|
103
|
+
textColor,
|
|
104
|
+
fontWeight,
|
|
105
|
+
fontSize,
|
|
106
|
+
lineHeight
|
|
107
|
+
) {
|
|
108
|
+
let titleStyle;
|
|
109
|
+
// 添加文本颜色属性
|
|
110
|
+
if (textColor !== '') {
|
|
111
|
+
titleStyle = `color:${textColor}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 添加对齐属性
|
|
115
|
+
if (fontWeight !== '') {
|
|
116
|
+
titleStyle = `${titleStyle};font-weight: ${fontWeight};font-size:${fontSize};line-height:${
|
|
117
|
+
lineHeight == 'auto' ? 'normal' : lineHeight
|
|
118
|
+
}`;
|
|
119
|
+
}
|
|
120
|
+
this.setData({ titleStyle });
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<view class="weda-grid-navigation" style="{{style}}">
|
|
2
|
+
<view class="weda-grid-navigation__wrapper">
|
|
3
|
+
<block wx:for="{{optionList}}" wx:key="colIndex" wx:for-item="row">
|
|
4
|
+
<view class="weda-grid weda-grid-navigation__row">
|
|
5
|
+
<block wx:for="{{row}}" wx:key="colIndex" wx:for-item="col">
|
|
6
|
+
<view class="weda-col weda-grid__item weda-grid-navigation__col weda-grid-navigation__col--{{iconSize}}" style="width: {{(1 / mobileCol)*100}}%" data-item="{{col}}" bindtap="navigaTo">
|
|
7
|
+
<view class="weda-grid__box">
|
|
8
|
+
<view class="weda-grid-navigation__col">
|
|
9
|
+
<view wx:if="{{col.icon!='自定义图片'}}" class="weda-grid-navigation__icon">
|
|
10
|
+
|
|
11
|
+
<view wx:if="{{col.tdicon}}" class="weda-icon t-icon t-icon-{{col.tdicon}}"></view>
|
|
12
|
+
|
|
13
|
+
<view wx:if="{{!col.tdicon}}" class="weda-icon lcap-icon-padding lcap-icon lcap-icon-{{col.icon}}">
|
|
14
|
+
</view>
|
|
15
|
+
</view>
|
|
16
|
+
<image wx:if="{{col.icon=='自定义图片'&&col.iconSrc}}" src="{{col.iconSrc}}" class="weda-grid-navigation__img"></image>
|
|
17
|
+
</view>
|
|
18
|
+
<view class="weda-grid-navigation__text" wx-if="{{col.title}}" style="-webkit-line-clamp:{{maxLines?maxLines:'revert'}};{{titleStyle}}">{{col.title}}</view>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</block>
|
|
22
|
+
</view>
|
|
23
|
+
</block>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|