fix:重构完毕

This commit is contained in:
MJ 2025-08-02 13:57:00 +08:00
parent e7104a1ae9
commit 82bae4c441
78 changed files with 1193 additions and 1616 deletions

View File

@ -1,56 +1,37 @@
import $req from './request' import { http } from './request/request'
// 获取用户信息 // 获取用户信息
export const getUserInfo = () => export const getUserInfo = async () =>
$req({ await http.get<any>('/sysUser/selectUser')
url: '/sysUser/selectUser',
})
// 获取客服信息 // 获取客服信息
export const getCsInfo = (id: string) => export const getCsInfo = async (id: string) =>
$req({ await http.get<any>(`/customerService/getInfoByUserId/${id}`)
url: `/customerService/getInfoByUserId/${id}`,
})
// 更新用户信息 // 更新用户信息
export const updateUserInfo = (data: any) => export const updateUserInfo = async (data: any) =>
$req({ await http.post<any>('/sysUser/editPerfectMessage', data)
url: '/sysUser/editPerfectMessage',
method: 'post',
data,
})
// 获取协议 // 获取协议
export const getAgreeInfo = (id: string, isChat = false) => export const getAgreeInfo = async (id: string, isChat = false) =>
$req({ await http.get<any>('/agreement/' + id, undefined, {
url: '/agreement/' + id, header: {
headers: {
Authorization: '', Authorization: '',
}, },
}) })
// 获取字典 // 获取字典
export const getDict = () => export const getDict = async () =>
$req({ await http.get<any>('/sysDictType/tree')
url: '/sysDictType/tree',
})
// 设备通知注册 // 设备通知注册
export const bindRegId = (data: any) => export const bindRegId = async (data: any) =>
$req({ await http.post<any>('/sysUser/dealRegistrationId', data)
url: '/sysUser/dealRegistrationId',
method: 'post',
data,
})
// 获取未读消息数量 // 获取未读消息数量
export const getUnreadNum = () => $req({ url: '/customerService/getUnreadNum' }) export const getUnreadNum = async () => await http.get<any>('/customerService/getUnreadNum')
// 支付创建订单 // 支付创建订单
export const createInspectorPrepayOrder = (data: any) => { export const createInspectorPrepayOrder = async (data: any) => {
return $req({ return await http.post<any>('/orderManagement/createInspectorPrepayOrder', data)
method: 'post',
url: '/orderManagement/createInspectorPrepayOrder',
data,
})
} }

View File

@ -1,36 +1,24 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* *
* @param data * @param data
*/ */
export const getUserInfo = (data = {}) => { export const getUserInfo = async (data = {}): Promise<any> => {
return $req({ return await http.post<any>('/phone/inspectorTeacher/myInfo', data);
method: 'post',
url: '/phone/inspectorTeacher/myInfo',
data,
});
}; };
/** /**
* *
* @param params * @param params
*/ */
export const queryUserRoles = (params = {}) => { export const queryUserRoles = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/sysUser/getAdminTypeByPhone', params);
method: 'get',
url: '/sysUser/getAdminTypeByPhone',
params,
});
}; };
/** /**
* *
*/ */
export const switchRole = (adminType: number) => { export const switchRole = async (adminType: number): Promise<any> => {
return $req({ return await http.get<any>('/sysUser/changeAdminType', {
method: 'get',
url: '/sysUser/changeAdminType',
params: {
adminType, adminType,
},
}); });
}; };

View File

@ -1,111 +1,73 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* *
* @param params * @param params
*/ */
export const getStudentDetail = (params = {}) => { export const getStudentDetail = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/phone/inspectorTeacher/getStuVoByOrderIdAndCourseDate', params);
method: 'get',
url: '/phone/inspectorTeacher/getStuVoByOrderIdAndCourseDate',
params,
});
}; };
/** /**
* *
* @param data * @param data
*/ */
export const getUserReportPage = (data = {}) => { export const getUserReportPage = async (data = {}): Promise<any> => {
return $req({ return await http.post<any>('/phone/inspectorTeacher/getUserReportPage', data);
method: 'post',
url: '/phone/inspectorTeacher/getUserReportPage',
data,
});
}; };
/** /**
* *
* @param params * @param params
*/ */
export const getUserInspectorCourseReportInfo = (params = {}) => { export const getUserInspectorCourseReportInfo = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/phone/inspectorTeacher/userInspectorCourseReportInfo', params);
method: 'get',
url: '/phone/inspectorTeacher/userInspectorCourseReportInfo',
params,
});
}; };
/** /**
* *
* @param data * @param data
*/ */
export const queryStudyPlanList = (data = {}) => { export const queryStudyPlanList = async (data = {}): Promise<any> => {
return $req({ return await http.post<any>('/phone/inspectorTeacher/queryStuPlanPage', data);
method: 'post',
url: '/phone/inspectorTeacher/queryStuPlanPage',
data,
});
}; };
/** /**
* *
* @param planId id * @param planId id
*/ */
export const deletePlanRequest = (planId: string) => { export const deletePlanRequest = async (planId: string): Promise<any> => {
return $req({ return await http.post<any>(`/phone/inspectorTeacher/deletePlanById?planId=${planId}`);
method: 'post',
url: `/phone/inspectorTeacher/deletePlanById?planId=${planId}`,
});
}; };
/** /**
* *
* @param gradeId id * @param gradeId id
*/ */
export const getSubjectListByGrade = (gradeId: string) => { export const getSubjectListByGrade = async (gradeId: string): Promise<any> => {
return $req({ return await http.get<any>(`/subject/list/${gradeId}`);
method: 'get',
url: `/subject/list/${gradeId}`,
});
}; };
/** /**
* *
* @param params * @param params
*/ */
export const queryStudyDuration = (params = {}) => { export const queryStudyDuration = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/userSubjectReport/study/duration', params);
method: 'get',
url: '/userSubjectReport/study/duration',
params,
});
}; };
/** /**
* *
* @param params * @param params
*/ */
export const queryVideoStudy = (params = {}) => { export const queryVideoStudy = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/userSubjectReport/study/video', params);
method: 'get',
url: '/userSubjectReport/study/video',
params,
});
}; };
/** /**
* *
* @param params * @param params
*/ */
export const queryStudyKnowledge = (params = {}) => { export const queryStudyKnowledge = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/userSubjectReport/study/knowledge', params);
method: 'get',
url: '/userSubjectReport/study/knowledge',
params,
});
}; };
/** /**
* *
* @param params * @param params
*/ */
export const queryStudentWrongQuestion = (params = {}) => { export const queryStudentWrongQuestion = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/userSubjectReport/study/error', params);
method: 'get',
url: '/userSubjectReport/study/error',
params,
});
}; };

View File

@ -1,27 +1,19 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* *
* @param data * @param data
*/ */
export const getCourseTable = (data={}) => { export const getCourseTable = async (data = {}): Promise<any> => {
return $req({ return await http.get<any>('/phone/inspectorTeacher/getCourseTableById', data);
method: 'get',
url: '/phone/inspectorTeacher/getCourseTableById',
data,
});
}; };
/** /**
* *
* @param data * @param params
*/ */
export const queryStudentList = (params={}) => { export const queryStudentList = async (params = {}): Promise<any> => {
return $req({ return await http.get<any>('/phone/inspectorTeacher/getMyStudent', params);
method:'get', };
url:'/phone/inspectorTeacher/getMyStudent',
params,
});
}

View File

@ -1,91 +1,63 @@
import $req from './request' import { http } from './request/request'
/** /**
* *
* @param data * @param data
*/ */
export const getBindPhoneTypeApi = data => { export const getBindPhoneTypeApi = async data => {
$req({ return await http.post<any>('/xcx/login/getBindRelationList', data)
method: 'post',
url: '/xcx/login/getBindRelationList',
data,
})
} }
/** /**
* *
* @param data * @param data
*/ */
export const getAdminTypeByPhoneApi = (params: any) => export const getAdminTypeByPhoneApi = async (params: any) =>
$req({ await http.get<any>('/sysUser/getAdminTypeByPhone', params)
method: 'get',
url: '/sysUser/getAdminTypeByPhone',
params,
})
/** /**
* *
* @param data * @param data
*/ */
export const sendCodeMessageApi = data => export const sendCodeMessageApi = async data =>
$req({ await http.post<any>(`/sms/sendMessage?phoneNumbers=${data}`)
method: 'post',
url: `/sms/sendMessage?phoneNumbers=${data}`,
})
/** /**
* *
* @param data * @param data
*/ */
export const smsLoginApi = data => export const smsLoginApi = async data =>
$req({ await http.post<any>('/smsLogin', {
method: 'post',
url: '/smsLogin',
data: {
...data, ...data,
clientType: 'MOBILE', clientType: 'MOBILE',
},
}) })
/** /**
* *
* @param data * @param data
*/ */
export const getUserInfoApi = () => export const getUserInfoApi = async () =>
$req({ await http.get<any>('/sysUser/selectUser')
method: 'get',
url: '/sysUser/selectUser',
})
/** /**
* *
* @param data * @param data
*/ */
export const updateUserInfoApi = (data: any) => export const updateUserInfoApi = async (data: any) =>
$req({ await http.post<any>('/sysUser/updateInfo', data)
method: 'post',
url: '/sysUser/updateInfo',
data,
})
/** /**
* *
* @param data * @param data
*/ */
export const bindAuthInfoApi = data => export const bindAuthInfoApi = async data =>
$req({ await http.post<any>('/wechatPublic/bindAuthInfo', data)
method: 'post',
url: '/wechatPublic/bindAuthInfo',
data,
})
/** /**
* *
* @param data * @param data
*/ */
export const getAuthUrlApi = () => export const getAuthUrlApi = async () =>
$req({ await http.get<any>('/wechatPublic/getAuthUrl')
method: 'get',
url: '/wechatPublic/getAuthUrl',
})
// 退出登录 // 退出登录
export const logout = () => export const logout = async () =>
$req({ await http.get<any>('/logout')
url: '/logout',
})

View File

@ -1,60 +1,43 @@
import $req from '../request' import { http } from '../request/request'
/** /**
* - * -
* @param data * @param data
*/ */
export const subjectApi = (gradeId: string) => export const subjectApi = async (gradeId: string) =>
$req({ await http.get<any>(`/subject/list/${gradeId}`)
method: 'get',
url: `/subject/list/${gradeId}`,
})
/** /**
* - * -
* @param data * @param data
*/ */
export const studyTimeStatApi = (params: any) => export const studyTimeStatApi = async (params: any) =>
$req({ await http.get<any>('/userSubjectReport/study/duration', params)
method: 'get',
url: '/userSubjectReport/study/duration',
params,
})
/** /**
* - * -
* @param data * @param data
*/ */
export const videoStudyStatApi = (params: any) => export const videoStudyStatApi = async (params: any) =>
$req({ await http.get<any>('/userSubjectReport/study/video', params)
method: 'get',
url: '/userSubjectReport/study/video',
params,
})
/** /**
* - * -
* @param data * @param data
*/ */
export const knowledgeStudyStatApi = (params: any) => export const knowledgeStudyStatApi = async (params: any) =>
$req({ await http.get<any>('/userSubjectReport/study/knowledge', params)
method: 'get',
url: '/userSubjectReport/study/knowledge',
params,
})
/** /**
* - * -
* @param data * @param data
*/ */
export const studyErrorStatApi = (params: any) => export const studyErrorStatApi = async (params: any) =>
$req({ await http.get<any>('/userSubjectReport/study/error', params)
method: 'get',
url: '/userSubjectReport/study/error',
params,
})
/** /**
* - * -
* @param data * @param data
*/ */
export const englishLanguageStatApi = (data: any) => export const englishLanguageStatApi = async (data: any) =>
$req({ await http.post<any>('/userSentenceLearn/queryStatListByTimeType', data)
method: 'post',
url: '/userSentenceLearn/queryStatListByTimeType',
data,
})

View File

@ -1,10 +1,8 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* *
* @param data * @param data
*/ */
export const queryAppRecordApi = (serialNum: string) => export const queryAppRecordApi = async (serialNum: string) =>
$req({ await http.get<any>(`/userAppRecord/queryAppRecord/${serialNum}`);
method: 'get',
url: `/userAppRecord/queryAppRecord/${serialNum}`,
});

View File

