diff --git a/littleApp_child/pages/quickArchives/quickArchives.js b/littleApp_child/pages/quickArchives/quickArchives.js index 23bed0d..2a4f50d 100644 --- a/littleApp_child/pages/quickArchives/quickArchives.js +++ b/littleApp_child/pages/quickArchives/quickArchives.js @@ -3,6 +3,8 @@ var networkUtil = require('../../utils/network_util.js') var numberUtil = require('../../utils/numberUtil.js') var api = require('../../utils/apiFile.js') var makePy = require('../../utils/makepy.js') +const {utils} = require("../../utils/sdk/src/utils"); +const util = require("../../utils/util") Page({ /** @@ -343,11 +345,17 @@ Page({ showViewType:1 }) }, - + getMomBirth () { + let momCn = this.data.postObj.mommyCardNo; + let bs = util.getBirthdayAndSex(momCn); + this.setData({ + ['postObj.mBirth']: bs[0] + }) + }, diff --git a/littleApp_child/pages/quickArchives/quickArchives.wxml b/littleApp_child/pages/quickArchives/quickArchives.wxml index 55f5b1b..89a375d 100644 --- a/littleApp_child/pages/quickArchives/quickArchives.wxml +++ b/littleApp_child/pages/quickArchives/quickArchives.wxml @@ -26,11 +26,11 @@ * - 身份证号码 + 母亲身份证号 - + @@ -89,7 +89,7 @@ - *儿童出生体重 + *儿童出生体重kg @@ -97,7 +97,7 @@ - *儿童出生身长 + *儿童出生身长cm diff --git a/littleApp_child/pages/quickArchives/quickArchives.wxss b/littleApp_child/pages/quickArchives/quickArchives.wxss index 087caee..fc504d0 100644 --- a/littleApp_child/pages/quickArchives/quickArchives.wxss +++ b/littleApp_child/pages/quickArchives/quickArchives.wxss @@ -23,6 +23,7 @@ } .weui-label{ display: block; + width: 120px!important; } .line-tt{ padding-left: 5px; diff --git a/littleApp_child/utils/util.js b/littleApp_child/utils/util.js index c6cd587..09eae7d 100644 --- a/littleApp_child/utils/util.js +++ b/littleApp_child/utils/util.js @@ -1,15 +1,15 @@ -function formatTime(date) { - var year = date.getFullYear() - var month = date.getMonth() + 1 - var day = date.getDate() - - var hour = date.getHours() - var minute = date.getMinutes() - var second = date.getSeconds() - - - return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') -} +// function formatTime(date) { +// var year = date.getFullYear() +// var month = date.getMonth() + 1 +// var day = date.getDate() +// +// var hour = date.getHours() +// var minute = date.getMinutes() +// var second = date.getSeconds() +// +// +// return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') +// } function formatNumber(n) { n = n.toString() @@ -225,7 +225,33 @@ function checkIsContainCapital(val) { } } - +//根据身份证号得到生日和性别 +function getBirthdayAndSex(idcard) { + let sex; + var output = new Array(2); + output[0] = ""; + output[1] = ""; + if (idcard.length === 15) { + let nian, yue, ri, shengri; + nian = idcard.substr(6, 2); + yue = idcard.substr(8, 2); + ri = idcard.substr(10, 2); + shengri = "19" + nian + "-" + yue + "-" + ri; + output[0] = shengri; + sex = (idcard.substr(14, 1) % 2); + output[1] = sex; + } else if (idcard.length === 18) { + let nian, yue, ri, shengri; + nian = idcard.substr(6, 4); + yue = idcard.substr(10, 2); + ri = idcard.substr(12, 2); + shengri = nian + "-" + yue + "-" + ri; + output[0] = shengri; + sex = (idcard.substr(16, 1) % 2); + output[1] = sex; + } + return output; +} module.exports = { getTime: getTime, @@ -238,5 +264,6 @@ module.exports = { convertHtmlToText : convertHtmlToText, CheckChinese: CheckChinese, mutableCopy: mutableCopy, - checkIsContainCapital: checkIsContainCapital + checkIsContainCapital: checkIsContainCapital, + getBirthdayAndSex: getBirthdayAndSex }