Jelajahi Sumber

Merge remote-tracking branch 'origin/teacher-collect' into newVersion

mo 2 tahun lalu
induk
melakukan
f26e89391c

+ 4 - 3
src/components/musicLIstItem/index.module.less

@@ -161,8 +161,8 @@
       }
     }
     .touchButtonO {
-      &:hover {
-      }
+      margin-bottom: 65px;
+      display: flex;
       .touchButton {
         background: #fff;
         border-radius: 12px;
@@ -173,7 +173,8 @@
         border-radius: 10px;
         border: 1px solid #4ca751;
         display: flex;
-        margin-bottom: 65px;
+        margin-left: 10px;
+        
         .touchButtonWrap {
           width: 54px;
           height: 100%;

+ 20 - 15
src/components/musicLIstItem/index.tsx

@@ -108,21 +108,26 @@ export default defineComponent({
                   <p>查看详情</p>
                 </div>
               ) : (
-                <div
-                  class={[
-                    classes.touchButton,
-                    classes[state.item.chargeType?.toLocaleLowerCase()]
-                  ]}
-                >
-                  <div class={classes.touchButtonWrap}>
-                    <img src={chargeImg[state.item.chargeType]} alt="" />
-                  </div>
-                  <div class={classes.touchButtonText}>
-                    {chargeTypes[state.item.chargeType]
-                      ? chargeTypes[state.item.chargeType]
-                      : '点播'}
-                  </div>
-                </div>
+                <>
+                  {state.item.paymentType && state.item.paymentType.map((tag: string) => (
+                    <div
+                      class={[
+                        classes.touchButton,
+                        classes[tag?.toLocaleLowerCase()]
+                      ]}
+                    >
+                      <div class={classes.touchButtonWrap}>
+                        <img src={chargeImg[tag]} alt="" />
+                      </div>
+                      <div class={classes.touchButtonText}>
+                        {chargeTypes[tag]
+                          ? chargeTypes[tag]
+                          : '点播'}
+                      </div>
+                    </div>
+                  ))}
+                  
+                </>
               )}
             </div>
             {/* <img class={classes.arrow} src={arrow} alt="" /> */}

+ 14 - 2
src/router/routes-admin.ts

@@ -174,14 +174,14 @@ export default [
         path: '/userInfo/musicClass',
         name: 'userInfoMusicClass',
         component: () => import('@/views/user-info/music-class'),
-        meta: { title: '我的曲谱', index: 5, isdark: true }
+        meta: { title: '上传曲谱', index: 5, isdark: true }
       },
       {
         path: '/userInfo/musicOperation',
         name: 'userInfoMusicOperation',
         component: () => import('@/views/user-info/music-operation'),
         meta: {
-          title: '我的曲谱',
+          title: '上传曲谱',
           index: 4,
           hidden: true,
           activeMenu: 'userInfoMusicClass',
@@ -189,6 +189,18 @@ export default [
         }
       },
       {
+        path: '/userInfo/myCollect',
+        name: 'userInfoMyCollect',
+        component: () => import('@/views/student-info/my-score'),
+        meta: {
+          title: '我的曲谱',
+          index: 5,
+          hidden: false,
+          activeMenu: 'userInfoMyCollect',
+          isdark: true
+        }
+      },
+      {
         path: '/userInfo/myFans',
         name: 'userInfoMyFans',
         component: () => import('@/views/user-info/my-fans'),

+ 14 - 3
src/views/albumDetail/index.tsx

@@ -63,7 +63,11 @@ export default defineComponent({
           data: {
             id: state.id,
             page: state.pageInfo.page,
-            rows: state.pageInfo.limit
+            rows: state.pageInfo.limit,
+            clientType: getUserType()
+          },
+          params: {
+            clientType: getUserType()
           }
         })
         state.details = res.data
@@ -73,7 +77,10 @@ export default defineComponent({
         } else {
           state.isshowData = false
         }
-        state.musicList = res.data.musicSheetList.rows
+        state.musicList = Array.isArray(res.data.musicSheetList.rows) && res.data.musicSheetList.rows.map(n => {
+          if (typeof n.paymentType === "string") n.paymentType = n.paymentType.split(',')
+          return n
+        }) || []
         state.hotList = res.data.hotMusicAlbum
         state.hotTagList = res.data.musicTagNames.split(',') || []
         state.relatedMusicAlbum = res.data.relatedMusicAlbum
@@ -91,7 +98,11 @@ export default defineComponent({
       try {
         const res = await request.post(
           `/api-website/music/album/favorite/${state.id}`,
-          {}
+          {
+            params: {
+              clientType: getUserType()
+            }
+          }
         )
         getList()
       } catch (e) {

+ 4 - 4
src/views/albumDetail/modals/musicLIstItem/index.module.less

@@ -175,9 +175,8 @@
       right: 0;
       top: 38px;
       position: absolute;
-      &:hover {
-
-      }
+      margin-bottom: 65px;
+      display: flex;
       .touchButton {
         background: #fff;
         border-radius: 12px;
@@ -188,7 +187,8 @@
         border-radius: 10px;
         border: 1px solid #4ca751;
         display: flex;
-        margin-bottom: 65px;
+        margin-left: 10px;
+        
         .touchButtonWrap {
           width: 54px;
           height: 100%;

+ 16 - 15
src/views/albumDetail/modals/musicLIstItem/index.tsx

@@ -96,21 +96,22 @@ export default defineComponent({
                       <p>查看</p>
                     </div>
                   ) : (
-                    <div
-                      class={[
-                        classes.touchButton,
-                        classes[state.item.chargeType?.toLocaleLowerCase()]
-                      ]}
-                    >
-                      {/* <div class={classes.touchButtonWrap}>
-                    <img src={chargeImg[state.item.chargeType]} alt="" />
-                  </div> */}
-                      <div class={classes.touchButtonText}>
-                        {chargeTypes[state.item.chargeType]
-                          ? chargeTypes[state.item.chargeType]
-                          : '点播'}
-                      </div>
-                    </div>
+                    <>
+                      {state.item.paymentType && state.item.paymentType.map((tag: string) => (
+                        <div
+                          class={[
+                            classes.touchButton,
+                            classes[tag?.toLocaleLowerCase()]
+                          ]}
+                        >
+                          <div class={classes.touchButtonText}>
+                            {chargeTypes[tag]
+                              ? chargeTypes[tag]
+                              : '点播'}
+                          </div>
+                        </div>
+                      ))}
+                    </>
                   )}
                 </div>
               </div>

+ 5 - 1
src/views/home/index.tsx

@@ -18,6 +18,7 @@ import 'swiper/css/pagination'
 import 'swiper/css/scrollbar'
 import { useRouter } from 'vue-router'
 import { ElInput } from 'element-plus'
+import { getUserType } from '@/helpers/utils'
 export default defineComponent({
   name: 'home',
   components: {
@@ -42,7 +43,10 @@ export default defineComponent({
           data: {
             albumStatus: 1,
             page: 1,
-            rows: 8
+            rows: 8,
+          },
+          params:{
+            clientType: getUserType()
           }
         })
 

+ 1 - 1
src/views/muiscDetial/index.module.less

@@ -275,7 +275,7 @@
         border-radius: 10px;
         overflow: hidden;
         cursor: pointer;
-
+        flex-shrink: 0;
         // background: #000000;
         // opacity: 0.2;
       }

+ 23 - 10
src/views/muiscDetial/index.tsx

@@ -155,8 +155,13 @@ export default defineComponent({
       try {
         const res = await request.get(
           `/api-website/open/music/sheet/detail/${state.id}`,
-          {}
+          {
+            params: {
+              clientType: getUserType()
+            }
+          }
         )
+        res.data.paymentType = res.data.paymentType.split(',')
         state.musicDetail = res.data
         state.musicList = res.data.teacher.musicSheetList
         state.subjectList = res.data.background
@@ -395,7 +400,12 @@ export default defineComponent({
       ).then(async () => {
         try {
           const res = await request.post(
-            `/api-website/music/sheet/favorite/${state.id}`
+            `/api-website/music/sheet/favorite/${state.id}`,
+            {
+              params: {
+                clientType: getUserType()
+              }
+            }
           )
           getMusicList()
           // state.otherVideoList = res.data
@@ -524,14 +534,17 @@ export default defineComponent({
                 <div class={classes.right}>
                   <div class={classes.musicInfo}>
                     <h2>
-                      <span
-                        class={[
-                          classes.musicTag,
-                          classes[chargeClass[state.musicDetail.chargeType]]
-                        ]}
-                      >
-                        {chargeTypes[state.musicDetail.chargeType]}
-                      </span>
+                      {state.musicDetail.paymentType && state.musicDetail.paymentType.map((tag: string) => (
+                        <span
+                          class={[
+                            classes.musicTag,
+                            classes[chargeClass[tag]]
+                          ]}
+                        >
+                          {chargeTypes[tag]}
+                        </span>
+                      ))}
+                      
                       {state.musicDetail.musicSheetName}
                     </h2>
                     <div class={classes.collectWrap}>

+ 5 - 1
src/views/musicLibrary/index.tsx

@@ -20,6 +20,7 @@ import 'swiper/css/scrollbar'
 import { useRoute, useRouter } from 'vue-router'
 import { state as baseState } from '@/state'
 import { SubjectEnum, useSubjectId } from '@/helpers/hooks'
+import { getUserType } from '@/helpers/utils'
 export default defineComponent({
   name: 'musicLibrary',
   components: {
@@ -52,7 +53,10 @@ export default defineComponent({
             albumStatus: 1,
             page: 1,
             subjectIds: subjectId ? subjectId : null,
-            rows: 10
+            rows: 10,
+          },
+          params:{
+            clientType: getUserType()
           }
         })
 

+ 5 - 1
src/views/musicLibrary/modals/searchAlbum.tsx

@@ -16,6 +16,7 @@ import 'swiper/css/scrollbar'
 import { ElTabPane, ElTabs } from 'element-plus'
 import pagination from '@/components/pagination'
 import ColEmpty from '@/components/col-empty'
+import { getUserType } from '@/helpers/utils'
 export default defineComponent({
   name: 'searchdetail',
   components: {
@@ -48,7 +49,10 @@ export default defineComponent({
             albumStatus: 1,
             ...state.search,
             page: state.pageInfo.page,
-            rows: state.pageInfo.limit
+            rows: state.pageInfo.limit,
+          },
+          params:{
+            clientType: getUserType()
           }
         })
 

+ 9 - 2
src/views/musicLibrary/modals/searchMusic.tsx

@@ -16,6 +16,7 @@ import 'swiper/css/pagination'
 import 'swiper/css/scrollbar'
 import ColEmpty from '@/components/col-empty'
 import { ElTabPane, ElTabs } from 'element-plus'
+import { getUserType } from '@/helpers/utils'
 export default defineComponent({
   name: 'searchMusic',
   components: {
@@ -64,11 +65,17 @@ export default defineComponent({
             ...state.search,
             page: state.pageInfo.page,
             rows: state.pageInfo.limit,
-            state: 1
+            state: 1,
+          },
+          params:{
+            clientType: getUserType()
           }
         })
 
-        state.musicList = res.data.rows
+        state.musicList = res.data.rows.map(n => {
+          if (typeof n.paymentType === "string") n.paymentType = n.paymentType.split(',')
+          return n
+        })
         state.pageInfo.total = res.data.total
         if( state.pageInfo.total == 0){
           state.isshowData = true

+ 6 - 1
src/views/student-info/my-score/album-list.tsx

@@ -5,11 +5,13 @@ import styles from './index.module.less'
 import { ElSkeleton, ElSkeletonItem } from 'element-plus'
 import { defineComponent } from 'vue'
 import Item from '../components/item'
+import { getUserType } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'list',
   data() {
     return {
+      clientType: '',
       pageInfo: {
         // 分页规则
         limit: 10, // 限制显示条数
@@ -23,6 +25,8 @@ export default defineComponent({
     }
   },
   mounted() {
+    const clientType = getUserType()
+    if (clientType === 'TEACHER') this.clientType = clientType
     this.getList()
   },
   methods: {
@@ -34,7 +38,8 @@ export default defineComponent({
           {
             params: {
               page: this.pageInfo.page,
-              rows: this.pageInfo.limit
+              rows: this.pageInfo.limit,
+              clientType: this.clientType
             }
           }
         )

+ 14 - 4
src/views/student-info/my-score/list.tsx

@@ -5,6 +5,7 @@ import styles from './index.module.less'
 import { ElSkeleton, ElSkeletonItem } from 'element-plus'
 import { defineComponent } from 'vue'
 import MusicItem from '../../user-info/music-class/item'
+import { getUserType } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'list',
@@ -46,10 +47,14 @@ export default defineComponent({
         const { data } = await request.get(url, {
           params: {
             page: this.pageInfo.page,
-            rows: this.pageInfo.limit
+            rows: this.pageInfo.limit,
+            clientType: getUserType()
           }
         })
-        this.list = data.rows || []
+        this.list = Array.isArray(data.rows) && data.rows.map(n => {
+          if (typeof n.paymentType === 'string') n.paymentType = n.paymentType.split(',')
+          return n
+        }) || []
         this.pageInfo.total = data.total
         if (data.total <= 0) {
           this.dataShow = true
@@ -101,8 +106,8 @@ export default defineComponent({
             {this.list.map((item: any) => (
               <MusicItem
                 onClick={(item: any) => {
+                  // console.log(item)
                   if (this.auditStatus === 'UNPASS') {
-                    console.log(item)
                     this.$router.push({
                       path: '/userInfo/musicOperation',
                       query: {
@@ -112,6 +117,10 @@ export default defineComponent({
                     })
                   } else {
                     // 跳转对应详情 个人中心不跳转到详情
+                    this.$router.push({
+                      path: '/muiscDetial',
+                      query: { id: item.id }
+                    })
                   }
                 }}
                 item={{
@@ -122,7 +131,8 @@ export default defineComponent({
                   titleImg: item.titleImg,
                   subjectNames: item.subjectNames,
                   composer: item.composer,
-                  chargeType: item.chargeType
+                  chargeType: item.chargeType,
+                  paymentType: item.paymentType || []
                 }}
                 class={[
                   styles.musicListItem,

+ 15 - 12
src/views/user-info/music-class/item.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, reactive, watch } from 'vue'
+import { defineComponent, PropType, reactive, watch } from 'vue'
 import icon from './images/icon.png'
 import classes from './index.module.less'
 import detaile from './images/detaile.png'
@@ -18,6 +18,7 @@ type Props = {
   titleImg: string
   chargeType: string
   auditStatus?: string
+  paymentType: []
 }
 const chargeTypes = {
   CHARGE: '点播',
@@ -29,7 +30,7 @@ export default defineComponent({
   name: 'music-item',
   props: {
     item: {
-      type: Object as () => Props,
+      type: Object as () => Props ,
       default: () => ({})
     },
     onClick: {
@@ -71,16 +72,18 @@ export default defineComponent({
             <div class={classes.textWrap}>
               <p>
                 {state.item.musicSheetName}
-                <div
-                  class={[
-                    classes.touchButton,
-                    classes[state.item.chargeType?.toLocaleLowerCase()]
-                  ]}
-                >
-                  {chargeTypes[state.item.chargeType]
-                    ? chargeTypes[state.item.chargeType]
-                    : '点播'}
-                </div>
+                {state.item.paymentType && state.item.paymentType.map((tag: string) => (
+                  <div
+                    class={[
+                      classes.touchButton,
+                      classes[tag?.toLocaleLowerCase()]
+                    ]}
+                  >
+                    {chargeTypes[tag]
+                      ? chargeTypes[tag]
+                      : '点播'}
+                  </div>
+                ))}
               </p>
               <div class={classes.authorInfo}>
                 <span>作曲: {state.item.composer}</span>

+ 6 - 2
src/views/user-info/music-class/list.tsx

@@ -57,7 +57,10 @@ export default defineComponent({
             }
           }
         )
-        this.list = data.list.rows || []
+        this.list = Array.isArray(data.list.rows) && data.list.rows.map(n => {
+          if (typeof n.paymentType === 'string') n.paymentType = n.paymentType.split(',')
+          return n
+        }) || []
         this.pageInfo.total = data.list.total
         if (data.list.total <= 0) {
           this.dataShow = true
@@ -160,7 +163,8 @@ export default defineComponent({
                       subjectNames: item.subjectNames,
                       titleImg: item.titleImg,
                       composer: item.composer,
-                      chargeType: item.chargeType
+                      chargeType: item.chargeType,
+                      paymentType: item.paymentType || []
                     }}
                     class={[
                       styles.musicListItem,

+ 3 - 1
src/views/user-info/music-operation/index.tsx

@@ -63,6 +63,7 @@ export default defineComponent({
         canEvaluate: 1,
         showFingering: 1,
         chargeType: 0,
+        paymentType: '',
         musicPrice: '',
         backgroundMp3s: [
           {
@@ -105,7 +106,7 @@ export default defineComponent({
         const res = await request.get(
           '/api-website/open/music/sheet/detail/' + id
         )
-        this.form.chargeType = res.data.chargeType === 'FREE' ? 0 : 2
+        this.form.chargeType = res.data.paymentType === 'FREE' ? 0 : 2
         this.form.showFingering = res.data.showFingering
         this.form.notation = res.data.notation
         this.form.canEvaluate = res.data.canEvaluate
@@ -186,6 +187,7 @@ export default defineComponent({
         xmlFileUrl: form.xmlFileUrl,
         canEvaluate: Number(form.canEvaluate),
         chargeType: form.chargeType === 0 ? 'FREE' : 'CHARGE',
+        paymentType: form.paymentType ? form.paymentType : form.chargeType === 0 ? 'FREE' : 'CHARGE',
         composer: form.composer,
         musicPrice: form.chargeType === 0 ? 0 : form.musicPrice,
         background: form.backgroundMp3s.map(item => ({