@ -1,49 +1,36 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* - * -
* @param data * @param data
*/ */
export const getRewardListApi = params => export const getRewardListApi = async (params: any) =>
$req({ await http.get<any>('/userRewardMapping/list', params);
method: 'get',
url: '/userRewardMapping/list',
params,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const addRewardApi = data => export const addRewardApi = async (data: any) =>
$req({ await http.post<any>('/userRewardMapping', data);
method: 'post',
url: '/userRewardMapping',
data,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const updateRewardApi = data => export const updateRewardApi = async (data: any) =>
$req({ await http.put<any>('/userRewardMapping', data);
method: 'put',
url: '/userRewardMapping',
data,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const deleteRewardApi = ids => export const deleteRewardApi = async (ids: string) =>
$req({ await http.del<any>(`/userRewardMapping/${ids}`);
method: 'delete',
url: `/userRewardMapping/${ids}`,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const getRewardDetailApi = id => export const getRewardDetailApi = async (id: string) =>
$req({ await http.get<any>(`/userRewardMapping/${id}`);
method: 'get',
url: `/userRewardMapping/${id}`,
});

View File

@ -1,78 +1,50 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* *
* @param params * @param params
*/ */
export const getCurInfo = params => export const getCurInfo = async (params: any) =>
$req({ await http.get<any>('/parentBind/curInfo', params);
method: 'get',
url: '/parentBind/curInfo',
params,
});
/** /**
* *
* @param data * @param data
*/ */
export const parentBindAdmin = data => export const parentBindAdmin = async (data: any) =>
$req({ await http.post<any>('/parentBind/admin', data);
method: 'post',
url: '/parentBind/admin',
data,
});
/** /**
* *
* @param data * @param data
*/ */
export const parentBindApply = data => export const parentBindApply = async (data: any) =>
$req({ await http.post<any>('/parentBind/apply', data);
method: 'post',
url: '/parentBind/apply',
data,
});
/** /**
* - * -
* @param params * @param params
*/ */
export const adminInfo = params => export const adminInfo = async (params: any) =>
$req({ await http.get<any>('/parentBind/adminInfo', params);
method: 'get',
url: '/parentBind/adminInfo',
params,
});
/** /**
* - * -
* @param params * @param params
*/ */
export const applyInfo = params => export const applyInfo = async (params: any) =>
$req({ await http.get<any>('/parentBind/apply/info', params);
method: 'get',
url: '/parentBind/apply/info',
params,
});
/** /**
* *
* @param data * @param data
*/ */
export const adminApproval = data => export const adminApproval = async (data: any) =>
$req({ await http.post<any>('/parentBind/admin/approval', data);
method: 'post',
url: '/parentBind/admin/approval',
data,
});
/** /**
* *
* @param data * @param data
*/ */
export const deviceTimeControl = data => export const deviceTimeControl = async (data: any) =>
$req({ await http.post<any>('/deviceTimeControl', data);
method: 'post',
url: '/deviceTimeControl',
data,
});

View File

@ -1,12 +1,8 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* - * -
* @param params * @param params
*/ */
export const deviceScreenshotRecordList = params => export const deviceScreenshotRecordList = async (params: any) =>
$req({ await http.get<any>('/deviceScreenshotRecord/list', params);
method: 'get',
url: '/deviceScreenshotRecord/list',
params,
});

View File

@ -1,22 +1,17 @@
import $req from '../request'; import { http } from '../request/request';
/** /**
* *
* *
* @param params * @param params
*/ */
export const getDeviceScreenControlApi = (simSerialNumber: string) => export const getDeviceScreenControlApi = async (simSerialNumber: string) =>
$req({ await http.get<any>(`/deviceTimeControl/${simSerialNumber}`);
method: 'get',
url: `/deviceTimeControl/${simSerialNumber}`,
});
/** /**
* *
* *
* @param params * @param params
*/ */
export const lockDeviceScreenApi = (simSerialNumber: string) => export const lockDeviceScreenApi = async (simSerialNumber: string) =>
$req({ await http.post<any>(`/deviceTimeControl/update/lock/${simSerialNumber}`);
method: 'post',
url: `/deviceTimeControl/update/lock/${simSerialNumber}`,
});

View File

@ -1,101 +1,67 @@
import $req from '../request' import { http } from '../request/request'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { user } from '@/store' import { user } from '@/store'
import { getCache } from '@/utils' import { getCache } from '@/utils'
import db from '@/utils/db' import db from '@/utils/db'
// 课表日历 // 课表日历
export const getScheduleList = (data?: Record<string, any>): Promise<any> => export const getScheduleList = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>('/phone/inspectorTeacher/getCourseTableById', data)
method: 'get',
url: '/phone/inspectorTeacher/getCourseTableById',
data,
})
// 查询指定日期学生数据 // 查询指定日期学生数据
export const getCourseDate = (data?: Record<string, any>): Promise<any> => export const getCourseDate = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(
method: 'get',
url:
`/phone/inspectorTeacher/getCourseTabletStudentVoByTime` + `/phone/inspectorTeacher/getCourseTabletStudentVoByTime` +
`${data.date ? `?courseDate=${data.date}` : ''}`, `${data.date ? `?courseDate=${data.date}` : ''}`,
// data, )
})
// 开始督学 // 开始督学
export const startInpector = (data?: Record<string, any>): Promise<any> => export const startInpector = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>(`/phone/inspectorTeacher/startInspector?courseDate=${data.courseDate}`)
method: 'post',
url: `/phone/inspectorTeacher/startInspector?courseDate=${data.courseDate}`,
})
// 结束督学 // 结束督学
export const endInpector = (data?: Record<string, any>): Promise<any> => export const endInpector = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>(`/phone/inspectorTeacher/endInspector?courseDate=${data.courseDate}`)
method: 'post',
url: `/phone/inspectorTeacher/endInspector?courseDate=${data.courseDate}`,
})
// 督学实况 // 督学实况
export const condition = (data?: Record<string, any>): Promise<any> => export const condition = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>(`/phone/inspectorTeacher/inspector_real?courseDate=${data.courseDate}`)
method: 'post',
url: `/phone/inspectorTeacher/inspector_real?courseDate=${data.courseDate}`,
})
// 获取学员课表日历 // 获取学员课表日历
export const getCourseData = (data?: Record<string, any>): Promise<any> => export const getCourseData = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(`/phone/inspectorTeacher/getStuCourseTable?userId=${data.id}`)
method: 'get',
url: `/phone/inspectorTeacher/getStuCourseTable?userId=${data.id}`,
// data,
})
// 获取学科 // 获取学科
export const getSubject = (data?: Record<string, any>): Promise<any> => export const getSubject = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(`/subject/list/${data.gradeId}`)
method: 'get',
url: `/subject/list/${data.gradeId}`,
})
// 获取学科教材 // 获取学科教材
export const getBooks = (data?: Record<string, any>): Promise<any> => export const getBooks = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(
method: 'get', `/userTextBook/list?gradeId=${data.gradeId}&subjectId=${data.subjectId}&userId=${data.userId}&current=${data.current}`,
url: `/userTextBook/list?gradeId=${data.gradeId}&subjectId=${data.subjectId}&userId=${data.userId}&current=${data.current}`, )
})
// 获取教材章节 // 获取教材章节
export const getChaper = (data?: Record<string, any>): Promise<any> => export const getChaper = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(`/subjectChapter/tree?textBookId=${data.textBookId}`)
method: 'get',
url: `/subjectChapter/tree?textBookId=${data.textBookId}`,
})
// 获取教材章节知识点 // 获取教材章节知识点
export const getKnowledge = (data?: Record<string, any>): Promise<any> => export const getKnowledge = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(`/subjectKnowledge/tree?chapterId=${data.chapterId}`)
method: 'get',
url: `/subjectKnowledge/tree?chapterId=${data.chapterId}`,
})
// 发布计划 // 发布计划
export const publishPlan = (data?: Record<string, any>): Promise<any> => export const publishPlan = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>('/phone/inspectorTeacher/publishPlan', data)
method: 'post',
url: `/phone/inspectorTeacher/publishPlan`,
data,
})
// 获取学员计划 // 获取学员计划
export const getStuPlan = (data?: Record<string, any>): Promise<any> => export const getStuPlan = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(
method: 'get', `/phone/inspectorTeacher/getStuPlanByDate?userId=${data.userId}&courseDate=${data.courseDate}`,
url: `/phone/inspectorTeacher/getStuPlanByDate?userId=${data.userId}&courseDate=${data.courseDate}`, )
})
// 获取督学师信息 // 获取督学师信息
export const getUserInfo = (data?: Record<string, any>): Promise<any> => export const getUserInfo = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>('/phone/inspectorTeacher/getCurrentTeacher')
method: 'get',
url: `/phone/inspectorTeacher/getCurrentTeacher`,
})
// 文件上传 // 文件上传
export const uploadFile = async (file): Promise<any> => { export const uploadFile = async (file): Promise<any> => {
const { token } = storeToRefs(user()) const { token } = storeToRefs(user())
@ -115,84 +81,51 @@ export const uploadFile = async (file): Promise<any> => {
} }
// 完善督学师资料 /phone/inspectorTeacher/updateTeacherInfo // 完善督学师资料 /phone/inspectorTeacher/updateTeacherInfo
export const updateTeacherInfo = (data?: Record<string, any>): Promise<any> => export const updateTeacherInfo = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>('/phone/inspectorTeacher/updateTeacherInfo', data)
method: 'post',
url: `/phone/inspectorTeacher/updateTeacherInfo`,
data,
})
// 沟通列表 // 沟通列表
export const getTalkList = (data?: Record<string, any>): Promise<any> => export const getTalkList = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(`/phone/inspectorTeacher/inspectorTalkListPage?current=${data.current}`)
method: 'get',
url: `/phone/inspectorTeacher/inspectorTalkListPage?current=${data.current}`,
})
// 沟通详情 // 沟通详情
export const getTalkDetails = (data?: Record<string, any>): Promise<any> => { export const getTalkDetails = async (data?: Record<string, any>): Promise<any> => {
const param = data.inspectorTalkRecordId const param = data.inspectorTalkRecordId
? `?inspectorTalkRecordId=${data.inspectorTalkRecordId}&userId=${data.userId}` ? `?inspectorTalkRecordId=${data.inspectorTalkRecordId}&userId=${data.userId}`
: `?userId=${data.userId}` : `?userId=${data.userId}`
return $req({ return await http.get<any>(`/phone/inspectorTeacher/studentInspectorTalkPage${param}`)
method: 'get',
url: `/phone/inspectorTeacher/studentInspectorTalkPage${param}`,
})
} }
// 消息存储 // 消息存储
export const saveTalk = (data?: Record<string, any>): Promise<any> => export const saveTalk = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>('/inspectorStudent/sendInspectorTalkRecord', data)
method: 'post',
url: `/inspectorStudent/sendInspectorTalkRecord`,
data,
})
// 验证码校验 // 验证码校验
export const validCode = (data?: Record<string, any>): Promise<any> => export const validCode = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>(`/sms/validateMessage?phoneNumbers=${data.phone}&code=${data.code}`, data)
method: 'post',
url: `/sms/validateMessage?phoneNumbers=${data.phone}&code=${data.code}`,
data,
})
// 获取我的未读信息 // 获取我的未读信息
export const getUnreadCount = (data?: Record<string, any>): Promise<any> => export const getUnreadCount = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>('/phone/inspectorTeacher/myUnreadCount')
method: 'get',
url: `/phone/inspectorTeacher/myUnreadCount`,
})
// 消息标记为已读 // 消息标记为已读
export const readMsg = (data?: Record<string, any>): Promise<any> => export const readMsg = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.post<any>('/inspectorStudent/readTalkRecord', data)
method: 'post',
url: `/inspectorStudent/readTalkRecord`,
data,
})
// 督学师是否已完善资料 // 督学师是否已完善资料
export const needPerfectInfo = (data?: Record<string, any>): Promise<any> => export const needPerfectInfo = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>('/phone/inspectorTeacher/is_perfect')
method: 'get',
url: `/phone/inspectorTeacher/is_perfect`,
})
// 学生是否可以进行精准学判断 // 学生是否可以进行精准学判断
export const getPrecisionFlag = (data?: Record<string, any>): Promise<any> => export const getPrecisionFlag = async (data?: Record<string, any>): Promise<any> =>
$req({ await http.get<any>(
method: 'get', `/userTrainTitle/airPrecisionFlag?subjectId=${data.subjectId}&userId=${data.userId}`,
url: `/userTrainTitle/airPrecisionFlag?subjectId=${data.subjectId}&userId=${data.userId}`, )
})
export const getKnowledgeFlag = (knowledgeId: string): Promise<boolean> => { export const getKnowledgeFlag = async (knowledgeId: string): Promise<boolean> => {
return $req({ return await http.get<any>(`/subjectKnowledge/titleFlag?id=${knowledgeId}`)
method: 'get',
url: `/subjectKnowledge/titleFlag?id=${knowledgeId}`,
})
} }
export const getKnowledgeVideo = (chapterId: string | number): Promise<any> => { export const getKnowledgeVideo = async (chapterId: string | number): Promise<any> => {
return $req({ return await http.get<any>(`/subjectChapterVideo/list?chapterId=${chapterId}`)
method: 'get',
url: `/subjectChapterVideo/list?chapterId=${chapterId}`,
})
} }

View File

@ -1,4 +1,3 @@
import $req from '../request'
import { http } from '../request/request' import { http } from '../request/request'
/** /**
* *

View File

@ -1,51 +1,40 @@
import $req from '../request'
import { http } from '../request/request' import { http } from '../request/request'
/** /**
* *
* @param params * @param params
*/ */
export const getParentBindChildApi = (params: any) => export const getParentBindChildApi = async (params: any) =>
$req({ await http.get<any>('/parentBindChild/list', params)
method: 'get',
url: '/parentBindChild/list',
params,
})
/** /**
* *
* @param params * @param params
*/ */
export const getParentBindDeviceApi = async (params: any) => export const getParentBindDeviceApi = async (params: any) =>
await http.get<any>('/parentBindDevice/list', params) await http.get<any>('/parentBindDevice/list', params)
/** /**
* - * -
* @param params * @param params
*/ */
export const parentBindChildApi = (id: string) => export const parentBindChildApi = async (id: string) =>
$req({ await http.get<any>(`/parentBindChild/${id}`)
method: 'get',
url: `/parentBindChild/${id}`,
})
/** /**
* - * -
* @param params * @param params
*/ */
export const childUnBoundParentApi = (data: any) => export const childUnBoundParentApi = async (data: any) =>
$req({ await http.post<any>('/parentBindChild/unBound', data)
method: 'post',
url: '/parentBindChild/unBound',
data,
})
/** /**
* - * -
* @param params * @param params
*/ */
export const parentUnBoundDeviceApi = (data: any) => export const parentUnBoundDeviceApi = async (data: any) =>
$req({ await http.post<any>('/parentBindDevice/unBound', data)
method: 'post',
url: '/parentBindDevice/unBound',
data,
})
/** /**
* - * -
* @param params * @param params
@ -57,17 +46,12 @@ export const parentDeviceCurrentLoginApi = async (id: string) =>
* - * -
* @param params * @param params
*/ */
export const applyBindInfoListApi = () => export const applyBindInfoListApi = async () =>
$req({ await http.get<any>('/parentBind/applyInfoList')
method: 'get',
url: '/parentBind/applyInfoList',
})
/** /**
* - * -
* @param params * @param params
*/ */
export const userInfoPermitApi = () => export const userInfoPermitApi = async () =>
$req({ await http.get<any>('/parentBind/applyInfoPermit')
method: 'get',
url: '/parentBind/applyInfoPermit',
})

View File

@ -1,54 +1,30 @@
import $req from '../request'; import { http } from '../request/request';
export const getInspectorCourseList = async (params: {userId: string | number}) => {
export const getInspectorCourseList = (params: {userId: string | number}) => { return await http.get<any>('/inspectorParent/userInspectorCourseList', params);
return $req({
method: 'get',
url: '/inspectorParent/userInspectorCourseList',
params
});
} }
export const getInspectorModeList = () => { export const getInspectorModeList = async () => {
return $req({ return await http.get<any>('/inspectorParent/inspectorModeList');
method: 'get',
url: '/inspectorParent/inspectorModeList',
});
} }
// 最近或最后一次课时督学师和同学信息 // 最近或最后一次课时督学师和同学信息
export const getInspectorTeacherStudentInfo = (params: {orderId: string}) => { export const getInspectorTeacherStudentInfo = async (params: {orderId: string}) => {
return $req({ return await http.get<any>('/inspectorParent/inspectorTeacherStudentInfo', params);
method: 'get',
url: '/inspectorParent/inspectorTeacherStudentInfo',
params
});
} }
// 督学订单列表 // 督学订单列表
export const getInspectorOrderList = (params: {userId: string | number}) => { export const getInspectorOrderList = async (params: {userId: string | number}) => {
return $req({ return await http.get<any>('/inspectorParent/userInspectorOrderList', params);
method: 'get',
url: '/inspectorParent/userInspectorOrderList',
params
});
} }
// 查询督学计划 // 查询督学计划
export const getInspectorPlan = (params: {inspectorPlanId: string}) => { export const getInspectorPlan = async (params: {inspectorPlanId: string}) => {
return $req({ return await http.get<any>('/inspectorParent/inspectorPlanInfo', params);
method: 'get',
url: '/inspectorParent/inspectorPlanInfo',
params
});
} }
// 督学计划报告 // 督学计划报告
export const getInspectorPlanReport = (params: {userId: string}) => { export const getInspectorPlanReport = async (params: {userId: string}) => {
return $req({ return await http.get<any>('/inspectorParent/userInspectorCourseReportList', params);
method: 'get',
url: '/inspectorParent/userInspectorCourseReportList',
params
});
} }

View File

@ -1,12 +1,9 @@
import $req from '../request'; import { http } from '../request/request';
export const getChildList = () => { export const getChildList = async () => {
return $req({ return await http.get<any>('/inspectorParent/childList');
url: '/inspectorParent/childList',
});
}; };
export const getModelList = () => {
return $req({ export const getModelList = async () => {
url: '/inspectorParent/inspectorModeList', return await http.get<any>('/inspectorParent/inspectorModeList');
});
}; };

View File

