优化+bug

This commit is contained in:
2025-03-10 02:12:33 +08:00
parent 9008626d3d
commit 041d7ab614
8 changed files with 85 additions and 24 deletions

2
app.js
View File

@ -65,7 +65,7 @@ App({
} }
//非空 //非空
if(item.required){ if(item.required){
if(value==''){ if(!value){
valid = false; valid = false;
} }
}else if(item.length){ }else if(item.length){

View File

@ -115,7 +115,7 @@ Component({
}, },
setUploadedImgs(imgs){ setUploadedImgs(imgs){
this.setData({ this.setData({
tempImgs:imgs.concat(this.data.tempImgs) tempImgs:imgs
}) })
} }
}, },

View File

@ -52,6 +52,14 @@ Component({
show:{ show:{
type:Boolean, type:Boolean,
value:false value:false
},
overlayClose:{
type:Boolean,
value:true
},
showCloseButton:{
type:Boolean,
value:false
} }
}, },
/** /**
@ -59,16 +67,20 @@ Component({
*/ */
data: { data: {
dynamicsStyle:'', dynamicsStyle:'',
textareaHeight:124 textareaHeight:124,
_show:false
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
abc(event){
console.log(event);
},
cancelButtonTap(){ cancelButtonTap(){
this.setData({ this.setData({
show:false _show:false
}); });
this.triggerEvent('cancel'); this.triggerEvent('cancel');
}, },
@ -88,21 +100,23 @@ Component({
show:false show:false
}); });
this.triggerEvent('ok',this.properties.content); this.triggerEvent('ok',this.properties.content);
},
afterLeave(event){
this.setData({
show:false
})
} }
}, },
lifetimes:{ lifetimes:{
attached(){ attached(){
console.log('init model view');
} }
}, },
observers:{ observers:{
"show"(show){ "show"(show){
if(show){ if(show){
const windowInfo = wx.getWindowInfo(); const windowInfo = wx.getWindowInfo();
// this.setData({
// textareaHeight:this.properties.row*25+24,
// })
this.createSelectorQuery().select('#modalViewMain').boundingClientRect((res)=>{ this.createSelectorQuery().select('#modalViewMain').boundingClientRect((res)=>{
const viewHeight = res.height; const viewHeight = res.height;
this.setData({ this.setData({
@ -110,6 +124,9 @@ Component({
}) })
}).exec(); }).exec();
} }
this.setData({
_show:show
})
} }
} }
}) })

View File

@ -1,9 +1,16 @@
<page-container model:show="{{show}}" position="center" class="custom-modal-view"
<page-container model:show="{{_show}}" wx:if="{{show}}" position="center"
class="custom-modal-view" bind:afterleave="afterLeave"
custom-style="background-color:transparent;left:27px;width:calc(100vw - 54px);height:200px;{{dynamicsStyle}}"> custom-style="background-color:transparent;left:27px;width:calc(100vw - 54px);height:200px;{{dynamicsStyle}}">
<view class="custom-modal-view-overlay" wx:if="{{!overlayClose}}"></view>
<view class="modal-view-main" id="modalViewMain"> <view class="modal-view-main" id="modalViewMain">
<view class="title {{titleTextCenter?'center':''}}">{{titleText}}</view> <view class="title {{titleTextCenter?'center':''}}">
<view class="text">{{titleText}}</view>
<view class="close-btn-area">
<view class="close-btn" bind:tap="cancelButtonTap" wx:if="{{showCloseButton}}"></view>
</view>
</view>
<textarea class="textarea {{contentMessage?'error':''}}" model:value="{{content}}" row="3" wx:if="{{editable}}" <textarea class="textarea {{contentMessage?'error':''}}" model:value="{{content}}" row="3" wx:if="{{editable}}"
placeholder="{{contentPlaceholder}}" focus="{{contentFocus}}" animation="{{contentAnimation}}" cursor-spacing="200rpx"></textarea> placeholder="{{contentPlaceholder}}" focus="{{contentFocus}}" animation="{{contentAnimation}}" cursor-spacing="200rpx"></textarea>
<view class="text" wx:else>{{content}}</view> <view class="text" wx:else>{{content}}</view>

View File

