Browse Source

人才吹哨超过字数确任不清空

master
chenteng 5 years ago
parent
commit
2432c15b66
  1. 28
      pages/topics/talents/index.js
  2. 2
      pages/topics/talents/index.wxml

28
pages/topics/talents/index.js

@ -18,6 +18,7 @@ Component({
data: {
messageTitle:"",
messageDetail:"",
messageTemp:"",
files: [],
// 所在街道
streets: [],
@ -89,15 +90,15 @@ Component({
})
},
bindTextAreaInput(e) {
if(this.data.messageDetail.length <= 200){
console.log("bindTextAreaInput");
this.setData({
messageDetail: e.detail.value
messageDetail: e.detail.value,
})
}else{
if(e.detail.value.length>200){
wx.showToast({
title: '超过字数',
icon: 'none',
duration: 2000,
icon: 'none'
})
}
},
@ -143,26 +144,19 @@ Component({
},
submit() {
if (this.data.messageDetail === ''){
if (this.data.messageDetail.length >200){
wx.showModal({
title: '提示',
content: '请输入正文内容',
showCancel:false
content: '问题超过字数,重新输入',
showCancel:false,
})
return
}
if (this.data.messageDetail.length >200){
let th = this
if (this.data.messageDetail === ''){
wx.showModal({
title: '提示',
content: '问题超过字数,请重新输入',
showCancel:false,
success: function (res) {
console.log(res);
setTimeout(function(){th.setData({
messageDetail: ''
})},500)
},
content: '请输入正文内容',
showCancel:false
})
return
}

2
pages/topics/talents/index.wxml

@ -6,7 +6,7 @@
<view class="question-image">
<!-- 文本框 -->
<view class="item">
<textarea class="textArea" maxlength="210" value="{{messageDetail}}" bindinput="bindTextAreaInput" placeholder="请描述您的问题(200字内)" />
<textarea class="textArea" maxlength="210" bindinput="bindTextAreaInput" placeholder="请描述您的问题(200字内)" />
</view>
<!-- 添加图片 -->
<view style="z-index:10">

Loading…
Cancel
Save