From 82bae4c44120bca0f21dd6ecaf2869467a7cac21 Mon Sep 17 00:00:00 2001 From: MJ Date: Sat, 2 Aug 2025 13:57:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=87=8D=E6=9E=84=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/global.ts | 53 ++--- src/api/inspector/mine.ts | 28 +-- src/api/inspector/student-detail.ts | 80 ++------ src/api/inspector/student.ts | 22 +- src/api/login.ts | 76 +++---- src/api/modules/academicReport.ts | 55 ++--- src/api/modules/applicationManagement.ts | 10 +- src/api/modules/awardManage.ts | 45 ++-- src/api/modules/bindDevice.ts | 58 ++---- src/api/modules/deviceScreenshotRecord.ts | 10 +- src/api/modules/home.ts | 17 +- src/api/modules/inspector.ts | 193 ++++++------------ src/api/modules/inviteBind.ts | 1 - src/api/modules/mine.ts | 52 ++--- src/api/modules/mySupervisionService.ts | 50 ++--- src/api/modules/parent.ts | 15 +- src/api/modules/taskManage.ts | 61 ++---- src/api/modules/warranty.ts | 27 +-- src/api/request.ts | 92 --------- src/api/request/interceptor.ts | 5 +- .../Components/exerciseStatistics.vue | 2 +- .../Components/knowledgeChart.vue | 2 +- .../Components/languageStatistics.vue | 2 +- .../academicReport/Components/studyTime.vue | 76 +++---- .../academicReport/Components/videoTime.vue | 80 ++++---- src/pages/academicReport/index.vue | 8 +- src/pages/applicationManagement/index.vue | 6 +- .../home/DesktopPreview/historyScreenShot.vue | 2 +- src/pages/home/LockScreen/index.vue | 4 +- src/pages/home/TimeManagement/index.vue | 2 +- src/pages/home/bindDevice/applyForBinding.vue | 16 +- .../home/bindDevice/bindChildAccount.vue | 2 +- .../home/bindDevice/familyRelationships.vue | 2 +- src/pages/home/bindDevice/index.vue | 6 +- src/pages/inspector/chat/chatDetails.vue | 106 +++++----- src/pages/inspector/chat/index.vue | 15 +- src/pages/inspector/mine/index.vue | 2 +- src/pages/inspector/mine/min-base-info.vue | 8 +- .../inspector/personalData/certificateAdd.vue | 11 +- src/pages/inspector/personalData/cropper.vue | 47 +++-- src/pages/inspector/personalData/index.vue | 163 ++++++++------- .../releasePlan/components/MultiplePicker.vue | 2 +- src/pages/inspector/releasePlan/index.vue | 77 ++++--- .../inspector/releasePlan/selectBook.vue | 12 +- .../inspector/releasePlan/selectChapter.vue | 112 +++++----- .../inspector/releasePlan/selectPlan.vue | 98 ++++----- src/pages/inspector/schedule/condition.vue | 114 +++++------ src/pages/inspector/schedule/index.vue | 28 +-- .../student-detail/components/data-plan.vue | 2 +- .../components/student-inspector-report.vue | 85 ++++---- .../study-situation-report-content.vue | 2 +- .../components/study-situation-report.vue | 2 +- .../knowledge-atlas.vue | 2 +- .../review-questions-summary.vue | 2 +- .../video-study-summary.vue | 2 +- src/pages/inspector/student-detail/index.vue | 2 +- src/pages/inspector/student/date-view.vue | 2 +- src/pages/inspector/student/student-list.vue | 2 +- src/pages/login/index.vue | 8 +- src/pages/mine/AwardManage/awardItem.vue | 2 +- src/pages/mine/AwardManage/index.vue | 114 +++++------ src/pages/mine/TaskManage/index.vue | 2 +- .../mine/TaskManage/patriarchSendObject.vue | 4 +- src/pages/mine/TaskManage/selectedAward.vue | 2 +- src/pages/mine/TaskManage/taskConfigList.vue | 2 +- src/pages/mine/Warranty/index.vue | 2 +- src/pages/mine/Warranty/serviceHistory.vue | 74 ++++--- src/pages/mine/aboutMine.vue | 14 +- src/pages/mine/details/bindPatriarch.vue | 4 +- src/pages/mine/details/deviceDetails.vue | 2 +- .../components/CourseTable.vue | 186 ++++++++--------- .../mySupervisionService/components/Order.vue | 100 ++++----- .../components/Report.vue | 38 ++-- .../mySupervisionService/studyPlan.vue | 173 +++++++++------- .../parents/supervisionService/buyService.vue | 4 +- src/store/bindApply.ts | 2 +- src/store/global.ts | 4 +- src/store/user.ts | 14 +- 78 files changed, 1193 insertions(+), 1616 deletions(-) delete mode 100644 src/api/request.ts diff --git a/src/api/global.ts b/src/api/global.ts index e0ead3b..08c348b 100644 --- a/src/api/global.ts +++ b/src/api/global.ts @@ -1,56 +1,37 @@ -import $req from './request' +import { http } from './request/request' // 获取用户信息 -export const getUserInfo = () => - $req({ - url: '/sysUser/selectUser', - }) +export const getUserInfo = async () => + await http.get('/sysUser/selectUser') // 获取客服信息 -export const getCsInfo = (id: string) => - $req({ - url: `/customerService/getInfoByUserId/${id}`, - }) +export const getCsInfo = async (id: string) => + await http.get(`/customerService/getInfoByUserId/${id}`) // 更新用户信息 -export const updateUserInfo = (data: any) => - $req({ - url: '/sysUser/editPerfectMessage', - method: 'post', - data, - }) +export const updateUserInfo = async (data: any) => + await http.post('/sysUser/editPerfectMessage', data) // 获取协议 -export const getAgreeInfo = (id: string, isChat = false) => - $req({ - url: '/agreement/' + id, - headers: { +export const getAgreeInfo = async (id: string, isChat = false) => + await http.get('/agreement/' + id, undefined, { + header: { Authorization: '', }, }) // 获取字典 -export const getDict = () => - $req({ - url: '/sysDictType/tree', - }) +export const getDict = async () => + await http.get('/sysDictType/tree') // 设备通知注册 -export const bindRegId = (data: any) => - $req({ - url: '/sysUser/dealRegistrationId', - method: 'post', - data, - }) +export const bindRegId = async (data: any) => + await http.post('/sysUser/dealRegistrationId', data) // 获取未读消息数量 -export const getUnreadNum = () => $req({ url: '/customerService/getUnreadNum' }) +export const getUnreadNum = async () => await http.get('/customerService/getUnreadNum') // 支付创建订单 -export const createInspectorPrepayOrder = (data: any) => { - return $req({ - method: 'post', - url: '/orderManagement/createInspectorPrepayOrder', - data, - }) +export const createInspectorPrepayOrder = async (data: any) => { + return await http.post('/orderManagement/createInspectorPrepayOrder', data) } diff --git a/src/api/inspector/mine.ts b/src/api/inspector/mine.ts index 978c724..4278463 100644 --- a/src/api/inspector/mine.ts +++ b/src/api/inspector/mine.ts @@ -1,36 +1,24 @@ -import $req from '../request'; +import { http } from '../request/request'; /** * 获取督学师信息 * @param data 请求参数 */ -export const getUserInfo = (data = {}) => { - return $req({ - method: 'post', - url: '/phone/inspectorTeacher/myInfo', - data, - }); +export const getUserInfo = async (data = {}): Promise => { + return await http.post('/phone/inspectorTeacher/myInfo', data); }; /** * 查询用户角色 * @param params 请求参数 */ -export const queryUserRoles = (params = {}) => { - return $req({ - method: 'get', - url: '/sysUser/getAdminTypeByPhone', - params, - }); +export const queryUserRoles = async (params = {}): Promise => { + return await http.get('/sysUser/getAdminTypeByPhone', params); }; /** * 切换用户角色 */ -export const switchRole = (adminType: number) => { - return $req({ - method: 'get', - url: '/sysUser/changeAdminType', - params: { - adminType, - }, +export const switchRole = async (adminType: number): Promise => { + return await http.get('/sysUser/changeAdminType', { + adminType, }); }; diff --git a/src/api/inspector/student-detail.ts b/src/api/inspector/student-detail.ts index 5544006..53e192f 100644 --- a/src/api/inspector/student-detail.ts +++ b/src/api/inspector/student-detail.ts @@ -1,111 +1,73 @@ -import $req from '../request'; +import { http } from '../request/request'; /** * 获取学员详情 * @param params 请求参数 */ -export const getStudentDetail = (params = {}) => { - return $req({ - method: 'get', - url: '/phone/inspectorTeacher/getStuVoByOrderIdAndCourseDate', - params, - }); +export const getStudentDetail = async (params = {}): Promise => { + return await http.get('/phone/inspectorTeacher/getStuVoByOrderIdAndCourseDate', params); }; /** * 获取学员督学报告列表 * @param data 请求参数 */ -export const getUserReportPage = (data = {}) => { - return $req({ - method: 'post', - url: '/phone/inspectorTeacher/getUserReportPage', - data, - }); +export const getUserReportPage = async (data = {}): Promise => { + return await http.post('/phone/inspectorTeacher/getUserReportPage', data); }; /** * 获取学员督学报告列表 * @param params 请求参数 */ -export const getUserInspectorCourseReportInfo = (params = {}) => { - return $req({ - method: 'get', - url: '/phone/inspectorTeacher/userInspectorCourseReportInfo', - params, - }); +export const getUserInspectorCourseReportInfo = async (params = {}): Promise => { + return await http.get('/phone/inspectorTeacher/userInspectorCourseReportInfo', params); }; /** * 获取学员学习计划列表 * @param data */ -export const queryStudyPlanList = (data = {}) => { - return $req({ - method: 'post', - url: '/phone/inspectorTeacher/queryStuPlanPage', - data, - }); +export const queryStudyPlanList = async (data = {}): Promise => { + return await http.post('/phone/inspectorTeacher/queryStuPlanPage', data); }; /** * 删除学员学习计划 * @param planId 学习计划id */ -export const deletePlanRequest = (planId: string) => { - return $req({ - method: 'post', - url: `/phone/inspectorTeacher/deletePlanById?planId=${planId}`, - }); +export const deletePlanRequest = async (planId: string): Promise => { + return await http.post(`/phone/inspectorTeacher/deletePlanById?planId=${planId}`); }; /** * 获取学科列表 * @param gradeId 年级id */ -export const getSubjectListByGrade = (gradeId: string) => { - return $req({ - method: 'get', - url: `/subject/list/${gradeId}`, - }); +export const getSubjectListByGrade = async (gradeId: string): Promise => { + return await http.get(`/subject/list/${gradeId}`); }; /** * 获取学员学习时长统计 * @param params */ -export const queryStudyDuration = (params = {}) => { - return $req({ - method: 'get', - url: '/userSubjectReport/study/duration', - params, - }); +export const queryStudyDuration = async (params = {}): Promise => { + return await http.get('/userSubjectReport/study/duration', params); }; /** * 获取学员视频学习统计 * @param params */ -export const queryVideoStudy = (params = {}) => { - return $req({ - method: 'get', - url: '/userSubjectReport/study/video', - params, - }); +export const queryVideoStudy = async (params = {}): Promise => { + return await http.get('/userSubjectReport/study/video', params); }; /** * 获取学员知识点学习统计 * @param params */ -export const queryStudyKnowledge = (params = {}) => { - return $req({ - method: 'get', - url: '/userSubjectReport/study/knowledge', - params, - }); +export const queryStudyKnowledge = async (params = {}): Promise => { + return await http.get('/userSubjectReport/study/knowledge', params); }; /** * 获取学员错题学习统计 * @param params */ -export const queryStudentWrongQuestion = (params = {}) => { - return $req({ - method: 'get', - url: '/userSubjectReport/study/error', - params, - }); +export const queryStudentWrongQuestion = async (params = {}): Promise => { + return await http.get('/userSubjectReport/study/error', params); }; diff --git a/src/api/inspector/student.ts b/src/api/inspector/student.ts index 1c8b241..2d5821c 100644 --- a/src/api/inspector/student.ts +++ b/src/api/inspector/student.ts @@ -1,27 +1,19 @@ -import $req from '../request'; +import { http } from '../request/request'; /** * 获取督学师课表时间 * @param data 请求参数 */ -export const getCourseTable = (data={}) => { - return $req({ - method: 'get', - url: '/phone/inspectorTeacher/getCourseTableById', - data, - }); +export const getCourseTable = async (data = {}): Promise => { + return await http.get('/phone/inspectorTeacher/getCourseTableById', data); }; /** * 查询学生列表 - * @param data + * @param params */ -export const queryStudentList = (params={}) => { - return $req({ - method:'get', - url:'/phone/inspectorTeacher/getMyStudent', - params, - }); -} +export const queryStudentList = async (params = {}): Promise => { + return await http.get('/phone/inspectorTeacher/getMyStudent', params); +}; diff --git a/src/api/login.ts b/src/api/login.ts index dc1800c..4c7adf1 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -1,91 +1,63 @@ -import $req from './request' +import { http } from './request/request' /** * 手机号授权 * @param data 请求参数 */ -export const getBindPhoneTypeApi = data => { - $req({ - method: 'post', - url: '/xcx/login/getBindRelationList', - data, - }) +export const getBindPhoneTypeApi = async data => { + return await http.post('/xcx/login/getBindRelationList', data) } /** * 手机号获取用户身份 * @param data 请求参数 */ -export const getAdminTypeByPhoneApi = (params: any) => - $req({ - method: 'get', - url: '/sysUser/getAdminTypeByPhone', - params, - }) +export const getAdminTypeByPhoneApi = async (params: any) => + await http.get('/sysUser/getAdminTypeByPhone', params) /** * 发送验证码 * @param data 请求参数 */ -export const sendCodeMessageApi = data => - $req({ - method: 'post', - url: `/sms/sendMessage?phoneNumbers=${data}`, - }) +export const sendCodeMessageApi = async data => + await http.post(`/sms/sendMessage?phoneNumbers=${data}`) /** * 手机号验证码登录 * @param data 请求参数 */ -export const smsLoginApi = data => - $req({ - method: 'post', - url: '/smsLogin', - data: { - ...data, - clientType: 'MOBILE', - }, +export const smsLoginApi = async data => + await http.post('/smsLogin', { + ...data, + clientType: 'MOBILE', }) /** * 获取用户信息 * @param data 请求参数 */ -export const getUserInfoApi = () => - $req({ - method: 'get', - url: '/sysUser/selectUser', - }) +export const getUserInfoApi = async () => + await http.get('/sysUser/selectUser') + /** * 更新用户信息 * @param data 请求参数 */ -export const updateUserInfoApi = (data: any) => - $req({ - method: 'post', - url: '/sysUser/updateInfo', - data, - }) +export const updateUserInfoApi = async (data: any) => + await http.post('/sysUser/updateInfo', data) + /** * 授权用户绑定 * @param data 请求参数 */ -export const bindAuthInfoApi = data => - $req({ - method: 'post', - url: '/wechatPublic/bindAuthInfo', - data, - }) +export const bindAuthInfoApi = async data => + await http.post('/wechatPublic/bindAuthInfo', data) + /** * 获取静默授权链接 * @param data 请求参数 */ -export const getAuthUrlApi = () => - $req({ - method: 'get', - url: '/wechatPublic/getAuthUrl', - }) +export const getAuthUrlApi = async () => + await http.get('/wechatPublic/getAuthUrl') // 退出登录 -export const logout = () => - $req({ - url: '/logout', - }) +export const logout = async () => + await http.get('/logout') diff --git a/src/api/modules/academicReport.ts b/src/api/modules/academicReport.ts index 9022db1..bafec2f 100644 --- a/src/api/modules/academicReport.ts +++ b/src/api/modules/academicReport.ts @@ -1,60 +1,43 @@ -import $req from '../request' +import { http } from '../request/request' + /** * 学情报告-学科目录 * @param data 请求参数 */ -export const subjectApi = (gradeId: string) => - $req({ - method: 'get', - url: `/subject/list/${gradeId}`, - }) +export const subjectApi = async (gradeId: string) => + await http.get(`/subject/list/${gradeId}`) + /** * 学情报告-学习时长统计 * @param data 请求参数 */ -export const studyTimeStatApi = (params: any) => - $req({ - method: 'get', - url: '/userSubjectReport/study/duration', - params, - }) +export const studyTimeStatApi = async (params: any) => + await http.get('/userSubjectReport/study/duration', params) + /** * 学情报告-视频学习统计 * @param data 请求参数 */ -export const videoStudyStatApi = (params: any) => - $req({ - method: 'get', - url: '/userSubjectReport/study/video', - params, - }) +export const videoStudyStatApi = async (params: any) => + await http.get('/userSubjectReport/study/video', params) + /** * 学情报告-知识图谱统计 * @param data 请求参数 */ -export const knowledgeStudyStatApi = (params: any) => - $req({ - method: 'get', - url: '/userSubjectReport/study/knowledge', - params, - }) +export const knowledgeStudyStatApi = async (params: any) => + await http.get('/userSubjectReport/study/knowledge', params) + /** * 学情报告-错题本统计 * @param data 请求参数 */ -export const studyErrorStatApi = (params: any) => - $req({ - method: 'get', - url: '/userSubjectReport/study/error', - params, - }) +export const studyErrorStatApi = async (params: any) => + await http.get('/userSubjectReport/study/error', params) + /** * 学情报告-英语语感统计 * @param data 请求参数 */ -export const englishLanguageStatApi = (data: any) => - $req({ - method: 'post', - url: '/userSentenceLearn/queryStatListByTimeType', - data, - }) +export const englishLanguageStatApi = async (data: any) => + await http.post('/userSentenceLearn/queryStatListByTimeType', data) diff --git a/src/api/modules/applicationManagement.ts b/src/api/modules/applicationManagement.ts index ff6c5b2..131cd86 100644 --- a/src/api/modules/applicationManagement.ts +++ b/src/api/modules/applicationManagement.ts @@ -1,10 +1,8 @@ -import $req from '../request'; +import { http } from '../request/request'; + /** * 应用管控 * @param data 请求参数 */ -export const queryAppRecordApi = (serialNum: string) => - $req({ - method: 'get', - url: `/userAppRecord/queryAppRecord/${serialNum}`, - }); +export const queryAppRecordApi = async (serialNum: string) => + await http.get(`/userAppRecord/queryAppRecord/${serialNum}`); diff --git a/src/api/modules/awardManage.ts b/src/api/modules/awardManage.ts index 19abd36..dc45a7f 100644 --- a/src/api/modules/awardManage.ts +++ b/src/api/modules/awardManage.ts @@ -1,49 +1,36 @@ -import $req from '../request'; +import { http } from '../request/request'; + /** * 家长老师-奖励管理 * @param data 请求参数 */ -export const getRewardListApi = params => - $req({ - method: 'get', - url: '/userRewardMapping/list', - params, - }); +export const getRewardListApi = async (params: any) => + await http.get('/userRewardMapping/list', params); + /** * 家长老师-新增奖励 * @param data 请求参数 */ -export const addRewardApi = data => - $req({ - method: 'post', - url: '/userRewardMapping', - data, - }); +export const addRewardApi = async (data: any) => + await http.post('/userRewardMapping', data); + /** * 家长老师-修改奖励 * @param data 请求参数 */ -export const updateRewardApi = data => - $req({ - method: 'put', - url: '/userRewardMapping', - data, - }); +export const updateRewardApi = async (data: any) => + await http.put('/userRewardMapping', data); + /** * 家长老师-删除奖励 * @param data 请求参数 */ -export const deleteRewardApi = ids => - $req({ - method: 'delete', - url: `/userRewardMapping/${ids}`, - }); +export const deleteRewardApi = async (ids: string) => + await http.del(`/userRewardMapping/${ids}`); + /** * 家长老师-奖励详情 * @param data 请求参数 */ -export const getRewardDetailApi = id => - $req({ - method: 'get', - url: `/userRewardMapping/${id}`, - }); +export const getRewardDetailApi = async (id: string) => + await http.get(`/userRewardMapping/${id}`); diff --git a/src/api/modules/bindDevice.ts b/src/api/modules/bindDevice.ts index f1eae34..d977476 100644 --- a/src/api/modules/bindDevice.ts +++ b/src/api/modules/bindDevice.ts @@ -1,78 +1,50 @@ -import $req from '../request'; +import { http } from '../request/request'; /** * 当前登录用户的绑定信息 * @param params 请求参数 */ -export const getCurInfo = params => - $req({ - method: 'get', - url: '/parentBind/curInfo', - params, - }); +export const getCurInfo = async (params: any) => + await http.get('/parentBind/curInfo', params); /** * 家长绑定管理员 * @param data 请求参数 */ -export const parentBindAdmin = data => - $req({ - method: 'post', - url: '/parentBind/admin', - data, - }); +export const parentBindAdmin = async (data: any) => + await http.post('/parentBind/admin', data); /** * 家长申请绑定 * @param data 请求参数 */ -export const parentBindApply = data => - $req({ - method: 'post', - url: '/parentBind/apply', - data, - }); +export const parentBindApply = async (data: any) => + await http.post('/parentBind/apply', data); /** * -设备当前管理员信息 * @param params 请求参数 */ -export const adminInfo = params => - $req({ - method: 'get', - url: '/parentBind/adminInfo', - params, - }); +export const adminInfo = async (params: any) => + await http.get('/parentBind/adminInfo', params); /** * -家长申请绑定信息 * @param params 请求参数 */ -export const applyInfo = params => - $req({ - method: 'get', - url: '/parentBind/apply/info', - params, - }); +export const applyInfo = async (params: any) => + await http.get('/parentBind/apply/info', params); /** * 管理员审批 * @param data 请求参数 */ -export const adminApproval = data => - $req({ - method: 'post', - url: '/parentBind/admin/approval', - data, - }); +export const adminApproval = async (data: any) => + await http.post('/parentBind/admin/approval', data); /** * 时间管控保存 * @param data 请求参数 */ -export const deviceTimeControl = data => - $req({ - method: 'post', - url: '/deviceTimeControl', - data, - }); +export const deviceTimeControl = async (data: any) => + await http.post('/deviceTimeControl', data); diff --git a/src/api/modules/deviceScreenshotRecord.ts b/src/api/modules/deviceScreenshotRecord.ts index 7a662ca..bbec055 100644 --- a/src/api/modules/deviceScreenshotRecord.ts +++ b/src/api/modules/deviceScreenshotRecord.ts @@ -1,12 +1,8 @@ -import $req from '../request'; +import { http } from '../request/request'; /** * 设备截屏记录表-查询列表 * @param params 请求参数 */ -export const deviceScreenshotRecordList = params => - $req({ - method: 'get', - url: '/deviceScreenshotRecord/list', - params, - }); +export const deviceScreenshotRecordList = async (params: any) => + await http.get('/deviceScreenshotRecord/list', params); diff --git a/src/api/modules/home.ts b/src/api/modules/home.ts index 5e19d03..9ab03aa 100644 --- a/src/api/modules/home.ts +++ b/src/api/modules/home.ts @@ -1,22 +1,17 @@ -import $req from '../request'; +import { http } from '../request/request'; /** * 设备屏幕查询 * 查询 * @param params 请求参数 */ -export const getDeviceScreenControlApi = (simSerialNumber: string) => - $req({ - method: 'get', - url: `/deviceTimeControl/${simSerialNumber}`, - }); +export const getDeviceScreenControlApi = async (simSerialNumber: string) => + await http.get(`/deviceTimeControl/${simSerialNumber}`); + /** * 一键解锁屏 * 解锁屏 * @param params 请求参数 */ -export const lockDeviceScreenApi = (simSerialNumber: string) => - $req({ - method: 'post', - url: `/deviceTimeControl/update/lock/${simSerialNumber}`, - }); +export const lockDeviceScreenApi = async (simSerialNumber: string) => + await http.post(`/deviceTimeControl/update/lock/${simSerialNumber}`); diff --git a/src/api/modules/inspector.ts b/src/api/modules/inspector.ts index c53c7a2..5b2b30d 100644 --- a/src/api/modules/inspector.ts +++ b/src/api/modules/inspector.ts @@ -1,101 +1,67 @@ -import $req from '../request' +import { http } from '../request/request' import { storeToRefs } from 'pinia' import { user } from '@/store' import { getCache } from '@/utils' import db from '@/utils/db' + // 课表日历 -export const getScheduleList = (data?: Record): Promise => - $req({ - method: 'get', - url: '/phone/inspectorTeacher/getCourseTableById', - data, - }) +export const getScheduleList = async (data?: Record): Promise => + await http.get('/phone/inspectorTeacher/getCourseTableById', data) // 查询指定日期学生数据 -export const getCourseDate = (data?: Record): Promise => - $req({ - method: 'get', - url: - `/phone/inspectorTeacher/getCourseTabletStudentVoByTime` + +export const getCourseDate = async (data?: Record): Promise => + await http.get( + `/phone/inspectorTeacher/getCourseTabletStudentVoByTime` + `${data.date ? `?courseDate=${data.date}` : ''}`, - // data, - }) + ) // 开始督学 -export const startInpector = (data?: Record): Promise => - $req({ - method: 'post', - url: `/phone/inspectorTeacher/startInspector?courseDate=${data.courseDate}`, - }) +export const startInpector = async (data?: Record): Promise => + await http.post(`/phone/inspectorTeacher/startInspector?courseDate=${data.courseDate}`) // 结束督学 -export const endInpector = (data?: Record): Promise => - $req({ - method: 'post', - url: `/phone/inspectorTeacher/endInspector?courseDate=${data.courseDate}`, - }) +export const endInpector = async (data?: Record): Promise => + await http.post(`/phone/inspectorTeacher/endInspector?courseDate=${data.courseDate}`) // 督学实况 -export const condition = (data?: Record): Promise => - $req({ - method: 'post', - url: `/phone/inspectorTeacher/inspector_real?courseDate=${data.courseDate}`, - }) +export const condition = async (data?: Record): Promise => + await http.post(`/phone/inspectorTeacher/inspector_real?courseDate=${data.courseDate}`) // 获取学员课表日历 -export const getCourseData = (data?: Record): Promise => - $req({ - method: 'get', - url: `/phone/inspectorTeacher/getStuCourseTable?userId=${data.id}`, - // data, - }) +export const getCourseData = async (data?: Record): Promise => + await http.get(`/phone/inspectorTeacher/getStuCourseTable?userId=${data.id}`) // 获取学科 -export const getSubject = (data?: Record): Promise => - $req({ - method: 'get', - url: `/subject/list/${data.gradeId}`, - }) +export const getSubject = async (data?: Record): Promise => + await http.get(`/subject/list/${data.gradeId}`) + // 获取学科教材 -export const getBooks = (data?: Record): Promise => - $req({ - method: 'get', - url: `/userTextBook/list?gradeId=${data.gradeId}&subjectId=${data.subjectId}&userId=${data.userId}¤t=${data.current}`, - }) +export const getBooks = async (data?: Record): Promise => + await http.get( + `/userTextBook/list?gradeId=${data.gradeId}&subjectId=${data.subjectId}&userId=${data.userId}¤t=${data.current}`, + ) // 获取教材章节 -export const getChaper = (data?: Record): Promise => - $req({ - method: 'get', - url: `/subjectChapter/tree?textBookId=${data.textBookId}`, - }) +export const getChaper = async (data?: Record): Promise => + await http.get(`/subjectChapter/tree?textBookId=${data.textBookId}`) + // 获取教材章节知识点 -export const getKnowledge = (data?: Record): Promise => - $req({ - method: 'get', - url: `/subjectKnowledge/tree?chapterId=${data.chapterId}`, - }) +export const getKnowledge = async (data?: Record): Promise => + await http.get(`/subjectKnowledge/tree?chapterId=${data.chapterId}`) // 发布计划 -export const publishPlan = (data?: Record): Promise => - $req({ - method: 'post', - url: `/phone/inspectorTeacher/publishPlan`, - data, - }) +export const publishPlan = async (data?: Record): Promise => + await http.post('/phone/inspectorTeacher/publishPlan', data) + // 获取学员计划 -export const getStuPlan = (data?: Record): Promise => - $req({ - method: 'get', - url: `/phone/inspectorTeacher/getStuPlanByDate?userId=${data.userId}&courseDate=${data.courseDate}`, - }) +export const getStuPlan = async (data?: Record): Promise => + await http.get( + `/phone/inspectorTeacher/getStuPlanByDate?userId=${data.userId}&courseDate=${data.courseDate}`, + ) // 获取督学师信息 -export const getUserInfo = (data?: Record): Promise => - $req({ - method: 'get', - url: `/phone/inspectorTeacher/getCurrentTeacher`, - }) +export const getUserInfo = async (data?: Record): Promise => + await http.get('/phone/inspectorTeacher/getCurrentTeacher') // 文件上传 export const uploadFile = async (file): Promise => { const { token } = storeToRefs(user()) @@ -115,84 +81,51 @@ export const uploadFile = async (file): Promise => { } // 完善督学师资料 /phone/inspectorTeacher/updateTeacherInfo -export const updateTeacherInfo = (data?: Record): Promise => - $req({ - method: 'post', - url: `/phone/inspectorTeacher/updateTeacherInfo`, - data, - }) +export const updateTeacherInfo = async (data?: Record): Promise => + await http.post('/phone/inspectorTeacher/updateTeacherInfo', data) // 沟通列表 -export const getTalkList = (data?: Record): Promise => - $req({ - method: 'get', - url: `/phone/inspectorTeacher/inspectorTalkListPage?current=${data.current}`, - }) +export const getTalkList = async (data?: Record): Promise => + await http.get(`/phone/inspectorTeacher/inspectorTalkListPage?current=${data.current}`) // 沟通详情 -export const getTalkDetails = (data?: Record): Promise => { +export const getTalkDetails = async (data?: Record): Promise => { const param = data.inspectorTalkRecordId ? `?inspectorTalkRecordId=${data.inspectorTalkRecordId}&userId=${data.userId}` : `?userId=${data.userId}` - return $req({ - method: 'get', - url: `/phone/inspectorTeacher/studentInspectorTalkPage${param}`, - }) + return await http.get(`/phone/inspectorTeacher/studentInspectorTalkPage${param}`) } // 消息存储 -export const saveTalk = (data?: Record): Promise => - $req({ - method: 'post', - url: `/inspectorStudent/sendInspectorTalkRecord`, - data, - }) +export const saveTalk = async (data?: Record): Promise => + await http.post('/inspectorStudent/sendInspectorTalkRecord', data) // 验证码校验 -export const validCode = (data?: Record): Promise => - $req({ - method: 'post', - url: `/sms/validateMessage?phoneNumbers=${data.phone}&code=${data.code}`, - data, - }) +export const validCode = async (data?: Record): Promise => + await http.post(`/sms/validateMessage?phoneNumbers=${data.phone}&code=${data.code}`, data) + // 获取我的未读信息 -export const getUnreadCount = (data?: Record): Promise => - $req({ - method: 'get', - url: `/phone/inspectorTeacher/myUnreadCount`, - }) +export const getUnreadCount = async (data?: Record): Promise => + await http.get('/phone/inspectorTeacher/myUnreadCount') // 消息标记为已读 -export const readMsg = (data?: Record): Promise => - $req({ - method: 'post', - url: `/inspectorStudent/readTalkRecord`, - data, - }) +export const readMsg = async (data?: Record): Promise => + await http.post('/inspectorStudent/readTalkRecord', data) // 督学师是否已完善资料 -export const needPerfectInfo = (data?: Record): Promise => - $req({ - method: 'get', - url: `/phone/inspectorTeacher/is_perfect`, - }) +export const needPerfectInfo = async (data?: Record): Promise => + await http.get('/phone/inspectorTeacher/is_perfect') + // 学生是否可以进行精准学判断 -export const getPrecisionFlag = (data?: Record): Promise => - $req({ - method: 'get', - url: `/userTrainTitle/airPrecisionFlag?subjectId=${data.subjectId}&userId=${data.userId}`, - }) +export const getPrecisionFlag = async (data?: Record): Promise => + await http.get( + `/userTrainTitle/airPrecisionFlag?subjectId=${data.subjectId}&userId=${data.userId}`, + ) -export const getKnowledgeFlag = (knowledgeId: string): Promise => { - return $req({ - method: 'get', - url: `/subjectKnowledge/titleFlag?id=${knowledgeId}`, - }) +export const getKnowledgeFlag = async (knowledgeId: string): Promise => { + return await http.get(`/subjectKnowledge/titleFlag?id=${knowledgeId}`) } -export const getKnowledgeVideo = (chapterId: string | number): Promise => { - return $req({ - method: 'get', - url: `/subjectChapterVideo/list?chapterId=${chapterId}`, - }) +export const getKnowledgeVideo = async (chapterId: string | number): Promise => { + return await http.get(`/subjectChapterVideo/list?chapterId=${chapterId}`) } diff --git a/src/api/modules/inviteBind.ts b/src/api/modules/inviteBind.ts index c29fc56..4893a94 100644 --- a/src/api/modules/inviteBind.ts +++ b/src/api/modules/inviteBind.ts @@ -1,4 +1,3 @@ -import $req from '../request' import { http } from '../request/request' /** * 获取邀请配置 diff --git a/src/api/modules/mine.ts b/src/api/modules/mine.ts index e8eb65b..8c99e7a 100644 --- a/src/api/modules/mine.ts +++ b/src/api/modules/mine.ts @@ -1,51 +1,40 @@ -import $req from '../request' import { http } from '../request/request' /** * 家长绑定的孩子 * @param params 请求参数 */ -export const getParentBindChildApi = (params: any) => - $req({ - method: 'get', - url: '/parentBindChild/list', - params, - }) +export const getParentBindChildApi = async (params: any) => + await http.get('/parentBindChild/list', params) + /** * 家长绑定的设备 * @param params 请求参数 */ export const getParentBindDeviceApi = async (params: any) => await http.get('/parentBindDevice/list', params) + /** * 我的孩子-绑定的家长 * @param params 请求参数 */ -export const parentBindChildApi = (id: string) => - $req({ - method: 'get', - url: `/parentBindChild/${id}`, - }) +export const parentBindChildApi = async (id: string) => + await http.get(`/parentBindChild/${id}`) + /** * 我的孩子-解除绑定家长 * @param params 请求参数 */ -export const childUnBoundParentApi = (data: any) => - $req({ - method: 'post', - url: '/parentBindChild/unBound', - data, - }) +export const childUnBoundParentApi = async (data: any) => + await http.post('/parentBindChild/unBound', data) + /** * 我的设备-解除绑定 * @param params 请求参数 */ -export const parentUnBoundDeviceApi = (data: any) => - $req({ - method: 'post', - url: '/parentBindDevice/unBound', - data, - }) +export const parentUnBoundDeviceApi = async (data: any) => + await http.post('/parentBindDevice/unBound', data) + /** * 我的设备-当前登录 * @param params 请求参数 @@ -57,17 +46,12 @@ export const parentDeviceCurrentLoginApi = async (id: string) => * 设备管理-绑定申请列表 * @param params 请求参数 */ -export const applyBindInfoListApi = () => - $req({ - method: 'get', - url: '/parentBind/applyInfoList', - }) +export const applyBindInfoListApi = async () => + await http.get('/parentBind/applyInfoList') + /** * 设备管理-当前登录用户是否管理员 * @param params 请求参数 */ -export const userInfoPermitApi = () => - $req({ - method: 'get', - url: '/parentBind/applyInfoPermit', - }) +export const userInfoPermitApi = async () => + await http.get('/parentBind/applyInfoPermit') diff --git a/src/api/modules/mySupervisionService.ts b/src/api/modules/mySupervisionService.ts index 5d339f5..09af07e 100644 --- a/src/api/modules/mySupervisionService.ts +++ b/src/api/modules/mySupervisionService.ts @@ -1,54 +1,30 @@ -import $req from '../request'; +import { http } from '../request/request'; - -export const getInspectorCourseList = (params: {userId: string | number}) => { - return $req({ - method: 'get', - url: '/inspectorParent/userInspectorCourseList', - params - }); +export const getInspectorCourseList = async (params: {userId: string | number}) => { + return await http.get('/inspectorParent/userInspectorCourseList', params); } -export const getInspectorModeList = () => { - return $req({ - method: 'get', - url: '/inspectorParent/inspectorModeList', - }); +export const getInspectorModeList = async () => { + return await http.get('/inspectorParent/inspectorModeList'); } // 最近或最后一次课时督学师和同学信息 -export const getInspectorTeacherStudentInfo = (params: {orderId: string}) => { - return $req({ - method: 'get', - url: '/inspectorParent/inspectorTeacherStudentInfo', - params - }); +export const getInspectorTeacherStudentInfo = async (params: {orderId: string}) => { + return await http.get('/inspectorParent/inspectorTeacherStudentInfo', params); } // 督学订单列表 -export const getInspectorOrderList = (params: {userId: string | number}) => { - return $req({ - method: 'get', - url: '/inspectorParent/userInspectorOrderList', - params - }); +export const getInspectorOrderList = async (params: {userId: string | number}) => { + return await http.get('/inspectorParent/userInspectorOrderList', params); } // 查询督学计划 -export const getInspectorPlan = (params: {inspectorPlanId: string}) => { - return $req({ - method: 'get', - url: '/inspectorParent/inspectorPlanInfo', - params - }); +export const getInspectorPlan = async (params: {inspectorPlanId: string}) => { + return await http.get('/inspectorParent/inspectorPlanInfo', params); } // 督学计划报告 -export const getInspectorPlanReport = (params: {userId: string}) => { - return $req({ - method: 'get', - url: '/inspectorParent/userInspectorCourseReportList', - params - }); +export const getInspectorPlanReport = async (params: {userId: string}) => { + return await http.get('/inspectorParent/userInspectorCourseReportList', params); } diff --git a/src/api/modules/parent.ts b/src/api/modules/parent.ts index 2644a21..22efd5c 100644 --- a/src/api/modules/parent.ts +++ b/src/api/modules/parent.ts @@ -1,12 +1,9 @@ -import $req from '../request'; +import { http } from '../request/request'; -export const getChildList = () => { - return $req({ - url: '/inspectorParent/childList', - }); +export const getChildList = async () => { + return await http.get('/inspectorParent/childList'); }; -export const getModelList = () => { - return $req({ - url: '/inspectorParent/inspectorModeList', - }); + +export const getModelList = async () => { + return await http.get('/inspectorParent/inspectorModeList'); }; diff --git a/src/api/modules/taskManage.ts b/src/api/modules/taskManage.ts index 7674396..d50f240 100644 --- a/src/api/modules/taskManage.ts +++ b/src/api/modules/taskManage.ts @@ -1,72 +1,47 @@ -import $req from '../request'; -/** +import { http } from '../request/request' + /** * 任务管理-列表 * @param data 请求参数 */ -export const getTaskListApi = params => - $req({ - method: 'get', - url: '/scTask/list', - params, - }); +export const getTaskListApi = async (params: any) => await http.get('/scTask/list', params) + /** * 任务管理-新增 * @param data 请求参数 */ -export const addTaskApi = data => - $req({ - method: 'post', - url: '/scTask', - data, - }); +export const addTaskApi = async (data: any) => await http.post('/scTask', data) + /** * 教师端-查询学生任务情况 * @param data 请求参数 */ -export const getFamilyTaskStuApi = params => - $req({ - method: 'get', - url: '/scTask/getFamilyTaskStuList', - params, - }); +export const getFamilyTaskStuApi = async (params: any) => + await http.get('/scTask/getFamilyTaskStuList', params) /** * 选择任务-列表 * @param data 请求参数 */ -export const taskConfigListApi = params => - $req({ - method: 'get', - url: '/scTaskConfig/list', - params, - }); +export const taskConfigListApi = async (params?: any) => + await http.get('/scTaskConfig/list', params) + /** * 选择任务-新增 * @param data 请求参数 */ -export const addTaskConfigApi = data => - $req({ - method: 'post', - url: '/scTaskConfig', - data, - }); +export const addTaskConfigApi = async (data: any) => await http.post('/scTaskConfig', data) + /** * 选择任务-删除 * @param data 请求参数 */ -export const deleteTaskConfigApi = ids => - $req({ - method: 'delete', - url: `/scTaskConfig/${ids}`, - }); +export const deleteTaskConfigApi = async (ids: string) => + await http.del(`/scTaskConfig/${ids}`) + /** * 选择任务-更新 * @param data 请求参数 */ -export const updateTaskStatusApi = data => - $req({ - method: 'post', - url: '/scTask/updateTaskStatus', - data, - }); +export const updateTaskStatusApi = async (data: any) => + await http.post('/scTask/updateTaskStatus', data) diff --git a/src/api/modules/warranty.ts b/src/api/modules/warranty.ts index 9fad929..3716415 100644 --- a/src/api/modules/warranty.ts +++ b/src/api/modules/warranty.ts @@ -1,31 +1,22 @@ -import $req from '../request' +import { http } from '../request/request' /** * 家长端-电子保修卡信息 * @param data 请求参数 */ -export const getWarrantyCardMsgApi = () => - $req({ - method: 'get', - url: '/parentBind/getBindDeviceList', - }) +export const getWarrantyCardMsgApi = async () => + await http.get('/parentBind/getBindDeviceList') + /** * 家长端-申请售后 * @param data 请求参数 */ -export const applyServiceApi = (data: any) => - $req({ - method: 'post', - url: '/deviceWarrantyRecord', - data, - }) +export const applyServiceApi = async (data: any) => + await http.post('/deviceWarrantyRecord', data) + /** * 家长端-查询售后历史 * @param data 请求参数 */ -export const getServiceHistoryApi = (params: any) => - $req({ - method: 'get', - url: '/deviceWarrantyRecord/list', - params, - }) +export const getServiceHistoryApi = async (params: any) => + await http.get('/deviceWarrantyRecord/list', params) diff --git a/src/api/request.ts b/src/api/request.ts deleted file mode 100644 index 6528531..0000000 --- a/src/api/request.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { user } from '@/store' -import { storeToRefs } from 'pinia' -import { getCache } from '@/utils' -import router from '@/router/router' -import db from '@/utils/db' - -const CONFIG = { - baseURL: `${import.meta.env.VITE_HOST}/api/main`, - // baseURL: '/api/main', - timeout: 60000, - method: 'GET', -} - -export class HttpError extends Error { - data: any - constructor(message: string, data: Record) { - super(message) - this.data = data - } -} - -const request = async (config: Record): Promise => { - const networkType = await uni.getNetworkType() - if (networkType.networkType === 'none') { - uni.showModal({ - content: '暂无网络,请恢复网络后使用', - confirmText: '知道了', - showCancel: false, - confirmColor: '#ffe60f', - }) - return Promise.reject( - new HttpError('暂无网络,请恢复网络后使用', { - code: '-1', - }), - ) - } - - return new Promise((resolve, reject) => { - const { clear } = user() - const { token } = storeToRefs(user()) - const mergerToken = token.value || db.get('token') - const method = (config.method || CONFIG.method).toUpperCase() - - uni.request({ - method, - // url: (config.host || CONFIG.host) + (config.baseURL || CONFIG.baseURL) + config.url, - url: (config.baseURL || CONFIG.baseURL) + config.url, - data: method === 'GET' ? config.params : config.data, - timeout: config.timeout || CONFIG.timeout, - header: { - Authorization: mergerToken ? `Bearer ${mergerToken}` : '', - ...config.headers, - }, - complete(res: any) { - if (res.statusCode === 200) { - if (res.data.code === 200) { - return resolve(res.data) - } else { - if (!config.showToast) { - uni.showToast({ - title: res.data?.message, - icon: 'none', - duration: 3000, - }) - } - return reject(new HttpError(res.data?.message, res.data)) - } - } else { - res.href = (config.baseURL || CONFIG.baseURL) + config.url - if (res.statusCode === 401) { - clear() - router.reLaunch('/pages/login/index') - } else { - uni.showToast({ - icon: 'none', - title: - res.statusCode === 500 ? '服务异常' : res?.data?.message || '服务异常,请稍后重试', - }) - } - return reject( - new HttpError(res.data?.message, { - code: res.statusCode, - data: res.data, - }), - ) - } - }, - }) - }) -} - -export default request diff --git a/src/api/request/interceptor.ts b/src/api/request/interceptor.ts index 324a0b1..0221477 100644 --- a/src/api/request/interceptor.ts +++ b/src/api/request/interceptor.ts @@ -1,4 +1,5 @@ -import { type RequestOptions, type ResponseData, type ErrorResponse } from './types' +/* eslint-disable prefer-promise-reject-errors */ +import type { RequestOptions, ResponseData, ErrorResponse } from './types' import { HTTP_STATUS, ERROR_MSG } from './config' import router from '@/router/router' import db from '@/utils/db' @@ -33,7 +34,7 @@ export const responseInterceptor = async ( // 处理成功响应 if (statusCode === HTTP_STATUS.SUCCESS) { - if (data.code === 200) return response + if (data.statusCode === 200 || data.code === 200) return response throw { statusCode, errMsg: data.data, diff --git a/src/pages/academicReport/Components/exerciseStatistics.vue b/src/pages/academicReport/Components/exerciseStatistics.vue index 544d8c4..af4b81a 100644 --- a/src/pages/academicReport/Components/exerciseStatistics.vue +++ b/src/pages/academicReport/Components/exerciseStatistics.vue @@ -207,7 +207,7 @@ async function fetchChartData() { empty.value = false; try { loading.value = true; - const { data } = await studyErrorStatApi({ + const data = await studyErrorStatApi({ dateType: dateType.value, subjectId: props.subjectId, userId: props.userId, diff --git a/src/pages/academicReport/Components/knowledgeChart.vue b/src/pages/academicReport/Components/knowledgeChart.vue index c37c0e0..1b425cd 100644 --- a/src/pages/academicReport/Components/knowledgeChart.vue +++ b/src/pages/academicReport/Components/knowledgeChart.vue @@ -106,7 +106,7 @@ async function fetchChartData() { empty.value = false; try { loading.value = true; - const { data } = await knowledgeStudyStatApi({ + const data = await knowledgeStudyStatApi({ dateType: dateType.value, subjectId: props.subjectId, userId: props.userId, diff --git a/src/pages/academicReport/Components/languageStatistics.vue b/src/pages/academicReport/Components/languageStatistics.vue index ee8ef91..293b35d 100644 --- a/src/pages/academicReport/Components/languageStatistics.vue +++ b/src/pages/academicReport/Components/languageStatistics.vue @@ -163,7 +163,7 @@ const languageStatistics = ref({ async function fetchChartData() { try { loading.value = true; - const { data } = await englishLanguageStatApi({ + const data = await englishLanguageStatApi({ dateType: dateType.value, userId: props.userId, }); diff --git a/src/pages/academicReport/Components/studyTime.vue b/src/pages/academicReport/Components/studyTime.vue index cafa805..4c252d4 100644 --- a/src/pages/academicReport/Components/studyTime.vue +++ b/src/pages/academicReport/Components/studyTime.vue @@ -30,29 +30,29 @@ diff --git a/src/pages/academicReport/Components/videoTime.vue b/src/pages/academicReport/Components/videoTime.vue index 6f39d1c..77b759a 100644 --- a/src/pages/academicReport/Components/videoTime.vue +++ b/src/pages/academicReport/Components/videoTime.vue @@ -70,28 +70,28 @@ diff --git a/src/pages/parents/mySupervisionService/components/Order.vue b/src/pages/parents/mySupervisionService/components/Order.vue index 3fd5a83..5afa59c 100644 --- a/src/pages/parents/mySupervisionService/components/Order.vue +++ b/src/pages/parents/mySupervisionService/components/Order.vue @@ -1,75 +1,83 @@ -