diff --git a/src/api/ThirdApi.js b/src/api/ThirdApi.js index 7d7f2c1e..7012164a 100644 --- a/src/api/ThirdApi.js +++ b/src/api/ThirdApi.js @@ -3,4 +3,7 @@ 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 USER_PERMISSION = '/userbasic/permission/listByUser post' \ No newline at end of file +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' diff --git a/src/api/apis.js b/src/api/apis.js index ef3088b2..0bab4d73 100644 --- a/src/api/apis.js +++ b/src/api/apis.js @@ -1 +1,5 @@ -export const STUDENT_LIST = '/admin/student/getStudent' \ No newline at end of file +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' \ No newline at end of file diff --git a/src/api/indexTask.js b/src/api/indexTask.js index 018867b5..832eac37 100644 --- a/src/api/indexTask.js +++ b/src/api/indexTask.js @@ -2,7 +2,8 @@ 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) diff --git a/src/api/request.js b/src/api/request.js index ccd6697c..945daf79 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -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 boeRequest(_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 @@ -110,13 +122,13 @@ 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, + total: 1, + current: 1, + pages: 1, loading: false }) @@ -132,7 +144,52 @@ export function usePage(_url, params, init = true) { init && fetch() } - function reset(){ + function reset() { + state.data = [] + state.loading = false + } + + function fetch() { + state.loading = true + 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 + }) + } + + 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 } @@ -185,26 +242,18 @@ export async function boeRequest(_url, params) { 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) { - url += '?' + paramsArray.join('&') - } else { - url += '&' + paramsArray.join('&') - } - } + url.includes('?') ? (url.endsWith('&') || (url += '&')) : (url += '?') + url += Object.keys(params).map(key => key + '=' + params[key]).join('&') } - const body = method !== 'get' ? params || {} : {} + 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' ? {'Content-Type': 'application/json'} : {} + ...method !== 'get' && s[2] !== 'formData' ? {'Content-Type': 'application/json'} : {} }, - ...method !== 'get' ? {body: JSON.stringify(body)} : {} + ...method !== 'get' ? {body: s[2] === 'formData' ? body : JSON.stringify(body)} : {} }).then(res => { return res.text() }).then(res => { @@ -212,6 +261,12 @@ export async function boeRequest(_url, params) { }) } +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] diff --git a/src/components/drawers/AddActive.vue b/src/components/drawers/AddActive.vue index 3515061c..8b58379a 100644 --- a/src/components/drawers/AddActive.vue +++ b/src/components/drawers/AddActive.vue @@ -1,19 +1,21 @@ - diff --git a/src/components/drawers/AddFaceteach.vue b/src/components/drawers/AddFaceteach.vue index 4af282c4..046e16fc 100644 --- a/src/components/drawers/AddFaceteach.vue +++ b/src/components/drawers/AddFaceteach.vue @@ -1,20 +1,22 @@ - diff --git a/src/components/drawers/AddInvist.vue b/src/components/drawers/AddInvist.vue index 2ffdf49d..404861bd 100644 --- a/src/components/drawers/AddInvist.vue +++ b/src/components/drawers/AddInvist.vue @@ -1,516 +1,265 @@ - diff --git a/src/components/drawers/AddInvistRoot.vue b/src/components/drawers/AddInvistRoot.vue new file mode 100644 index 00000000..4a661757 --- /dev/null +++ b/src/components/drawers/AddInvistRoot.vue @@ -0,0 +1,256 @@ + + + diff --git a/src/components/drawers/AddLive.vue b/src/components/drawers/AddLive.vue index 6b552a3f..a1f5ef83 100644 --- a/src/components/drawers/AddLive.vue +++ b/src/components/drawers/AddLive.vue @@ -1,20 +1,22 @@ - \ No newline at end of file diff --git a/src/components/drawers/SelectTest.vue b/src/components/drawers/SelectTest.vue index c3786ebb..342b0bac 100644 --- a/src/components/drawers/SelectTest.vue +++ b/src/components/drawers/SelectTest.vue @@ -1,18 +1,20 @@ - - - - \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 3db4b19b..bae18429 100644 --- a/vue.config.js +++ b/vue.config.js @@ -24,6 +24,14 @@ module.exports = defineConfig({ target: 'https:' + process.env.VUE_APP_BOE_API_URL, changeOrigin: true, //表示是否改变原域名 }, + "/systemapi": { + target: 'https:' + process.env.VUE_APP_BOE_API_URL, + changeOrigin: true, //表示是否改变原域名 + }, + "/api": { + target: 'https:' + process.env.VUE_APP_BOE_API_URL, + changeOrigin: true, //表示是否改变原域名 + }, }, }, });