mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 19:06:45 +08:00
Merge branch 'user-modify'
# Conflicts: # src/api/ThirdApi.js
This commit is contained in:
@@ -12,6 +12,10 @@ 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";
|
||||
|
||||
export const LOGOUT = "/userbasic/logout post";
|
||||
export const REFRESH_TOKEN_API = "/userbasic/refreshToken";
|
||||
|
||||
export const COURSE_AUDIT = "/xboe/m/course/manage/audit post formData";
|
||||
export const OTHER_AUDIT = "/xboe/m/course/audit/appoint post formData";
|
||||
export const ONLINE_COURSE_DEL = (id, courseId) => `/systemapi/xboe/school/study/course/delete-signup?id=${id}&couserId=${courseId} post`;
|
||||
@@ -26,9 +26,12 @@ export const ASSESSMENT_DETAIL = (assessmentId)=>`/assessment/queryAssessmentDet
|
||||
|
||||
export const USER_LIST_PAGE = "/admin/thirdApi/user/list";
|
||||
//学员列表 没有分页数据 只能通过名称检索 速度较快
|
||||
export const USER_LIST = "/admin/thirdApi/user/searchList";
|
||||
export const USER_LIST = "/admin/thirdApi/user/list";
|
||||
export const ORG_LIST = "/admin/thirdApi/org/list";
|
||||
export const ORG_CHILD_LIST = "/admin/thirdApi/org/info";
|
||||
|
||||
export const AUDIENCE_LIST = "/admin/thirdApi/audience/userAudiences";
|
||||
export const USER_PERMISSION = "/admin/thirdApi/permission/listByUser";
|
||||
export const VALIDATE_TOKEN = "/admin/thirdApi/validateToken";
|
||||
export const REFRESH_TOKEN = "/admin/thirdApi/refreshToken";
|
||||
export const USER_INFO = "/admin/CheckUser/userInfo";
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
import http from "./config";
|
||||
import qs from "qs";
|
||||
import {getCookieForName} from "@/api/method";
|
||||
// import { getCookie } from '../api/method'
|
||||
/**
|
||||
* 接口传参数方式(get)
|
||||
@@ -188,7 +189,7 @@ export const auditStudentBatch = (obj) => http.post('/admin/student/auditStudent
|
||||
// //面授课批量导入成绩
|
||||
export const batchImportScore = (obj) =>
|
||||
http.post('/admin/student/importHomeWork', obj, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") },
|
||||
});
|
||||
//数据导入状态
|
||||
export const getImportStatus = (uuid) => http.get('/admin/student/getImportStatus', { params: { uuid: uuid } })
|
||||
@@ -197,7 +198,7 @@ export const getImportStatus = (uuid) => http.get('/admin/student/getImportStatu
|
||||
// export const exportHomeWork=(obj)=>http.get('admin/student/exportHomeWork',{params:obj})
|
||||
|
||||
// 面授课导入学员
|
||||
export const FaceTeachImportStudent = (obj) => http.post('/admin/student/importStudent', obj, { headers: { "Content-Type": "multipart/form-data" } })
|
||||
export const FaceTeachImportStudent = (obj) => http.post('/admin/student/importStudent', obj, { headers: { "Content-Type": "multipart/form-data" },token:getCookieForName("token") })
|
||||
//成绩录入
|
||||
export const updateStudent = (obj) => http.post('/admin/student/homeWorkScoreEntry', obj)
|
||||
|
||||
@@ -227,7 +228,7 @@ export const createExamination = (obj) => http.post('/examination/createExaminat
|
||||
//催促考试
|
||||
export const batchSendMessage = (obj) => http.post('/admin/taskmanage/batchSendMessage', obj)
|
||||
// 外部考试导入成绩
|
||||
export const ImportExternalExamScore = (obj) => http.post('/admin/external/exam/manage/importExternalExamScore', obj, { headers: { "Content-Type": "multipart/form-data" } })
|
||||
export const ImportExternalExamScore = (obj) => http.post('/admin/external/exam/manage/importExternalExamScore', obj, { headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") } })
|
||||
//分组
|
||||
export const changeGroupByStudentId = (obj) => http.post('/admin/student/changeGroupByStudentId', obj)
|
||||
//导入小组
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import http from "./config";
|
||||
import {getCookieForName} from "@/api/method";
|
||||
// import qs from 'qs';
|
||||
|
||||
/**
|
||||
@@ -42,13 +43,13 @@ export const createEvaluation = (obj) =>
|
||||
//上传组件
|
||||
export const fileUp = (data) =>
|
||||
http.post("/file/upload", data, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") },
|
||||
});
|
||||
|
||||
//上传文件
|
||||
export const baseVoteupload = (data) =>
|
||||
http.post("/vote/baseVoteupload", data, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") },
|
||||
});
|
||||
|
||||
//删除测评信息
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import http from "./config";
|
||||
import qs from "qs";
|
||||
import {getCookieForName} from "@/api/method";
|
||||
|
||||
/**
|
||||
* 接口传参数方式(get)
|
||||
@@ -44,7 +45,7 @@ import qs from "qs";
|
||||
export const baseVoteupload = (obj) =>
|
||||
http.post("/vote/baseVoteupload", obj, {
|
||||
headers: {
|
||||
token: "123",
|
||||
token: getCookieForName("token"),
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import {isRef, reactive, ref, toRefs, unref, watch, watchEffect} from "vue";
|
||||
import {getCookieForName, throttle} from "@/api/method";
|
||||
import {getCookieForName, setCookie, throttle} from "@/api/method";
|
||||
import JSONBigInt from "json-bigint";
|
||||
import router from "@/router";
|
||||
import {message} from "ant-design-vue";
|
||||
import {REFRESH_TOKEN, VALIDATE_TOKEN} from "@/api/apis";
|
||||
import {REFRESH_TOKEN_API} from "@/api/ThirdApi";
|
||||
|
||||
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
||||
|
||||
@@ -79,68 +81,68 @@ export function useBoeApiPage(_url, params = {}, config = {
|
||||
};
|
||||
}
|
||||
|
||||
export function useBoeApi(_url, params = {}, config = {
|
||||
init: true,
|
||||
result: res => res.result,
|
||||
}) {
|
||||
// export function useBoeApi(_url, params = {}, config = {
|
||||
// init: true,
|
||||
// result: res => res.result,
|
||||
// }) {
|
||||
//
|
||||
// const state = reactive({
|
||||
// data: [],
|
||||
// loading: false,
|
||||
// });
|
||||
// watch(() => params, () => {
|
||||
// fetch();
|
||||
// });
|
||||
//
|
||||
// function fetch() {
|
||||
// state.loading = true;
|
||||
// return boeRequest(_url, params).then(r => {
|
||||
// state.data = config.result(r);
|
||||
// state.loading = false;
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// config.init && fetch();
|
||||
// return {
|
||||
// ...toRefs(state),
|
||||
// fetch,
|
||||
// };
|
||||
// }
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
loading: false,
|
||||
});
|
||||
watch(() => params, () => {
|
||||
fetch();
|
||||
});
|
||||
|
||||
function fetch() {
|
||||
state.loading = true;
|
||||
return boeRequest(_url, params).then(r => {
|
||||
state.data = config.result(r);
|
||||
state.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
config.init && fetch();
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
};
|
||||
}
|
||||
|
||||
export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
loading: false,
|
||||
total: 0,
|
||||
totalPage: 0,
|
||||
page: 1,
|
||||
...params
|
||||
});
|
||||
|
||||
watch(() => params.keyword, throttle(fetch, 600));
|
||||
watch(() => params.page, fetch);
|
||||
|
||||
function fetch() {
|
||||
state.loading = true;
|
||||
if (!params.keyword) {
|
||||
state.loading = false;
|
||||
return;
|
||||
}
|
||||
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;
|
||||
state.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
init && fetch();
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
};
|
||||
}
|
||||
// export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||
//
|
||||
// const state = reactive({
|
||||
// data: [],
|
||||
// loading: false,
|
||||
// total: 0,
|
||||
// totalPage: 0,
|
||||
// page: 1,
|
||||
// ...params
|
||||
// });
|
||||
//
|
||||
// watch(() => params.keyword, throttle(fetch, 600));
|
||||
// watch(() => params.page, fetch);
|
||||
//
|
||||
// function fetch() {
|
||||
// state.loading = true;
|
||||
// if (!params.keyword) {
|
||||
// state.loading = false;
|
||||
// return;
|
||||
// }
|
||||
// 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;
|
||||
// state.loading = false;
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// init && fetch();
|
||||
// return {
|
||||
// ...toRefs(state),
|
||||
// fetch,
|
||||
// };
|
||||
// }
|
||||
export function useNewRowsPageNoInit(_url, params) {
|
||||
const state = reactive({
|
||||
data: [],
|
||||
@@ -247,6 +249,57 @@ export function useRowsPage(_url, params, init = true) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页只返回 total 无分页信息
|
||||
* @param _url
|
||||
* @param params
|
||||
* @param init
|
||||
* @param listing
|
||||
*/
|
||||
export function useTotalPage(_url, params, init = true,listing = false) {
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
total: 1,
|
||||
current: 1,
|
||||
pages: 1,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
loading: false
|
||||
});
|
||||
|
||||
if (isRef(params) && listing) {
|
||||
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.list;
|
||||
state.total = r.data.total;
|
||||
state.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
reset,
|
||||
};
|
||||
}
|
||||
export function usePage(_url, params, init = true,listing = false) {
|
||||
|
||||
const state = reactive({
|
||||
@@ -291,6 +344,42 @@ export function usePage(_url, params, init = true,listing = false) {
|
||||
reset,
|
||||
};
|
||||
}
|
||||
export function useThrottlePage(_url, params = {}, init = true) {
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
loading: false,
|
||||
total: 0,
|
||||
totalPage: 0,
|
||||
page: 1,
|
||||
pageNo: 1,
|
||||
...params
|
||||
});
|
||||
|
||||
watch(() => params.keyword, throttle(fetch, 600));
|
||||
watch(() => params.page, fetch);
|
||||
|
||||
function fetch() {
|
||||
state.loading = true;
|
||||
if (!params.keyword) {
|
||||
state.loading = false;
|
||||
return;
|
||||
}
|
||||
return request(_url, params).then(r => {
|
||||
state.data = params.pageNo === 1 ? r.data.list : [...state.data, ...r.data.list];
|
||||
state.totalPage = r.data.total/10 || 1;
|
||||
state.total = r.data.total;
|
||||
state.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
init && fetch();
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export function useRequest(_url, params, init = true) {
|
||||
|
||||
@@ -318,7 +407,32 @@ export function useRequest(_url, params, init = true) {
|
||||
fetchData,
|
||||
};
|
||||
}
|
||||
export function useArrayRequest(_url, params, init = true) {
|
||||
|
||||
const data = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
if (isRef(params)) {
|
||||
watch(params.value, () => {
|
||||
fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
function fetchData() {
|
||||
loading.value = true;
|
||||
request(_url, unref(params)).then(r => {
|
||||
data.value = r.data;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
init && fetchData();
|
||||
return {
|
||||
data,
|
||||
loading,
|
||||
fetchData,
|
||||
};
|
||||
}
|
||||
export async function boeRequest(_url, params = {}) {
|
||||
const s = _url.split(" ");
|
||||
let url = s[0];
|
||||
@@ -380,13 +494,20 @@ export async function request(_url, params) {
|
||||
if (res.code === 0 || res.code === 200) {
|
||||
return res;
|
||||
}
|
||||
if (res.code === 1000) {
|
||||
if (res.code === 1000 || res.code === 1002) {
|
||||
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ?
|
||||
router.push({path: 'login', query: { returnUrl: router.currentRoute.value.fullPath }}) :
|
||||
(window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath))
|
||||
localStorage.removeItem('refreshPage')
|
||||
return Promise.reject(res);
|
||||
}else if(res.code=== 1001){
|
||||
return boeRequest(REFRESH_TOKEN_API).then((res)=>{
|
||||
if(res.code===0 || res.code === 200){
|
||||
return request(_url, params)
|
||||
}
|
||||
})
|
||||
}
|
||||
//刷新token
|
||||
res.show ? message.error(res.msg):message.error('系统接口数据异常,请联系管理员');
|
||||
return Promise.reject(res);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user