lex-xin 6 months ago
parent
commit
8dc70fc261
2 changed files with 15 additions and 13 deletions
  1. 10 8
      src/views/coursewarePlay/index.tsx
  2. 5 5
      src/views/hook/useFee.ts

+ 10 - 8
src/views/coursewarePlay/index.tsx

@@ -56,6 +56,14 @@ export default defineComponent({
         if (value == 'hidden') {
           handleStop()
         }
+        if (value === "visible") {
+          if(data.source === 'search') {
+            getSearchDetail({
+              type: 'visible',
+              search: data.search
+            })
+          }
+        }
       }
     )
     /** 设置播放容器 16:9 */
@@ -426,10 +434,8 @@ export default defineComponent({
                         : null;
                     const useStatus = materialRefs.length > 0
                     ? materialRefs[0]?.extend?.useStatus : null
-                    const isLock = useStatus === 'LOCK' && state.platformType === "STUDENT" ? true : false
                     return {
                       ...item,
-                      isLock,
                       materialMusicId,
                       content: item.content,
                       coursewareDetailId: itemResult.lessonCoursewareDetailId,
@@ -453,10 +459,8 @@ export default defineComponent({
                           : null;
                       const useStatus = materialRefs.length > 0
                       ? materialRefs[0]?.extend?.useStatus : null
-                      const isLock = useStatus === 'LOCK' && state.platformType === "STUDENT" ? true : false
                       return {
                         ...item,
-                        isLock,
                         materialMusicId,
                         coursewareDetailId: itemResult.lessonCoursewareDetailId,
                         lessonCoursewareDetailId: itemResult.lessonCoursewareDetailId,
@@ -994,15 +998,13 @@ export default defineComponent({
 
     // 上一个知识点, 下一个知识点
     const handlePreAndNext = (type: string) => {
-
       if(data.source === 'search') {
         // 判断是否需要会员
         const index = type === "up" ? popupData.activeIndex - 1 : popupData.activeIndex + 1
         const item = data.itemList[index]
         const parentItem = detailList.value?.find((n: any) => n.lessonCoursewareDetailId == item?.lessonCoursewareDetailId)
         if(String(parentItem?.accessScope) === '1') {
-          const hasVip = handleCheckVip()
-          console.log(hasVip, parentItem, "parentItem");
+          const hasVip = handleCheckVip(false)
           if (!hasVip) {
             handleStop()
             return
@@ -1593,7 +1595,7 @@ export default defineComponent({
                   const item = data.itemList.find((n: any) => n.id == res.itemActive)
                   const parentItem = detailList.value?.find((n: any) => n.lessonCoursewareDetailId == item?.lessonCoursewareDetailId)
                   if(String(parentItem?.accessScope) === '1') {
-                    const hasVip = handleCheckVip()
+                    const hasVip = handleCheckVip(false)
                     if (!hasVip) return
                   }
 

+ 5 - 5
src/views/hook/useFee.ts

@@ -3,8 +3,8 @@ import { browser } from '@/helpers/utils'
 import { state } from '@/state'
 import { showDialog } from 'vant'
 
-const gotoMemberCenter = () => {
-  postMessage({ api: 'back' })
+const gotoMemberCenter = (isBack = true) => {
+  if(isBack) postMessage({ api: 'back' })
   const browserInfo = browser()
   if (browserInfo.isApp) {
     const url = window.location.origin + location.pathname + `#/memberCenter`
@@ -21,7 +21,7 @@ const gotoMemberCenter = () => {
 }
 
 /**验证是否是会员 */
-export const handleCheckVip = () => {
+export const handleCheckVip = (isBack = true) => {
   // 学员端验证
   if (state.platformType == 'STUDENT') {
     //学员有待激活会员
@@ -30,7 +30,7 @@ export const handleCheckVip = () => {
         title: '温馨提示',
         message: '您的团练宝暂未激活,请激活后使用'
       }).then(() => {
-        gotoMemberCenter()
+        gotoMemberCenter(isBack)
       })
       return false
     }
@@ -40,7 +40,7 @@ export const handleCheckVip = () => {
         title: '温馨提示',
         message: '您暂未开通团练宝,请开通后使用'
       }).then(() => {
-        gotoMemberCenter()
+        gotoMemberCenter(isBack)
       })
       return false
     }