瀏覽代碼

Merge branch 'iteration-create' into online

lex 1 年之前
父節點
當前提交
383c914691

+ 20 - 16
src/views/co-ai/baseIndex.module.less

@@ -3,8 +3,7 @@
   // width: 100vw;
   height: 100vh;
   overflow: hidden;
-  background: url('../../common/images/icon_bg.png') no-repeat center center /
-    cover;
+  background: url('../../common/images/icon_bg.png') no-repeat center center / cover;
   display: flex;
   flex-direction: column;
   padding: 61px 18px 18px 37px;
@@ -17,7 +16,7 @@
   width: 31px;
   height: 31px;
 
-  & > img {
+  &>img {
     width: 100%;
     height: 100%;
     object-fit: cover;
@@ -134,8 +133,15 @@
 
     &.emtpyWrap {
       width: 100%;
+      height: 100%;
       padding-top: 0;
     }
+
+    :global {
+      .van-empty__description {
+        color: #777;
+      }
+    }
   }
 
   :global {
@@ -176,16 +182,16 @@
     position: relative;
     margin-bottom: 15px;
     width: 100%;
+    // height: 144px;
     background-color: #edeff2;
     box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
 
     img {
       width: 100%;
-      // height: 100%;
-      height: calc(100% * 161 / 128);
-      // position: absolute;
+      aspect-ratio: 53 / 75;
     }
 
+
     &::before {
       content: '';
       position: absolute;
@@ -207,6 +213,8 @@
       background-color: #e7e7e7;
       z-index: 2;
     }
+
+
   }
 
   .name {
@@ -259,10 +267,10 @@
   z-index: 3;
   display: block;
   width: 100%;
-  line-height: 1;
+  line-height: 0;
   // height: calc(100% * 161 / 128 - 20px);
   background-color: #edeff2;
-  background-image: url('./image/icon_default.svg');
+  background-image: url('../courseware-list/image/icon_default.svg');
   background-repeat: no-repeat;
   background-position: center center;
 
@@ -275,18 +283,14 @@
     height: 100%;
     z-index: 2;
     background-repeat: no-repeat;
-    background-image: linear-gradient(
-        to right,
+    background-image: linear-gradient(to right,
         rgba(0, 0, 0, 0.2) 0,
         rgba(255, 255, 255, 0.08) 0%,
-        transparent 0.5%
-      ),
-      linear-gradient(
-        to right,
+        transparent 0.5%),
+      linear-gradient(to right,
         rgba(0, 0, 0, 0.1) 0.3%,
         rgba(255, 255, 255, 0.09) 1.1%,
-        transparent 1.3%
-      );
+        transparent 1.3%);
     background-size: 50% 100%, 50% 100%;
     background-position: 0% top, 9% top;
   }

+ 11 - 1
src/views/co-ai/baseIndex.tsx

@@ -8,7 +8,7 @@ import {
 } from 'vue';
 import styles from './baseIndex.module.less';
 import icon_back from './image/icon_back.svg';
-import { Button, Space, Tab, Tabs, showConfirmDialog } from 'vant';
+import { Button, Space, Tab, Tabs, showConfirmDialog, Image } from 'vant';
 import {
   api_lessonCoursewareFavoriteRemove,
   api_lessonCoursewareFavoriteSave
@@ -24,6 +24,7 @@ import { api_musicSheetCategoriesPage, api_musicTagTree } from './api';
 import queryString from 'query-string';
 import { useRect } from '@vant/use';
 import { nextTick } from 'process';
+import iconDefaultCo from './image/icon-default-co.png';
 
 export default defineComponent({
   name: 'baseIndex-list',
@@ -100,6 +101,13 @@ export default defineComponent({
       // });
     };
     onMounted(async () => {
+      // 安卓的状态栏
+      postMessage({
+        api: 'setStatusBarVisibility',
+        content: {
+          isVisibility: 0
+        }
+      });
       data.loading = true;
       await getTanentList();
       await getList();
@@ -248,11 +256,13 @@ export default defineComponent({
                           class={[styles.cover, item.load ? styles.loaded : '']}
                           objectFit="cover"
                           src={item.coverImg}
+                          fallbackSrc={iconDefaultCo}
                           onLoad={() => {
                             item.load = true;
                           }}
                           onError={() => {
                             item.load = true;
+                            item.error = true;
                           }}
                         />
                       </div>

二進制
src/views/co-ai/image/icon-default-co.png


+ 10 - 2
src/views/co-ai/index.tsx

@@ -250,6 +250,14 @@ export default defineComponent({
       }
     };
     onMounted(async () => {
+      // 安卓的状态栏
+      postMessage({
+        api: 'setStatusBarVisibility',
+        content: {
+          isVisibility: 0
+        }
+      });
+
       await getMusicSheetCategories();
       getMusicList();
 
@@ -297,8 +305,8 @@ export default defineComponent({
             showArrow={false}
             onSelect={(item: any) => {
               // data.showMusicImg = item.value;
-              if(item.value ==  musicForms.musicSheetCategoriesId){
-                return
+              if (item.value == musicForms.musicSheetCategoriesId) {
+                return;
               }
               data.musics = [];
               musicForms.musicSheetCategoriesId = item.value;

+ 18 - 8
src/views/courseware-list/api.ts

@@ -33,17 +33,17 @@ export const api_lessonCoursewareFavoriteRemove = (
   });
 };
 /** 教材详情 */
-export const api_lessonCoursewareDetail = (
-  params: string | number
-): Promise<any> => {
-  return request.get(`/edu-app/lessonCourseware/detail/${params}`);
+export const api_lessonCoursewareDetail = (params: any): Promise<any> => {
+  return request.get(`/edu-app/lessonCourseware/detail/${params.id}`, {
+    params: params
+  });
 };
 
 /** 课程教材详情 */
-export const api_classLessonCoursewareDetail = (
-  params: string | number
-): Promise<any> => {
-  return request.get(`/edu-app/classLessonCourseware/detail/${params}`);
+export const api_classLessonCoursewareDetail = (params: any): Promise<any> => {
+  return request.get(`/edu-app/classLessonCourseware/detail/${params.id}`, {
+    params: params
+  });
 };
 
 /** 版本教材 */
@@ -52,3 +52,13 @@ export const api_tenantInfoDetail = (params: any): Promise<any> => {
     params: params
   });
 };
+
+/**
+ * 获取声部列表
+ * returns subjects
+ */
+export const api_subjectList = (params: any) => {
+  return request.post('/edu-app/subject/page', {
+    data: params
+  });
+};

+ 6 - 2
src/views/courseware-list/component/book/index.tsx

@@ -35,6 +35,10 @@ export default defineComponent({
     rect: {
       type: Object as PropType<DOMRect>,
       default: () => ({})
+    },
+    subjectId: {
+      type: [String, Number],
+      default: ''
     }
   },
   emits: ['close'],
@@ -123,8 +127,6 @@ export default defineComponent({
                   showGuide.value = true;
                 }, 1500);
               }, 500);
-
-              
             });
           });
         });
@@ -208,6 +210,7 @@ export default defineComponent({
           lessonCoursewareId: item.lessonCoursewareId,
           lessonCoursewareDetailId: item.lessonCoursewareDetailId,
           name: item.name,
+          subjectId: props.subjectId,
           tab: props.tab // 当前切换的是哪个类型
         });
         const url =
@@ -226,6 +229,7 @@ export default defineComponent({
         //   path: '/courseware-play',
         //   query: {
         //     id: item.id,
+        //     subjectId: props.subjectId,
         //     lessonCoursewareId: item.lessonCoursewareId,
         //     lessonCoursewareDetailId: item.lessonCoursewareDetailId,
         //     name: item.name,

+ 1 - 1
src/views/courseware-list/index.module.less

@@ -409,4 +409,4 @@
       color: #fff;
     }
   }
-}
+}

+ 71 - 10
src/views/courseware-list/index.tsx

@@ -31,7 +31,8 @@ import {
   api_lessonCoursewareDetail,
   api_classLessonCoursewarePage,
   api_classLessonCoursewareDetail,
-  api_tenantInfoDetail
+  api_tenantInfoDetail,
+  api_subjectList
 } from './api';
 import { NImage } from 'naive-ui';
 import { state } from '@/state';
@@ -76,9 +77,16 @@ export default defineComponent({
     const goback = () => {
       postMessage({ api: 'goBack' });
     };
+    const coursewareStorage = localStorage.getItem('courseware-list')
+      ? JSON.parse(localStorage.getItem('courseware-list') as any)
+      : {};
     const forms = reactive({
-      currentGradeNum: null,
-      bookVersionId: null as any,
+      currentGradeNum: coursewareStorage.currentGradeNum || null,
+      bookVersionId: coursewareStorage.bookVersionId || (null as any),
+      subjectId:
+        coursewareStorage.subjectId ||
+        state.user.data?.subjectId ||
+        (null as any),
       page: 1,
       rows: 999,
       type: 'COURSEWARE'
@@ -105,6 +113,7 @@ export default defineComponent({
       tab: 'all',
       details: [] as any[],
       bookData: {} as any,
+      subjectList: [] as any,
       showBook: false,
       book: {} as DOMRect
     });
@@ -121,6 +130,13 @@ export default defineComponent({
 
           baseBookVerionList.value = data.bookVersionList || [];
           bookVersionList.value = deepClone(baseBookVerionList.value);
+          const index = baseBookVerionList.findIndex(
+            (item: any) => item.bookVersionId == coursewareStorage.bookVersoinId
+          );
+          // 判断列表中是存在,缓存的教材数据
+          if (index < 0) {
+            forms.bookVersionId = null;
+          }
         }
       } catch {
         //
@@ -143,10 +159,9 @@ export default defineComponent({
         });
       }
       data.loading = false;
-      setTimeout(()=>{
+      setTimeout(() => {
         isShowGuide.value = true;
-      },100)
-
+      }, 100);
     };
     const getFavoriteList = async () => {
       data.loading = true;
@@ -155,6 +170,7 @@ export default defineComponent({
         userId: state.user?.data?.id,
         page: forms.page,
         rows: forms.rows,
+        subjectId: forms.subjectId,
         bookVersionId: forms.bookVersionId != -1 ? forms.bookVersionId : '',
         currentGradeNum: forms.currentGradeNum ? forms.currentGradeNum : ''
       });
@@ -177,6 +193,7 @@ export default defineComponent({
         bookVersionId: forms.bookVersionId ? forms.bookVersionId : '',
         page: forms.page,
         rows: forms.rows,
+        subjectId: forms.subjectId,
         currentGradeNum: forms.currentGradeNum ? forms.currentGradeNum : ''
       });
       if (res?.code === 200 && Array.isArray(res?.data?.rows)) {
@@ -214,8 +231,22 @@ export default defineComponent({
       }
       getData();
     };
-    onMounted(() => {
-      getTanentList();
+
+    const getSubjectList = async () => {
+      try {
+        const res = await api_subjectList({
+          enableFlag: true,
+          delFlag: 0,
+          page: 1,
+          rows: 999
+        });
+        console.log(res.data, ' subjectList');
+        data.subjectList = res.data.rows || [];
+      } catch {}
+    };
+    onMounted(async () => {
+      await getTanentList();
+      await getSubjectList();
       getData();
     });
 
@@ -245,7 +276,10 @@ export default defineComponent({
     /** 学生端根据教材编号获取关联的单元、章节 */
     const getDetail = async (item: any) => {
       if (data.tab === 'course') {
-        const res = await api_classLessonCoursewareDetail(item.id);
+        const res = await api_classLessonCoursewareDetail({
+          id: item.id,
+          subjectId: forms.subjectId
+        });
         if (res?.code == 200 && Array.isArray(res?.data?.lessonList)) {
           data.details = res.data.lessonList || [];
           data.bookData = res.data;
@@ -265,7 +299,10 @@ export default defineComponent({
           return;
         }
       } else {
-        const res = await api_lessonCoursewareDetail(item.id);
+        const res = await api_lessonCoursewareDetail({
+          id: item.id,
+          subjectId: forms.subjectId
+        });
         if (res?.code == 200 && Array.isArray(res?.data?.lessonList)) {
           data.details = res.data.lessonList || [];
           data.bookData = res.data;
@@ -321,6 +358,7 @@ export default defineComponent({
               styles.downBtn,
               (data.tab != 'course' && forms.bookVersionId > 0) ||
               (data.tab == 'course' && forms.bookVersionId) ||
+              forms.subjectId ||
               forms.currentGradeNum
                 ? styles.activeBtn
                 : ''
@@ -439,6 +477,7 @@ export default defineComponent({
         <TheBook
           show={data.showBook}
           bookData={data.bookData}
+          subjectId={forms.subjectId}
           tab={data.tab}
           rect={data.book}
           onClose={() => {
@@ -473,6 +512,18 @@ export default defineComponent({
                   </Tag>
                 ))}
               </div>
+
+              <div class={styles.popoverTitle}>选择声部</div>
+              <div class={[styles.popupList, styles.versionList]}>
+                {data.subjectList.map((item: any) => (
+                  <Tag
+                    plain={forms.subjectId == item.id}
+                    round
+                    onClick={() => (forms.subjectId = item.id)}>
+                    {item.name}
+                  </Tag>
+                ))}
+              </div>
             </div>
 
             <div class={styles.btnGroup}>
@@ -481,6 +532,7 @@ export default defineComponent({
                 onClick={() => {
                   forms.bookVersionId = null;
                   forms.currentGradeNum = null;
+                  forms.subjectId = state.user.data?.subjectId || null;
                 }}>
                 重置
               </Button>
@@ -488,6 +540,15 @@ export default defineComponent({
                 round
                 class={styles.btnSure}
                 onClick={() => {
+                  // 保存缓存
+                  localStorage.setItem(
+                    'courseware-list',
+                    JSON.stringify({
+                      bookVersionId: forms.bookVersionId,
+                      currentGradeNum: forms.currentGradeNum,
+                      subjectId: forms.subjectId
+                    })
+                  );
                   getData();
                   popoverShow.value = false;
                 }}>

+ 8 - 4
src/views/courseware-play/index.tsx

@@ -105,9 +105,10 @@ export default defineComponent({
 
     const getCourseDetail = async () => {
       try {
-        const res = await api_lessonCoursewareDetail(
-          route.query.lessonCoursewareId as any
-        );
+        const res = await api_lessonCoursewareDetail({
+          id: route.query.lessonCoursewareId as any,
+          subjectId: activeData.subjectId
+        });
         if (res?.code == 200 && Array.isArray(res?.data?.lessonList)) {
           data.courseDetails = res.data.lessonList || [];
         }
@@ -127,6 +128,7 @@ export default defineComponent({
     });
     const activeData = reactive({
       isAutoPlay: true, // 是否自动播放
+      subjectId: route.query.subjectId,
       lessonCoursewareId: route.query.lessonCoursewareId,
       lessonCoursewareDetailId: route.query.lessonCoursewareDetailId,
       coursewareDetailKnowledgeId: route.query.id,
@@ -144,6 +146,7 @@ export default defineComponent({
       if (route.query.tab == 'course') {
         const res = await api_classLessonCoursewareQuery({
           coursewareDetailKnowledgeId: activeData.coursewareDetailKnowledgeId,
+          subjectId: activeData.subjectId,
           page: 1,
           rows: -1
         });
@@ -165,7 +168,8 @@ export default defineComponent({
       } else {
         const res = await api_lessonCoursewareKnowledgeDetailDetail({
           lessonCoursewareKnowledgeDetailId:
-            activeData.coursewareDetailKnowledgeId
+            activeData.coursewareDetailKnowledgeId,
+          subjectId: activeData.subjectId
         });
         if (res?.code === 200 && Array.isArray(res.data)) {
           courseList = res.data || [];