@ -1,72 +1,47 @@
import $req from '../request'; import { http } from '../request/request'
/**
/** /**
* - * -
* @param data * @param data
*/ */
export const getTaskListApi = params => export const getTaskListApi = async (params: any) => await http.get<any>('/scTask/list', params)
$req({
method: 'get',
url: '/scTask/list',
params,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const addTaskApi = data => export const addTaskApi = async (data: any) => await http.post<any>('/scTask', data)
$req({
method: 'post',
url: '/scTask',
data,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const getFamilyTaskStuApi = params => export const getFamilyTaskStuApi = async (params: any) =>
$req({ await http.get<any>('/scTask/getFamilyTaskStuList', params)
method: 'get',
url: '/scTask/getFamilyTaskStuList',
params,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const taskConfigListApi = params => export const taskConfigListApi = async (params?: any) =>
$req({ await http.get<any>('/scTaskConfig/list', params)
method: 'get',
url: '/scTaskConfig/list',
params,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const addTaskConfigApi = data => export const addTaskConfigApi = async (data: any) => await http.post<any>('/scTaskConfig', data)
$req({
method: 'post',
url: '/scTaskConfig',
data,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const deleteTaskConfigApi = ids => export const deleteTaskConfigApi = async (ids: string) =>
$req({ await http.del<any>(`/scTaskConfig/${ids}`)
method: 'delete',
url: `/scTaskConfig/${ids}`,
});
/** /**
* - * -
* @param data * @param data
*/ */
export const updateTaskStatusApi = data => export const updateTaskStatusApi = async (data: any) =>
$req({ await http.post<any>('/scTask/updateTaskStatus', data)
method: 'post',
url: '/scTask/updateTaskStatus',
data,
});

View File

@ -1,31 +1,22 @@
import $req from '../request' import { http } from '../request/request'
/** /**
* - * -
* @param data * @param data
*/ */
export const getWarrantyCardMsgApi = () => export const getWarrantyCardMsgApi = async () =>
$req({ await http.get<any>('/parentBind/getBindDeviceList')
method: 'get',
url: '/parentBind/getBindDeviceList',
})
/** /**
* - * -
* @param data * @param data
*/ */
export const applyServiceApi = (data: any) => export const applyServiceApi = async (data: any) =>
$req({ await http.post<any>('/deviceWarrantyRecord', data)
method: 'post',
url: '/deviceWarrantyRecord',
data,
})
/** /**
* - * -
* @param data * @param data
*/ */
export const getServiceHistoryApi = (params: any) => export const getServiceHistoryApi = async (params: any) =>
$req({ await http.get<any>('/deviceWarrantyRecord/list', params)
method: 'get',
url: '/deviceWarrantyRecord/list',
params,
})

View File

@ -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<string, any>) {
super(message)
this.data = data
}
}
const request = async (config: Record<string, any>): Promise<any> => {
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

View File

@ -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 { HTTP_STATUS, ERROR_MSG } from './config'
import router from '@/router/router' import router from '@/router/router'
import db from '@/utils/db' import db from '@/utils/db'
@ -33,7 +34,7 @@ export const responseInterceptor = async <T>(
// 处理成功响应 // 处理成功响应
if (statusCode === HTTP_STATUS.SUCCESS) { if (statusCode === HTTP_STATUS.SUCCESS) {
if (data.code === 200) return response if (data.statusCode === 200 || data.code === 200) return response
throw { throw {
statusCode, statusCode,
errMsg: data.data, errMsg: data.data,

View File

@ -207,7 +207,7 @@ async function fetchChartData() {
empty.value = false; empty.value = false;
try { try {
loading.value = true; loading.value = true;
const { data } = await studyErrorStatApi({ const data = await studyErrorStatApi({
dateType: dateType.value, dateType: dateType.value,
subjectId: props.subjectId, subjectId: props.subjectId,
userId: props.userId, userId: props.userId,

View File

@ -106,7 +106,7 @@ async function fetchChartData() {
empty.value = false; empty.value = false;
try { try {
loading.value = true; loading.value = true;
const { data } = await knowledgeStudyStatApi({ const data = await knowledgeStudyStatApi({
dateType: dateType.value, dateType: dateType.value,
subjectId: props.subjectId, subjectId: props.subjectId,
userId: props.userId, userId: props.userId,

View File

@ -163,7 +163,7 @@ const languageStatistics = ref({
async function fetchChartData() { async function fetchChartData() {
try { try {
loading.value = true; loading.value = true;
const { data } = await englishLanguageStatApi({ const data = await englishLanguageStatApi({
dateType: dateType.value, dateType: dateType.value,
userId: props.userId, userId: props.userId,
}); });

View File

@ -30,29 +30,29 @@
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from 'vue'; import { ref, watch } from 'vue'
import DateFilter from './dateFilter.vue'; import DateFilter from './dateFilter.vue'
import BarChart from './Echart/BarChart.vue'; import BarChart from './Echart/BarChart.vue'
import type { SubjectType, StudyTimeType } from '../interface'; import type { SubjectType, StudyTimeType } from '../interface'
import '../index.scss'; import '../index.scss'
import { studyTimeStatApi } from '@/api'; import { studyTimeStatApi } from '@/api'
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
subjectId: number | string; subjectId: number | string
userId: string; userId: string
}>(), }>(),
{ {
subjectId: 0, subjectId: 0,
userId: '', userId: '',
}, },
); )
const emits = defineEmits(['change']); const emits = defineEmits(['change'])
const _subjectId = ref(); const _subjectId = ref()
const loading = ref(true); const loading = ref(true)
const dateType = ref(0); const dateType = ref(0)
const empty = ref(false); const empty = ref(false)
const showData = ref<StudyTimeType>({ const showData = ref<StudyTimeType>({
continuousDuration: 0, continuousDuration: 0,
cumulativeTimeDuration: 0, cumulativeTimeDuration: 0,
@ -63,7 +63,7 @@ const showData = ref<StudyTimeType>({
totalTimeFree: 0, totalTimeFree: 0,
}, },
], ],
}); })
const englishLearningTime = ref({ const englishLearningTime = ref({
categories: ['自由学', 'AI精准学', '错题本', '单词闯关', '单词测试', '语感训练'], categories: ['自由学', 'AI精准学', '错题本', '单词闯关', '单词测试', '语感训练'],
series: [ series: [
@ -72,7 +72,7 @@ const englishLearningTime = ref({
format: 'hoursUnit', format: 'hoursUnit',
}, },
], ],
}); })
const learningTime = ref({ const learningTime = ref({
categories: ['自由学', 'AI精准学', '错题本'], categories: ['自由学', 'AI精准学', '错题本'],
series: [ series: [
@ -81,30 +81,30 @@ const learningTime = ref({
format: 'hoursUnit', format: 'hoursUnit',
}, },
], ],
}); })
function timeTool(second: string | number) { function timeTool(second: string | number) {
const seconds = Number(second); const seconds = Number(second)
let h: number | string = (seconds / 3600).toFixed(1); let h: number | string = (seconds / 3600).toFixed(1)
return Number(h); return Number(h)
} }
async function fecthStudyTimeStat() { async function fecthStudyTimeStat() {
if (props.subjectId === 0) { if (props.subjectId === 0) {
empty.value = true; empty.value = true
return; return
} }
empty.value = false; empty.value = false
try { try {
loading.value = true; loading.value = true
const { data } = await studyTimeStatApi({ const data = await studyTimeStatApi({
dateType: dateType.value, dateType: dateType.value,
subjectId: props.subjectId, subjectId: props.subjectId,
userId: props.userId, userId: props.userId,
}); })
showData.value.continuousDuration = data.continuousDuration; showData.value.continuousDuration = data.continuousDuration
showData.value.cumulativeTimeDuration = data.cumulativeTimeDuration; showData.value.cumulativeTimeDuration = data.cumulativeTimeDuration
let stat = data.studyDurationVoList[0]; let stat = data.studyDurationVoList[0]
englishLearningTime.value.series[0].data = [ englishLearningTime.value.series[0].data = [
{ color: '#83C400', value: timeTool(stat.totalTimeFree), text: stat.totalTimeFree }, { color: '#83C400', value: timeTool(stat.totalTimeFree), text: stat.totalTimeFree },
{ color: '#767fff', value: timeTool(stat.totalTimeAi) }, { color: '#767fff', value: timeTool(stat.totalTimeAi) },
@ -112,26 +112,26 @@ async function fecthStudyTimeStat() {
{ color: '#E9605D', value: timeTool(stat.totalTimeWordRecord) }, { color: '#E9605D', value: timeTool(stat.totalTimeWordRecord) },
{ color: '#F2B058', value: timeTool(stat.totalTimeWordTest) }, { color: '#F2B058', value: timeTool(stat.totalTimeWordTest) },
{ color: '#A6E3FC', value: timeTool(stat.totalTimeSentenceRecord) }, { color: '#A6E3FC', value: timeTool(stat.totalTimeSentenceRecord) },
]; ]
learningTime.value.series[0].data = [ learningTime.value.series[0].data = [
{ color: '#83C400', value: timeTool(stat.totalTimeFree), text: stat.totalTimeFree }, { color: '#83C400', value: timeTool(stat.totalTimeFree), text: stat.totalTimeFree },
{ color: '#767fff', value: timeTool(stat.totalTimeAi) }, { color: '#767fff', value: timeTool(stat.totalTimeAi) },
{ color: '#F59DF5', value: timeTool(stat.totalTimeError) }, { color: '#F59DF5', value: timeTool(stat.totalTimeError) },
]; ]
} finally { } finally {
loading.value = false; loading.value = false
} }
} }
async function handleFilterDate(i) { async function handleFilterDate(i) {
dateType.value = i.value; dateType.value = i.value
fecthStudyTimeStat(); fecthStudyTimeStat()
} }
watch( watch(
() => props.subjectId, () => props.subjectId,
val => { val => {
_subjectId.value = val; _subjectId.value = val
dateType.value = 0; dateType.value = 0
fecthStudyTimeStat(); fecthStudyTimeStat()
}, },
); )
</script> </script>

View File

@ -70,28 +70,28 @@
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, onMounted, watch } from 'vue'; import { ref, reactive, onMounted, watch } from 'vue'
import DateFilter from './dateFilter.vue'; import DateFilter from './dateFilter.vue'
import '../index.scss'; import '../index.scss'
import { videoStudyStatApi } from '@/api'; import { videoStudyStatApi } from '@/api'
import dayjs from 'dayjs'; import dayjs from 'dayjs'
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
subjectId: number | string; subjectId: number | string
userId: string; userId: string
}>(), }>(),
{ {
subjectId: 0, subjectId: 0,
userId: '', userId: '',
}, },
); )
const emits = defineEmits(['change']); const emits = defineEmits(['change'])
const OSS_URL = import.meta.env.VITE_OSS_HOST; const OSS_URL = import.meta.env.VITE_OSS_HOST
const empty = ref(false); const empty = ref(false)
const dateType = ref(0); const dateType = ref(0)
const loading = ref(false); const loading = ref(false)
const opts = ref({ const opts = ref({
padding: [15, 20, 0, 15], padding: [15, 20, 0, 15],
enableScroll: false, enableScroll: false,
@ -125,7 +125,7 @@ const opts = ref({
labelBgOpacity: 1, labelBgOpacity: 1,
}, },
}, },
}); })
const showData = ref({ const showData = ref({
videoCount: '', videoCount: '',
videoCountRatio: '', videoCountRatio: '',
@ -138,7 +138,7 @@ const showData = ref({
videoTime: '0', videoTime: '0',
}, },
], ],
}); })
const videoLearning = ref({ const videoLearning = ref({
categories: [], categories: [],
@ -149,57 +149,57 @@ const videoLearning = ref({
color: '#9789ff', color: '#9789ff',
}, },
], ],
}); })
async function fetchChartData() { async function fetchChartData() {
if (props.subjectId === 0) { if (props.subjectId === 0) {
empty.value = true; empty.value = true
return; return
} }
empty.value = false; empty.value = false
try { try {
loading.value = true; loading.value = true
const { data } = await videoStudyStatApi({ const data = await videoStudyStatApi({
dateType: dateType.value, dateType: dateType.value,
subjectId: props.subjectId, subjectId: props.subjectId,
userId: props.userId, userId: props.userId,
}); })
showData.value = data; showData.value = data
videoLearning.value.categories = []; videoLearning.value.categories = []
let chartData = []; let chartData = []
for (let i in data.videoRecordVoList) { for (let i in data.videoRecordVoList) {
videoLearning.value.categories[i] = dayjs(data.videoRecordVoList[i].studyDate).format( videoLearning.value.categories[i] = dayjs(data.videoRecordVoList[i].studyDate).format(
'YYYY/MM/DD', 'YYYY/MM/DD',
); )
chartData[i] = data.videoRecordVoList[i].videoTime; chartData[i] = data.videoRecordVoList[i].videoTime
} }
videoLearning.value.series[0].data = chartData; videoLearning.value.series[0].data = chartData
} finally { } finally {
loading.value = false; loading.value = false
} }
} }
async function handleFilterDate(i) { async function handleFilterDate(i) {
dateType.value = i.value; dateType.value = i.value
fetchChartData(); fetchChartData()
} }
function timeTool(second: string | number, isminute = false) { function timeTool(second: string | number, isminute = false) {
const seconds = Number(second); const seconds = Number(second)
let h: number | string = Math.floor(seconds / 3600); let h: number | string = Math.floor(seconds / 3600)
let m: number | string = Math.floor((seconds % 3600) / 60); let m: number | string = Math.floor((seconds % 3600) / 60)
// //
h = h < 10 ? '0' + h : h; h = h < 10 ? '0' + h : h
m = m < 10 ? '0' + m : m; m = m < 10 ? '0' + m : m
return isminute ? m : h; return isminute ? m : h
} }
watch( watch(
() => props.subjectId, () => props.subjectId,
val => { val => {
dateType.value = 0; dateType.value = 0
fetchChartData(); fetchChartData()
}, },
); )
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title2 { .title2 {

View File

@ -82,10 +82,10 @@ function tapFilterSubject(i: SubjectType) {
// //
async function getParentBindChild() { async function getParentBindChild() {
const { data } = await getParentBindChildApi({ parentId: userInfo.value.id, size: -1 }) const data = await getParentBindChildApi({ parentId: userInfo.value.id, size: -1 })
empty.value = data.rows.length === 0 ? true : false empty.value = data.rows?.length ? true : false
childrenList.value = data.rows childrenList.value = data.rows
showChildrenInfo.value = data.rows[0] showChildrenInfo.value = data.rows?.[0]
} }
// //
async function getSubject() { async function getSubject() {
@ -94,7 +94,7 @@ async function getSubject() {
subjectList.value = [] subjectList.value = []
return return
} }
const { data } = await subjectApi(showChildrenInfo.value.gradeId) const data = await subjectApi(showChildrenInfo.value.gradeId)
subjectList.value = data subjectList.value = data
chooseSubject.value = data[0] chooseSubject.value = data[0]
} }

View File

@ -248,7 +248,7 @@ async function getParentBindDevice() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}) })
const { data } = await getParentBindDeviceApi({ parentId: userInfo.value.id, size: -1 }) const data = await getParentBindDeviceApi({ parentId: userInfo.value.id, size: -1 })
equipEmpty.value = data.rows.length === 0 equipEmpty.value = data.rows.length === 0
for (let i in data.rows) { for (let i in data.rows) {
const _r = await deviceCurrentLogin(data.rows[i].id) const _r = await deviceCurrentLogin(data.rows[i].id)
@ -267,7 +267,7 @@ async function getParentBindDevice() {
} }
// //
async function deviceCurrentLogin(id: string) { async function deviceCurrentLogin(id: string) {
const { data } = await parentDeviceCurrentLoginApi(id) const data = await parentDeviceCurrentLoginApi(id)
return data return data
} }
// //
@ -278,7 +278,7 @@ async function fetchAppRecord() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}) })
const { data } = await queryAppRecordApi(showEquipment.value.simSerialNumber) const data = await queryAppRecordApi(showEquipment.value.simSerialNumber)
const res = data.filter(i => i.systemApp === 0) const res = data.filter(i => i.systemApp === 0)
equipAppList.value = res equipAppList.value = res
appEmpty.value = res.length === 0 appEmpty.value = res.length === 0

View File

@ -35,7 +35,7 @@ function queryList(pageNo: number, pageSize: number) {
current: pageNo, current: pageNo,
simSerialNumber: simSerialNumber.value, simSerialNumber: simSerialNumber.value,
}).then(res => { }).then(res => {
paging.value.complete(res.data.rows); paging.value.complete(res.rows);
}); });
} }

View File

@ -31,7 +31,7 @@ async function handleMachineScreen() {
uni.showLoading({ uni.showLoading({
title: `${screenControlInfo?.value.lockFlag === 1}` ? '解屏中...' : '锁屏中...', title: `${screenControlInfo?.value.lockFlag === 1}` ? '解屏中...' : '锁屏中...',
}); });
const { data } = await lockDeviceScreenApi(simSerialNumber.value); const data = await lockDeviceScreenApi(simSerialNumber.value);
fetchDeviceScreen(); fetchDeviceScreen();
} finally { } finally {
uni.hideLoading(); uni.hideLoading();
@ -42,7 +42,7 @@ async function fetchDeviceScreen() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); });
const { data } = await getDeviceScreenControlApi(simSerialNumber.value); const data = await getDeviceScreenControlApi(simSerialNumber.value);
screenControlInfo.value = data ? data : {}; screenControlInfo.value = data ? data : {};
} finally { } finally {
uni.hideLoading(); uni.hideLoading();

View File

@ -509,7 +509,7 @@ async function fetchDeviceScreen() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}) })
const { data } = await getDeviceScreenControlApi(simSerialNumber.value) const data = await getDeviceScreenControlApi(simSerialNumber.value)
if (!data) return if (!data) return
cellData[0].show = data.usageFlag === 1 ? true : false cellData[0].show = data.usageFlag === 1 ? true : false
cellData[1].show = data.eyeFlag === 1 ? true : false cellData[1].show = data.eyeFlag === 1 ? true : false

View File

@ -140,30 +140,30 @@ async function getAdminInfoFun() {
await adminInfo({ await adminInfo({
simSerialNumber: parameterData.simSerialNumber, simSerialNumber: parameterData.simSerialNumber,
}).then(res => { }).then(res => {
deviceManager.value.adminUserAvatar = res.data.adminUserAvatar deviceManager.value.adminUserAvatar = res.adminUserAvatar
deviceManager.value.adminUserName = res.data.adminUserName deviceManager.value.adminUserName = res.adminUserName
}) })
} else if (parameterData.type === 2) { } else if (parameterData.type === 2) {
// //
await adminInfo({ await adminInfo({
childUserId: parameterData.childUserId, childUserId: parameterData.childUserId,
}).then(res => { }).then(res => {
parentManager.value.adminUserAvatar = res.data.adminUserAvatar parentManager.value.adminUserAvatar = res.adminUserAvatar
parentManager.value.adminUserName = res.data.adminUserName parentManager.value.adminUserName = res.adminUserName
}) })
} else { } else {
// //
await adminInfo({ await adminInfo({
childUserId: parameterData.childUserId, childUserId: parameterData.childUserId,
}).then(res => { }).then(res => {
parentManager.value.adminUserAvatar = res.data.adminUserAvatar parentManager.value.adminUserAvatar = res.adminUserAvatar
parentManager.value.adminUserName = res.data.adminUserName parentManager.value.adminUserName = res.adminUserName
}) })
await adminInfo({ await adminInfo({
simSerialNumber: parameterData.simSerialNumber, simSerialNumber: parameterData.simSerialNumber,
}).then(res => { }).then(res => {
deviceManager.value.adminUserAvatar = res.data.adminUserAvatar deviceManager.value.adminUserAvatar = res.adminUserAvatar
deviceManager.value.adminUserName = res.data.adminUserName deviceManager.value.adminUserName = res.adminUserName
}) })
} }
} }

View File

