|
@@ -1,5 +1,4 @@
|
|
|
import { request } from '@/services/request/index';
|
|
import { request } from '@/services/request/index';
|
|
|
-import { ref } from 'vue';
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取 config文件下的配置信息
|
|
* 获取 config文件下的配置信息
|
|
|
*/
|
|
*/
|
|
@@ -18,37 +17,3 @@ export const getCommonApiUrl = (apiUrl: string) => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-export interface Addresss {
|
|
|
|
|
- autoid: number
|
|
|
|
|
- divisioncode: string
|
|
|
|
|
- divisionlevel: "city" | "district" | "province"
|
|
|
|
|
- divisionname: string
|
|
|
|
|
- modifierid: number
|
|
|
|
|
- modifytime: string
|
|
|
|
|
- parentcode: string
|
|
|
|
|
- pathname: string
|
|
|
|
|
- postcode: string
|
|
|
|
|
- separablename: string
|
|
|
|
|
- shortcode: string
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-export function getAddress() {
|
|
|
|
|
- const cityList = ref<Addresss[]>([]);
|
|
|
|
|
- const districtList = ref<Addresss[]>([]);
|
|
|
|
|
- const provinceList = ref<Addresss[]>([]);
|
|
|
|
|
- request({ method: 'get', url: './config/address.json' }).then(res => {
|
|
|
|
|
- res.data.forEach((el: Addresss) => {
|
|
|
|
|
- const { divisionlevel } = el;
|
|
|
|
|
- if (divisionlevel === 'city') { // 市
|
|
|
|
|
- cityList.value.push(el)
|
|
|
|
|
- } else if (divisionlevel === 'district') { // 区
|
|
|
|
|
- districtList.value.push(el)
|
|
|
|
|
- } else if (divisionlevel === 'province') { // 省
|
|
|
|
|
- provinceList.value.push(el)
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }).catch((err) => {
|
|
|
|
|
- throw new Error('读取地址失败!');
|
|
|
|
|
- })
|
|
|
|
|
- return { cityList, districtList, provinceList }
|
|
|
|
|
-}
|
|
|