Преглед изворни кода

学生端云教练:曲目列表,点击曲目要判断当前学生的会员状态(后端接口有返回)

skyblued пре 2 година
родитељ
комит
8a50221d16
1 измењених фајлова са 25 додато и 11 уклоњено
  1. 25 11
      src/views/accompany/music-list.tsx

+ 25 - 11
src/views/accompany/music-list.tsx

@@ -15,6 +15,7 @@ import {
   Popover,
   PullRefresh,
   Search,
+  showConfirmDialog,
   Sticky
 } from 'vant'
 import { defineComponent, reactive, ref, onMounted, nextTick, computed } from 'vue'
@@ -33,6 +34,7 @@ export default defineComponent({
   },
   setup(props, ctx) {
     const route = useRoute()
+    const router = useRouter()
     const imgDefault = getImage('icon-music.svg')
     const data = reactive({
       loading: false,
@@ -157,18 +159,30 @@ export default defineComponent({
     }
     //进入云教练
     const openView = (item: any) => {
+      if (!state.user.data.vipMember && state.platformType == 'STUDENT') {
+        showConfirmDialog({
+          message: '您暂未开通团练宝,请开通后使用'
+        })
+        .then(() => {
+          router.push({
+            path: '/memberCenter'
+          })
+        })
+        return
+      }
+      console.log(state.user.data)
       let src = `${location.origin}/orchestra-music-score/?id=${item.id}`
       console.log('🚀 ~ 去云教练的src', src)
-      postMessage({
-        api: 'openAccompanyWebView',
-        content: {
-          url: src,
-          orientation: 0,
-          isHideTitle: true,
-          statusBarTextColor: false,
-          isOpenLight: true
-        }
-      })
+      // postMessage({
+      //   api: 'openAccompanyWebView',
+      //   content: {
+      //     url: src,
+      //     orientation: 0,
+      //     isHideTitle: true,
+      //     statusBarTextColor: false,
+      //     isOpenLight: true
+      //   }
+      // })
     }
     onMounted(() => {
       getTree()
@@ -176,7 +190,7 @@ export default defineComponent({
     return () => (
       <div class={styles['accompany-music-list']}>
         <OSticky
-          mode='sticky'
+          mode="sticky"
           class={styles.heade}
           onGetHeight={(height: number) => {
             document.documentElement.style.setProperty('--header-height', height + 'px')