-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renderer: basic 'Private Cloud' functions
- Loading branch information
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<template> | ||
<ListDetailLayout class="ncm-page" | ||
showBack | ||
:detailLoading="detailLoading"> | ||
<template #list> | ||
<div v-if="user.loginValid" | ||
class="disk__aside"> | ||
<p>歌曲永久保存,随时随地多端畅听</p> | ||
<p>{{ humanSize(size) }} / {{ humanSize(maxSize) }}</p> | ||
<mu-linear-progress mode="determinate" | ||
:value="size / maxSize" | ||
color="secondary"></mu-linear-progress> | ||
</div> | ||
</template> | ||
<template v-if="user.loginValid"> | ||
<PlayTracks :tracks="tracks" | ||
:source="TrackSource"></PlayTracks> | ||
<VirtualTrackList :tracks="tracks" | ||
:source="TrackSource"></VirtualTrackList> | ||
</template> | ||
<CenteredTip v-else | ||
icon="cloud_off" | ||
tip="登录后查看音乐云盘"></CenteredTip> | ||
</ListDetailLayout> | ||
</template> | ||
|
||
<script> | ||
import { mapState } from 'vuex'; | ||
import Api from '@/api/ipc'; | ||
import { Track } from '@/util/models'; | ||
import { humanSize } from '@/util/formatter'; | ||
import ListDetailLayout from '@/components/ListDetailLayout.vue'; | ||
import PlayTracks from '@/components/PlayTracks.vue'; | ||
import VirtualTrackList from '@/components/TrackList/VirtualTrackList.vue'; | ||
import CenteredTip from '@/components/CenteredTip.vue'; | ||
const TrackSource = { | ||
name: 'disk' | ||
}; | ||
export default { | ||
data() { | ||
return { | ||
size: 0, | ||
maxSize: 0, | ||
count: 0, | ||
tracks: [], | ||
detailLoading: true | ||
}; | ||
}, | ||
computed: { | ||
...mapState(['user']) | ||
}, | ||
methods: { | ||
humanSize, | ||
async loadTracks() { | ||
const res = await Api.getPrivateCloudList(500, 0); | ||
if (res.code === 200) { | ||
this.tracks = res.data.map(d => new Track(d.simpleSong)); | ||
this.size = res.size; | ||
this.maxSize = res.maxSize; | ||
this.count = res.count; | ||
} | ||
this.detailLoading = false; | ||
} | ||
}, | ||
created() { | ||
this.TrackSource = TrackSource; | ||
}, | ||
mounted() { | ||
this.loadTracks(); | ||
}, | ||
components: { | ||
PlayTracks, | ||
ListDetailLayout, | ||
VirtualTrackList, | ||
CenteredTip | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="less"> | ||
.disk__aside { | ||
padding: 10px 16px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters