Browse Source

教材到播放

liushengqiang 1 year ago
parent
commit
d8acb55016

BIN
src/components/the-favorite/icon_like.png


BIN
src/components/the-favorite/icon_liked.png


+ 33 - 0
src/components/the-favorite/index.css

@@ -0,0 +1,33 @@
+.favoriteWrap {
+    width          : 28px;
+    height         : 28px;
+    background     : rgba(255, 255, 255, 0.61);
+    border         : 1px solid #FFFFFF;
+    border-radius  : 50%;
+    cursor         : pointer;
+    display        : flex;
+    justify-content: center;
+    align-items    : center;
+
+}
+
+.liked .favoritIcon {
+    animation: blink 1s forwards;
+}
+
+.favoritIcon {
+    width: 17px;
+    height: 15px;
+}
+
+
+
+@keyframes blink {
+    10% {
+        transform: scale(1.4);
+    }
+
+    100% {
+        transform: scale(1);
+    }
+}

+ 24 - 0
src/components/the-favorite/index.tsx

@@ -0,0 +1,24 @@
+import { defineComponent, ref } from 'vue';
+import './index.css';
+import icon_like from './icon_like.png';
+import icon_liked from './icon_liked.png';
+
+export default defineComponent({
+  name: 'the-favorite',
+  props: {
+    isFavorite: {
+      type: Boolean,
+      default: false
+    }
+  },
+  setup(props) {
+    return () => (
+      <div class={['favoriteWrap', props.isFavorite ? 'liked' : '']}>
+        <img
+          class="favoritIcon"
+          src={props.isFavorite ? icon_liked : icon_like}
+        />
+      </div>
+    );
+  }
+});

+ 24 - 0
src/views/courseware-list/api.ts

@@ -6,3 +6,27 @@ export const api_lessonCoursewarePage = (params: any): Promise<any> => {
     data: params
   });
 };
+/** 获取音乐教材收藏列表 */
+export const api_lessonCoursewareFavoriteage = (params: any): Promise<any> => {
+  return request.post('/edu-app/lessonCoursewareFavorite/page', {
+    data: params
+  });
+};
+/** 教材收藏 */
+export const api_lessonCoursewareFavoriteSave = (params: any): Promise<any> => {
+  return request.post('/edu-app/lessonCoursewareFavorite/save', {
+    data: params
+  });
+};
+/** 教材收藏取消 */
+export const api_lessonCoursewareFavoriteRemove = (params: any): Promise<any> => {
+  return request.post('/edu-app/lessonCoursewareFavorite/remove', {
+    data: params
+  });
+};
+/** 教材收藏取消 */
+export const api_lessonCoursewareQueryStudentLessonDetail = (params: any): Promise<any> => {
+  return request.post('/edu-app/lessonCourseware/queryStudentLessonDetail', {
+    data: params
+  });
+};

