瀏覽代碼

Merge branch 'iteration-20240829-free'

lex-xin 7 月之前
父節點
當前提交
372caa042e

二進制
src/common/images/song-empty.png


+ 37 - 0
src/tenant/music/personal/index.module.less

@@ -70,6 +70,43 @@
   }
 }
 
+.songEfficacy {
+  background: #FFFFFF;
+  border-radius: 10px;
+}
+.songContainer {
+  width: 238px;
+  padding-top: 18px;
+  padding-bottom: 18px;
+
+  .title {
+    font-size: 16px;
+    color: #666666;
+    line-height: 24px;
+    text-align: center;
+  }
+
+  img {
+    margin: 10px auto 16px;
+    width: 133px;
+    height: 98px;
+    display: block;
+  }
+
+  .btnGroup {
+    text-align: center;
+    :global {
+      .van-button {
+        --van-button-default-height: 40px;
+        width: 130px;
+        font-size: 16px;
+        color: #333333;
+      }
+    }
+  }
+
+}
+
 .pTitle {
   font-size: 16px;
   font-weight: 600;

+ 41 - 35
src/tenant/music/personal/personal.tsx

@@ -1,5 +1,5 @@
 import { defineComponent, reactive, ref, watch } from 'vue'
-import { List } from 'vant'
+import { List, Button } from 'vant'
 import request from '@/helpers/request'
 import { useRoute, useRouter } from 'vue-router'
 import ColResult from '@/components/col-result'
@@ -8,6 +8,7 @@ import styles from './index.module.less'
 import Song from '../component/song'
 import { number } from 'echarts/core'
 
+
 export default defineComponent({
   name: 'MusicList',
   emits: ['favorite'],
@@ -26,6 +27,7 @@ export default defineComponent({
       gift: props.gift,
       page: 1
     })
+    
     const data = ref<any>(null)
     const rows = ref<any[]>([])
     const loading = ref(false)
@@ -78,42 +80,46 @@ export default defineComponent({
       FetchList
     })
 
+    console.log('1111')
+
     return () => (
-      <List
-        loading={loading.value}
-        finished={finished.value}
-        finished-text={rows.value.length ? '没有更多了' : ''}
-        onLoad={FetchList}
-        error={isError.value}
-      >
-        {rows.value.length ? (
-          <div class={styles.personalSong}>
-            <Song
-              showTitleImg
-              list={rows.value}
-              onDetail={(item: any) => {
-                const url =
-                  location.origin +
-                  location.pathname +
-                  '#/music-detail?id=' +
-                  item.id
-                openDefaultWebView(url, () => {
-                  router.push({
-                    path: '/music-detail',
-                    query: {
-                      id: item.id
-                    }
+      <>
+        <List
+          loading={loading.value}
+          finished={finished.value}
+          finished-text={rows.value.length ? '没有更多了' : ''}
+          onLoad={FetchList}
+          error={isError.value}
+        >
+          {rows.value.length ? (
+            <div class={styles.personalSong}>
+              <Song
+                showTitleImg
+                list={rows.value}
+                onDetail={(item: any) => {
+                  const url =
+                    location.origin +
+                    location.pathname +
+                    '#/music-detail?id=' +
+                    item.id
+                  openDefaultWebView(url, () => {
+                    router.push({
+                      path: '/music-detail',
+                      query: {
+                        id: item.id
+                      }
+                    })
                   })
-                })
-              }}
-            />
-          </div>
-        ) : (
-          !loading.value && (
-            <ColResult tips="暂无单曲" classImgSize="SMALL" btnStatus={false} />
-          )
-        )}
-      </List>
+                }}
+              />
+            </div>
+          ) : (
+            !loading.value && (
+              <ColResult tips="暂无单曲" classImgSize="SMALL" btnStatus={false} />
+            )
+          )}
+        </List>
+      </>
     )
   }
 })

+ 38 - 1
src/tenant/music/personal/practice.tsx

@@ -1,11 +1,12 @@
 import request from '@/helpers/request'
 import { useAsyncState } from '@vueuse/core'
 import { defineComponent, ref } from 'vue'
-import { Cell, Skeleton } from 'vant'
+import { Cell, Skeleton, Popup, Button } from 'vant'
 import Item from '../list/item'
 import { openDefaultWebView, state } from '@/state'
 import styles from './index.module.less'
 import Song from '../component/song'
+import songEmpty from '@/common/images/song-empty.png'
 import { useRouter } from 'vue-router'
 
 export default defineComponent({
@@ -15,6 +16,8 @@ export default defineComponent({
     const router = useRouter()
     /** 这里条数不会变动,设置固定高度避免抖动 */
     const prevNum = ref(0)
+    const songStatus = ref(false)
+    const songItem = ref({})
     const {
       isLoading,
       state: resState,
@@ -31,6 +34,20 @@ export default defineComponent({
       null
     )
 
+    const onSure = async () => {
+      try {
+        request.get('/music/sheet/practice/del/' + songItem.value.id , {
+          prefix:
+            state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student'
+        })
+        execute()
+
+        songStatus.value = false
+      } catch {
+
+      }
+    }
+
     expose({
       reload: execute
     })
@@ -54,6 +71,11 @@ export default defineComponent({
                   showTitleImg
                   list={list}
                   onDetail={(item: any) => {
+                    if(item.play === 1) {
+                      songItem.value = item
+                      songStatus.value = true
+                      return
+                    }
                     const url =
                       location.origin +
                       location.pathname +
@@ -72,6 +94,21 @@ export default defineComponent({
               </div>
             </>
           )}
+
+        <Popup
+          show={songStatus.value}
+          class={styles.songEfficacy}
+          round
+          onClose={() => (songStatus.value = false)}
+        >
+          <div class={styles.songContainer}>
+            <div class={styles.title}>该曲目已失效</div>
+            <img src={songEmpty} />
+            <div class={styles.btnGroup}>
+              <Button round onClick={onSure}>我知道了</Button>
+            </div>
+          </div>
+        </Popup>
         </>
       )
     }

+ 9 - 33
src/tenant/music/train-list/index.tsx

@@ -71,8 +71,8 @@ export default defineComponent({
       subjectId: null,
       albumId: route.query.albumId,
       albumName: '',
-      level: -1,
-      type: -1,
+      level: '',
+      type: '',
       title: title
     })
     const data = ref<any>(null)
@@ -98,10 +98,8 @@ export default defineComponent({
     const FetchList = async () => {
       loading.value = true
       isError.value = false
-      const { level, type, ...more } = params 
       const tempParams = {
-        categoryId: type !== -1 ? type : level !== -1 ? level : '',
-        ...more
+        ...params
       }
 
       try {
@@ -137,17 +135,7 @@ export default defineComponent({
           }
         }
       )
-      const result = data || {}
-      const courseTypeList = result.categoyList && result.categoyList.length > 0 ? [{
-        name: '全部级别',
-        id: -1
-      }, ...result.categoyList] : []
-
-      searchObj.value = {
-        subjects: result.subjects || [],
-        levelList: courseTypeList,
-        typeList: []
-      }
+      searchObj.value = data || {}
     }
 
     const getAlbumRecordPage = async () => {
@@ -391,20 +379,9 @@ export default defineComponent({
                                             round
                                             onClick={() => {
                                               params.level = subject.id
-
-                                              if(subject.id > 0) {
-                                                const musicSheetCategoriesList = subject.musicSheetCategoriesList && subject.musicSheetCategoriesList.length > 0 ? [{
-                                                  name: '全部类型',
-                                                  id: -1
-                                                }, ...subject.musicSheetCategoriesList] : []
-                                                searchObj.value.typeList = musicSheetCategoriesList
-                                              } else {
-                                                params.type = -1
-                                                searchObj.value.typeList = []
-                                              }
                                             }}
                                           >
-                                            {subject.name}
+                                            {subject.value}
                                           </Tag>
                                         )
                                       }
@@ -440,14 +417,14 @@ export default defineComponent({
                                               params.type = subject.id
                                             }}
                                           >
-                                            {subject.name}
+                                            {subject.value}
                                           </Tag>
                                         )
                                       }
                                     )}
                                   </div>
                                 </>
-                            )}
+                              )}
                           </div>
 
                           <div class={['btnGroup', 'btnMore']}>
@@ -458,9 +435,8 @@ export default defineComponent({
                               round
                               onClick={() => {
                                 params.subjectId = null
-                                params.level = -1
-                                params.type = -1
-                                searchObj.value.typeList = []
+                                params.level = ''
+                                params.type = ''
                               }}
                             >
                               重 置

+ 38 - 0
src/views/music/personal/index.module.less

@@ -21,6 +21,44 @@
   }
 }
 
+
+.songEfficacy {
+  background: #FFFFFF;
+  border-radius: 10px;
+}
+.songContainer {
+  width: 238px;
+  padding-top: 18px;
+  padding-bottom: 18px;
+
+  .title {
+    font-size: 16px;
+    color: #666666;
+    line-height: 24px;
+    text-align: center;
+  }
+
+  img {
+    margin: 10px auto 16px;
+    width: 133px;
+    height: 98px;
+    display: block;
+  }
+
+  .btnGroup {
+    text-align: center;
+    :global {
+      .van-button {
+        --van-button-default-height: 40px;
+        width: 130px;
+        font-size: 16px;
+        color: #333333;
+      }
+    }
+  }
+
+}
+
 .practice,
 .personalSong {
   padding: 0 12px;

+ 38 - 1
src/views/music/personal/practice.tsx

@@ -1,9 +1,10 @@
 import request from '@/helpers/request'
 import { useAsyncState } from '@vueuse/core'
 import { defineComponent, ref } from 'vue'
-import { Cell, Skeleton } from 'vant'
+import { Cell, Skeleton, Button, Popup } from 'vant'
 import Item from '../list/item'
 import { openDefaultWebView, state } from '@/state'
+import songEmpty from '@/common/images/song-empty.png'
 import styles from './index.module.less'
 import Song from '../component/song'
 import { useRouter } from 'vue-router'
@@ -15,6 +16,8 @@ export default defineComponent({
     const router = useRouter()
     /** 这里条数不会变动,设置固定高度避免抖动 */
     const prevNum = ref(0)
+    const songStatus = ref(false)
+    const songItem = ref({})
     const {
       isLoading,
       state: resState,
@@ -31,6 +34,20 @@ export default defineComponent({
       null
     )
 
+    const onSure = async () => {
+      try {
+        request.get('/music/sheet/practice/del/' + songItem.value.id , {
+          prefix:
+            state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student'
+        })
+        execute()
+
+        songStatus.value = false
+      } catch {
+
+      }
+    }
+
     expose({
       reload: execute
     })
@@ -47,6 +64,11 @@ export default defineComponent({
             <Song
               list={list}
               onDetail={(item: any) => {
+                if(item.play === 0) {
+                  songItem.value = item
+                  songStatus.value = true
+                  return
+                }
                 const url =
                   location.origin +
                   location.pathname +
@@ -63,6 +85,21 @@ export default defineComponent({
               }}
             />
           </div>
+
+          <Popup
+            show={songStatus.value}
+            class={styles.songEfficacy}
+            round
+            onClose={() => (songStatus.value = false)}
+          >
+            <div class={styles.songContainer}>
+              <div class={styles.title}>该曲目已失效</div>
+              <img src={songEmpty} />
+              <div class={styles.btnGroup}>
+                <Button round onClick={onSure}>我知道了</Button>
+              </div>
+            </div>
+          </Popup>
         </>
       )
     }