提交 c3c1bfa85f30ac35cc0128e9a038ad5c95c51569

作者 pangy
1 个父辈 4c8cb76b

外国国籍去除‘中国’等

... ... @@ -106,11 +106,23 @@ Page({
106 106 "Authorization": Authorization
107 107 },
108 108 success: function (res) {
109   - var countryData = that.data.countryData
110   - countryData.values = res.data
111   - that.countrys = res.data
  109 + var countrys = res.data
  110 + if (countrys.indexOf('中国') > -1) {
  111 + countrys.splice(countrys.indexOf('中国'), 1);
  112 + }
  113 + if (countrys.indexOf('中国台湾') > -1) {
  114 + countrys.splice(countrys.indexOf('中国台湾'), 1);
  115 + }
  116 + if (countrys.indexOf('香港') > -1) {
  117 + countrys.splice(countrys.indexOf('香港'), 1);
  118 + }
  119 + if (countrys.indexOf('澳门') > -1) {
  120 + countrys.splice(countrys.indexOf('澳门'), 1);
  121 + }
  122 + that.data.countryData.values = countrys
  123 + that.countrys = countrys
112 124 that.setData({
113   - countryData: countryData,
  125 + countryData: that.data.countryData,
114 126 })
115 127 },
116 128 fail(res) {
... ...
... ... @@ -319,15 +319,25 @@ Page({
319 319 "Authorization": Authorization
320 320 },
321 321 success: function (res) {
322   - console.log('country', res)
323   - var countryData = that.data.countryData
324   - countryData.values = res.data
325   - var birthCountryData = that.data.birthCountryData
326   - birthCountryData.values = res.data
327   - that.countrys = res.data
  322 + var countrys = res.data.concat()
  323 + that.data.birthCountryData.values = res.data
  324 + if (countrys.indexOf('中国') > -1) {
  325 + countrys.splice(countrys.indexOf('中国'), 1);
  326 + }
  327 + if (countrys.indexOf('中国台湾') > -1) {
  328 + countrys.splice(countrys.indexOf('中国台湾'), 1);
  329 + }
  330 + if (countrys.indexOf('香港') > -1) {
  331 + countrys.splice(countrys.indexOf('香港'), 1);
  332 + }
  333 + if (countrys.indexOf('澳门') > -1) {
  334 + countrys.splice(countrys.indexOf('澳门'), 1);
  335 + }
  336 + that.data.countryData.values = countrys
  337 + that.countrys = countrys
328 338 that.setData({
329   - countryData: countryData,
330   - birthCountryData: birthCountryData
  339 + countryData: that.data.countryData,
  340 + birthCountryData: that.data.birthCountryData
331 341 })
332 342 },
333 343 fail(res) {
... ...
注册登录 后发表评论