mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
测试接口需要异步
This commit is contained in:
parent
4f1d83cf2e
commit
637286cab7
|
@ -5,12 +5,12 @@ const HOST = 'http://123.57.147.184:3001';
|
|||
|
||||
export const get = (url: any, params: any, success: any) => {
|
||||
axios.get(HOST + url, params)
|
||||
.then(res => {
|
||||
success(res);
|
||||
})
|
||||
.catch(err => {
|
||||
success(err);
|
||||
});;
|
||||
.then(res => {
|
||||
success(res);
|
||||
})
|
||||
.catch(err => {
|
||||
success(err);
|
||||
});
|
||||
};
|
||||
export const post = (url: any, params: any, success: any) => {
|
||||
axios.post(HOST + url, params)
|
||||
|
@ -24,3 +24,9 @@ export const post = (url: any, params: any, success: any) => {
|
|||
export const getMapJson = (name: string) => {
|
||||
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 = () => {
|
||||
const hospitals = []
|
||||
const hospitals = [] as any
|
||||
hospitals.push({ label: '北京朝阳医院', value: '北京朝阳医院' })
|
||||
hospitals.push({ label: '北京朝阳医院1', value: '北京朝阳医院1' })
|
||||
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 = () => {
|
||||
|
|
|
@ -126,7 +126,10 @@ import { getHospitalsData, getPhoneAreasData } from '@/static-data/core'
|
|||
|
||||
const router = useRouter()
|
||||
|
||||
const hospitals: any = getHospitalsData()
|
||||
const hospitals = ref([] as any)
|
||||
getHospitalsData().then((res: any) => {
|
||||
hospitals.value = res
|
||||
})
|
||||
const phoneAreas: any = getPhoneAreasData()
|
||||
|
||||
const loginRules = reactive({
|
||||
|
|
Loading…
Reference in New Issue
Block a user