提交 1826de2c9f494106bebe2af3b597758d6faed143

作者 wangyu
1 个父辈 758fc5c3

优化

... ... @@ -9,12 +9,12 @@ Page({
9 9 */
10 10 data: {
11 11 legal_entity_id: "",
12   - supporter_id:"",
  12 + supporter_id: "",
13 13 name: "",
14 14 nation: "",
15 15 id_card_no: "",
16   - birthday:"",
17   - datas:"",
  16 + birthday: "",
  17 + datas: "",
18 18 birthday_datelong: -1,
19 19 },
20 20
... ... @@ -23,20 +23,20 @@ Page({
23 23 */
24 24 onLoad: function(options) {
25 25 console.log("onLoad", options)
26   - if (options.id){
  26 + if (options.id) {
27 27 this.setData({
28 28 legal_entity_id: options.id,
29 29 })
30 30 }
31   -
32   - if (options.datas && JSON.parse(options.datas)){
33   - var curdata = JSON.parse(options.datas)
  31 +
  32 + if (options.datas && JSON.parse(options.datas)) {
  33 + var curdata = JSON.parse(options.datas)
34 34 this.setData({
35 35 datas: curdata,
36 36 supporter_id: curdata.id,
37 37 name: curdata.co_supporter,
38 38 id_card_no: curdata.id_card_no,
39   - birthday: curdata.birthday ? this.formatDate(curdata.birthday ):"",
  39 + birthday: curdata.birthday ? this.formatDate(curdata.birthday) : "",
40 40 birthday_datelong: Date.parse(new Date(curdata.birthday)) / 1000
41 41 })
42 42 }
... ... @@ -109,7 +109,7 @@ Page({
109 109 this.showToast("证件号码有误")
110 110 return;
111 111 }
112   - if (this.data.birthday.length < 1 ){
  112 + if (this.data.birthday.length < 1) {
113 113 this.showToast("请选择出生日期")
114 114 return;
115 115 }
... ... @@ -143,23 +143,23 @@ Page({
143 143 wx.navigateBack({
144 144 delta: 1
145 145 })
146   - }else{
  146 + } else {
147 147 that.showToast(res.data.message)
148 148 }
149 149 }
150 150 },
151   - fail:function(res){
  151 + fail: function(res) {
152 152 console.log("fail", res)
153 153 that.showToast(res.data.message)
154 154 }
155 155 })
156 156 },
157 157
158   - bindDateChange:function(e){
  158 + bindDateChange: function(e) {
159 159 console.log('picker发送选择改变,携带值为', e)
160 160 this.setData({
161 161 birthday: e.detail.value,
162   - birthday_datelong : Date.parse(new Date(e.detail.value)) / 1000
  162 + birthday_datelong: Date.parse(new Date(e.detail.value)) / 1000
163 163 })
164 164 },
165 165
... ... @@ -172,8 +172,8 @@ Page({
172 172 }
173 173 },
174 174
175   - bindinput:function(e){
176   - console.log("bindinput",e.detail.value)
  175 + bindinput: function(e) {
  176 + console.log("bindinput", e.detail.value)
177 177 var idCardNo = e.detail.value
178 178 if (idCardNo.length == 18) {
179 179 if (!format.isIDCardNum(idCardNo)) {
... ...
... ... @@ -398,29 +398,29 @@ Page({
398 398 method: "POST",
399 399 success: function(res) {
400 400 console.log("success", res)
401   - if (res.statusCode==200){
  401 + if (res.statusCode == 200) {
402 402 that.getAdditionInfo()
403   - }else {
  403 + } else {
404 404 wx.showToast({
405 405 title: res.data.message,
406 406 icon: "none"
407 407 })
408 408 }
409   -
  409 +
410 410 },
411   - fail:function(res){
412   - console.log("fail",res)
413   - wx.showToast({
414   - title: res.data.message,
415   - icon:"none"
416   - })
  411 + fail: function(res) {
  412 + console.log("fail", res)
  413 + wx.showToast({
  414 + title: res.data.message,
  415 + icon: "none"
  416 + })
417 417 }
418 418 })
419 419 },
420 420
421 421 goedit: function(e) { //编辑
422 422 console.log("goedit", e)
423   - var oridata = this.data.origindata?this.data.origindata.items:[]
  423 + var oridata = this.data.origindata ? this.data.origindata.items : []
424 424 var new_info
425 425 if (this.data.cur_status == "continuing_education") {
426 426 if (e.currentTarget.id.indexOf('title') != -1) {
... ... @@ -532,14 +532,14 @@ Page({
532 532 console.log('succ', res)
533 533 if (res.statusCode == 200) {
534 534 that.handleData(res.data);
535   - }else{
  535 + } else {
536 536 wx.showToast({
537 537 title: res.data.message,
538 538 icon: "none"
539 539 })
540 540 }
541 541 },
542   - fail: function (res) {
  542 + fail: function(res) {
543 543 console.log("fail", res)
544 544 wx.showToast({
545 545 title: res.data.message,
... ...
... ... @@ -177,7 +177,7 @@
177 177 letter-spacing: 0;
178 178 }
179 179
180   -#flag{
181   -margin-bottom: 10rpx;
182   -height: 10rpx;
  180 +#flag {
  181 + margin-bottom: 10rpx;
  182 + height: 10rpx;
183 183 }
... ...
注册登录 后发表评论