mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 19:06:45 +08:00
fix: 冲突解决
This commit is contained in:
@@ -2,4 +2,9 @@
|
||||
export const USER_LIST = '/userbasic/user/searchList post'
|
||||
export const ORG_LIST = '/userbasic/org/list post'
|
||||
export const ORG_CHILD_LIST = '/userbasic/org/info post'
|
||||
export const AUDIENCE_LIST = '/userbasic/audience/list post'
|
||||
export const AUDIENCE_LIST = '/userbasic/audience/list post'
|
||||
export const USER_PERMISSION = '/userbasic/permission/listByUser post'
|
||||
export const CASE_PAGE = '/systemapi/xboe/m/boe/cases/pagelist post formData'
|
||||
export const EXAM_PAPER_PAGE = '/systemapi/xboe/m/exam/paper/querylist post formData'
|
||||
export const TEST_PAGE = '/api/b1/system/quiz/quiz-list post formData'
|
||||
export const ONLINE_PAGE = '/systemapi/xboe/m/course/manage/pagelist post formData'
|
||||
|
||||
7
src/api/apis.js
Normal file
7
src/api/apis.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export const STUDENT_LIST = '/admin/student/getStudent';
|
||||
export const ONLINE_COURSE_PAGE = '/onlineClasses/queryOnlineList';
|
||||
export const ASSESSMENT_PAGE = '/assessment/queryAssessmentDetailList post';
|
||||
export const PROJECT_AUDIT_PAGE = '/admin/project/auditedlist post';
|
||||
export const ROUTER_DETAIL_MODIFY = '/admin/router/routerInfoTemp post';
|
||||
export const PROJECT_DETAIL_MODIFY = '/admin/project/projectInfoTemp post';
|
||||
export const PROJECT_RELEASE = '/admin/project/realease';
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-11-04 22:45:31
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2023-01-10 17:38:43
|
||||
* @LastEditTime: 2023-02-13 23:09:53
|
||||
* @FilePath: /fe-manage/src/api/index1.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
@@ -65,10 +65,11 @@ export const setConfig = (obj) => http.post("/admin/router/setConfig", obj);
|
||||
//获取学员列表
|
||||
export const getStudent = (obj) => http.post("/admin/router/studentList", obj);
|
||||
//获取路径图详情-包含关卡及任务列表
|
||||
export const getRouterDetail = (routerId) =>
|
||||
export const getRouterDetail = (routerId, useTask) =>
|
||||
http.get("/admin/router/detail", {
|
||||
params: {
|
||||
routerId: routerId,
|
||||
useTask: useTask
|
||||
},
|
||||
});
|
||||
//添加学员
|
||||
@@ -78,7 +79,7 @@ export const delStudent = (obj) =>
|
||||
http.post("/admin/router/deleteStudent", obj);
|
||||
|
||||
// 获取学员路径图进度明细
|
||||
export const stuProgress = (params) => http.get('/admin/router/studentProcess', {params});
|
||||
export const stuProgress = (params) => http.get('/admin/router/studentProcess', { params });
|
||||
// export const stuProgress = (obj) =>http.post("/admin/router/studentProcess", obj);
|
||||
|
||||
//编辑学习路径基本信息
|
||||
@@ -87,7 +88,12 @@ export const editLearnInfo = (obj) => http.post('/admin/router/editInfo', obj)
|
||||
|
||||
//项目基础信息-----------------------------------
|
||||
//项目积分榜单
|
||||
export const scoreRank = (obj) => http.post("/admin/project/scoreRank", obj);
|
||||
// export const scoreRank = (obj) => http.post("/admin/project/scoreRank", obj);
|
||||
export const scoreRank = (params) => http.get('/points/top/list', { params })
|
||||
// 项目进度排行
|
||||
export const completionRank = (params) => http.get('/stu/project/rank_list/completion_list', { params })
|
||||
// 项目学时排行榜
|
||||
export const studytimeRank = (params) => http.get('/stu/project/rank_list/study_time_list', { params })
|
||||
//排行榜
|
||||
export const billboard = (obj) => http.post("/admin/project/billboard", obj);
|
||||
//项目基础信息-----------------------------------
|
||||
@@ -103,7 +109,7 @@ export const billboard = (obj) => http.post("/admin/project/billboard", obj);
|
||||
//公共信息---------------------------------------------------
|
||||
// 获取字典信息
|
||||
export const getDict = (obj) => http.post('/dict/getList', obj)
|
||||
export const getDictTree = (params) => http.get('/dict/getTree', {params})
|
||||
export const getDictTree = (params) => http.get('/dict', { params })
|
||||
//获取组织树一级列表
|
||||
export const getOrgTree = (obj) => http.post('/admin/router/orgList', obj)
|
||||
//根据id获取组织树一级元素下所有子元素
|
||||
@@ -190,4 +196,40 @@ export const getImportStatus = (uuid) => http.get('/admin/student/getImportStatu
|
||||
// 面授课导入学员
|
||||
export const FaceTeachImportStudent = (obj) => http.post('/admin/student/importStudent', obj, { headers: { "Content-Type": "multipart/form-data" } })
|
||||
//成绩录入
|
||||
export const updateStudent = (obj) => http.post('/admin/student/updateStudent', obj)
|
||||
export const updateStudent = (obj) => http.post('/admin/student/homeWorkScoreEntry', obj)
|
||||
|
||||
|
||||
//获取证书列表
|
||||
export const certificate = (obj) => http.get('/admin/certificate/page', { params: obj })
|
||||
//添加证书
|
||||
export const saveupdatecertificate = (obj) => http.post('/admin/certificate/saveOrUpdate', obj)
|
||||
//删除证书
|
||||
export const certificatedel = (obj) => http.get('/admin/certificate/del', { params: obj })
|
||||
//证书详情
|
||||
export const certificatedetail = (obj) => http.get('/admin/certificate/get', { params: obj })
|
||||
//获取阶段列表
|
||||
export const getStageList = (obj) => http.get('/admin/project/getStageList', { params: obj })
|
||||
//获取任务列表
|
||||
export const getTaskList = (obj) => http.get('/admin/project/getTaskList', { params: obj })
|
||||
//查看证书学员列表
|
||||
export const stuCertList = (obj) => http.get('/admin/certificate/stuCertList', { params: obj })
|
||||
//更新学员证书
|
||||
export const cancelOrAuth = (obj) => http.post('/admin/certificate/cancelOrAuth', obj)
|
||||
//获取项目总积分
|
||||
export const allPoints = (obj) => http.get('/points/project/allPoints', { params: obj })
|
||||
export const updateStuCert = (obj) => http.post('/admin/certificate/updateStuCert', obj)
|
||||
|
||||
// 外部考试导入成绩
|
||||
export const ImportExternalExamScore = (obj) => http.post('/admin/external/exam/manage/importExternalExamScore', obj, { headers: { "Content-Type": "multipart/form-data" } })
|
||||
//分组
|
||||
export const changeGroupByStudentId = (obj) => http.post('/admin/student/changeGroupByStudentId', obj)
|
||||
//导入小组
|
||||
export const importGroup = (uuid) => http.post('/admin/studentGroup/importGroup/{pid}', { params: { uuid: uuid } })
|
||||
//添加小组学员
|
||||
export const addGroupMember = (obj) => http.post('/admin/studentGroup/addGroupMember', obj)
|
||||
//获取小组成员
|
||||
export const groupMemberList = (obj) => http.post('/admin/studentGroup/groupMemberList', obj)
|
||||
//删除小组成员
|
||||
export const delGroupStudent = (obj) => http.post('/admin/studentGroup/delStudent', obj)
|
||||
//随机分组
|
||||
export const randomGroup = (obj, projectId) => http.post(`/admin/studentGroup/randomGroup/${projectId}`, obj)
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-12-13 09:24:38
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2023-01-30 10:50:28
|
||||
* @FilePath: /fe-manage/src/api/indexAudit.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import http from "./config";
|
||||
|
||||
//获取待审核面授课列表
|
||||
@@ -22,6 +30,9 @@ export const courseListView = (obj) => http.post('/admin/offcourse/listReview',
|
||||
//获取面授课详情
|
||||
export const courseDetail = (offcourseId) => http.post(`/admin/offcourse/detail?offcourseId=${offcourseId}`)
|
||||
|
||||
// 面授课转审邀请接口
|
||||
export const inviteAudit = (obj) => http.post('/admin/offcourse/inviteAudit', obj)
|
||||
|
||||
//项目审核日志
|
||||
export const auditList = (obj) => http.post('/admin/project/auditList', obj)
|
||||
|
||||
@@ -29,4 +40,10 @@ export const auditList = (obj) => http.post('/admin/project/auditList', obj)
|
||||
export const auditView = (obj) => http.post('/admin/project/auditView', obj)
|
||||
|
||||
//面授课审核
|
||||
export const courseAuditView = (obj) => http.post('/admin/offcourse/auditView', obj)
|
||||
export const courseAuditView = (obj) => http.post('/admin/offcourse/auditView', obj)
|
||||
|
||||
//项目修改记录
|
||||
export const editRecord = (chooseProject) => http.get(`/modifyRecord/page?id=${chooseProject}&type=1&size=2`)
|
||||
|
||||
// 面授课的修改记录
|
||||
export const editCourseRecord = (chooseCourse) => http.get(`/modifyRecord/page?id=${chooseCourse}&type=2&size=100`)
|
||||
|
||||
@@ -31,6 +31,8 @@ export const detailPlan = (obj) =>
|
||||
export const edit = (obj) => http.post("/admin/offcourse/edit", obj);
|
||||
//7新建或编辑面授课开课
|
||||
export const editPlan = (obj) => http.post("/admin/offcourse/editPlan", obj);
|
||||
export const copyCoursePlan = (params) => http.get("/admin/offcourse/copyCoursePlan", {params});
|
||||
export const copyCourse = (params) => http.get("/admin/offcourse/copyCourse", {params});
|
||||
//8课程导出
|
||||
export const exportP = (obj) => http.post("/admin/offcourse/export", obj);
|
||||
//9操作面授课(发布,撤回,删除,审核,停用)
|
||||
|
||||
@@ -22,4 +22,6 @@ export const queryExaminationAloneExtendList = (obj) => http.post('/examination/
|
||||
// 对接三方考试任务保存接口-三方
|
||||
export const examinationTaskSave = (obj) => http.post('/examination/examinationTaskSave', obj);
|
||||
//编辑考试信息
|
||||
export const updateExamination = (obj) => http.post('/examination/updateExamination', obj);
|
||||
export const updateExamination = (obj) => http.post('/examination/updateExamination', obj);
|
||||
//编辑外部考试信息
|
||||
export const updateExternalExam = (obj) => http.post('/external/exam/updateExternalExam', obj);
|
||||
|
||||
@@ -15,12 +15,7 @@ export const deleteLink = (obj) => http.post('/link/deleteLink', { params: obj }
|
||||
})
|
||||
|
||||
//获取外链详细信息接口
|
||||
export const getLink = (obj) => http.post('/link/getOne', obj,{
|
||||
headers: {
|
||||
'token': '123',
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
}
|
||||
})
|
||||
export const getLink = (obj) => http.get('/link/getOne', {params: obj})
|
||||
|
||||
// 更新外链数据
|
||||
export const updateLinks = (obj) => http.post('/link/updateLinks', obj, {
|
||||
|
||||
@@ -4,4 +4,12 @@ import http from "./config";
|
||||
export const getRouterOverview = (routerId) => http.get(`/admin/router/overview?routerId=${routerId}`)
|
||||
|
||||
//新建或编辑路径图
|
||||
export const editRoutered = (obj) => http.post('/admin/router/edit', obj)
|
||||
export const editRoutered = (obj) => http.post('/admin/router/edit', obj)
|
||||
export const editRouterModel = (obj) => http.post('/admin/router/editModel', obj)
|
||||
export const editProjectModel = (obj) => http.post('/admin/project/editModel', obj)
|
||||
|
||||
// 路径图模式修改接口
|
||||
export const editRouteredModel = (obj) => http.post('/admin/router/editModel', obj)
|
||||
|
||||
// 新建或编辑路径图共享文档
|
||||
export const editRouteredDoc = (obj) => http.post('/admin/router/editShareRouter', obj)
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-11-18 14:09:43
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2022-12-05 15:27:36
|
||||
* @LastEditTime: 2023-02-11 18:55:44
|
||||
* @FilePath: /fe-manage/src/api/indexProjStu.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
@@ -42,4 +42,6 @@ export const setScoreRule = (obj) => http.post('/admin/project/setScoreRule', ob
|
||||
export const studentScoreList = (obj) => http.post('/admin/project/studentScoreList', obj)
|
||||
|
||||
//添加项目学员
|
||||
export const addStudent = (obj) => http.post('/admin/project/addStudent', obj)
|
||||
export const addStudent = (obj) => http.post('/admin/project/addStudent', obj)
|
||||
//获取组员名单
|
||||
export const groupMemberList = (obj) => http.post('/admin/studentGroup/groupMemberList', obj)
|
||||
@@ -4,8 +4,7 @@ import http from "./config";
|
||||
* 1
|
||||
*/
|
||||
//获取受众信息
|
||||
export const getAudienceInfoApi = (obj) =>
|
||||
http.post("/admin/orgStruct/getAudienceInfo", obj);
|
||||
// export const getAudienceInfoApi = (obj) => http.post("/admin/orgStruct/getAudienceInfo", obj);
|
||||
//获取员工信息
|
||||
export const getMemberInfoApi = (obj) =>
|
||||
http.post("/admin/orgStruct/getMemberInfo", obj);
|
||||
|
||||
@@ -2,8 +2,12 @@ import http from "./config";
|
||||
|
||||
|
||||
// 获取路径图详情-包含关卡及任务列表
|
||||
export const GetRouterDetail = (routerId,useTask="") => http.get(`/admin/router/detail?routerId=${routerId}&useTask=${useTask}`)
|
||||
export const GetRouterDetail = (routerId="") => http.get(`/admin/router/detail?routerId=${routerId}`)
|
||||
export const GetRouterDraftDetail = (routerId="") => http.get(`/admin/router/detailDraft?routerId=${routerId}`)
|
||||
//
|
||||
export const changeChapterSort = (list) => http.post("/admin/router/changeChapterSort",list)
|
||||
|
||||
export const changeTasklistSort = (list) => http.post("/admin/router/changeTasklistSort",list)
|
||||
// 新建或编辑阶段任务
|
||||
export const ProjectEditTask = (obj) => http.post('/admin/project/editTask',obj)
|
||||
// 新建或编辑关卡任务
|
||||
@@ -12,6 +16,10 @@ export const RouterEditTask = (obj) => http.post('/admin/router/editTask',obj)
|
||||
export const RouterDeleteTask = (obj) => http.post('/admin/router/deleteTask',obj);
|
||||
// 删除项目任务
|
||||
export const ProjectDeleteTask = (obj) => http.delete('/admin/project/deleteTask',obj);
|
||||
// 发布路径下的全部关卡和任务
|
||||
export const releaseRouter = (obj)=> http.get(`/admin/router/release?routerId=${obj}`);
|
||||
|
||||
export const cancelRouterTask = (routerId)=>http.get(`/admin/router/cancelTask?routerId=${routerId}`);
|
||||
// 判断当前在线课是否已经添加到该路径图下
|
||||
export const IsExistence = (obj) => http.post('/admin/router/queryTaskDoesItExist',obj);
|
||||
// 判断当前在线课是否已经添加到该项目下
|
||||
@@ -19,3 +27,5 @@ export const IsExistenceProject = (obj) => http.post('/admin/project/queryTaskDo
|
||||
// 判断当前在线课是否已经添加到该模板库下
|
||||
export const IsExistenceProjectTemplate = (obj) => http.post('/admin/project/template/queryTaskDoesItExistForTemplate',obj);
|
||||
|
||||
// 新建外部考试
|
||||
export const CreateExternalExam = (obj) => http.post('/external/exam/createExternalExam',obj);
|
||||
@@ -31,3 +31,21 @@ export const DownLoadTotalSize = (obj) => http.get('/admin/download/totalSize',
|
||||
|
||||
// 下载中心删除
|
||||
export const RemoveDownLoadHomeWork = (obj) => http.get('/admin/download/del', {params: obj})
|
||||
|
||||
// 获取投票管理的信息
|
||||
export const QueryVoteManagementDetail = (obj) => http.post('/admin/vote/manage/queryVoteManagementDetail', obj)
|
||||
|
||||
// 根据投票任务Id获取投票任务信息
|
||||
export const QueryVoteTaskDetailById = (obj) => http.post('/voteSubmit/queryVoteTaskDetailById', obj)
|
||||
|
||||
// 直播考勤请假
|
||||
export const AttendanceLeave = (obj) => http.post('/stu/task/attendance/leave', obj)
|
||||
|
||||
// 直播考勤签到
|
||||
export const AttendanceSign = (obj) => http.post('/stu/task/attendance/sign', obj)
|
||||
|
||||
// 查询项目管理的信息
|
||||
export const QueryProjectManageDetail = (obj) => http.post('/project/management/queryProjectManageDetail', obj)
|
||||
|
||||
// 获取外部考试信息的接口
|
||||
export const QueryExternalExamManageDetail = (obj) => http.post('/admin/external/exam/manage/queryExternalExamManageDetail', obj)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import http from "./config";
|
||||
//获取任务列表
|
||||
export const getTask = (obj) => http.get('/admin/project/detail', { params: obj })
|
||||
export const getDraftTask = (obj) => http.get('/admin/project/detailDraft', { params: obj })
|
||||
|
||||
//项目里的新建或编辑阶段任务
|
||||
export const addTask = (obj) => http.post('/admin/project/editTask', obj)
|
||||
@@ -13,15 +14,17 @@ export const deleteTask = (obj) => http.delete('/admin/project/deleteTask', { pa
|
||||
|
||||
//新建或编辑项目
|
||||
export const editProj = (obj) => http.post('/admin/project/edit', obj)
|
||||
//编辑项目共享文档
|
||||
export const editProjDoc = (obj) => http.post('/admin/project/editShareAttach', obj)
|
||||
|
||||
//路径图里的新建或编辑关卡任务
|
||||
export const editTask = (obj) => http.post('/admin/router/editTask', obj)
|
||||
|
||||
//项目里获取项目积分规则
|
||||
export const scoreRule = (obj) => http.get('/admin/project/scoreRule', { params: obj })
|
||||
export const scoreRule = (obj) => http.get('/points/project/rule', { params: obj })
|
||||
|
||||
//项目里设置项目积分规则
|
||||
export const setScoreRule = (obj) => http.post('/admin/project/setScoreRule', obj)
|
||||
export const setScoreRule = (obj) => http.post('/points/project/rule/edit', obj)
|
||||
|
||||
//面授课开课列表
|
||||
export const planList = (obj) => http.post('/admin/offcourse/planList', obj)
|
||||
|
||||
@@ -50,10 +50,10 @@ export const baseVoteupload = (obj) =>
|
||||
});
|
||||
//创建题干信息接口
|
||||
export const createStemMessage = (obj) =>
|
||||
http.post("/vote/createOptionMessage", obj);
|
||||
http.post("/vote/createOrUpdateVote", obj);
|
||||
|
||||
//投票信息创建接口
|
||||
export const createVote = (obj) => http.post("/vote/createVote", obj);
|
||||
export const createVote = (obj) => http.post("/vote/createOrUpdateVote", obj);
|
||||
|
||||
//删除投票信息
|
||||
export const deleteVoteMessage = (obj) =>
|
||||
@@ -71,8 +71,8 @@ export const deleteVoteStemOption = (optionId) =>
|
||||
export const editVote = (obj) => http.post("/vote/editVote", obj);
|
||||
|
||||
//根据题干ID获取题干信息
|
||||
export const queryStemByStemId = (ballotId) =>
|
||||
http.post(`/vote/queryStemByStemId?ballotId=${ballotId}`);
|
||||
export const queryStemByStemId = (voteId) =>
|
||||
http.get(`/vote/queryVoteById?voteId=${voteId}`);
|
||||
|
||||
//修改题干信息接口
|
||||
export const updateStemMessage = (obj) =>
|
||||
@@ -83,7 +83,7 @@ export const fileUp = (obj) =>
|
||||
http.post("/file/upload", obj, qs.stringify({ obj }));
|
||||
//根据题干ID获取投票任务
|
||||
export const queryVoteDetailById = (voteID) =>
|
||||
http.post(`/vote/queryVoteDetailById?voteId=${voteID}`);
|
||||
http.get(`/vote/queryVoteById?voteId=${voteID}`);
|
||||
|
||||
// 测试方法
|
||||
// import * as api from '../../api/index'
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-11-17 21:25:14
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2023-01-30 11:32:33
|
||||
* @FilePath: /fe-manage/src/api/indexWork.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import http from "./config";
|
||||
// 创建作业信息接口
|
||||
export const createWorkTask = (obj) =>
|
||||
@@ -13,3 +21,5 @@ export const queryWorkDetailById = (obj) => http.post('/work/queryWorkDetailById
|
||||
// 修改作业信息接口
|
||||
export const updateWorkTaskUsing = (obj) =>
|
||||
http.post("/work/updateWorkTask", obj);
|
||||
//查看作业
|
||||
export const getWorkSubmitInfo = (workId, stuId) => http.get(`/admin/student/getWorkSubmitInfo?id=${workId}&stuId=${stuId}`)
|
||||
@@ -277,12 +277,12 @@ const commonData = {
|
||||
const organizationalTree = []
|
||||
|
||||
//嵌套页面
|
||||
const iframeUrl = process.env.VUE_APP_IFRAME_URL
|
||||
const iframeUrl = window.location.protocol + process.env.VUE_APP_IFRAME_URL
|
||||
//学员端路由
|
||||
const studentUrl = process.env.VUE_APP_IFRAME_STUDENT_URL
|
||||
const studentUrl = window.location.protocol + process.env.VUE_APP_IFRAME_STUDENT_URL
|
||||
|
||||
//二维码
|
||||
const codeUrl = "https://u-pre.boe.com"
|
||||
const codeUrl = window.location.protocol + "//u-pre.boe.com"
|
||||
export {
|
||||
throttle,
|
||||
toDate,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {reactive, ref, toRefs, watch} from "vue";
|
||||
import {isRef, reactive, ref, toRefs, unref, watch, watchEffect} from "vue";
|
||||
import {getCookieForName, throttle} from "@/api/method";
|
||||
import JSONBigInt from 'json-bigint';
|
||||
|
||||
@@ -20,9 +20,21 @@ export function useBoeApiPage(_url, params = {}, config = {
|
||||
total: 0
|
||||
})
|
||||
|
||||
if (isRef(params)) {
|
||||
watch(params.value, () => {
|
||||
fetch()
|
||||
})
|
||||
}
|
||||
|
||||
if (isRef(_url)) {
|
||||
watchEffect(fetch)
|
||||
} else {
|
||||
fetch()
|
||||
}
|
||||
|
||||
function fetch() {
|
||||
state.loading = true
|
||||
return request(_url, params).then(r => {
|
||||
return boeRequest(unref(_url), unref(params)).then(r => {
|
||||
state.data = config.result(r)
|
||||
state.totalPage = config.totalPage(r)
|
||||
state.total = config.total(r)
|
||||
@@ -31,7 +43,7 @@ export function useBoeApiPage(_url, params = {}, config = {
|
||||
})
|
||||
}
|
||||
|
||||
function reset(){
|
||||
function reset() {
|
||||
state.data = []
|
||||
state.loading = false
|
||||
state.page = 1
|
||||
@@ -62,7 +74,7 @@ export function useBoeApi(_url, params = {}, config = {
|
||||
|
||||
function fetch() {
|
||||
state.loading = true
|
||||
return request(_url, params).then(r => {
|
||||
return boeRequest(_url, params).then(r => {
|
||||
state.data = config.result(r)
|
||||
state.loading = false
|
||||
})
|
||||
@@ -95,7 +107,7 @@ export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||
state.loading = false
|
||||
return
|
||||
}
|
||||
return request(_url, params).then(r => {
|
||||
return boeRequest(_url, params).then(r => {
|
||||
state.data = params.page === 1 ? r.result.userInfoList : [...state.data, ...r.result.userInfoList]
|
||||
state.totalPage = r.result.totalPage
|
||||
state.total = r.result.totalElement
|
||||
@@ -110,31 +122,93 @@ export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||
};
|
||||
}
|
||||
|
||||
export function usePage(_url, params = {}, init = true) {
|
||||
export function useRowsPage(_url, params, init = true) {
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
total: 1,
|
||||
current: 1,
|
||||
pages: 1,
|
||||
loading: false
|
||||
})
|
||||
|
||||
watch(params, () => {
|
||||
fetch()
|
||||
})
|
||||
if (isRef(params)) {
|
||||
watch(params.value, () => {
|
||||
fetch()
|
||||
})
|
||||
}
|
||||
|
||||
if (isRef(_url)) {
|
||||
watchEffect(fetch)
|
||||
} else {
|
||||
init && fetch()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
state.data = []
|
||||
state.loading = false
|
||||
}
|
||||
|
||||
function fetch() {
|
||||
state.loading = true
|
||||
return request(_url, params).then(r => {
|
||||
console.log('fetch')
|
||||
console.log(r)
|
||||
state.data = r.result
|
||||
return request(unref(_url), unref(params)).then(r => {
|
||||
state.data = r.data.rows
|
||||
state.current = r.data.current
|
||||
state.pages = r.data.pages
|
||||
state.total = r.data.total
|
||||
state.loading = false
|
||||
})
|
||||
}
|
||||
|
||||
init && fetch()
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
reset,
|
||||
};
|
||||
}
|
||||
|
||||
export function usePage(_url, params, init = true) {
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
total: 1,
|
||||
current: 1,
|
||||
pages: 1,
|
||||
loading: false
|
||||
})
|
||||
|
||||
if (isRef(params)) {
|
||||
watch(params.value, () => {
|
||||
fetch()
|
||||
})
|
||||
}
|
||||
|
||||
if (isRef(_url)) {
|
||||
watchEffect(fetch)
|
||||
} else {
|
||||
init && fetch()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
state.data = []
|
||||
state.loading = false
|
||||
}
|
||||
|
||||
function fetch() {
|
||||
state.loading = true
|
||||
return request(unref(_url), unref(params)).then(r => {
|
||||
state.data = r.data.records
|
||||
state.current = r.data.current
|
||||
state.pages = r.data.pages
|
||||
state.total = r.data.total
|
||||
state.loading = false
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
reset,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -163,13 +237,42 @@ export function useRequest(_url, params = {}, init = true) {
|
||||
};
|
||||
}
|
||||
|
||||
export async function boeRequest(_url, params) {
|
||||
const s = _url.split(' ')
|
||||
let url = s[0]
|
||||
const method = s[1]?.toLowerCase() || 'get'
|
||||
if (method === 'get') {
|
||||
url.includes('?') ? (url.endsWith('&') || (url += '&')) : (url += '?')
|
||||
url += Object.keys(params).map(key => key + '=' + params[key]).join('&')
|
||||
}
|
||||
const body = method !== 'get' ? s[2] === 'formData' ? formatFormData(params) : params : {}
|
||||
url = process.env.NODE_ENV === 'development' ? url : window.location.protocol + process.env.VUE_APP_BOE_API_URL + url
|
||||
return fetch(url, {
|
||||
method,
|
||||
headers: {
|
||||
token: getCookieForName('token'),
|
||||
...method !== 'get' && s[2] !== 'formData' ? {'Content-Type': 'application/json'} : {}
|
||||
},
|
||||
...method !== 'get' ? {body: s[2] === 'formData' ? body : JSON.stringify(body)} : {}
|
||||
}).then(res => {
|
||||
return res.text()
|
||||
}).then(res => {
|
||||
return JSONBigIntStr.parse(res)
|
||||
})
|
||||
}
|
||||
|
||||
function formatFormData(data) {
|
||||
const formData = new FormData();
|
||||
Object.keys(data).forEach(k => formData.append(k, data[k]))
|
||||
return formData
|
||||
}
|
||||
|
||||
export async function request(_url, params) {
|
||||
const s = _url.split(' ')
|
||||
let url = s[0]
|
||||
const method = s[1]?.toLowerCase() || 'get'
|
||||
if (method === 'get') {
|
||||
let paramsArray = [];
|
||||
//拼接参数
|
||||
if (params) {
|
||||
Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key]))
|
||||
if (url.search(/\?/) === -1) {
|
||||
@@ -180,8 +283,7 @@ export async function request(_url, params) {
|
||||
}
|
||||
}
|
||||
const body = method !== 'get' ? params || {} : {}
|
||||
url = process.env.NODE_ENV === 'development' ? url : process.env.VUE_APP_BOE_API_URL + url
|
||||
return fetch(url, {
|
||||
return fetch(process.env.VUE_APP_BASE_API + url, {
|
||||
method,
|
||||
headers: {
|
||||
token: getCookieForName('token'),
|
||||
@@ -193,23 +295,4 @@ export async function request(_url, params) {
|
||||
}).then(res => {
|
||||
return JSONBigIntStr.parse(res)
|
||||
})
|
||||
// return axios({
|
||||
// url,
|
||||
// method,
|
||||
// headers: {
|
||||
// token: getCookie('token'),
|
||||
// ...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
||||
// },
|
||||
// baseURL: '',
|
||||
// ...method !== 'get' ? {data: JSON.stringify(body)} : {}
|
||||
// }).then(resp => {
|
||||
// return resp.data
|
||||
// }).then(response => {
|
||||
// console.log(response)
|
||||
// return response
|
||||
// }).catch(e => {
|
||||
// console.log(2222)
|
||||
// console.log(e)
|
||||
// // router.push({path: '/login'})
|
||||
// })
|
||||
}
|
||||
Reference in New Issue
Block a user