skyblued 2 年之前
父节点
当前提交
9fc4a6142e
共有 1 个文件被更改,包括 20 次插入12 次删除
  1. 20 12
      src/views/accompany/music-list.tsx

+ 20 - 12
src/views/accompany/music-list.tsx

@@ -1,6 +1,7 @@
 import OEmpty from '@/components/o-empty'
 import { postMessage } from '@/helpers/native-message'
 import request from '@/helpers/request'
+import { browser } from '@/helpers/utils'
 import { state } from '@/state'
 import {
   Cell,
@@ -15,7 +16,7 @@ import {
   Sticky
 } from 'vant'
 import { defineComponent, reactive, ref, onMounted, nextTick, computed } from 'vue'
-import { useRoute } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
 import { getImage } from './images'
 import styles from './index.module.less'
 
@@ -29,6 +30,7 @@ export default defineComponent({
   },
   setup(props, ctx) {
     const route = useRoute()
+    const router = useRouter()
     const imgDefault = getImage('icon-music.svg')
     const data = reactive({
       loading: true,
@@ -205,17 +207,23 @@ export default defineComponent({
             const origin = /(localhost|192)/.test(location.host)
               ? 'http://192.168.3.114:3000'
               : location.origin
-            let src = `${origin}/orchestra-music-score/?id=1603573996544364546&Authorization=${sessionStorage.getItem('Authorization')}`
-            postMessage({
-              api: 'openAccompanyWebView',
-              content: {
-                url: src,
-                orientation: 0,
-                isHideTitle: true,
-                statusBarTextColor: false,
-                isOpenLight: true
-              }
-            })
+            let src = `${origin}/orchestra-music-score/?id=1603573996544364546&Authorization=${sessionStorage.getItem(
+              'Authorization'
+            )}`
+            if (browser().isApp) {
+              postMessage({
+                api: 'openAccompanyWebView',
+                content: {
+                  url: src,
+                  orientation: 0,
+                  isHideTitle: true,
+                  statusBarTextColor: false,
+                  isOpenLight: true
+                }
+              })
+            } else {
+                location.href = src
+            }
           }}
         ></Cell>
         <PullRefresh v-model:modelValue={data.refreshing} onRefresh={onRefresh}>