This commit is contained in:
2021-10-22 22:18:02 +08:00
parent 7e809ed50b
commit d14a5676f3
57 changed files with 13853 additions and 335 deletions

30
src/api/base.ts Normal file
View 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
View 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
}

View 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
View 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
}