123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { defineComponent, reactive, watch } from 'vue'
- import icon from '../videoDetailItem/images/icon.png'
- import classes from './index.module.less'
- import detaile from './images/detaile.png'
- import music from './images/music.png'
- import arrow from './images/arrow.png'
- import { goodsType } from '@/constant'
- import { useRouter } from 'vue-router'
- type Props = {
- id?: Number
- addName: String
- addUserAvatar: String
- musicSheetName: String
- subjectNames: String
- composer: String
- chargeType: String
- }
- const chargeTypes = {
- CHARGE: '点播',
- FREE: '免费',
- VIP: 'VIP'
- }
- export default defineComponent({
- name: 'musicLIstItem',
- props: {
- item: {
- type: Object as () => Props,
- default: () => ({})
- },
- onClick: {
- type: Function,
- default: (item: any) => {}
- }
- },
- setup(props: any) {
- const state = reactive({
- item:props.item
- })
- const router = useRouter()
- watch(
- () => props.item,
- item => {
- state.item = item
- }
- )
- const gotoMusicDetail = () => {
- router.push({path:'/muiscDetial',query:{id:state.item.id}})
- }
- return () => (
- <div
- onClick={() => {
- props.onClick(state.item)
- }}
- >
- <div class={classes.itemWrap} onClick={() => gotoMusicDetail()}>
- <div class={classes.left}>
- <div class={classes.imgWrap}>
- <img src={music} alt="" />
- </div>
- <div class={classes.textWrap}>
- <p>
- {state.item.musicSheetName}
- <span>作曲: {state.item.composer}</span>
- </p>
- <div class={classes.authorInfo}>
- <img
- class={classes.icon}
- src={state.item.addUserAvatar || icon}
- alt=""
- />
- <span class={classes.authorName}>{state.item.addName}</span>
- <div class={classes.tagList}>
- <div class={classes.tag}>{state.item.subjectNames}</div>
- {/* <div class={classes.tag}>圆号</div> */}
- </div>
- </div>
- </div>
- </div>
- <div class={classes.right}>
- <div
- class={[
- classes.touchButton,
- classes[state.item.chargeType?.toLocaleLowerCase()]
- ]}
- >
- {chargeTypes[state.item.chargeType]
- ? chargeTypes[state.item.chargeType]
- : '点播'}
- </div>
- <img class={classes.arrow} src={arrow} alt="" />
- </div>
- </div>
- </div>
- )
- }
- })
|