对接设置接口
This commit is contained in:
@@ -21,8 +21,9 @@
|
||||
<view class="upload-area">
|
||||
<!-- 已上传图片 -->
|
||||
<view class="uploaded-img" v-for="(img, index) in imgList" :key="index">
|
||||
<image :src="img" mode="aspectFill"></image>
|
||||
<text class="del-img" @click="deleteImg(index)">×</text>
|
||||
<image :src="img" mode="aspectFill" class="upload-img"></image>
|
||||
<image src="http://47.104.199.163:9090/images/imgs/delete.png" class="upload-delete" @click="deleteImage(index)"></image>
|
||||
<!-- <text class="del-img" @click="deleteImg(index)">×</text> -->
|
||||
</view>
|
||||
<!-- 上传按钮(最多3张) -->
|
||||
<view class="upload-btn" @click="chooseImg" v-if="imgList.length < 3">
|
||||
@@ -55,7 +56,7 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { addActivityLive, signinActivityLive, uploadImage } from '../api/api.js';
|
||||
import { addActivityLive, signinActivityLive, uploadFile } from '../api/api.js';
|
||||
|
||||
// 活动ID
|
||||
const activityId = ref('');
|
||||
@@ -98,7 +99,7 @@ const chooseImg = () => {
|
||||
};
|
||||
|
||||
// 删除图片
|
||||
const deleteImg = (index) => {
|
||||
const deleteImage = (index) => {
|
||||
imgList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
@@ -147,9 +148,9 @@ const reLocate = () => {
|
||||
// 上传所有图片
|
||||
const uploadAllImages = async () => {
|
||||
if (imgList.value.length === 0) return [];
|
||||
const uploadPromises = imgList.value.map(img => uploadImage(img));
|
||||
const uploadPromises = imgList.value.map(img => uploadFile(img));
|
||||
const results = await Promise.all(uploadPromises);
|
||||
return results.map(res => res.data?.url || res.data);
|
||||
return results.map(res => res.url);
|
||||
};
|
||||
|
||||
// 提交实况
|
||||
@@ -258,11 +259,20 @@ const submitStatus = async () => {
|
||||
height: 80px;
|
||||
position: relative;
|
||||
}
|
||||
.uploaded-img image {
|
||||
.uploaded-img .upload-img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.uploaded-img .upload-delete{
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 3rpx;
|
||||
padding: 2px;
|
||||
}
|
||||
.del-img {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
|
||||
Reference in New Issue
Block a user