@cloudbase/weda-ui 0.2.16 → 0.2.17
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/README.md +39 -170
- package/package.json +17 -10
- package/src/configs/components/chart/bar.json +711 -0
- package/src/configs/components/chart/line.json +666 -0
- package/src/configs/components/chart/pie.json +487 -0
- package/src/configs/components/listView.json +2 -1
- package/src/configs/index.js +7 -0
- package/src/mp/components/chart/bar/index.js +254 -0
- package/src/mp/components/chart/bar/index.json +6 -0
- package/src/mp/components/chart/bar/index.wxml +3 -0
- package/src/mp/components/chart/bar/index.wxss +9 -0
- package/src/mp/components/chart/common/config/bar.js +50 -0
- package/src/mp/components/chart/common/config/global.js +16 -0
- package/src/mp/components/chart/common/config/line.js +48 -0
- package/src/mp/components/chart/common/config/pie.js +36 -0
- package/src/mp/components/chart/common/core/eChartBar.js +262 -0
- package/src/mp/components/chart/common/core/eChartBase.js +371 -0
- package/src/mp/components/chart/common/core/eChartLine.js +228 -0
- package/src/mp/components/chart/common/core/eChartPie.js +166 -0
- package/src/mp/components/chart/common/lib/echarts.min.js +18 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +277 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +4 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +4 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +4 -0
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +107 -0
- package/src/mp/components/chart/line/index.js +243 -0
- package/src/mp/components/chart/line/index.json +6 -0
- package/src/mp/components/chart/line/index.wxml +3 -0
- package/src/mp/components/chart/line/index.wxss +9 -0
- package/src/mp/components/chart/pie/index.js +178 -0
- package/src/mp/components/chart/pie/index.json +6 -0
- package/src/mp/components/chart/pie/index.wxml +4 -0
- package/src/mp/components/chart/pie/index.wxss +9 -0
- package/src/mp/components/dataView/index.json +1 -1
- package/src/mp/components/form/radio/index.js +5 -0
- package/src/mp/components/form/select/index.wxml +4 -4
- package/src/mp/components/form/textarea/index.wxml +6 -5
- package/src/mp/components/form/uploader/index.js +42 -22
- package/src/mp/components/form/uploader/index.wxml +15 -3
- package/src/mp/components/form/uploaderFile/index.js +58 -30
- package/src/mp/components/graphicCard/index.js +26 -28
- package/src/mp/components/internals/listView/arrow-right-line.svg +3 -0
- package/src/mp/components/internals/listView/index.js +286 -0
- package/src/mp/components/internals/listView/index.json +4 -0
- package/src/mp/components/internals/listView/index.wxml +40 -0
- package/src/mp/components/internals/listView/index.wxss +150 -0
- package/src/mp/components/internals/listView/more-line.svg +3 -0
- package/src/mp/components/listView/index.js +17 -24
- package/src/mp/components/listView/index.wxml +1 -1
- package/src/mp/components/navLayout/index.js +3 -3
- package/src/mp/index.json +3 -0
- package/src/mp/utils/platform.js +15 -0
- package/src/setupTests.js +2 -1
- package/src/web/components/chart/bar/index.tsx +139 -0
- package/src/web/components/chart/common/config/bar.js +49 -0
- package/src/web/components/chart/common/config/global.js +16 -0
- package/src/web/components/chart/common/config/line.js +50 -0
- package/src/web/components/chart/common/config/pie.js +37 -0
- package/src/web/components/chart/common/core/eChartBar.js +264 -0
- package/src/web/components/chart/common/core/eChartBase.ts +379 -0
- package/src/web/components/chart/common/core/eChartLine.js +229 -0
- package/src/web/components/chart/common/core/eChartPie.js +170 -0
- package/src/web/components/chart/common/core/type.ts +34 -0
- package/src/web/components/chart/common/echart.css +106 -0
- package/src/web/components/chart/common/echarts.ts +33 -0
- package/src/web/components/chart/common/useChart.tsx +69 -0
- package/src/web/components/chart/line/index.tsx +135 -0
- package/src/web/components/chart/pie/index.tsx +99 -0
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +3 -3
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +2 -2
- package/src/web/components/form/select/h5.tsx +3 -1
- package/src/web/components/form/select/time.jsx +1 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +19 -17
- package/src/web/components/form/uploader/uploader.pc.tsx +13 -16
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +35 -37
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +15 -21
- package/src/web/components/graphicCard/index.css +1 -5
- package/src/web/components/graphicCard/index.tsx +4 -3
- package/src/web/components/index.js +5 -2
- package/src/web/utils/platform.js +1 -1
- package/src/web/utils/tcb.js +3 -15
- package/CHANGELOG.md +0 -240
- package/src/.DS_Store +0 -0
- package/src/configs/.DS_Store +0 -0
- package/src/mp/.gitignore +0 -10
- package/src/web/.DS_Store +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as echarts from '../common/lib/echarts.min';
|
|
2
|
+
import EchartPie from '../common/core/eChartPie';
|
|
3
|
+
Component({
|
|
4
|
+
options: {
|
|
5
|
+
virtualHost: true,
|
|
6
|
+
multipleSlots: true,
|
|
7
|
+
},
|
|
8
|
+
properties: {
|
|
9
|
+
id: {
|
|
10
|
+
type: String,
|
|
11
|
+
value: '',
|
|
12
|
+
},
|
|
13
|
+
className: {
|
|
14
|
+
type: String,
|
|
15
|
+
value: '',
|
|
16
|
+
},
|
|
17
|
+
style: {
|
|
18
|
+
type: String,
|
|
19
|
+
value: '',
|
|
20
|
+
},
|
|
21
|
+
chartType: {
|
|
22
|
+
// 图形类型
|
|
23
|
+
type: String,
|
|
24
|
+
value: 'bight',
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
// 图表标题
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
isTitle: {
|
|
31
|
+
// 是否显示标题
|
|
32
|
+
type: Boolean,
|
|
33
|
+
value: false,
|
|
34
|
+
},
|
|
35
|
+
titleLocation: {
|
|
36
|
+
type: String,
|
|
37
|
+
value: 'top',
|
|
38
|
+
},
|
|
39
|
+
dataSource: {
|
|
40
|
+
// 数据源
|
|
41
|
+
type: Object,
|
|
42
|
+
},
|
|
43
|
+
filterData: {
|
|
44
|
+
// 数据筛选
|
|
45
|
+
type: Array,
|
|
46
|
+
value: [],
|
|
47
|
+
},
|
|
48
|
+
setColor: {
|
|
49
|
+
// 设置颜色
|
|
50
|
+
type: Array,
|
|
51
|
+
value: [],
|
|
52
|
+
},
|
|
53
|
+
xField: {
|
|
54
|
+
// x轴字段选择
|
|
55
|
+
type: Object,
|
|
56
|
+
value: {
|
|
57
|
+
format: '',
|
|
58
|
+
type: '', // 数据源字段 类型
|
|
59
|
+
title: '', // 字段名中文
|
|
60
|
+
name: '', // 字段名英文
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
xStatistics: {
|
|
64
|
+
// x轴统计维度
|
|
65
|
+
type: String,
|
|
66
|
+
value: '', // 统计纬度, 只有选择时间类型才有,y 年,m月,d 日,w周,h时,min 分,s秒
|
|
67
|
+
},
|
|
68
|
+
xIsCountEmpty: {
|
|
69
|
+
// x轴 是否统计空值
|
|
70
|
+
type: Boolean,
|
|
71
|
+
value: false,
|
|
72
|
+
},
|
|
73
|
+
yField: {
|
|
74
|
+
// Y轴字段,分组字段,是否分组
|
|
75
|
+
type: Object,
|
|
76
|
+
value: {
|
|
77
|
+
numValue: [{ key: '', operationType: '' }],
|
|
78
|
+
groupKey: '',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
isLegend: {
|
|
82
|
+
// 是否显示图例
|
|
83
|
+
type: Boolean,
|
|
84
|
+
value: false,
|
|
85
|
+
},
|
|
86
|
+
legend: {
|
|
87
|
+
// 图例
|
|
88
|
+
type: String,
|
|
89
|
+
value: 'bottom', // 左 left 右right, 上top,下 bottom
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// 高级属性
|
|
93
|
+
isSeriesShowSymbol: {
|
|
94
|
+
// 是否显示数据标签 开启后 属性 series.label.show 要同时设置为true
|
|
95
|
+
type: Boolean,
|
|
96
|
+
value: true,
|
|
97
|
+
},
|
|
98
|
+
isPercent: {
|
|
99
|
+
// 百分比
|
|
100
|
+
type: Boolean,
|
|
101
|
+
value: false,
|
|
102
|
+
},
|
|
103
|
+
isUnit: {
|
|
104
|
+
// 显示单位
|
|
105
|
+
type: Boolean,
|
|
106
|
+
value: false,
|
|
107
|
+
},
|
|
108
|
+
unit: {
|
|
109
|
+
// 数字显示的单位 百分比,千分比,千,万,百万,亿,十亿
|
|
110
|
+
type: String,
|
|
111
|
+
value: '%',
|
|
112
|
+
},
|
|
113
|
+
decimalDigits: {
|
|
114
|
+
// 小数位数
|
|
115
|
+
type: Number,
|
|
116
|
+
value: 0,
|
|
117
|
+
},
|
|
118
|
+
suffix: {
|
|
119
|
+
// 后缀
|
|
120
|
+
type: String,
|
|
121
|
+
value: '',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
data: {
|
|
125
|
+
ec: {},
|
|
126
|
+
canvas_id: {
|
|
127
|
+
type: String,
|
|
128
|
+
value: `canvas_pie_${Date.now()}_${Math.random() * 100}`,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
lifetimes: {
|
|
132
|
+
attached() {
|
|
133
|
+
// 在组件实例进入页面节点树时执行
|
|
134
|
+
this.initData();
|
|
135
|
+
},
|
|
136
|
+
detached() {
|
|
137
|
+
// 在组件实例被从页面节点树移除时执行
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
// 以下是旧式的定义方式,可以保持对 <2.2.3 版本基础库的兼容
|
|
141
|
+
attached() {
|
|
142
|
+
// 在组件实例进入页面节点树时执行
|
|
143
|
+
this.initData();
|
|
144
|
+
},
|
|
145
|
+
detached() {
|
|
146
|
+
// 在组件实例被从页面节点树移除时执行
|
|
147
|
+
},
|
|
148
|
+
observers: {
|
|
149
|
+
// 当参数变化时
|
|
150
|
+
option() {
|
|
151
|
+
this.initData();
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
methods: {
|
|
155
|
+
initData() {
|
|
156
|
+
this.setData({
|
|
157
|
+
ec: {
|
|
158
|
+
onInit: this.initChart.bind(this),
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
async initChart(canvas, width, height, dpr) {
|
|
163
|
+
const objEchart = echarts.init(canvas, null, {
|
|
164
|
+
width,
|
|
165
|
+
height,
|
|
166
|
+
devicePixelRatio: dpr,
|
|
167
|
+
});
|
|
168
|
+
canvas.setChart(objEchart);
|
|
169
|
+
const objEChartPie = new EchartPie();
|
|
170
|
+
await objEChartPie.setOptions(this.properties);
|
|
171
|
+
const options = await objEChartPie.getOptions();
|
|
172
|
+
// objEchart.clear();
|
|
173
|
+
console.log('设置前参数pie', options);
|
|
174
|
+
objEchart.setOption(options);
|
|
175
|
+
return objEchart;
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<formcell
|
|
2
|
-
className="{{cls}}"
|
|
1
|
+
<formcell
|
|
2
|
+
className="{{cls}}"
|
|
3
3
|
style="{{style}}"
|
|
4
4
|
label="{{labelVisible ? label : null}}"
|
|
5
5
|
layout="{{layout}}"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<view class="{{subCls}}">
|
|
10
10
|
<view class="weui-cell__bd">
|
|
11
11
|
<picker
|
|
12
|
-
class="weui-picker__group"
|
|
12
|
+
class="weui-picker__group weui-input"
|
|
13
13
|
bindchange="onChange"
|
|
14
14
|
bindcancel="onCancel"
|
|
15
15
|
mode="{{mode}}"
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
</picker>
|
|
23
23
|
</view>
|
|
24
24
|
</view>
|
|
25
|
-
</formcell>
|
|
25
|
+
</formcell>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<formcell
|
|
2
|
-
className="{{cls}}"
|
|
1
|
+
<formcell
|
|
2
|
+
className="{{cls}}"
|
|
3
3
|
style="{{style}}"
|
|
4
4
|
label="{{labelVisible ? label : null}}"
|
|
5
5
|
layout="{{layout}}"
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
>
|
|
9
9
|
<view class="weui-cell weui-cell_active weui-cell_form}} {{disabled ? 'weui-cell_disabled' : ''}}">
|
|
10
10
|
<view class="weui-cell__bd">
|
|
11
|
-
<textarea
|
|
12
|
-
class="weui-textarea"
|
|
11
|
+
<textarea
|
|
12
|
+
class="weui-textarea"
|
|
13
13
|
placeholder="{{placeholder}}"
|
|
14
14
|
placeholder-class="weui-input__placeholder"
|
|
15
15
|
bindinput="handleChange"
|
|
16
16
|
value="{{value}}"
|
|
17
|
+
disable="{{disabled}}"
|
|
17
18
|
maxlength="{{maxLength}}"
|
|
18
19
|
></textarea>
|
|
19
20
|
<view wx:if="{{counterVisible}}" class="weui-textarea-counter"><span>{{!!value ? value.length : 0}}</span>/{{maxLength}}</view>
|
|
20
21
|
</view>
|
|
21
22
|
</view>
|
|
22
|
-
</formcell>
|
|
23
|
+
</formcell>
|
|
@@ -24,8 +24,7 @@ Component({
|
|
|
24
24
|
value: 'horizontal',
|
|
25
25
|
},
|
|
26
26
|
defaultValue: {
|
|
27
|
-
type:
|
|
28
|
-
value: '',
|
|
27
|
+
type: null,
|
|
29
28
|
},
|
|
30
29
|
single: {
|
|
31
30
|
type: Boolean,
|
|
@@ -75,7 +74,7 @@ Component({
|
|
|
75
74
|
const urls = e.detail.cloudUrls; // uploadFile 获取返回值
|
|
76
75
|
// 小程序自带tempURL 不需要调用 tcb.getTempFileURL 获取
|
|
77
76
|
this.triggerEvent('success', {
|
|
78
|
-
value: urls
|
|
77
|
+
value: urls,
|
|
79
78
|
});
|
|
80
79
|
this.setData({
|
|
81
80
|
files: this.data.files.concat(e.detail.urls.map((url) => ({ url }))),
|
|
@@ -83,30 +82,51 @@ Component({
|
|
|
83
82
|
});
|
|
84
83
|
},
|
|
85
84
|
onDelete: function (e) {
|
|
86
|
-
this.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
if (this.data.urls.length == 0) {
|
|
86
|
+
var storgeUrls = [];
|
|
87
|
+
this.data.cloudFile.forEach((v, index) => {
|
|
88
|
+
if (e.detail.index != index) {
|
|
89
|
+
storgeUrls.push(v);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
this.setData({
|
|
93
|
+
files: this.data.files.filter((v, index) => e.detail.index !== index),
|
|
94
|
+
urls: storgeUrls,
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
this.setData({
|
|
98
|
+
files: this.data.files.filter((v, index) => e.detail.index !== index),
|
|
99
|
+
urls: this.data.urls.filter((v, index) => e.detail.index !== index),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
90
102
|
},
|
|
91
103
|
},
|
|
92
104
|
observers: {
|
|
93
105
|
defaultValue: async function (value) {
|
|
94
|
-
if (!Array.isArray(value)) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
// if (!Array.isArray(value)) {
|
|
107
|
+
// value = [value].filter((v) => v.length > 0);
|
|
108
|
+
// //value = [value]
|
|
109
|
+
// }
|
|
110
|
+
if (value) {
|
|
111
|
+
let httpFiles = [];
|
|
112
|
+
for (let f of value) {
|
|
113
|
+
const hf = await getTempFileURL(f);
|
|
114
|
+
const httpFile = { url: hf };
|
|
115
|
+
httpFiles.push(httpFile);
|
|
116
|
+
}
|
|
117
|
+
this.setData({
|
|
118
|
+
files: httpFiles,
|
|
119
|
+
cloudFile:
|
|
120
|
+
JSON.stringify(value) != JSON.stringify(this.data.cloudFile)
|
|
121
|
+
? value
|
|
122
|
+
: [],
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
this.setData({
|
|
126
|
+
files: [],
|
|
127
|
+
cloudFile: [],
|
|
128
|
+
});
|
|
102
129
|
}
|
|
103
|
-
this.setData({
|
|
104
|
-
files: httpFiles,
|
|
105
|
-
cloudFile:
|
|
106
|
-
JSON.stringify(value) != JSON.stringify(this.data.cloudFile)
|
|
107
|
-
? value
|
|
108
|
-
: [],
|
|
109
|
-
});
|
|
110
130
|
},
|
|
111
131
|
|
|
112
132
|
'maxUploadCount, single': function (maxUploadCount, single) {
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
<mp-cells>
|
|
2
2
|
<mp-cell>
|
|
3
|
-
<mp-uploader
|
|
3
|
+
<mp-uploader
|
|
4
|
+
max-size="{{maxSize * 1024 * 1024}}"
|
|
5
|
+
files="{{files}}"
|
|
6
|
+
showDelete="{{true}}"
|
|
7
|
+
ext-class="{{layout}}"
|
|
8
|
+
bindfail="uploadError"
|
|
9
|
+
bindsuccess="uploadSuccess"
|
|
10
|
+
select="{{selectFile}}"
|
|
11
|
+
upload="{{uploadFile}}"
|
|
12
|
+
maxCount="{{maxCount}}"
|
|
13
|
+
title="{{title}}"
|
|
14
|
+
binddelete="onDelete">
|
|
15
|
+
</mp-uploader>
|
|
4
16
|
</mp-cell>
|
|
5
17
|
</mp-cells>
|
|
6
18
|
<!-- uploader delete 实际代码接受 showDelete
|
|
@@ -9,7 +21,7 @@
|
|
|
9
21
|
|
|
10
22
|
<!-- bind开头的是事件handler,wxml模版中不能带 `{{}}`
|
|
11
23
|
```
|
|
12
|
-
<mp-uploader files="{{files}}" showDelete="{{true}}" ext-class="{{layout}}" bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uploadFile}}" maxCount="{{maxUploadCount}}" title="{{title}}"
|
|
24
|
+
<mp-uploader files="{{files}}" showDelete="{{true}}" ext-class="{{layout}}" bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uploadFile}}" maxCount="{{maxUploadCount}}" title="{{title}}" binddelete="onDelete"></mp-uploader>
|
|
13
25
|
```
|
|
14
|
-
upload 是函数带{{}}, bindtelete直接传函数名字符串
|
|
26
|
+
upload 是函数带{{}}, bindtelete直接传函数名字符串
|
|
15
27
|
-->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
2
2
|
import SparkMD5 from '../../../utils/spark-md5';
|
|
3
|
-
import { transSize } from '../../../utils/platform';
|
|
3
|
+
import { transSize, uuid } from '../../../utils/platform';
|
|
4
4
|
Component({
|
|
5
5
|
options: {
|
|
6
6
|
virtualHost: true,
|
|
@@ -22,8 +22,7 @@ Component({
|
|
|
22
22
|
value: false,
|
|
23
23
|
},
|
|
24
24
|
defaultValue: {
|
|
25
|
-
type:
|
|
26
|
-
value: [],
|
|
25
|
+
type: null,
|
|
27
26
|
},
|
|
28
27
|
maxUploadCount: {
|
|
29
28
|
type: Number,
|
|
@@ -60,6 +59,7 @@ Component({
|
|
|
60
59
|
files: [],
|
|
61
60
|
urls: [],
|
|
62
61
|
cloudFile: [],
|
|
62
|
+
strogeUrls: [],
|
|
63
63
|
},
|
|
64
64
|
methods: {
|
|
65
65
|
// 批量上传文件前置事件
|
|
@@ -133,13 +133,9 @@ Component({
|
|
|
133
133
|
if (!this.handleBefore(files?.tempFiles)) return;
|
|
134
134
|
const uploadPath = 'weda-uploader';
|
|
135
135
|
const uploadPromise = files.tempFiles.map(async (tempFile) => {
|
|
136
|
-
const
|
|
137
|
-
.
|
|
138
|
-
|
|
139
|
-
var spark = new SparkMD5.ArrayBuffer();
|
|
140
|
-
spark.append(res);
|
|
141
|
-
var md5Path = spark.end(false);
|
|
142
|
-
const cloudPath = `${uploadPath}/${md5Path}-${tempFile.name}`;
|
|
136
|
+
const cloudPath = `${uploadPath}/${uuid().replaceAll('-', '')}-${
|
|
137
|
+
tempFile.name
|
|
138
|
+
}`;
|
|
143
139
|
tempFile.percent = '0';
|
|
144
140
|
tempFile.cloudPath = null;
|
|
145
141
|
tempFile.filePath = tempFile?.path || null;
|
|
@@ -162,9 +158,18 @@ Component({
|
|
|
162
158
|
_this.data.files[index].status = 'success';
|
|
163
159
|
const arr = [];
|
|
164
160
|
arr.push(res.fileID);
|
|
161
|
+
let strogeUrls = [];
|
|
162
|
+
//为了避免死循环 在组件接到默认值后用cloudFile做暂存,造成urls跟cloudFile不同步,根据暂存状态来处理更新urls
|
|
163
|
+
if (_this.data.cloudFile.length > 0) {
|
|
164
|
+
strogeUrls = [..._this.data.cloudFile, ...arr];
|
|
165
|
+
} else {
|
|
166
|
+
strogeUrls = [..._this.data.urls, ...arr];
|
|
167
|
+
}
|
|
168
|
+
//同步urls cloudFile
|
|
165
169
|
_this.setData({
|
|
166
|
-
files: _this.data.files,
|
|
167
|
-
urls: [...
|
|
170
|
+
files: [..._this.data.files],
|
|
171
|
+
urls: [...strogeUrls],
|
|
172
|
+
cloudFile: [...strogeUrls],
|
|
168
173
|
});
|
|
169
174
|
if (_this.properties.single) {
|
|
170
175
|
_this.triggerEvent('success', {
|
|
@@ -188,6 +193,7 @@ Component({
|
|
|
188
193
|
this.data.files[index].uploaded = transSize(res.totalBytesSent);
|
|
189
194
|
this.setData({
|
|
190
195
|
files: this.data.files,
|
|
196
|
+
//cloudFile:this.data.cloudFile.concat(this.data.files)
|
|
191
197
|
});
|
|
192
198
|
});
|
|
193
199
|
return { fileID: uploadTask.fileID };
|
|
@@ -204,15 +210,30 @@ Component({
|
|
|
204
210
|
},
|
|
205
211
|
|
|
206
212
|
onDelete: function (e) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
if (this.data.urls.length == 0) {
|
|
214
|
+
var storgeUrls = [];
|
|
215
|
+
this.data.cloudFile.forEach((v, index) => {
|
|
216
|
+
if (e.target.dataset.item.cloudPath != v) {
|
|
217
|
+
storgeUrls.push(v);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
this.setData({
|
|
221
|
+
files: this.data.files.filter(
|
|
222
|
+
(v, index) => e.target.dataset.item.cloudPath !== v.cloudPath
|
|
223
|
+
),
|
|
224
|
+
urls: storgeUrls,
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
const filelist = this.data.files.filter(
|
|
228
|
+
(item) => e.target.dataset.item?.path != item?.path
|
|
229
|
+
);
|
|
230
|
+
this.setData({
|
|
231
|
+
files: filelist,
|
|
232
|
+
urls: this.data.urls.filter(
|
|
233
|
+
(v, index) => e.target.dataset.item?.cloudPath != v
|
|
234
|
+
),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
216
237
|
},
|
|
217
238
|
reload: function (e) {
|
|
218
239
|
this.handleUpload(e.target.dataset.item);
|
|
@@ -236,11 +257,11 @@ Component({
|
|
|
236
257
|
},
|
|
237
258
|
observers: {
|
|
238
259
|
defaultValue: async function (value) {
|
|
239
|
-
if (!Array.isArray(value)) {
|
|
240
|
-
|
|
241
|
-
}
|
|
260
|
+
// if (!Array.isArray(value)) {
|
|
261
|
+
// value = [value].filter((v) => v.length > 0);
|
|
262
|
+
// }
|
|
242
263
|
let httpFiles = [];
|
|
243
|
-
if (value.
|
|
264
|
+
if (value && JSON.stringify(value) != '[]') {
|
|
244
265
|
for (let f of value) {
|
|
245
266
|
const hf = await getTempFileURL(f);
|
|
246
267
|
const uuidReg = /[0-9a-f]{8}([0-9a-f]{4}){3}[0-9a-f]{12}-/;
|
|
@@ -256,12 +277,19 @@ Component({
|
|
|
256
277
|
};
|
|
257
278
|
httpFiles.push(httpFile);
|
|
258
279
|
}
|
|
280
|
+
this.setData({
|
|
281
|
+
files: httpFiles,
|
|
282
|
+
cloudFile:
|
|
283
|
+
JSON.stringify(value) != JSON.stringify(this.data.cloudFile)
|
|
284
|
+
? value
|
|
285
|
+
: [],
|
|
286
|
+
});
|
|
287
|
+
} else {
|
|
288
|
+
this.setData({
|
|
289
|
+
files: [],
|
|
290
|
+
cloudFile: [],
|
|
291
|
+
});
|
|
259
292
|
}
|
|
260
|
-
|
|
261
|
-
this.setData({
|
|
262
|
-
files: httpFiles,
|
|
263
|
-
cloudFile: value,
|
|
264
|
-
});
|
|
265
293
|
},
|
|
266
294
|
'maxUploadCount, single': function (maxUploadCount, single) {
|
|
267
295
|
const maxCount = single ? 1 : maxUploadCount;
|
|
@@ -109,11 +109,11 @@ Component({
|
|
|
109
109
|
}
|
|
110
110
|
item.paramObj = paramObj;
|
|
111
111
|
if (item.withParams && item.params.length > 0) {
|
|
112
|
-
wx.
|
|
112
|
+
wx.redirectTo({
|
|
113
113
|
url: '../' + item?.insideUrl + '/index?' + item.paramObj.join('&'),
|
|
114
114
|
});
|
|
115
115
|
} else {
|
|
116
|
-
wx.
|
|
116
|
+
wx.redirectTo({
|
|
117
117
|
url: '../' + item?.insideUrl + '/index',
|
|
118
118
|
});
|
|
119
119
|
}
|
|
@@ -161,17 +161,16 @@ Component({
|
|
|
161
161
|
optionList,
|
|
162
162
|
});
|
|
163
163
|
},
|
|
164
|
-
'titleMaxLines,titleColor,titleFontWeight,titleFontSize,textAlign,titleLineHeight':
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
titleStyle = `
|
|
164
|
+
'titleMaxLines,titleColor,titleFontWeight,titleFontSize,textAlign,titleLineHeight': function (
|
|
165
|
+
titleMaxLines,
|
|
166
|
+
titleColor,
|
|
167
|
+
titleFontWeight,
|
|
168
|
+
titleFontSize,
|
|
169
|
+
textAlign,
|
|
170
|
+
titleLineHeight
|
|
171
|
+
) {
|
|
172
|
+
let titleStyle = this.properties.titleStyle;
|
|
173
|
+
titleStyle = `
|
|
175
174
|
-webkit-line-clamp:${titleMaxLines ? titleMaxLines : 'revert'};
|
|
176
175
|
color: ${titleColor};
|
|
177
176
|
font-weight: ${titleFontWeight};
|
|
@@ -179,19 +178,18 @@ Component({
|
|
|
179
178
|
text-align: ${textAlign};
|
|
180
179
|
line-height: ${titleLineHeight == 'auto' ? 'normal' : titleLineHeight};
|
|
181
180
|
`;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
'desMaxLines,desColor,desFontWeight,desFontSize,textAlign,desLineHeight':
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
desStyle = `
|
|
181
|
+
this.setData({ titleStyle });
|
|
182
|
+
},
|
|
183
|
+
'desMaxLines,desColor,desFontWeight,desFontSize,textAlign,desLineHeight': function (
|
|
184
|
+
desMaxLines,
|
|
185
|
+
desColor,
|
|
186
|
+
desFontWeight,
|
|
187
|
+
desFontSize,
|
|
188
|
+
textAlign,
|
|
189
|
+
desLineHeight
|
|
190
|
+
) {
|
|
191
|
+
let desStyle = this.properties.desStyle;
|
|
192
|
+
desStyle = `
|
|
195
193
|
-webkit-line-clamp:${desMaxLines ? desMaxLines : 'revert'};
|
|
196
194
|
color: ${desColor};
|
|
197
195
|
font-weight: ${desFontWeight};
|
|
@@ -199,7 +197,7 @@ Component({
|
|
|
199
197
|
text-align: ${textAlign};
|
|
200
198
|
line-height: ${desLineHeight == 'auto' ? 'normal' : desLineHeight};
|
|
201
199
|
`;
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
this.setData({ desStyle });
|
|
201
|
+
},
|
|
204
202
|
},
|
|
205
203
|
});
|