@ -1,18 +1,56 @@
.custom-modal-view{ .custom-modal-view{
border-radius: 20px; border-radius: 20px;
} }
.custom-modal-view-overlay{
position: fixed;
top:0;left:0;right:0;
height:100vh;
opacity: 0;
}
.custom-modal-view .title{ .custom-modal-view .title{
font-size: 34rpx; font-size: 34rpx;
font-weight: 500; font-weight: 500;
line-height: 50rpx; line-height: 50rpx;
position: relative;
} }
.custom-modal-view .title.center{ .custom-modal-view .title.center{
text-align: center; text-align: center;
} }
.close-btn-area{
position: absolute;
right:-32rpx;top:-32rpx;
width:100rpx;height:82rpx;
display: flex;
align-items: flex-end;
justify-content: center;
}
.custom-modal-view .title .close-btn{
position: relative;
width:50rpx;height:50rpx;
}
.custom-modal-view .title .close-btn::before,.custom-modal-view .title .close-btn::after{
content: '';
position: absolute;
width:80%;
height:4rpx;
left:10%;top:50%;
margin-top:-2rpx;
background-color: #999999;
transform: rotate(45deg);
}
.custom-modal-view .title .close-btn::after{
width:4rpx;
height:80%;
left:50%;top:10%;
margin-top:0;
margin-left: -2rpx;
}
.modal-view-main{ .modal-view-main{
border-radius: 24rpx; border-radius: 24rpx;
background-color: #fff; background-color: #fff;
padding:32rpx; padding:32rpx;
position: relative;
z-index: 111;
} }
.custom-modal-view .textarea{ .custom-modal-view .textarea{
border: 1.2px solid rgba(85, 85, 85, 0.3); border: 1.2px solid rgba(85, 85, 85, 0.3);

View File

@ -206,7 +206,7 @@
</movable-area> </movable-area>
<modal-view titleText="取消订单需联系客户说明原因" editable content-placeholder="请输入退单原因" bind:ok="refund" model:show="{{isShowRefundConfirm}}" wx:if="{{isShowRefundConfirm}}" titleTextCenter="{{false}}" editRequired/> <modal-view titleText="取消订单需联系客户说明原因" editable content-placeholder="请输入退单原因" bind:ok="refund" model:show="{{isShowRefundConfirm}}" titleTextCenter="{{false}}" editRequired/>
<mark-up id="markupView" class="mark-up"/> <mark-up id="markupView" class="mark-up"/>

View File

@ -33,8 +33,7 @@ Component({
*/ */
methods: { methods: {
async apply(){ async apply(){
const imgUploader = this.selectComponent('#imgUploader'); const urls = await this.imgUploader.getUploadedUrl();
const urls = await imgUploader.getUploadedUrl();
const valid = app.validateForm({ const valid = app.validateForm({
reason:{required:true,autoFocus:true,shake:true}, reason:{required:true,autoFocus:true,shake:true},
money:{min:1,shake:true} money:{min:1,shake:true}
@ -52,10 +51,9 @@ Component({
this.setData({ this.setData({
reason:'', reason:'',
money:0, money:0,
});
this.setData({
isShowMarkup:false isShowMarkup:false
}) });
this.imgUploader.setUploadedImgs([]);
wx.showToast({ wx.showToast({
title: '保存成功', title: '保存成功',
}) })
@ -70,10 +68,9 @@ Component({
this.setData({ this.setData({
reason:'', reason:'',
money:0, money:0,
});
this.setData({
isShowMarkup:false isShowMarkup:false
}) });
this.imgUploader.setUploadedImgs([]);
wx.showToast({ wx.showToast({
title: '保存成功', title: '保存成功',
}) })
@ -98,19 +95,21 @@ Component({
money:data.additional_fee_amount, money:data.additional_fee_amount,
requestId:data.id requestId:data.id
}) })
this.selectComponent('#imgUploader').setUploadedImgs(imgs); this.imgUploader.setUploadedImgs(imgs);
}).catch((error)=>{ }).catch((error)=>{
this.setData({ this.setData({
reason:'', reason:'',
requestId:'',
money:0, money:0,
}); });
this.imgUploader.setUploadedImgs([]);
}) })
} }
}, },
lifetimes:{ lifetimes:{
attached(){ attached(){
this.imgUploader = this.selectComponent('#imgUploader')
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<modal-view titleText="申请加价" isShowOk="{{false}}" isShowCancel="{{false}}" <modal-view titleText="申请加价" isShowOk="{{false}}" isShowCancel="{{false}}"
okButtonText="提交申请" model:show="{{isShowMarkup}}" wx:if="{{isShowMarkup}}" okButtonText="提交申请" model:show="{{isShowMarkup}}" show-close-button
class="mark-up-view" titleTextCenter="{{false}}"> class="mark-up-view" titleTextCenter="{{false}}" overlay-close="{{false}}">
<view class="input-area"> <view class="input-area">
<textarea model:value="{{reason}}" focus="{{reasonFocus}}" class="textarea" <textarea model:value="{{reason}}" focus="{{reasonFocus}}" class="textarea"
placeholder="请输入加价原因" animation="{{reasonAnimation}}"/> placeholder="请输入加价原因" animation="{{reasonAnimation}}"/>