mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 05:46:45 +08:00
98 lines
3.4 KiB
JavaScript
98 lines
3.4 KiB
JavaScript
/*
|
||
* @Author: lixg lixg@dongwu-inc.com
|
||
* @Date: 2022-11-04 22:45:31
|
||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||
* @LastEditTime: 2022-11-07 11:12:01
|
||
* @FilePath: /fe-manage/src/api/index1.js
|
||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||
*/
|
||
import http from "./config";
|
||
import qs from 'qs';
|
||
|
||
|
||
/**
|
||
* 接口传参数方式(get)
|
||
* axios.get('/user', {
|
||
* params: {
|
||
* id: 12345,
|
||
* name: user
|
||
* }
|
||
* }).then(res => console.log(res))
|
||
*
|
||
* 接口传参三种方式(post/put/patch)
|
||
*
|
||
* 1.'Content-Type'= 'multipart/form-data',传参格式为 formData。
|
||
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||
* (request的Header:'Content-Type'= 'multipart/form-data')
|
||
* var formData=new FormData();
|
||
* formData.append('user',123456);formData.append('pass',12345678);
|
||
* axios.post("/notice",formData).then()
|
||
*
|
||
* 2.'Content-Type'= 'application/x-www-form-urlencoded',传参格式为 query 形式,使用$qs.stringify。
|
||
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||
* (request的Header:'Content-Type'= 'application/x-www-form-urlencoded')
|
||
* let data = {"code":"1234","name":"yyyy"};
|
||
* axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
|
||
*
|
||
* 3.'Content-Type'= 'application/json,传参格式为 raw (JSON格式)。
|
||
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||
* (request的Header:'Content-Type'= 'application/json;charset=UTF-8')
|
||
* let data = {"code":"1234","name":"yyyy"}
|
||
* axios.post(`${this.$url}/test/testRequest`,data).then()
|
||
*
|
||
*/
|
||
|
||
//上传文件
|
||
export const uploadFile = (obj) => http.post('/test/testRequest', qs.stringify({ obj }));
|
||
|
||
// 接口-请求
|
||
|
||
//创建学习路径
|
||
export const createLearnPath = (obj) => http.post('/admin/router/edit', obj);
|
||
// 获取学习路径图列表
|
||
export const getLearnPath = (obj) => http.post('/admin/router/list', obj);
|
||
//学习路径图的发布、停用、删除
|
||
export const handleLearnPath = (obj) => http.post('/admin/router/handle', obj);
|
||
|
||
//获取关卡
|
||
export const getChapter = (obj) => http.post('/admin/router/detail', { params: obj });
|
||
|
||
//新建或编辑关卡
|
||
export const editChapter = (obj) => http.post('/admin/router/editChapter', obj);
|
||
//获取学员列表
|
||
export const getStudent = (obj) => http.post('/admin/router/studentList', obj);
|
||
//获取路径图详情-包含关卡及任务列表
|
||
export const getRouterDetail = (routerId) => http.get('/admin/router/detail', {
|
||
params: {
|
||
routerId: routerId,
|
||
}
|
||
});
|
||
//添加学员
|
||
export const addStudent = (obj) => http.post('/admin/router/addStudent', obj);
|
||
|
||
|
||
//项目基础信息-----------------------------------
|
||
//学员获取
|
||
export const getProjectStudent=(obj)=>http.post('/admin/project/studentList',obj)
|
||
//项目积分榜单
|
||
export const scoreRank = (obj) => http.post('/admin/project/scoreRank', obj);
|
||
//获取规则
|
||
export const scoreRule=(projectId)=>http.get('/admin/project/scoreRule',{
|
||
params: {
|
||
projectId: projectId,
|
||
}
|
||
})
|
||
//排行榜
|
||
export const billboard = (obj) => http.post('/admin/project/billboard', obj);
|
||
|
||
//项目基础信息-----------------------------------
|
||
|
||
|
||
// 测试方法
|
||
// import * as api from '../../api/index'
|
||
// api.getLearnPath({}).then(res => {
|
||
// console.log(res)
|
||
// }).catch(err => {
|
||
// console.log(err)
|
||
// })
|