| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import { defineComponent, toRefs, reactive, onMounted, ref, watch } from 'vue'
- import classes from './index.module.less'
- import hold from './images/hold.png'
- import start from './images/start.png'
- import lineStart from './images/lineStart.png'
- import pan from './images/pan.png'
- import player from './images/player.png'
- import { useRouter } from 'vue-router'
- export default defineComponent({
- name: 'albumItem',
- props: {
- detail: {
- type: Object,
- default: {
- albumCoverUrl: '',
- albumDesc: '',
- albumFavoriteCount: 0,
- albumName: '',
- albumStatus: 0,
- albumTag: '',
- auditVersion: 0,
- createBy: 0,
- createTime: '',
- delFlag: null,
- hotFlag: null,
- id: 0,
- musicSheetCount: 0,
- musicTagNames: '',
- sortNumber: 0,
- topFlag: null,
- updateBy: 34,
- updateTime: '',
- favorite: 0
- } as any
- }
- },
- setup(props) {
- const state = reactive({
- detail: props.detail
- })
- watch(
- () => props.detail,
- detail => {
- state.detail = detail
- }
- )
- const router = useRouter()
- const gotoAlbum = () => {
- if (state.detail && state.detail.id) {
- router.push({ path: '/albumDetail', query: { id: state.detail.id } })
- }
- }
- return () => (
- <>
- <div
- class={classes.itemWrap}
- onClick={() => {
- gotoAlbum()
- }}
- >
- {state.detail?.paymentType === 'CHARGE' && (
- <span class={classes.albumType}>付费</span>
- )}
- <img
- class={classes.startImage}
- src={state.detail?.favorite ? lineStart : start}
- alt=""
- />
- <div class={classes.hold}>
- <div class={classes.masker}>
- <img src={player} alt="" />
- </div>
- <img
- src={
- state.detail?.albumCoverUrl ? state.detail?.albumCoverUrl : hold
- }
- alt=""
- />
- </div>
- <h2>{state.detail?.albumName}</h2>
- <div class={classes.itemBottom}>
- <div class={classes.itemBottomL}>
- {/* <img src={pan} alt="" /> */}
- <span>{state.detail?.musicSheetCount}首</span>
- </div>
- <div class={classes.itemBottomR}>
- {/* <img src={start} alt="" /> */}
- <span>{state.detail?.albumFavoriteCount}收藏</span>
- </div>
- </div>
- </div>
- </>
- )
- }
- })
|