+ 40 - 0
src/views/courseware-list/image/icon_default.svg

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="51px" height="49px" viewBox="0 0 51 49" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>编组@2x</title>
+    <defs>
+        <linearGradient x1="60.3790157%" y1="14.1179897%" x2="60.3790157%" y2="99.1367692%" id="linearGradient-1">
+            <stop stop-color="#D8D9DB" offset="0%"></stop>
+            <stop stop-color="#D3D4D6" offset="100%"></stop>
+        </linearGradient>
+        <linearGradient x1="47.928727%" y1="88.2137009%" x2="47.928727%" y2="-1.32949207e-12%" id="linearGradient-2">
+            <stop stop-color="#D0D1D3" offset="0%"></stop>
+            <stop stop-color="#CACBCD" offset="100%"></stop>
+        </linearGradient>
+        <linearGradient x1="57.5601934%" y1="1.66592618%" x2="56.4312509%" y2="99.1367692%" id="linearGradient-3">
+            <stop stop-color="#D8D9DB" offset="0%"></stop>
+            <stop stop-color="#D1D2D4" offset="100%"></stop>
+        </linearGradient>
+        <linearGradient x1="47.928727%" y1="88.2137009%" x2="47.928727%" y2="-1.32949207e-12%" id="linearGradient-4">
+            <stop stop-color="#D0D1D3" offset="0%"></stop>
+            <stop stop-color="#C8C9CB" offset="100%"></stop>
+        </linearGradient>
+        <linearGradient x1="47.928727%" y1="88.2137009%" x2="47.928727%" y2="-1.32949207e-12%" id="linearGradient-5">
+            <stop stop-color="#CFD0D2" offset="0%"></stop>
+            <stop stop-color="#CBCCCE" offset="100%"></stop>
+        </linearGradient>
+    </defs>
+    <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="67、小酷AI" transform="translate(-1720.000000, -737.000000)" fill-rule="nonzero">
+            <g id="编组" transform="translate(1720.000000, 737.000000)">
+                <g id="编组-6" transform="translate(0.600000, 0.666667)">
+                    <path d="M0.755328486,15.0252525 C-0.830540243,19.9313215 0.11107891,25.262202 3.29524979,29.4047571 C6.47942068,33.5473122 11.5319763,36.0147566 16.9240016,36.0606061 C24.4286025,36.09296 31.0759035,31.4573623 33.3061224,24.6361115 L0.755328486,15.0252525 Z" id="路径" fill="url(#linearGradient-1)"></path>
+                    <path d="M17.7262393,31.0568351 C8.4521233,30.9803529 0.940551474,23.8601879 0.813375057,15.0252525 L0.754723889,15.0252525 C-0.829875444,19.9313026 0.110989998,25.2621626 3.29261214,29.4047017 C6.47423428,33.5472408 11.5227456,36.0146758 16.9104549,36.060355 C24.4276023,36.0999738 31.0862959,31.4479077 33.3061224,24.6055962 L31.7758601,24.1535015 C28.5683718,28.5148198 23.3157927,31.0956941 17.7262393,31.0568351 L17.7262393,31.0568351 Z" id="路径" fill="url(#linearGradient-2)"></path>
+                    <path d="M14.7677422,5.37825957 C14.7677422,5.37825957 18.3328036,4.44948812 20.0004184,7.54187485 C15.9970737,11.1250329 13.586515,16.8823604 15.6870684,21.3679043 C16.5048411,23.1304592 18.0548677,24.5341705 18.6962581,26.4392074 C20.6791709,32.3335664 18.6004257,38.818554 13.5437557,42.5132859 L13.4849616,42.5555028 C13.4849616,42.5555028 12.9504696,42.951286 12.1113173,43.5370453 C14.650154,45.1782267 18.4236672,47.1360346 21.8711403,47.7956734 C30.2359393,49.4051921 38.8305699,44.0067081 42.0642462,36.4921028 C42.3367119,35.8608728 42.5652914,35.2120441 42.7483959,34.5501262 C43.5795078,31.4293042 43.8097647,28.1821626 43.4272007,24.9774478 C43.202714,23.0407483 42.6147729,19.4681445 45.3674064,19.0354214 C46.4363903,18.8665539 47.4626149,19.4048192 48.2803876,20.0539038 C48.4033207,20.1488917 49.5364437,21.067109 49.4562699,21.2518078 C51.2735425,16.9351315 48.2964223,5.51018733 38.3869416,1.64734247 C31.0376772,-1.32367072 20.3692179,-0.389622168 14.7677422,5.37825957 Z" id="路径" fill="url(#linearGradient-3)"></path>
+                    <path d="M26.6124657,47.6072826 C21.4912819,46.636432 18.7337213,44.7527707 16.9716508,43.1698621 C17.8393774,42.600015 18.3557545,42.2148405 18.3557545,42.2148405 L18.4143128,42.1726296 C23.5265567,38.5761859 25.72439,32.1283454 23.8602286,26.1958052 C23.2533524,24.2752094 21.7308383,22.8505916 20.9589343,21.077734 C18.9626308,16.5558917 21.459341,10.8415915 25.5105062,7.33281071 C23.9134634,4.20920435 20.3414111,5.07452773 20.3414111,5.07452773 C23.237382,2.18835767 27.421634,0.584343589 31.7922078,0.114747363 C25.5850348,-0.47092883 18.8188969,1.17001978 14.7570848,5.39110946 C14.7570848,5.39110946 18.3078432,4.46774609 19.9687677,7.55441792 C15.9814843,11.1370678 13.5805966,16.8988552 15.6727227,21.383763 C16.4872145,23.1407916 18.0310225,24.5495802 18.6698396,26.4490706 C20.6447971,32.3425937 18.5743917,38.8266616 13.5380088,42.5208695 L13.4794506,42.5630804 C13.4794506,42.5630804 12.947103,42.9640839 12.1113173,43.5444838 C14.6399683,45.1907088 18.3983423,47.1429627 21.8319843,47.8077844 C23.7881287,48.171816 25.7955452,48.171816 27.7516896,47.8077844 C27.3524289,47.744468 26.9797855,47.6811517 26.6124657,47.6072826 Z" id="路径" fill="url(#linearGradient-4)"></path>
+                    <path d="M45.0423476,14.0093804 C46.200789,13.854566 48.445269,13.5716291 48.445269,13.5716291 C46.707607,9.89878877 42.4247158,7.65130943 39.7402509,6.83452952 C39.7068343,6.83452952 38.3200464,6.42347036 38.3311852,6.43948565 C33.2852822,5.3717995 29.0190992,6.29000959 25.799969,9.25283865 C22.37477,12.4025128 21.6340358,17.9598192 24.3964728,21.7340897 C25.154529,22.6993831 26.100114,23.5151123 27.1811875,24.1363836 C25.0592349,38.8384218 37.0335082,40.6855189 37.1560356,40.562735 C39.1777385,38.2405176 41.2105802,35.939654 41.2105802,28.0601302 C41.2105802,25.9247579 40.2916244,22.4120704 40.1579581,21.5045372 C39.5230431,17.1750699 40.8652756,14.5966078 45.0423476,14.0093804 Z" id="路径" fill="#F4F5F7"></path>
+                    <ellipse id="椭圆形" fill="url(#linearGradient-5)" cx="35.5769944" cy="14.2739899" rx="2.27087199" ry="2.25378788"></ellipse>
+                </g>
+            </g>
+        </g>
+    </g>
+</svg>

