|
@@ -0,0 +1,434 @@
|
|
|
+import ColSticky from '@/components/col-sticky'
|
|
|
+import request from '@/helpers/request'
|
|
|
+import { browser, removeAuth } from '@/helpers/utils'
|
|
|
+import { postMessage } from '@/helpers/native-message'
|
|
|
+import { Button, Cell, CellGroup, Image, Notify, Popup } from 'vant'
|
|
|
+import { defineComponent } from 'vue'
|
|
|
+import styles from './index.module.less'
|
|
|
+import logo from '@/common/images/logo.png'
|
|
|
+import { shareCall } from '@/teacher/share-page/share'
|
|
|
+import { getRandomKey } from '@/views/music/music'
|
|
|
+import qs from 'query-string'
|
|
|
+import dayjs from 'dayjs'
|
|
|
+import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
|
+
|
|
|
+export const getAssetsHomeFile = (fileName: string) => {
|
|
|
+ const path = `./images/${fileName}`
|
|
|
+ const modules = import.meta.globEager('./images/*')
|
|
|
+ return modules[path].default
|
|
|
+}
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ name: 'track-review-activity',
|
|
|
+ data() {
|
|
|
+ const query = this.$route.query
|
|
|
+ return {
|
|
|
+ id: query.id,
|
|
|
+ activeInfo: {} as any,
|
|
|
+ popupStatus: false,
|
|
|
+ wxStatus: false,
|
|
|
+ behaviorId: getRandomKey(),
|
|
|
+ selectMusic: {} as any
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ activityMusic() {
|
|
|
+ const { activeInfo } = this
|
|
|
+ return activeInfo.activityMusicVoList || []
|
|
|
+ },
|
|
|
+ // 用户是否有中选的曲子
|
|
|
+ userSelectMusic() {
|
|
|
+ let status = false
|
|
|
+ this.activityMusic.forEach((item: any) => {
|
|
|
+ if (item.join === 1) {
|
|
|
+ status = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return status
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ this.getMusicInfo()
|
|
|
+ if (!browser().isApp) {
|
|
|
+ this.popupStatus = true
|
|
|
+ removeAuth()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getMusicInfo() {
|
|
|
+ try {
|
|
|
+ const res = await request.post(
|
|
|
+ '/api-student/open/activity/info/' + this.id
|
|
|
+ )
|
|
|
+ this.activeInfo = res.data
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async onJoinActve() {
|
|
|
+ const activeInfo = this.activeInfo
|
|
|
+ try {
|
|
|
+ // 判断是否是收费活动
|
|
|
+ if (activeInfo.registrationMethod === 'CHARGE') {
|
|
|
+ orderStatus.orderObject.orderType = 'ACTI_REGIST'
|
|
|
+ orderStatus.orderObject.orderName = activeInfo.activityName
|
|
|
+ orderStatus.orderObject.orderDesc = activeInfo.activityName
|
|
|
+ orderStatus.orderObject.actualPrice = activeInfo.registrationPrice
|
|
|
+ orderStatus.orderObject.orderNo = ''
|
|
|
+ orderStatus.orderObject.orderList = [
|
|
|
+ {
|
|
|
+ orderType: 'ACTI_REGIST',
|
|
|
+ goodsName: activeInfo.activityName,
|
|
|
+ activityId: activeInfo.id,
|
|
|
+ actualPrice: activeInfo.registrationPrice
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.$router.push({
|
|
|
+ path: '/orderDetail',
|
|
|
+ query: {
|
|
|
+ orderType: 'ACTI_REGIST',
|
|
|
+ activityId: activeInfo.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ await request.post(
|
|
|
+ `/api-student/activity/joinActivity/${activeInfo.id}`
|
|
|
+ )
|
|
|
+
|
|
|
+ // 成功通知
|
|
|
+ Notify({ type: 'success', message: '报名成功' })
|
|
|
+ this.getMusicInfo()
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async onOpenMusic() {
|
|
|
+ try {
|
|
|
+ const selectMusic = this.selectMusic
|
|
|
+ if (selectMusic.join !== 1) {
|
|
|
+ await request.post(
|
|
|
+ `/api-student/activity/evaluation/${selectMusic.evaluationId}`
|
|
|
+ )
|
|
|
+ }
|
|
|
+ const browserInfo = browser()
|
|
|
+ const url = qs.stringifyUrl({
|
|
|
+ url: location.origin + '/colexiu.html',
|
|
|
+ query: {
|
|
|
+ id: this.id,
|
|
|
+ behaviorId: this.behaviorId,
|
|
|
+ client: browserInfo.isTeacher ? 'teacher' : 'student',
|
|
|
+ setting: encodeURIComponent(
|
|
|
+ JSON.stringify({
|
|
|
+ mode: this.activeInfo.activityType,
|
|
|
+ resets: ['SPEED'],
|
|
|
+ difficulty: 'PERFORMER',
|
|
|
+ feeType: 'FREE',
|
|
|
+ submitData: { evaluationId: this.selectMusic.evaluationId }
|
|
|
+ })
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
+ postMessage({
|
|
|
+ api: 'openAccompanyWebView',
|
|
|
+ content: {
|
|
|
+ url,
|
|
|
+ orientation: 0,
|
|
|
+ isHideTitle: true,
|
|
|
+ statusBarTextColor: false,
|
|
|
+ isOpenLight: true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onOpenApp() {
|
|
|
+ //
|
|
|
+ if (!browser().isApp) {
|
|
|
+ if (browser().weixin) {
|
|
|
+ this.wxStatus = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果不在app里面则不需要唤起操作
|
|
|
+ const { origin } = location
|
|
|
+ const str = origin + `/student/#/track-review-activity?id=${this.id}`
|
|
|
+ shareCall(str, {})
|
|
|
+ // 不管有没有唤起,则跳转到下载页面
|
|
|
+ setTimeout(() => {
|
|
|
+ window.location.href = location.origin + '/student/#/download'
|
|
|
+ }, 3000)
|
|
|
+ } else {
|
|
|
+ this.popupStatus = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ class={styles.review}
|
|
|
+ style={{
|
|
|
+ background: `url(${this.activeInfo.subjectUrl}) no-repeat top center ${this.activeInfo.backgroundUrl}`,
|
|
|
+ backgroundSize: 'contain'
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div class={styles.reviewContainer}>
|
|
|
+ <div class={[styles.section, styles.activeTime]}>
|
|
|
+ <div class={styles.activeBg}>
|
|
|
+ <img src={getAssetsHomeFile('icon_time.png')} />
|
|
|
+ <p>
|
|
|
+ <span>活动时间:</span>
|
|
|
+ {dayjs(this.activeInfo.activityStart).format(
|
|
|
+ 'YYYY-MM-DD'
|
|
|
+ )} ~ {dayjs(this.activeInfo.activityEnd).format('YYYY-MM-DD')}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={[styles.section]}>
|
|
|
+ <div class={styles.title}>
|
|
|
+ <img src={getAssetsHomeFile('icon_arrow_left.png')} />
|
|
|
+ <span>活动介绍</span>
|
|
|
+ <img src={getAssetsHomeFile('icon_arrow_right.png')} />
|
|
|
+ </div>
|
|
|
+ <div class={styles.tips}>{this.activeInfo.describe}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={[styles.section]}>
|
|
|
+ <h2 class={styles.title2}>
|
|
|
+ <span>
|
|
|
+ <i class={styles.titlePrefix}></i>
|
|
|
+ 活动奖品
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <img
|
|
|
+ src={getAssetsHomeFile('star_bg.png')}
|
|
|
+ class={styles.iconStar}
|
|
|
+ />
|
|
|
+ </h2>
|
|
|
+ {this.activeInfo.activityRewardList &&
|
|
|
+ this.activeInfo.activityRewardList.map((item: any) => (
|
|
|
+ <div class={styles.prize}>
|
|
|
+ <Image src={item.imgUrl} />
|
|
|
+ <div class={styles.prizeContainer}>
|
|
|
+ <div class={styles.prizeName}>{item.rewardName}</div>
|
|
|
+ <div class={styles.prizeDesc}>{item.rewardDescribe}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={[styles.section]} style={{ backgroundColor: '#fff' }}>
|
|
|
+ <h2 class={styles.title2}>
|
|
|
+ <span>
|
|
|
+ <i class={styles.titlePrefix}></i>
|
|
|
+ 活动曲目
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span class={styles.titleTips}>
|
|
|
+ 共{this.activityMusic.length || 0}
|
|
|
+ 首曲目
|
|
|
+ </span>
|
|
|
+ </h2>
|
|
|
+
|
|
|
+ {this.activityMusic.map((item: any) => (
|
|
|
+ <CellGroup class={styles.musicItem} border={false}>
|
|
|
+ <Cell
|
|
|
+ center
|
|
|
+ titleClass={styles.musicTitle}
|
|
|
+ v-slots={{
|
|
|
+ icon: () => (
|
|
|
+ <Image
|
|
|
+ src={getAssetsHomeFile('icon_music.png')}
|
|
|
+ class={styles.iconMusic}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ title: () => (
|
|
|
+ <span class={styles.musicName}>
|
|
|
+ {item.musicSheetName}
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ value: () => <span>{item.musicSubject}</span>
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <Cell
|
|
|
+ center
|
|
|
+ class={styles.cellLevel}
|
|
|
+ v-slots={{
|
|
|
+ icon: () => (
|
|
|
+ <div class={styles.kingSection}>
|
|
|
+ <Image
|
|
|
+ src={getAssetsHomeFile('icon_king.png')}
|
|
|
+ class={styles.iconKing}
|
|
|
+ />
|
|
|
+ <p class={styles.score}>
|
|
|
+ {item.userId ? item.score : '--'}
|
|
|
+ <span>分</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.users}>
|
|
|
+ <div class={styles.userInfo}>
|
|
|
+ <div class={styles.userImg}>
|
|
|
+ {item.userId ? (
|
|
|
+ <>
|
|
|
+ <Image
|
|
|
+ src={item.userAvatar}
|
|
|
+ class={styles.userLogo}
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ src={getAssetsHomeFile('icon_level.png')}
|
|
|
+ class={styles.iconLevel}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <div class={styles.userLogo}>
|
|
|
+ <img
|
|
|
+ src={getAssetsHomeFile('icon_no_level.png')}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ <div class={styles.userName}>
|
|
|
+ {item.userId ? (
|
|
|
+ <>
|
|
|
+ <p class={styles.name}>{item.username}</p>
|
|
|
+ <p>
|
|
|
+ <span class={styles.subjectName}>
|
|
|
+ {item.userSubject}
|
|
|
+ </span>
|
|
|
+ </p>{' '}
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <span class={styles.noText}>虚位以待</span>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class={styles.userBtn}>
|
|
|
+ <Button
|
|
|
+ round
|
|
|
+ style={{
|
|
|
+ padding: '0 8px',
|
|
|
+ height: '32px'
|
|
|
+ }}
|
|
|
+ color="linear-gradient(180deg, #FFA200 0%, #FF6900 100%)"
|
|
|
+ disabled={
|
|
|
+ this.activeInfo.join === 0 ||
|
|
|
+ (this.userSelectMusic && item.join !== 1)
|
|
|
+ }
|
|
|
+ onClick={() => {
|
|
|
+ this.selectMusic = item
|
|
|
+ this.popupStatus = true
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 立刻挑战
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ ></Cell>
|
|
|
+ </CellGroup>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={[styles.section]}>
|
|
|
+ <div class={styles.title}>
|
|
|
+ <img src={getAssetsHomeFile('icon_arrow_left.png')} />
|
|
|
+ <span>活动规则</span>
|
|
|
+ <img src={getAssetsHomeFile('icon_arrow_right.png')} />
|
|
|
+ </div>
|
|
|
+ <div class={styles.tips}>{this.activeInfo.ruleDescribe}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {this.activeInfo.join !== 1 && (
|
|
|
+ <ColSticky position="bottom">
|
|
|
+ <div class={styles.btnGroup}>
|
|
|
+ <Button
|
|
|
+ round
|
|
|
+ class={styles.submit}
|
|
|
+ block
|
|
|
+ onClick={this.onJoinActve}
|
|
|
+ >
|
|
|
+ 参与报名
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </ColSticky>
|
|
|
+ )}
|
|
|
+
|
|
|
+ <Popup
|
|
|
+ v-model:show={this.popupStatus}
|
|
|
+ round
|
|
|
+ style={{ width: '90%' }}
|
|
|
+ closeOnClickOverlay={false}
|
|
|
+ >
|
|
|
+ <div class={styles.popupContainer}>
|
|
|
+ <div class={[styles.popupTitle, 'van-hairline--bottom']}>
|
|
|
+ <i class={styles.line}></i>提示
|
|
|
+ <img
|
|
|
+ src={getAssetsHomeFile('icon_close.png')}
|
|
|
+ class={styles.popupClose}
|
|
|
+ onClick={this.onOpenApp}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={styles.popupContent}>
|
|
|
+ {browser().isApp ? (
|
|
|
+ <>
|
|
|
+ <p>
|
|
|
+ 确定要参加<span>我和我的祖国</span>评测<span>难度高</span>
|
|
|
+ 的比拼吗?
|
|
|
+ </p>
|
|
|
+ <p class={styles.popupTips}>
|
|
|
+ 每位用户仅可选择一首曲目的一个难度哦!
|
|
|
+ </p>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <div class={styles.appOut}>
|
|
|
+ <img src={logo} />
|
|
|
+ <p>请在酷乐秀APP内打开活动链接!</p>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {browser().isApp ? (
|
|
|
+ <div class={['btnGroup, btnMore', styles.popupBtn]}>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ round
|
|
|
+ plain
|
|
|
+ onClick={() => (this.popupStatus = false)}
|
|
|
+ >
|
|
|
+ 再想想
|
|
|
+ </Button>
|
|
|
+ <Button type="primary" round onClick={this.onOpenMusic}>
|
|
|
+ 就是它了
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <div class={['btnGroup, btnMore', styles.popupBtn]}>
|
|
|
+ <Button type="primary" round onClick={this.onOpenApp}>
|
|
|
+ 确定
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ </Popup>
|
|
|
+
|
|
|
+ {this.wxStatus && (
|
|
|
+ <div
|
|
|
+ class={styles.wxpopup}
|
|
|
+ onClick={() => {
|
|
|
+ this.wxStatus = false
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <img src={getAssetsHomeFile('wx_bg.png')} alt="" />
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+})
|