Update docs(fronted/res/api/)

feature/wyh
王奕辉 3 days ago
parent 2e802ea203
commit db8aaf463e

@ -1,8 +1,15 @@
// 考试相关的接口,包括考试、问题、选项和评分等接口 /**
* @description: 考试模块接口包括考试问题选项和评分等接口
*/
import api from './index' import api from './index'
import { axios } from '../utils/request' import { axios } from '../utils/request'
/**
* @description: 根据传入的参数获取问题列表
* @param {Object} parameter - 查询参数
* @returns {Promise} - 返回问题列表的Promise对象
*/
export function getQuestionList (parameter) { export function getQuestionList (parameter) {
return axios({ return axios({
url: api.ExamQuestionList, url: api.ExamQuestionList,
@ -11,6 +18,10 @@ export function getQuestionList (parameter) {
}) })
} }
/**
* @description: 获取所有问题
* @returns {Promise} - 返回所有问题的Promise对象
*/
export function getQuestionAll () { export function getQuestionAll () {
return axios({ return axios({
url: api.ExamQuestionAll, url: api.ExamQuestionAll,
@ -18,6 +29,11 @@ export function getQuestionAll () {
}) })
} }
/**
* @description: 更新问题信息
* @param {Object} parameter - 问题更新参数
* @returns {Promise} - 返回更新操作的Promise对象
*/
export function questionUpdate (parameter) { export function questionUpdate (parameter) {
console.log(parameter) console.log(parameter)
return axios({ return axios({
@ -27,6 +43,10 @@ export function questionUpdate (parameter) {
}) })
} }
/**
* @description: 获取问题的选项
* @returns {Promise} - 返回问题选项的Promise对象
*/
export function getQuestionSelection () { export function getQuestionSelection () {
return axios({ return axios({
url: api.ExamQuestionSelection, url: api.ExamQuestionSelection,
@ -37,6 +57,11 @@ export function getQuestionSelection () {
}) })
} }
/**
* @description: 创建新问题
* @param {Object} parameter - 问题创建参数
* @returns {Promise} - 返回创建操作的Promise对象
*/
export function questionCreate (parameter) { export function questionCreate (parameter) {
console.log(parameter) console.log(parameter)
return axios({ return axios({
@ -46,6 +71,11 @@ export function questionCreate (parameter) {
}) })
} }
/**
* @description: 根据传入的参数获取考试列表
* @param {Object} parameter - 查询参数
* @returns {Promise} - 返回考试列表的Promise对象
*/
export function getExamList (parameter) { export function getExamList (parameter) {
return axios({ return axios({
url: api.ExamList, url: api.ExamList,
@ -54,6 +84,10 @@ export function getExamList (parameter) {
}) })
} }
/**
* @description: 获取所有考试
* @returns {Promise} - 返回所有考试的Promise对象
*/
export function getExamAll () { export function getExamAll () {
return axios({ return axios({
url: api.ExamAll, url: api.ExamAll,
@ -61,7 +95,10 @@ export function getExamAll () {
}) })
} }
// 获取所有问题,按照单选、多选和判断进行分类 /**
* @description: 获取所有问题并按单选多选和判断进行分类
* @returns {Promise} - 返回分类问题列表的Promise对象
*/
export function getExamQuestionTypeList () { export function getExamQuestionTypeList () {
return axios({ return axios({
url: api.ExamQuestionTypeList, url: api.ExamQuestionTypeList,
@ -72,6 +109,10 @@ export function getExamQuestionTypeList () {
}) })
} }
/**
* @description: 获取考试卡片列表
* @returns {Promise} - 返回考试卡片列表的Promise对象
*/
export function getExamCardList () { export function getExamCardList () {
return axios({ return axios({
url: api.ExamCardList, url: api.ExamCardList,
@ -82,6 +123,11 @@ export function getExamCardList () {
}) })
} }
/**
* @description: 创建新考试
* @param {Object} parameter - 考试创建参数
* @returns {Promise} - 返回创建操作的Promise对象
*/
export function examCreate (parameter) { export function examCreate (parameter) {
console.log(parameter) console.log(parameter)
return axios({ return axios({
@ -91,6 +137,11 @@ export function examCreate (parameter) {
}) })
} }
/**
* @description: 更新考试信息
* @param {Object} parameter - 考试更新参数
* @returns {Promise} - 返回更新操作的Promise对象
*/
export function examUpdate (parameter) { export function examUpdate (parameter) {
console.log(parameter) console.log(parameter)
return axios({ return axios({
@ -100,6 +151,11 @@ export function examUpdate (parameter) {
}) })
} }
/**
* @description: 根据考试ID获取考试详情
* @param {String} examId - 考试ID
* @returns {Promise} - 返回考试详情的Promise对象
*/
export function getExamDetail (examId) { export function getExamDetail (examId) {
return axios({ return axios({
url: api.ExamDetail + examId, url: api.ExamDetail + examId,
@ -110,6 +166,11 @@ export function getExamDetail (examId) {
}) })
} }
/**
* @description: 根据记录ID获取考试记录详情
* @param {String} recordId - 记录ID
* @returns {Promise} - 返回考试记录详情的Promise对象
*/
export function getExamRecordDetail (recordId) { export function getExamRecordDetail (recordId) {
return axios({ return axios({
url: api.recordDetail + recordId, url: api.recordDetail + recordId,
@ -120,6 +181,11 @@ export function getExamRecordDetail (recordId) {
}) })
} }
/**
* @description: 根据问题ID获取问题详情
* @param {String} questionId - 问题ID
* @returns {Promise} - 返回问题详情的Promise对象
*/
export function getQuestionDetail (questionId) { export function getQuestionDetail (questionId) {
return axios({ return axios({
url: api.QuestionDetail + questionId, url: api.QuestionDetail + questionId,
@ -130,6 +196,12 @@ export function getQuestionDetail (questionId) {
}) })
} }
/**
* @description: 提交考试答案完成考试
* @param {String} examId - 考试ID
* @param {Object} answersMap - 答案映射
* @returns {Promise} - 返回完成考试的Promise对象
*/
export function finishExam (examId, answersMap) { export function finishExam (examId, answersMap) {
console.log(answersMap) console.log(answersMap)
return axios({ return axios({
@ -142,6 +214,10 @@ export function finishExam (examId, answersMap) {
}) })
} }
/**
* @description: 获取所有考试记录
* @returns {Promise} - 返回所有考试记录的Promise对象
*/
export function getExamRecordList () { export function getExamRecordList () {
return axios({ return axios({
url: api.ExamRecordList, url: api.ExamRecordList,

@ -1,38 +1,117 @@
/**
* @description: api接口统一管理
*/
const api = { const api = {
/**
* @description: 用户登录的接口
*/
Login: '/auth/login', Login: '/auth/login',
/**
* @description: 用户注销的接口
*/
Logout: '/auth/logout', Logout: '/auth/logout',
/**
* @description: 重置密码的接口
*/
ForgePassword: '/auth/forge-password', ForgePassword: '/auth/forge-password',
/**
* @description: 用户注册的接口
*/
Register: '/auth/register', Register: '/auth/register',
/**
* @description: 两步验证码的接口
*/
twoStepCode: '/auth/2step-code', twoStepCode: '/auth/2step-code',
/**
* @description: 发送短信的接口
*/
SendSms: '/account/sms', SendSms: '/account/sms',
/**
* @description: 发送短信错误的接口
*/
SendSmsErr: '/account/sms_err', SendSmsErr: '/account/sms_err',
// get my info /**
* @description: 获取用户信息的接口
*/
UserInfo: '/user/info', UserInfo: '/user/info',
// 下面是自己的用户认证的接口 // 下面是自己的用户认证的接口
/**
* @description: 用户注册自定义的接口
*/
UserRegister: '/user/register', UserRegister: '/user/register',
/**
* @description: 用户登录自定义的接口
*/
UserLogin: '/user/login', UserLogin: '/user/login',
// 考试的接口 // 考试的接口
/**
* @description: 获取考试问题列表的接口
*/
ExamQuestionList: '/exam/question/list', ExamQuestionList: '/exam/question/list',
/**
* @description: 获取所有考试问题的接口
*/
ExamQuestionAll: '/exam/question/all', ExamQuestionAll: '/exam/question/all',
/**
* @description: 更新考试问题的接口
*/
ExamQuestionUpdate: '/exam/question/update', ExamQuestionUpdate: '/exam/question/update',
/**
* @description: 选择考试问题的接口
*/
ExamQuestionSelection: '/exam/question/selection', ExamQuestionSelection: '/exam/question/selection',
/**
* @description: 创建考试问题的接口
*/
ExamQuestionCreate: '/exam/question/create', ExamQuestionCreate: '/exam/question/create',
/**
* @description: 获取考试列表的接口
*/
ExamList: '/exam/list', ExamList: '/exam/list',
/**
* @description: 获取所有考试的接口
*/
ExamAll: '/exam/all', ExamAll: '/exam/all',
// 获取问题列表,按照单选、多选和判断进行分类 /**
* @description: 按照单选多选和判断分类获取问题列表的接口
*/
ExamQuestionTypeList: '/exam/question/type/list', ExamQuestionTypeList: '/exam/question/type/list',
/**
* @description: 创建考试的接口
*/
ExamCreate: '/exam/create', ExamCreate: '/exam/create',
/**
* @description: 更新考试的接口
*/
ExamUpdate: '/exam/update', ExamUpdate: '/exam/update',
/**
* @description: 获取考试卡片列表的接口
*/
ExamCardList: '/exam/card/list', ExamCardList: '/exam/card/list',
// 获取考试详情 /**
* @description: 获取考试详情的接口
*/
ExamDetail: '/exam/detail/', ExamDetail: '/exam/detail/',
// 获取考试详情 /**
* @description: 获取问题详情的接口
*/
QuestionDetail: '/exam/question/detail/', QuestionDetail: '/exam/question/detail/',
// 交卷 /**
* @description: 交卷的接口
*/
FinishExam: '/exam/finish/', FinishExam: '/exam/finish/',
/**
* @description: 获取考试记录列表的接口
*/
ExamRecordList: '/exam/record/list', ExamRecordList: '/exam/record/list',
/**
* @description: 获取考试记录详情的接口
*/
recordDetail: '/exam/record/detail/' recordDetail: '/exam/record/detail/'
} }
/**
* @description: 默认导出api对象
*/
export default api export default api

@ -2,12 +2,12 @@ import api from './index'
import { axios } from '../utils/request' import { axios } from '../utils/request'
/** /**
* login func * 用户登录功能
* parameter: { * 参数: {
* username: '', * username: 用户名
* password: '', * password: 密码
* remember_me: true, * remember_me: 是否记住
* captcha: '12345' * captcha: 验证码
* } * }
* @param parameter * @param parameter
* @returns {*} * @returns {*}
@ -21,6 +21,11 @@ export function login (parameter) {
}) })
} }
/**
* 获取短信验证码
* @param parameter
* @returns {*}
*/
export function getSmsCaptcha (parameter) { export function getSmsCaptcha (parameter) {
return axios({ return axios({
url: api.SendSms, url: api.SendSms,
@ -29,6 +34,10 @@ export function getSmsCaptcha (parameter) {
}) })
} }
/**
* 获取用户信息
* @returns {*}
*/
export function getInfo () { export function getInfo () {
return axios({ return axios({
url: api.UserInfo, url: api.UserInfo,
@ -39,6 +48,10 @@ export function getInfo () {
}) })
} }
/**
* 用户登出
* @returns {*}
*/
export function logout () { export function logout () {
return axios({ return axios({
url: api.Logout, url: api.Logout,
@ -50,8 +63,9 @@ export function logout () {
} }
/** /**
* get user 2step code open? * 获取用户两步验证码开启状态
* @param parameter {*} * @param parameter
* @returns {*}
*/ */
export function get2step (parameter) { export function get2step (parameter) {
return axios({ return axios({

@ -3,6 +3,11 @@
import api from './index' import api from './index'
import { axios } from '../utils/request' import { axios } from '../utils/request'
/**
* 用户登录
* @param {Object} parameter - 登录参数
* @returns {Promise} - 返回登录请求的Promise
*/
export function login (parameter) { export function login (parameter) {
return axios({ return axios({
url: api.UserLogin, url: api.UserLogin,
@ -11,6 +16,11 @@ export function login (parameter) {
}) })
} }
/**
* 用户注册
* @param {Object} parameter - 注册参数
* @returns {Promise} - 返回注册请求的Promise
*/
export function register (parameter) { export function register (parameter) {
return axios({ return axios({
url: api.UserRegister, url: api.UserRegister,

Loading…
Cancel
Save