mali-applet-ui 0.0.54 → 0.0.57
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/components/ml-button/ml-button.vue +3 -1
- package/components/ml-echarts/ml-echarts.vue +1 -5
- package/components/ml-form-item/ml-form-item.vue +1 -1
- package/components/ml-list-group/ml-list-group.vue +106 -2
- package/components/ml-switch/ml-switch.vue +7 -1
- package/config/store.js +11 -3
- package/package.json +1 -1
|
@@ -71,11 +71,13 @@ export default {
|
|
|
71
71
|
}
|
|
72
72
|
&.type-button {
|
|
73
73
|
width: 100%;
|
|
74
|
-
margin: 0 10rpx;
|
|
75
74
|
padding: 0 20rpx;
|
|
76
75
|
line-height: 80rpx;
|
|
77
76
|
border: 1px solid #e5e5e5;
|
|
78
77
|
border-radius: 10rpx;
|
|
78
|
+
&+.ml-button {
|
|
79
|
+
margin-left: 20rpx;
|
|
80
|
+
}
|
|
79
81
|
&.status-primary {
|
|
80
82
|
color: #ffffff;
|
|
81
83
|
background: $uni-color-primary;
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import XEUtils from 'xe-utils'
|
|
9
9
|
import WxCanvas from './wx-canvas';
|
|
10
10
|
import * as echarts from './echarts';
|
|
11
|
-
import globalStore from '../../config/store'
|
|
12
11
|
|
|
13
12
|
export default {
|
|
14
13
|
name: 'MlEcharts',
|
|
@@ -62,10 +61,7 @@ export default {
|
|
|
62
61
|
opts.legend.formatter = this.customFormat
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
|
-
return
|
|
66
|
-
color: globalStore.echarts.color,
|
|
67
|
-
...opts
|
|
68
|
-
}
|
|
64
|
+
return opts
|
|
69
65
|
},
|
|
70
66
|
customFormat (name) {
|
|
71
67
|
return this.formatLegend(name, this.options || {})
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<ml-select-picker v-else-if="matchComponent('MlSelectPicker')" :value="itemValue" :options="renderOpts.options" border @change="modelEvent"></ml-select-picker>
|
|
14
14
|
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" border @change="modelEvent"></ml-textarea>
|
|
15
15
|
<ml-upload v-else-if="matchComponent('MlUpload')" :value="itemValue" :mediatype="renderOpts.mediatype || 'image'" @change="modelEvent"></ml-upload>
|
|
16
|
-
<ml-amount-input v-else-if="matchComponent('MlAmountInput')" :value="itemValue" @change="modelEvent"></ml-amount-input>
|
|
16
|
+
<ml-amount-input v-else-if="matchComponent('MlAmountInput')" :value="itemValue" border @change="modelEvent"></ml-amount-input>
|
|
17
17
|
<ml-amount-text v-else-if="matchComponent('MlAmountText')" :value="itemValue" @change="modelEvent"></ml-amount-text>
|
|
18
18
|
<text v-else class="ml-form-item-default-content">{{ itemValue }}</text>
|
|
19
19
|
</slot>
|
|
@@ -4,21 +4,125 @@
|
|
|
4
4
|
<scroll-view scroll-y>
|
|
5
5
|
<slot></slot>
|
|
6
6
|
</scroll-view>
|
|
7
|
-
<uni-load-more v-if="
|
|
7
|
+
<uni-load-more v-if="showPage" :status="loadStatus"></uni-load-more>
|
|
8
8
|
</view>
|
|
9
9
|
</view>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
+
import globalStore from '../../config/store'
|
|
14
|
+
import XEUtils from 'xe-utils'
|
|
15
|
+
|
|
13
16
|
export default {
|
|
14
17
|
name: 'MlListGroup',
|
|
15
18
|
options: {
|
|
16
19
|
virtualHost: true
|
|
17
20
|
},
|
|
18
21
|
props: {
|
|
22
|
+
value: Array,
|
|
23
|
+
showPage: Boolean,
|
|
24
|
+
autoload: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
pageProps: Object,
|
|
29
|
+
requestMethod: Function,
|
|
19
30
|
title: String,
|
|
20
|
-
loadMore: Boolean,
|
|
21
31
|
className: String
|
|
32
|
+
},
|
|
33
|
+
data () {
|
|
34
|
+
return {
|
|
35
|
+
loading: false,
|
|
36
|
+
pageVO: {
|
|
37
|
+
pageSize: globalStore.list.pageSize,
|
|
38
|
+
currPage: 1,
|
|
39
|
+
total: 0
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
computed: {
|
|
44
|
+
loadStatus () {
|
|
45
|
+
if (this.loading) {
|
|
46
|
+
return 'loading'
|
|
47
|
+
}
|
|
48
|
+
return this.pageVO.pageSize * this.pageVO.currPage < Number(this.pageVO.total) ? 'more' : 'noMore'
|
|
49
|
+
},
|
|
50
|
+
pagePropOpts () {
|
|
51
|
+
return { ...globalStore.list.pageProp, ...this.pageProps }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
created () {
|
|
55
|
+
if (this.autoload && this.requestMethod) {
|
|
56
|
+
this.reload()
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
getParams () {
|
|
61
|
+
return this.showPage ? {
|
|
62
|
+
pageObj: this.pageVO,
|
|
63
|
+
data: {
|
|
64
|
+
[this.pagePropOpts.currentPage || 'page']: this.pageVO.currPage,
|
|
65
|
+
[this.pagePropOpts.pageSize || 'limit']: this.pageVO.pageSize
|
|
66
|
+
}
|
|
67
|
+
} : {
|
|
68
|
+
data: {}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
getList () {
|
|
72
|
+
this.loading = true
|
|
73
|
+
if (this.requestMethod) {
|
|
74
|
+
return Promise.resolve(
|
|
75
|
+
this.requestMethod(this.getParams())
|
|
76
|
+
).then(res => {
|
|
77
|
+
let data = []
|
|
78
|
+
if (XEUtils.isFunction(globalStore.list.resProps.result)) {
|
|
79
|
+
data = globalStore.list.resProps.result({ response: res }) || []
|
|
80
|
+
} else {
|
|
81
|
+
data = Array.isArray(res) ? res : XEUtils.get(res, globalStore.list.resProps.result || 'datas')
|
|
82
|
+
}
|
|
83
|
+
if (this.showPage) {
|
|
84
|
+
if (XEUtils.isFunction(globalStore.list.resProps.total)) {
|
|
85
|
+
this.pageVO.total = XEUtils.toNumber(globalStore.list.resProps.total({ response: res }))
|
|
86
|
+
} else {
|
|
87
|
+
this.pageVO.total = XEUtils.toNumber(XEUtils.get(res, globalStore.list.resProps.total || 'total'))
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
this.loading = false
|
|
91
|
+
return data
|
|
92
|
+
}).catch(() => {
|
|
93
|
+
this.loading = false
|
|
94
|
+
return []
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
return Promise.resolve([])
|
|
98
|
+
},
|
|
99
|
+
async reload() {
|
|
100
|
+
uni.showLoading({
|
|
101
|
+
title: '加载中'
|
|
102
|
+
})
|
|
103
|
+
try {
|
|
104
|
+
const data = await this.getList()
|
|
105
|
+
uni.stopPullDownRefresh()
|
|
106
|
+
uni.hideLoading()
|
|
107
|
+
this.$emit('input', data)
|
|
108
|
+
} catch (e) {
|
|
109
|
+
uni.stopPullDownRefresh()
|
|
110
|
+
uni.hideLoading()
|
|
111
|
+
console.error(e)
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
async loadMore() {
|
|
115
|
+
if (this.showPage && !this.loading && this.loadStatus === 'more') {
|
|
116
|
+
try {
|
|
117
|
+
this.pageVO.currPage++
|
|
118
|
+
const data = await this.getList()
|
|
119
|
+
const moreList = (this.value || []).concat(data)
|
|
120
|
+
this.$emit('input', moreList)
|
|
121
|
+
} catch (e) {
|
|
122
|
+
console.error(e)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
22
126
|
}
|
|
23
127
|
}
|
|
24
128
|
</script>
|
package/config/store.js
CHANGED
|
@@ -28,9 +28,17 @@ const globalStore = {
|
|
|
28
28
|
optionMethod: null
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
// 列表组件
|
|
32
|
+
list: {
|
|
33
|
+
pageSize: 30,
|
|
34
|
+
pageProp: {
|
|
35
|
+
pageSize: 'limit',
|
|
36
|
+
currentPage: 'page'
|
|
37
|
+
},
|
|
38
|
+
resProps: {
|
|
39
|
+
result: 'datas',
|
|
40
|
+
total: 'total'
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
44
|
|