浏览代码

feat: 评测、跟练svip逻辑修改

TIANYONG 3 月之前
父节点
当前提交
7c788c6c97
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 6 3
      src/page-instrument/header-top/index.tsx
  2. 2 2
      src/page-instrument/header-top/modeView.tsx

+ 6 - 3
src/page-instrument/header-top/index.tsx

@@ -39,7 +39,7 @@ const ModeView = defineAsyncComponent(() =>
 )
 
 /** 校验是否能切换模式,会员的曲子,酷乐秀跟练模式、评测模式需要svip */
-export const checkMusicBuy = (item: any) => {
+export const checkMusicBuy = (item: any, type?: string) => {
   let checked = true;
   // 学生端或者老师端需要校验点播和会员曲目
   if (state.systemType === "student" || state.systemType === "teacher") {
@@ -51,8 +51,11 @@ export const checkMusicBuy = (item: any) => {
       permissionPopup.show = true
       checked = false
     }
-    // 如果是vip的曲子,当前用户不是会员时,需要弹窗提醒
-    if (storeData.user.vipType === "NOT_VIP" && item.paymentType !== "FREE") {
+    /**
+     * 如果是vip的曲子,当前用户不是会员时,需要弹窗提醒
+     * 如果是vip的曲子,当前用户不是svip会员,点击跟练或评测时,需要弹窗提醒(会员曲子,跟练和评测需要开通svip会员才能使用)
+     */
+    if ( (state.vipType === "NOT_VIP" && item.paymentType !== "FREE") || (!state.vipType.includes("SVIP") && (type === "follow" || type === "evaluating")) ) {
       permissionPopup.active = item.paymentType.includes('CHARGE') ? "memberAndDemand" : "member"
       permissionPopup.musicId = item.id
       permissionPopup.musicPrice = item.musicPrice

+ 2 - 2
src/page-instrument/header-top/modeView.tsx

@@ -118,7 +118,7 @@ export default defineComponent({
           {!state.isPercussion && 
             <div class={styles.modeItem}>
               <Vue3Lottie ref={modeImgDom2} class={styles.modeImg} animationData={glMode} autoPlay={false} loop={true} onClick={() => { 
-                if (checkMusicBuy(state.musicBuyInfo)) {
+                if (checkMusicBuy(state.musicBuyInfo, "follow")) {
                   headTopData.handleChangeModeType("follow")
                 }
                 }}></Vue3Lottie>
@@ -130,7 +130,7 @@ export default defineComponent({
           {state.enableEvaluation && 
             <div class={styles.modeItem}>
               <Vue3Lottie ref={modeImgDom3} class={styles.modeImg} animationData={pcMode} autoPlay={false} loop={true} onClick={() => {
-                if (checkMusicBuy(state.musicBuyInfo)) {
+                if (checkMusicBuy(state.musicBuyInfo, "evaluating")) {
                   // 点击评测模式进入评测模块的需要检测耳机状态,通过返回按钮进入评测模块的,不检测耳机状态
                   evaluatingData.needCheckErjiStatus = true;
                   headTopData.handleChangeModeType("evaluating")