提交 a14c477dd563bea0d68ff3bc7fa497df5843fe1b

作者 pangy
1 个父辈 ae1baa0a

学前教育 起始时间 生日+ 3年

... ... @@ -821,6 +821,10 @@ Page({
821 821 switch (this.data.cur_index + '') {
822 822 case 'children_education':
823 823 this.dealCardType(data.children_id_card_type, 'childrencardtype')//为防止干扰其他字段,需要先执行
  824 + if (data.education_period.indexOf('学前') > -1){
  825 + var studystartdate = this.data.studystartdate
  826 + studystartdate.disabled = true
  827 + }
824 828 var setData = {}
825 829 this.data.countryData.selected = data.children_nation
826 830 setData.countryData = this.data.countryData
... ... @@ -835,7 +839,7 @@ Page({
835 839 var childrenpercentData = this.data.childrenpercentData
836 840 childrenpercentData.selected = data.percent + '%'
837 841 setData.childrenpercentData = childrenpercentData
838   - var studystartdate = this.data.studystartdate
  842 +
839 843 studystartdate.selected = format.formatTime_month(data.education_start)
840 844 studystartdate.datelong = data.education_start
841 845 setData.studystartdate = studystartdate
... ... @@ -2294,6 +2298,35 @@ Page({
2294 2298 }
2295 2299
2296 2300 },
  2301 + //-----------------处理受教育时间起的逻辑-----------/
  2302 + handleStartDate: function (select_date,disabled) {
  2303 + var study_startdate = this.data.studystartdate
  2304 + study_startdate.selected = select_date
  2305 + study_startdate.disabled = disabled
  2306 + var start = select_date, select_year = 0
  2307 + if (select_date.length>4) {
  2308 + study_startdate.datelong = (Date.parse(new Date(select_date)) / 1000)
  2309 + select_year = select_date.substring(0, 4)
  2310 + }else{
  2311 + study_startdate.datelong = null
  2312 + }
  2313 + //处理两个终止时间的限制
  2314 + if (select_year < 2019) {
  2315 + start = '2019-01'
  2316 + }
  2317 + var studyPeriodDate = this.data.studyPeriodDate
  2318 + studyPeriodDate.start = start
  2319 + studyPeriodDate.selected = ''
  2320 + studyPeriodDate.datelong = null
  2321 + var study_enddate = this.data.studyEndDate
  2322 + study_enddate.start = start
  2323 + study_enddate.selected = ''
  2324 + this.setData({
  2325 + studystartdate: study_startdate,
  2326 + studyPeriodDate: studyPeriodDate,
  2327 + studyEndDate: study_enddate
  2328 + })
  2329 + },
2297 2330 onPickerSelect: function(e) {
2298 2331 console.log('picker发送选择改变,携带值为', e)
2299 2332 switch (e.currentTarget.id) {
... ... @@ -2425,27 +2458,7 @@ Page({
2425 2458 break;
2426 2459 case 'study_start_date':
2427 2460 var select_date = e.detail.value
2428   - var study_startdate = this.data.studystartdate
2429   - study_startdate.selected = select_date
2430   - study_startdate.datelong = (Date.parse(new Date(select_date)) / 1000)
2431   - //处理两个终止时间的限制
2432   - var select_year = select_date.substring(0, 4)
2433   - var start = select_date
2434   - if (select_year<2019){
2435   - start = '2019-01'
2436   - }
2437   - var studyPeriodDate = this.data.studyPeriodDate
2438   - studyPeriodDate.start = start
2439   - studyPeriodDate.selected = ''
2440   - studyPeriodDate.datelong = null
2441   - var study_enddate = this.data.studyEndDate
2442   - study_enddate.start = start
2443   - study_enddate.selected = ''
2444   - this.setData({
2445   - studystartdate: study_startdate,
2446   - studyPeriodDate: studyPeriodDate,
2447   - studyEndDate: study_enddate
2448   - })
  2461 + this.handleStartDate(select_date,false) //处理受教育时间起的逻辑
2449 2462 break;
2450 2463 case 'study_end_date':
2451 2464 var study_enddate = this.data.studyEndDate
... ... @@ -2487,12 +2500,24 @@ Page({
2487 2500 // }
2488 2501 break;
2489 2502 case 'child_edu_degree':
  2503 + var ifPreprimary = (e.detail.value == '0') //学前教育
  2504 + if (ifPreprimary){
  2505 + if (this.data.commonbirthDate.selected.length < 1) {
  2506 + this.showToast('请先完善子女生日信息')
  2507 + return
  2508 + } else{
  2509 + var year = this.data.commonbirthDate.selected.substring(0, 4) - 3
  2510 + var month = this.data.commonbirthDate.selected.substring(4, 7)
  2511 + this.handleStartDate(year+month, true) //处理受教育时间起的逻辑
  2512 + }
  2513 + }else{
  2514 + this.handleStartDate('', false)
  2515 + }
2490 2516 var childedudegreeData = this.data.childedudegreeData
2491 2517 childedudegreeData.selected = childedudegreeData.values[e.detail.value]
2492 2518 this.setData({
2493 2519 childedudegreeData: childedudegreeData
2494 2520 })
2495   - var ifPreprimary = (e.detail.value == '0')
2496 2521 this.data.schoolCountryData.isrequre = !ifPreprimary
2497 2522 this.setData({
2498 2523 schoolCountryData: this.data.schoolCountryData,
... ...
注册登录 后发表评论