在添加账号中应用添加图片组件

This commit is contained in:
WindowBird 2025-08-25 16:53:48 +08:00
parent df1709deab
commit ba997299f7
3 changed files with 19 additions and 21 deletions

View File

@ -10,10 +10,10 @@
<image v-else :src="imageUrl" class="preview-image" mode="aspectFit"></image>
</view>
<!-- 错误提示 -->
<view v-if="errorMessage" class="error-message">
<text class="error-text">{{ errorMessage }}</text>
</view>
<!-- &lt;!&ndash; 错误提示 &ndash;&gt;-->
<!-- <view v-if="errorMessage" class="error-message">-->
<!-- <text class="error-text">{{ errorMessage }}</text>-->
<!-- </view>-->
</view>
</template>

View File

@ -19,7 +19,6 @@ export default {
//
handleUploadSuccess(result) {
console.log('图片上传成功:', result.url)
uni.showToast({
title: '上传成功',
icon: 'success',

View File

@ -17,13 +17,12 @@
<view class="form-item">
<text class="form-label">{{ typeOptions[typeIndex].noLabel }}</text>
<view class="input-group">
<textarea
<image-uploader
v-if="typeOptions[typeIndex].value === 'QR'"
v-model="bankForm.no"
:maxlength="500"
:placeholder="typeOptions[typeIndex].noPlaceholder"
auto-height
class="form-input qr-input"
ref="uploader"
:height="'150rpx'"
:width="'150rpx'"
@success="handleUploadSuccess"
/>
<input
v-else
@ -32,14 +31,6 @@
class="form-input"
maxlength="30"
/>
<!-- 收款二维码类型时显示上传按钮 -->
<view
v-if="typeOptions[typeIndex].value === 'QR'"
class="upload-btn"
@click="goToImageUpload"
>
<text class="upload-text">上传</text>
</view>
</view>
</view>
@ -114,7 +105,7 @@ export default {
{
label: '收款二维码',
value: 'QR',
noLabel: '收款码图片url',
noLabel: '点击添加二维码',
noPlaceholder: '请点击上传-上传收款二维码图片自动获得收款码图片URL',
},
],
@ -154,6 +145,14 @@ export default {
uni.$off('image-upload-success', this.onImageUploadSuccess)
},
methods: {
handleUploadSuccess(result) {
console.log('图片上传成功:', result.url)
this.bankForm.no = result.url
uni.showToast({
title: '上传成功',
icon: 'success',
})
},
//
resetForm() {
this.bankForm = {
@ -287,7 +286,7 @@ export default {
})
this.$emit('success')
//
setTimeout(() => {
this.handleClose()