正在显示
5 个修改的文件
包含
149 行增加
和
46 行删除
| @@ -32,7 +32,7 @@ App({ | @@ -32,7 +32,7 @@ App({ | ||
| 32 | } | 32 | } |
| 33 | }, | 33 | }, |
| 34 | 34 | ||
| 35 | - getTokenByCode: function (code) { | 35 | + getTokenByCode: function (code, relaunch) { |
| 36 | var that = this; | 36 | var that = this; |
| 37 | var baseUrl = that.globalData.baseUrl; | 37 | var baseUrl = that.globalData.baseUrl; |
| 38 | wx.request({ | 38 | wx.request({ |
| @@ -63,6 +63,11 @@ App({ | @@ -63,6 +63,11 @@ App({ | ||
| 63 | }) | 63 | }) |
| 64 | } else if (user && user.type == "1") {//注册用户 | 64 | } else if (user && user.type == "1") {//注册用户 |
| 65 | that.configOssUrl() | 65 | that.configOssUrl() |
| 66 | + if (relaunch) { | ||
| 67 | + wx.reLaunch({ | ||
| 68 | + url: '../guide/guide' | ||
| 69 | + }) | ||
| 70 | + } | ||
| 66 | } | 71 | } |
| 67 | }, | 72 | }, |
| 68 | fail: function (res) { | 73 | fail: function (res) { |
| @@ -21,6 +21,7 @@ const Deduce_amounts_month = { | @@ -21,6 +21,7 @@ const Deduce_amounts_month = { | ||
| 21 | const Deduce_amounts_year = { | 21 | const Deduce_amounts_year = { |
| 22 | 'children_education': 12000, | 22 | 'children_education': 12000, |
| 23 | 'continuing_education': 4800, | 23 | 'continuing_education': 4800, |
| 24 | + 'continuing_education_non': 3600, | ||
| 24 | 'support_duty': 24000, | 25 | 'support_duty': 24000, |
| 25 | 'medical_fund': 0, | 26 | 'medical_fund': 0, |
| 26 | 'house_fund': 0 | 27 | 'house_fund': 0 |
| @@ -40,7 +41,7 @@ Page({ | @@ -40,7 +41,7 @@ Page({ | ||
| 40 | loanAddress_haschanged: false, | 41 | loanAddress_haschanged: false, |
| 41 | rentAddress_haschanged: false, | 42 | rentAddress_haschanged: false, |
| 42 | extrainfo_arr: ["请上传子女出生证明、学籍信息凭证、学费凭证、本人结婚证和分摊协议", "请上传学历学籍凭证", "请上传出生证明或关系证明、独生子女证、分摊协议、其他法定赡养人赡养证明", "请上传诊断书和医疗费用收据", "请上传首套房证明、还款证明、不动产登记证、结婚证和夫妻约定抵扣协议"], | 43 | extrainfo_arr: ["请上传子女出生证明、学籍信息凭证、学费凭证、本人结婚证和分摊协议", "请上传学历学籍凭证", "请上传出生证明或关系证明、独生子女证、分摊协议、其他法定赡养人赡养证明", "请上传诊断书和医疗费用收据", "请上传首套房证明、还款证明、不动产登记证、结婚证和夫妻约定抵扣协议"], |
| 43 | - cur_index: 'support_duty', | 44 | + cur_index: 'continuing_education', |
| 44 | lovercardtypeData: { | 45 | lovercardtypeData: { |
| 45 | label: '配偶证照类型', | 46 | label: '配偶证照类型', |
| 46 | bindtype: 'lovercardtype', | 47 | bindtype: 'lovercardtype', |
| @@ -858,6 +859,18 @@ Page({ | @@ -858,6 +859,18 @@ Page({ | ||
| 858 | spouse_name: id_info.name, | 859 | spouse_name: id_info.name, |
| 859 | loverbirthDate: this.data.loverbirthDate | 860 | loverbirthDate: this.data.loverbirthDate |
| 860 | } | 861 | } |
| 862 | + } else if (this.idcard_belong == 'older_id_card_no') { | ||
| 863 | + this.data.olderbirthDate.selected = birth_day | ||
| 864 | + data = { | ||
| 865 | + id_card_no: id_info.id_card_number, | ||
| 866 | + supported_name: id_info.name, | ||
| 867 | + olderbirthDate: this.data.olderbirthDate | ||
| 868 | + } | ||
| 869 | + } else if (this.idcard_belong == 'owner_id_cartd_no') { | ||
| 870 | + this.data.olderbirthDate.selected = birth_day | ||
| 871 | + data = { | ||
| 872 | + owner_id_cartd_no: id_info.id_card_number, | ||
| 873 | + } | ||
| 861 | } | 874 | } |
| 862 | this.setData(data) | 875 | this.setData(data) |
| 863 | console.log('-cardtypeData--', that.data.cardtypeData) | 876 | console.log('-cardtypeData--', that.data.cardtypeData) |
| @@ -1251,6 +1264,10 @@ Page({ | @@ -1251,6 +1264,10 @@ Page({ | ||
| 1251 | wx.navigateBack({ | 1264 | wx.navigateBack({ |
| 1252 | delta: 1 | 1265 | delta: 1 |
| 1253 | }) | 1266 | }) |
| 1267 | + }else{ | ||
| 1268 | + wx.showToast({ | ||
| 1269 | + title: res.message | ||
| 1270 | + }) | ||
| 1254 | } | 1271 | } |
| 1255 | } | 1272 | } |
| 1256 | }) | 1273 | }) |
| @@ -1268,7 +1285,66 @@ Page({ | @@ -1268,7 +1285,66 @@ Page({ | ||
| 1268 | }) | 1285 | }) |
| 1269 | } | 1286 | } |
| 1270 | }, | 1287 | }, |
| 1271 | - | 1288 | + idChange: function (e) { |
| 1289 | + console.log('idCardNoChange',e, e.detail.value) | ||
| 1290 | + var idCardNo = e.detail.value | ||
| 1291 | + if (e.detail.value.length == 18) { | ||
| 1292 | + if (!format.isIDCardNum(idCardNo)) { | ||
| 1293 | + wx.showToast({ | ||
| 1294 | + image: "../../../../images/warn.png", | ||
| 1295 | + title: '身份证格式有误' | ||
| 1296 | + }) | ||
| 1297 | + return; | ||
| 1298 | + } | ||
| 1299 | + this.dealIdInfo(idCardNo, e.currentTarget.id) | ||
| 1300 | + } | ||
| 1301 | + }, | ||
| 1302 | + //根据身份证号码,获取相关信息 | ||
| 1303 | + dealIdInfo: function (idCardNum, idcard_belong) { | ||
| 1304 | + var info = format.analyzeIDCard(idCardNum) | ||
| 1305 | + console.log('info', info.age, info.sex, info.birthDay, (Date.parse(new Date(info.birthDay)) / 1000)) | ||
| 1306 | + var data | ||
| 1307 | + if (idcard_belong == 'children_id_card_no_input') { | ||
| 1308 | + this.data.commonbirthDate.selected = info.birthDay | ||
| 1309 | + this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | ||
| 1310 | + data = { | ||
| 1311 | + commonbirthDate: this.data.commonbirthDate | ||
| 1312 | + } | ||
| 1313 | + } else if (idcard_belong == 'spouse_id_card_no_input') { | ||
| 1314 | + this.data.loverbirthDate.selected = info.birthDay | ||
| 1315 | + this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | ||
| 1316 | + data = { | ||
| 1317 | + loverbirthDate: this.data.loverbirthDate | ||
| 1318 | + } | ||
| 1319 | + } else if (idcard_belong == 'medical_id_card_no_input') { | ||
| 1320 | + this.data.commonbirthDate.selected = info.birthDay | ||
| 1321 | + this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | ||
| 1322 | + data = { | ||
| 1323 | + commonbirthDate: this.data.commonbirthDate | ||
| 1324 | + } | ||
| 1325 | + } else if (idcard_belong == 'older_id_card_no_input') { | ||
| 1326 | + this.data.olderbirthDate.selected = info.birthDay | ||
| 1327 | + this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | ||
| 1328 | + data = { | ||
| 1329 | + olderbirthDate: this.data.olderbirthDate | ||
| 1330 | + } | ||
| 1331 | + } else if (idcard_belong == 'owner_id_cartd_no_input') { | ||
| 1332 | + // this.data.olderbirthDate.selected = info.birthDay | ||
| 1333 | + // this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | ||
| 1334 | + // data = { | ||
| 1335 | + // owner_id_cartd_no: idCardNum, | ||
| 1336 | + // } | ||
| 1337 | + } | ||
| 1338 | + if (info.age) { | ||
| 1339 | + // data.age = info.age | ||
| 1340 | + } | ||
| 1341 | + if (info.sex) { | ||
| 1342 | + // var gender_data = this.data.genderData | ||
| 1343 | + // gender_data.selected = info.sex | ||
| 1344 | + // data.genderData = gender_data | ||
| 1345 | + } | ||
| 1346 | + this.setData(data) | ||
| 1347 | + }, | ||
| 1272 | onPickerSelect: function(e) { | 1348 | onPickerSelect: function(e) { |
| 1273 | console.log('picker发送选择改变,携带值为', e) | 1349 | console.log('picker发送选择改变,携带值为', e) |
| 1274 | switch (e.currentTarget.id) { | 1350 | switch (e.currentTarget.id) { |
| @@ -1390,7 +1466,7 @@ Page({ | @@ -1390,7 +1466,7 @@ Page({ | ||
| 1390 | if (e.detail.value == '0') { | 1466 | if (e.detail.value == '0') { |
| 1391 | deduction_amount = Deduce_amounts_month[this.data.cur_index] | 1467 | deduction_amount = Deduce_amounts_month[this.data.cur_index] |
| 1392 | } else { | 1468 | } else { |
| 1393 | - deduction_amount = Deduce_amounts_year[this.data.cur_indexfan] | 1469 | + deduction_amount = Deduce_amounts_year[this.data.cur_index] |
| 1394 | } | 1470 | } |
| 1395 | reduce_typeData.selected = reduce_typeData.values[e.detail.value] | 1471 | reduce_typeData.selected = reduce_typeData.values[e.detail.value] |
| 1396 | this.setData({ | 1472 | this.setData({ |
| @@ -1401,9 +1477,22 @@ Page({ | @@ -1401,9 +1477,22 @@ Page({ | ||
| 1401 | case 'edu_type': | 1477 | case 'edu_type': |
| 1402 | var edutypee_data = this.data.edutypeData | 1478 | var edutypee_data = this.data.edutypeData |
| 1403 | edutypee_data.selected = edutypee_data.values[e.detail.value] | 1479 | edutypee_data.selected = edutypee_data.values[e.detail.value] |
| 1480 | + var reducetypeData = this.data.reducetypeData | ||
| 1481 | + var deduction_amount | ||
| 1482 | + if (e.detail.value == '1') {//非学历教育 | ||
| 1483 | + reducetypeData.selected = '年度' | ||
| 1484 | + reducetypeData.disabled = true | ||
| 1485 | + deduction_amount = Deduce_amounts_year['continuing_education_non'] | ||
| 1486 | + }else { | ||
| 1487 | + reducetypeData.disabled = false | ||
| 1488 | + reducetypeData.selected = '月度' | ||
| 1489 | + deduction_amount = Deduce_amounts_month['continuing_education'] | ||
| 1490 | + } | ||
| 1404 | this.setData({ | 1491 | this.setData({ |
| 1405 | edu_lable: e.detail.value == 0 ? 'school' : 'tech', | 1492 | edu_lable: e.detail.value == 0 ? 'school' : 'tech', |
| 1406 | - edutypeData: edutypee_data | 1493 | + edutypeData: edutypee_data, |
| 1494 | + reducetypeData: reducetypeData, | ||
| 1495 | + deduction_amount: deduction_amount | ||
| 1407 | }) | 1496 | }) |
| 1408 | break; | 1497 | break; |
| 1409 | case 'edu_style': | 1498 | case 'edu_style': |
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | <text class='text_black_30 float_left' style='line-height: 90rpx'>子女证件号码</text> | 13 | <text class='text_black_30 float_left' style='line-height: 90rpx'>子女证件号码</text> |
| 14 | <view wx:if="{{isIdCard}}"> | 14 | <view wx:if="{{isIdCard}}"> |
| 15 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="children_id_card_no"></image> | 15 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="children_id_card_no"></image> |
| 16 | - <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}'></input> | 16 | + <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}' bindinput="idChange" id='children_id_card_no_input'></input> |
| 17 | </view> | 17 | </view> |
| 18 | <!-- <view wx:else> | 18 | <!-- <view wx:else> |
| 19 | <input class='input_wrap float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}'></input> | 19 | <input class='input_wrap float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}'></input> |
| @@ -129,7 +129,10 @@ | @@ -129,7 +129,10 @@ | ||
| 129 | <view style='height:90rpx'> | 129 | <view style='height:90rpx'> |
| 130 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> | 130 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> |
| 131 | <text class='text_black_30 float_left'>被赡养人证照号码</text> | 131 | <text class='text_black_30 float_left'>被赡养人证照号码</text> |
| 132 | - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:420rpx;' placeholder='请输入证件号码' type='idcard' name='id_card_no' value='{{id_card_no}}'></input> | 132 | + <view wx:if="{{isIdCard}}"> |
| 133 | + <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="older_id_card_no"></image> | ||
| 134 | + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:380rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='id_card_no' value='{{id_card_no}}' bindinput="idChange" id="older_id_card_no_input"></input> | ||
| 135 | + </view> | ||
| 133 | </view> | 136 | </view> |
| 134 | <view class='divide_line_f5f5f5'></view> | 137 | <view class='divide_line_f5f5f5'></view> |
| 135 | <template is="picker_cell_normal" data="{{...olderbirthDate}}" /> | 138 | <template is="picker_cell_normal" data="{{...olderbirthDate}}" /> |
| @@ -170,7 +173,7 @@ | @@ -170,7 +173,7 @@ | ||
| 170 | <view style='height:90rpx'> | 173 | <view style='height:90rpx'> |
| 171 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> | 174 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> |
| 172 | <text class='text_black_30 float_left'>病人证照号码</text> | 175 | <text class='text_black_30 float_left'>病人证照号码</text> |
| 173 | - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证照号码' name='id_card_no' type='idcard' value='{{id_card_no}}'></input> | 176 | + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证照号码' name='id_card_no' type='idcard' value='{{id_card_no}}' bindinput="idChange" id="medical_id_card_no_input"></input> |
| 174 | </view> | 177 | </view> |
| 175 | <view class='divide_line_f5f5f5'></view> | 178 | <view class='divide_line_f5f5f5'></view> |
| 176 | <template is="picker_cell_normal" data="{{...commonbirthDate}}" /> | 179 | <template is="picker_cell_normal" data="{{...commonbirthDate}}" /> |
| @@ -264,7 +267,10 @@ | @@ -264,7 +267,10 @@ | ||
| 264 | <view style='height:90rpx'> | 267 | <view style='height:90rpx'> |
| 265 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> | 268 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> |
| 266 | <text class='text_black_30 float_left'>证件号码</text> | 269 | <text class='text_black_30 float_left'>证件号码</text> |
| 267 | - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证件号码' name='owner_id_cartd_no'></input> | 270 | + <view wx:if="{{isIdCard}}"> |
| 271 | + <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="owner_id_cartd_no"></image> | ||
| 272 | + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:380rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='owner_id_cartd_no' value='{{owner_id_cartd_no}}' bindinput="idChange" id='owner_id_cartd_no_input'></input> | ||
| 273 | + </view> | ||
| 268 | </view> | 274 | </view> |
| 269 | </view> | 275 | </view> |
| 270 | <view style='height:20rpx;width:100%;background:#F8F8F8;'></view> | 276 | <view style='height:20rpx;width:100%;background:#F8F8F8;'></view> |
| @@ -320,7 +326,7 @@ | @@ -320,7 +326,7 @@ | ||
| 320 | <text class='text_black_30 float_left'>配偶证件号码</text> | 326 | <text class='text_black_30 float_left'>配偶证件号码</text> |
| 321 | <view wx:if="{{isIdCard}}"> | 327 | <view wx:if="{{isIdCard}}"> |
| 322 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image> | 328 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image> |
| 323 | - <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='spouse_id_card_no' maxlength='18' type='idcard' value='{{spouse_id_card_no}}'></input> | 329 | + <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='spouse_id_card_no' maxlength='18' type='idcard' value='{{spouse_id_card_no}}' bindinput="idChange" id='spouse_id_card_no_input'></input> |
| 324 | </view> | 330 | </view> |
| 325 | </view> | 331 | </view> |
| 326 | <view class='divide_line_f5f5f5'></view> | 332 | <view class='divide_line_f5f5f5'></view> |
| @@ -345,7 +351,7 @@ | @@ -345,7 +351,7 @@ | ||
| 345 | <text class='text_black_30 float_left'>配偶证件号码</text> | 351 | <text class='text_black_30 float_left'>配偶证件号码</text> |
| 346 | <view wx:if="{{isIdCard}}"> | 352 | <view wx:if="{{isIdCard}}"> |
| 347 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image> | 353 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image> |
| 348 | - <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='lover_idno' maxlength='18' type='idcard' value='{{lover_idno}}'></input> | 354 | + <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='lover_idno' maxlength='18' type='idcard' value='{{lover_idno}}' bindinput="idChange" id='spouse_id_card_no_input'></input> |
| 349 | </view> | 355 | </view> |
| 350 | </view> | 356 | </view> |
| 351 | <view class='divide_line_f5f5f5'></view> | 357 | <view class='divide_line_f5f5f5'></view> |
| @@ -372,7 +372,7 @@ Page({ | @@ -372,7 +372,7 @@ Page({ | ||
| 372 | }, | 372 | }, |
| 373 | 373 | ||
| 374 | dealIdInfo: function (idCardNum) { | 374 | dealIdInfo: function (idCardNum) { |
| 375 | - var info = this.analyzeIDCard(idCardNum) | 375 | + var info = format.analyzeIDCard(idCardNum) |
| 376 | console.log('info', info.age, info.sex) | 376 | console.log('info', info.age, info.sex) |
| 377 | if (info.age) { | 377 | if (info.age) { |
| 378 | this.setData({ | 378 | this.setData({ |
| @@ -422,39 +422,6 @@ Page({ | @@ -422,39 +422,6 @@ Page({ | ||
| 422 | 422 | ||
| 423 | }, | 423 | }, |
| 424 | 424 | ||
| 425 | - analyzeIDCard: function(IDCard){ | ||
| 426 | - var sexAndAge = {} | ||
| 427 | - //获取用户身份证号码 | ||
| 428 | - var userCard = IDCard; | ||
| 429 | - //如果身份证号码为undefind则返回空 | ||
| 430 | - if(!userCard) { | ||
| 431 | - return sexAndAge; | ||
| 432 | - } | ||
| 433 | - //获取性别 | ||
| 434 | - if(parseInt(userCard.substr(16, 1)) % 2 == 1){ | ||
| 435 | - sexAndAge.sex = '男' | ||
| 436 | - }else { | ||
| 437 | - sexAndAge.sex = '女' | ||
| 438 | - } | ||
| 439 | - //获取出生年月日 | ||
| 440 | - //userCard.substring(6,10) + "-" + userCard.substring(10,12) + "-" + userCard.substring(12,14); | ||
| 441 | - var yearBirth = userCard.substring(6, 10); | ||
| 442 | - var monthBirth = userCard.substring(10, 12); | ||
| 443 | - var dayBirth = userCard.substring(12, 14); | ||
| 444 | - //获取当前年月日并计算年龄 | ||
| 445 | - var myDate = new Date(); | ||
| 446 | - var monthNow = myDate.getMonth() + 1; | ||
| 447 | - var dayNow = myDate.getDay(); | ||
| 448 | - var age = myDate.getFullYear() - yearBirth; | ||
| 449 | - if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) { | ||
| 450 | - age--; | ||
| 451 | - } | ||
| 452 | - //得到年龄 | ||
| 453 | - sexAndAge.age = age; | ||
| 454 | - //返回性别和年龄 | ||
| 455 | - return sexAndAge; | ||
| 456 | -}, | ||
| 457 | - | ||
| 458 | /** | 425 | /** |
| 459 | * 生命周期函数--监听页面隐藏 | 426 | * 生命周期函数--监听页面隐藏 |
| 460 | */ | 427 | */ |
| @@ -100,6 +100,41 @@ function isIDCardNum(idCardNo) { | @@ -100,6 +100,41 @@ function isIDCardNum(idCardNo) { | ||
| 100 | return false; | 100 | return false; |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | +function analyzeIDCard(IDCard){ | ||
| 104 | + var sexAndAge = {} | ||
| 105 | + //获取用户身份证号码 | ||
| 106 | + var userCard = IDCard; | ||
| 107 | + //如果身份证号码为undefind则返回空 | ||
| 108 | + if (!userCard) { | ||
| 109 | + return sexAndAge; | ||
| 110 | + } | ||
| 111 | + //获取性别 | ||
| 112 | + if (parseInt(userCard.substr(16, 1)) % 2 == 1) { | ||
| 113 | + sexAndAge.sex = '男' | ||
| 114 | + } else { | ||
| 115 | + sexAndAge.sex = '女' | ||
| 116 | + } | ||
| 117 | + //获取出生年月日 | ||
| 118 | + //userCard.substring(6,10) + "-" + userCard.substring(10,12) + "-" + userCard.substring(12,14); | ||
| 119 | + var yearBirth = userCard.substring(6, 10); | ||
| 120 | + var monthBirth = userCard.substring(10, 12); | ||
| 121 | + var dayBirth = userCard.substring(12, 14); | ||
| 122 | + //出生日期 | ||
| 123 | + sexAndAge.birthDay = yearBirth + '-' + monthBirth + '-' + dayBirth; | ||
| 124 | + | ||
| 125 | + //获取当前年月日并计算年龄 | ||
| 126 | + var myDate = new Date(); | ||
| 127 | + var monthNow = myDate.getMonth() + 1; | ||
| 128 | + var dayNow = myDate.getDay(); | ||
| 129 | + var age = myDate.getFullYear() - yearBirth; | ||
| 130 | + if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) { | ||
| 131 | + age--; | ||
| 132 | + } | ||
| 133 | + //得到年龄 | ||
| 134 | + sexAndAge.age = age; | ||
| 135 | + //返回性别和年龄 | ||
| 136 | + return sexAndAge; | ||
| 137 | +} | ||
| 103 | 138 | ||
| 104 | module.exports = { | 139 | module.exports = { |
| 105 | formatTime: formatTime, | 140 | formatTime: formatTime, |
| @@ -110,5 +145,6 @@ module.exports = { | @@ -110,5 +145,6 @@ module.exports = { | ||
| 110 | monthFormString: monthFormString, | 145 | monthFormString: monthFormString, |
| 111 | dayFormString: dayFormString, | 146 | dayFormString: dayFormString, |
| 112 | isIDCardNum: isIDCardNum, | 147 | isIDCardNum: isIDCardNum, |
| 113 | - curDateTime: curDateTime | 148 | + curDateTime: curDateTime, |
| 149 | + analyzeIDCard: analyzeIDCard | ||
| 114 | } | 150 | } |
请
注册
或
登录
后发表评论