lex 1 год назад
Родитель
Сommit
64abe6a616

BIN
src/page-instrument/component/the-music-list/icon-music-vip.png


+ 46 - 7
src/page-instrument/component/the-music-list/index.module.less

@@ -49,7 +49,8 @@
             overflow-x: hidden;
             overflow-y: auto;
         }
-        .van-tab--active::after{
+
+        .van-tab--active::after {
             content: '';
             position: absolute;
             bottom: 0;
@@ -60,7 +61,8 @@
             background: var(--van-tabs-bottom-bar-color);
             border-radius: var(--van-tabs-bottom-bar-height);
         }
-        .van-tabs__line{
+
+        .van-tabs__line {
             transition-duration: 0s !important;
             display: none;
         }
@@ -74,21 +76,58 @@
 .item {
     display: flex;
     align-items: center;
-    height: 41px;
-    border-radius: 7px;
+    // height: 41px;
+    // border-radius: 7px;
     font-size: 13px;
     font-family: PingFangSC-Regular, PingFang SC;
     font-weight: 400;
     color: #333333;
     line-height: 18px;
-    padding: 0 14px;
-    margin: 10px 0;
+    padding: 12px 12px;
+    // margin: 10px 0;
+
+    .titleImg {
+        width: 51px;
+        height: 51px;
+        margin-right: 10px;
+        border-radius: 8px;
+        overflow: hidden;
+        position: relative;
+        flex-shrink: 0;
+    }
+
+    .iconType {
+        position: absolute;
+        width: 28px;
+        height: 14px;
+        right: 0;
+        top: 0;
+        z-index: 9;
+
+        // &.FREE {
+        //   background: url('../co-ai/image/icon-music-default.png') no-repeat center;
+        //   background-size: contain;
+        // }
+
+        &.VIP {
+            background: url('./icon-music-vip.png') no-repeat center;
+            background-size: contain;
+        }
+    }
+
+    .author {
+        padding-top: 8px;
+        font-size: 13px;
+        color: #777777;
+        line-height: 1;
+    }
 }
 
 .itemActive {
     background: #ECF9FF;
 }
-.noData{
+
+.noData {
     display: flex;
     justify-content: center;
     align-items: center;

+ 98 - 94
src/page-instrument/component/the-music-list/list.tsx

@@ -2,104 +2,108 @@ import { defineComponent, onMounted, reactive, watch } from "vue";
 import styles from "./index.module.less";
 import { api_musicSheetPage } from "../../api";
 import state, { togglePlay } from "/src/state";
-import { List } from "vant";
+import { List, Image } from "vant";
 import { postMessage } from "/src/utils/native-message";
 import qs from "query-string";
 
 export default defineComponent({
-	name: "TheMusicList-list",
-	props: {
-		recentFlag: {
-			type: Boolean,
-			default: false,
-		},
-	},
-	setup(props) {
-		const forms = reactive({
-			page: 1,
-			rows: 20,
-			musicSheetCategoriesId: state.bizMusicCategoryId,
-			recentFlag: props.recentFlag ? true : null,
-			excludeMusicId: props.recentFlag ? null : state.examSongId,
-		});
-		const data = reactive({
-			list: [] as any[],
-			finished: false,
-			loading: false,
-			hasNext: true,
-		});
-		const getList = async () => {
-			if (!data.hasNext) return
-			data.loading = true;
-			try {
-				const res = await api_musicSheetPage({
-					...forms,
-				});
-				if (res?.code === 200 && Array.isArray(res.data?.rows)) {
-					data.list = [...data.list, ...res.data.rows];
-				}
-				data.finished = res.data?.rows?.length < forms.rows;
-				data.hasNext = res.data?.total > data.list.length
-			} catch (error) {
-				console.log(error);
-			}
+  name: "TheMusicList-list",
+  props: {
+    recentFlag: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  setup(props) {
+    const forms = reactive({
+      page: 1,
+      rows: 20,
+      musicSheetCategoriesId: state.bizMusicCategoryId,
+      recentFlag: props.recentFlag ? true : null,
+      excludeMusicId: props.recentFlag ? null : state.examSongId,
+    });
+    const data = reactive({
+      list: [] as any[],
+      finished: false,
+      loading: false,
+      hasNext: true,
+    });
+    const getList = async () => {
+      if (!data.hasNext) return;
+      data.loading = true;
+      try {
+        const res = await api_musicSheetPage({
+          ...forms,
+        });
+        if (res?.code === 200 && Array.isArray(res.data?.rows)) {
+          data.list = [...data.list, ...res.data.rows];
+        }
+        data.finished = res.data?.rows?.length < forms.rows;
+        data.hasNext = res.data?.total > data.list.length;
+      } catch (error) {
+        console.log(error);
+      }
 
-			data.loading = false;
-		};
-		watch(
-			() => props.recentFlag,
-			() => {
-				data.hasNext = true
-			}
-		);
-		onMounted(() => {
-			getList();
-		});
+      data.loading = false;
+    };
+    watch(
+      () => props.recentFlag,
+      () => {
+        data.hasNext = true;
+      }
+    );
+    onMounted(() => {
+      getList();
+    });
 
-		const openAccomapina = (item: any) => {
-			if (item.id === state.examSongId) return;
-			// 暂停播放
-			togglePlay("paused");
-			postMessage({
-				api: "cloudLoading",
-				content: {
-					show: true,
-					type: "fullscreen",
-				},
-			});
-			location.href =
-				location.origin +
-				location.pathname +
-				"?" +
-				qs.stringify({
-					id: item.id,
-					_t: Date.now(),
-				});
-		};
-		return () => (
-			<div class={styles.wrap}>
-				<List
-					loading={data.loading}
-					finished={data.finished}
-					immediateCheck={false}
-					onLoad={() => {
-						forms.page++;
-						getList();
-					}}
-				>
-					{data.list.map((item: any) => {
-						return (
-							<div
-								class={[styles.item, state.examSongId == item.id && styles.itemActive]}
-								onClick={() => openAccomapina(item)}
-							>
-								{item.musicSheetName}
-							</div>
-						);
-					})}
-					{!data.loading && data.list.length === 0 && <div class={styles.noData}>暂无数据</div>}
-				</List>
-			</div>
-		);
-	},
+    const openAccomapina = (item: any) => {
+      if (item.id === state.examSongId) return;
+      // 暂停播放
+      togglePlay("paused");
+      postMessage({
+        api: "cloudLoading",
+        content: {
+          show: true,
+          type: "fullscreen",
+        },
+      });
+      location.href =
+        location.origin +
+        location.pathname +
+        "?" +
+        qs.stringify({
+          id: item.id,
+          _t: Date.now(),
+        });
+    };
+    return () => (
+      <div class={styles.wrap}>
+        <List
+          loading={data.loading}
+          finished={data.finished}
+          immediateCheck={false}
+          onLoad={() => {
+            forms.page++;
+            getList();
+          }}
+        >
+          {data.list.map((item: any) => {
+            return (
+              <div class={[styles.item, state.examSongId == item.id && styles.itemActive]} onClick={() => openAccomapina(item)}>
+                <div class={styles.titleImg}>
+                  <i class={[styles.iconType, styles[item.paymentType]]}></i>
+                  <Image src={item.titleImg} class={styles.img} />
+                </div>
+                <div class={styles.content}>
+                  <p class={styles.name}>{item.musicSheetName}</p>
+                  {item.composer && <p class={styles.author}>{item.composer}</p>}
+                </div>
+              </div>
+            );
+          })}
+          {!data.loading && data.list.length === 0 && <div class={styles.noData}>暂无数据</div>}
+        </List>
+      </div>
+    );
+  },
 });

+ 2 - 2
vite.config.ts

@@ -78,8 +78,8 @@ export default defineConfig({
         // target: "https://kt.colexiu.com",
         // target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
         // target: "https://dev.resource.colexiu.com",
-        // target: "https://test.kt.colexiu.com",
-        target: "https://mec.colexiu.com",
+        target: "https://test.kt.colexiu.com",
+        // target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),
       },