lex 1 year ago
parent
commit
68056ef405

+ 13 - 9
src/components/card-preview/rhythm-modal/index.tsx

@@ -15,15 +15,19 @@ export default defineComponent({
     const userStore = useUserStore();
     const iframeRef = ref();
     const isLoaded = ref(false);
-    const origin = /(localhost|192)/.test(location.host)
-      ? 'http://localhost:9002'
-      : location.origin;
-    // const src = `${origin}/classroom-app/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
-    //   props.item.dataJson
-    // }&Authorization=${userStore.getToken}`;
-    const src = `${origin}/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
-      props.item.dataJson
-    }&Authorization=${userStore.getToken}`;
+    // const origin = /(localhost|192)/.test(location.host)
+    //   ? 'http://localhost:9002'
+    //   : location.origin;
+
+    let src = `${origin}/classroom-app/#/tempo-practice?v=${Date.now()}&Authorization=${
+      userStore.getToken
+    }&platform=modal`;
+    if (/(localhost|192)/.test(location.host)) {
+      src = `http://localhost:9002/#/tempo-practice?v=${Date.now()}&Authorization=${
+        userStore.getToken
+      }&platform=modal`;
+    }
+
     return () => (
       <div class={styles.musicScore}>
         <iframe

+ 7 - 4
src/views/attend-class/component/rhythm-modal/index.tsx

@@ -19,12 +19,15 @@ export default defineComponent({
     const origin = /(localhost|192)/.test(location.host)
       ? 'http://localhost:9002'
       : location.origin;
-    // const src = `${origin}/classroom-app/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
-    //   props.item.dataJson
-    // }&Authorization=${userStore.getToken}&win=pc`;
-    const src = `${origin}/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
+    let src = `${origin}/classroom-app/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
       props.item.dataJson
     }&Authorization=${userStore.getToken}&win=pc`;
+    if (/(localhost|192)/.test(location.host)) {
+      src = `${origin}/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
+        props.item.dataJson
+      }&Authorization=${userStore.getToken}&win=pc`;
+    }
+
     return () => (
       <div class={styles.musicScore}>
         <iframe

+ 6 - 4
src/views/prepare-lessons/model/source-rhythm/index.tsx

@@ -10,12 +10,14 @@ export default defineComponent({
     const userStore = useUserStore();
     const iframeRef = ref();
     const loading = ref(true);
-    // const src = `${origin}/classroom-app/#/tempo-practice?v=${Date.now()}&Authorization=${
-    //   userStore.getToken
-    // }&platform=modal`;
-    const src = `http://localhost:9002/#/tempo-practice?v=${Date.now()}&Authorization=${
+    let src = `${origin}/classroom-app/#/tempo-practice?v=${Date.now()}&Authorization=${
       userStore.getToken
     }&platform=modal`;
+    if (/(localhost|192)/.test(location.host)) {
+      src = `http://localhost:9002/#/tempo-practice?v=${Date.now()}&Authorization=${
+        userStore.getToken
+      }&platform=modal`;
+    }
 
     // emit('confirm');
     const onSubmit = () => {