skyblued 2 年之前
父節點
當前提交
c4dd581b8c

+ 25 - 3
src/views/accompany/category.tsx

@@ -5,10 +5,32 @@ import styles from './index.module.less'
 export default defineComponent({
     name: 'accompany-category',
     setup(props, ctx) {
-        console.log(getImage('b1.svg'))
+        const svgs = [
+            {
+                icon: getImage('l1.png'),
+                title: '声部训练',
+                subtitle: '乐器基础,巩固自己的基本功'
+            },
+            {
+                icon: getImage('l2.png'),
+                title: '合奏训练',
+                subtitle: '团队协作,加强协调配合能力'
+            },
+            {
+                icon: getImage('l3.png'),
+                title: '独奏曲目',
+                subtitle: '热播金曲,练习更加有趣'
+            },
+        ]
         return () => (
-            <div class={styles.accompany}>
-                列表
+            <div class={styles.accompanyCategory}>
+                {svgs.map((item: any) => {
+                    return (
+                        <div class={styles.container} style={{backgroundImage: `url(${item.icon})`}}>
+                            {/* <img src={item.icon} /> */}
+                        </div>
+                    )
+                })}
             </div>
         )
     },

+ 3 - 2
src/views/accompany/images/index.ts

@@ -1,4 +1,5 @@
+const modules = import.meta.globEager(`../images/**`)
 export const getImage = (name: string) => {
-    console.log(import('../images'))
-    return 
+    // console.log("🚀 ~ modules", modules[`../images/${name}`]?.default)
+    return modules[`../images/${name}`]?.default || ''
 }

+ 8 - 0
src/views/accompany/index.module.less

@@ -0,0 +1,8 @@
+.accompanyCategory{
+    .container{
+        margin: 8px 12px;
+        height: 140px;
+        background-repeat: no-repeat;
+        background-size: 100% 100%;
+    }
+}

+ 0 - 1
src/views/accompany/index.tsx

@@ -7,7 +7,6 @@ export default defineComponent({
     setup(props, ctx) {
         return () => (
             <div class={styles.accompany}>
-                云教练
                 <RouterView />
             </div>
         )

+ 8 - 1
src/views/lessonCourseware/index.tsx

@@ -19,7 +19,14 @@ export default defineComponent({
         try {
           const res: any = await request.post(state.platformApi + `/courseSchedule/getCourseware/${route.query.courseScheduleId}`)
           if (Array.isArray(res?.data)) {
-            data.list = res.data
+            data.list = res.data.map((n: any) => {
+              return {
+                coverImg: n.coverImg,
+                name: n.coursewareName,
+                id: n.lessonCoursewareId,
+                courseNum: n.coursewareNum
+              }
+            })
           }
         } catch (error) {}
       } else {