@atooyu/uxto-ui 1.0.0
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 +259 -0
- package/dist/index.js +5055 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5055 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +2528 -0
- package/package.json +93 -0
- package/src/components/index.ts +51 -0
- package/src/components/u-avatar/u-avatar.vue +205 -0
- package/src/components/u-badge/u-badge.vue +145 -0
- package/src/components/u-button/u-button.vue +239 -0
- package/src/components/u-cell/u-cell.vue +179 -0
- package/src/components/u-cell-group/u-cell-group.vue +46 -0
- package/src/components/u-checkbox/u-checkbox.vue +174 -0
- package/src/components/u-checkbox-group/u-checkbox-group.vue +72 -0
- package/src/components/u-code-input/u-code-input.vue +248 -0
- package/src/components/u-count-down/u-count-down.vue +182 -0
- package/src/components/u-datetime-picker/u-datetime-picker.vue +377 -0
- package/src/components/u-divider/u-divider.vue +71 -0
- package/src/components/u-empty/u-empty.vue +98 -0
- package/src/components/u-grid/u-grid.vue +63 -0
- package/src/components/u-grid-item/u-grid-item.vue +170 -0
- package/src/components/u-icon/icons/account.svg +3 -0
- package/src/components/u-icon/icons/arrow-down.svg +3 -0
- package/src/components/u-icon/icons/arrow-left.svg +3 -0
- package/src/components/u-icon/icons/arrow-right.svg +3 -0
- package/src/components/u-icon/icons/arrow-up.svg +3 -0
- package/src/components/u-icon/icons/bell.svg +3 -0
- package/src/components/u-icon/icons/bookmark-o.svg +3 -0
- package/src/components/u-icon/icons/bookmark.svg +3 -0
- package/src/components/u-icon/icons/chat.svg +3 -0
- package/src/components/u-icon/icons/check-circle.svg +3 -0
- package/src/components/u-icon/icons/check.svg +3 -0
- package/src/components/u-icon/icons/chevron-left.svg +3 -0
- package/src/components/u-icon/icons/chevron-right.svg +3 -0
- package/src/components/u-icon/icons/clear-o.svg +3 -0
- package/src/components/u-icon/icons/clear.svg +3 -0
- package/src/components/u-icon/icons/clipboard.svg +3 -0
- package/src/components/u-icon/icons/clock.svg +3 -0
- package/src/components/u-icon/icons/close.svg +3 -0
- package/src/components/u-icon/icons/code.svg +3 -0
- package/src/components/u-icon/icons/copy.svg +3 -0
- package/src/components/u-icon/icons/delete.svg +3 -0
- package/src/components/u-icon/icons/download.svg +3 -0
- package/src/components/u-icon/icons/edit.svg +3 -0
- package/src/components/u-icon/icons/email.svg +3 -0
- package/src/components/u-icon/icons/error-o.svg +3 -0
- package/src/components/u-icon/icons/error.svg +3 -0
- package/src/components/u-icon/icons/exit-fullscreen.svg +3 -0
- package/src/components/u-icon/icons/expand-less.svg +3 -0
- package/src/components/u-icon/icons/expand-more.svg +3 -0
- package/src/components/u-icon/icons/eye-off.svg +3 -0
- package/src/components/u-icon/icons/eye.svg +3 -0
- package/src/components/u-icon/icons/flag-o.svg +3 -0
- package/src/components/u-icon/icons/flag.svg +3 -0
- package/src/components/u-icon/icons/fullscreen.svg +3 -0
- package/src/components/u-icon/icons/grid.svg +3 -0
- package/src/components/u-icon/icons/group.svg +3 -0
- package/src/components/u-icon/icons/heart-o.svg +3 -0
- package/src/components/u-icon/icons/heart.svg +3 -0
- package/src/components/u-icon/icons/info-o.svg +3 -0
- package/src/components/u-icon/icons/info.svg +3 -0
- package/src/components/u-icon/icons/keyboard-arrow-down.svg +3 -0
- package/src/components/u-icon/icons/keyboard-arrow-left.svg +3 -0
- package/src/components/u-icon/icons/keyboard-arrow-right.svg +3 -0
- package/src/components/u-icon/icons/keyboard-arrow-up.svg +3 -0
- package/src/components/u-icon/icons/like-o.svg +3 -0
- package/src/components/u-icon/icons/like.svg +3 -0
- package/src/components/u-icon/icons/link.svg +3 -0
- package/src/components/u-icon/icons/list.svg +3 -0
- package/src/components/u-icon/icons/loading.svg +3 -0
- package/src/components/u-icon/icons/lock.svg +3 -0
- package/src/components/u-icon/icons/menu-o.svg +3 -0
- package/src/components/u-icon/icons/menu.svg +3 -0
- package/src/components/u-icon/icons/message.svg +3 -0
- package/src/components/u-icon/icons/minus.svg +3 -0
- package/src/components/u-icon/icons/notification.svg +3 -0
- package/src/components/u-icon/icons/phone.svg +3 -0
- package/src/components/u-icon/icons/plus.svg +3 -0
- package/src/components/u-icon/icons/question.svg +3 -0
- package/src/components/u-icon/icons/redo.svg +3 -0
- package/src/components/u-icon/icons/refresh-o.svg +3 -0
- package/src/components/u-icon/icons/refresh.svg +3 -0
- package/src/components/u-icon/icons/reload.svg +3 -0
- package/src/components/u-icon/icons/search-o.svg +3 -0
- package/src/components/u-icon/icons/search.svg +3 -0
- package/src/components/u-icon/icons/setting.svg +3 -0
- package/src/components/u-icon/icons/share.svg +3 -0
- package/src/components/u-icon/icons/smile-o.svg +3 -0
- package/src/components/u-icon/icons/smile.svg +3 -0
- package/src/components/u-icon/icons/star-o.svg +3 -0
- package/src/components/u-icon/icons/star.svg +3 -0
- package/src/components/u-icon/icons/success-o.svg +3 -0
- package/src/components/u-icon/icons/success.svg +3 -0
- package/src/components/u-icon/icons/sync.svg +3 -0
- package/src/components/u-icon/icons/tick.svg +3 -0
- package/src/components/u-icon/icons/undo.svg +3 -0
- package/src/components/u-icon/icons/unlock.svg +3 -0
- package/src/components/u-icon/icons/upload.svg +3 -0
- package/src/components/u-icon/icons/user.svg +3 -0
- package/src/components/u-icon/icons/warning-o.svg +3 -0
- package/src/components/u-icon/icons/warning.svg +3 -0
- package/src/components/u-icon/icons/zoom-in.svg +3 -0
- package/src/components/u-icon/icons/zoom-out.svg +3 -0
- package/src/components/u-icon/index.ts +219 -0
- package/src/components/u-icon/u-icon.vue +117 -0
- package/src/components/u-image/u-image.vue +106 -0
- package/src/components/u-input/u-input.vue +208 -0
- package/src/components/u-keyboard/u-keyboard.vue +213 -0
- package/src/components/u-layout/u-layout.vue +58 -0
- package/src/components/u-line-progress/u-line-progress.vue +156 -0
- package/src/components/u-link/u-link.vue +113 -0
- package/src/components/u-list/u-list.vue +148 -0
- package/src/components/u-list-item/u-list-item.vue +180 -0
- package/src/components/u-loading/u-loading.vue +80 -0
- package/src/components/u-loading-page/u-loading-page.vue +94 -0
- package/src/components/u-modal/u-modal.vue +159 -0
- package/src/components/u-notice-bar/u-notice-bar.vue +113 -0
- package/src/components/u-number-box/u-number-box.vue +262 -0
- package/src/components/u-parse/u-parse.vue +197 -0
- package/src/components/u-picker/u-picker.vue +219 -0
- package/src/components/u-popup/u-popup.vue +257 -0
- package/src/components/u-radio/u-radio.vue +159 -0
- package/src/components/u-radio-group/u-radio-group.vue +61 -0
- package/src/components/u-rate/u-rate.vue +187 -0
- package/src/components/u-read-more/u-read-more.vue +117 -0
- package/src/components/u-search/u-search.vue +238 -0
- package/src/components/u-skeleton/u-skeleton.vue +192 -0
- package/src/components/u-slider/u-slider.vue +453 -0
- package/src/components/u-swiper/u-swiper.vue +301 -0
- package/src/components/u-swiper-item/u-swiper-item.vue +82 -0
- package/src/components/u-switch/u-switch.vue +105 -0
- package/src/components/u-tabbar/u-tabbar.vue +221 -0
- package/src/components/u-tag/u-tag.vue +144 -0
- package/src/components/u-textarea/u-textarea.vue +189 -0
- package/src/components/u-toast/u-toast.vue +186 -0
- package/src/components/u-tooltip/u-tooltip.vue +364 -0
- package/src/components/u-transition/u-transition.vue +216 -0
- package/src/components/u-upload/u-upload.vue +403 -0
- package/src/styles/index.scss +59 -0
- package/src/styles/variables.scss +68 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-upload">
|
|
3
|
+
<view class="u-upload__list">
|
|
4
|
+
<!-- 已上传文件列表 -->
|
|
5
|
+
<view
|
|
6
|
+
v-for="(file, index) in fileList"
|
|
7
|
+
:key="index"
|
|
8
|
+
class="u-upload__item"
|
|
9
|
+
:class="{
|
|
10
|
+
'u-upload__item--error': file.status === 'error',
|
|
11
|
+
'u-upload__item--uploading': file.status === 'uploading'
|
|
12
|
+
}"
|
|
13
|
+
>
|
|
14
|
+
<!-- 图片预览 -->
|
|
15
|
+
<image
|
|
16
|
+
v-if="isImage(file)"
|
|
17
|
+
class="u-upload__preview"
|
|
18
|
+
:src="file.url || file.thumb"
|
|
19
|
+
mode="aspectFill"
|
|
20
|
+
@click="handlePreview(file, index)"
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<!-- 视频预览 -->
|
|
24
|
+
<view v-else-if="isVideo(file)" class="u-upload__video">
|
|
25
|
+
<image
|
|
26
|
+
class="u-upload__preview"
|
|
27
|
+
:src="file.thumb || defaultVideoThumb"
|
|
28
|
+
mode="aspectFill"
|
|
29
|
+
@click="handlePreview(file, index)"
|
|
30
|
+
/>
|
|
31
|
+
<view class="u-upload__video-icon">
|
|
32
|
+
<text>▶</text>
|
|
33
|
+
</view>
|
|
34
|
+
</view>
|
|
35
|
+
|
|
36
|
+
<!-- 其他文件 -->
|
|
37
|
+
<view v-else class="u-upload__file" @click="handlePreview(file, index)">
|
|
38
|
+
<text class="u-upload__file-icon">📄</text>
|
|
39
|
+
<text class="u-upload__file-name">{{ getFileName(file) }}</text>
|
|
40
|
+
</view>
|
|
41
|
+
|
|
42
|
+
<!-- 上传进度 -->
|
|
43
|
+
<view v-if="file.status === 'uploading'" class="u-upload__progress">
|
|
44
|
+
<view class="u-upload__progress-bar" :style="{ width: file.progress + '%' }"></view>
|
|
45
|
+
</view>
|
|
46
|
+
|
|
47
|
+
<!-- 删除按钮 -->
|
|
48
|
+
<view
|
|
49
|
+
v-if="deletable && file.status !== 'uploading'"
|
|
50
|
+
class="u-upload__delete"
|
|
51
|
+
@click="handleDelete(index)"
|
|
52
|
+
>
|
|
53
|
+
<text class="u-upload__delete-icon">×</text>
|
|
54
|
+
</view>
|
|
55
|
+
|
|
56
|
+
<!-- 上传失败提示 -->
|
|
57
|
+
<view v-if="file.status === 'error'" class="u-upload__error">
|
|
58
|
+
<text>上传失败</text>
|
|
59
|
+
</view>
|
|
60
|
+
</view>
|
|
61
|
+
|
|
62
|
+
<!-- 上传按钮 -->
|
|
63
|
+
<view
|
|
64
|
+
v-if="showUploadBtn"
|
|
65
|
+
class="u-upload__trigger"
|
|
66
|
+
:class="{
|
|
67
|
+
'u-upload__trigger--disabled': disabled || fileList.length >= maxCount
|
|
68
|
+
}"
|
|
69
|
+
@click="handleTrigger"
|
|
70
|
+
>
|
|
71
|
+
<slot name="trigger">
|
|
72
|
+
<view class="u-upload__trigger-default">
|
|
73
|
+
<text class="u-upload__trigger-icon">+</text>
|
|
74
|
+
<text v-if="triggerText" class="u-upload__trigger-text">{{ triggerText }}</text>
|
|
75
|
+
</view>
|
|
76
|
+
</slot>
|
|
77
|
+
</view>
|
|
78
|
+
</view>
|
|
79
|
+
</view>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script setup lang="ts">
|
|
83
|
+
import { ref, computed, watch } from 'vue'
|
|
84
|
+
|
|
85
|
+
interface UploadFile {
|
|
86
|
+
url?: string
|
|
87
|
+
thumb?: string
|
|
88
|
+
name?: string
|
|
89
|
+
size?: number
|
|
90
|
+
status?: 'pending' | 'uploading' | 'done' | 'error'
|
|
91
|
+
progress?: number
|
|
92
|
+
type?: string
|
|
93
|
+
file?: any
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface Props {
|
|
97
|
+
modelValue?: UploadFile[]
|
|
98
|
+
accept?: 'image' | 'video' | 'media' | 'all'
|
|
99
|
+
multiple?: boolean
|
|
100
|
+
maxCount?: number
|
|
101
|
+
maxSize?: number
|
|
102
|
+
disabled?: boolean
|
|
103
|
+
deletable?: boolean
|
|
104
|
+
showUpload?: boolean
|
|
105
|
+
triggerText?: string
|
|
106
|
+
previewFull?: boolean
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
110
|
+
modelValue: () => [],
|
|
111
|
+
accept: 'image',
|
|
112
|
+
multiple: false,
|
|
113
|
+
maxCount: 99,
|
|
114
|
+
maxSize: 10 * 1024 * 1024,
|
|
115
|
+
disabled: false,
|
|
116
|
+
deletable: true,
|
|
117
|
+
showUpload: true,
|
|
118
|
+
triggerText: '',
|
|
119
|
+
previewFull: true
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const emit = defineEmits<{
|
|
123
|
+
'update:modelValue': [files: UploadFile[]]
|
|
124
|
+
change: [files: UploadFile[]]
|
|
125
|
+
success: [file: UploadFile]
|
|
126
|
+
fail: [error: any]
|
|
127
|
+
delete: [file: UploadFile, index: number]
|
|
128
|
+
preview: [file: UploadFile, index: number]
|
|
129
|
+
oversize: [files: UploadFile[]]
|
|
130
|
+
overcount: []
|
|
131
|
+
}>()
|
|
132
|
+
|
|
133
|
+
const fileList = ref<UploadFile[]>(props.modelValue)
|
|
134
|
+
// 默认视频缩略图占位符
|
|
135
|
+
const defaultVideoThumb = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iODAiIGhlaWdodD0iODAiIGZpbGw9IiNFNUU1RTUiLz48dGV4dCB4PSI1MCUiIHk9IjUwJSIgZmlsbD0iIzk5OSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgZm9udC1zaXplPSIyNCI+▶PC90ZXh0Pjwvc3ZnPg=='
|
|
136
|
+
|
|
137
|
+
const showUploadBtn = computed(() => {
|
|
138
|
+
return props.showUpload && (!props.maxCount || fileList.value.length < props.maxCount)
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
watch(() => props.modelValue, (val) => {
|
|
142
|
+
fileList.value = val
|
|
143
|
+
}, { deep: true })
|
|
144
|
+
|
|
145
|
+
const isImage = (file: UploadFile) => {
|
|
146
|
+
if (file.type) return file.type.startsWith('image/')
|
|
147
|
+
const url = file.url || ''
|
|
148
|
+
return /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(url)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const isVideo = (file: UploadFile) => {
|
|
152
|
+
if (file.type) return file.type.startsWith('video/')
|
|
153
|
+
const url = file.url || ''
|
|
154
|
+
return /\.(mp4|mov|avi|mkv|webm)$/i.test(url)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const getFileName = (file: UploadFile) => {
|
|
158
|
+
if (file.name) return file.name
|
|
159
|
+
const url = file.url || ''
|
|
160
|
+
const match = url.match(/[^/]+$/)
|
|
161
|
+
return match ? match[0] : '文件'
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const handleTrigger = () => {
|
|
165
|
+
if (props.disabled || fileList.value.length >= props.maxCount) {
|
|
166
|
+
if (fileList.value.length >= props.maxCount) {
|
|
167
|
+
emit('overcount')
|
|
168
|
+
}
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 模拟文件选择,实际在uni-app中使用 uni.chooseImage/uni.chooseVideo
|
|
173
|
+
// 这里仅作演示
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const handlePreview = (file: UploadFile, index: number) => {
|
|
177
|
+
emit('preview', file, index)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const handleDelete = (index: number) => {
|
|
181
|
+
const file = fileList.value[index]
|
|
182
|
+
fileList.value.splice(index, 1)
|
|
183
|
+
emit('update:modelValue', fileList.value)
|
|
184
|
+
emit('change', fileList.value)
|
|
185
|
+
emit('delete', file, index)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const afterRead = (files: UploadFile | UploadFile[]) => {
|
|
189
|
+
const fileArray = Array.isArray(files) ? files : [files]
|
|
190
|
+
|
|
191
|
+
// 检查数量限制
|
|
192
|
+
if (fileList.value.length + fileArray.length > props.maxCount) {
|
|
193
|
+
emit('overcount')
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 检查大小限制
|
|
198
|
+
const oversizeFiles = fileArray.filter(f => f.size && f.size > props.maxSize)
|
|
199
|
+
if (oversizeFiles.length > 0) {
|
|
200
|
+
emit('oversize', oversizeFiles)
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// 添加文件到列表
|
|
205
|
+
fileArray.forEach(file => {
|
|
206
|
+
file.status = 'uploading'
|
|
207
|
+
file.progress = 0
|
|
208
|
+
fileList.value.push(file)
|
|
209
|
+
|
|
210
|
+
// 模拟上传过程
|
|
211
|
+
simulateUpload(file)
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const simulateUpload = (file: UploadFile) => {
|
|
216
|
+
// 模拟上传进度
|
|
217
|
+
let progress = 0
|
|
218
|
+
const timer = setInterval(() => {
|
|
219
|
+
progress += Math.random() * 30
|
|
220
|
+
if (progress >= 100) {
|
|
221
|
+
progress = 100
|
|
222
|
+
file.status = 'done'
|
|
223
|
+
file.progress = 100
|
|
224
|
+
clearInterval(timer)
|
|
225
|
+
emit('update:modelValue', fileList.value)
|
|
226
|
+
emit('change', fileList.value)
|
|
227
|
+
emit('success', file)
|
|
228
|
+
} else {
|
|
229
|
+
file.progress = progress
|
|
230
|
+
}
|
|
231
|
+
}, 200)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 提供外部调用的方法
|
|
235
|
+
defineExpose({
|
|
236
|
+
afterRead,
|
|
237
|
+
fileList
|
|
238
|
+
})
|
|
239
|
+
</script>
|
|
240
|
+
|
|
241
|
+
<script lang="ts">
|
|
242
|
+
export default {
|
|
243
|
+
options: {
|
|
244
|
+
virtualHost: true,
|
|
245
|
+
styleIsolation: 'shared'
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
</script>
|
|
249
|
+
|
|
250
|
+
<style lang="scss" scoped>
|
|
251
|
+
.u-upload {
|
|
252
|
+
width: 100%;
|
|
253
|
+
|
|
254
|
+
&__list {
|
|
255
|
+
display: flex;
|
|
256
|
+
flex-wrap: wrap;
|
|
257
|
+
gap: $--spacing-sm;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&__item {
|
|
261
|
+
position: relative;
|
|
262
|
+
width: 80px;
|
|
263
|
+
height: 80px;
|
|
264
|
+
border-radius: $--border-radius-md;
|
|
265
|
+
overflow: hidden;
|
|
266
|
+
background: $--bg-color-2;
|
|
267
|
+
border: 1px solid $--border-color;
|
|
268
|
+
|
|
269
|
+
&--error {
|
|
270
|
+
border-color: $--color-danger;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&--uploading {
|
|
274
|
+
opacity: 0.8;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
&__preview {
|
|
279
|
+
width: 100%;
|
|
280
|
+
height: 100%;
|
|
281
|
+
object-fit: cover;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
&__video {
|
|
285
|
+
width: 100%;
|
|
286
|
+
height: 100%;
|
|
287
|
+
position: relative;
|
|
288
|
+
|
|
289
|
+
&-icon {
|
|
290
|
+
position: absolute;
|
|
291
|
+
inset: 0;
|
|
292
|
+
display: flex;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
background: rgba(0, 0, 0, 0.3);
|
|
296
|
+
color: #fff;
|
|
297
|
+
font-size: 24px;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&__file {
|
|
302
|
+
width: 100%;
|
|
303
|
+
height: 100%;
|
|
304
|
+
display: flex;
|
|
305
|
+
flex-direction: column;
|
|
306
|
+
align-items: center;
|
|
307
|
+
justify-content: center;
|
|
308
|
+
padding: $--spacing-xs;
|
|
309
|
+
|
|
310
|
+
&-icon {
|
|
311
|
+
font-size: 24px;
|
|
312
|
+
margin-bottom: 4px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&-name {
|
|
316
|
+
font-size: $--font-size-xs;
|
|
317
|
+
color: $--text-color-2;
|
|
318
|
+
text-align: center;
|
|
319
|
+
overflow: hidden;
|
|
320
|
+
text-overflow: ellipsis;
|
|
321
|
+
white-space: nowrap;
|
|
322
|
+
max-width: 100%;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&__progress {
|
|
327
|
+
position: absolute;
|
|
328
|
+
bottom: 0;
|
|
329
|
+
left: 0;
|
|
330
|
+
right: 0;
|
|
331
|
+
height: 4px;
|
|
332
|
+
background: rgba(255, 255, 255, 0.8);
|
|
333
|
+
|
|
334
|
+
&-bar {
|
|
335
|
+
height: 100%;
|
|
336
|
+
background: $--color-primary;
|
|
337
|
+
transition: width 0.2s;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&__delete {
|
|
342
|
+
position: absolute;
|
|
343
|
+
top: 0;
|
|
344
|
+
right: 0;
|
|
345
|
+
width: 16px;
|
|
346
|
+
height: 16px;
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
justify-content: center;
|
|
350
|
+
background: rgba(0, 0, 0, 0.5);
|
|
351
|
+
border-radius: 0 $--border-radius-md 0 0;
|
|
352
|
+
|
|
353
|
+
&-icon {
|
|
354
|
+
color: #fff;
|
|
355
|
+
font-size: 12px;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&__error {
|
|
360
|
+
position: absolute;
|
|
361
|
+
inset: 0;
|
|
362
|
+
display: flex;
|
|
363
|
+
align-items: center;
|
|
364
|
+
justify-content: center;
|
|
365
|
+
background: rgba(238, 10, 36, 0.1);
|
|
366
|
+
color: $--color-danger;
|
|
367
|
+
font-size: $--font-size-xs;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
&__trigger {
|
|
371
|
+
width: 80px;
|
|
372
|
+
height: 80px;
|
|
373
|
+
border-radius: $--border-radius-md;
|
|
374
|
+
background: $--bg-color;
|
|
375
|
+
border: 1px solid $--border-color;
|
|
376
|
+
display: flex;
|
|
377
|
+
align-items: center;
|
|
378
|
+
justify-content: center;
|
|
379
|
+
|
|
380
|
+
&--disabled {
|
|
381
|
+
opacity: 0.5;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&-default {
|
|
385
|
+
display: flex;
|
|
386
|
+
flex-direction: column;
|
|
387
|
+
align-items: center;
|
|
388
|
+
justify-content: center;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
&-icon {
|
|
392
|
+
font-size: 24px;
|
|
393
|
+
color: $--text-color-3;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
&-text {
|
|
397
|
+
font-size: $--font-size-xs;
|
|
398
|
+
color: $--text-color-3;
|
|
399
|
+
margin-top: 4px;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import './variables.scss';
|
|
2
|
+
|
|
3
|
+
/* 全局样式 */
|
|
4
|
+
page {
|
|
5
|
+
background-color: $--bg-color;
|
|
6
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
|
|
7
|
+
font-size: $--font-size-md;
|
|
8
|
+
color: $--text-color;
|
|
9
|
+
line-height: 1.5;
|
|
10
|
+
-webkit-font-smoothing: antialiased;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* 清除默认样式 */
|
|
14
|
+
view, text, image, scroll-view {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* 安全区域适配 */
|
|
19
|
+
.safe-area-bottom {
|
|
20
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
21
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Flex 布局工具类 */
|
|
25
|
+
.flex {
|
|
26
|
+
display: flex;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.flex-center {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.flex-between {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.flex-column {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* 文字省略 */
|
|
47
|
+
.ellipsis {
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ellipsis-2 {
|
|
54
|
+
display: -webkit-box;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
-webkit-line-clamp: 2;
|
|
58
|
+
-webkit-box-orient: vertical;
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// 主题色
|
|
2
|
+
$--color-primary: #1989fa !default;
|
|
3
|
+
$--color-success: #07c160 !default;
|
|
4
|
+
$--color-warning: #ff976a !default;
|
|
5
|
+
$--color-danger: #ee0a24 !default;
|
|
6
|
+
$--color-info: #969799 !default;
|
|
7
|
+
|
|
8
|
+
// 文字颜色
|
|
9
|
+
$--text-color: #323233 !default;
|
|
10
|
+
$--text-color-2: #646566 !default;
|
|
11
|
+
$--text-color-3: #969799 !default;
|
|
12
|
+
$--text-color-white: #ffffff !default;
|
|
13
|
+
|
|
14
|
+
// 背景色
|
|
15
|
+
$--bg-color: #f7f8fa !default;
|
|
16
|
+
$--bg-color-2: #ffffff !default;
|
|
17
|
+
$--bg-color-3: #f2f3f5 !default;
|
|
18
|
+
|
|
19
|
+
// 边框
|
|
20
|
+
$--border-color: #ebedf0 !default;
|
|
21
|
+
$--border-radius-sm: 4px !default;
|
|
22
|
+
$--border-radius-md: 8px !default;
|
|
23
|
+
$--border-radius-lg: 12px !default;
|
|
24
|
+
|
|
25
|
+
// 边框半径别名
|
|
26
|
+
$--radius-sm: $--border-radius-sm !default;
|
|
27
|
+
$--radius-md: $--border-radius-md !default;
|
|
28
|
+
$--radius-lg: $--border-radius-lg !default;
|
|
29
|
+
|
|
30
|
+
// 字体大小
|
|
31
|
+
$--font-size-xs: 10px !default;
|
|
32
|
+
$--font-size-sm: 12px !default;
|
|
33
|
+
$--font-size-md: 14px !default;
|
|
34
|
+
$--font-size-lg: 16px !default;
|
|
35
|
+
$--font-size-xl: 18px !default;
|
|
36
|
+
$--font-size-base: $--font-size-md !default;
|
|
37
|
+
|
|
38
|
+
// 间距
|
|
39
|
+
$--spacing-xs: 4px !default;
|
|
40
|
+
$--spacing-sm: 8px !default;
|
|
41
|
+
$--spacing-base: 12px !default;
|
|
42
|
+
$--spacing-md: 12px !default;
|
|
43
|
+
$--spacing-lg: 16px !default;
|
|
44
|
+
$--spacing-xl: 24px !default;
|
|
45
|
+
|
|
46
|
+
// 动画
|
|
47
|
+
$--transition-duration: 0.3s !default;
|
|
48
|
+
|
|
49
|
+
// 组件变量
|
|
50
|
+
// Button
|
|
51
|
+
$--button-height: 44px !default;
|
|
52
|
+
$--button-height-sm: 32px !default;
|
|
53
|
+
$--button-height-lg: 50px !default;
|
|
54
|
+
|
|
55
|
+
// Input
|
|
56
|
+
$--input-height: 44px !default;
|
|
57
|
+
|
|
58
|
+
// Search
|
|
59
|
+
$--search-height: 36px !default;
|
|
60
|
+
|
|
61
|
+
// Textarea
|
|
62
|
+
$--textarea-line-height: 1.5 !default;
|
|
63
|
+
|
|
64
|
+
// Slider
|
|
65
|
+
$--slider-button-size: 24px !default;
|
|
66
|
+
|
|
67
|
+
// Cell
|
|
68
|
+
$--cell-height: 48px !default;
|