|
@@ -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(() => {
|