@ -68,7 +68,7 @@ function getApplyInfo(e) {
applyInfo({ applyInfo({
id: e, id: e,
}).then(res => { }).then(res => {
infoData.value = res.data; infoData.value = res;
}); });
} finally { } finally {
uni.hideLoading(); uni.hideLoading();

View File

@ -220,7 +220,7 @@ async function subFun() {
// //
async function handleParentBindAmin(obj, isTwo?: boolean) { async function handleParentBindAmin(obj, isTwo?: boolean) {
const res = await parentBindAdmin(obj); const res = await parentBindAdmin(obj);
type.value = res.data; type.value = res;
showSuccessPopup.value = true; showSuccessPopup.value = true;
switch (type.value) { switch (type.value) {
case 0: // case 0: //

View File

@ -254,8 +254,8 @@ async function determine() {
} }
const res = await parentBindAdmin(_obj) const res = await parentBindAdmin(_obj)
showSuccessPopup.value = true showSuccessPopup.value = true
successPopupText.value = res.data === 6 ? '您已成为设备管理员' : '请稍后再进行尝试~' successPopupText.value = res === 6 ? '您已成为设备管理员' : '请稍后再进行尝试~'
bindType.value = res.data === 6 ? 'success' : 'fail' bindType.value = res === 6 ? 'success' : 'fail'
} }
} else { } else {
router.navigateTo({ router.navigateTo({
@ -293,7 +293,7 @@ async function fetchCurBindInfo() {
title: '加载中...', title: '加载中...',
mask: true, mask: true,
}) })
const { data } = await getCurInfo({ const data = await getCurInfo({
parentUerId: userInfo.value.id, parentUerId: userInfo.value.id,
simSerialNumber: QRCode.value, // simSerialNumber: QRCode.value, //
childUserId: childUserIds.value, // childUserId: childUserIds.value, //

View File

@ -84,7 +84,7 @@ const inputFouse = async () => {
} }
async function send() { async function send() {
const { code, data } = await saveTalk({ const data = await saveTalk({
senderId: userInfo.value.userId, senderId: userInfo.value.userId,
// inspectorPlanId: stuData.value.inspectorPlanId, // inspectorPlanId: stuData.value.inspectorPlanId,
receiverId: stuData.value.sender === 2 ? stuData.value.senderId : stuData.value.receiverId, receiverId: stuData.value.sender === 2 ? stuData.value.senderId : stuData.value.receiverId,
@ -92,7 +92,6 @@ async function send() {
sender: 1, sender: 1,
messageContent: content.value, messageContent: content.value,
}) })
if (code === 200) {
const msg = { const msg = {
id: data.id, id: data.id,
senderId: userInfo.value.userId, senderId: userInfo.value.userId,
@ -128,7 +127,6 @@ async function send() {
row.value = 'item-' + (chatList.value.length - 1) row.value = 'item-' + (chatList.value.length - 1)
}, 500) }, 500)
}) })
}
} }
// //
@ -153,13 +151,10 @@ async function getDetails() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}) })
const { code, data } = await getTalkDetails({ const data = await getTalkDetails({
inspectorTalkRecordId: chatList.value[0]?.id ?? (chatList.value[1]?.id || undefined), inspectorTalkRecordId: chatList.value[0]?.id ?? (chatList.value[1]?.id || undefined),
userId: stuData.value.sender === 2 ? stuData.value.senderId : stuData.value.receiverId, userId: stuData.value.sender === 2 ? stuData.value.senderId : stuData.value.receiverId,
}) })
uni.hideLoading()
uni.stopPullDownRefresh()
if (code === 200) {
const ids = chatList.value.filter(item => item.status === 1).map(item => item.id) const ids = chatList.value.filter(item => item.status === 1).map(item => item.id)
if (ids.length) { if (ids.length) {
readMsg({ readMsg({
@ -175,8 +170,7 @@ async function getDetails() {
} }
return { ...v } return { ...v }
}) })
} } finally {
} catch (error) {
uni.hideLoading() uni.hideLoading()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
} }

View File

