|
|
@@ -34,10 +34,10 @@ Page({
|
|
|
var cityList = city.cityList();
|
|
|
this.data.cityNameList = city.cityNameList();
|
|
|
|
|
|
- console.log("cityinfo", cityList);
|
|
|
+ // console.log("cityinfo", cityList);
|
|
|
|
|
|
var sysInfo = wx.getSystemInfoSync();
|
|
|
- console.log(sysInfo);
|
|
|
+ // console.log(sysInfo);
|
|
|
var winHeight = sysInfo.windowHeight;
|
|
|
|
|
|
//添加要匹配的字母范围值
|
|
|
@@ -157,6 +157,18 @@ Page({
|
|
|
wxSortPickerViewItemTap: function(e) {
|
|
|
var city = e.target.dataset.text;
|
|
|
var cityCode = e.target.dataset.code;
|
|
|
+ if (city.indexOf("市") != -1) {
|
|
|
+ city = city.substring(0, city.lastIndexOf('市'));
|
|
|
+ }
|
|
|
+ if (city.indexOf("地区") != -1) {
|
|
|
+ city = city.substring(0, city.lastIndexOf('地区'));
|
|
|
+ }
|
|
|
+ if (city.indexOf("自治州") != -1) {
|
|
|
+ city = city.substring(0, city.lastIndexOf('自治州'));
|
|
|
+ }
|
|
|
+ if (city.indexOf("特别行政区") != -1) {
|
|
|
+ city = city.substring(0, city.lastIndexOf('特别行政区'));
|
|
|
+ }
|
|
|
console.log('选择了城市:', city);
|
|
|
console.log('选择了城市的code:', cityCode);
|
|
|
wx.setStorageSync('city', city)
|
|
|
@@ -205,6 +217,9 @@ Page({
|
|
|
var data = data[0],
|
|
|
city = data.regeocodeData.addressComponent.city || "无锡",
|
|
|
cityCode = data.regeocodeData.addressComponent.adcode.substring(0, 4) + "00";
|
|
|
+ if (city.indexOf("市") != -1) {
|
|
|
+ city = city.substring(0, city.lastIndexOf('市'));
|
|
|
+ }
|
|
|
that.setData({
|
|
|
city: city,
|
|
|
cityCode: cityCode
|