WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2023-03-20 c4911f853e9c1c3ed6d1aeca934479e9043ec4d1
forms/chinaArea/ChinaLocations.weapp.js
@@ -4,15 +4,15 @@
 */
import Taro from '@tarojs/taro';
import { Fetcher } from '@components/bases/Fetcher';
import project from '@project';
import { $hostBoot } from '@components/bases/HostBoot';
const locationTree = [];
let ChinaLocationData = {};
let readyCallback = () => { };
Taro.request({
    url: Fetcher.host + project.host.assetsPath + '/datas/ChinaLocation.json',
    url: $hostBoot.getHost() + project.host.assetsPath + '/datas/ChinaLocation.json',
    header: {
        'X-Requested-With': 'XMLHttpRequest',
        'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
@@ -75,14 +75,16 @@
        let tempLocationData = ChinaLocationData;
        regions.forEach((code) => {
            if (!code || !tempLocationData[code]) {
                return;
            }
            if (typeof tempLocationData[code].name === 'string') {
                address += tempLocationData[code].name;
                address.push('');
                tempLocationData = [];
            } else {
                address += tempLocationData[code];
                if (typeof tempLocationData[code].name === 'string') {
                    address += tempLocationData[code].name;
                } else {
                    address += tempLocationData[code];
                }
                tempLocationData = tempLocationData[code].children;
            }
            tempLocationData = tempLocationData[code].children;
        });
        return address;
    },
@@ -98,14 +100,16 @@
        let tempLocationData = ChinaLocationData;
        regions.forEach((code) => {
            if (!code || !tempLocationData[code]) {
                return;
            }
            if (typeof tempLocationData[code].name === 'string') {
                address.push(tempLocationData[code].name);
                address.push('');
                tempLocationData = [];
            } else {
                address.push(tempLocationData[code]);
                if (typeof tempLocationData[code].name === 'string') {
                    address.push(tempLocationData[code].name);
                } else {
                    address.push(tempLocationData[code]);
                }
                tempLocationData = tempLocationData[code].children;
            }
            tempLocationData = tempLocationData[code].children;
        });
        return address;