chore:在线留言提交后,再次打开在线留言,输入框会清空上次内容
This commit is contained in:
@@ -113,20 +113,20 @@
|
||||
<view class="fui-cell ">
|
||||
<view class="fui-cell-label ">{{ $lang('name') }}</view>
|
||||
<view class="fui-cell-info">
|
||||
<input v-model="Form.realname" class="fui-input" :placeholder="$lang('pleaseEnterName')" value=""></input>
|
||||
<input v-model="Form.realname" class="fui-input" :placeholder="$lang('pleaseEnterName')":key="formKey" value=""></input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fui-cell ">
|
||||
<view class="fui-cell-label">{{ $lang('contactInfo') }}</view>
|
||||
<view class="fui-cell-info">
|
||||
<input v-model="Form.mobile" class="fui-input" maxlength="11" :placeholder="$lang('pleaseEnterMobile')" type="number"></input>
|
||||
<input v-model="Form.mobile" class="fui-input" maxlength="11" :placeholder="$lang('pleaseEnterMobile')" type="number":key="formKey"></input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fui-cell ">
|
||||
<view class="fui-cell-label" style="position: absolute;top:10px">{{ $lang('messageContent') }}</view>
|
||||
<view class="fui-cell-info" style="margin-left: 160rpx;border: solid 2rpx #eee;">
|
||||
<!-- <input v-model="Form.mailbox" class="fui-input" placeholder="请输入您的邮箱" type="text" ></input> -->
|
||||
<textarea class="textarea" v-model="Form.remark" :placeholder="$lang('pleaseEnterMessage')" style="font-size: 28rpx;padding: 10rpx;"></textarea>
|
||||
<textarea class="textarea" v-model="Form.remark" :placeholder="$lang('pleaseEnterMessage')" style="font-size: 28rpx;padding: 10rpx;":key="formKey"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -158,6 +158,7 @@ export default {
|
||||
remark: ''
|
||||
|
||||
},
|
||||
formKey: Date.now(),
|
||||
markers: [
|
||||
{
|
||||
id: 1,
|
||||
@@ -222,18 +223,30 @@ export default {
|
||||
// window.open('https://xcx10.5g-quickapp.com/test.php')
|
||||
},
|
||||
save() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/member/message',
|
||||
data: this.Form,
|
||||
success: res => {
|
||||
this.$refs.informationPopup.close();
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
});
|
||||
},
|
||||
fail: res => {
|
||||
}
|
||||
});
|
||||
if (!this.Form.realname.trim()) {
|
||||
uni.showToast({ title: '请填写姓名', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.Form.mobile || !/^1[3-9]\d{9}$/.test(this.Form.mobile)) {
|
||||
uni.showToast({ title: '手机号格式不正确', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.Form.remark.trim()) {
|
||||
uni.showToast({ title: '请填写留言内容', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
this.$api.sendRequest({
|
||||
url: '/api/member/message',
|
||||
data: this.Form,
|
||||
success: res => {
|
||||
this.$refs.informationPopup.close();
|
||||
uni.showToast({ title: res.message || '提交成功', icon: 'success' });
|
||||
|
||||
this.Form = { realname: '', mobile: '', remark: '' };
|
||||
this.formKey = Date.now();
|
||||
}
|
||||
});
|
||||
},
|
||||
change(e) {
|
||||
console.log(e)
|
||||
@@ -241,8 +254,17 @@ export default {
|
||||
},
|
||||
//留言打开
|
||||
tapMessage() {
|
||||
this.ismessage = 1
|
||||
this.$refs.informationPopup.open();
|
||||
// 清空表单数据
|
||||
this.Form = {
|
||||
realname: '',
|
||||
mobile: '',
|
||||
remark: ''
|
||||
};
|
||||
// 关键:更新 key,强制重建输入框
|
||||
this.formKey = Date.now();
|
||||
|
||||
this.ismessage = 1;
|
||||
this.$refs.informationPopup.open();
|
||||
},
|
||||
//留言关闭
|
||||
closeinformationPopup() {
|
||||
|
||||
Reference in New Issue
Block a user