@ -49,15 +49,14 @@ async function getTalkData() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}) })
const { code, data } = await getTalkList({ current: current.value }) const data = await getTalkList({ current: current.value })
uni.hideLoading()
if (code === 200) {
list.value = data.rows list.value = data.rows
if (data.rows.length < 10) { if (data.rows.length < 10) {
state.value = 'finished' state.value = 'finished'
} }
} finally {
uni.hideLoading()
} }
} catch (error) {}
} }
// //
function toDetails(row: any) { function toDetails(row: any) {

View File

@ -37,7 +37,7 @@ provide('userInfo', userInfo);
const queryData = async () => { const queryData = async () => {
try { try {
loading.value = true; loading.value = true;
const { data } = await getUserInfo(); const data = await getUserInfo();
userInfo.value = Object.assign(data, { role: '督学师' }); userInfo.value = Object.assign(data, { role: '督学师' });
} finally { } finally {
loading.value = false; loading.value = false;

View File

@ -70,7 +70,7 @@ const roleList = ref<any[]>([])
const { getUserInfo: getLoginUserInfo } = user() const { getUserInfo: getLoginUserInfo } = user()
const queryRole = async () => { const queryRole = async () => {
const { data } = await queryUserRoles({ phone: userInfo.value.phone }) const data = await queryUserRoles({ phone: userInfo.value.phone })
roleList.value = (data ?? []).map(item => { roleList.value = (data ?? []).map(item => {
return { return {
text: '家长', // item.adminType === 16 ? '' : '', text: '家长', // item.adminType === 16 ? '' : '',
@ -126,13 +126,13 @@ const showRole = () => {
const selectRole = async item => { const selectRole = async item => {
userInfo.value.role = item.text userInfo.value.role = item.text
const res = await switchRole(item.value) const res = await switchRole(item.value)
db.set('token', res.data) db.set('token', res)
const data = await getLoginUserInfo() const data = await getLoginUserInfo()
if (!data.openid) { if (!data.openid) {
// //
const authRes = await getAuthUrlApi() const authRes = await getAuthUrlApi()
// #ifdef H5 // #ifdef H5
window.location.href = authRes.data window.location.href = authRes
// #endif // #endif
// if (data.adminType === 16) { // if (data.adminType === 16) {
// const authRes = await getAuthUrlApi(); // const authRes = await getAuthUrlApi();
@ -145,7 +145,7 @@ const selectRole = async item => {
// }); // });
// } // }
} else { } else {
let adminType = db.get('userInfo').adminType let adminType = db.get<any>('userInfo').adminType
uni.reLaunch({ uni.reLaunch({
url: '/pages/home/index', url: '/pages/home/index',
}) })

View File

@ -96,15 +96,8 @@ function chooseUploadMethod(i: any) {
uni.showLoading({ uni.showLoading({
title: '上传中...', title: '上传中...',
}) })
const { code, data } = await uploadFile(res.tempFiles[0]) const data = await uploadFile(res.tempFiles[0])
uni.hideLoading()
if (code === 200) {
rowData.value.url = data.filePath rowData.value.url = data.filePath
} else {
uni.showToast({
title: '上传失败,请重试',
})
}
}, },
fail: err => { fail: err => {
// //

View File

@ -13,38 +13,37 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue'
import { uploadFile } from '@/api/modules/inspector'; import { uploadFile } from '@/api/modules/inspector'
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app'
import { usepersonalStoreHook } from '@/store/inspector'; import { usepersonalStoreHook } from '@/store/inspector'
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue'; import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue'
const cropImg = ref(''); import router from '@/router/router'
const cropImg = ref('')
function dataURLtoFile(dataurl, filename) { function dataURLtoFile(dataurl, filename) {
let arr = dataurl.split(','); let arr = dataurl.split(',')
let mime = arr[0].match(/:(.*?);/)[1]; let mime = arr[0].match(/:(.*?);/)[1]
let bstr = atob(arr[1]); let bstr = atob(arr[1])
let n = bstr.length; let n = bstr.length
let u8arr = new Uint8Array(n); let u8arr = new Uint8Array(n)
while (n--) { while (n--) {
u8arr[n] = bstr.charCodeAt(n); u8arr[n] = bstr.charCodeAt(n)
} }
return new File([u8arr], filename, { type: mime }); return new File([u8arr], filename, { type: mime })
} }
async function handleCrop(e) { async function handleCrop(e) {
const file = dataURLtoFile(e.tempFilePath, String(Date.now())); const file = dataURLtoFile(e.tempFilePath, String(Date.now()))
const { code, data } = await uploadFile(file); const data = await uploadFile(file)
if (code === 200) { usepersonalStoreHook().SET_AVATAR(data.filePath)
usepersonalStoreHook().SET_AVATAR(data.filePath); router.navigateBack({
uni.navigateBack({
delta: 1, delta: 1,
}); })
}
} }
onLoad(option => { onLoad(option => {
cropImg.value = option.file; cropImg.value = option.file
uni.setNavigationBarColor({ uni.setNavigationBarColor({
frontColor: '#ffffff', // frontColor: '#ffffff', //
backgroundColor: '#2d2d2d', // backgroundColor: '#2d2d2d', //
}); })
}); })
</script> </script>

View File

@ -181,35 +181,35 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { user } from '@/store'; import { user } from '@/store'
const { logout } = user(); const { logout } = user()
import { onLaunch, onShow, onHide, onLoad } from '@dcloudio/uni-app'; import { onLaunch, onShow, onHide, onLoad } from '@dcloudio/uni-app'
import { usepersonalStoreHook } from '@/store/inspector'; import { usepersonalStoreHook } from '@/store/inspector'
import Picker from '../releasePlan/components/picker.vue'; import Picker from '../releasePlan/components/picker.vue'
import { getUserInfo, updateTeacherInfo } from '@/api/modules/inspector'; import { getUserInfo, updateTeacherInfo } from '@/api/modules/inspector'
import { ref, reactive, nextTick, onMounted } from 'vue'; import { ref, reactive, nextTick, onMounted } from 'vue'
import router from '@/router/router'; import router from '@/router/router'
import { removeCache } from '@/utils'; import { removeCache } from '@/utils'
const OSS_URL = import.meta.env.VITE_OSS_HOST; const OSS_URL = import.meta.env.VITE_OSS_HOST
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`; const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`
const arrow = `${OSS_URL}/iconfont/down_arrow.png`; const arrow = `${OSS_URL}/iconfont/down_arrow.png`
const form = ref<any>({}); const form = ref<any>({})
const popupRef = ref(); const popupRef = ref()
const pikerIndex = ref(0); const pikerIndex = ref(0)
const popupTitle = ref(''); const popupTitle = ref('')
const currentIndex = ref(); const currentIndex = ref()
const selectionPopupRef = ref(); const selectionPopupRef = ref()
const qualification = ref<any[]>([]); const qualification = ref<any[]>([])
const formStore = usepersonalStoreHook(); const formStore = usepersonalStoreHook()
const showPopup = ref(false); const showPopup = ref(false)
const hasQuery = ref(false); const hasQuery = ref(false)
const columns = [ const columns = [
{ name: '大专', value: '大专' }, { name: '大专', value: '大专' },
{ name: '本科', value: '本科' }, { name: '本科', value: '本科' },
{ name: '研究生', value: '研究生' }, { name: '研究生', value: '研究生' },
{ name: '博士', value: '博士' }, { name: '博士', value: '博士' },
{ name: '其他', value: '其他' }, { name: '其他', value: '其他' },
]; ]
const pickList = ref([ const pickList = ref([
{ {
name: '从相册选择', name: '从相册选择',
@ -221,49 +221,49 @@ const pickList = ref([
type: 2, type: 2,
sourceType: 'camera', sourceType: 'camera',
}, },
]); ])
// //
const subjectList = ref([{ name: '数学' }, { name: '语文' }]); const subjectList = ref([{ name: '数学' }, { name: '语文' }])
const handSelect = (type: string) => { const handSelect = (type: string) => {
switch (type) { switch (type) {
case 'subject': case 'subject':
popupTitle.value = '请选择擅长科目'; popupTitle.value = '请选择擅长科目'
break; break
} }
selectionPopupRef.value.open(); selectionPopupRef.value.open()
}; }
function confirmSelect(val: any) { function confirmSelect(val: any) {
form.value.degree = val.value; form.value.degree = val.value
showPopup.value = false; showPopup.value = false
} }
const bindPickerChange = (e: any) => { const bindPickerChange = (e: any) => {
currentIndex.value = e.detail.value; currentIndex.value = e.detail.value
}; }
function handlePreview() { function handlePreview() {
if (!form.value.personalPhoto) return; if (!form.value.personalPhoto) return
uni.previewImage({ uni.previewImage({
urls: [form.value.personalPhoto], urls: [form.value.personalPhoto],
current: 0, current: 0,
}); })
} }
function addQualification() { function addQualification() {
router.navigateTo('/pages/inspector/personalData/certificateAdd'); router.navigateTo('/pages/inspector/personalData/certificateAdd')
} }
function chooseUploadMethod(i: any) { function chooseUploadMethod(i: any) {
popupRef.value.close(); popupRef.value.close()
uni.chooseImage({ uni.chooseImage({
count: 1, // count: 1, //
sizeType: ['compressed', 'original'], // original compressed sizeType: ['compressed', 'original'], // original compressed
sourceType: [i.sourceType], // album camera 使 sourceType: [i.sourceType], // album camera 使
success: res => { success: res => {
jumpPage(`/pages/inspector/personalData/cropper?file=${res.tempFilePaths[0]}`); jumpPage(`/pages/inspector/personalData/cropper?file=${res.tempFilePaths[0]}`)
}, },
fail: err => { fail: err => {
// //
console.log('chooseImage fail', err); console.log('chooseImage fail', err)
}, },
}); })
} }
// //
function uploadImage() { function uploadImage() {
@ -272,27 +272,27 @@ function uploadImage() {
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
// album camera 使使 // album camera 使使
success: (res: any) => { success: (res: any) => {
console.log(res, '图片'); console.log(res, '图片')
// //
res.tempFilePaths.map((item: any) => form.value.qualification.push(item)); res.tempFilePaths.map((item: any) => form.value.qualification.push(item))
}, },
fail: err => { fail: err => {
// //
console.log('chooseImage fail', err); console.log('chooseImage fail', err)
}, },
}); })
} }
// //
function previewImg(idx: number) { function previewImg(idx: number) {
uni.previewImage({ uni.previewImage({
current: idx, current: idx,
urls: form.value.qualification, urls: form.value.qualification,
}); })
} }
// //
function deleteImg(i: number) { function deleteImg(i: number) {
form.value.qualification.splice(i, 1); form.value.qualification.splice(i, 1)
} }
// //
function loadUploadIcon(e: any) { function loadUploadIcon(e: any) {
@ -303,13 +303,13 @@ function errorUploadIcon() {
// wx.hideLoading(); // wx.hideLoading();
} }
function back() { function back() {
router.navigateBack(); router.navigateBack()
} }
const clsoePopup = () => { const clsoePopup = () => {
popupRef.value.close(); popupRef.value.close()
}; }
function checkedForm() { function checkedForm() {
let valid = true; let valid = true
const fields = [ const fields = [
'personalPhoto', 'personalPhoto',
'phone', 'phone',
@ -318,13 +318,13 @@ function checkedForm() {
'personalInformation', 'personalInformation',
'degree', 'degree',
'gradSchool', 'gradSchool',
]; ]
fields.forEach(item => { fields.forEach(item => {
if (!form.value[item]) { if (!form.value[item]) {
valid = false; valid = false
} }
}); })
return valid; return valid
} }
// //
async function submitSave() { async function submitSave() {
@ -332,62 +332,61 @@ async function submitSave() {
uni.showToast({ uni.showToast({
title: '请完善资料后再保存', title: '请完善资料后再保存',
icon: 'none', icon: 'none',
}); })
return; return
} }
try { try {
uni.showLoading({ uni.showLoading({
title: '保存中...', title: '保存中...',
mask: true, mask: true,
}); })
const { code } = await updateTeacherInfo(form.value); const { code } = await updateTeacherInfo(form.value)
uni.hideLoading(); uni.hideLoading()
if (code === 200) { if (code === 200) {
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
mask: true, mask: true,
}); })
setTimeout(() => { setTimeout(() => {
router.navigateTo('/pages/inspector/mine/index'); router.navigateTo('/pages/inspector/mine/index')
}, 1500); }, 1500)
} }
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading()
} }
} }
// //
const jumpPage = (path: string) => { const jumpPage = (path: string) => {
formStore.SET_FORM(form.value); formStore.SET_FORM(form.value)
router.navigateTo({ router.navigateTo({
path: path, path: path,
}); })
}; }
// //
async function getData() { async function getData() {
try { try {
uni.showLoading({ title: '加载中...' }); uni.showLoading({ title: '加载中...' })
const { code, data } = await getUserInfo(); const data = await getUserInfo()
if (code === 200) { hasQuery.value = true
hasQuery.value = true; form.value = { ...data }
form.value = { ...data }; formStore.SET_FORM(form.value)
formStore.SET_FORM(form.value); pikerIndex.value = columns.findIndex(e => e.value === data.degree)
pikerIndex.value = columns.findIndex(e => e.value === data.degree); } finally {
uni.hideLoading()
} }
uni.hideLoading();
} catch (error) {}
} }
async function handLogout() { async function handLogout() {
logout(); logout()
} }
onMounted(() => { onMounted(() => {
if (!hasQuery.value) getData(); if (!hasQuery.value) getData()
}); })
onShow(() => { onShow(() => {
const personalData = formStore.form; const personalData = formStore.form
if (personalData) { if (personalData) {
form.value = personalData; form.value = personalData
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {

View File

@ -100,7 +100,7 @@ const selectedItem = async (item) => {
try { try {
if ((knowledgeFlag.value[item.value] ?? "") === "") { if ((knowledgeFlag.value[item.value] ?? "") === "") {
await uni.showLoading() await uni.showLoading()
const {data} = await getKnowledgeFlag(item.value) const data = await getKnowledgeFlag(item.value)
knowledgeFlag.value[item.value] = data knowledgeFlag.value[item.value] = data
uni.hideLoading() uni.hideLoading()
} }

View File

@ -307,33 +307,27 @@ function removeConfirm() {
} }
// //
async function getDate() { async function getDate() {
const { code, data } = await getCourseData({ id: user.value.userId }) const data = await getCourseData({ id: user.value.userId })
if (code === 200) {
canlenderList.value = data || [] canlenderList.value = data || []
}
} }
// //
async function getSubjectList() { async function getSubjectList() {
const { code, data } = await getSubject({ gradeId: user.value.gradeId }) const data = await getSubject({ gradeId: user.value.gradeId })
if (code === 200) {
subjectData.value = data.map((item: any) => { subjectData.value = data.map((item: any) => {
return { return {
name: item.subject, name: item.subject,
value: item.subjectId, value: item.subjectId,
} }
}) })
}
} }
// //
async function getStuPlanData() { async function getStuPlanData() {
try { try {
uni.showLoading({ title: '加载中...' }) uni.showLoading({ title: '加载中...' })
const { code, data } = await getStuPlan({ const data = await getStuPlan({
userId: user.value.userId, userId: user.value.userId,
courseDate: user.value.courseDate ?? '', courseDate: user.value.courseDate ?? '',
}) })
uni.hideLoading()
if (code === 200) {
form.value.courseId = data.courseId ? data.courseId : plan.value.courseId form.value.courseId = data.courseId ? data.courseId : plan.value.courseId
form.value.date = data.courseDate form.value.date = data.courseDate
? dayjs(data.courseDate).format('YYYY-MM-DD') ? dayjs(data.courseDate).format('YYYY-MM-DD')
@ -362,8 +356,7 @@ async function getStuPlanData() {
} else { } else {
uni.removeStorageSync('plan') uni.removeStorageSync('plan')
} }
} } finally {
} catch (error) {
uni.hideLoading() uni.hideLoading()
} }
} }

View File

@ -90,17 +90,13 @@ async function getBooksData(params: any) {
title: '加载中...', title: '加载中...',
}) })
state.value = 'loading' state.value = 'loading'
const { code, data } = await getBooks(params) const data = await getBooks(params)
uni.hideLoading()
if (code === 200) {
books.value = [...books.value, ...data.rows] books.value = [...books.value, ...data.rows]
state.value = data.rows.length < 10 ? 'finished' : 'loading' state.value = data.rows.length < 10 ? 'finished' : 'loading'
} else {
state.value = 'error'
}
} catch (error) { } catch (error) {
state.value = 'error' state.value = 'error'
} finally {
uni.hideLoading() uni.hideLoading()
} }
} }

View File

@ -35,36 +35,36 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import radio from '@/static/svg/radio.svg'; import radio from '@/static/svg/radio.svg'
import { getChaper, getKnowledge, getKnowledgeVideo } from '@/api/modules/inspector'; import { getChaper, getKnowledge, getKnowledgeVideo } from '@/api/modules/inspector'
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue'
import MultiplePicker from './components/MultiplePicker.vue'; import MultiplePicker from './components/MultiplePicker.vue'
const selectId = ref<number>(-1); const selectId = ref<number>(-1)
const selection = ref<any>({}); const selection = ref<any>({})
const plan = ref<any>({}); const plan = ref<any>({})
const chaperTree = ref<any[]>([]); const chaperTree = ref<any[]>([])
const knowledgeList = ref<any[]>([{ value: 0, name: '知识点1' }]); const knowledgeList = ref<any[]>([{ value: 0, name: '知识点1' }])
const showPicker = ref(false); const showPicker = ref(false)
function select(row: any) { function select(row: any) {
selectId.value = row.id; selectId.value = row.id
selection.value = row; selection.value = row
} }
const taskType = ref<number>(0); const taskType = ref<number>(0)
function clickNext() { function clickNext() {
if (selectId.value === -1) { if (selectId.value === -1) {
uni.showToast({ uni.showToast({
title: '请先选择章节再进行下一步', title: '请先选择章节再进行下一步',
icon: 'none', icon: 'none',
duration: 3000, duration: 3000,
}); })
return; return
} }
if (taskType.value === 0) { if (taskType.value === 0) {
getVideoList(); getVideoList()
} else { } else {
getKnowledgeList(); getKnowledgeList()
} }
} }
// //
@ -72,14 +72,11 @@ async function getChaperList() {
try { try {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); })
const { code, data } = await getChaper({ textBookId: plan.value.row.bookId }); const data = await getChaper({ textBookId: plan.value.row.bookId })
if (code === 200) { chaperTree.value = data || []
chaperTree.value = data || []; } finally {
} uni.hideLoading()
uni.hideLoading();
} catch (error) {
uni.hideLoading();
} }
} }
// //
@ -87,30 +84,30 @@ async function getVideoList() {
try { try {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); })
const { data } = await getKnowledgeVideo(selectId.value); const data = await getKnowledgeVideo(selectId.value)
console.log(data.rows); console.log(data.rows)
if (data.rows.length) { if (data.rows.length) {
uni.setStorageSync('videoList', data.rows); uni.setStorageSync('videoList', data.rows)
plan.value.planList[plan.value.index] = { plan.value.planList[plan.value.index] = {
...plan.value.planList[plan.value.index], ...plan.value.planList[plan.value.index],
chapterId: selectId.value, chapterId: selectId.value,
chapterName: selection.value.chapterName || selection.value.name, chapterName: selection.value.chapterName || selection.value.name,
}; }
uni.setStorageSync('plan', plan.value); uni.setStorageSync('plan', plan.value)
await uni.navigateTo({ await uni.navigateTo({
url: '/pages/inspector/releasePlan/selectVideo', url: '/pages/inspector/releasePlan/selectVideo',
}); })
} else { } else {
uni.showToast({ uni.showToast({
title: '该章节暂无视频', title: '该章节暂无视频',
icon: 'none', icon: 'none',
duration: 3000, duration: 3000,
}); })
} }
uni.hideLoading(); uni.hideLoading()
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading()
} }
} }
// //
@ -119,22 +116,21 @@ async function getKnowledgeList() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask: true, mask: true,
}); })
const { code, data } = await getKnowledge({ chapterId: selectId.value }); const data = await getKnowledge({ chapterId: selectId.value })
uni.hideLoading();
knowledgeList.value = data.map((item: any) => { knowledgeList.value = data.map((item: any) => {
return { return {
name: item.name, name: item.name,
value: item.id, value: item.id,
};
});
if (knowledgeList.value.length === 0) {
uni.showToast({ title: '该章节没有知识点', icon: 'none' });
return;
} }
showPicker.value = true; })
} catch (error) { if (knowledgeList.value.length === 0) {
uni.hideLoading(); uni.showToast({ title: '该章节没有知识点', icon: 'none' })
return
}
showPicker.value = true
} finally {
uni.hideLoading()
} }
} }
function confirmSelect(val: any) { function confirmSelect(val: any) {
@ -144,15 +140,15 @@ function confirmSelect(val: any) {
chapterName: selection.value.name, chapterName: selection.value.name,
courseTimeId: item.value, courseTimeId: item.value,
courseTimeName: item.name, courseTimeName: item.name,
}; }
}); })
plan.value.planList[plan.value.index] = { plan.value.planList[plan.value.index] = {
...plan.value.planList[plan.value.index], ...plan.value.planList[plan.value.index],
chapterId: data[0].chapterId, chapterId: data[0].chapterId,
chapterName: data[0].chapterName, chapterName: data[0].chapterName,
courseTimeId: data[0].courseTimeId, courseTimeId: data[0].courseTimeId,
courseTimeName: data[0].courseTimeName, courseTimeName: data[0].courseTimeName,
}; }
data.slice(1).forEach(item => { data.slice(1).forEach(item => {
plan.value.planList.push({ plan.value.planList.push({
...plan.value.planList[plan.value.index], ...plan.value.planList[plan.value.index],
@ -160,20 +156,20 @@ function confirmSelect(val: any) {
chapterName: item.chapterName, chapterName: item.chapterName,
courseTimeId: item.courseTimeId, courseTimeId: item.courseTimeId,
courseTimeName: item.courseTimeName, courseTimeName: item.courseTimeName,
}); })
}); })
plan.value.row = plan.value.planList[plan.value.index]; plan.value.row = plan.value.planList[plan.value.index]
console.log(plan.value.planList); console.log(plan.value.planList)
uni.setStorageSync('plan', plan.value); uni.setStorageSync('plan', plan.value)
uni.navigateTo({ url: '/pages/inspector/releasePlan/index' }); uni.navigateTo({ url: '/pages/inspector/releasePlan/index' })
} }
onMounted(() => { onMounted(() => {
plan.value = uni.getStorageSync('plan'); plan.value = uni.getStorageSync('plan')
taskType.value = plan.value?.row?.taskType ?? 0; taskType.value = plan.value?.row?.taskType ?? 0
getChaperList(); getChaperList()
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {

View File

@ -19,29 +19,29 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'; import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import { getPrecisionFlag } from '@/api/modules/inspector'; import { getPrecisionFlag } from '@/api/modules/inspector'
import video from '@/static/svg/video.svg'; import video from '@/static/svg/video.svg'
import radio from '@/static/svg/radio.svg'; import radio from '@/static/svg/radio.svg'
import exercise from '@/static/svg/exercise.svg'; import exercise from '@/static/svg/exercise.svg'
import study from '@/static/svg/study.svg'; import study from '@/static/svg/study.svg'
import sense from '@/static/svg/sense.svg'; import sense from '@/static/svg/sense.svg'
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue'
import Popup from './components/popup.vue'; import Popup from './components/popup.vue'
const showPopup = ref(false); const showPopup = ref(false)
const count = ref(1); const count = ref(1)
const list = ref<any[]>([ const list = ref<any[]>([
{ id: 0, imgUrl: video, width: '260rpx', height: '82rpx' }, { id: 0, imgUrl: video, width: '260rpx', height: '82rpx' },
{ id: 1, imgUrl: exercise, width: '260rpx', height: '82rpx' }, { id: 1, imgUrl: exercise, width: '260rpx', height: '82rpx' },
{ id: 2, imgUrl: study, width: '197rpx', height: '82rpx' }, { id: 2, imgUrl: study, width: '197rpx', height: '82rpx' },
// { id: 3, imgUrl: sense, width: '197rpx', height: '82rpx' }, // { id: 3, imgUrl: sense, width: '197rpx', height: '82rpx' },
]); ])
const plan = ref<any>({}); const plan = ref<any>({})
const labelText = ref('次数'); const labelText = ref('次数')
const planIndex = ref(); const planIndex = ref()
const selectId = ref<number>(-1); const selectId = ref<number>(-1)
function selcetPlan(id: number) { function selcetPlan(id: number) {
selectId.value = id; selectId.value = id
} }
async function clickNext() { async function clickNext() {
switch (selectId.value) { switch (selectId.value) {
@ -50,61 +50,61 @@ async function clickNext() {
title: '请选择任务再进行下一步', title: '请选择任务再进行下一步',
icon: 'none', icon: 'none',
duration: 3000, duration: 3000,
}); })
break; break
case 0: case 0:
setplanRow(); setplanRow()
uni.navigateTo({ url: '/pages/inspector/releasePlan/selectBook' }); uni.navigateTo({ url: '/pages/inspector/releasePlan/selectBook' })
break; break
case 1: case 1:
setplanRow(); setplanRow()
uni.navigateTo({ url: '/pages/inspector/releasePlan/selectBook' }); uni.navigateTo({ url: '/pages/inspector/releasePlan/selectBook' })
break; break
case 2: case 2:
PrecisionFlag(); PrecisionFlag()
break; break
case 3: case 3:
labelText.value = '次数'; labelText.value = '次数'
showPopup.value = true; showPopup.value = true
break; break
} }
} }
async function PrecisionFlag() { async function PrecisionFlag() {
const { code, data } = await getPrecisionFlag({ const data = await getPrecisionFlag({
subjectId: plan.value.row.subjectId, subjectId: plan.value.row.subjectId,
userId: plan.value.userId, userId: plan.value.userId,
}); })
if (code === 200 && data) { if (data) {
labelText.value = '次数'; labelText.value = '次数'
showPopup.value = true; showPopup.value = true
} else { } else {
uni.showToast({ uni.showToast({
title: '该学科所选教材没有练习题无法发布AI精准学任务', title: '该学科所选教材没有练习题无法发布AI精准学任务',
icon: 'none', icon: 'none',
duration: 3000, duration: 3000,
}); })
} }
} }
function setplanRow(num?: string | number) { function setplanRow(num?: string | number) {
let row = plan.value.planList[plan.value.index]; let row = plan.value.planList[plan.value.index]
row = { ...row, taskType: selectId.value, num }; row = { ...row, taskType: selectId.value, num }
plan.value.row = row; plan.value.row = row
plan.value.planList[plan.value.index] = row; plan.value.planList[plan.value.index] = row
uni.setStorageSync('plan', plan.value); uni.setStorageSync('plan', plan.value)
} }
function handleConfirm() { function handleConfirm() {
// //
const num = count.value; const num = count.value
setplanRow(num); setplanRow(num)
uni.navigateBack({ delta: 1 }); uni.navigateBack({ delta: 1 })
} }
onShow(() => { onShow(() => {
plan.value = uni.getStorageSync('plan'); plan.value = uni.getStorageSync('plan')
planIndex.value = plan.value.index; planIndex.value = plan.value.index
selectId.value = plan.value.row?.taskType; selectId.value = plan.value.row?.taskType
count.value = plan.value.row.num; count.value = plan.value.row.num
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {

View File

@ -118,59 +118,56 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import dayjs from 'dayjs'; import dayjs from 'dayjs'
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'; import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
import { onMounted, ref, watch } from 'vue'; import { onMounted, ref, watch } from 'vue'
import selectIcon from '/src/static/svg/select.svg'; import selectIcon from '/src/static/svg/select.svg'
import { condition, getUnreadCount } from '@/api/modules/inspector'; import { condition, getUnreadCount } from '@/api/modules/inspector'
import { useSocket } from '@/hooks/useSocket'; import { useSocket } from '@/hooks/useSocket'
const { init: socketInit, inspectorMessage, sendMsg, inspectorDesktopMessage } = useSocket(); const { init: socketInit, inspectorMessage, sendMsg, inspectorDesktopMessage } = useSocket()
const selectionIcon = selectIcon; const selectionIcon = selectIcon
const list = ref<any[]>([{ id: 0, fold: true, list: [{ id: 0 }, { id: 1 }] }]); const list = ref<any[]>([{ id: 0, fold: true, list: [{ id: 0 }, { id: 1 }] }])
const tagName = { const tagName = {
0: '自由学', 0: '自由学',
1: '自由学', 1: '自由学',
2: '精准学', 2: '精准学',
3: '语感训练', 3: '语感训练',
}; }
const tagClass = { const tagClass = {
0: 'yellow', 0: 'yellow',
1: 'yellow', 1: 'yellow',
2: 'blue', 2: 'blue',
3: 'red', 3: 'red',
}; }
const unreadCount = ref(0); const unreadCount = ref(0)
function padZero(value) { function padZero(value) {
return value < 10 ? `0${value}` : `${value}`; return value < 10 ? `0${value}` : `${value}`
} }
function timeFormat(time: string) { function timeFormat(time: string) {
return dayjs(time).format('HH:mm'); return dayjs(time).format('HH:mm')
} }
function jumpPage(path: string) { function jumpPage(path: string) {
uni.navigateTo({ uni.navigateTo({
url: path, url: path,
}); })
} }
const deskUserId = ref(''); const deskUserId = ref('')
const deskShotArr = ref([]); const deskShotArr = ref([])
async function getData() { async function getData() {
try { try {
uni.showLoading({ title: '加载中...' }); uni.showLoading({ title: '加载中...' })
const courseDate = uni.getStorageSync('courseDate'); const courseDate = uni.getStorageSync('courseDate')
const { code, data } = await condition({ courseDate }); const data = await condition({ courseDate })
uni.hideLoading(); deskUserId.value = data.map(item => item.userId).join()
if (code === 200) { sendMsg({ type: 'inspectorDesktopPreview', msg: deskUserId.value })
deskUserId.value = data.map(item => item.userId).join();
sendMsg({ type: 'inspectorDesktopPreview', msg: deskUserId.value });
list.value = (data || []).map(item => { list.value = (data || []).map(item => {
return { return {
...item, ...item,
fold: true, fold: true,
};
});
} }
} catch (error) { })
uni.hideLoading(); } finally {
uni.hideLoading()
} }
} }
function chat(row: any) { function chat(row: any) {
@ -179,53 +176,50 @@ function chat(row: any) {
receiverId: row.userId, receiverId: row.userId,
avatarUrl: row.avatarUrl, avatarUrl: row.avatarUrl,
nickName: row.username, nickName: row.username,
}); })
uni.setStorageSync('user', { userName: row.userName, userId: row.userId }); uni.setStorageSync('user', { userName: row.userName, userId: row.userId })
uni.navigateTo({ uni.navigateTo({
url: '/pages/inspector/chat/chatDetails', url: '/pages/inspector/chat/chatDetails',
}); })
} }
// //
async function getMyUnreadCount() { async function getMyUnreadCount() {
const { code, data } = await getUnreadCount(); unreadCount.value = await getUnreadCount()
if (code === 200) {
unreadCount.value = data;
}
} }
watch(inspectorMessage, msg => { watch(inspectorMessage, msg => {
if (!msg) return; if (!msg) return
unreadCount.value++; unreadCount.value++
}); })
watch(inspectorDesktopMessage, (info: any) => { watch(inspectorDesktopMessage, (info: any) => {
if (!info.type) return; if (!info.type) return
if (!info.msg) { if (!info.msg) {
deskShotArr.value.push({ ...info.data }); deskShotArr.value.push({ ...info.data })
} else { } else {
deskShotArr.value.push({ ...info.msg }); deskShotArr.value.push({ ...info.msg })
} }
list.value = list.value.map((i: any) => { list.value = list.value.map((i: any) => {
let v: any = deskShotArr.value.filter((i2: any) => i2.userId === i.userId); let v: any = deskShotArr.value.filter((i2: any) => i2.userId === i.userId)
if (v.length > 0) { if (v.length > 0) {
return { return {
...i, ...i,
deskUrl: v[0].imageUrl ? v[0].imageUrl : '', deskUrl: v[0].imageUrl ? v[0].imageUrl : '',
};
} }
return i; }
}); return i
}); })
})
onPullDownRefresh(() => { onPullDownRefresh(() => {
sendMsg({ type: 'inspectorDesktopPreview', msg: deskUserId.value }); sendMsg({ type: 'inspectorDesktopPreview', msg: deskUserId.value })
uni.stopPullDownRefresh(); uni.stopPullDownRefresh()
}); })
onMounted(() => { onMounted(() => {
socketInit(); socketInit()
getData(); getData()
}); })
onShow(() => { onShow(() => {
deskShotArr.value = []; deskShotArr.value = []
getMyUnreadCount(); getMyUnreadCount()
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {

View File

@ -345,10 +345,8 @@ function changeDay(type: string) {
async function getDate(date?: string) { async function getDate(date?: string) {
uni.showLoading({ title: '加载中...' }) uni.showLoading({ title: '加载中...' })
try { try {
const { code, data, message } = await getCourseDate({ date }) const data = await getCourseDate({ date })
if (code === 200) { currentDate.value = dayjs(data.courseDate).format('YYYY-MM-DD') || dayjs().format('YYYY-MM-DD')
currentDate.value =
dayjs(data.courseDate).format('YYYY-MM-DD') || dayjs().format('YYYY-MM-DD')
courseData.value = data || {} courseData.value = data || {}
currentDateIndex.value = calendarData.value.findIndex(e => e.courseDate === currentDate.value) currentDateIndex.value = calendarData.value.findIndex(e => e.courseDate === currentDate.value)
inspectorTimeStart.value = data.inspectorTimeStart ? data.inspectorTimeStart : '' inspectorTimeStart.value = data.inspectorTimeStart ? data.inspectorTimeStart : ''
@ -356,8 +354,6 @@ async function getDate(date?: string) {
if (data.planState === 1) { if (data.planState === 1) {
canEnd() canEnd()
} }
}
} catch (e) {
} finally { } finally {
uni.hideLoading() uni.hideLoading()
} }
@ -366,7 +362,8 @@ async function getDate(date?: string) {
async function getList() { async function getList() {
try { try {
uni.showLoading({ title: '加载中...' }) uni.showLoading({ title: '加载中...' })
const { code, data, message } = await getScheduleList() const result2 = await getScheduleList()
const { code, data, message } = result2
if (code === 200) { if (code === 200) {
calendarData.value = data || [] calendarData.value = data || []
} else { } else {
@ -379,10 +376,7 @@ async function getList() {
} }
// //
async function getMyUnreadCount() { async function getMyUnreadCount() {
const { code, data } = await getUnreadCount() unreadCount.value = await getUnreadCount()
if (code === 200) {
unreadCount.value = data
}
} }
watch(inspectorMessage, msg => { watch(inspectorMessage, msg => {
if (!msg) return if (!msg) return

View File

@ -63,7 +63,7 @@ const loadMore = () => {
const queryList = async () => { const queryList = async () => {
loading.value = true loading.value = true
try { try {
const { data } = await queryStudyPlanList({ const data = await queryStudyPlanList({
current: page.value.current, current: page.value.current,
userId: studentInfo.value.userId, userId: studentInfo.value.userId,
}) })

View File

@ -39,81 +39,78 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { inject, type Ref, ref, watch, watchEffect } from 'vue'; import { inject, type Ref, ref, watch, watchEffect } from 'vue'
import dayjs from 'dayjs'; import dayjs from 'dayjs'
import { import { getUserInspectorCourseReportInfo, getUserReportPage } from '@/api/inspector/student-detail'
getUserInspectorCourseReportInfo, import IspDataLoad from '@/components/inspector/isp-data-load.vue'
getUserReportPage, import IspLoadMore from '@/components/inspector/isp-load-more.vue'
} from '@/api/inspector/student-detail';
import IspDataLoad from '@/components/inspector/isp-data-load.vue';
import IspLoadMore from '@/components/inspector/isp-load-more.vue';
const collapseValue = ref(); const collapseValue = ref()
const studentInfo = inject<Ref<any>>('studentInfo'); const studentInfo = inject<Ref<any>>('studentInfo')
const queryResult = ref({}); const queryResult = ref({})
const reportList = ref([]); const reportList = ref([])
const reportDetail = ref<any>({}); const reportDetail = ref<any>({})
const listLoading = ref(false); const listLoading = ref(false)
const loading = ref(false); const loading = ref(false)
const page = ref({ const page = ref({
current: 1, current: 1,
total: 0, total: 0,
}); })
const loadMore = () => { const loadMore = () => {
if (Number(page.value.total) > reportList.value.length) { if (Number(page.value.total) > reportList.value.length) {
page.value.current++; page.value.current++
initData(); initData()
} }
}; }
// //
const getWeekDay = (date: string) => { const getWeekDay = (date: string) => {
const weekDay = new Date(date).getDay(); const weekDay = new Date(date).getDay()
const weekDayMap = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; const weekDayMap = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
return weekDayMap[weekDay]; return weekDayMap[weekDay]
}; }
const initData = async () => { const initData = async () => {
listLoading.value = true; listLoading.value = true
try { try {
const { data } = await getUserReportPage({ const data = await getUserReportPage({
userId: studentInfo.value.userId, userId: studentInfo.value.userId,
current: page.value.current, current: page.value.current,
}); })
page.value.total = data.total; page.value.total = data.total
queryResult.value = data; queryResult.value = data
reportList.value.push(...(data?.records ?? [])); reportList.value.push(...(data?.records ?? []))
} finally { } finally {
listLoading.value = false; listLoading.value = false
} }
}; }
const getReportDetail = async (_name: string) => { const getReportDetail = async (_name: string) => {
const item = reportList.value.find(item => { const item = reportList.value.find(item => {
return String(item.id) === _name; return String(item.id) === _name
}); })
if (reportDetail.value && reportDetail.value.id === item.id) { if (reportDetail.value && reportDetail.value.id === item.id) {
return; return
} }
loading.value = true; loading.value = true
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getUserInspectorCourseReportInfo({ getUserInspectorCourseReportInfo({
inspectorCourseId: item.inspectorCourseId, inspectorCourseId: item.inspectorCourseId,
}) })
.then(({ data }) => { .then(data => {
reportDetail.value = data; reportDetail.value = data
resolve(true); resolve(true)
}) })
.finally(() => { .finally(() => {
loading.value = false; loading.value = false
}); })
}); })
}; }
watchEffect(() => { watchEffect(() => {
if (studentInfo.value.userId) { if (studentInfo.value.userId) {
initData(); initData()
} }
}); })
// watch( // watch(
// () => studentInfo.value, // () => studentInfo.value,

View File

@ -55,7 +55,7 @@ const queryData = async () => {
if (!(currentDuration.value >= 0)) { if (!(currentDuration.value >= 0)) {
return; return;
} }
const { data } = await queryStudyDuration({ const data = await queryStudyDuration({
...studySituationParam.value, ...studySituationParam.value,
dateType: currentDuration.value, dateType: currentDuration.value,
}); });

View File

@ -62,7 +62,7 @@ provide('studySituationParam', {
const querySubjectList = async () => { const querySubjectList = async () => {
loading.value = true; loading.value = true;
try { try {
const { data } = await getSubjectListByGrade(studentInfo.value.gradeId); const data = await getSubjectListByGrade(studentInfo.value.gradeId);
subjectList.value = data.map((item: any) => ({ subjectList.value = data.map((item: any) => ({
name: item.name, name: item.name,
value: item.subjectId, value: item.subjectId,

View File

@ -90,7 +90,7 @@ const queryData = async () => {
if (!(currentDuration.value >= 0)) { if (!(currentDuration.value >= 0)) {
return; return;
} }
const { data } = await queryStudyKnowledge({ const data = await queryStudyKnowledge({
...studySituationParam.value, ...studySituationParam.value,
dateType: currentDuration.value, dateType: currentDuration.value,
}); });

View File

@ -132,7 +132,7 @@ const queryData = async () => {
if (!(currentDuration.value >= 0)) { if (!(currentDuration.value >= 0)) {
return; return;
} }
const { data } = await queryStudentWrongQuestion({ const data = await queryStudentWrongQuestion({
...studySituationParam.value, ...studySituationParam.value,
dateType: currentDuration.value, dateType: currentDuration.value,
}); });

View File

@ -80,7 +80,7 @@ const queryData = async () => {
if (!(currentDuration.value >= 0)) { if (!(currentDuration.value >= 0)) {
return; return;
} }
const { data } = await queryVideoStudy({ const data = await queryVideoStudy({
...studySituationParam.value, ...studySituationParam.value,
dateType: currentDuration.value, dateType: currentDuration.value,
}); });

View File

@ -36,7 +36,7 @@ provide('routeData', routeData)
const queryData = async _params => { const queryData = async _params => {
loadingData.value = true loadingData.value = true
try { try {
const { data } = await getStudentDetail(_params) const data = await getStudentDetail(_params)
studentInfo.value = data studentInfo.value = data
} finally { } finally {
loadingData.value = false loadingData.value = false

View File

@ -40,7 +40,7 @@ const calendarValue = ref(dayjs().format('YYYY-MM-DD'));
const dateList = ref([]); const dateList = ref([]);
const initData = async () => { const initData = async () => {
const { data } = await getCourseTable(); const data = await getCourseTable();
dateList.value = (data ?? []).map(item => { dateList.value = (data ?? []).map(item => {
return { return {
...item, ...item,

View File

@ -58,7 +58,7 @@ const stateObj = {
const queryList = async (courseDate: string) => { const queryList = async (courseDate: string) => {
queryLoading.value = true queryLoading.value = true
try { try {
const { data } = await queryStudentList({ courseDate }) const data = await queryStudentList({ courseDate })
queryResult.value = data ?? {} queryResult.value = data ?? {}
studentList.value = data?.studentDetails ?? [] studentList.value = data?.studentDetails ?? []
} finally { } finally {

View File

@ -124,7 +124,7 @@ function phoneDivision() {
} }
// //
async function fetchDXUserInfo() { async function fetchDXUserInfo() {
const { data } = await dx_getUserInfoApi() const data = await dx_getUserInfoApi()
db.set('dxs_userInfo', data) db.set('dxs_userInfo', data)
} }
// //
@ -171,7 +171,7 @@ async function getAdminTypeByPhone() {
const res = await getAdminTypeByPhoneApi({ const res = await getAdminTypeByPhoneApi({
phone: loginForm.value.phone, phone: loginForm.value.phone,
}) })
userAdmin.value = res.data userAdmin.value = res
if (userAdmin.value.length <= 1) { if (userAdmin.value.length <= 1) {
// //
loginForm.value.adminType = userAdmin.value[0].adminType loginForm.value.adminType = userAdmin.value[0].adminType
@ -189,14 +189,14 @@ async function smsLogin() {
title: '登录中...', title: '登录中...',
}) })
const res = await smsLoginApi(loginForm.value) const res = await smsLoginApi(loginForm.value)
setToken(res.data) setToken(res)
const data = await getUserInfo() const data = await getUserInfo()
if (!data.openid) { if (!data.openid) {
// //
const authRes = await getAuthUrlApi() const authRes = await getAuthUrlApi()
// #ifdef H5 // #ifdef H5
window.location.href = authRes.data window.location.href = authRes
// #endif // #endif
// if (data.adminType === 16) { // if (data.adminType === 16) {
// const authRes = await getAuthUrlApi(); // const authRes = await getAuthUrlApi();

View File

@ -186,7 +186,7 @@ async function submit() {
onLoad(async options => { onLoad(async options => {
formData.value.id = options.id; formData.value.id = options.id;
if (formData.value.id) { if (formData.value.id) {
const { data } = await getRewardDetailApi(formData.value.id); const data = await getRewardDetailApi(formData.value.id);
formData.value = data; formData.value = data;
tempImageUrl.value[0] = data.iconUrl; tempImageUrl.value[0] = data.iconUrl;
fontNum.value = data.note.length; fontNum.value = data.note.length;

View File

@ -42,125 +42,123 @@
</template> </template>
<script setup> <script setup>
import { nextTick, reactive, ref } from 'vue'; import { nextTick, reactive, ref } from 'vue'
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'; import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'
import { getRewardListApi, deleteRewardApi } from '@/api'; import { getRewardListApi, deleteRewardApi } from '@/api'
import router from '@/router/router'; import router from '@/router/router'
import Empty from '@/components/Empty/index.vue'; import Empty from '@/components/Empty/index.vue'
import CustomPopup from '@/components/CustomPopup/index.vue'; import CustomPopup from '@/components/CustomPopup/index.vue'
import SwipeAction from './swipeAction.vue'; import SwipeAction from './swipeAction.vue'
const OSS_URL = import.meta.env.VITE_OSS_HOST; const OSS_URL = import.meta.env.VITE_OSS_HOST
const swipeRef = ref(null); const swipeRef = ref(null)
const showCustomPopup = ref(false); const showCustomPopup = ref(false)
const id = ref(); // id const id = ref() // id
const pageStatus = ref(''); const pageStatus = ref('')
const scrollView = ref({ const scrollView = ref({
oldScrollTop: 0, oldScrollTop: 0,
scrollTop: 0, scrollTop: 0,
}); })
const isScroll = ref(false); const isScroll = ref(false)
const timer = ref(null); const timer = ref(null)
const pageInfo = ref({ const pageInfo = ref({
size: 10, size: 10,
current: 1, current: 1,
total: 0, total: 0,
}); })
const list = ref([]); const list = ref([])
const back = () => { const back = () => {
router.navigateTo('/pages/mine/index'); router.navigateTo('/pages/mine/index')
}; }
// //
function handleAddItem() { function handleAddItem() {
router.navigateTo('/pages/mine/awardManage/awardItem'); router.navigateTo('/pages/mine/awardManage/awardItem')
} }
// //
function handleBackTop() { function handleBackTop() {
if (timer.value) { if (timer.value) {
clearTimeout(timer.value); clearTimeout(timer.value)
} }
timer.value = setTimeout(() => { timer.value = setTimeout(() => {
scrollView.value.scrollTop = scrollView.value.oldScrollTop; scrollView.value.scrollTop = scrollView.value.oldScrollTop
nextTick(() => { nextTick(() => {
scrollView.value.scrollTop = 0; scrollView.value.scrollTop = 0
}); })
}, 300); }, 300)
} }
function handleSrcoll(val) { function handleSrcoll(val) {
isScroll.value = val; isScroll.value = val
} }
function handleEditBtn(val) { function handleEditBtn(val) {
router.navigateTo({ router.navigateTo({
path: `/pages/mine/awardManage/awardItem`, path: `/pages/mine/awardManage/awardItem`,
query: { id: val.id } query: { id: val.id },
}); })
} }
function handleDeleteBtn(val) { function handleDeleteBtn(val) {
console.log('删除', val); console.log('删除', val)
id.value = val.id; id.value = val.id
showCustomPopup.value = true; showCustomPopup.value = true
} }
// //
function handleConfirmPopup() { function handleConfirmPopup() {
deleteRewardApi(id.value).then(res => { deleteRewardApi(id.value).then(res => {
if (res.code === 200) { if (res.code === 200) {
let index = list.value.findIndex(item => item.id === id.value); let index = list.value.findIndex(item => item.id === id.value)
list.value.splice(index, 1); list.value.splice(index, 1)
pageInfo.value.total = -1; pageInfo.value.total = -1
showCustomPopup.value = false; showCustomPopup.value = false
uni.showToast({ uni.showToast({
title: '删除成功', title: '删除成功',
icon: 'none', icon: 'none',
}); })
} }
}); })
} }
// //
function fetchAwardList() { function fetchAwardList() {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
}); })
getRewardListApi({ getRewardListApi({
...pageInfo.value, ...pageInfo.value,
}) })
.then(res => { .then(res => {
if (res.code === 200) { const data = res
const { data } = res; pageStatus.value = data.totalRows === 0 ? 'empty' : ''
pageStatus.value = data.totalRows === 0 ? 'empty' : ''; pageInfo.value.total = data.totalRows
pageInfo.value.total = data.totalRows;
for (let i in data.rows) { for (let i in data.rows) {
list.value.push({ list.value.push({
...data.rows[i], ...data.rows[i],
right: 0, right: 0,
}); })
}
wx.hideLoading();
} }
wx.hideLoading()
}) })
.catch(err => { .catch(err => {
uni.hideLoading(); uni.hideLoading()
}); })
} }
function handleScroll(e) { function handleScroll(e) {
scrollView.value.oldScrollTop = e.detail.scrollTop; scrollView.value.oldScrollTop = e.detail.scrollTop
} }
// //
function loadData() { function loadData() {
if (list.value.length < pageInfo.value.total) { if (list.value.length < pageInfo.value.total) {
pageInfo.value.current++; pageInfo.value.current++
fetchAwardList(); fetchAwardList()
} }
} }
onLoad(() => { onLoad(() => {
pageInfo.value.current = 1; pageInfo.value.current = 1
list.value = []; list.value = []
fetchAwardList(); fetchAwardList()
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -92,7 +92,7 @@ async function fetchTaskList() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); });
const { data } = await getTaskListApi({ const data = await getTaskListApi({
...pageInfo.value, ...pageInfo.value,
}); });
pageInfo.value.total = data.totalRows; pageInfo.value.total = data.totalRows;

View File

@ -161,7 +161,7 @@ async function fetchChildrenInfo() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); });
const { data } = await getParentBindChildApi({ const data = await getParentBindChildApi({
parentId: userInfo.value.id, parentId: userInfo.value.id,
...page.value, ...page.value,
}); });
@ -184,7 +184,7 @@ async function fetchStudentTaskStatus() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); });
const { data } = await getFamilyTaskStuApi({ const data = await getFamilyTaskStuApi({
...taskStatusInfo.value, ...taskStatusInfo.value,
}); });
childrenList.value = data; childrenList.value = data;

View File

@ -136,7 +136,7 @@ async function fetchRewardList() {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
}); });
let { data } = await getRewardListApi({ size: -1 }); let data = await getRewardListApi({ size: -1 });
total.value = data.totalRows; total.value = data.totalRows;
if (data.totalRows > 0) { if (data.totalRows > 0) {
data.rows.map((item, idx) => data.rows.map((item, idx) =>

View File

@ -192,7 +192,7 @@ async function fetchTaskList() {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
}); });
let { data } = await taskConfigListApi(); let data = await taskConfigListApi();
systemTaskList.value = data.filter(item => item.taskType === 0); systemTaskList.value = data.filter(item => item.taskType === 0);
customTaskList.value = data.filter(item => item.taskType === 1); customTaskList.value = data.filter(item => item.taskType === 1);
uni.hideLoading(); uni.hideLoading();

View File

@ -69,7 +69,7 @@ function getWarrantyList() {
}); });
getWarrantyCardMsgApi() getWarrantyCardMsgApi()
.then(res => { .then(res => {
warrantyList.value = res.data; warrantyList.value = res;
uni.hideLoading(); uni.hideLoading();
}) })
.catch(err => { .catch(err => {

View File

@ -43,84 +43,82 @@
</template> </template>
<script setup> <script setup>
import { computed, nextTick, ref, watch } from 'vue'; import { computed, nextTick, ref, watch } from 'vue'
import dayjs from 'dayjs'; import dayjs from 'dayjs'
import Empty from '@/components/Empty/index.vue'; import Empty from '@/components/Empty/index.vue'
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app'
import { getServiceHistoryApi } from '@/api'; import { getServiceHistoryApi } from '@/api'
const OSS_URL = import.meta.env.VITE_OSS_HOST; const OSS_URL = import.meta.env.VITE_OSS_HOST
const familyId = ref(''); // id const familyId = ref('') // id
const pageStatus = ref(''); const pageStatus = ref('')
const serviceHistortList = ref([]); const serviceHistortList = ref([])
const page = ref({ const page = ref({
current: 1, current: 1,
size: 10, size: 10,
total: 0, total: 0,
}); })
const timer = ref(null); const timer = ref(null)
const scrollView = ref({ const scrollView = ref({
oldScrollTop: 0, oldScrollTop: 0,
scrollTop: 0, scrollTop: 0,
}); })
function handleScroll(e) { function handleScroll(e) {
scrollView.value.oldScrollTop = e.detail.scrollTop; scrollView.value.oldScrollTop = e.detail.scrollTop
} }
// //
function handleBackTop() { function handleBackTop() {
if (timer.value) { if (timer.value) {
clearTimeout(timer.value); clearTimeout(timer.value)
} }
timer.value = setTimeout(() => { timer.value = setTimeout(() => {
scrollView.value.scrollTop = scrollView.value.oldScrollTop; scrollView.value.scrollTop = scrollView.value.oldScrollTop
nextTick(() => { nextTick(() => {
scrollView.value.scrollTop = 0; scrollView.value.scrollTop = 0
}); })
}, 300); }, 300)
} }
// //
function loadData() { function loadData() {
if (serviceHistortList.value.length < page.value.total) { if (serviceHistortList.value.length < page.value.total) {
page.value.current++; page.value.current++
fetchServiceHistoryList(); fetchServiceHistoryList()
} }
} }
// //
function lookServiceDetails(i) { function lookServiceDetails(i) {
let details = encodeURIComponent(JSON.stringify(i)); let details = encodeURIComponent(JSON.stringify(i))
uni.navigateTo({ uni.navigateTo({
url: `/pages/mine/warranty/serviceHistoryDetails?details=${details}`, url: `/pages/mine/warranty/serviceHistoryDetails?details=${details}`,
}); })
} }
// //
function fetchServiceHistoryList() { function fetchServiceHistoryList() {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
}); })
getServiceHistoryApi(page.value) getServiceHistoryApi(page.value)
.then(res => { .then(res => {
if (res.code === 200) { let data = res
let { data } = res; page.value.total = data.totalRows
page.value.total = data.totalRows;
if (data.rows.length === 0) { if (data.rows.length === 0) {
pageStatus.value = 'empty'; pageStatus.value = 'empty'
} else { } else {
pageStatus.value = ''; pageStatus.value = ''
serviceHistortList.value.push(...data.rows); serviceHistortList.value.push(...data.rows)
}
wx.hideLoading();
} }
wx.hideLoading()
}) })
.catch(err => { .catch(err => {
wx.hideLoading(); wx.hideLoading()
}); })
} }
onLoad(() => { onLoad(() => {
serviceHistortList.value = []; serviceHistortList.value = []
fetchServiceHistoryList(); fetchServiceHistoryList()
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -123,7 +123,7 @@ const queryList = (pageNo: number, pageSize: number) => {
if (activeNav.value.type === 1) { if (activeNav.value.type === 1) {
getParentBindChildApi({ parentId: userInfo.value.id, current: pageNo, size: pageSize }) getParentBindChildApi({ parentId: userInfo.value.id, current: pageNo, size: pageSize })
.then(res => { .then(res => {
paging.value.complete(res.data.rows) paging.value.complete(res.rows)
}) })
.catch(res => { .catch(res => {
paging.value.complete(false) paging.value.complete(false)
@ -131,7 +131,7 @@ const queryList = (pageNo: number, pageSize: number) => {
} else { } else {
getParentBindDeviceApi({ parentId: userInfo.value.id, current: pageNo, size: pageSize }) getParentBindDeviceApi({ parentId: userInfo.value.id, current: pageNo, size: pageSize })
.then(res => { .then(res => {
paging.value.complete(res.data.rows) paging.value.complete(res.rows)
}) })
.catch(res => { .catch(res => {
paging.value.complete(false) paging.value.complete(false)
@ -145,13 +145,13 @@ function handleDetialPage(type: number, obj: any) {
case 1: case 1:
router.navigateTo({ router.navigateTo({
path: `/pages/mine/details/childrenDetails`, path: `/pages/mine/details/childrenDetails`,
query: { details } query: { details },
}) })
break break
case 2: case 2:
router.navigateTo({ router.navigateTo({
path: `/pages/mine/details/deviceDetails`, path: `/pages/mine/details/deviceDetails`,
query: { details } query: { details },
}) })
break break
} }
@ -164,7 +164,7 @@ function handleBindDevice() {
const toMySupervisionService = child => { const toMySupervisionService = child => {
router.navigateTo({ router.navigateTo({
path: `/pages/parents/mySupervisionService/index`, path: `/pages/parents/mySupervisionService/index`,
query: { id: child.childId } query: { id: child.childId },
}) })
} }

View File

@ -85,7 +85,7 @@ const queryList = (pageNo: number, pageSize: number) => {
if (props.type === 1) { if (props.type === 1) {
getParentBindChildApi({ childId: detailInfo.value.childId, current: pageNo, size: pageSize }) getParentBindChildApi({ childId: detailInfo.value.childId, current: pageNo, size: pageSize })
.then(res => { .then(res => {
paging.value.complete(res.data.rows) paging.value.complete(res.rows)
}) })
.catch(res => { .catch(res => {
paging.value.complete(false) paging.value.complete(false)
@ -97,7 +97,7 @@ const queryList = (pageNo: number, pageSize: number) => {
size: pageSize, size: pageSize,
}) })
.then(res => { .then(res => {
paging.value.complete(res.data.rows) paging.value.complete(res.rows)
}) })
.catch(res => { .catch(res => {
paging.value.complete(false) paging.value.complete(false)

View File

@ -66,7 +66,7 @@ const OSS_URL = import.meta.env.VITE_OSS_HOST
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png` const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`
// //
async function deviceCurrentLogin() { async function deviceCurrentLogin() {
const { data } = await parentDeviceCurrentLoginApi(detailInfo.value.id) const data = await parentDeviceCurrentLoginApi(detailInfo.value.id)
currentLogin.value = data currentLogin.value = data
} }
async function share() { async function share() {

View File

@ -1,96 +1,98 @@
<template> <template>
<view class="course-table"> <view class="course-table">
<wd-skeleton animation="gradient" theme="paragraph" v-if="isLoading" /> <wd-skeleton v-if="isLoading" animation="gradient" theme="paragraph" />
<template v-else> <template v-else>
<time-cycle :list="timeCycleList" @change="timeCycleChange" /> <time-cycle :list="timeCycleList" @change="timeCycleChange" />
<supervisor-teacher :teacher="teacher"/> <supervisor-teacher :teacher="teacher" />
<classmates :classmates="classmateList" v-if="classmateList.length"/> <classmates v-if="classmateList.length" :classmates="classmateList" />
<custom-calender ref="customCalenderRef" @selected-day="selectedDay"> <custom-calender ref="customCalenderRef" @selected-day="selectedDay">
<template #header="{date}"> <template #header="{ date }">
<view class="header"> <view class="header">
<wd-icon name="arrow-left" size="22px" @click="prevTime"></wd-icon> <wd-icon name="arrow-left" size="22px" @click="prevTime"></wd-icon>
<view>{{date.monthDate}}</view> <view>{{ date.monthDate }}</view>
<wd-icon name="arrow-right" size="22px" v-if="show(date)" @click="nextTime"></wd-icon> <wd-icon v-if="show(date)" name="arrow-right" size="22px" @click="nextTime"></wd-icon>
</view> </view>
</template> </template>
<template #cell="{date}"> <template #cell="{ date }">
<course-table-cell :list="list" :date="{value: date?.date, disable: date?.disable}"/> <course-table-cell :list="list" :date="{ value: date?.date, disable: date?.disable }" />
</template> </template>
</custom-calender> </custom-calender>
</template> </template>
</view> </view>
</template> </template>
<script setup lang=ts> <script setup lang="ts">
import TimeCycle from "./TimeCycle.vue"; import TimeCycle from './TimeCycle.vue'
import SupervisorTeacher from "@/components/SupervisorTeacher/SupervisorTeacher.vue"; import SupervisorTeacher from '@/components/SupervisorTeacher/SupervisorTeacher.vue'
import Classmates from "./Classmates.vue"; import Classmates from './Classmates.vue'
import CustomCalender from "@/components/customCalender/index.vue" import CustomCalender from '@/components/customCalender/index.vue'
import {ref} from "vue"; import { ref } from 'vue'
import dayjs from "dayjs"; import dayjs from 'dayjs'
import {onLoad, onUnload} from "@dcloudio/uni-app"; import { onLoad, onUnload } from '@dcloudio/uni-app'
import {getInspectorCourseList, getInspectorTeacherStudentInfo} from "@/api"; import { getInspectorCourseList, getInspectorTeacherStudentInfo } from '@/api'
import CourseTableCell from "./CourseTableCell.vue"; import CourseTableCell from './CourseTableCell.vue'
const OSS_URL = import.meta.env.VITE_OSS_HOST; const OSS_URL = import.meta.env.VITE_OSS_HOST
const currentTime = ref(null); const currentTime = ref(null)
const customCalenderRef = ref(null) const customCalenderRef = ref(null)
const teacher = ref<{ const teacher = ref<{
name: string; name: string
school: string; school: string
edu: string; edu: string
avatar: string; avatar: string
labelList: { labelList: {
name: string; name: string
color: string; color: string
bgColor: string; bgColor: string
}[]; }[]
titleLabel: string[]; titleLabel: string[]
desc: string; desc: string
}|null>(null) } | null>(null)
const classmateList = ref([]) const classmateList = ref([])
const colorList = [ const colorList = [
{color: '#FF8624', bgColor: "#fff7f0"}, { color: '#FF8624', bgColor: '#fff7f0' },
{color: '#0CC25C', bgColor: "#F1FFF7"}, { color: '#0CC25C', bgColor: '#F1FFF7' },
{color: '#FF3C58', bgColor: "#FFF3F5"} { color: '#FF3C58', bgColor: '#FFF3F5' },
] ]
const loadTeacherAndClassmate = (id: string) => { const loadTeacherAndClassmate = (id: string) => {
getInspectorTeacherStudentInfo({orderId: id}).then(({data}) => { getInspectorTeacherStudentInfo({ orderId: id }).then(data => {
const teacherData = data.inspectorTeacher const teacherData = data.inspectorTeacher
teacher.value = teacherData ? { teacher.value = teacherData
? {
name: teacherData.nickName, name: teacherData.nickName,
school: teacherData.gradSchool, school: teacherData.gradSchool,
edu: teacherData.degree, edu: teacherData.degree,
avatar: teacherData.personalPhoto, avatar: teacherData.personalPhoto,
labelList: teacherData.label.split(",").map((item, index) => { labelList: teacherData.label.split(',').map((item, index) => {
let color = colorList[index % 3] let color = colorList[index % 3]
return { return {
name: item, name: item,
color: color.color, color: color.color,
bgColor: color.bgColor bgColor: color.bgColor,
} }
}), }),
titleLabel: teacherData.propagandaSlogan?.split(","), titleLabel: teacherData.propagandaSlogan?.split(','),
desc: teacherData.personalInformation desc: teacherData.personalInformation,
} : null }
: null
classmateList.value = (data.studentList || []).map(item => { classmateList.value = (data.studentList || []).map(item => {
return { return {
name: item.name, name: item.name,
avatar: item.avatarUrl avatar: item.avatarUrl,
} }
}) })
}) })
} }
const timeCycleChange = (time: {start: string, end: string}) => { const timeCycleChange = (time: { start: string; end: string }) => {
currentTime.value = time; currentTime.value = time
if (time && timeCycleMap.value[`${time.start}-${time.end}`]) { if (time && timeCycleMap.value[`${time.start}-${time.end}`]) {
loadTeacherAndClassmate(timeCycleMap.value[`${time.start}-${time.end}`].orderId) loadTeacherAndClassmate(timeCycleMap.value[`${time.start}-${time.end}`].orderId)
} }
@ -98,10 +100,7 @@ const timeCycleChange = (time: {start: string, end: string}) => {
const list = ref([]) const list = ref([])
const show = (date: { const show = (date: { date: string; monthDate: string }) => {
date: string,
monthDate: string
}) => {
return true return true
// return dayjs(date.date).month() < dayjs().month() // return dayjs(date.date).month() < dayjs().month()
} }
@ -114,7 +113,7 @@ const nextTime = () => {
} }
const planMap = ref([]) const planMap = ref([])
const selectedDay = (date: {date: string}) => { const selectedDay = (date: { date: string }) => {
let dayData = planMap.value.find(item => item.date === date.date) let dayData = planMap.value.find(item => item.date === date.date)
if (dayData && dayData.id) { if (dayData && dayData.id) {
uni.navigateTo({ uni.navigateTo({
@ -129,9 +128,9 @@ const timeCycleMap = ref({})
const isLoading = ref(true) const isLoading = ref(true)
onLoad((options) => { onLoad(options => {
getInspectorCourseList({ userId: options.id })
getInspectorCourseList({userId: options.id}).then(({data}) => { .then(data => {
let planList = [] let planList = []
data.forEach(item => { data.forEach(item => {
timeCycleList.value.push({ timeCycleList.value.push({
@ -139,12 +138,13 @@ onLoad((options) => {
end: item.inspectorTimeEnd, end: item.inspectorTimeEnd,
}) })
timeCycleMap.value[`${item.inspectorTimeStart}-${item.inspectorTimeEnd}`] = item timeCycleMap.value[`${item.inspectorTimeStart}-${item.inspectorTimeEnd}`] = item
planList.push(item.inspectorCourseList.map(i => { planList.push(
let date = dayjs(i.courseDate).format("YYYY-MM-DD") item.inspectorCourseList.map(i => {
let date = dayjs(i.courseDate).format('YYYY-MM-DD')
if (i.inspectorPlanId) { if (i.inspectorPlanId) {
planMap.value.push({ planMap.value.push({
date: date, date: date,
id: i.inspectorPlanId id: i.inspectorPlanId,
}) })
} }
return { return {
@ -153,15 +153,18 @@ onLoad((options) => {
taskCount: i.taskCount, taskCount: i.taskCount,
state: i.planStatus, state: i.planStatus,
mode: i.mode, mode: i.mode,
},
} }
} }),
})) )
}) })
list.value = planList.flat(1) list.value = planList.flat(1)
uni.setStorageSync('plan', planMap.value) uni.setStorageSync('plan', planMap.value)
}).catch(() => { })
.catch(() => {
uni.removeStorageSync('plan') uni.removeStorageSync('plan')
}).finally(() => { })
.finally(() => {
isLoading.value = false isLoading.value = false
}) })
}) })
@ -181,7 +184,6 @@ onUnload(() => {
padding: 10rpx 0 30rpx 0; padding: 10rpx 0 30rpx 0;
} }
.cell-date { .cell-date {
} }
} }
</style> </style>

View File

@ -1,59 +1,67 @@
<template> <template>
<view class="order"> <view class="order">
<wd-skeleton animation="gradient" theme="paragraph" v-if="isLoading" /> <wd-skeleton v-if="isLoading" animation="gradient" theme="paragraph" />
<view class="order-list" v-else-if="orderList.length"> <view v-else-if="orderList.length" class="order-list">
<view class="order-item" v-for="(item, index) in orderList" :key="index"> <view v-for="(item, index) in orderList" :key="index" class="order-item">
<view class="title-state"> <view class="title-state">
<view class="title">{{item.title}}</view> <view class="title">{{ item.title }}</view>
<view class="state" :style="{color: item.status === 1 ? '#615DFF' : '#A9AAB5'}">{{item.status === 1 ? '服务中' : '已过期'}}</view> <view class="state" :style="{ color: item.status === 1 ? '#615DFF' : '#A9AAB5' }">{{
item.status === 1 ? '服务中' : '已过期'
}}</view>
</view> </view>
<view class="order-info"> <view class="order-info">
<view class="info-item"> <view class="info-item">
<view class="label"><text></text></view> <view class="label"><text></text></view>
<view class="value">{{item.money}}</view> <view class="value">{{ item.money }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="label">实际支付</view> <view class="label">实际支付</view>
<view class="value">{{item.payAmount}}</view> <view class="value">{{ item.payAmount }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="label">开通时间</view> <view class="label">开通时间</view>
<view class="value">{{dayjs(item.paymentTime).format("YYYY.MM.DD HH:mm:ss")}}</view> <view class="value">{{ dayjs(item.paymentTime).format('YYYY.MM.DD HH:mm:ss') }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="label">服务周期</view> <view class="label">服务周期</view>
<view class="value">{{dayjs(item.startTime).format("YYYY.MM.DD")}} ~ {{dayjs(item.endTime).format("YYYY.MM.DD")}}</view> <view class="value"
>{{ dayjs(item.startTime).format('YYYY.MM.DD') }} ~
{{ dayjs(item.endTime).format('YYYY.MM.DD') }}</view
>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<empty content="还没有订单"/> <empty content="还没有订单" />
</view> </view>
</template> </template>
<script setup lang=ts> <script setup lang="ts">
import {ref} from "vue"; import { ref } from 'vue'
import dayjs from "dayjs"; import dayjs from 'dayjs'
import {onLoad} from "@dcloudio/uni-app"; import { onLoad } from '@dcloudio/uni-app'
import {getInspectorOrderList} from "@/api"; import { getInspectorOrderList } from '@/api'
import Empty from "@/components/Empty"; import Empty from '@/components/Empty'
const orderList = ref<{ const orderList = ref<
title: string, {
paymentTime: string, title: string
startTime: string, paymentTime: string
endTime: string, startTime: string
payAmount: string, endTime: string
money: string, payAmount: string
money: string
status: number status: number
}[]>([]) }[]
>([])
const modeType = {1: '1v1', 2: '1vN'} const modeType = { 1: '1v1', 2: '1vN' }
const isLoading = ref(true) const isLoading = ref(true)
onLoad((options) => { onLoad(options => {
getInspectorOrderList({userId: options.id}).then(({data}) => { getInspectorOrderList({ userId: options.id })
.then(data => {
orderList.value = data.map(item => { orderList.value = data.map(item => {
return { return {
title: modeType[item.mode] + '督学模式', title: modeType[item.mode] + '督学模式',
@ -62,14 +70,14 @@ onLoad((options) => {
endTime: item.inspectorTimeEnd, endTime: item.inspectorTimeEnd,
payAmount: item.payAmount, payAmount: item.payAmount,
money: item.money, money: item.money,
status: item.inspectorServiceStatus status: item.inspectorServiceStatus,
} }
}) })
}).finally(() => { })
.finally(() => {
isLoading.value = false isLoading.value = false
}) })
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -89,7 +97,7 @@ onLoad((options) => {
.title { .title {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: #0A1F13; color: #0a1f13;
} }
.state { .state {
font-size: 26rpx; font-size: 26rpx;
@ -105,7 +113,7 @@ onLoad((options) => {
width: 140rpx; width: 140rpx;
font-size: 28rpx; font-size: 28rpx;
flex-shrink: 0; flex-shrink: 0;
color: #A9AAB5; color: #a9aab5;
} }
.value { .value {
font-size: 28rpx; font-size: 28rpx;
@ -116,7 +124,7 @@ onLoad((options) => {
&:not(:first-child) { &:not(:first-child) {
.label { .label {
&::after { &::after {
content: ""; content: '';
} }
} }
} }
@ -126,7 +134,7 @@ onLoad((options) => {
justify-content: space-between; justify-content: space-between;
> text { > text {
&::after { &::after {
content: ""; content: '';
} }
} }
} }

View File

@ -12,23 +12,23 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import ReportTimeChange from './ReportTimeChange.vue'; import ReportTimeChange from './ReportTimeChange.vue'
import { computed, ref } from 'vue'; import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app'
import { getInspectorPlanReport } from '@/api'; import { getInspectorPlanReport } from '@/api'
import StudentReport from '@/components/student-report'; import StudentReport from '@/components/student-report'
import dayjs from 'dayjs'; import dayjs from 'dayjs'
import Empty from '@/components/Empty'; import Empty from '@/components/Empty'
const currentDate = ref(dayjs()); const currentDate = ref(dayjs())
const result = ref([]); const result = ref([])
const isLoading = ref(true); const isLoading = ref(true)
onLoad(options => { onLoad(options => {
getInspectorPlanReport({ userId: options.id }) getInspectorPlanReport({ userId: options.id })
.then(({ data }) => { .then(data => {
result.value = data.map(item => { result.value = data.map(item => {
return { return {
...item, ...item,
@ -37,20 +37,20 @@ onLoad(options => {
practiceQuestionStatistics: JSON.parse(item.practiceQuestionStatistics), practiceQuestionStatistics: JSON.parse(item.practiceQuestionStatistics),
watchVideoStatistics: JSON.parse(item.watchVideoStatistics), watchVideoStatistics: JSON.parse(item.watchVideoStatistics),
tasks: (item.tasks || []).map(task => JSON.parse(task.taskInfoJson)), tasks: (item.tasks || []).map(task => JSON.parse(task.taskInfoJson)),
}; }
}); })
currentDate.value = dayjs(data[0].courseDate); currentDate.value = dayjs(data[0].courseDate)
}) })
.finally(() => { .finally(() => {
isLoading.value = false; isLoading.value = false
}); })
}); })
const reportData = computed(() => { const reportData = computed(() => {
return result.value.find( return result.value.find(
item => dayjs(item.courseDate).format('YYYY-MM-DD') === currentDate.value.format('YYYY-MM-DD'), item => dayjs(item.courseDate).format('YYYY-MM-DD') === currentDate.value.format('YYYY-MM-DD'),
); )
}); })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -2,32 +2,53 @@
<view class="study-plan"> <view class="study-plan">
<view class="study-plan-content"> <view class="study-plan-content">
<view class="change-time"> <view class="change-time">
<wd-icon name="arrow-left" size="30rpx" :color="isCanPrev ? '#666' : '#ddd'" @click="prevTime"></wd-icon> <wd-icon
name="arrow-left"
size="30rpx"
:color="isCanPrev ? '#666' : '#ddd'"
@click="prevTime"
></wd-icon>
<view class="time-text">{{ currentDate.format('MM月DD日') }}</view> <view class="time-text">{{ currentDate.format('MM月DD日') }}</view>
<wd-icon name="arrow-right" size="30rpx" :color="isCanNext ? '#666' : '#ddd'" @click="nextTime"></wd-icon> <wd-icon
name="arrow-right"
size="30rpx"
:color="isCanNext ? '#666' : '#ddd'"
@click="nextTime"
></wd-icon>
</view> </view>
<wd-skeleton v-if="isLoading" animation="gradient" theme="paragraph" style="padding-bottom: 30rpx"></wd-skeleton> <wd-skeleton
v-if="isLoading"
animation="gradient"
theme="paragraph"
style="padding-bottom: 30rpx"
></wd-skeleton>
<view class="plan-list" v-else> <view v-else class="plan-list">
<view v-for="(item, index) in planList" :key="index" class="plan-item"> <view v-for="(item, index) in planList" :key="index" class="plan-item">
<view class="serial-number"> <view class="serial-number">
<view v-if="item.progress === 100" class="finished-icon"> <view v-if="item.progress === 100" class="finished-icon">
<wd-icon name="check-bold" size="30rpx"></wd-icon> <wd-icon name="check-bold" size="30rpx"></wd-icon>
</view> </view>
<template v-else>{{ (++index).toString().padStart(2, '0') }}</template></view> <template v-else>{{ (++index).toString().padStart(2, '0') }}</template></view
>
<view class="plan-item-info"> <view class="plan-item-info">
<view class="plan-item-title"> <view class="plan-item-title">
<view class="title-type"> <view class="title-type">
<view class="title">{{ item.subjectName }}</view> <view class="title">{{ item.subjectName }}</view>
<view class="type" :style="{backgroundColor: type[item.taskType].color}">{{ type[item.taskType].text }}</view> <view class="type" :style="{ backgroundColor: type[item.taskType].color }">{{
type[item.taskType].text
}}</view>
</view> </view>
<view class="plan-item-time"> <view class="plan-item-time">
<view class="total-progress"> <view class="total-progress">
<text class="success" v-if="item.progress > 0">{{item.progress}}%</text> <text v-if="item.progress > 0" class="success">{{ item.progress }}%</text>
<text class="progress" v-else>{{item.finishedNum}}/{{item.num}}</text> <text v-else class="progress">{{ item.finishedNum }}/{{ item.num }}</text>
</view> </view>
<view class="time">{{ dayjs(item.startTime).format("HH:mm") }} - {{ dayjs(item.endTime).format("HH:mm") }}</view> <view class="time"
>{{ dayjs(item.startTime).format('HH:mm') }} -
{{ dayjs(item.endTime).format('HH:mm') }}</view
>
</view> </view>
</view> </view>
<view class="plan-desc">{{ item.plan }}</view> <view class="plan-desc">{{ item.plan }}</view>
@ -39,30 +60,32 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {computed, ref} from 'vue'; import { computed, ref } from 'vue'
import dayjs from 'dayjs'; import dayjs from 'dayjs'
import {onLoad} from "@dcloudio/uni-app"; import { onLoad } from '@dcloudio/uni-app'
import {getInspectorPlan} from "@/api"; import { getInspectorPlan } from '@/api'
const type = { const type = {
0: {text: "自由学", color: '#FFA65D',}, 0: { text: '自由学', color: '#FFA65D' },
1: {text: "自由学", color: '#FFA65D',}, 1: { text: '自由学', color: '#FFA65D' },
2: {text: "精准学", color: '#4fd6ee',}, 2: { text: '精准学', color: '#4fd6ee' },
3: {text: "语感训练", color: '#ff91a1',}, 3: { text: '语感训练', color: '#ff91a1' },
4: {text: "错题本", color: '#ff91a1',} 4: { text: '错题本', color: '#ff91a1' },
} }
const currentDate = ref(dayjs()); const currentDate = ref(dayjs())
const planList = ref<{ const planList = ref<
subjectName: string, {
taskType: number | string, subjectName: string
startTime: string, taskType: number | string
endTime: string, startTime: string
num: number, endTime: string
finishedNum: number, num: number
plan: string, finishedNum: number
progress: number, plan: string
}[]>([]); progress: number
}[]
>([])
const allPlan = ref([]) const allPlan = ref([])
@ -70,7 +93,8 @@ const isLoading = ref(true)
const loadData = async () => { const loadData = async () => {
let plan = allPlan.value.find(item => item.date === currentDate.value.format('YYYY-MM-DD')) let plan = allPlan.value.find(item => item.date === currentDate.value.format('YYYY-MM-DD'))
isLoading.value = true isLoading.value = true
getInspectorPlan({inspectorPlanId: plan.id}).then(({data}) => { getInspectorPlan({ inspectorPlanId: plan.id })
.then(data => {
planList.value = data.taskList.map(item => { planList.value = data.taskList.map(item => {
let data = JSON.parse(item.taskInfoJson) let data = JSON.parse(item.taskInfoJson)
let plan = { let plan = {
@ -81,28 +105,29 @@ const loadData = async () => {
num: data.num, num: data.num,
finishedNum: data.finishedNum, finishedNum: data.finishedNum,
progress: data.progress, progress: data.progress,
plan: "" plan: '',
} }
switch (plan.taskType) { switch (plan.taskType) {
case "0": case '0':
plan.plan = `观看学习视频:《${data.chapterName}》章节《${data.courseTimeName}》视频` plan.plan = `观看学习视频:《${data.chapterName}》章节《${data.courseTimeName}》视频`
break break
case "1": case '1':
plan.plan = `完成章节练习:《${data.chapterName}` plan.plan = `完成章节练习:《${data.chapterName}`
break break
case "2": case '2':
plan.plan = `AI精准学习${plan.num}` plan.plan = `AI精准学习${plan.num}`
break break
case "3": case '3':
plan.plan = `语感训练${plan.num}` plan.plan = `语感训练${plan.num}`
break break
case "4": case '4':
plan.plan = ` 订正错题本${plan.num}` plan.plan = ` 订正错题本${plan.num}`
break break
} }
return plan return plan
}) })
}).finally(() => { })
.finally(() => {
isLoading.value = false isLoading.value = false
}) })
} }
@ -111,7 +136,10 @@ const isCanPrev = computed(() => {
return allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD')) > 0 return allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD')) > 0
}) })
const isCanNext = computed(() => { const isCanNext = computed(() => {
return allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD')) < allPlan.value.length - 1 return (
allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD')) <
allPlan.value.length - 1
)
}) })
const prevTime = () => { const prevTime = () => {
let index = allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD')) let index = allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD'))
@ -119,19 +147,18 @@ const prevTime = () => {
currentDate.value = dayjs(allPlan.value[index - 1].date) currentDate.value = dayjs(allPlan.value[index - 1].date)
loadData() loadData()
} }
}; }
const nextTime = () => { const nextTime = () => {
let index = allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD')) let index = allPlan.value.findIndex(item => item.date === currentDate.value.format('YYYY-MM-DD'))
if (isCanNext.value) { if (isCanNext.value) {
currentDate.value = dayjs(allPlan.value[index + 1].date) currentDate.value = dayjs(allPlan.value[index + 1].date)
loadData() loadData()
} }
}; }
onLoad(option => {
onLoad((option) => { allPlan.value = uni.getStorageSync('plan')
allPlan.value = uni.getStorageSync("plan") currentDate.value = dayjs(option.d)
currentDate.value = dayjs(option.d);
loadData() loadData()
}) })
</script> </script>
@ -217,14 +244,14 @@ onLoad((option) => {
border-right: 1px solid #f2f2f2; border-right: 1px solid #f2f2f2;
margin-right: 10rpx; margin-right: 10rpx;
.success { .success {
color: #21D17A; color: #21d17a;
} }
.progress { .progress {
color: #FF2828; color: #ff2828;
} }
} }
.time { .time {
color: #A9AAB5; color: #a9aab5;
} }
} }
} }

View File

@ -299,7 +299,7 @@ const onCloseSelectOrder = () => {
}; };
const getBaseInfo = async () => { const getBaseInfo = async () => {
const { data } = await getChildList(); const data = await getChildList();
// console.log('data', data); // console.log('data', data);
childrenList.value = data.map(child => { childrenList.value = data.map(child => {
return { return {
@ -368,7 +368,7 @@ const onConfirmSelectOrder = async () => {
userId: curSelectChildren[0].id, userId: curSelectChildren[0].id,
}; };
const { data } = await createInspectorPrepayOrder(params); const data = await createInspectorPrepayOrder(params);
const order = { const order = {
appId: data.prepayResponse.appId, appId: data.prepayResponse.appId,

View File

@ -9,7 +9,7 @@ export const bindApplyStore = defineStore('bindApplyStore', () => {
// 未处理的绑定申请列表 // 未处理的绑定申请列表
const getApplyBindInfoList = async () => { const getApplyBindInfoList = async () => {
try { try {
const { data } = await applyBindInfoListApi() const data = await applyBindInfoListApi()
bindApplyList.value = data bindApplyList.value = data
if (bindApplyList.value.length === 0) { if (bindApplyList.value.length === 0) {
db.set('applyBindMsg', false) db.set('applyBindMsg', false)

View File

@ -10,8 +10,8 @@ export const global = defineStore('global', () => {
// 获取字典列表 // 获取字典列表
const getDicts = async () => { const getDicts = async () => {
const res = await getDictApi() const res = await getDictApi()
dictData.value = res.data dictData.value = res
db.set('dict', res.data) db.set('dict', res)
} }
// 获取字典 // 获取字典

View File

@ -44,21 +44,21 @@ export const user = defineStore('user', () => {
const getUserInfo = async () => { const getUserInfo = async () => {
const res = await getUserInfoApi() const res = await getUserInfoApi()
userInfo.value = res.data userInfo.value = res
db.set('userInfo', res.data) db.set('userInfo', res)
getUserInfoPermit() getUserInfoPermit()
return res.data return res
} }
// 当前登录用户是否管理员身份 // 当前登录用户是否管理员身份
async function getUserInfoPermit() { async function getUserInfoPermit() {
const { data } = await userInfoPermitApi() const data = await userInfoPermitApi()
db.set('userAdmin', data) db.set('userAdmin', data)
} }
const getCsInfo = async () => { const getCsInfo = async () => {
const res = await getCsInfoApi(userInfo.value.id) const res = await getCsInfoApi(userInfo.value.id)
csInfo.value = res.data csInfo.value = res
db.set('csInfo', res.data) db.set('csInfo', res)
return res.data return res
} }
const clear = async () => { const clear = async () => {