|  | @@ -1,14 +1,26 @@
 | 
	
		
			
				|  |  | -import { defineComponent, reactive } from 'vue';
 | 
	
		
			
				|  |  | +import { defineComponent, reactive, toRefs } from 'vue';
 | 
	
		
			
				|  |  |  import styles from './chapter.module.less';
 | 
	
		
			
				|  |  |  import iconMenuChapter from '../image/icon-menu-chapter.svg';
 | 
	
		
			
				|  |  | -import { Collapse, CollapseItem, Icon, Image } from 'vant';
 | 
	
		
			
				|  |  | +import { Collapse, CollapseItem, Icon, Image, showToast } from 'vant';
 | 
	
		
			
				|  |  |  import chapterDown from '../image/chapter-down-arrow.svg';
 | 
	
		
			
				|  |  |  import chapterDefault from '../image/chapter-default-arrow.svg';
 | 
	
		
			
				|  |  |  import chapterVideo from '../image/chapter-video.svg';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'chapter',
 | 
	
		
			
				|  |  | -  setup() {
 | 
	
		
			
				|  |  | +  props: {
 | 
	
		
			
				|  |  | +    detail: {
 | 
	
		
			
				|  |  | +      type: Object,
 | 
	
		
			
				|  |  | +      default: () => []
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    itemActive: {
 | 
	
		
			
				|  |  | +      type: String,
 | 
	
		
			
				|  |  | +      default: ''
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  emits: ['handleSelect'],
 | 
	
		
			
				|  |  | +  setup(props, { emit }) {
 | 
	
		
			
				|  |  | +    const { detail, itemActive } = toRefs(props);
 | 
	
		
			
				|  |  |      const pointData = reactive({
 | 
	
		
			
				|  |  |        active: ''
 | 
	
		
			
				|  |  |      });
 | 
	
	
		
			
				|  | @@ -27,87 +39,60 @@ export default defineComponent({
 | 
	
		
			
				|  |  |              }}
 | 
	
		
			
				|  |  |              border={false}
 | 
	
		
			
				|  |  |              accordion>
 | 
	
		
			
				|  |  | -            <CollapseItem
 | 
	
		
			
				|  |  | -              center
 | 
	
		
			
				|  |  | -              class={styles.collapseItem}
 | 
	
		
			
				|  |  | -              border={false}
 | 
	
		
			
				|  |  | -              isLink={false}
 | 
	
		
			
				|  |  | -              title={'第一种'}
 | 
	
		
			
				|  |  | -              name={1}>
 | 
	
		
			
				|  |  | -              {{
 | 
	
		
			
				|  |  | -                default: () => (
 | 
	
		
			
				|  |  | -                  <>
 | 
	
		
			
				|  |  | -                    <div
 | 
	
		
			
				|  |  | -                      class={[
 | 
	
		
			
				|  |  | -                        styles.item
 | 
	
		
			
				|  |  | -                        // props.itemActive == n.id ? styles.itemActive : ''
 | 
	
		
			
				|  |  | -                      ]}
 | 
	
		
			
				|  |  | -                      onClick={() => {
 | 
	
		
			
				|  |  | -                        // emit('handleSelect', {
 | 
	
		
			
				|  |  | -                        //   itemActive: n.id,
 | 
	
		
			
				|  |  | -                        //   tabActive: item.id,
 | 
	
		
			
				|  |  | -                        //   tabName: item.name
 | 
	
		
			
				|  |  | -                        // });
 | 
	
		
			
				|  |  | -                      }}>
 | 
	
		
			
				|  |  | -                      <Image src={chapterVideo} class={styles.itemImage} />
 | 
	
		
			
				|  |  | -                      <span style={{ width: '80%' }} class="van-ellipsis">
 | 
	
		
			
				|  |  | -                        章节名称
 | 
	
		
			
				|  |  | -                      </span>
 | 
	
		
			
				|  |  | -                    </div>
 | 
	
		
			
				|  |  | -                    <div
 | 
	
		
			
				|  |  | -                      class={[
 | 
	
		
			
				|  |  | -                        styles.item
 | 
	
		
			
				|  |  | -                        // props.itemActive == n.id ? styles.itemActive : ''
 | 
	
		
			
				|  |  | -                      ]}
 | 
	
		
			
				|  |  | -                      onClick={() => {
 | 
	
		
			
				|  |  | -                        // emit('handleSelect', {
 | 
	
		
			
				|  |  | -                        //   itemActive: n.id,
 | 
	
		
			
				|  |  | -                        //   tabActive: item.id,
 | 
	
		
			
				|  |  | -                        //   tabName: item.name
 | 
	
		
			
				|  |  | -                        // });
 | 
	
		
			
				|  |  | -                      }}>
 | 
	
		
			
				|  |  | -                      <Image src={chapterVideo} class={styles.itemImage} />
 | 
	
		
			
				|  |  | -                      <span style={{ width: '80%' }} class="van-ellipsis">
 | 
	
		
			
				|  |  | -                        章节名称
 | 
	
		
			
				|  |  | -                      </span>
 | 
	
		
			
				|  |  | -                    </div>
 | 
	
		
			
				|  |  | -                  </>
 | 
	
		
			
				|  |  | -                ),
 | 
	
		
			
				|  |  | -                icon: () => <img class={styles.arrow} src={chapterDefault} />
 | 
	
		
			
				|  |  | -              }}
 | 
	
		
			
				|  |  | -            </CollapseItem>
 | 
	
		
			
				|  |  | -            <CollapseItem
 | 
	
		
			
				|  |  | -              center
 | 
	
		
			
				|  |  | -              class={styles.collapseItem}
 | 
	
		
			
				|  |  | -              border={false}
 | 
	
		
			
				|  |  | -              isLink={false}
 | 
	
		
			
				|  |  | -              title={'第二种'}
 | 
	
		
			
				|  |  | -              name={1}>
 | 
	
		
			
				|  |  | -              {{
 | 
	
		
			
				|  |  | -                default: () => (
 | 
	
		
			
				|  |  | -                  <>
 | 
	
		
			
				|  |  | -                    <div
 | 
	
		
			
				|  |  | -                      class={[
 | 
	
		
			
				|  |  | -                        styles.item
 | 
	
		
			
				|  |  | -                        // props.itemActive == n.id ? styles.itemActive : ''
 | 
	
		
			
				|  |  | -                      ]}
 | 
	
		
			
				|  |  | -                      onClick={() => {
 | 
	
		
			
				|  |  | -                        // emit('handleSelect', {
 | 
	
		
			
				|  |  | -                        //   itemActive: n.id,
 | 
	
		
			
				|  |  | -                        //   tabActive: item.id,
 | 
	
		
			
				|  |  | -                        //   tabName: item.name
 | 
	
		
			
				|  |  | -                        // });
 | 
	
		
			
				|  |  | -                      }}>
 | 
	
		
			
				|  |  | -                      <Image src={chapterVideo} class={styles.itemImage} />
 | 
	
		
			
				|  |  | -                      <span style={{ width: '80%' }} class="van-ellipsis">
 | 
	
		
			
				|  |  | -                        章节名称
 | 
	
		
			
				|  |  | -                      </span>
 | 
	
		
			
				|  |  | -                    </div>
 | 
	
		
			
				|  |  | -                  </>
 | 
	
		
			
				|  |  | -                ),
 | 
	
		
			
				|  |  | -                icon: () => <img class={styles.arrow} src={chapterDefault} />
 | 
	
		
			
				|  |  | -              }}
 | 
	
		
			
				|  |  | -            </CollapseItem>
 | 
	
		
			
				|  |  | +            {detail.value.map((item: any) => (
 | 
	
		
			
				|  |  | +              <CollapseItem
 | 
	
		
			
				|  |  | +                center
 | 
	
		
			
				|  |  | +                class={[
 | 
	
		
			
				|  |  | +                  styles.collapseItem,
 | 
	
		
			
				|  |  | +                  pointData.active === item.id ? styles.activeItem : ''
 | 
	
		
			
				|  |  | +                ]}
 | 
	
		
			
				|  |  | +                border={false}
 | 
	
		
			
				|  |  | +                isLink={false}
 | 
	
		
			
				|  |  | +                title={item.name}
 | 
	
		
			
				|  |  | +                titleClass={'van-ellipsis'}
 | 
	
		
			
				|  |  | +                titleStyle={{ width: '80%' }}
 | 
	
		
			
				|  |  | +                name={item.id}>
 | 
	
		
			
				|  |  | +                {{
 | 
	
		
			
				|  |  | +                  default: () => (
 | 
	
		
			
				|  |  | +                    <>
 | 
	
		
			
				|  |  | +                      {item.knowledgeList.map((know: any) => (
 | 
	
		
			
				|  |  | +                        <div
 | 
	
		
			
				|  |  | +                          class={[
 | 
	
		
			
				|  |  | +                            styles.item,
 | 
	
		
			
				|  |  | +                            itemActive.value == know.id ? styles.itemActive : ''
 | 
	
		
			
				|  |  | +                          ]}
 | 
	
		
			
				|  |  | +                          onClick={() => {
 | 
	
		
			
				|  |  | +                            if (!know.containMaterial) {
 | 
	
		
			
				|  |  | +                              showToast('暂无课件,不法切换');
 | 
	
		
			
				|  |  | +                              return;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            emit('handleSelect', {
 | 
	
		
			
				|  |  | +                              itemActive: know.id,
 | 
	
		
			
				|  |  | +                              tabActive: item.id,
 | 
	
		
			
				|  |  | +                              tabName: item.name
 | 
	
		
			
				|  |  | +                            });
 | 
	
		
			
				|  |  | +                          }}>
 | 
	
		
			
				|  |  | +                          <Image src={chapterVideo} class={styles.itemImage} />
 | 
	
		
			
				|  |  | +                          <span style={{ width: '80%' }} class="van-ellipsis">
 | 
	
		
			
				|  |  | +                            {know.name}
 | 
	
		
			
				|  |  | +                          </span>
 | 
	
		
			
				|  |  | +                        </div>
 | 
	
		
			
				|  |  | +                      ))}
 | 
	
		
			
				|  |  | +                    </>
 | 
	
		
			
				|  |  | +                  ),
 | 
	
		
			
				|  |  | +                  icon: () => (
 | 
	
		
			
				|  |  | +                    <img
 | 
	
		
			
				|  |  | +                      class={styles.arrow}
 | 
	
		
			
				|  |  | +                      src={
 | 
	
		
			
				|  |  | +                        pointData.active === item.id
 | 
	
		
			
				|  |  | +                          ? chapterDown
 | 
	
		
			
				|  |  | +                          : chapterDefault
 | 
	
		
			
				|  |  | +                      }
 | 
	
		
			
				|  |  | +                    />
 | 
	
		
			
				|  |  | +                  )
 | 
	
		
			
				|  |  | +                }}
 | 
	
		
			
				|  |  | +              </CollapseItem>
 | 
	
		
			
				|  |  | +            ))}
 | 
	
		
			
				|  |  |            </Collapse>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        </div>
 |