chenjj 3 miesięcy temu
rodzic
commit
fdbcf659e7

+ 1 - 1
App.vue

@@ -12,7 +12,7 @@ export default {
 	},
 	onShow: function () {
 		//设置默认角色
-		 uni.setStorageSync('userType', 1);
+		//  uni.setStorageSync('userType', 1);
 		console.log('App Show')
 	},
 	onHide: function () {

+ 5 - 2
pages/index.vue

@@ -300,8 +300,11 @@ onMounted(async () => {
         getList()
       })
   } else {
-    //设置默认角色
-    uni.setStorageSync('userType', 1);
+    if(!userType){
+      //设置默认角色
+      uni.setStorageSync('userType', 1);
+    }
+    
     getList();
   }
 })

+ 4 - 1
pages_home/components/cust-form/index.vue

@@ -374,10 +374,13 @@ function onCityWx(row) {
     console.log('地区选点',row);
     wx.chooseLocation({
         success:async function (res) {
+            console.log('res.address',res.address);
+            
             const result = splitAddress(res.address);
+			console.log("TCL: onCityWx -> result", result)
             const res_dara = await regionAddresstree();
             const handlecityData = getCityCode([result.province,result.city,result.district].join(' '),res_dara.data)
-            console.log(res,handlecityData);
+			console.log("TCL: onCityWx -> handlecityData", handlecityData)
             addressChange(handlecityData,row)
 
              Object.assign(formData, {

+ 2 - 11
pages_home/components/pickerAddress/address.js

@@ -19222,16 +19222,7 @@ export default [
                         "districtInitial": "S",
                         "name": "双桥经济技术开发区",
                         "districtPinyin": "shuang qiao jing ji ji shu kai fa qu"
-                    }
-                ]
-            },
-            {
-                "cityAcronym": "ZQJX",
-                "code": 500200,
-                "cityInitial": "Z",
-                "name": "重庆郊县",
-                "cityPinyin": "zhong qing jiao xian",
-                "children": [
+                    },
                     {
                         "districtAcronym": "CKX",
                         "code": 500229,
@@ -19317,7 +19308,7 @@ export default [
                         "districtPinyin": "peng shui miao zu tu jia zu zi zhi xian"
                     }
                 ]
-            }
+            },
         ],
         "provinceAcronym": "ZQS",
         "code": 500000,

+ 5 - 1
utils/adress.js

@@ -123,8 +123,10 @@ function locateTheCurrentAddress(ad_array){
 
 function splitAddress(address) {
   // 处理直辖市(如北京市朝阳区)
-  const directCityRegex = /^(北京|天津|上海|重庆)(市)?(.+?区)/;
+  const directCityRegex = /^(北京|天津|上海|重庆)(市)?(.+?(区|县))/;
+	console.log("TCL: splitAddress -> directCityRegex", directCityRegex)
   const directMatch = address.match(directCityRegex);
+	console.log("TCL: splitAddress -> directMatch", directMatch)
   if (directMatch) {
     return {
       province: directMatch[1],
@@ -157,6 +159,7 @@ function normalizeAddress(str) {
  * @returns {Object|null} 包含 data/name、code、index 的对象
  */
 const getCityCode = (address,addressData) => {
+	console.log("TCL: getCityCode -> address", address)
   if(!addressData) return null;
    //address:重庆市永川区人民大道191号
   const names = address.split(/\s+/)
@@ -197,6 +200,7 @@ const getCityCode = (address,addressData) => {
   result.data.push(district.name)
   result.code.push(district.regionCode)
   result.index.push(districtIndex)
+	console.log("TCL: getCityCode -> result", result)
 
   return result