lex 1 year ago
parent
commit
e0d9a01027

+ 1 - 1
src/views/exercise-record/exercis-detail.tsx

@@ -136,7 +136,7 @@ export default defineComponent({
               <OHeader
                 border={false}
                 background={state.background}
-                color={state.color}
+                // color={state.color}
               />
             </OSticky>
             <div class={styles.topInfo}>

BIN
src/views/hot-music-more/images/icon-player.png


BIN
src/views/hot-music-more/images/woring-bg.png


+ 166 - 1
src/views/hot-music-more/index.module.less

@@ -7,6 +7,11 @@
     .van-search {
       padding-top: 20px;
     }
+
+    // .van-sticky--fixed {
+    //   background: url('./images/woring-bg.png') no-repeat top center;
+    //   background-size: 100%;
+    // }
   }
 }
 
@@ -64,10 +69,170 @@
     background-size: contain;
     width: 9px;
     height: 5px;
+    transition: transform 0.2s ease;
+  }
+
+  &.active {
+    i {
+      transform: rotate(180deg);
+      transition: transform 0.2s ease;
+    }
   }
 }
 
 // .hotMusicMoreTablet {
 //   background: url('./images/woring-bg-tablet.png') no-repeat top center;
 //   background-size: contain;
-// }
+// }
+
+.musicList {
+  margin: 8px 13px 13px;
+  background: #FFFFFF;
+  border-radius: 16px;
+  overflow: hidden;
+  min-height: 50vh;
+
+  .musicItem {
+    padding: 15px 12px;
+  }
+
+  .musicImg {
+    width: 51px;
+    height: 51px;
+    margin-right: 10px;
+  }
+
+  .musicPlayIcon {
+    width: 24px;
+    height: 24px;
+  }
+
+  .musicContnet {
+    h2 {
+      font-size: 16px;
+      font-weight: 600;
+      color: #333333;
+      line-height: 22px;
+    }
+
+    p {
+      padding-top: 8px;
+      font-size: 13px;
+      color: #777777;
+      line-height: 1;
+    }
+  }
+}
+
+.changeSubjectContainer {
+  min-height: 317px;
+  max-height: 367px;
+  overflow-x: hidden;
+  overflow-y: auto;
+  padding: 0 15px 30px;
+
+
+  &::-webkit-scrollbar {
+    display: none;
+  }
+
+
+  .title {
+    padding-top: 18px;
+    display: flex;
+    align-items: center;
+
+    font-size: 16px;
+    font-weight: 500;
+    color: #333333;
+    line-height: 22px;
+
+    &::before {
+      content: '';
+      display: inline-block;
+      width: 4px;
+      height: 11px;
+      background: #1CACF1;
+      border-radius: 3px;
+      margin-right: 6px;
+    }
+  }
+}
+
+
+.searchHead {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 16px;
+  font-weight: 500;
+  color: #333333;
+  height: 55px;
+  line-height: 55px;
+  border-bottom: 1px solid #F2F2F2;
+  margin: 0 15px;
+
+  .cancel,
+  .confirm {
+    font-size: 14px;
+    font-weight: 400;
+    line-height: 20px;
+    color: #777777;
+    padding: 0 7px;
+  }
+
+  .confirm {
+    color: #1CACF1;
+  }
+
+}
+
+.subjectContainer {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  padding-top: 18px;
+
+  .subjectItem {
+    width: 31%;
+    height: 34px;
+    line-height: 34px;
+    text-align: center;
+    background: #F6F6F6;
+    border-radius: 50px;
+    font-size: 13px;
+    color: #333333;
+    border: 1px solid #F6F6F6;
+    margin-bottom: 12px;
+
+    &:nth-child(3n + 2) {
+      margin-left: 2.333%;
+      margin-right: 2.333%;
+    }
+
+    &.arrow::after {
+      content: '';
+      display: inline-block;
+      margin-left: 3px;
+      width: 0;
+      height: 0;
+      border-left: 4px solid transparent;
+      border-right: 4px solid transparent;
+      border-top: 4px solid transparent;
+      border-bottom: 4px solid #777777;
+      transform: translateY(3px) rotate(180deg);
+    }
+
+
+    &.active {
+      border: 1px solid #1CACF1;
+      background: #EBF8FF;
+      color: #1CACF1;
+
+      &::after {
+        border-bottom: 4px solid #1CACF1;
+        transform: translateY(-2px) rotate(0deg);
+      }
+    }
+  }
+}

+ 148 - 4
src/views/hot-music-more/index.tsx

@@ -1,23 +1,73 @@
-import { defineComponent } from 'vue';
+import { defineComponent, onMounted, reactive } from 'vue';
 import styles from './index.module.less';
 import { browser } from '@/helpers/utils';
 import MSticky from '@/components/m-sticky';
 import MHeader from '@/components/m-header';
 import { useRouter } from 'vue-router';
 import MSearch from '@/components/m-search';
