mali-applet-ui 0.2.94 → 0.2.95
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,18 @@
|
|
|
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">
|
|
9
|
+
<template #content>
|
|
10
|
+
<slot name="emptycontent"></slot>
|
|
11
|
+
</template>
|
|
12
|
+
</ml-not-data>
|
|
13
|
+
</slot>
|
|
14
|
+
</view>
|
|
15
|
+
<view v-else-if="showPage" class="ml-load-more-warpper">
|
|
5
16
|
<view v-if="loadStatus === 'more'" class="ml-load-more-status-more">上拉显示更多</view>
|
|
6
17
|
<view v-if="loadStatus === 'noMore'" class="ml-load-more-status-no-more">没有更多数据了</view>
|
|
7
18
|
</view>
|
|
@@ -20,6 +31,7 @@ export default {
|
|
|
20
31
|
pageProps: Object,
|
|
21
32
|
requestMethod: Function,
|
|
22
33
|
filterForm: Object,
|
|
34
|
+
emptyConfig: Object,
|
|
23
35
|
className: String
|
|
24
36
|
},
|
|
25
37
|
inject: {
|
|
@@ -35,7 +47,10 @@ export default {
|
|
|
35
47
|
pageSize: globalStore.loadMore.pageSize,
|
|
36
48
|
currPage: 1,
|
|
37
49
|
total: 0
|
|
38
|
-
}
|
|
50
|
+
},
|
|
51
|
+
emptyUrl: '',
|
|
52
|
+
emptyText: '',
|
|
53
|
+
emptyHint: ''
|
|
39
54
|
}
|
|
40
55
|
},
|
|
41
56
|
computed: {
|
|
@@ -45,8 +60,23 @@ export default {
|
|
|
45
60
|
}
|
|
46
61
|
return this.pageVO.pageSize * this.pageVO.currPage < Number(this.pageVO.total) ? 'more' : 'noMore'
|
|
47
62
|
},
|
|
63
|
+
showNotData () {
|
|
64
|
+
return !this.value || !this.value.length
|
|
65
|
+
},
|
|
48
66
|
pagePropOpts () {
|
|
49
67
|
return { ...globalStore.loadMore.pageProp, ...this.pageProps }
|
|
68
|
+
},
|
|
69
|
+
hasFilters () {
|
|
70
|
+
console.log(this.filterForm)
|
|
71
|
+
for (let key in this.filterForm) {
|
|
72
|
+
if (this.filterForm[key]) {
|
|
73
|
+
return true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return false
|
|
77
|
+
},
|
|
78
|
+
emptyOpts () {
|
|
79
|
+
return Object.assign({}, this.emptyConfig)
|
|
50
80
|
}
|
|
51
81
|
},
|
|
52
82
|
created () {
|
|
@@ -120,6 +150,7 @@ export default {
|
|
|
120
150
|
uni.stopPullDownRefresh()
|
|
121
151
|
console.error(e)
|
|
122
152
|
}
|
|
153
|
+
this.updateEmptyStatus()
|
|
123
154
|
},
|
|
124
155
|
async loadMore() {
|
|
125
156
|
if (this.showPage && !this.loading && this.loadStatus === 'more') {
|
|
@@ -132,12 +163,30 @@ export default {
|
|
|
132
163
|
console.error(e)
|
|
133
164
|
}
|
|
134
165
|
}
|
|
166
|
+
},
|
|
167
|
+
updateEmptyStatus () {
|
|
168
|
+
if (this.hasFilters) {
|
|
169
|
+
this.emptyUrl = this.emptyOpts.resultUrl || globalStore.loadMore.notData.resultUrl
|
|
170
|
+
this.emptyText = XEUtils.template(this.emptyOpts.resultText || globalStore.loadMore.notData.resultText, this.filterForm)
|
|
171
|
+
this.emptyHint = XEUtils.template(this.emptyOpts.resultHint || globalStore.loadMore.notData.resultHint, this.filterForm)
|
|
172
|
+
} else {
|
|
173
|
+
this.emptyUrl = this.emptyOpts.emptyUrl || globalStore.loadMore.notData.emptyUrl
|
|
174
|
+
this.emptyText = this.emptyOpts.emptyText || globalStore.loadMore.notData.emptyText
|
|
175
|
+
this.emptyHint = this.emptyOpts.emptyHint || globalStore.loadMore.notData.emptyHint
|
|
176
|
+
}
|
|
135
177
|
}
|
|
136
178
|
}
|
|
137
179
|
}
|
|
138
180
|
</script>
|
|
139
181
|
|
|
140
182
|
<style lang="scss">
|
|
183
|
+
.ml-load-more {
|
|
184
|
+
&.not-data {
|
|
185
|
+
.ml-load-more-content {
|
|
186
|
+
display: none;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
141
190
|
.ml-load-more-warpper {
|
|
142
191
|
text-align: center;
|
|
143
192
|
.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="contnet"></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: 100rpx;
|
|
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
|