|
@@ -16,6 +16,7 @@ import { getTimeRange, TIME_TYPE } from '../home-statistics'
|
|
|
import ColResult from '@/components/col-result'
|
|
|
import { promisefiyPostMessage } from '@/helpers/native-message'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
+import { state } from '@/state'
|
|
|
|
|
|
/** 秒转分 */
|
|
|
export const formatSecToMin = (second: number) => {
|
|
@@ -45,22 +46,31 @@ export const formatSecToHMS = second => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const catchKey = 'practice-statistics-detail-search'
|
|
|
export default defineComponent({
|
|
|
name: 'PracticeDetail',
|
|
|
setup() {
|
|
|
const router = useRouter()
|
|
|
+
|
|
|
+ let catchSearch: any = sessionStorage.getItem(catchKey)
|
|
|
+ catchSearch = catchSearch ? JSON.parse(catchSearch) : {}
|
|
|
+ sessionStorage.removeItem(catchKey)
|
|
|
+
|
|
|
const searchStatus = ref(false)
|
|
|
- const currentType = ref<TIME_TYPE>('MONTH')
|
|
|
+ const currentType = ref<TIME_TYPE>(catchSearch.currentType !== undefined ? catchSearch.currentType : 'MONTH')
|
|
|
|
|
|
const searchObj = reactive({
|
|
|
- tempSubjectId: '' as any,
|
|
|
- type: 'MONTH' as TIME_TYPE
|
|
|
+ tempSubjectId: catchSearch.subjectId || '' as any,
|
|
|
+ type: catchSearch.currentType !== undefined ? catchSearch.currentType : 'MONTH' as TIME_TYPE
|
|
|
})
|
|
|
- const timeRange = getTimeRange(currentType.value)
|
|
|
+ const timeRange = catchSearch.startTime && catchSearch.endTime ? {
|
|
|
+ startTime: catchSearch.startTime,
|
|
|
+ endTime: catchSearch.endTime
|
|
|
+ } : getTimeRange(currentType.value)
|
|
|
const forms = reactive({
|
|
|
loading: false,
|
|
|
dataShow: true,
|
|
|
- subjectId: '' as any, // 选择的声部
|
|
|
+ subjectId: catchSearch.subjectId || '' as any, // 选择的声部
|
|
|
subjectList: [] as any,
|
|
|
startTimeStatus: false,
|
|
|
startTimeClosedStatus: false,
|
|
@@ -131,15 +141,13 @@ export default defineComponent({
|
|
|
|
|
|
const pathname = data || ''
|
|
|
if (pathname) {
|
|
|
- const filenameWithExtension = pathname.split('/').pop()
|
|
|
- const filename = filenameWithExtension.split('.')[0]
|
|
|
- console.log(filename) // 输出: page
|
|
|
+ const fileName = `练习详情${forms.startTimeStr}~${forms.endTimeStr}_${state.user.data?.userId}`
|
|
|
// 发送消息通知移动端下载文件
|
|
|
promisefiyPostMessage({
|
|
|
api: 'downloadFile',
|
|
|
content: {
|
|
|
downloadUrl: pathname,
|
|
|
- fileName: filename
|
|
|
+ fileName
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -171,10 +179,14 @@ export default defineComponent({
|
|
|
// 练习时长
|
|
|
const practiceTimes = data.practiceTimes || []
|
|
|
const xAxisDataTimes: string[] = []
|
|
|
- const practiceTimeList: string[] = []
|
|
|
+ const practiceTimeList: any[] = []
|
|
|
practiceTimes.forEach((item: any, index: number) => {
|
|
|
xAxisDataTimes.push(item.date)
|
|
|
- practiceTimeList.push(formatSecToMin(item.practiceTime))
|
|
|
+ practiceTimeList.push([
|
|
|
+ index,
|
|
|
+ formatSecToMin(item.practiceTime),
|
|
|
+ item.practiceTime
|
|
|
+ ])
|
|
|
|
|
|
if (practiceTimes.length - 1 === index) {
|
|
|
obj.value.timeCount = item.practiceTime
|
|
@@ -292,6 +304,7 @@ export default defineComponent({
|
|
|
// timeRange.value = getTimeRange(currentType.value)
|
|
|
searchStatus.value = false
|
|
|
forms.subjectId = searchObj.tempSubjectId
|
|
|
+ currentType.value = searchObj.type
|
|
|
getDetail()
|
|
|
getStudentDetail()
|
|
|
}
|
|
@@ -320,10 +333,16 @@ export default defineComponent({
|
|
|
|
|
|
/** 跳转详情 */
|
|
|
const toDetail = (item: any) => {
|
|
|
+ sessionStorage.setItem(catchKey, JSON.stringify({
|
|
|
+ startTime: forms.startTimeStr,
|
|
|
+ endTime: forms.endTimeStr,
|
|
|
+ currentType: currentType.value,
|
|
|
+ subjectId: forms.subjectId
|
|
|
+ }))
|
|
|
router.push({
|
|
|
path: '/exercise-detail',
|
|
|
query: {
|
|
|
- studentId: item.userId || ''
|
|
|
+ studentId: item.userId || '',
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -458,7 +477,15 @@ export default defineComponent({
|
|
|
>
|
|
|
练习时长
|
|
|
<div class={styles.filters}>
|
|
|
- <Icon
|
|
|
+ <i class={['iconfont iconfont-down', styles.upArrow]} style={{ color: forms.sortField === 'totalPracticeTime' &&
|
|
|
+ forms.sortType === 'ASC'
|
|
|
+ ? 'rgba(223, 128, 16, 1)'
|
|
|
+ : 'rgba(0, 0, 0, 0.20)' }}></i>
|
|
|
+ <i class={['iconfont iconfont-down', styles.downArrow]} style={{ color: forms.sortField === 'totalPracticeTime' &&
|
|
|
+ forms.sortType === 'DESC'
|
|
|
+ ? 'rgba(223, 128, 16, 1)'
|
|
|
+ : 'rgba(0, 0, 0, 0.20)' }}></i>
|
|
|
+ {/* <Icon
|
|
|
classPrefix="iconfont"
|
|
|
name="down"
|
|
|
class={styles.upArrow}
|
|
@@ -481,7 +508,7 @@ export default defineComponent({
|
|
|
? 'rgba(223, 128, 16, 1)'
|
|
|
: 'rgba(0, 0, 0, 0.20)'
|
|
|
}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
</div>
|
|
|
</div>
|
|
|
</th>
|
|
@@ -493,30 +520,14 @@ export default defineComponent({
|
|
|
>
|
|
|
平均练习时长
|
|
|
<div class={styles.filters}>
|
|
|
- <Icon
|
|
|
- classPrefix="iconfont"
|
|
|
- name="down"
|
|
|
- class={styles.upArrow}
|
|
|
- size={12}
|
|
|
- color={
|
|
|
- forms.sortField === 'averagePracticeTime' &&
|
|
|
+ <i class={['iconfont iconfont-down', styles.upArrow]} style={{ color: forms.sortField === 'averagePracticeTime' &&
|
|
|
forms.sortType === 'ASC'
|
|
|
? 'rgba(223, 128, 16, 1)'
|
|
|
- : 'rgba(0, 0, 0, 0.20)'
|
|
|
- }
|
|
|
- />
|
|
|
- <Icon
|
|
|
- classPrefix="iconfont"
|
|
|
- name="down"
|
|
|
- class={styles.downArrow}
|
|
|
- size={12}
|
|
|
- color={
|
|
|
- forms.sortField === 'averagePracticeTime' &&
|
|
|
+ : 'rgba(0, 0, 0, 0.20)' }}></i>
|
|
|
+ <i class={['iconfont iconfont-down', styles.downArrow]} style={{ color: forms.sortField === 'averagePracticeTime' &&
|
|
|
forms.sortType === 'DESC'
|
|
|
? 'rgba(223, 128, 16, 1)'
|
|
|
- : 'rgba(0, 0, 0, 0.20)'
|
|
|
- }
|
|
|
- />
|
|
|
+ : 'rgba(0, 0, 0, 0.20)' }}></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</th>
|