|
@@ -16,7 +16,7 @@
|
|
|
|
|
|
|
|
<!-- 正常模式:宫格上传(完全对齐官方 upload-image 样式) -->
|
|
<!-- 正常模式:宫格上传(完全对齐官方 upload-image 样式) -->
|
|
|
<view v-else class="uni-file-picker__container">
|
|
<view v-else class="uni-file-picker__container">
|
|
|
- <view class="file-picker__box" v-for="(item, index) in innerFileList" :key="index"
|
|
|
|
|
|
|
+ <view class="file-picker__box cursor-pointer" v-for="(item, index) in innerFileList" :key="index"
|
|
|
:style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }">
|
|
:style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }">
|
|
|
<view class="file-picker__box-content" :style="borderStyle">
|
|
<view class="file-picker__box-content" :style="borderStyle">
|
|
|
<!-- 图片 -->
|
|
<!-- 图片 -->
|
|
@@ -56,9 +56,9 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 添加按钮 -->
|
|
<!-- 添加按钮 -->
|
|
|
- <view v-if="innerFileList?.length < limit" class="file-picker__box"
|
|
|
|
|
|
|
+ <view v-if="innerFileList?.length < limit" class="file-picker__box cursor-pointer"
|
|
|
:style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }">
|
|
:style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }">
|
|
|
- <view class="file-picker__box-content is-add" :style="borderStyle" @click="handleChoose">
|
|
|
|
|
|
|
+ <view class="file-picker__box-content is-add" :style="borderStyle" @click="handleChoose">
|
|
|
<cwg-icon name="icon_add" class="upload-icon" :size="24" />
|
|
<cwg-icon name="icon_add" class="upload-icon" :size="24" />
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -112,11 +112,11 @@ const props = defineProps({
|
|
|
default: ''
|
|
default: ''
|
|
|
},
|
|
},
|
|
|
imageWidth: {
|
|
imageWidth: {
|
|
|
- type: String,
|
|
|
|
|
|
|
+ type: [String,Number],
|
|
|
default: ''
|
|
default: ''
|
|
|
},
|
|
},
|
|
|
imageHeight: {
|
|
imageHeight: {
|
|
|
- type: String,
|
|
|
|
|
|
|
+ type: [String,Number],
|
|
|
default: ''
|
|
default: ''
|
|
|
},
|
|
},
|
|
|
uploadUrl: {
|
|
uploadUrl: {
|
|
@@ -243,8 +243,8 @@ watch(
|
|
|
if (JSON.stringify(innerFileList.value) === JSON.stringify(formatted)) return
|
|
if (JSON.stringify(innerFileList.value) === JSON.stringify(formatted)) return
|
|
|
|
|
|
|
|
if (!val) {
|
|
if (!val) {
|
|
|
- innerFileList.value = []
|
|
|
|
|
- originalType.value = 'array'
|
|
|
|
|
|
|
+ // innerFileList.value = []
|
|
|
|
|
+ // originalType.value = 'array'
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -483,6 +483,7 @@ const startUpload = async () => {
|
|
|
const uploadFile = (fileItem) => {
|
|
const uploadFile = (fileItem) => {
|
|
|
return new Promise((resolve) => {
|
|
return new Promise((resolve) => {
|
|
|
innerFileList.value.push({ ...fileItem, status: 'uploading', progress: 0 })
|
|
innerFileList.value.push({ ...fileItem, status: 'uploading', progress: 0 })
|
|
|
|
|
+ console.log(innerFileList.value,'upload231')
|
|
|
const index = innerFileList.value.length - 1
|
|
const index = innerFileList.value.length - 1
|
|
|
const url = props.action || config.Host80 + props.uploadUrl
|
|
const url = props.action || config.Host80 + props.uploadUrl
|
|
|
console.log({
|
|
console.log({
|
|
@@ -514,7 +515,7 @@ const uploadFile = (fileItem) => {
|
|
|
? JSON.parse(res.data).msg
|
|
? JSON.parse(res.data).msg
|
|
|
: res.data.msg
|
|
: res.data.msg
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ console.log(innerFileList.value,'file',result)
|
|
|
if (result.success) {
|
|
if (result.success) {
|
|
|
innerFileList.value[index].progress = 100
|
|
innerFileList.value[index].progress = 100
|
|
|
innerFileList.value[index].status = 'success'
|
|
innerFileList.value[index].status = 'success'
|
|
@@ -731,6 +732,7 @@ const imgStyle = computed(() => {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
flex-wrap: wrap;
|
|
|
//margin: -5px;
|
|
//margin: -5px;
|
|
|
|
|
+ gap: px2rpx(5);
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
|
|
|
|