+ 80 - 9
src/views/courseware-list/index.module.less

@@ -85,8 +85,9 @@
             align-items: center;
             padding: 0;
             width: 100%;
-            height: 40px;
-            color: #777;
+            height: 36px;
+            color: #999;
+            font-size: 13px;
         }
 
         .van-popover__content {
@@ -102,6 +103,7 @@
     flex: 1;
     overflow-y: hidden;
     overflow-x: auto;
+    display: flex;
 
     .wrap {
         display: flex;
@@ -111,18 +113,14 @@
 }
 
 .wrapItem {
+    position: relative;
     width: 120px;
     display: flex;
     flex-direction: column;
     margin: 0 17px;
+    flex-shrink: 0;
+
 
-    .cover {
-        display: block;
-        width: 100%;
-        height: 170px;
-        object-fit: cover;
-        margin-bottom: 15px;
-    }
 
     .name {
         font-size: 11px;
@@ -131,4 +129,77 @@
         line-height: 16px;
         text-align: center;
     }
+
+    .favoriteBtn {
+        position: absolute;
+        top: 130px;
+        right: 6px;
+        z-index: 10;
+    }
+}
+
+.cover {
+    position: relative;
+    display: block;
+    width: 100%;
+    height: 170px;
+    margin-bottom: 15px;
+    background-color: #edeff2;
+    background-image: url('./image/icon_default.svg');
+    background-repeat: no-repeat;
+    background-position: center center;
+
+    &::after {
+        content: '';
+        position: absolute;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+        z-index: 4;
+        background-repeat: no-repeat;
+        background-image: linear-gradient(to right, rgba(0, 0, 0, .2) 0, rgba(255, 255, 255, .08) 0%, transparent .5%), linear-gradient(to right, rgba(0, 0, 0, .1) .3%, rgba(255, 255, 255, .09) 1.1%, transparent 1.3%);
+        background-size: 50% 100%, 50% 100%;
+        background-position: 0% top, 9% top;
+    }
+
+    :global {
+        img {
+            width: 100%;
+            height: 100%;
+            opacity: 0;
+            transition: opacity .3s ease-in-out;
+        }
+    }
+
+    &.loaded {
+        img {
+            opacity: 1;
+        }
+
+    }
+}
+
+.book{
+    position: fixed;
+    top: 50%;
+    left: 50%;
+    width: 50vw;
+    transform: translate(-50%, -50%) scale(0);
+    z-index: 20;
+    background-color: #fff;
+    transition: all .3s ease-in-out;
+    visibility: hidden;
+    pointer-events: none;
+    border-radius: 8px;
+    box-shadow: 0 0 10px 0 rgba(0,0,0,.2);
+    .bookWrap{
+        height: 60vh;
+        overflow-y: auto;
+    }
+    &.show{
+        visibility: visible;
+        pointer-events: auto;
+        transform: translate(-50%, -50%) scale(1);
+    }
 }

+ 206 - 16
src/views/courseware-list/index.tsx

@@ -1,9 +1,25 @@
-import { computed, defineComponent, onBeforeMount, reactive } from 'vue';
+import {
+  computed,
+  defineComponent,
+  onBeforeMount,
+  onMounted,
+  reactive
+} from 'vue';
 import styles from './index.module.less';
 import icon_back from './image/icon_back.svg';
 import icon_arrow from './image/icon_arrow.svg';
-import { Button, Popover, Tab, Tabs, showToast } from 'vant';
-import { api_lessonCoursewarePage } from './api';
+import { Button, Image, Popover, Tab, Tabs, showToast } from 'vant';
+import {
+  api_lessonCoursewareFavoriteRemove,
+  api_lessonCoursewareFavoriteSave,
+  api_lessonCoursewareFavoriteage,
+  api_lessonCoursewarePage,
+  api_lessonCoursewareQueryStudentLessonDetail
+} from './api';
+import { NImage } from 'naive-ui';
+import { state } from '@/state';
+import TheFavorite from '@/components/the-favorite';
+import { useRouter } from 'vue-router';
 
 export const BOOK_DATA = {
   grades: [
@@ -27,6 +43,7 @@ export const BOOK_DATA = {
 export default defineComponent({
   name: 'courseware-list',
   setup() {
+    const router = useRouter();
     // 返回
     const goback = () => {
       postMessage({ api: 'goBack' });
@@ -48,12 +65,15 @@ export default defineComponent({
     });
     const onSelect = (action: any, index: number) => {
       forms.currentGradeNum = index;
-      forms.page = 1;
-      getList();
+      handleChange();
     };
 
     const data = reactive({
-      list: [] as any[]
+      list: [] as any[],
+      favoriteList: [] as any[],
+      tab: 'all',
+      details: [] as any[],
+      showBook: false
     });
 
     const getList = async () => {
@@ -62,25 +82,130 @@ export default defineComponent({
         currentGradeNum: forms.currentGradeNum ? forms.currentGradeNum : ''
       });
       if (res?.code === 200 && Array.isArray(res?.data?.rows)) {
-        data.list = [...res.data.rows,...res.data.rows,...res.data.rows,...res.data.rows,...res.data.rows,...res.data.rows].map((item: any) => {
+        data.list = res.data.rows.map((item: any) => {
+          const type = BOOK_DATA.bookTypes[item.bookType];
+          item.name = `${item.name}(${type})`;
+          item.load = false;
+          item.key = Date.now() + item.id;
+          return item;
+        });
+      }
+    };
+    const getFavoriteList = async () => {
+      const res = await api_lessonCoursewareFavoriteage({
+        clientType: 'STUDENT',
+        userId: state.user?.data?.id,
+        page: forms.page,
+        rows: forms.rows
+      });
+      if (res?.code === 200 && Array.isArray(res?.data?.rows)) {
+        data.list = res.data.rows.map((item: any) => {
           const type = BOOK_DATA.bookTypes[item.bookType];
           item.name = `${item.name}(${type})`;
+          item.load = false;
+          item.key = Date.now() + item.id;
           return item;
         });
       }
     };
-    onBeforeMount(() => {
-      getList();
+    const getData = () => {
+      if (data.tab === 'all') {
+        getList();
+      }
+      if (data.tab === 'favorite') {
+        getFavoriteList();
+      }
+    };
+    const handleChange = () => {
+      forms.page = 1;
+      getData();
+    };
+    onMounted(() => {
+      getData();
     });
+
+    const handleFavorite = async (item: any) => {
+      if (item.favoriteFlag) {
+        await api_lessonCoursewareFavoriteSave({
+          lessonCoursewareId: item.id
+        });
+      } else {
+        await api_lessonCoursewareFavoriteRemove({
+          lessonCoursewareId: item.id
+        });
+      }
+    };
+
+    let timer: any = null;
+    const dubounce = (fn: any, delay: number = 300) => {
+      if (timer) {
+        clearTimeout(timer);
+      }
+      timer = setTimeout(fn, delay);
+    };
+
+    /** 学生端根据教材编号获取关联的单元、章节 */
+    const getDetail = async (item: any) => {
+      const res = await api_lessonCoursewareQueryStudentLessonDetail({
+        lessonCoursewareId: item.id
+      });
+      if (res?.code == 200) {
+        data.details = res.data;
+      }
+    };
+
+    const handleCreateContainer = (id: string) => {
+      const box = document.querySelector(
+        `[data-id="${id}"]`
+      ) as unknown as HTMLElement;
+      if (!box) return;
+      const rect = box.getBoundingClientRect();
+      const container = document.createElement('div');
+      console.log('🚀 ~ box:', box);
+      container.style.left = `${rect.x}px`;
+      container.style.top = `${rect.y}px`;
+      container.style.width = `${rect.width}px`;
+      container.style.height = `${rect.height}px`;
+      container.style.position = 'fixed';
+      container.style.zIndex = '9999';
+      container.appendChild(box.cloneNode(true));
+      document.body.appendChild(container);
+      setTimeout(() => {
+        container.style.transformOrigin = 'left';
+        container.style.left = `50vw`;
+        container.style.top = `25vh`;
+        container.style.transition = 'all 0.3s ease-in-out';
+        container.style.transform = 'scale(1.5)';
+        container.style.backfaceVisibility = 'hidden';
+        setTimeout(() => {
+          container.style.transform = 'scale(1.5) rotateY(180deg)';
+        }, 300);
+      }, 0);
+    };
+    const handleOpen = (item: any) => {
+      getDetail(item);
+      data.showBook = true;
+      //   handleCreateContainer(item.id);
+      // postMessage({
+      //     api: 'openCourseware',
+      //     params: {
+      //     lessonCoursewareId: item.id
+      //     }
+      // });
+    };
+
     return () => (
       <div class={styles.container}>
         <div class={styles.head}>
           <div class={styles.back} onClick={goback}>
             <img src={icon_back} />
           </div>
-          <Tabs class={styles.tabs}>
-            <Tab title="全部教材" name="全部教材"></Tab>
-            <Tab title="我的收藏" name="我的收藏"></Tab>
+          <Tabs
+            class={styles.tabs}
+            v-model:active={data.tab}
+            onChange={() => handleChange()}>
+            <Tab title="全部教材" name="all"></Tab>
+            <Tab title="我的收藏" name="favorite"></Tab>
           </Tabs>
           <Popover
             class={styles.popover}
@@ -89,7 +214,8 @@ export default defineComponent({
             {{
               reference: () => (
                 <Button class={styles.downBtn} round size="small">
-                  全部年级 <img class={styles.icon} src={icon_arrow} />
+                  {BOOK_DATA.grades[forms.currentGradeNum].text}{' '}
+                  <img class={styles.icon} src={icon_arrow} />
                 </Button>
               )
             }}
@@ -100,13 +226,77 @@ export default defineComponent({
           <div class={styles.wrap}>
             {data.list.map((item, index) => {
               return (
-                <div class={styles.wrapItem}>
-                  <img class={styles.cover} src={item.coverImg} />
+                <div
+                  class={styles.wrapItem}
+                  key={item.key}
+                  onClick={() => handleOpen(item)}>
+                  <NImage
+                    data-id={item.id}
+                    class={[styles.cover, item.load ? styles.loaded : '']}
+                    objectFit="cover"
+                    src={item.coverImg}
+                    onLoad={() => {
+                      item.load = true;
+                    }}
+                    onError={() => {
+                      item.load = true;
+                    }}
+                  />
                   <div class={styles.name}>{item.name}</div>
+                  {data.tab === 'all' && (
+                    <div
+                      class={styles.favoriteBtn}
+                      onClick={() => {
+                        item.favoriteFlag = !item.favoriteFlag;
+                        dubounce(() => handleFavorite(item));
+                      }}>
+                      <TheFavorite isFavorite={item.favoriteFlag} />
+                    </div>
+                  )}
                 </div>
               );
             })}
-            
+          </div>
+        </div>
+
+        <div class={[styles.book, data.showBook && styles.show]}>
+          <div class={styles.bookWrap}>
+            {data.details.map((item: any) => {
+              return (
+                <div class={styles.detail}>
+                  <div class={styles.detailTitle}>{item.name}</div>
+                  {item.knowledgeDetails.map((k: any) => {
+                    return <div>{k.name}</div>;
+                  })}
+                </div>
+              );
+            })}
+            {!data.details.length && (
+              <div
+                onClick={() => {
+                  router.push({
+                    path: '/courseware-play',
+                    query: {
+                      id: '1678286165663399937',
+                      name: '人教第一单元第二章节'
+                    }
+                  });
+                }}>
+                人教第一单元第二章节(如果显示这个,就是返回的数据为空,
+                次为固定的后台某个单元)
+              </div>
+            )}
+          </div>
+          <div style={{ padding: '8px 14px' }}>
+            <Button
+              type="primary"
+              size="small"
+              block
+              onClick={() => {
+                data.showBook = false;
+              }}>
+              关闭
+            </Button>
           </div>
         </div>
       </div>

+ 8 - 0
src/views/courseware-play/api.ts

@@ -0,0 +1,8 @@
+import request from '@/helpers/request';
+
+/** 获取章节详情 */
+export const api_lessonCoursewareKnowledgeDetailDetail = (params: any): Promise<any> => {
+  return request.post('/edu-app/lessonCoursewareKnowledgeDetail/detail', {
+    data: params
+  });
+};

+ 3 - 1
src/views/courseware-play/component/points.tsx

@@ -10,6 +10,7 @@ import iconSong from '../image/icon-song.svg';
 import iconSongActive from '../image/icon-song-active.svg';
 
 import { Icon } from 'vant';
+import { useRoute } from 'vue-router';
 export default defineComponent({
   name: 'points',
   props: {
@@ -24,6 +25,7 @@ export default defineComponent({
   },
   emits: ['handleSelect'],
   setup(props, { emit }) {
+    const route = useRoute();
     const types: { [_: string]: string } = {
       SONG: '乐谱',
       VIDEO: '视频',
@@ -47,7 +49,7 @@ export default defineComponent({
       <div class={styles.container}>
         <div class={styles.pointHead}>
           <img src={iconMulv} />
-          第一单元 我愿住在童话里
+          {route.query.name}
         </div>
         <div class={styles.content}>
           {props.data.map((item, index: number) => {

+ 16 - 40
src/views/courseware-play/index.tsx

@@ -32,6 +32,7 @@ import { usePageVisibility, useRect } from '@vant/use';
 import VideoPlay from './component/video-play';
 import Tool, { ToolItem, ToolType } from './component/tool';
 import AudioItem from './component/audio-item';
+import { api_lessonCoursewareKnowledgeDetailDetail } from './api';
 
 export default defineComponent({
   name: 'CoursewarePlay',
@@ -150,43 +151,17 @@ export default defineComponent({
       return list;
     };
     const getDetail = async () => {
-      data.knowledgePointList = [
-        {
-          id: '1',
-          name: '其多列',
-          title: '其多列',
-          type: 'VIDEO',
-          content:
-            'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687844560120.mp4',
-          url: 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687844640957.png'
-        },
-        {
-          id: '5',
-          name: '歌曲表演 大鹿',
-          title: '歌曲表演 大鹿',
-          type: 'AUDIO',
-          content:
-            'https://cloud-coach.ks3-cn-beijing.ksyuncs.com/1686819360752.mp3',
-          url: 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687916228530.png'
-        },
-        {
-          id: '2',
-          name: '其多列',
-          title: '其多列',
-          type: 'IMG',
-          content:
-            'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1688007481564.jpg',
-          url: 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1688007481564.jpg'
-        },
-        {
-          id: '4',
-          name: '歌曲 其多列',
-          title: '其多列',
-          type: 'SONG',
-          content: '',
-          url: 'https://cloud-coach.ks3-cn-beijing.ksyuncs.com/music-sheet-first/1687847690372-1.png'
-        }
-      ];
+      const res = await api_lessonCoursewareKnowledgeDetailDetail({
+        lessonCoursewareKnowledgeDetailId: route.query.id
+      });
+      if (res?.code === 200 && Array.isArray(res.data)) {
+        data.knowledgePointList = res.data.map((item: any) => {
+          return {
+            ...item,
+            url: item.coverImg
+          };
+        });
+      }
       popupData.itemActive = data.knowledgePointList[0].id;
       popupData.itemName = data.knowledgePointList[0].name;
       data.itemList = data.knowledgePointList.map((m: any, index: number) => {
@@ -227,7 +202,8 @@ export default defineComponent({
       try {
         playRef.value?.handleOut();
       } catch (error) {}
-      postMessage({ api: 'goBack' });
+      // postMessage({ api: 'goBack' });
+      router.back()
     };
 
     const popupData = reactive({
@@ -560,7 +536,7 @@ export default defineComponent({
                       </>
                     ) : m.type === 'IMG' ? (
                       <img src={m.content} />
-                    ) : m.type === 'AUDIO' ? (
+                    ) : m.type === 'SONG' ? (
                       <AudioItem
                         item={m}
                         show={popupData.activeIndex === mIndex}
@@ -568,7 +544,7 @@ export default defineComponent({
                         isEmtry={isEmtry}
                         onEnded={() => {
                           const _index = popupData.activeIndex + 1;
-                          console.log("🚀 ~ _index:", _index)
+                          console.log('🚀 ~ _index:', _index);
                           if (_index < data.itemList.length) {
                             handleSwipeChange(_index);
                           }

+ 4 - 2
src/views/layout/auth.tsx

@@ -37,7 +37,7 @@ export default defineComponent({
   methods: {
     async setAuth() {
       const { query } = this.$route;
-      const token = query.userInfo || query.Authorization;
+      const token = query.userInfo || query.Authorization || storage.get(ACCESS_TOKEN);
 
       if (token) {
         storage.set(ACCESS_TOKEN, token);
@@ -53,7 +53,9 @@ export default defineComponent({
             requestType: 'form',
             hideLoading: true
           });
-          setLogin(res.data);
+          if (res?.code === 200){
+            setLogin(res.data);
+          }
         } catch (e: any) {
           const message = e.message;
           if (

+ 2 - 2
vite.config.ts

@@ -13,8 +13,8 @@ function resolve(dir: string) {
 }
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
-// const proxyUrl = 'https://test.lexiaoya.cn/';
-const proxyUrl = 'https://dev.kt.colexiu.com/';
+const proxyUrl = 'https://test.lexiaoya.cn/';
+// const proxyUrl = 'https://dev.kt.colexiu.com/';
 // const proxyUrl = 'http://192.168.3.143:7989/';
 export default defineConfig({
   base: './',