|
@@ -1,20 +1,46 @@
|
|
-import Calendar from '@/business-components/calendar'
|
|
|
|
|
|
+import ColProtocol from '@/components/col-protocol'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
import { state } from '@/state'
|
|
import { state } from '@/state'
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
-import { Cell, CellGroup, Dialog, Stepper, Tag } from 'vant'
|
|
|
|
|
|
+import {
|
|
|
|
+ ActionSheet,
|
|
|
|
+ Button,
|
|
|
|
+ Cell,
|
|
|
|
+ CellGroup,
|
|
|
|
+ Dialog,
|
|
|
|
+ Stepper,
|
|
|
|
+ Sticky,
|
|
|
|
+ Tag,
|
|
|
|
+ Popup
|
|
|
|
+} from 'vant'
|
|
import { defineComponent } from 'vue'
|
|
import { defineComponent } from 'vue'
|
|
|
|
+import PracticeCalendar from '../model/practice-calendar'
|
|
import styles from './practice.module.less'
|
|
import styles from './practice.module.less'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'practice',
|
|
name: 'practice',
|
|
|
|
+ props: {
|
|
|
|
+ userInfo: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default: {}
|
|
|
|
+ }
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
const query = this.$route.query
|
|
const query = this.$route.query
|
|
return {
|
|
return {
|
|
teacherId: query.teacherId,
|
|
teacherId: query.teacherId,
|
|
- showSelectList: [],
|
|
|
|
calendarList: {},
|
|
calendarList: {},
|
|
- selectCourseList: []
|
|
|
|
|
|
+ selectCourseList: [],
|
|
|
|
+ agreeStatus: false,
|
|
|
|
+ teacherSubjectList: [],
|
|
|
|
+ subjectStatus: false,
|
|
|
|
+ subjectInfo: {
|
|
|
|
+ subjectPrice: 0,
|
|
|
|
+ courseMinutes: 0,
|
|
|
|
+ subjectName: '',
|
|
|
|
+ subjectId: 0
|
|
|
|
+ },
|
|
|
|
+ courseNum: 4
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
@@ -27,115 +53,118 @@ export default defineComponent({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
)
|
|
)
|
|
- console.log(res)
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ const result = res.data || []
|
|
|
|
+ const findItem = result.find((item: any) => {
|
|
|
|
+ return item.subjectId === Number(this.userInfo.subjectId)
|
|
|
|
+ })
|
|
|
|
+ // 判断是否有跟学生相同的科目,如果没有则默认取第一个
|
|
|
|
+ const tempRes = findItem || result[0]
|
|
|
|
+ const { subjectName, subjectPrice, courseMinutes, subjectId } = tempRes
|
|
|
|
+ this.subjectInfo = {
|
|
|
|
+ subjectPrice,
|
|
|
|
+ courseMinutes,
|
|
|
|
+ subjectName,
|
|
|
|
+ subjectId
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result.forEach((item: any) => {
|
|
|
|
+ item.name = item.subjectName
|
|
|
|
+ })
|
|
|
|
+ this.teacherSubjectList = result
|
|
} catch {}
|
|
} catch {}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async getList(date?: Date) {
|
|
|
|
- try {
|
|
|
|
- console.log(state.user.data)
|
|
|
|
- let params = {
|
|
|
|
- day: dayjs(date || new Date()).format('DD'),
|
|
|
|
- month: dayjs(date || new Date()).format('MM'),
|
|
|
|
- year: dayjs(date || new Date()).format('YYYY')
|
|
|
|
- }
|
|
|
|
- let res = await request.post(
|
|
|
|
- '/api-student/courseSchedule/createPracticeCourseCalendar',
|
|
|
|
- {
|
|
|
|
- data: {
|
|
|
|
- ...params,
|
|
|
|
- studentId: state.user.data?.userId,
|
|
|
|
- teacherId: this.teacherId
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- const result = res.data || []
|
|
|
|
- let tempObj = {}
|
|
|
|
- result.forEach((item: any) => {
|
|
|
|
- tempObj[item.date] = item
|
|
|
|
- })
|
|
|
|
- this.calendarList = tempObj
|
|
|
|
- } catch {}
|
|
|
|
- },
|
|
|
|
- onCloseTag(item: any) {
|
|
|
|
- Dialog.confirm({
|
|
|
|
- title: '提示',
|
|
|
|
- message: '您是否要删除该选择的课程?',
|
|
|
|
- confirmButtonColor: 'var(--van-primary)'
|
|
|
|
- }).then(() => {
|
|
|
|
- // const index = createState.selectCourseList.findIndex(
|
|
|
|
- // (course: any) => course.startTime === item.startTime
|
|
|
|
- // )
|
|
|
|
- // createState.selectCourseList.splice(index, 1)
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ onSubmit() {}
|
|
},
|
|
},
|
|
render() {
|
|
render() {
|
|
return (
|
|
return (
|
|
- <div class={styles.practice}>
|
|
|
|
- <CellGroup class={styles.group}>
|
|
|
|
- <Cell
|
|
|
|
- title="陪练课收费"
|
|
|
|
- v-slots={{
|
|
|
|
- default: () => (
|
|
|
|
- <div class={styles.price}>
|
|
|
|
- <span>¥40</span>/25分钟
|
|
|
|
- </div>
|
|
|
|
- )
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
- <Cell title="选择专业" isLink value="竖笛" />
|
|
|
|
- <Cell
|
|
|
|
- title="课时数"
|
|
|
|
- v-slots={{
|
|
|
|
- default: () => <Stepper theme="round" buttonSize={22} />
|
|
|
|
- }}
|
|
|
|
|
|
+ <>
|
|
|
|
+ <div class={styles.practice}>
|
|
|
|
+ <CellGroup class={styles.group}>
|
|
|
|
+ <Cell
|
|
|
|
+ title="陪练课收费"
|
|
|
|
+ v-slots={{
|
|
|
|
+ default: () => (
|
|
|
|
+ <div class={styles.price}>
|
|
|
|
+ <span>
|
|
|
|
+ ¥
|
|
|
|
+ {(this as any).$filters.moneyFormat(
|
|
|
|
+ this.subjectInfo.subjectPrice
|
|
|
|
+ )}
|
|
|
|
+ </span>
|
|
|
|
+ /{this.subjectInfo.courseMinutes}分钟
|
|
|
|
+ </div>
|
|
|
|
+ )
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ <Cell
|
|
|
|
+ title="选择专业"
|
|
|
|
+ isLink
|
|
|
|
+ value={this.subjectInfo.subjectName}
|
|
|
|
+ onClick={() => (this.subjectStatus = true)}
|
|
|
|
+ />
|
|
|
|
+ <Cell
|
|
|
|
+ title="课时数"
|
|
|
|
+ v-slots={{
|
|
|
|
+ default: () => (
|
|
|
|
+ <Stepper
|
|
|
|
+ v-model={this.courseNum}
|
|
|
|
+ theme="round"
|
|
|
|
+ max={12}
|
|
|
|
+ min={1}
|
|
|
|
+ buttonSize={22}
|
|
|
|
+ onChange={() => {
|
|
|
|
+ this.selectCourseList = []
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ )
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ </CellGroup>
|
|
|
|
+
|
|
|
|
+ <PracticeCalendar
|
|
|
|
+ teacherId={this.teacherId as string}
|
|
|
|
+ courseNum={this.courseNum}
|
|
/>
|
|
/>
|
|
- </CellGroup>
|
|
|
|
|
|
|
|
- <div class={styles.group}>
|
|
|
|
- <Calendar
|
|
|
|
- selectList={this.selectCourseList}
|
|
|
|
- list={this.calendarList}
|
|
|
|
- maxDays={5}
|
|
|
|
- nextMonth={(date: Date) => this.getList(date)}
|
|
|
|
- prevMonth={(date: Date) => this.getList(date)}
|
|
|
|
- selectDay={this.onSelectDay}
|
|
|
|
|
|
+ <ActionSheet
|
|
|
|
+ show={this.subjectStatus}
|
|
|
|
+ actions={this.teacherSubjectList}
|
|
|
|
+ cancelText="取消"
|
|
|
|
+ closeOnClickAction
|
|
|
|
+ onCancel={() => (this.subjectStatus = false)}
|
|
|
|
+ onSelect={(item: any) => {
|
|
|
|
+ const { subjectName, subjectPrice, courseMinutes, subjectId } =
|
|
|
|
+ item
|
|
|
|
+ this.subjectInfo = {
|
|
|
|
+ subjectPrice,
|
|
|
|
+ courseMinutes,
|
|
|
|
+ subjectName,
|
|
|
|
+ subjectId
|
|
|
|
+ }
|
|
|
|
+ this.subjectStatus = false
|
|
|
|
+ }}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
+ <Sticky offsetBottom={0} position="bottom">
|
|
|
|
+ <div class={styles.protocol}>
|
|
|
|
+ <ColProtocol
|
|
|
|
+ v-model={this.agreeStatus}
|
|
|
|
+ showHeader
|
|
|
|
+ style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
|
|
- <Cell
|
|
|
|
- class={[styles.arrangeCell, 'mb12']}
|
|
|
|
- v-slots={{
|
|
|
|
- title: () => (
|
|
|
|
- <div class={styles.rTitle}>
|
|
|
|
- <span>已选择课程时间</span>
|
|
|
|
- </div>
|
|
|
|
- ),
|
|
|
|
- label: () => (
|
|
|
|
- <div class={styles.rTag}>
|
|
|
|
- {this.showSelectList.map((item: any) => (
|
|
|
|
- <>
|
|
|
|
- <Tag
|
|
|
|
- plain
|
|
|
|
- round
|
|
|
|
- closeable
|
|
|
|
- size="large"
|
|
|
|
- type="primary"
|
|
|
|
- class={styles.tag}
|
|
|
|
- onClose={() => this.onCloseTag(item)}
|
|
|
|
- >
|
|
|
|
- {item.title}
|
|
|
|
- </Tag>
|
|
|
|
- <br />
|
|
|
|
- </>
|
|
|
|
- ))}
|
|
|
|
- </div>
|
|
|
|
- )
|
|
|
|
- }}
|
|
|
|
- ></Cell>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div
|
|
|
|
+ class={'btnGroup'}
|
|
|
|
+ style={{ background: '#fff', paddingTop: '10px' }}
|
|
|
|
+ >
|
|
|
|
+ <Button block round type="primary" onClick={this.onSubmit}>
|
|
|
|
+ 确认约课
|
|
|
|
+ </Button>
|
|
|
|
+ </div>
|
|
|
|
+ </Sticky>
|
|
|
|
+ </>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
})
|
|
})
|