瀏覽代碼

Merge branch 'paino_change' into dev

lex 2 年之前
父節點
當前提交
99000970c6

+ 1 - 1
src/views/music/album-detail/index.module.less

@@ -184,7 +184,7 @@
   position: relative;
   padding: 0 16px;
   // margin-top: -16px;
-  z-index: 10;
+  z-index: 12;
   .alumnList {
     padding: 0 12px;
     border-radius: 18px;

+ 25 - 5
src/views/music/album-detail/index.tsx

@@ -2,6 +2,7 @@ import { defineComponent, nextTick, onMounted, reactive, ref } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import request from '@/helpers/request'
 import ColHeader from '@/components/col-header'
+import { postMessage } from '@/helpers/native-message'
 import { Button, Icon, Image, List, NavBar, Sticky } from 'vant'
 // import classNames from 'classnames'
 // import Footer from '../album/footer'
@@ -49,6 +50,7 @@ export default defineComponent({
     const albumFavoriteCount = ref(0)
     const headers = ref(null)
     const background = ref<string>('rgba(55, 205, 177, 0)')
+    const color = ref<string>('#fff')
     const heightInfo = ref<any>('auto')
 
     const route = useRoute()
@@ -85,16 +87,34 @@ export default defineComponent({
       FetchList()
       useEventListener(document, 'scroll', evt => {
         const { y } = useWindowScroll()
-        background.value = `rgba(55, 205, 177, ${y.value / 100})`
+        if (y.value > 20) {
+          background.value = `rgba(255, 255, 255)`
+          color.value = 'black'
+          postMessage({
+            api: 'backIconChange',
+            content: { iconStyle: 'black' }
+          })
+        } else {
+          background.value = 'transparent'
+          color.value = '#fff'
+          postMessage({
+            api: 'backIconChange',
+            content: { iconStyle: 'white' }
+          })
+        }
       })
     })
 
     const toggleFavorite = async (id: number) => {
+      // 如果是老师则不能收藏
+      if (state.platformType === 'TEACHER') {
+        return
+      }
       favoriteLoading.value = true
       try {
-        await request.post('/music/album/favorite/' + id, {
-          prefix:
-            state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student'
+        await request.post('/api-student/music/album/favorite/' + id, {
+          // prefix:
+          //   state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student'
         })
         favorited.value = favorited.value === 1 ? 0 : 1
         albumFavoriteCount.value += favorited.value ? 1 : -1
@@ -109,7 +129,7 @@ export default defineComponent({
             <ColHeader
               background={background.value}
               border={false}
-              color="#fff"
+              color={color.value}
               backIconColor="white"
               onHeaderBack={() => {
                 nextTick(() => {

+ 8 - 0
src/views/music/component/song/index.module.less

@@ -92,6 +92,14 @@
     line-height: 17px;
   }
 }
+.moreSection {
+  margin-left: 6px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 28px;
+  height: 28px;
+}
 
 .collection {
   width: 13px;

+ 12 - 11
src/views/music/component/song/index.tsx

@@ -125,16 +125,17 @@ export default defineComponent({
             <div class={styles.play}>
               <Icon name={IconPlay} size={28} />
 
-              <Icon
-                name={IconMore}
-                size={18}
-                style={{ marginLeft: '12px  ' }}
-                onClick={(e: MouseEvent) => {
-                  e.stopPropagation()
-                  isMore.value = true
-                  moreData.value = n
-                }}
-              />
+              <span class={styles.moreSection}>
+                <Icon
+                  name={IconMore}
+                  size={18}
+                  onClick={(e: MouseEvent) => {
+                    e.stopPropagation()
+                    isMore.value = true
+                    moreData.value = n
+                  }}
+                />
+              </span>
             </div>
           </div>
         ))}
@@ -193,7 +194,7 @@ export default defineComponent({
                 }}
               />
             )}
-            {state.platformType !== 'TEACHER' && (
+            {state.platformType === 'TEACHER' && (
               <Cell
                 border={false}
                 size="large"