|
@@ -1,49 +1,153 @@
|
|
|
import OSticky from '@/components/o-sticky'
|
|
|
-import { Button, Grid, GridItem, Icon, Image, Popover, Popup } from 'vant'
|
|
|
-import { defineComponent, reactive } from 'vue'
|
|
|
+import { Button, DatePicker, Grid, GridItem, Icon, Image, List, Picker, Popover, Popup } from 'vant'
|
|
|
+import { defineComponent, nextTick, onMounted, reactive } from 'vue'
|
|
|
import styles from './information.module.less'
|
|
|
import iconSaveImage from '../images/icon-save-image.png'
|
|
|
import iconWechat from '../images/icon-wechat.png'
|
|
|
import OQrcode from '@/components/o-qrcode'
|
|
|
+import request from '@/helpers/request'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+import { CountUp } from 'countup.js'
|
|
|
+import OEmpty from '@/components/o-empty'
|
|
|
+import dayjs from 'dayjs'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'detail-information',
|
|
|
setup() {
|
|
|
+ const route = useRoute()
|
|
|
const state = reactive({
|
|
|
+ timeShow: false,
|
|
|
+ currentData: [dayjs().year() + ''],
|
|
|
showPopover: false,
|
|
|
- actions: [
|
|
|
- { text: '全部乐团', color: 'var(--van-primary-color)', value: 'ALL' },
|
|
|
- { text: '交付团', value: 'DELIVERY' },
|
|
|
- { text: '晋升团', value: 'PROMOTION' }
|
|
|
- ],
|
|
|
+ actionText: '上学期',
|
|
|
+ actionType: 'up',
|
|
|
actionTerm: [
|
|
|
- { text: '上学期', color: 'var(--van-primary-color)', value: 'ALL' },
|
|
|
- { text: '下学期', value: 'DELIVERY' }
|
|
|
+ { text: '上学期', color: 'var(--van-primary-color)', value: 'up' },
|
|
|
+ { text: '下学期', value: 'down' }
|
|
|
],
|
|
|
oPopover: false,
|
|
|
check: [],
|
|
|
checkboxRefs: [] as any,
|
|
|
- showQrcode: false
|
|
|
+ showQrcode: false,
|
|
|
+ isLoading: false,
|
|
|
+ list: [] as any,
|
|
|
+ listState: {
|
|
|
+ dataShow: true, // 判断是否有数据
|
|
|
+ loading: false,
|
|
|
+ finished: false
|
|
|
+ },
|
|
|
+
|
|
|
+ params: {
|
|
|
+ startTime: dayjs().year() + '-03-01 00:00:00',
|
|
|
+ endTime: dayjs().year() + '-09-01 00:00:00',
|
|
|
+ page: 1,
|
|
|
+ rows: 20
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 选择学期
|
|
|
+ const onSelect = (val: any) => {
|
|
|
+ console.log(val)
|
|
|
+ state.actionTerm.forEach((item: any) => {
|
|
|
+ item.color = null
|
|
|
+ })
|
|
|
+ val.color = 'var(--van-primary-color)'
|
|
|
+ state.actionText = val.text
|
|
|
+ state.actionType = val.value
|
|
|
+ if (val === 'up') {
|
|
|
+ state.params.startTime = dayjs().year() + '-03-01 00:00:00'
|
|
|
+ state.params.endTime = dayjs().year() + '-09-01 00:00:00'
|
|
|
+ } else if (val === 'down') {
|
|
|
+ state.params.startTime = dayjs().year() + '-09-01 00:00:00'
|
|
|
+ state.params.endTime = dayjs().add(1, 'year').year() + '-03-01 00:00:00'
|
|
|
+ }
|
|
|
+ onSearch()
|
|
|
+ }
|
|
|
+
|
|
|
+ const onConfirmDate = (date: any) => {
|
|
|
+ state.currentData = date.selectedValues
|
|
|
+ if (state.actionType == 'up') {
|
|
|
+ state.params.startTime = date.selectedValues[0] + '-03-01 00:00:00'
|
|
|
+ state.params.endTime = date.selectedValues[0] + '-09-01 00:00:00'
|
|
|
+ } else if (state.actionType == 'down') {
|
|
|
+ state.params.startTime = date.selectedValues[0] + 1 + '-03-01 00:00:00'
|
|
|
+ state.params.endTime = date.selectedValues[0] + 1 + '-09-01 00:00:00'
|
|
|
+ }
|
|
|
+ state.timeShow = false
|
|
|
+ console.log(state.params)
|
|
|
+ onSearch()
|
|
|
+ }
|
|
|
+
|
|
|
+ const getDetails = async () => {
|
|
|
+ try {
|
|
|
+ const { data } = await request.get('/api-school/orchestra/detail/' + route.query.id)
|
|
|
+ // console.log(data)
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 班级列表
|
|
|
+ const getList = async () => {
|
|
|
+ try {
|
|
|
+ if (state.isLoading) return
|
|
|
+ state.isLoading = true
|
|
|
+ const res = await request.post('/api-school/classGroup/page', {
|
|
|
+ data: {
|
|
|
+ ...state.params,
|
|
|
+ orchestraId: route.query.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.listState.loading = false
|
|
|
+ const result = res.data || {}
|
|
|
+ // 处理重复请求数据
|
|
|
+ if (state.list.length > 0 && result.pageNo === 1) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const rows = result.rows || []
|
|
|
+ state.list = state.list.concat(rows)
|
|
|
+ state.listState.finished = result.current >= result.pages
|
|
|
+ state.params.page = result.current + 1
|
|
|
+ state.listState.dataShow = state.list.length > 0
|
|
|
+ state.isLoading = false
|
|
|
+ } catch {
|
|
|
+ state.listState.dataShow = false
|
|
|
+ state.listState.finished = true
|
|
|
+ state.isLoading = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const onSearch = () => {
|
|
|
+ state.params.page = 1
|
|
|
+ state.list = []
|
|
|
+ state.listState.dataShow = true // 判断是否有数据
|
|
|
+ state.listState.loading = false
|
|
|
+ state.listState.finished = false
|
|
|
+ getList()
|
|
|
+ }
|
|
|
+
|
|
|
+ const initNumCountUp = () => {
|
|
|
+ nextTick(() => {
|
|
|
+ // 在读学生
|
|
|
+ new CountUp('currentStudentNum', Math.random() * 1000).start()
|
|
|
+ new CountUp('time1', Math.random() * 100).start()
|
|
|
+ new CountUp('time2', Math.random() * 100).start()
|
|
|
+ new CountUp('time3', Math.random() * 100).start()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ getDetails()
|
|
|
+ getList()
|
|
|
+ initNumCountUp()
|
|
|
})
|
|
|
+
|
|
|
return () => (
|
|
|
<>
|
|
|
<div style={{ padding: '12px 13px 16px', background: '#F8F8F8' }}>
|
|
|
- <Popover
|
|
|
- v-model:show={state.showPopover}
|
|
|
- actions={state.actions}
|
|
|
- showArrow={false}
|
|
|
- placement="bottom-start"
|
|
|
- offset={[0, 12]}
|
|
|
- style={{ zIndex: '9999' }}
|
|
|
- >
|
|
|
- {{
|
|
|
- reference: () => (
|
|
|
- <div class={styles.searchBand}>
|
|
|
- 全部乐团 <Icon name={state.showPopover ? 'arrow-up' : 'arrow-down'} />
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Popover>
|
|
|
+ <div class={styles.searchBand} onClick={() => (state.timeShow = true)}>
|
|
|
+ {state.currentData[0]}年 <Icon name={state.showPopover ? 'arrow-up' : 'arrow-down'} />
|
|
|
+ </div>
|
|
|
<Popover
|
|
|
v-model:show={state.oPopover}
|
|
|
actions={state.actionTerm}
|
|
@@ -51,11 +155,12 @@ export default defineComponent({
|
|
|
placement="bottom"
|
|
|
offset={[0, 12]}
|
|
|
style={{ zIndex: '9999' }}
|
|
|
+ onSelect={onSelect}
|
|
|
>
|
|
|
{{
|
|
|
reference: () => (
|
|
|
<div class={styles.searchBand} style="margin-left: 16px">
|
|
|
- 上学期 <Icon name={state.oPopover ? 'arrow-up' : 'arrow-down'} />
|
|
|
+ {state.actionText} <Icon name={state.oPopover ? 'arrow-up' : 'arrow-down'} />
|
|
|
</div>
|
|
|
)
|
|
|
}}
|
|
@@ -65,46 +170,68 @@ export default defineComponent({
|
|
|
<Grid border={false} class={styles.gridContainer}>
|
|
|
<GridItem>
|
|
|
<p class={[styles.title, styles.red]}>
|
|
|
- 92<span>名</span>
|
|
|
+ <span id="currentStudentNum">0</span>
|
|
|
+ <i>名</i>
|
|
|
</p>
|
|
|
<p class={styles.name}>在读学生</p>
|
|
|
</GridItem>
|
|
|
<GridItem>
|
|
|
- <p class={[styles.title, styles.red]}>92%</p>
|
|
|
+ <p class={[styles.title, styles.red]}>
|
|
|
+ <span id="time1">0</span>%
|
|
|
+ </p>
|
|
|
<p class={styles.name}>到课率</p>
|
|
|
</GridItem>
|
|
|
<GridItem>
|
|
|
- <p class={[styles.title, styles.red]}>92%</p>
|
|
|
+ <p class={[styles.title, styles.red]}>
|
|
|
+ <span id="time2">0</span>%
|
|
|
+ </p>
|
|
|
<p class={styles.name}>作业提交率</p>
|
|
|
</GridItem>
|
|
|
<GridItem>
|
|
|
- <p class={[styles.title, styles.red]}>92%</p>
|
|
|
+ <p class={[styles.title, styles.red]}>
|
|
|
+ <span id="time3">0</span>%
|
|
|
+ </p>
|
|
|
<p class={styles.name}>练习合格率</p>
|
|
|
</GridItem>
|
|
|
</Grid>
|
|
|
|
|
|
- {[1, 2, 3, 4, 5, 6].map((val: any) => (
|
|
|
- <div class={[styles.gridContainer, styles.gridClass]}>
|
|
|
- <div class={styles.className}>
|
|
|
- <i class={styles.line}></i>
|
|
|
- 长笛班
|
|
|
- </div>
|
|
|
- <Grid border={false} columnNum={3}>
|
|
|
- <GridItem>
|
|
|
- <p class={styles.title}>18</p>
|
|
|
- <p class={styles.name}>在读学生</p>
|
|
|
- </GridItem>
|
|
|
- <GridItem>
|
|
|
- <p class={[styles.title, styles.teacher]}>张老师</p>
|
|
|
- <p class={styles.name}>伴学指导</p>
|
|
|
- </GridItem>
|
|
|
- <GridItem>
|
|
|
- <p class={styles.title}>10/16</p>
|
|
|
- <p class={styles.name}>课时</p>
|
|
|
- </GridItem>
|
|
|
- </Grid>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
+ {state.listState.dataShow ? (
|
|
|
+ <List
|
|
|
+ v-model:loading={state.listState.loading}
|
|
|
+ finished={state.listState.finished}
|
|
|
+ finishedText=" "
|
|
|
+ class={[styles.liveList]}
|
|
|
+ onLoad={getList}
|
|
|
+ immediateCheck={false}
|
|
|
+ >
|
|
|
+ {state.list.map((item: any) => (
|
|
|
+ <div class={[styles.gridContainer, styles.gridClass]}>
|
|
|
+ <div class={styles.className}>
|
|
|
+ <i class={styles.line}></i>
|
|
|
+ {item.name}
|
|
|
+ </div>
|
|
|
+ <Grid border={false} columnNum={3}>
|
|
|
+ <GridItem>
|
|
|
+ <p class={styles.title}>{item.preStudentNum || 0}</p>
|
|
|
+ <p class={styles.name}>在读学生</p>
|
|
|
+ </GridItem>
|
|
|
+ <GridItem>
|
|
|
+ <p class={[styles.title, styles.teacher]}>{item.teacherName || '/'}</p>
|
|
|
+ <p class={styles.name}>伴学指导</p>
|
|
|
+ </GridItem>
|
|
|
+ <GridItem>
|
|
|
+ <p class={styles.title}>
|
|
|
+ {item.completeCourseScheduleNum || 0}/{item.courseScheduleNum || 0}
|
|
|
+ </p>
|
|
|
+ <p class={styles.name}>课时</p>
|
|
|
+ </GridItem>
|
|
|
+ </Grid>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </List>
|
|
|
+ ) : (
|
|
|
+ <OEmpty btnStatus={false} classImgSize="SMALL" tips="暂无班级" />
|
|
|
+ )}
|
|
|
|
|
|
<OSticky position="bottom">
|
|
|
<div class={'btnGroup'}>
|
|
@@ -164,6 +291,17 @@ export default defineComponent({
|
|
|
</div>
|
|
|
</div>
|
|
|
</Popup>
|
|
|
+
|
|
|
+ <Popup v-model:show={state.timeShow} position="bottom" round>
|
|
|
+ <DatePicker
|
|
|
+ v-model={state.currentData}
|
|
|
+ columnsType={['year']}
|
|
|
+ minDate={new Date(2010, 0, 1)}
|
|
|
+ maxDate={new Date(2055, 11, 31)}
|
|
|
+ onConfirm={onConfirmDate}
|
|
|
+ onCancel={() => (state.timeShow = false)}
|
|
|
+ />
|
|
|
+ </Popup>
|
|
|
</>
|
|
|
)
|
|
|
}
|