|
@@ -46,9 +46,17 @@ export default defineComponent({
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ rankingMethod() {
|
|
|
+ const activeInfo: any = this.activeInfo
|
|
|
+ return activeInfo.rankingMethod || ''
|
|
|
+ },
|
|
|
activityMusic() {
|
|
|
const activeInfo: any = this.activeInfo
|
|
|
- return activeInfo.activityMusicVoList || []
|
|
|
+ const list =
|
|
|
+ activeInfo.rankingMethod === 'TOTAL_SCORE'
|
|
|
+ ? activeInfo.subjectInfos
|
|
|
+ : activeInfo.activityMusicVoList
|
|
|
+ return list || []
|
|
|
},
|
|
|
// 用户是否有中选的曲子
|
|
|
userSelectMusic() {
|
|
@@ -63,17 +71,20 @@ export default defineComponent({
|
|
|
// this.activeInfo.activityRewardList
|
|
|
rewardList() {
|
|
|
const activeInfo: any = this.activeInfo
|
|
|
- // activityRewardList = activityRewardList?.activityRewardList
|
|
|
- // console.log(activityRewardList)
|
|
|
let list = activeInfo.activityRewardList || []
|
|
|
if (list && list.length > 0) {
|
|
|
- const last = list.sort((a: any, b: any) => {
|
|
|
- return Number(a.group) < Number(b.group) ? -1 : 1
|
|
|
- })
|
|
|
- list = this.groupBy(last, (item: any) => {
|
|
|
- return [item.group]
|
|
|
- })
|
|
|
+ if (activeInfo.rankingMethod === 'TOTAL_SCORE') {
|
|
|
+ list = [list]
|
|
|
+ } else {
|
|
|
+ const last = list.sort((a: any, b: any) => {
|
|
|
+ return Number(a.group) < Number(b.group) ? -1 : 1
|
|
|
+ })
|
|
|
+ list = this.groupBy(last, (item: any) => {
|
|
|
+ return [item.group]
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
+ console.log(list)
|
|
|
return list || []
|
|
|
}
|
|
|
},
|
|
@@ -89,6 +100,7 @@ export default defineComponent({
|
|
|
this.onBackDialog('请使用酷乐秀学生端扫码打开')
|
|
|
return
|
|
|
} else {
|
|
|
+ console.log(this.hiddenProperty, 'hidden property')
|
|
|
this.hiddenProperty =
|
|
|
'hidden' in document
|
|
|
? 'hidden'
|
|
@@ -108,16 +120,21 @@ export default defineComponent({
|
|
|
this.checkActivityTime()
|
|
|
},
|
|
|
unmounted() {
|
|
|
- const visibilityChangeEvent = this.hiddenProperty.replace(
|
|
|
- /hidden/i,
|
|
|
- 'visibilitychange'
|
|
|
- )
|
|
|
- document.removeEventListener(visibilityChangeEvent, this.onVisibilityChange)
|
|
|
+ if (this.hiddenProperty) {
|
|
|
+ const visibilityChangeEvent = this.hiddenProperty.replace(
|
|
|
+ /hidden/i,
|
|
|
+ 'visibilitychange'
|
|
|
+ )
|
|
|
+ document.removeEventListener(
|
|
|
+ visibilityChangeEvent,
|
|
|
+ this.onVisibilityChange
|
|
|
+ )
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
groupBy(array: any, f: any) {
|
|
|
const groups = {}
|
|
|
- array.forEach(function (o) {
|
|
|
+ array.forEach(o => {
|
|
|
//注意这里必须是forEach 大写
|
|
|
const group = JSON.stringify(f(o))
|
|
|
groups[group] = groups[group] || []
|
|
@@ -246,13 +263,35 @@ export default defineComponent({
|
|
|
async onOpenMusic() {
|
|
|
try {
|
|
|
const selectMusic = this.selectMusic
|
|
|
+ let evaluationId = ''
|
|
|
+ // 判断是否是总分评测
|
|
|
+ if (this.rankingMethod === 'TOTAL_SCORE') {
|
|
|
+ // 直接取第一首曲目的评测编号
|
|
|
+ const activityMusicVoList = this.activeInfo.activityMusicVoList || []
|
|
|
+ activityMusicVoList.forEach(item => {
|
|
|
+ console.log(item, selectMusic)
|
|
|
+ if (item.subjectId == selectMusic.subjectId && !evaluationId) {
|
|
|
+ evaluationId = item.evaluationId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ evaluationId = selectMusic.evaluationId
|
|
|
+ }
|
|
|
if (selectMusic.join !== 1) {
|
|
|
- await request.post(
|
|
|
- `/api-student/activity/evaluation/${selectMusic.evaluationId}`
|
|
|
- )
|
|
|
+ await request.post(`/api-student/activity/evaluation/${evaluationId}`)
|
|
|
this.selectMusic.join = 1
|
|
|
}
|
|
|
this.popupStatus = false
|
|
|
+ if (this.rankingMethod === 'TOTAL_SCORE') {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/track-song',
|
|
|
+ query: {
|
|
|
+ subjectId: selectMusic.subjectId,
|
|
|
+ id: this.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
const browserInfo = browser()
|
|
|
const url = qs.stringifyUrl({
|
|
|
url: location.origin + '/accompany',
|
|
@@ -342,11 +381,6 @@ export default defineComponent({
|
|
|
<i class={styles.titlePrefix}></i>
|
|
|
活动奖品
|
|
|
</span>
|
|
|
-
|
|
|
- {/* <img
|
|
|
- src={getAssetsHomeFile('star_bg.png')}
|
|
|
- class={styles.iconStar}
|
|
|
- /> */}
|
|
|
<span
|
|
|
class={styles.titleTips}
|
|
|
onClick={() =>
|
|
@@ -366,25 +400,34 @@ export default defineComponent({
|
|
|
{this.rewardList.map((item: any, index: number) => (
|
|
|
<>
|
|
|
<div class={styles.prizeTitle}>
|
|
|
- {index === 0 && (
|
|
|
- <Image
|
|
|
- class={styles.prizeLevel}
|
|
|
- src={getAssetsHomeFile('icon_level.png')}
|
|
|
- />
|
|
|
- )}
|
|
|
- {index === 1 && (
|
|
|
- <Image
|
|
|
- class={styles.prizeLevel}
|
|
|
- src={getAssetsHomeFile('icon_level2.png')}
|
|
|
- />
|
|
|
- )}
|
|
|
- {index === 2 && (
|
|
|
- <Image
|
|
|
- class={styles.prizeLevel}
|
|
|
- src={getAssetsHomeFile('icon_level3.png')}
|
|
|
- />
|
|
|
+ {this.rankingMethod === 'TOTAL_SCORE' ? (
|
|
|
+ <div class={styles.prizeTitle_score}>
|
|
|
+ 总评测分数达到 {this.activeInfo.rankingScore || 0}
|
|
|
+ 分即可获奖
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ {index === 0 && (
|
|
|
+ <Image
|
|
|
+ class={styles.prizeLevel}
|
|
|
+ src={getAssetsHomeFile('icon_level.png')}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {index === 1 && (
|
|
|
+ <Image
|
|
|
+ class={styles.prizeLevel}
|
|
|
+ src={getAssetsHomeFile('icon_level2.png')}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {index === 2 && (
|
|
|
+ <Image
|
|
|
+ class={styles.prizeLevel}
|
|
|
+ src={getAssetsHomeFile('icon_level3.png')}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ 第{++index}名奖品
|
|
|
+ </>
|
|
|
)}
|
|
|
- 第{++index}名奖品
|
|
|
</div>
|
|
|
<div class={styles.prizeSection}>
|
|
|
{item.map((child: any) => (
|
|
@@ -409,9 +452,25 @@ export default defineComponent({
|
|
|
<i class={styles.titlePrefix}></i>
|
|
|
活动曲目
|
|
|
</span>
|
|
|
- <span class={styles.titleTips}>
|
|
|
- 共{this.activityMusic.length || 0}首曲目
|
|
|
- </span>
|
|
|
+ {this.rankingMethod === 'TOTAL_SCORE' ? (
|
|
|
+ <span
|
|
|
+ class={styles.titleTips}
|
|
|
+ onClick={() => {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/track-subject-song',
|
|
|
+ query: {
|
|
|
+ id: this.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 查看曲目
|
|
|
+ </span>
|
|
|
+ ) : (
|
|
|
+ <span class={styles.titleTips}>
|
|
|
+ 共{this.activityMusic.length || 0}首曲目
|
|
|
+ </span>
|
|
|
+ )}
|
|
|
</h2>
|
|
|
|
|
|
{this.activityMusic.map((item: any) => (
|
|
@@ -419,19 +478,42 @@ export default defineComponent({
|
|
|
<Cell
|
|
|
center
|
|
|
titleClass={styles.musicTitle}
|
|
|
+ isLink
|
|
|
v-slots={{
|
|
|
icon: () => (
|
|
|
<Image
|
|
|
- src={getAssetsHomeFile('icon_music.png')}
|
|
|
+ src={getAssetsHomeFile(
|
|
|
+ this.rankingMethod === 'TOTAL_SCORE'
|
|
|
+ ? 'icon_music.png'
|
|
|
+ : 'icon_subject.png'
|
|
|
+ )}
|
|
|
class={styles.iconMusic}
|
|
|
/>
|
|
|
),
|
|
|
title: () => (
|
|
|
<span class={styles.musicName}>
|
|
|
- {item.musicSheetName}
|
|
|
+ {this.rankingMethod === 'TOTAL_SCORE'
|
|
|
+ ? item.subjectName
|
|
|
+ : item.musicSheetName}
|
|
|
</span>
|
|
|
),
|
|
|
- value: () => <span>{item.musicSubject}</span>
|
|
|
+ value: () => (
|
|
|
+ <span
|
|
|
+ onClick={() => {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/track-subject-song',
|
|
|
+ query: {
|
|
|
+ id: this.id,
|
|
|
+ subjectId: item.subjectId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {this.rankingMethod === 'TOTAL_SCORE'
|
|
|
+ ? `共${item.musicNums}首活动曲目`
|
|
|
+ : item.musicSubject}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
}}
|
|
|
/>
|
|
|
<Cell
|
|
@@ -500,7 +582,7 @@ export default defineComponent({
|
|
|
color="linear-gradient(180deg, #FFA200 0%, #FF6900 100%)"
|
|
|
disabled={
|
|
|
this.activeInfo.join === 0 ||
|
|
|
- (this.userSelectMusic && item.join !== 1)
|
|
|
+ (this.userSelectMusic && item.join != 1)
|
|
|
}
|
|
|
onClick={() => {
|
|
|
if (!this.checkActivityTime()) {
|
|
@@ -508,7 +590,18 @@ export default defineComponent({
|
|
|
}
|
|
|
this.selectMusic = item
|
|
|
if (item.join === 1) {
|
|
|
- this.onOpenMusic()
|
|
|
+ if (this.rankingMethod === 'TOTAL_SCORE') {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/track-song',
|
|
|
+ query: {
|
|
|
+ id: this.id,
|
|
|
+ subjectId: item.subjectId,
|
|
|
+ subjectName: item.subjectName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.onOpenMusic()
|
|
|
+ }
|
|
|
} else {
|
|
|
this.popupStatus = true
|
|
|
}
|
|
@@ -569,16 +662,31 @@ export default defineComponent({
|
|
|
<div class={styles.popupContent}>
|
|
|
{browser().isApp ? (
|
|
|
<>
|
|
|
- <p>
|
|
|
- 确定要参加<span>{this.selectMusic.musicSheetName}</span>评测
|
|
|
- <span>
|
|
|
- {difficulty[this.activeInfo.evaluationDifficulty]}
|
|
|
- </span>
|
|
|
- 的比拼吗?
|
|
|
- </p>
|
|
|
- <p class={styles.popupTips}>
|
|
|
- 每位用户仅可选择一首曲目的一个难度哦!
|
|
|
- </p>
|
|
|
+ {this.rankingMethod === 'TOTAL_SCORE' ? (
|
|
|
+ <>
|
|
|
+ <p>
|
|
|
+ 确定要参加 <span>{this.selectMusic.subjectName}</span>
|
|
|
+ (声部)的比拼吗?
|
|
|
+ </p>
|
|
|
+ <p class={styles.popupTips}>
|
|
|
+ 每位用户仅可选择一个声部参与挑战哦!
|
|
|
+ </p>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ <p>
|
|
|
+ 确定要参加<span>{this.selectMusic.musicSheetName}</span>
|
|
|
+ 评测
|
|
|
+ <span>
|
|
|
+ {difficulty[this.activeInfo.evaluationDifficulty]}
|
|
|
+ </span>
|
|
|
+ 的比拼吗?
|
|
|
+ </p>
|
|
|
+ <p class={styles.popupTips}>
|
|
|
+ 每位用户仅可选择一首曲目的一个难度哦!
|
|
|
+ </p>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
</>
|
|
|
) : (
|
|
|
<div class={styles.appOut}>
|