Browse Source

BUG修改 个人资料姓名 样式修改 吹哨内容过多

master
chenteng 5 years ago
parent
commit
bc89495336
  1. 31
      pages/topics/talents/index.js
  2. 4
      pages/topics/talents/index.wxml
  3. 3
      pages/topics/talents/index.wxss
  4. 34
      pages/user/myInfo/index.js
  5. 2
      pages/user/myInfo/index.wxml

31
pages/topics/talents/index.js

@ -89,11 +89,18 @@ Component({
}) })
}, },
bindTextAreaInput(e) { bindTextAreaInput(e) {
if(this.data.messageDetail.length <= 200){
this.setData({ this.setData({
messageDetail: e.detail.value messageDetail: e.detail.value
}) })
}else{
wx.showToast({
title: '超过字数',
icon: 'none',
duration: 2000,
})
}
}, },
uplaodFile(files) { uplaodFile(files) {
console.log('upload files', files) console.log('upload files', files)
// 文件上传的函数,返回一个promise // 文件上传的函数,返回一个promise
@ -144,6 +151,21 @@ Component({
}) })
return return
} }
if (this.data.messageDetail.length >200){
let th = this
wx.showModal({
title: '提示',
content: '问题超过字数,请重新输入',
showCancel:false,
success: function (res) {
console.log(res);
setTimeout(function(){th.setData({
messageDetail: ''
})},500)
},
})
return
}
//判断是否选择街道 //判断是否选择街道
if (this.data.streetID === ''){ if (this.data.streetID === ''){
wx.showModal({ wx.showModal({
@ -165,7 +187,7 @@ Component({
},()=>{ },()=>{
wx.showModal({ wx.showModal({
title: '提交成功', title: '提交成功',
content: '问题已收到,我们会尽快给您答复的!', content: '问题已收到!',
cancelText:'知道了', cancelText:'知道了',
confirmText:'查看进度', confirmText:'查看进度',
success (res) { success (res) {
@ -192,8 +214,9 @@ Component({
}) })
} }
}) })
this.setData({
streetsIndex: 0,
})
} }
}, },

4
pages/topics/talents/index.wxml

@ -6,10 +6,10 @@
<view class="question-image"> <view class="question-image">
<!-- 文本框 --> <!-- 文本框 -->
<view class="item"> <view class="item">
<textarea class="textArea" maxlength="1000" value="{{messageDetail}}" bindinput="bindTextAreaInput" placeholder="请描述您的问题" /> <textarea class="textArea" maxlength="210" value="{{messageDetail}}" bindinput="bindTextAreaInput" placeholder="请描述您的问题(200字内)" />
</view> </view>
<!-- 添加图片 --> <!-- 添加图片 -->
<view> <view style="z-index:10">
<mp-uploader ext-class="myUploader" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" max-count="9" title=""></mp-uploader> <mp-uploader ext-class="myUploader" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" max-count="9" title=""></mp-uploader>
</view> </view>
</view> </view>

3
pages/topics/talents/index.wxss

@ -35,6 +35,7 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
background-color: white;
} }
.submitBtn{ .submitBtn{
/* width: 100%; */ /* width: 100%; */
@ -73,7 +74,7 @@
/* 以下为新增 */ /* 以下为新增 */
.question-image{ .question-image{
padding:20px 0px; padding:5px 0px 20px 0px;
} }
.select-view{ .select-view{
display: flex; display: flex;

34
pages/user/myInfo/index.js

@ -31,6 +31,7 @@ Page({
show: false, show: false,
tempData:String, tempData:String,
realData:String, realData:String,
temp:String,
type:String, type:String,
value:String, value:String,
}, },
@ -45,12 +46,31 @@ Page({
this.setData({ this.setData({
realData:this.data.tempData realData:this.data.tempData
}) })
//判断名字长度,限制名字长度10个字之内,姓名不能为空
if(this.data.type === 'userName'){ if(this.data.type === 'userName'){
console.log("username");
console.dir(this.data.realData);
console.log(this.data.realData.length);
if(this.data.realData.length > 10){
wx.showToast({
title: '姓名长度应小于10',
icon: 'none',
duration: 2000,
})
}else if(this.data.realData.length == 0){
wx.showToast({
title: '姓名不能为空',
icon: 'none',
duration: 2000,
})
}else{
console.log("nickName修改了");
console.log(this.data.nickName);
this.setData({ this.setData({
nickName:this.data.realData nickName:this.data.realData
}) })
} }
}
if(this.data.type === 'userAge'){ if(this.data.type === 'userAge'){
this.setData({ this.setData({
age:this.data.realData age:this.data.realData
@ -87,13 +107,16 @@ Page({
}) })
} }
this.setData({ this.setData({
value:'' value:'',
realData:'',
tempData:''
}) })
}, },
tempData: function(e){ tempData: function(e){
this.setData({ this.setData({
tempData:e.detail.value tempData:e.detail.value,
// value:''
}) })
}, },
@ -224,7 +247,9 @@ Page({
}) })
}, },
submit(){ submit(){
// console.log("submit"); console.log("submit");
// console.log(this.data.nickName.length);
// console.log(this.data.nickName);
// console.log(this.data); // console.log(this.data);
userModel.updateUserInfo(this.data, res => { userModel.updateUserInfo(this.data, res => {
if(res.code === 200){ if(res.code === 200){
@ -256,5 +281,6 @@ Page({
}) })
} }
}) })
} }
}) })

2
pages/user/myInfo/index.wxml

@ -47,7 +47,7 @@
title="年龄" title="年龄"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> <!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" value="{{age}}" disabled placeholder="请输入"></input> <input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="10" value="{{age}}" disabled placeholder="请输入"></input>
</mp-cell> </mp-cell>
<!-- 下面是选择框 --> <!-- 下面是选择框 -->
<mp-cell link="true" <mp-cell link="true"

Loading…
Cancel
Save