mali-applet-ui 0.2.94 → 0.2.96
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.
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-load-more" :class="[className]">
|
|
3
|
-
<
|
|
4
|
-
|
|
2
|
+
<view class="ml-load-more" :class="[className || '', {'not-data': showNotData}]">
|
|
3
|
+
<view class="ml-load-more-content">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</view>
|
|
6
|
+
<view v-if="showNotData && !loading" class="ml-load-more-empty">
|
|
7
|
+
<slot name="empty">
|
|
8
|
+
<ml-not-data :emptyUrl="emptyUrl" :emptyText="emptyText" :emptyHint="emptyHint"></ml-not-data>
|
|
9
|
+
<view class="ml-load-more-empty-content">
|
|
10
|
+
<slot name="emptycontent"></slot>
|
|
11
|
+
</view>
|
|
12
|
+
</slot>
|
|
13
|
+
</view>
|
|
14
|
+
<view v-else-if="showPage" class="ml-load-more-warpper">
|
|
5
15
|
<view v-if="loadStatus === 'more'" class="ml-load-more-status-more">上拉显示更多</view>
|
|
6
16
|
<view v-if="loadStatus === 'noMore'" class="ml-load-more-status-no-more">没有更多数据了</view>
|
|
7
17
|
</view>
|
|
@@ -20,6 +30,7 @@ export default {
|
|
|
20
30
|
pageProps: Object,
|
|
21
31
|
requestMethod: Function,
|
|
22
32
|
filterForm: Object,
|
|
33
|
+
emptyConfig: Object,
|
|
23
34
|
className: String
|
|
24
35
|
},
|
|
25
36
|
inject: {
|
|
@@ -35,7 +46,10 @@ export default {
|
|
|
35
46
|
pageSize: globalStore.loadMore.pageSize,
|
|
36
47
|
currPage: 1,
|
|
37
48
|
total: 0
|
|
38
|
-
}
|
|
49
|
+
},
|
|
50
|
+
emptyUrl: '',
|
|
51
|
+
emptyText: '',
|
|
52
|
+
emptyHint: ''
|
|
39
53
|
}
|
|
40
54
|
},
|
|
41
55
|
computed: {
|
|
@@ -45,8 +59,23 @@ export default {
|
|
|
45
59
|
}
|
|
46
60
|
return this.pageVO.pageSize * this.pageVO.currPage < Number(this.pageVO.total) ? 'more' : 'noMore'
|
|
47
61
|
},
|
|
62
|
+
showNotData () {
|
|
63
|
+
return !this.value || !this.value.length
|
|
64
|
+
},
|
|
48
65
|
pagePropOpts () {
|
|
49
66
|
return { ...globalStore.loadMore.pageProp, ...this.pageProps }
|
|
67
|
+
},
|
|
68
|
+
hasFilters () {
|
|
69
|
+
console.log(this.filterForm)
|
|
70
|
+
for (let key in this.filterForm) {
|
|
71
|
+
if (this.filterForm[key]) {
|
|
72
|
+
return true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return false
|
|
76
|
+
},
|
|
77
|
+
emptyOpts () {
|
|
78
|
+
return Object.assign({}, this.emptyConfig)
|
|
50
79
|
}
|
|
51
80
|
},
|
|
52
81
|
created () {
|
|
@@ -120,6 +149,7 @@ export default {
|
|
|
120
149
|
uni.stopPullDownRefresh()
|
|
121
150
|
console.error(e)
|
|
122
151
|
}
|
|
152
|
+
this.updateEmptyStatus()
|
|
123
153
|
},
|
|
124
154
|
async loadMore() {
|
|
125
155
|
if (this.showPage && !this.loading && this.loadStatus === 'more') {
|
|
@@ -132,12 +162,33 @@ export default {
|
|
|
132
162
|
console.error(e)
|
|
133
163
|
}
|
|
134
164
|
}
|
|
165
|
+
},
|
|
166
|
+
updateEmptyStatus () {
|
|
167
|
+
if (this.hasFilters) {
|
|
168
|
+
this.emptyUrl = this.emptyOpts.resultUrl || globalStore.loadMore.notData.resultUrl
|
|
169
|
+
this.emptyText = XEUtils.template(this.emptyOpts.resultText || globalStore.loadMore.notData.resultText, this.filterForm)
|
|
170
|
+
this.emptyHint = XEUtils.template(this.emptyOpts.resultHint || globalStore.loadMore.notData.resultHint, this.filterForm)
|
|
171
|
+
} else {
|
|
172
|
+
this.emptyUrl = this.emptyOpts.emptyUrl || globalStore.loadMore.notData.emptyUrl
|
|
173
|
+
this.emptyText = this.emptyOpts.emptyText || globalStore.loadMore.notData.emptyText
|
|
174
|
+
this.emptyHint = this.emptyOpts.emptyHint || globalStore.loadMore.notData.emptyHint
|
|
175
|
+
}
|
|
135
176
|
}
|
|
136
177
|
}
|
|
137
178
|
}
|
|
138
179
|
</script>
|
|
139
180
|
|
|
140
181
|
<style lang="scss">
|
|
182
|
+
.ml-load-more {
|
|
183
|
+
&.not-data {
|
|
184
|
+
.ml-load-more-content {
|
|
185
|
+
display: none;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
.ml-load-more-empty-content {
|
|
189
|
+
text-align: center;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
141
192
|
.ml-load-more-warpper {
|
|
142
193
|
text-align: center;
|
|
143
194
|
.ml-load-more-status-more,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-not-data">
|
|
3
|
+
<slot>
|
|
4
|
+
<view v-if="emptyUrl || $slots.icon" class="ml-not-data-image">
|
|
5
|
+
<slot name="icon">
|
|
6
|
+
<image class="ml-not-data-image-icon" :src="emptyUrl" mode="aspectFit"></image>
|
|
7
|
+
</slot>
|
|
8
|
+
</view>
|
|
9
|
+
<view v-if="emptyText || $slots.text" class="ml-not-data-text">
|
|
10
|
+
<slot name="text">
|
|
11
|
+
<text>{{ emptyText || '暂无数据!' }}</text>
|
|
12
|
+
</slot>
|
|
13
|
+
</view>
|
|
14
|
+
<view v-if="emptyHint || $slots.hint" class="ml-not-data-hint">
|
|
15
|
+
<slot name="hint">
|
|
16
|
+
<text>{{ emptyHint }}</text>
|
|
17
|
+
</slot>
|
|
18
|
+
</view>
|
|
19
|
+
<view class="ml-not-data-contnet">
|
|
20
|
+
<slot name="content"></slot>
|
|
21
|
+
</view>
|
|
22
|
+
</slot>
|
|
23
|
+
</view>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: 'MlNotData',
|
|
29
|
+
props: {
|
|
30
|
+
emptyUrl: String,
|
|
31
|
+
emptyText: String,
|
|
32
|
+
emptyHint: String
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style lang="scss">
|
|
38
|
+
.ml-not-data {
|
|
39
|
+
text-align: center;
|
|
40
|
+
padding-top: 5vh;
|
|
41
|
+
.ml-not-data-image-icon {
|
|
42
|
+
width: 400rpx;
|
|
43
|
+
}
|
|
44
|
+
.ml-not-data-text {
|
|
45
|
+
font-size: 32rpx;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
}
|
|
48
|
+
.ml-not-data-hint {
|
|
49
|
+
font-size: 26rpx;
|
|
50
|
+
padding: 0 60rpx;
|
|
51
|
+
line-height: 40rpx;
|
|
52
|
+
color: rgba(0, 0, 0, 0.45);
|
|
53
|
+
}
|
|
54
|
+
.ml-not-data-text,
|
|
55
|
+
.ml-not-data-hint {
|
|
56
|
+
margin-bottom: 20rpx;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -54,9 +54,8 @@
|
|
|
54
54
|
</template>
|
|
55
55
|
|
|
56
56
|
<script>
|
|
57
|
-
import XEUtils from 'xe-utils'
|
|
58
57
|
import globalStore from '../../config/store'
|
|
59
|
-
import { getFileSuffix } from '../../utils/file'
|
|
58
|
+
import { getFileSuffix, getFileName } from '../../utils/file'
|
|
60
59
|
import { uploadAllFiles, uploadImageFiles } from './file-handle'
|
|
61
60
|
|
|
62
61
|
export default {
|
|
@@ -184,7 +183,7 @@ export default {
|
|
|
184
183
|
loadList () {
|
|
185
184
|
if (this.simpleValue) {
|
|
186
185
|
this.fileList = (this.urlList && this.urlList.length ? this.urlList : (this.value || [])).map(url => {
|
|
187
|
-
const name =
|
|
186
|
+
const name = getFileName(url)
|
|
188
187
|
const obj = {
|
|
189
188
|
id: null,
|
|
190
189
|
[this.nameField]: name,
|
|
@@ -246,10 +245,6 @@ export default {
|
|
|
246
245
|
})
|
|
247
246
|
}
|
|
248
247
|
return item[this.urlField]
|
|
249
|
-
},
|
|
250
|
-
getUrlName (url) {
|
|
251
|
-
const urlRest = XEUtils.parseUrl(url)
|
|
252
|
-
return urlRest.pathname.split('/').slice(-1)[0] || ''
|
|
253
248
|
},
|
|
254
249
|
previewImageEvent (item, index) {
|
|
255
250
|
if (!this.preview) {
|
package/config/store.js
CHANGED
package/package.json
CHANGED
package/utils/file.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
1
3
|
export function getFileSuffix (filename) {
|
|
2
4
|
const pos = filename.lastIndexOf('.')
|
|
3
5
|
let suffix = ''
|
|
@@ -7,6 +9,11 @@ export function getFileSuffix (filename) {
|
|
|
7
9
|
return suffix
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
export function getFileName (url) {
|
|
13
|
+
const urlRest = XEUtils.parseUrl(url)
|
|
14
|
+
return urlRest.pathname.split('/').slice(-1)[0] || ''
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* 下载文件
|
|
12
19
|
* @param {*} url
|