mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2026-06-12 17:21:46 +08:00
测试接口需要异步
This commit is contained in:
parent
4f1d83cf2e
commit
637286cab7
|
|
@ -10,7 +10,7 @@ export const get = (url: any, params: any, success: any) => {
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
success(err);
|
success(err);
|
||||||
});;
|
});
|
||||||
};
|
};
|
||||||
export const post = (url: any, params: any, success: any) => {
|
export const post = (url: any, params: any, success: any) => {
|
||||||
axios.post(HOST + url, params)
|
axios.post(HOST + url, params)
|
||||||
|
|
@ -24,3 +24,9 @@ export const post = (url: any, params: any, success: any) => {
|
||||||
export const getMapJson = (name: string) => {
|
export const getMapJson = (name: string) => {
|
||||||
return axios.post('/static/json/' + name)
|
return axios.post('/static/json/' + name)
|
||||||
}
|
}
|
||||||
|
export const getData = (url: string, params?: any) => {
|
||||||
|
return axios.get(url, params)
|
||||||
|
}
|
||||||
|
export const postData = (url: string, params?: any) => {
|
||||||
|
return axios.post(url, params)
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
|
import {getData, postData} from '@/axios/index'
|
||||||
|
|
||||||
export const getHospitalsData = () => {
|
export const getHospitalsData = () => {
|
||||||
const hospitals = []
|
const hospitals = [] as any
|
||||||
hospitals.push({ label: '北京朝阳医院', value: '北京朝阳医院' })
|
hospitals.push({ label: '北京朝阳医院', value: '北京朝阳医院' })
|
||||||
hospitals.push({ label: '北京朝阳医院1', value: '北京朝阳医院1' })
|
hospitals.push({ label: '北京朝阳医院1', value: '北京朝阳医院1' })
|
||||||
hospitals.push({ label: '北京朝阳医院2', value: '北京朝阳医院2' })
|
hospitals.push({ label: '北京朝阳医院2', value: '北京朝阳医院2' })
|
||||||
return hospitals
|
return new Promise((resolve, reject) => {
|
||||||
|
getData('/url', {}).then((res: any) => {
|
||||||
|
resolve(hospitals)
|
||||||
|
}).catch((err: any) => {
|
||||||
|
resolve(hospitals)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPhoneAreasData = () => {
|
export const getPhoneAreasData = () => {
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,10 @@ import { getHospitalsData, getPhoneAreasData } from '@/static-data/core'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const hospitals: any = getHospitalsData()
|
const hospitals = ref([] as any)
|
||||||
|
getHospitalsData().then((res: any) => {
|
||||||
|
hospitals.value = res
|
||||||
|
})
|
||||||
const phoneAreas: any = getPhoneAreasData()
|
const phoneAreas: any = getPhoneAreasData()
|
||||||
|
|
||||||
const loginRules = reactive({
|
const loginRules = reactive({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user