diff --git a/utils/global.js b/utils/global.js index 2b9b5e2..ab89f38 100644 --- a/utils/global.js +++ b/utils/global.js @@ -79,9 +79,22 @@ export function getArea(str) { } else if (_district != -1) { //有行政区 area.province = str.substring(0, _district + 3) un_pro_str = str.substr(_district + 3); - } else if (_city != -1) { //有市 - area.province = str.substring(0, _city + 1) - un_pro_str = str.substr(_city + 1); + } else if (_city != -1) { //有市 + console.log("市",_city) + area.province = str.substring(0, _city + 1) + let deviceType + uni.getSystemInfo({ + success(res) { + deviceType = res.osName + } + }) + + if(deviceType == 'android'){ + un_pro_str = str.substr(_city + 1); + }else{ + un_pro_str = str + } + console.log("市例",un_pro_str) } @@ -116,7 +129,7 @@ export function getArea(str) { un_city_str = un_pro_str.substr(_county + 1); } - var reg = /.+?(市|县|区)/g; + var reg = /.+?(市|县|区|旗)/g; var aaa; aaa = un_city_str.match(reg); area.country = aaa[0];