提交 709e8c353ab732daaaf12e5245a438e896e9a4d6

作者 wangyu
1 个父辈 5b09b1c6

优化

... ... @@ -46,27 +46,14 @@ Page({
46 46 handleData: function (data){
47 47 var newdata = JSON.parse(data);
48 48 if (newdata ){
49   - if (newdata.children_birthday && newdata.children_birthday > 0) {
50   - newdata.children_birthday = format.formatTime_date(newdata.children_birthday)
51   - }
52   - if (newdata.spouse_birthday && newdata.spouse_birthday > 0) {
53   - newdata.spouse_birthday = format.formatTime_date(newdata.spouse_birthday)
54   - }
55   - if (newdata.education_start && newdata.education_start > 0) {
56   - newdata.education_start = format.formatTime_date(newdata.education_start)
57   - }
58   - if (newdata.education_end && newdata.education_end > 0) {
59   - newdata.education_end = format.formatTime_date(newdata.education_end)
60   - }
61   - if (newdata.birthday && newdata.birthday > 0) {
62   - newdata.birthday = format.formatTime_date(newdata.birthday)
63   - }
64   - if (newdata.rent_start && newdata.rent_start > 0) {
65   - newdata.rent_start = format.formatTime_date(newdata.rent_start)
66   - }
67   - if (newdata.rent_end && newdata.rent_end > 0) {
68   - newdata.rent_end = format.formatTime_date(newdata.rent_end)
69   - }
  49 + this.verifyDate(newdata.children_birthday)
  50 + this.verifyDate(newdata.spouse_birthday)
  51 + this.verifyDate(newdata.education_start)
  52 + this.verifyDate(newdata.education_end)
  53 + this.verifyDate(newdata.birthday)
  54 + this.verifyDate(newdata.rent_start)
  55 + this.verifyDate(newdata.rent_end)
  56 +
70 57 if (newdata.house_address) {
71 58 if (newdata.house_address.province == newdata.house_address.city) {
72 59 newdata.house_address_new = newdata.house_address.city + newdata.house_address.district
... ... @@ -85,6 +72,14 @@ Page({
85 72 }
86 73 },
87 74
  75 + verifyDate(date){
  76 + if (date && date > 0) {
  77 + date = format.formatTime_date(date)
  78 + } else {
  79 + date = ""
  80 + }
  81 + },
  82 +
88 83 /**
89 84 * Lifecycle function--Called when page is initially rendered
90 85 */
... ...
... ... @@ -79,7 +79,7 @@
79 79 </view>
80 80 <view style='height:90rpx;width:100%;clear:both;'>
81 81 <text class='text_left'>出生日期</text>
82   - <text class='text_right_333'>{{datas.spouse_birthday}}</text>
  82 + <text class='text_right_333'>{{datas.spouse_birthday>0?"datas.spouse_birthday":""}}</text>
83 83 </view>
84 84 <view style='height:90rpx;width:100%;clear:both;'>
85 85 <text class='text_left'>国籍</text>
... ...
注册登录 后发表评论