提交 a14c477dd563bea0d68ff3bc7fa497df5843fe1b

作者 pangy
1 个父辈 ae1baa0a

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

@@ -821,6 +821,10 @@ Page({ @@ -821,6 +821,10 @@ Page({
821 switch (this.data.cur_index + '') { 821 switch (this.data.cur_index + '') {
822 case 'children_education': 822 case 'children_education':
823 this.dealCardType(data.children_id_card_type, 'childrencardtype')//为防止干扰其他字段,需要先执行 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 var setData = {} 828 var setData = {}
825 this.data.countryData.selected = data.children_nation 829 this.data.countryData.selected = data.children_nation
826 setData.countryData = this.data.countryData 830 setData.countryData = this.data.countryData
@@ -835,7 +839,7 @@ Page({ @@ -835,7 +839,7 @@ Page({
835 var childrenpercentData = this.data.childrenpercentData 839 var childrenpercentData = this.data.childrenpercentData
836 childrenpercentData.selected = data.percent + '%' 840 childrenpercentData.selected = data.percent + '%'
837 setData.childrenpercentData = childrenpercentData 841 setData.childrenpercentData = childrenpercentData
838 - var studystartdate = this.data.studystartdate 842 +
839 studystartdate.selected = format.formatTime_month(data.education_start) 843 studystartdate.selected = format.formatTime_month(data.education_start)
840 studystartdate.datelong = data.education_start 844 studystartdate.datelong = data.education_start
841 setData.studystartdate = studystartdate 845 setData.studystartdate = studystartdate
@@ -2294,6 +2298,35 @@ Page({ @@ -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 onPickerSelect: function(e) { 2330 onPickerSelect: function(e) {
2298 console.log('picker发送选择改变,携带值为', e) 2331 console.log('picker发送选择改变,携带值为', e)
2299 switch (e.currentTarget.id) { 2332 switch (e.currentTarget.id) {
@@ -2425,27 +2458,7 @@ Page({ @@ -2425,27 +2458,7 @@ Page({
2425 break; 2458 break;
2426 case 'study_start_date': 2459 case 'study_start_date':
2427 var select_date = e.detail.value 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 break; 2462 break;
2450 case 'study_end_date': 2463 case 'study_end_date':
2451 var study_enddate = this.data.studyEndDate 2464 var study_enddate = this.data.studyEndDate
@@ -2487,12 +2500,24 @@ Page({ @@ -2487,12 +2500,24 @@ Page({
2487 // } 2500 // }
2488 break; 2501 break;
2489 case 'child_edu_degree': 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 var childedudegreeData = this.data.childedudegreeData 2516 var childedudegreeData = this.data.childedudegreeData
2491 childedudegreeData.selected = childedudegreeData.values[e.detail.value] 2517 childedudegreeData.selected = childedudegreeData.values[e.detail.value]
2492 this.setData({ 2518 this.setData({
2493 childedudegreeData: childedudegreeData 2519 childedudegreeData: childedudegreeData
2494 }) 2520 })
2495 - var ifPreprimary = (e.detail.value == '0')  
2496 this.data.schoolCountryData.isrequre = !ifPreprimary 2521 this.data.schoolCountryData.isrequre = !ifPreprimary
2497 this.setData({ 2522 this.setData({
2498 schoolCountryData: this.data.schoolCountryData, 2523 schoolCountryData: this.data.schoolCountryData,
注册登录 后发表评论