对接问卷调查、投诉建议接口
This commit is contained in:
@@ -55,11 +55,11 @@
|
||||
<view class="upload-wrap">
|
||||
<!-- 已上传图片 -->
|
||||
<view class="upload-item" v-for="(img, index) in form.images" :key="index">
|
||||
<image :src="img" mode="aspectFill" @click="previewImage(img)"></image>
|
||||
<uni-icons type="close" size="16" @click="deleteImage(index)"></uni-icons>
|
||||
<image :src="img" mode="aspectFill" class="upload-img" @click="previewImage(img)"></image>
|
||||
<image src="http://47.104.199.163:9090/images/imgs/delete.png" class="upload-delete" @click="deleteImage(index)"></image>
|
||||
</view>
|
||||
<!-- 上传按钮 -->
|
||||
<view class="upload-btn" @click="chooseImage">
|
||||
<view class="upload-btn" @click="chooseImage" v-if="form.images.length < 3">
|
||||
<uni-icons type="plus" size="24"></uni-icons>
|
||||
<text>上传照片</text>
|
||||
</view>
|
||||
@@ -298,17 +298,28 @@ const goToSelectProject = () => {
|
||||
uni.navigateTo({ url: '/pageSubPack/online-repair/personalSelectPoject' })
|
||||
}
|
||||
|
||||
// 图片
|
||||
// 选择图片
|
||||
const chooseImage = () => {
|
||||
// 计算还能选几张
|
||||
const remainCount = 3 - form.value.images.length;
|
||||
if (remainCount <= 0) {
|
||||
uni.showToast({
|
||||
title: '最多只能上传3张图片',
|
||||
icon: 'none'
|
||||
})
|
||||
return;
|
||||
}
|
||||
uni.chooseImage({
|
||||
count: 3,
|
||||
count: remainCount, // 动态限制可选数量
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
form.value.images = [...form.value.images, ...res.tempFilePaths]
|
||||
const tempFilePaths = res.tempFilePaths
|
||||
form.value.images = [...form.value.images, ...tempFilePaths]
|
||||
}
|
||||
})
|
||||
}
|
||||
// 预览图片
|
||||
const previewImage = (url) => {
|
||||
uni.previewImage({ urls: form.value.images, current: url })
|
||||
}
|
||||
@@ -326,7 +337,7 @@ const uploadImages = async () => {
|
||||
}
|
||||
try {
|
||||
const res = await uploadFile(path)
|
||||
urls.push(res.data || res.msg || '')
|
||||
urls.push(res.url || '')
|
||||
} catch (e) {
|
||||
console.error('上传失败', e)
|
||||
}
|
||||
@@ -469,24 +480,25 @@ textarea {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
.upload-item image {
|
||||
.upload-item .upload-img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.upload-item uni-icons {
|
||||
.upload-item .upload-delete{
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
background: #ff3b30;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 3rpx;
|
||||
padding: 2px;
|
||||
}
|
||||
.upload-btn {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border: 1px dashed #ccc;
|
||||
/* border: 1px dashed #ccc; */
|
||||
background-color: #f3f3f3;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user