index.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { defineComponent } from 'vue';
  2. import { Image } from 'vant';
  3. import styles from './index.module.less';
  4. import OSticky from '@/components/o-sticky';
  5. import OHeader from '@/components/o-header';
  6. export default defineComponent({
  7. name: 'classify-list',
  8. data() {
  9. return {
  10. list: [] as any[],
  11. liveConfig: false
  12. };
  13. },
  14. mounted() {
  15. // localStorage.setItem('behaviorId', getRandomKey())
  16. // this.FetchList()
  17. const musicScoreList = sessionStorage.getItem('musicScoreList');
  18. if (musicScoreList) {
  19. const tempMusicScoreList = JSON.parse(musicScoreList);
  20. this.list = tempMusicScoreList; // 从上面页面获取分类信息
  21. } else {
  22. (this as any).$router.replace('/');
  23. }
  24. // appState.subjectOptions = [{value: 0, text: '全部声部'}]
  25. // appState.subjectId = appState.origanSubjectId;
  26. // const parseSearch: any = qs.parse(location.search);
  27. // this.liveConfig = !!parseSearch.liveConfig;
  28. },
  29. methods: {
  30. toDetail(item: any) {
  31. (this as any).$router.push({
  32. path: '/music-list/' + item.id,
  33. query: {
  34. ...this.$route.query
  35. }
  36. });
  37. },
  38. goBack() {
  39. (this as any).$router.push({
  40. path: '/',
  41. query: {
  42. ...this.$route.query
  43. }
  44. });
  45. }
  46. },
  47. render() {
  48. return (
  49. <div class={styles.container}>
  50. <OSticky position="top">
  51. <OHeader
  52. isBack={true}
  53. border={false}
  54. isFixed={false}
  55. backIconColor="white"></OHeader>
  56. </OSticky>
  57. <div class={styles.content}>
  58. <div class={styles.title}>教材</div>
  59. <div class={styles.items}>
  60. {this.list.map(item => (
  61. <div key={item.id} onClick={() => this.toDetail(item)}>
  62. <div class={styles.inner}>
  63. <Image src={item.coverImg} class={styles.img} />
  64. <div class="van-ellipsis">{item.name}</div>
  65. </div>
  66. </div>
  67. ))}
  68. </div>
  69. </div>
  70. </div>
  71. );
  72. }
  73. });