12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- /*
- *请求获取省市区
- *已提供给地区选择picker组件使用
- */
- import { queryAddressInformation } from '@/services/public.js';
- const provinceData=[];
- const cityData=[];
- const areaData=[];
- // queryAddressInformation().then(res =>{
- // let list = res.data;
- // list.forEach(item => {
- // let xxx = handleCitys(item);
- // provinceData.push(item);
- // cityData.push(xxx.e);
- // areaData.push(xxx.f);
- // })
- // })
- //获取市后继续处理
- function handleCitys(data) {
- const x = [];
- const s = [];
- if (data.cityList.length) {
- data.cityList.forEach(item => {
- let xxx = handleTowns(item);
- s.push(xxx);
- x.push(item)
- })
- }else{
- s.push([{name:''}]);
- x.push([{name:''}]);
- }
- return {
- e: x,
- f: s,
- };
- }
- //获取区后继续处理
- function handleTowns(data) {
- const x = [];
- data.townList.forEach(item => {
- x.push(item)
- })
- return x;
- }
- function handleData3(data) {
- const xxx = [];
- data.forEach(item => {
- const ooo = []
- item.forEach(opt => {
- opt.forEach(z => {
- ooo.push(z);
- })
- })
- xxx.push(ooo)
- })
- return xxx;
- }
- module.exports = {
- provinceData,
- cityData,
- areaData
- }
|