yibufen
This commit is contained in:
30
src/api/base.ts
Normal file
30
src/api/base.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import Axios from 'axios'
|
||||
|
||||
const host = "http://192.168.3.159"
|
||||
|
||||
const config = {}
|
||||
export interface res<T> { code: number, msg: string, data: T }
|
||||
export const login = Axios.create({
|
||||
baseURL: host + ":9005",
|
||||
...config
|
||||
})
|
||||
|
||||
export const professionalquery = Axios.create({
|
||||
baseURL: host + ":9001",
|
||||
...config
|
||||
})
|
||||
|
||||
export const schoolquery = Axios.create({
|
||||
baseURL: host + ":9002",
|
||||
...config
|
||||
})
|
||||
|
||||
export const voluntary = Axios.create({
|
||||
baseURL: host + ":9003",
|
||||
...config
|
||||
})
|
||||
|
||||
export const zixun = Axios.create({
|
||||
baseURL: host + ":9007",
|
||||
...config
|
||||
})
|
||||
28
src/api/login.ts
Normal file
28
src/api/login.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { login, res } from "./base";
|
||||
|
||||
interface userLogin { student_id: string, password: string }
|
||||
interface loginres {
|
||||
student: {
|
||||
student_key: number,
|
||||
student_id: string,
|
||||
phone: string,
|
||||
password: string,
|
||||
student_name: string,
|
||||
score: number,
|
||||
ranking: number,
|
||||
subject_one: number,
|
||||
subject_two: number,
|
||||
subject_three: number,
|
||||
is_deleted: number,
|
||||
create_time: string,
|
||||
update_time: string
|
||||
},
|
||||
token: string
|
||||
}
|
||||
export async function userlogin({ student_id, password }: userLogin): Promise<res<loginres>> {
|
||||
const res = await login.post<res<loginres>>("/login",{ student_id, password })
|
||||
return res.data
|
||||
}
|
||||
|
||||
|
||||
|
||||
29
src/api/professionalquery.ts
Normal file
29
src/api/professionalquery.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { professionalquery, res } from "./base";
|
||||
|
||||
interface daLeiList {
|
||||
major_id: string,
|
||||
major_name: string,
|
||||
major_level: number,
|
||||
major_parent: string,
|
||||
major_type: number,
|
||||
major_message: string,
|
||||
is_deleted: number,
|
||||
create_time: string,
|
||||
update_time: string
|
||||
}
|
||||
|
||||
export async function getZhuanYeDaLei({ major_type }: { major_type: number }) {
|
||||
const res = await professionalquery.post<res<daLeiList[]>>("getZhuanyemenleiByMajor_type", { major_type: major_type })
|
||||
return res.data
|
||||
}
|
||||
|
||||
|
||||
export async function getZhuanYeLei({ major_parent }: { major_parent: string }) {
|
||||
const res = await professionalquery.post<res<daLeiList[]>>("getZhuanyelaiByZhuanyedalei", { major_parent: major_parent })
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function getZhuanYeJieShao({ major_parent }: { major_parent: string }) {
|
||||
const res = await professionalquery.post<res<daLeiList[]>>("getZhuanyeByZhuanyelei", { major_parent: major_parent })
|
||||
return res.data
|
||||
}
|
||||
13
src/api/zixun.ts
Normal file
13
src/api/zixun.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { res, zixun } from "./base";
|
||||
|
||||
|
||||
interface zixunlist {
|
||||
"news_id": number,
|
||||
"title": string,
|
||||
"content": string
|
||||
}
|
||||
export async function getzixun():Promise<res<zixunlist[]>> {
|
||||
const res = await zixun.post<res<zixunlist[]>>("/getAllZixun")
|
||||
return res.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user