index.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. import {
  2. computed,
  3. defineComponent,
  4. onMounted,
  5. reactive,
  6. ref,
  7. watch,
  8. nextTick
  9. } from 'vue'
  10. import {
  11. Image,
  12. Tabs,
  13. Tab,
  14. List,
  15. Button,
  16. Popup,
  17. Dialog,
  18. Sticky,
  19. Swipe,
  20. SwipeItem,
  21. Picker
  22. } from 'vant'
  23. import styles from './index.module.less'
  24. import TheSticky from '@/components/the-sticky'
  25. import ColHeader from '@/components/col-header'
  26. import { useWindowScroll, useEventListener } from '@vueuse/core'
  27. import request from '@/helpers/request'
  28. import iconMenu from './images/icon-menu.png'
  29. import iconRightTop from './images/icon-right-top.png'
  30. import iconAlbumCover from '../../images/icon-album-cover.png'
  31. import iconTimer from './images/icon-timer.png'
  32. import iconArrow from './images/icon-arrow.png'
  33. import { state as baseState, setLogout } from '@/state'
  34. import Song from '../component/song'
  35. import { useRoute, useRouter } from 'vue-router'
  36. import ColResult from '@/components/col-result'
  37. import { moneyFormat } from '@/helpers/utils'
  38. import { orderStatus } from '@/views/order-detail/orderStatus'
  39. import { postMessage } from '@/helpers/native-message'
  40. import { browser } from '@/helpers/utils'
  41. // Import Swiper Vue.js components
  42. // import Swiper core and required modules
  43. import { Pagination } from 'swiper/modules'
  44. import { Swiper, SwiperSlide } from 'swiper/vue'
  45. // Import Swiper styles
  46. import 'swiper/css'
  47. import 'swiper/css/pagination'
  48. import CourseItem from '../lessonCourseware/component/CourseItem'
  49. export default defineComponent({
  50. name: 'train-tool',
  51. setup() {
  52. const sessionStorageToolSubject =
  53. sessionStorage.getItem('tool-subject-type')
  54. const toolSubject =
  55. sessionStorageToolSubject && JSON.parse(sessionStorageToolSubject)
  56. sessionStorage.removeItem('tool-subject-type')
  57. const route = useRoute()
  58. const router = useRouter()
  59. const background = ref<string>('rgba(55, 205, 177, 0)')
  60. const color = ref<string>('#fff')
  61. const state = reactive({
  62. details: {} as any,
  63. buy: route.query.buy as any,
  64. albumId: route.query.albumId || null,
  65. activeTab:
  66. toolSubject?.activeTab || route.query.subjectType || 'COURSEWARE', // 有缓存 默认用缓存,之后用请求头,最后默认
  67. loadingAlbum: false,
  68. loading: false,
  69. finished: false,
  70. isError: false,
  71. list: [] as any,
  72. popupStatus: false,
  73. selectMember: {} as any, // 购买的月份
  74. ensembleCounts: false,
  75. musicCounts: false,
  76. subjectCounts: false,
  77. coursewareCounts: false,
  78. tenantAlbumStatus: 0 as any,
  79. ablumStatus: false,
  80. heightV: 0,
  81. hasBuyStatus: true, // 是否能继续购买
  82. albumList: [] as any, // 专辑列表
  83. initialSlide: 0,
  84. subjectStatus: false,
  85. openStatus: false,
  86. teacherSubjectId: null as any,
  87. teacherSubjectName: null as any,
  88. teacherSubjectIndex: 0,
  89. subjectList: [] // 声部列表
  90. })
  91. const params = reactive({
  92. page: 1,
  93. rows: 20
  94. })
  95. const apiSuffix = ref(
  96. baseState.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
  97. )
  98. const isSingleAlbum = computed(() => {
  99. const query = route.query
  100. if (query.taId || (query.albumId && state.buy === '1')) {
  101. return true
  102. } else {
  103. return false
  104. }
  105. })
  106. const getDetails = async () => {
  107. state.loadingAlbum = true
  108. try {
  109. // tenantGroupAlbum/buyAlbumInfo
  110. // 当我的曲目过来的时候才走单个查询
  111. if (state.albumId && state.buy === '1') {
  112. let url = apiSuffix.value + '/userTenantAlbumRecord/detail'
  113. if (state.albumId) {
  114. url = url + '?albumId=' + state.albumId
  115. }
  116. const { data } = await request.post(url)
  117. state.albumList = [data || {}]
  118. state.details = data || {}
  119. } else {
  120. const url =
  121. apiSuffix.value +
  122. `/tenantGroupAlbum/buyAlbumInfo?tenantGroupAlbumId=${
  123. route.query.taId || ''
  124. }`
  125. //&tenantAlbumId=${state.albumId || ''}
  126. // if (state.albumId) {
  127. // url = url + '?albumId=' + state.albumId
  128. // }
  129. const { data } = await request.get(url)
  130. state.albumList = data || []
  131. if (state.albumList.length > 0) {
  132. let index = 0
  133. // 以缓存为优先 其次 请求头 state.albumId
  134. if (toolSubject?.tenantGroupAlbumId || state.albumId) {
  135. index = state.albumList.findIndex(item => {
  136. return toolSubject?.tenantGroupAlbumId
  137. ? (baseState.platformType === 'STUDENT'
  138. ? item.tenantGroupAlbumId
  139. : item.id) === toolSubject?.tenantGroupAlbumId
  140. : item.id == state.albumId // 这里不全等 因为state.albumId为字符串 id为number
  141. })
  142. index < 0 && (index = 0)
  143. }
  144. state.initialSlide = index //默认展示第几个
  145. state.details = state.albumList[index] // 有缓存 就用缓存里面的数据
  146. } else {
  147. // state.albumList
  148. if (!browser().isApp) {
  149. Dialog.alert({
  150. title: '提示',
  151. message: '该教程不可购买',
  152. confirmButtonText: '确定',
  153. confirmButtonColor: '#2dc7aa'
  154. }).then(() => {
  155. if (browser().isApp) {
  156. postMessage({ api: 'back' })
  157. } else {
  158. setLogout()
  159. router.replace({
  160. path: '/login' as any,
  161. query: {
  162. returnUrl: '/train-tool',
  163. ...route.query
  164. }
  165. })
  166. }
  167. })
  168. }
  169. }
  170. }
  171. } catch {
  172. //
  173. }
  174. state.loadingAlbum = false
  175. }
  176. watch(
  177. () => state.details,
  178. () => {
  179. state.ensembleCounts = state.details?.ensembleCounts ? true : false
  180. state.subjectCounts = state.details?.subjectCounts ? true : false
  181. state.musicCounts = state.details?.musicCounts ? true : false
  182. state.coursewareCounts = state.details?.coursewareCounts ? true : false
  183. if (state.details.buyTimesFlag) {
  184. if (state.details.buyedTimes >= state.details.buyTimes) {
  185. state.hasBuyStatus = false
  186. } else {
  187. state.hasBuyStatus = true
  188. }
  189. } else {
  190. state.hasBuyStatus = true
  191. }
  192. }
  193. )
  194. let listController
  195. const FetchList = async (hideLoading = false) => {
  196. if (!state.details.id) {
  197. return
  198. }
  199. if (listController) {
  200. listController.abort()
  201. }
  202. state.loading = true
  203. state.isError = false
  204. const tempParams = {
  205. albumId: state.details.id || null,
  206. subjectType: state.activeTab,
  207. ...params
  208. } as any
  209. // 老师端默认查询声部
  210. if (baseState.platformType === 'TEACHER') {
  211. // const users = baseState.user.data
  212. tempParams.subjectId = state.teacherSubjectId || null
  213. }
  214. try {
  215. listController = new AbortController()
  216. const { signal } = listController
  217. const { data } = await request.post(
  218. `${apiSuffix.value}/tenantAlbumMusic/page`,
  219. {
  220. hideLoading,
  221. data: tempParams,
  222. signal
  223. }
  224. )
  225. if (state.list.length > 0 && data.pageNo === 1) {
  226. return
  227. }
  228. state.list = state.list.concat(data.rows || [])
  229. params.page = data.pageNo + 1
  230. // showContact.value = state.list.length > 0
  231. state.loading = false
  232. state.finished = data.pageNo >= data.totalPage
  233. params.page = data.pageNo + 1
  234. } catch (error) {
  235. state.isError = true
  236. }
  237. state.loading = false
  238. }
  239. const getSubjectList = async () => {
  240. try {
  241. const res = await request.get('/api-tenant/open/subject/queryPage', {
  242. data: { page: 1, rows: 9999 }
  243. })
  244. const result = res.data.rows || []
  245. result.forEach((item: any) => {
  246. item.text = item.name
  247. })
  248. state.subjectList = result || []
  249. const index = state.subjectList.findIndex(
  250. (item: any) => item.id == state.teacherSubjectId
  251. )
  252. state.teacherSubjectIndex = index === -1 ? 0 : index
  253. } catch (e) {
  254. console.log(e)
  255. }
  256. }
  257. onMounted(async () => {
  258. // useEventListener(document, 'scroll', evt => {
  259. // const { y } = useWindowScroll()
  260. // if (y.value > 20) {
  261. // background.value = `rgba(255, 255, 255)`
  262. // } else {
  263. // background.value = 'transparent'
  264. // }
  265. // })
  266. // 老师端默认查询声部
  267. if (baseState.platformType === 'TEACHER') {
  268. const users = baseState.user.data
  269. state.teacherSubjectId = users.defaultSubject || null
  270. state.teacherSubjectName = users.defaultSubjectName || null
  271. }
  272. state.loading = true
  273. state.loadingAlbum = true
  274. await getDetails()
  275. await FetchList()
  276. getSubjectList()
  277. state.loadingAlbum = false
  278. state.loading = false
  279. // 为了处理 swiper 会不显示的问题
  280. document.body.scrollIntoView()
  281. window.scrollTo(1, 0)
  282. })
  283. function handleChangeActiveTab() {
  284. state.activeTab = state.details?.coursewareCounts
  285. ? 'COURSEWARE'
  286. : state.details?.subjectCounts
  287. ? 'SUBJECT'
  288. : state.details?.musicCounts
  289. ? 'MUSIC'
  290. : 'ENSEMBLE'
  291. }
  292. const onSubmit = async () => {
  293. const album = state.details
  294. const details = state.details
  295. orderStatus.orderObject.orderType = 'TENANT_ALBUM'
  296. orderStatus.orderObject.orderName = details.name
  297. orderStatus.orderObject.orderDesc = details.name
  298. orderStatus.orderObject.actualPrice = album.actualPrice
  299. // orderStatus.orderObject.recomUserId = route.query.recomUserId || 0
  300. // orderStatus.orderObject.activityId = route.query.activityId || 0
  301. orderStatus.orderObject.orderNo = ''
  302. orderStatus.orderObject.orderList = [
  303. {
  304. orderType: 'TENANT_ALBUM',
  305. goodsName: details.name,
  306. actualPrice: album.actualPrice,
  307. price: album.actualPrice,
  308. ...details,
  309. ...album
  310. }
  311. ]
  312. const res = await request.post('/api-student/userOrder/getPendingOrder', {
  313. data: {
  314. goodType: 'TENANT_ALBUM',
  315. bizId: details.id
  316. }
  317. })
  318. const result = res.data
  319. if (result) {
  320. state.popupStatus = false
  321. Dialog.confirm({
  322. title: '提示',
  323. message: '您有一个未支付的订单,是否继续支付?',
  324. theme: 'round-button',
  325. className: 'confirm-button-group',
  326. cancelButtonText: '取消订单',
  327. confirmButtonText: '继续支付'
  328. })
  329. .then(async () => {
  330. orderStatus.orderObject.orderNo = result.orderNo
  331. orderStatus.orderObject.actualPrice = result.actualPrice
  332. orderStatus.orderObject.discountPrice = result.discountPrice
  333. orderStatus.orderObject.paymentConfig = {
  334. ...result.paymentConfig,
  335. paymentVendor: result.paymentVendor,
  336. paymentVersion: result.paymentVersion
  337. }
  338. routerTo()
  339. })
  340. .catch(() => {
  341. Dialog.close()
  342. // 只用取消订单,不用做其它处理
  343. cancelPayment(result.orderNo)
  344. })
  345. } else {
  346. routerTo()
  347. }
  348. }
  349. const routerTo = () => {
  350. const album = state.details
  351. sessionStorage.setItem(
  352. 'tool-subject-type',
  353. JSON.stringify({
  354. activeTab: state.activeTab,
  355. tenantGroupAlbumId:
  356. baseState.platformType === 'STUDENT'
  357. ? state.details.tenantGroupAlbumId
  358. : state.details.id // 老师用专辑id当唯一值
  359. })
  360. )
  361. router.push({
  362. path: '/orderDetail',
  363. query: {
  364. orderType: 'ALBUM',
  365. album: album.id
  366. }
  367. })
  368. }
  369. const cancelPayment = async (orderNo: string) => {
  370. try {
  371. await request.post('/api-student/userOrder/orderCancel/v2', {
  372. data: {
  373. orderNo
  374. }
  375. })
  376. } catch {
  377. //
  378. }
  379. }
  380. return () => (
  381. <div class={styles.trainTool}>
  382. {!state.loading && !state.details.id && state.buy != '1' ? (
  383. <>
  384. <TheSticky
  385. class={styles.theSticky}
  386. position="top"
  387. onBarHeight={(height: any) => {
  388. console.log(height, 'height', height)
  389. state.heightV = height
  390. }}
  391. >
  392. <ColHeader border={false} isFixed={false} />
  393. </TheSticky>
  394. {!state.loading && (
  395. <div
  396. class={styles.colResultBox}
  397. style={{
  398. height: 'calc(100vh - var(--header-height))',
  399. display: 'flex',
  400. alignItems: 'center'
  401. }}
  402. >
  403. <ColResult
  404. tips="暂无教程"
  405. classImgSize="SMALL"
  406. btnStatus={false}
  407. />
  408. </div>
  409. )}
  410. </>
  411. ) : (
  412. !state.loadingAlbum && (
  413. <>
  414. <TheSticky
  415. class={styles.theSticky}
  416. position="top"
  417. onBarHeight={(height: any) => {
  418. state.heightV = height
  419. }}
  420. >
  421. <ColHeader
  422. background={background.value}
  423. border={false}
  424. isFixed={false}
  425. hideHeader={route.query.taId ? true : false}
  426. // color={color.value}
  427. // backIconColor="white"
  428. >
  429. {{
  430. right: () =>
  431. baseState.platformType === 'TEACHER' && (
  432. <div
  433. class={styles.changeSubjectSection}
  434. onClick={() => {
  435. state.subjectStatus = true
  436. }}
  437. >
  438. <span class={styles.subjectName}>
  439. {state.teacherSubjectName}
  440. </span>
  441. <img
  442. class={state.subjectStatus && styles.active}
  443. src={iconArrow}
  444. />
  445. </div>
  446. )
  447. }}
  448. </ColHeader>
  449. </TheSticky>
  450. {/* <img class={styles.bgImg} src={state.details?.coverImg} /> */}
  451. <div class={styles.musicContent}></div>
  452. <div class={styles.bg}>
  453. <div class={styles.alumWrap}>
  454. {isSingleAlbum.value ? (
  455. <div class={styles.singleAlbum}>
  456. <div class={styles.img}>
  457. {state.details?.buyTimesFlag && (
  458. <span class={styles.quota}>
  459. 限购:{state.details?.buyedTimes}/
  460. {state.details?.buyTimes}次
  461. </span>
  462. )}
  463. <Image
  464. class={styles.image}
  465. width="100%"
  466. height="100%"
  467. fit="cover"
  468. src={state.details?.coverImg || iconAlbumCover}
  469. errorIcon={iconAlbumCover}
  470. />
  471. <div class={styles.iconPian}></div>
  472. </div>
  473. </div>
  474. ) : (
  475. state.albumList &&
  476. state.albumList.length > 0 && (
  477. <Swiper
  478. initialSlide={state.initialSlide}
  479. watchSlidesProgress={true}
  480. slidesPerView={'auto'}
  481. centeredSlides={true}
  482. modules={[Pagination]}
  483. pagination={{ clickable: true }}
  484. // onTransitionEnd={(swiper: any) => {}} onSlideChange
  485. onSlideChange={(swiper: any) => {
  486. state.details = state.albumList[swiper.activeIndex]
  487. // 等tab渲染完了之后再切换 不然tab会自动重新赋值
  488. nextTick(() => {
  489. // 当有初始值的时候不刷新
  490. if (state.initialSlide) {
  491. state.initialSlide = 0
  492. return
  493. }
  494. handleChangeActiveTab()
  495. params.page = 1
  496. state.list = []
  497. FetchList(true)
  498. })
  499. }}
  500. >
  501. {state.albumList.map((album: any) => (
  502. <SwiperSlide>
  503. <div class={styles.img}>
  504. {album.buyTimesFlag && (
  505. <span class={styles.quota}>
  506. 限购{album.buyedTimes}/{album.buyTimes}次
  507. </span>
  508. )}
  509. <Image
  510. class={styles.image}
  511. width="100%"
  512. height="100%"
  513. fit="cover"
  514. src={album?.coverImg || iconAlbumCover}
  515. errorIcon={iconAlbumCover}
  516. />
  517. <div class={styles.iconPian}></div>
  518. </div>
  519. </SwiperSlide>
  520. ))}
  521. </Swiper>
  522. )
  523. )}
  524. <div class={styles.alumDes}>
  525. <div class={[styles.alumTitle, 'van-ellipsis']}>
  526. {state.details?.name}
  527. </div>
  528. <div
  529. class={[styles.des, 'van-multi-ellipsis--l2']}
  530. style={{
  531. height: '32px',
  532. lineHeight: '16px'
  533. }}
  534. >
  535. {state.details?.describe}
  536. </div>
  537. </div>
  538. {state.buy != '1' && baseState.platformType === 'STUDENT' && (
  539. <div class={styles.albumPriceGroup}>
  540. <div class={styles.albumTimer}>
  541. <img src={iconTimer} class={styles.iconTimer} />
  542. <span>有效期:{state.details?.purchaseNum || 0}天</span>
  543. </div>
  544. <div class={styles.albumPriceList}>
  545. {(state.details?.originalPrice || 0) >
  546. (state.details?.actualPrice || 0) && (
  547. <del class={styles.originPrice}>
  548. 原价:¥
  549. {moneyFormat(state.details?.originalPrice || 0)}
  550. </del>
  551. )}
  552. <span class={styles.currentPrice}>
  553. <span>
  554. ¥{moneyFormat(state.details?.actualPrice || 0)}
  555. </span>
  556. </span>
  557. </div>
  558. </div>
  559. )}
  560. </div>
  561. </div>
  562. <div class={styles.musicList}>
  563. <Sticky position="top" offsetTop={state.heightV}>
  564. <Tabs
  565. color="var(--van-primary)"
  566. background="transparent"
  567. lineWidth={20}
  568. shrink
  569. v-model:active={state.activeTab}
  570. onClick-tab={val => {
  571. state.activeTab = val.name
  572. params.page = 1
  573. state.list = []
  574. FetchList()
  575. }}
  576. >
  577. {state.coursewareCounts && (
  578. <Tab title="云课堂" name="COURSEWARE"></Tab>
  579. )}
  580. {state.subjectCounts && (
  581. <Tab title="声部云练" name="SUBJECT"></Tab>
  582. )}
  583. {state.musicCounts && (
  584. <Tab title="独奏云练" name="MUSIC"></Tab>
  585. )}
  586. {state.ensembleCounts && (
  587. <Tab title="合奏云练" name="ENSEMBLE"></Tab>
  588. )}
  589. </Tabs>
  590. </Sticky>
  591. <div
  592. class={[
  593. styles.alumnList,
  594. state.activeTab === 'COURSEWARE'
  595. ? styles.alumnListCourseware
  596. : ''
  597. ]}
  598. >
  599. <List
  600. loading={state.loading}
  601. finished={state.finished}
  602. finished-text={' '}
  603. onLoad={FetchList}
  604. immediateCheck={false}
  605. error={state.isError}
  606. >
  607. {state.list && state.list.length ? (
  608. state.activeTab === 'COURSEWARE' ? (
  609. <CourseItem
  610. list={state.list.map(item => {
  611. return {
  612. name: item.musicSheetName,
  613. coverImg: item.titleImg,
  614. id: item.id
  615. }
  616. })}
  617. onItemClick={row => {
  618. sessionStorage.setItem(
  619. 'tool-subject-type',
  620. JSON.stringify({
  621. activeTab: state.activeTab,
  622. tenantGroupAlbumId:
  623. baseState.platformType === 'STUDENT'
  624. ? state.details.tenantGroupAlbumId
  625. : state.details.id // 老师用专辑id当唯一值
  626. })
  627. )
  628. router.push({
  629. path: '/courseList',
  630. query: {
  631. id: row.id,
  632. albumId: state.details.id,
  633. taId: state.details.tenantGroupAlbumId, // 当通过我的曲目进来的时候 这个值为空
  634. buyStatus: state.hasBuyStatus ? '0' : '1' //默认能购买
  635. }
  636. })
  637. }}
  638. />
  639. ) : (
  640. <Song
  641. showNumber
  642. list={state.list}
  643. onDetail={(item: any) => {
  644. sessionStorage.setItem(
  645. 'tool-subject-type',
  646. JSON.stringify({
  647. activeTab: state.activeTab,
  648. tenantGroupAlbumId:
  649. baseState.platformType === 'STUDENT'
  650. ? state.details.tenantGroupAlbumId
  651. : state.details.id // 老师用专辑id当唯一值
  652. })
  653. )
  654. router.push({
  655. path: '/music-detail',
  656. query: {
  657. id: item.id,
  658. tenantAlbumId: item.tenantAlbumId,
  659. taId: state.details.tenantGroupAlbumId, // 当通过我的曲目进来的时候 这个值为空
  660. buyStatus: state.hasBuyStatus ? '0' : '1' //默认能购买
  661. }
  662. })
  663. }}
  664. />
  665. )
  666. ) : (
  667. !state.loading && (
  668. <ColResult
  669. tips={
  670. state.activeTab === 'COURSEWARE'
  671. ? '暂无教材'
  672. : '暂无曲目'
  673. }
  674. classImgSize="SMALL"
  675. btnStatus={false}
  676. />
  677. )
  678. )}
  679. </List>
  680. </div>
  681. </div>
  682. {baseState.platformType === 'STUDENT' && state.buy != '1' && (
  683. <TheSticky position="bottom">
  684. <div class={styles.btnGroup}>
  685. <Button
  686. round
  687. block
  688. disabled={!state.hasBuyStatus}
  689. color="linear-gradient(270deg, #FF204B 0%, #FE5B71 100%)"
  690. onClick={onSubmit}
  691. >
  692. 开通训练教程
  693. </Button>
  694. </div>
  695. </TheSticky>
  696. )}
  697. </>
  698. )
  699. )}
  700. {/* 选择声部 */}
  701. <Popup
  702. show={state.subjectStatus}
  703. position="bottom"
  704. round
  705. safe-area-inset-bottom
  706. onClose={() => (state.subjectStatus = false)}
  707. onClosed={() => (state.openStatus = false)}
  708. >
  709. <Picker
  710. defaultIndex={state.teacherSubjectIndex}
  711. columns={state.subjectList}
  712. onCancel={() => {
  713. state.subjectStatus = false
  714. }}
  715. onConfirm={(val: any) => {
  716. console.log(val, 'val')
  717. state.teacherSubjectId = val.id
  718. state.teacherSubjectName = val.name
  719. params.page = 1
  720. state.finished = false
  721. state.list = []
  722. FetchList()
  723. state.subjectStatus = false
  724. }}
  725. ></Picker>
  726. </Popup>
  727. </div>
  728. )
  729. }
  730. })