Commit 27c5d303a27ff03ec47380e9e30ef44e575d1ec7
1 parent
c5427480
生日日期优化
Showing
2 changed files
with
7 additions
and
1 deletions
packageA/pages/profile/profile.js
@@ -78,6 +78,7 @@ Page({ | @@ -78,6 +78,7 @@ Page({ | ||
78 | lon: null, //经度 | 78 | lon: null, //经度 |
79 | loading: 0, | 79 | loading: 0, |
80 | oldBirtthDayLength:0, //生日日期个数 | 80 | oldBirtthDayLength:0, //生日日期个数 |
81 | + oldbirthday:'',//生日日期 | ||
81 | }, | 82 | }, |
82 | //通过路径跳转到其他页面 | 83 | //通过路径跳转到其他页面 |
83 | goto: function (e) { | 84 | goto: function (e) { |
@@ -1147,6 +1148,10 @@ Page({ | @@ -1147,6 +1148,10 @@ Page({ | ||
1147 | console.log("获取生日222222222"); | 1148 | console.log("获取生日222222222"); |
1148 | console.log(e); | 1149 | console.log(e); |
1149 | let b = this.getInput(e); | 1150 | let b = this.getInput(e); |
1151 | + let reg=/^[0-9\-]*$/ | ||
1152 | + if (!(reg.test(b))){ | ||
1153 | + return this.data.oldbirthday | ||
1154 | + } | ||
1150 | let length = b.length; | 1155 | let length = b.length; |
1151 | let oldBirtthDayLength=this.data.oldBirtthDayLength | 1156 | let oldBirtthDayLength=this.data.oldBirtthDayLength |
1152 | if (length > oldBirtthDayLength) { | 1157 | if (length > oldBirtthDayLength) { |
@@ -1164,6 +1169,7 @@ Page({ | @@ -1164,6 +1169,7 @@ Page({ | ||
1164 | this.setData({ | 1169 | this.setData({ |
1165 | datet: b, | 1170 | datet: b, |
1166 | oldBirtthDayLength:length, | 1171 | oldBirtthDayLength:length, |
1172 | + oldbirthday:b | ||
1167 | }); | 1173 | }); |
1168 | }, | 1174 | }, |
1169 | //获取生日 | 1175 | //获取生日 |
packageA/pages/profile/profile.wxml
@@ -91,7 +91,7 @@ | @@ -91,7 +91,7 @@ | ||
91 | <view class="shrink0">出生日期:</view> | 91 | <view class="shrink0">出生日期:</view> |
92 | <view class="flex fs28 Birth pdl20 jc_fe"> | 92 | <view class="flex fs28 Birth pdl20 jc_fe"> |
93 | <view class="user-txt-right pdl20 flex ai-center"> | 93 | <view class="user-txt-right pdl20 flex ai-center"> |
94 | - <input bindinput="getbind" bindblur="bindChange" maxlength="10" type="number" value="{{datet}}" class="user-txt-right pdl20 f1 t-r" placeholder="请输入出生日期"></input> | 94 | + <input bindinput="getbind" bindblur="bindChange" maxlength="10" type="text" value="{{datet}}" class="user-txt-right pdl20 f1 t-r" placeholder="请输入出生日期"></input> |
95 | <picker class="pdl20" bindchange='bindChange' mode="date" start="{{year-70}}-1-1" end="{{year}}-12-31"> | 95 | <picker class="pdl20" bindchange='bindChange' mode="date" start="{{year-70}}-1-1" end="{{year}}-12-31"> |
96 | <!-- <view class="flex ai-center">{{datet?datet:"请选择时间"}}<view class="angle">∟</view></view> --> | 96 | <!-- <view class="flex ai-center">{{datet?datet:"请选择时间"}}<view class="angle">∟</view></view> --> |
97 | <image src="{{iurl}}/miniapp/images/calendar.png" style="width: 40rpx;height: 40rpx;"></image> | 97 | <image src="{{iurl}}/miniapp/images/calendar.png" style="width: 40rpx;height: 40rpx;"></image> |