+import { Cell, Image, List, Popup } from 'vant';
+import iconPlayer from './images/icon-player.png';
+import { api_musicSheetPage } from '../co-ai/api';
+import { useEventListener, useWindowScroll } from '@vueuse/core';
 
 export default defineComponent({
   name: 'hot-music-more',
   setup() {
     const router = useRouter();
+    const state = reactive({
+      background: 'transparent',
+      loading: false,
+      finished: false,
+      searchPopup: false,
+      musics: [] as any
+    });
+
+    const musicForms = reactive({
+      page: 1,
+      rows: 20,
+      status: 1,
+      keyword: '', // 关键词
+      musicSheetCategoriesId: ''
+    });
+
+    const getMusicList = async () => {
+      state.loading = true;
+      try {
+        const res = await api_musicSheetPage({
+          ...musicForms
+        });
+        if (res.code === 200 && Array.isArray(res?.data?.rows)) {
+          state.musics = [...state.musics, ...res.data.rows];
+          state.finished = !res.data.next;
+        }
+      } catch (error) {
+        // console.log('🚀 ~ error:', error);
+      }
+      state.loading = false;
+    };
+
+    const getSubjectList = async () => {};
+
+    onMounted(() => {
+      useEventListener(document, 'scroll', () => {
+        const { y } = useWindowScroll();
+        if (y.value > 32) {
+          state.background = '#fff';
+        } else {
+          state.background = 'transparent';
+        }
+      });
+      getMusicList();
+    });
     return () => (
+      // sortType: 2
       <div
         class={[
           styles.hotMusicMore,
           browser().isTablet ? styles.hotMusicMoreTablet : ''
         ]}>
         <MSticky position="top">
-          <MHeader border={false} background="transparent">
+          <MHeader border={false} background={state.background}>
             {{
               content: () => (
                 <div class={styles.woringHeader}>
@@ -43,10 +93,15 @@ export default defineComponent({
             }}
           </MHeader>
 
-          <MSearch background="transparent">
+          <MSearch background={state.background}>
             {{
               left: () => (
-                <div class={styles.searchContent}>
+                <div
+                  class={[
+                    styles.searchContent,
+                    state.searchPopup && styles.active
+                  ]}
+                  onClick={() => (state.searchPopup = true)}>
                   <span>筛选</span>
                   <i></i>
                 </div>
@@ -54,6 +109,95 @@ export default defineComponent({
             }}
           </MSearch>
         </MSticky>
+
+        <List
+          loading={state.loading}
+          finished={state.finished}
+          finishedText=" "
+          onLoad={getMusicList}
+          immediateCheck={false}
+          class={styles.musicList}>
+          {state.musics.map((item: any) => (
+            <Cell class={styles.musicItem} border={false} center>
+              {{
+                icon: () => (
+                  <Image class={styles.musicImg} src={item.titleImg} />
+                ),
+                title: () => (
+                  <div class={styles.musicContnet}>
+                    <h2>{item.musicSheetName}</h2>
+                    {item.composer && <p>{item.composer}</p>}
+                  </div>
+                ),
+                'right-icon': () => (
+                  <Image class={styles.musicPlayIcon} src={iconPlayer} />
+                )
+              }}
+            </Cell>
+          ))}
+        </List>
+
+        {/* {!data.skelete && data.list.length === 0 && (
+          <MEmpty description="暂无记录" />
+        )} */}
+
+        <Popup position="bottom" round v-model:show={state.searchPopup}>
+          <div class={styles.searchContainer}>
+            <div class={styles.searchHead}>
+              <span
+                class={styles.cancel}
+                onClick={() => (state.searchPopup = false)}>
+                取消
+              </span>
+              <span>筛选</span>
+              <span
+                class={styles.confirm}
+                onClick={() => (state.searchPopup = false)}>
+                确定
+              </span>
+            </div>
+
+            <div class={styles.changeSubjectContainer}>
+              <div class={styles.title}>声部</div>
+
+              <div class={styles.subjectContainer}>
+                <div
+                  class={[
+                    styles.subjectItem
+                    // item.children.length > 0 && styles.arrow,
+                    // item.id === state.subjectValue && styles.active
+                  ]}>
+                  测试
+                </div>
+                <div class={[styles.subjectItem, styles.arrow, styles.active]}>
+                  测试
+                </div>
+              </div>
+
+              <div class={styles.title}>乐器</div>
+              <div class={styles.subjectContainer}>
+                <div
+                  class={[
+                    styles.subjectItem
+                    // styles.active
+                  ]}>
+                  测试
+                </div>
+              </div>
+
+              <div class={styles.title}>曲谱教材</div>
+              <div class={styles.subjectContainer}>
+                <div
+                  class={[
+                    styles.subjectItem
+                    // styles.active
+                  ]}>
+                  一年级上册
+                </div>
+              </div>
+            </div>
+          </div>
+        </Popup>
       </div>
     );
   }

+ 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: './',