rrj-astra-ui 1.0.2
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.en.md +36 -0
- package/README.md +37 -0
- package/components/AuiBadge.vue +50 -0
- package/components/AuiBlockBox.vue +85 -0
- package/components/AuiButton.vue +210 -0
- package/components/AuiCustomerForm.vue +304 -0
- package/components/AuiDivider.vue +66 -0
- package/components/AuiFold.vue +40 -0
- package/components/AuiFoldItem.vue +173 -0
- package/components/AuiForm.vue +76 -0
- package/components/AuiFormItem.vue +88 -0
- package/components/AuiGrid.vue +26 -0
- package/components/AuiGridItem.vue +20 -0
- package/components/AuiIcon.vue +145 -0
- package/components/AuiImage.vue +152 -0
- package/components/AuiInput.vue +176 -0
- package/components/AuiLamp.vue +254 -0
- package/components/AuiLineProgress.vue +169 -0
- package/components/AuiList.vue +18 -0
- package/components/AuiListItem.vue +142 -0
- package/components/AuiMultiSelect.vue +303 -0
- package/components/AuiNoticeBar.vue +62 -0
- package/components/AuiNumberBox.vue +282 -0
- package/components/AuiPicker.vue +619 -0
- package/components/AuiPopup.vue +57 -0
- package/components/AuiSelectGroup.vue +312 -0
- package/components/AuiTab.vue +173 -0
- package/components/AuiTabItem.vue +43 -0
- package/components/AuiTable.vue +357 -0
- package/components/AuiTag.vue +112 -0
- package/components/AuiText.vue +81 -0
- package/components/AuiTextarea.vue +203 -0
- package/components/AuiToast.vue +96 -0
- package/components/AuiUpdate.vue +271 -0
- package/components/AuiUpload.vue +524 -0
- package/index.js +93 -0
- package/package.json +36 -0
- package/style.scss +30 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="['aui-upload', `aui-theme-${theme}`, {'aui-disabled': disabled}]">
|
|
3
|
+
<!-- 上传按钮区域 -->
|
|
4
|
+
<view v-if="(previewImages.length < props.maxCount || props.maxCount === 0) && !isLoading"
|
|
5
|
+
class="aui-upload-btn" @click="handleClick">
|
|
6
|
+
<slot name="button">
|
|
7
|
+
<view class="aui-upload-icon">
|
|
8
|
+
<i class="fa fa-camera"></i>
|
|
9
|
+
</view>
|
|
10
|
+
<view class="aui-upload-text">{{ uploadText }}</view>
|
|
11
|
+
</slot>
|
|
12
|
+
</view>
|
|
13
|
+
|
|
14
|
+
<!-- 加载中状态 -->
|
|
15
|
+
<view v-else-if="isLoading" class="aui-upload-loading">
|
|
16
|
+
<view class="aui-loading-spinner">
|
|
17
|
+
<i class="fa fa-circle-o-notch fa-spin"></i>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
|
|
21
|
+
<!-- 预览区域 -->
|
|
22
|
+
<view v-if="previewImages.length > 0" class="aui-upload-preview-container">
|
|
23
|
+
<view v-for="(image, index) in previewImages" :key="index" class="aui-upload-image-wrapper">
|
|
24
|
+
<!-- 点击图片调用放大查看方法 -->
|
|
25
|
+
<img :src="image" class="aui-upload-image" :style="{ maxHeight: previewMaxHeight }" alt="预览图片" @click="previewImage(index)" @error="handleImageError(index)">
|
|
26
|
+
|
|
27
|
+
<!-- 操作按钮 -->
|
|
28
|
+
<view class="aui-upload-actions">
|
|
29
|
+
<view class="aui-upload-action-btn" @click="handleRemove(index)">
|
|
30
|
+
<aui-icon name="close" size="15px" color="#FFFFFF" />
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
34
|
+
</view>
|
|
35
|
+
</view>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup>
|
|
39
|
+
import { defineProps, defineEmits, ref, watch } from 'vue';
|
|
40
|
+
import AuiIcon from './AuiIcon.vue';
|
|
41
|
+
|
|
42
|
+
// 定义组件名称
|
|
43
|
+
const __name = 'AuiUpload';
|
|
44
|
+
defineOptions({ name: __name });
|
|
45
|
+
|
|
46
|
+
const props = defineProps({
|
|
47
|
+
modelValue: {
|
|
48
|
+
type: [String, Array],
|
|
49
|
+
default: () => []
|
|
50
|
+
},
|
|
51
|
+
multiple: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
maxSize: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: 10 // MB
|
|
58
|
+
},
|
|
59
|
+
maxCount: {
|
|
60
|
+
type: Number,
|
|
61
|
+
default: 1
|
|
62
|
+
},
|
|
63
|
+
theme: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'normal',
|
|
66
|
+
validator: (value) => ['normal', 'flat', 'card'].includes(value)
|
|
67
|
+
},
|
|
68
|
+
size: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: 'normal',
|
|
71
|
+
validator: (value) => ['small', 'normal', 'large'].includes(value)
|
|
72
|
+
},
|
|
73
|
+
disabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
uploadText: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: '点击上传图片'
|
|
80
|
+
},
|
|
81
|
+
previewMaxHeight: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: '200px'
|
|
84
|
+
},
|
|
85
|
+
accept: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: 'image/*'
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const emits = defineEmits(['update:modelValue', 'change', 'success', 'error', 'before-upload']);
|
|
92
|
+
|
|
93
|
+
// 状态
|
|
94
|
+
const previewImages = ref(Array.isArray(props.modelValue) ? [...props.modelValue] : props.modelValue ? [props.modelValue] : []);
|
|
95
|
+
const isLoading = ref(false);
|
|
96
|
+
|
|
97
|
+
// 处理图片加载失败
|
|
98
|
+
const handleImageError = (index) => {
|
|
99
|
+
console.error(`图片加载失败,索引: ${index},路径: ${previewImages.value[index]}`);
|
|
100
|
+
emits('error', {
|
|
101
|
+
type: 'image-load-failed',
|
|
102
|
+
message: `图片加载失败,索引: ${index}`
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// 初始化
|
|
107
|
+
watch(() => props.modelValue, (newValue) => {
|
|
108
|
+
updatePreviewImages();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// 更新预览图片
|
|
112
|
+
const updatePreviewImages = () => {
|
|
113
|
+
previewImages.value = Array.isArray(props.modelValue) ? [...props.modelValue] : props.modelValue ? [props.modelValue] : [];
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// 处理点击上传按钮
|
|
117
|
+
const handleClick = () => {
|
|
118
|
+
if (props.disabled) return;
|
|
119
|
+
|
|
120
|
+
// 检查是否已达到最大上传数量
|
|
121
|
+
if (props.maxCount > 0 && previewImages.value.length >= props.maxCount) {
|
|
122
|
+
emits('error', {
|
|
123
|
+
type: 'max-count-exceed',
|
|
124
|
+
message: `最多只能上传 ${props.maxCount} 张图片`
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 判断是否支持 uni.chooseMedia
|
|
130
|
+
var platform=uni.getSystemInfoSync().platform;
|
|
131
|
+
if (platform==='harmonyos') {
|
|
132
|
+
uni.chooseMedia({
|
|
133
|
+
count: props.multiple ? props.maxCount - previewImages.value.length : 1,
|
|
134
|
+
mediaType: ['image'],
|
|
135
|
+
sourceType: ['album', 'camera'],
|
|
136
|
+
success: (res) => {
|
|
137
|
+
console.log('选择的图片原始路径', res.tempFiles);
|
|
138
|
+
// 处理选择的图片
|
|
139
|
+
res.tempFiles.forEach(async (subItem) => {
|
|
140
|
+
try {
|
|
141
|
+
// 保存到沙盒
|
|
142
|
+
const { savedFilePath } = await uni.saveFile({
|
|
143
|
+
tempFilePath: subItem.tempFilePath
|
|
144
|
+
});
|
|
145
|
+
console.log('本地路径:'+savedFilePath);
|
|
146
|
+
const { size } = await getFileMetadata(savedFilePath);
|
|
147
|
+
console.log('文件元数据', { size });
|
|
148
|
+
// 检查文件大小
|
|
149
|
+
const fileSizeInMB = size / (1024 * 1024);
|
|
150
|
+
if (fileSizeInMB > props.maxSize) {
|
|
151
|
+
emits('error', {
|
|
152
|
+
type: 'size-exceed',
|
|
153
|
+
message: `文件大小超过 ${props.maxSize}MB`
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 触发上传前钩子
|
|
159
|
+
const file = {
|
|
160
|
+
savedFilePath,
|
|
161
|
+
size,
|
|
162
|
+
name: savedFilePath.split('/').pop()
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const beforeResult = emits('before-upload', file);
|
|
166
|
+
if (beforeResult === false) {
|
|
167
|
+
console.log('上传前钩子返回 false,取消上传');
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 处理图片
|
|
172
|
+
handleProcessedImage(savedFilePath, file);
|
|
173
|
+
} catch (err) {
|
|
174
|
+
console.error('获取文件信息失败:', err);
|
|
175
|
+
emits('error', {
|
|
176
|
+
type: 'file-info-failed',
|
|
177
|
+
message: '获取文件信息失败,请重试'
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
fail: (err) => {
|
|
183
|
+
console.error('选择图片失败:', err);
|
|
184
|
+
emits('error', {
|
|
185
|
+
type: 'select-failed',
|
|
186
|
+
message: '选择图片失败,请重试'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
// 不支持 uni.chooseMedia 时使用 uni.chooseImage
|
|
192
|
+
uni.chooseImage({
|
|
193
|
+
count: props.multiple ? props.maxCount - previewImages.value.length : 1,
|
|
194
|
+
sizeType: ['original'],
|
|
195
|
+
sourceType: ['album', 'camera'],
|
|
196
|
+
success: (res) => {
|
|
197
|
+
console.log('选择的图片原始路径', res.tempFilePaths);
|
|
198
|
+
// 处理选择的图片
|
|
199
|
+
res.tempFilePaths.forEach(async (tempFilePath) => {
|
|
200
|
+
try {
|
|
201
|
+
var savedFilePath=tempFilePath;
|
|
202
|
+
console.log('本地路径:'+savedFilePath);
|
|
203
|
+
uni.getFileInfo({
|
|
204
|
+
filePath: savedFilePath,
|
|
205
|
+
success: function (res) {
|
|
206
|
+
console.log('文件大小:', res.size);
|
|
207
|
+
var size=res.size;
|
|
208
|
+
// 检查文件大小
|
|
209
|
+
const fileSizeInMB = size / (1024 * 1024);
|
|
210
|
+
if (fileSizeInMB > props.maxSize) {
|
|
211
|
+
emits('error', {
|
|
212
|
+
type: 'size-exceed',
|
|
213
|
+
message: `文件大小超过 ${props.maxSize}MB`
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// 触发上传前钩子
|
|
219
|
+
const file = {
|
|
220
|
+
savedFilePath,
|
|
221
|
+
size,
|
|
222
|
+
name: savedFilePath.split('/').pop()
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const beforeResult = emits('before-upload', file);
|
|
226
|
+
if (beforeResult === false) {
|
|
227
|
+
console.log('上传前钩子返回 false,取消上传');
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 处理图片
|
|
232
|
+
handleProcessedImage(savedFilePath, file);
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
} catch (err) {
|
|
236
|
+
console.error('获取文件信息失败:', err);
|
|
237
|
+
emits('error', {
|
|
238
|
+
type: 'file-info-failed',
|
|
239
|
+
message: '获取文件信息失败,请重试'
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
fail: (err) => {
|
|
245
|
+
console.error('选择图片失败:', err);
|
|
246
|
+
emits('error', {
|
|
247
|
+
type: 'select-failed',
|
|
248
|
+
message: '选择图片失败,请重试'
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// 获取文件元数据
|
|
256
|
+
const getFileMetadata = (filePath) => {
|
|
257
|
+
const fs = uni.getFileSystemManager();
|
|
258
|
+
|
|
259
|
+
return new Promise((resolve, reject) => {
|
|
260
|
+
fs.getFileInfo({
|
|
261
|
+
filePath: filePath,
|
|
262
|
+
success: (res) => {
|
|
263
|
+
resolve(res);
|
|
264
|
+
},
|
|
265
|
+
fail: (err) => {
|
|
266
|
+
reject(err);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// 处理替换图片
|
|
273
|
+
const handleReplace = (index) => {
|
|
274
|
+
handleClick();
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// 处理移除图片
|
|
278
|
+
const handleRemove = (index) => {
|
|
279
|
+
previewImages.value.splice(index, 1);
|
|
280
|
+
emitChanges();
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// 自定义唯一 ID 生成函数
|
|
284
|
+
const generateUniqueId = () => {
|
|
285
|
+
const timestamp = Date.now().toString(36); // 时间戳转 base36
|
|
286
|
+
const randomNum = Math.random().toString(36).substr(2, 5); // 随机数
|
|
287
|
+
return `${timestamp}_${randomNum}`;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
// 处理已处理的图像
|
|
291
|
+
const handleProcessedImage = (imageUrl, originalFile) => {
|
|
292
|
+
isLoading.value = false;
|
|
293
|
+
|
|
294
|
+
// 创建一个唯一的文件名
|
|
295
|
+
const fileName = originalFile
|
|
296
|
+
? `${generateUniqueId()}_${originalFile.name}`
|
|
297
|
+
: `uploaded_image_${generateUniqueId()}.jpg`;
|
|
298
|
+
|
|
299
|
+
// 构建上传结果
|
|
300
|
+
const uploadResult = {
|
|
301
|
+
url: imageUrl,
|
|
302
|
+
name: fileName,
|
|
303
|
+
size: getFileSize(imageUrl),
|
|
304
|
+
type: 'image/jpeg'
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// 更新预览图片
|
|
308
|
+
previewImages.value.push(imageUrl);
|
|
309
|
+
|
|
310
|
+
// 触发事件
|
|
311
|
+
emitChanges();
|
|
312
|
+
emits('success', uploadResult);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// 触发变更事件
|
|
316
|
+
const emitChanges = () => {
|
|
317
|
+
const newValue = props.multiple ? [...previewImages.value] : previewImages.value[0] || '';
|
|
318
|
+
emits('update:modelValue', newValue);
|
|
319
|
+
emits('change', newValue);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// 获取文件大小
|
|
323
|
+
const getFileSize = (filePath) => {
|
|
324
|
+
return new Promise((resolve) => {
|
|
325
|
+
uni.getFileInfo({
|
|
326
|
+
filePath,
|
|
327
|
+
success: (res) => {
|
|
328
|
+
resolve(Math.round(res.size / 1024)); // 返回 KB
|
|
329
|
+
},
|
|
330
|
+
fail: () => {
|
|
331
|
+
resolve(0);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// 图片放大查看方法
|
|
338
|
+
const previewImage = (index) => {
|
|
339
|
+
uni.previewImage({
|
|
340
|
+
current: previewImages.value[index],
|
|
341
|
+
urls: previewImages.value
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
</script>
|
|
345
|
+
|
|
346
|
+
<style scoped lang="scss">
|
|
347
|
+
@import '../style.scss';
|
|
348
|
+
|
|
349
|
+
.aui-upload {
|
|
350
|
+
position: relative;
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-wrap: wrap;
|
|
353
|
+
min-height: 120px;
|
|
354
|
+
border-radius: 8px;
|
|
355
|
+
transition: all 0.3s;
|
|
356
|
+
cursor: pointer;
|
|
357
|
+
|
|
358
|
+
&:hover:not(.aui-disabled) {
|
|
359
|
+
border-color: $aui-primary-color;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
&.aui-disabled {
|
|
363
|
+
opacity: 0.6;
|
|
364
|
+
cursor: not-allowed;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
&-btn {
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-direction: column;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
align-items: center;
|
|
372
|
+
width: 100px;
|
|
373
|
+
height: 100px;
|
|
374
|
+
margin: 5px;
|
|
375
|
+
border: 1px dashed $aui-border-color;
|
|
376
|
+
border-radius: 8px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
&-icon {
|
|
380
|
+
font-size: 36px;
|
|
381
|
+
color: $aui-gray-color;
|
|
382
|
+
margin-bottom: 10px;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
&-text {
|
|
386
|
+
color: $aui-text-color-secondary;
|
|
387
|
+
font-size: 12px;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
&-loading {
|
|
391
|
+
display: flex;
|
|
392
|
+
justify-content: center;
|
|
393
|
+
align-items: center;
|
|
394
|
+
width: 100px;
|
|
395
|
+
height: 100px;
|
|
396
|
+
margin: 5px;
|
|
397
|
+
border: 1px dashed $aui-border-color;
|
|
398
|
+
border-radius: 8px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
&-spinner {
|
|
402
|
+
font-size: 24px;
|
|
403
|
+
color: $aui-primary-color;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
&-preview-container {
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-wrap: wrap;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
&-image-wrapper {
|
|
412
|
+
position: relative;
|
|
413
|
+
width: 100px;
|
|
414
|
+
height: 100px;
|
|
415
|
+
margin: 5px;
|
|
416
|
+
border-radius: 8px;
|
|
417
|
+
overflow: hidden;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
&-image {
|
|
421
|
+
width: 100%;
|
|
422
|
+
height: 100%;
|
|
423
|
+
object-fit: cover;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
&-actions {
|
|
427
|
+
position: absolute;
|
|
428
|
+
bottom: 0;
|
|
429
|
+
left: 0;
|
|
430
|
+
right: 0;
|
|
431
|
+
display: flex;
|
|
432
|
+
justify-content: center;
|
|
433
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
434
|
+
padding: 5px 0;
|
|
435
|
+
opacity: 0;
|
|
436
|
+
transition: opacity 0.3s;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
&-image-wrapper:hover &-actions {
|
|
440
|
+
opacity: 1;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
&-action-btn {
|
|
444
|
+
width: 24px;
|
|
445
|
+
height: 24px;
|
|
446
|
+
display: flex;
|
|
447
|
+
justify-content: center;
|
|
448
|
+
align-items: center;
|
|
449
|
+
color: white;
|
|
450
|
+
cursor: pointer;
|
|
451
|
+
margin: 0 5px;
|
|
452
|
+
border-radius: 50%;
|
|
453
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
454
|
+
|
|
455
|
+
&:hover {
|
|
456
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/* 主题样式 */
|
|
462
|
+
.aui-upload.aui-theme-normal {
|
|
463
|
+
border: 1px dashed $aui-border-color;
|
|
464
|
+
|
|
465
|
+
&:hover:not(.aui-disabled) {
|
|
466
|
+
border-style: solid;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.aui-upload.aui-theme-flat {
|
|
471
|
+
background-color: #f5f5f5;
|
|
472
|
+
border: none;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.aui-upload.aui-theme-card {
|
|
476
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
|
477
|
+
border: none;
|
|
478
|
+
|
|
479
|
+
&:hover:not(.aui-disabled) {
|
|
480
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/* 尺寸样式 */
|
|
485
|
+
.aui-upload.aui-size-small {
|
|
486
|
+
.aui-upload-btn,
|
|
487
|
+
.aui-upload-loading,
|
|
488
|
+
.aui-upload-image-wrapper {
|
|
489
|
+
width: 60px;
|
|
490
|
+
height: 60px;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.aui-upload-icon {
|
|
494
|
+
font-size: 24px;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.aui-upload-text {
|
|
498
|
+
display: none;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.aui-upload.aui-size-large {
|
|
503
|
+
.aui-upload-btn,
|
|
504
|
+
.aui-upload-loading,
|
|
505
|
+
.aui-upload-image-wrapper {
|
|
506
|
+
width: 140px;
|
|
507
|
+
height: 140px;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.aui-upload-icon {
|
|
511
|
+
font-size: 48px;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.aui-upload-text {
|
|
515
|
+
font-size: 14px;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/* 变量定义 */
|
|
520
|
+
$aui-primary-color: #1677ff;
|
|
521
|
+
$aui-border-color: #d9d9d9;
|
|
522
|
+
$aui-gray-color: #bfbfbf;
|
|
523
|
+
$aui-text-color-secondary: #8c8c8c;
|
|
524
|
+
</style>
|
package/index.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import AuiBadge from './components/AuiBadge.vue';
|
|
2
|
+
import AuiButton from './components/AuiButton.vue';
|
|
3
|
+
import AuiImage from './components/AuiImage.vue';
|
|
4
|
+
import AuiInput from './components/AuiInput.vue';
|
|
5
|
+
import AuiTag from './components/AuiTag.vue';
|
|
6
|
+
import AuiText from './components/AuiText.vue';
|
|
7
|
+
import AuiForm from './components/AuiForm.vue';
|
|
8
|
+
import AuiFormItem from './components/AuiFormItem.vue';
|
|
9
|
+
import AuiList from './components/AuiList.vue';
|
|
10
|
+
import AuiListItem from './components/AuiListItem.vue';
|
|
11
|
+
import AuiDivider from './components/AuiDivider.vue';
|
|
12
|
+
import AuiIcon from './components/AuiIcon.vue';
|
|
13
|
+
import AuiNoticeBar from './components/AuiNoticeBar.vue';
|
|
14
|
+
import AuiGrid from './components/AuiGrid.vue';
|
|
15
|
+
import AuiGridItem from './components/AuiGridItem.vue';
|
|
16
|
+
import AuiBlockBox from './components/AuiBlockBox.vue';
|
|
17
|
+
import './style.scss';
|
|
18
|
+
import AuiTab from './components/AuiTab.vue';
|
|
19
|
+
import AuiTable from './components/AuiTable.vue';
|
|
20
|
+
import AuiMultiSelect from './components/AuiMultiSelect.vue';
|
|
21
|
+
import AuiUpdate from './components/AuiUpdate.vue';
|
|
22
|
+
import AuiPicker from './components/AuiPicker.vue';
|
|
23
|
+
import AuiTabItem from './components/AuiTabItem.vue';
|
|
24
|
+
import AuiLineProgress from './components/AuiLineProgress.vue';
|
|
25
|
+
import AuiFold from './components/AuiFold.vue';
|
|
26
|
+
import AuiFoldItem from './components/AuiFoldItem.vue';
|
|
27
|
+
import AuiPopup from './components/AuiPopup.vue';
|
|
28
|
+
import AuiSelectGroup from './components/AuiSelectGroup.vue';
|
|
29
|
+
import AuiNumberBox from './components/AuiNumberBox.vue';
|
|
30
|
+
import AuiTextarea from './components/AuiTextarea.vue';
|
|
31
|
+
import AuiUpload from './components/AuiUpload.vue';
|
|
32
|
+
import AuiCustomerForm from './components/AuiCustomerForm.vue';
|
|
33
|
+
import AuiLamp from './components/AuiLamp.vue';
|
|
34
|
+
|
|
35
|
+
const components = [
|
|
36
|
+
AuiButton,
|
|
37
|
+
AuiImage,
|
|
38
|
+
AuiInput,
|
|
39
|
+
AuiTag,
|
|
40
|
+
AuiText,
|
|
41
|
+
AuiBadge,
|
|
42
|
+
AuiForm,
|
|
43
|
+
AuiFormItem,
|
|
44
|
+
AuiList,
|
|
45
|
+
AuiListItem,
|
|
46
|
+
AuiDivider,
|
|
47
|
+
AuiIcon,
|
|
48
|
+
AuiNoticeBar,
|
|
49
|
+
AuiGrid,
|
|
50
|
+
AuiGridItem,
|
|
51
|
+
AuiBlockBox,
|
|
52
|
+
AuiTab,
|
|
53
|
+
AuiTabItem,
|
|
54
|
+
AuiTable,
|
|
55
|
+
AuiMultiSelect,
|
|
56
|
+
AuiUpdate,
|
|
57
|
+
AuiPicker,
|
|
58
|
+
AuiLineProgress,
|
|
59
|
+
AuiFold,
|
|
60
|
+
AuiFoldItem,
|
|
61
|
+
AuiPopup,
|
|
62
|
+
AuiSelectGroup,
|
|
63
|
+
AuiNumberBox,
|
|
64
|
+
AuiTextarea,
|
|
65
|
+
AuiUpload,
|
|
66
|
+
AuiCustomerForm,
|
|
67
|
+
AuiLamp
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const install = (app) => {
|
|
71
|
+
components.forEach(component => {
|
|
72
|
+
const componentName = component.name;
|
|
73
|
+
if (!componentName) {
|
|
74
|
+
// 在开发环境输出错误信息,生产环境可移除
|
|
75
|
+
if (process.env.NODE_ENV === 'development') {
|
|
76
|
+
console.error('Component is missing name:', component);
|
|
77
|
+
}
|
|
78
|
+
throw new Error('Component is missing name, registration failed.');
|
|
79
|
+
}
|
|
80
|
+
// 在开发环境输出调试信息,生产环境可移除
|
|
81
|
+
if (process.env.NODE_ENV === 'development') {
|
|
82
|
+
console.log('Registering component:', componentName, 'Component object:', component);
|
|
83
|
+
}
|
|
84
|
+
app.component(componentName, component);
|
|
85
|
+
});
|
|
86
|
+
// 在开发环境输出调试信息,生产环境可移除
|
|
87
|
+
if (process.env.NODE_ENV === 'development') {
|
|
88
|
+
console.log('All components registered. App instance:', app);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default { install };
|
|
93
|
+
export { AuiButton, AuiImage, AuiInput, AuiTag, AuiText, AuiBadge, AuiForm, AuiFormItem, AuiList, AuiListItem, AuiDivider, AuiIcon, AuiNoticeBar,AuiGrid,AuiGridItem,AuiBlockBox ,AuiTab,AuiTabItem,AuiTable,AuiMultiSelect,AuiUpdate,AuiPicker,AuiLineProgress,AuiFold,AuiFoldItem,AuiPopup,AuiSelectGroup,AuiNumberBox,AuiTextarea,AuiUpload,AuiCustomerForm,AuiLamp};
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rrj-astra-ui",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "RRJ - AstraUI - A powerful UI framework for UniApp with global SCSS color variables",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"yarn",
|
|
8
|
+
"npm"
|
|
9
|
+
],
|
|
10
|
+
"author": "onlinesmart.cn",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/nockey/astra-ui.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/nockey/astra-ui/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/nokcey/astra-ui#readme",
|
|
20
|
+
"files": [
|
|
21
|
+
"components",
|
|
22
|
+
"index.js",
|
|
23
|
+
"style.scss"
|
|
24
|
+
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"vue": "^3.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"sass": "^1.66.1"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@xmldom/xmldom": "^0.9.8",
|
|
33
|
+
"parse5": "^7.3.0",
|
|
34
|
+
"uuid": "^11.1.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/style.scss
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// 定义全局颜色变量
|
|
2
|
+
$aui-secondary-color: #919BA1;
|
|
3
|
+
$aui-primary-color: #3B82F6;
|
|
4
|
+
$aui-primary-color-hover: #3178D5;
|
|
5
|
+
$aui-primary-bg-color: #EFF6FF;
|
|
6
|
+
$aui-danger-color: #F5222D;
|
|
7
|
+
$aui-danger-color-hover: #CE5C5D;
|
|
8
|
+
$aui-danger-bg-color: #FFF1F0;
|
|
9
|
+
$aui-warning-color: #FA8C16;
|
|
10
|
+
$aui-warning-color-hover: #D19438;
|
|
11
|
+
$aui-warning-bg-color: #FFF7E6;
|
|
12
|
+
$aui-success-color: #2ECC71;
|
|
13
|
+
$aui-success-color-hover: #66bb6a;
|
|
14
|
+
$aui-success-bg-color: #F6FFED;
|
|
15
|
+
$aui-default-color: #333;
|
|
16
|
+
$aui-text-color: #6B7280;
|
|
17
|
+
$aui-disabled-color: #ccc;
|
|
18
|
+
$aui-border-color: #EEEEEE;
|
|
19
|
+
$aui-hover-color:#F5F5F5;
|
|
20
|
+
$aui-active-bg:#EFF6FF;
|
|
21
|
+
$aui-active-color:#2563EB;
|
|
22
|
+
$aui-gray-color:red;
|
|
23
|
+
$aui-text-color-secondary: #999;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
//定义全局变量
|
|
29
|
+
$aui-font-size: 14px;
|
|
30
|
+
$aui-font-min-size: 12px;
|