修复包间图片上传错误的问题

This commit is contained in:
wangxiaowei
2025-12-27 17:49:45 +08:00
parent c4c20bc893
commit 4596ecd386

View File

@ -133,7 +133,6 @@
image-mode="scaleToFill" image-mode="scaleToFill"
:action="action" :action="action"
@success="RoomDetail.handleUploadSuccess"> @success="RoomDetail.handleUploadSuccess">
<wd-img width="184rpx" height="184rpx" :src="form.img || `${OSS}images/store/my/image1.png`" mode="aspectFill" radius="16rpx" />
</wd-upload> </wd-upload>
</view> </view>
</view> </view>
@ -380,7 +379,7 @@
<!-- 输入框 --> <!-- 输入框 -->
<view class="mb-40rpx"> <view class="mb-40rpx">
<wd-input v-model="newTagName" no-border placeholder="标签名称" :maxlength="5" <wd-input v-model="newTagName" type="text" no-border placeholder="标签名称"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx" /> custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx" />
</view> </view>
@ -416,7 +415,8 @@
// 标签相关 // 标签相关
const showTagSelectPopup = ref(false) const showTagSelectPopup = ref(false)
const showCreateTagPopup = ref(false) const showCreateTagPopup = ref(false)
const newTagName = ref('') const newTagName = ref<string>('')
console.log("🚀 ~ newTagName:", newTagName.value)
const isTagManageMode = ref(false) // 是否处于管理模式 const isTagManageMode = ref(false) // 是否处于管理模式
const selectedTags = ref<number[]>([]) // 临时选中的标签,点击确认后才回填到表单 const selectedTags = ref<number[]>([]) // 临时选中的标签,点击确认后才回填到表单
// Mock 已有标签列表 // Mock 已有标签列表
@ -522,9 +522,7 @@
const response = JSON.parse(e.file.response) const response = JSON.parse(e.file.response)
if (response.code) { if (response.code) {
const avatarUrl = response.data.url const avatarUrl = response.data.url
await updateUserInfo({ avatar: avatarUrl })
form.image = avatarUrl form.image = avatarUrl
toast.info('图片上传成功')
} else { } else {
throw new Error('上传失败') throw new Error('上传失败')
} }
@ -642,6 +640,9 @@
*/ */
handleCompleteCreateTag: async () => { handleCompleteCreateTag: async () => {
const tagName = newTagName.value.trim() const tagName = newTagName.value.trim()
console.log("🚀 ~ tagName:", newTagName.value)
console.log("🚀 ~ tagName:", tagName)
if (!tagName) { if (!tagName) {
toast.info('请输入标签名称') toast.info('请输入标签名称')
return return
@ -650,6 +651,7 @@
toast.info('标签不能超过5个字') toast.info('标签不能超过5个字')
return return
} }
console.log("🚀 ~ tagName:", tagName)
uni.showLoading({ uni.showLoading({
title: '操作者中...' title: '操作者中...'
@ -727,7 +729,7 @@
let params = { let params = {
id: roomId.value, id: roomId.value,
img: form.image, img: form.image.replace(import.meta.env.VITE_UPLOAD_IMAGE_URL, ''),
title: form.title, title: form.title,
label_id: tags.value.map(tag => tag.id).join(','), label_id: tags.value.map(tag => tag.id).join(','),
price: Number(form.price), price: Number(form.price),