Browse Source

优化链接

lex-xin 2 tháng trước cách đây
mục cha
commit
3e56735897

+ 0 - 3
src/components/card-preview/music-modal/index.tsx

@@ -21,9 +21,6 @@ export default defineComponent({
     const userStore = useUserStore();
     const iframeRef = ref();
     const isLoaded = ref(false);
-    // const origin = /(localhost|192)/.test(location.host)
-    //   ? 'https://test.lexiaoya.cn'
-    //   : location.origin;
     let src = `${vaildMusicScoreUrl()}/instrument?v=${+new Date()}&modelType=practise&id=${
       props.item.content
     }&Authorization=${userStore.getToken}&platform=pc&zoom=0.8`;

+ 0 - 3
src/components/card-preview/rhythm-modal/index.tsx

@@ -16,9 +16,6 @@ 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;
 
     let src = `${origin}/classroom-app/#/tempo-practice?v=${Date.now()}&Authorization=${
       userStore.getToken

+ 2 - 1
src/components/layout/imGroup.tsx

@@ -3,6 +3,7 @@ import { useUserStore } from '/src/store/modules/users';
 import styles from './index.module.less';
 import { NSpin } from 'naive-ui';
 import { iframeDislableKeyboard } from '/src/utils';
+import { getHttpOrigin } from '/src/helpers/utils';
 
 export default defineComponent({
   name: 'imGroup',
@@ -17,7 +18,7 @@ export default defineComponent({
       ? 'https://test.kt.colexiu.com'
       : /online.lexiaoya.cn/.test(location.href)
       ? 'https://kt.colexiu.com'
-      : location.origin;
+      : getHttpOrigin();
     const src = `${origin}/classroom-im/?v=${+new Date()}&userID=${
       userStore.getUserInfo.imUserId
     }&Authorization=${userStore.getToken}&t=${+new Date()}`;

+ 62 - 58
src/helpers/utils.ts

@@ -1,58 +1,62 @@
-export const browser = () => {
-  const u = navigator.userAgent;
-  return {
-    trident: u.indexOf('Trident') > -1, //IE内核
-    presto: u.indexOf('Presto') > -1, //opera内核
-    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
-    gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
-    mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
-    ios: !!u.match(/Mac OS X/), //ios终端
-    // ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
-    android: u.indexOf('DAYAAPPA') > -1 || u.indexOf('Adr') > -1, //android终端
-    iPhone: u.indexOf('DAYAAPPI') > -1, //是否为iPhone或者QQHD浏览器
-    isApp:
-      u.indexOf('DAYAAPPI') > -1 ||
-      u.indexOf('DAYAAPPA') > -1 ||
-      u.indexOf('Adr') > -1,
-    iPad: u.indexOf('iPad') > -1, //是否iPad
-    webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
-    weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
-    alipay: u.indexOf('AlipayClient') > -1, //是否支付宝
-    huawei: !!u.match(/huawei/i) || !!u.match(/honor/i),
-    xiaomi: !!u.match(/mi\s/i) || !!u.match(/redmi/i) || !!u.match(/mix/i)
-  };
-};
-
-export const getRandomKey = () => {
-  const key = '' + new Date().getTime() + Math.floor(Math.random() * 1000000);
-  return key;
-};
-
-/**
- * 删除token
- */
-export const removeAuth = () => {
-  sessionStorage.removeItem('Authorization');
-};
-
-/**
- * 设置token
- * @param token
- * @returns {void}
- */
-export const setAuth = (token: any) => {
-  sessionStorage.setItem('Authorization', token);
-};
-
-/**
- * 获取token
- */
-export const getAuth = () => {
-  sessionStorage.getItem('Authorization');
-};
-
-export function checkPhone(phone: string) {
-  const phoneRule =
-    /^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/;
-  return phoneRule.test(phone);
-}
+export const browser = () => {
+  const u = navigator.userAgent;
+  return {
+    trident: u.indexOf('Trident') > -1, //IE内核
+    presto: u.indexOf('Presto') > -1, //opera内核
+    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
+    gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
+    mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
+    ios: !!u.match(/Mac OS X/), //ios终端
+    // ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
+    android: u.indexOf('DAYAAPPA') > -1 || u.indexOf('Adr') > -1, //android终端
+    iPhone: u.indexOf('DAYAAPPI') > -1, //是否为iPhone或者QQHD浏览器
+    isApp:
+      u.indexOf('DAYAAPPI') > -1 ||
+      u.indexOf('DAYAAPPA') > -1 ||
+      u.indexOf('Adr') > -1,
+    iPad: u.indexOf('iPad') > -1, //是否iPad
+    webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
+    weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
+    alipay: u.indexOf('AlipayClient') > -1, //是否支付宝
+    huawei: !!u.match(/huawei/i) || !!u.match(/honor/i),
+    xiaomi: !!u.match(/mi\s/i) || !!u.match(/redmi/i) || !!u.match(/mix/i)
+  };
+};
+
+export const getRandomKey = () => {
+  const key = '' + new Date().getTime() + Math.floor(Math.random() * 1000000);
+  return key;
+};
+
+/**
+ * 删除token
+ */
+export const removeAuth = () => {
+  sessionStorage.removeItem('Authorization');
+};
+
+/**
+ * 设置token
+ * @param token
+ * @returns {void}
+ */
+export const setAuth = (token: any) => {
+  sessionStorage.setItem('Authorization', token);
+};
+
+/**
+ * 获取token
+ */
+export const getAuth = () => {
+  sessionStorage.getItem('Authorization');
+};
+
+export function checkPhone(phone: string) {
+  const phoneRule =
+    /^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/;
+  return phoneRule.test(phone);
+}
+
+export const getHttpOrigin = () => {
+	return window.location.origin
+}

+ 146 - 150
src/views/attend-class/component/musicScore.tsx

@@ -1,150 +1,146 @@
-import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';
-import { NSkeleton } from 'naive-ui';
-import styles from './musicScore.module.less';
-import { usePageVisibility } from '@vant/use';
-import { useUserStore } from '/src/store/modules/users';
-import { vaildMusicScoreUrl } from '/src/utils/urlUtils';
-import { iframeDislableKeyboard } from '/src/utils';
-
-export default defineComponent({
-  name: 'musicScore',
-  props: {
-    music: {
-      type: Object,
-      default: () => ({})
-    },
-    activeModel: {
-      type: Boolean
-    },
-    instrumentId: {
-      type: String
-    },
-    /** 当前是否为选中状态 */
-    activeStatus: {
-      type: Boolean
-    },
-    imagePos: {
-      type: String,
-      default: 'left'
-    }
-  },
-  emits: ['setIframe'],
-  setup(props, { emit }) {
-    const userStore = useUserStore();
-    const isLoading = ref(false);
-    const pageVisibility = usePageVisibility();
-    /** 页面显示和隐藏 */
-    watch(pageVisibility, value => {
-      console.log('🚀 ~ value:', value);
-      if (value == 'hidden') {
-        isLoading.value = false;
-      }
-    });
-    const iframeRef = ref();
-    const isLoaded = ref(false);
-    const renderError = ref(false);
-    const renderSuccess = ref(false);
-    // const origin = /(localhost|192)/.test(location.host)
-    //   ? 'https://test.lexiaoya.cn/instrument'
-    //   : // 'http://localhost:3000/instrument.html'
-    //     location.origin + '/instrument';
-    let src = `${vaildMusicScoreUrl()}/instrument/?v=${+new Date()}&showGuide=true&showWebGuide=false&platform=pc&zoom=1.2&modelType=practise&id=${
-      props.music.content
-    }&Authorization=${userStore.getToken}&imagePos=${props.imagePos}`;
-    if (props.instrumentId) {
-      src += `&instrumentId=${props.instrumentId}`;
-    }
-    const checkView = () => {
-      fetch(src)
-        .then(() => {
-          renderSuccess.value = true;
-          renderError.value = false;
-        })
-        .catch(() => {
-          renderError.value = true;
-        });
-    };
-    watch(
-      () => props.music,
-      () => {
-        if (renderSuccess.value) return;
-        renderError.value = false;
-        if (props.music.display) {
-          checkView();
-        }
-      }
-    );
-
-    // 去云教练完整版
-    // const gotoAccomany = () => {
-    //   if (isLoading.value) return;
-    //   if (!browserInfo.ios) {
-    //     isLoading.value = true;
-    //   }
-    //   // const parmas = qs.stringify({
-    //   //   id: props.music.content
-    //   // });
-    //   // let src = `${location.origin}/orchestra-music-score/?` + parmas
-    //   const src = `https://test.lexiaoya.cn/orchestra-music-score/?_t=1687590480955&id=11707&modelType=practice&modeType=json&Authorization=bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsib2F1dGgyLXJlc291cmNlIl0sImNsaWVudFR5cGUiOiJCQUNLRU5EIiwidXNlcl9uYW1lIjoiMTgxNjI4NTU4MDAiLCJzY29wZSI6WyJhbGwiXSwidXNlcklkIjoiMTAwMDE0OSIsImF1dGhvcml0aWVzIjpbIjE4MTYyODU1ODAwIl0sImp0aSI6IjY0MzA2NjllLTE5NGItNDk3Yy1hMDQ5LWM4YWUxMGU0NDNiOCIsImNsaWVudF9pZCI6ImptZWR1LWJhY2tlbmQifQ.aeJ0o-lSfx1Ok-YptZuC-AUY6M7k3LK9rr0Bmx7sj81pPt2HDiDqeT2PuriYdJacxWnxboyhdG_lwU0QK-W-vON97c45NQpSEFLVpZ0m1xdIqwllwf20xhyj5YJwdOFUzxf1TNEfGsHZg66J7wEJQBSzlmQwcxmEE5lqLVD8o_3f2SBqnWCj9RqE4air7FUemllMnZiu8HsS-TKtLDaGa_XW8Yb_Zjzzz6r5UcYNI-C1uKPXg18o1dhHBJ8O-Pl0U8WivPRub_opvO2NSn5L9YtPt7Dd50UeSwaIOdMeCGdii1bg__h77Stek1_5IaZLYkoo2gvmUA-xk09TwCQBpA`;
-    //   postMessage(
-    //     {
-    //       api: 'openAccompanyWebView',
-    //       content: {
-    //         url: src,
-    //         orientation: 0,
-    //         isHideTitle: true,
-    //         statusBarTextColor: false,
-    //         isOpenLight: true
-    //       }
-    //     },
-    //     () => {
-    //       if (browserInfo.ios) {
-    //         isLoading.value = true;
-    //       }
-    //     }
-    //   );
-    // };
-
-    watch(
-      () => props.activeModel,
-      () => {
-        if (iframeRef.value.contentWindow && props.activeStatus) {
-          // console.log(
-          //   iframeRef.value.contentWindow,
-          //   props.activeModel,
-          //   'iframeRef'
-          // );
-          iframeRef.value.contentWindow.postMessage(
-            {
-              api: 'attendClassBarStatus',
-              hideMenu: !props.activeModel
-            },
-            '*'
-          );
-        }
-      }
-    );
-
-    return () => (
-      <div class={styles.musicScore}>
-        <iframe
-          ref={iframeRef}
-          onLoad={(val: any) => {
-            emit('setIframe', iframeRef.value);
-            isLoaded.value = true;
-            iframeDislableKeyboard(val.target);
-          }}
-          class={[styles.container, 'musicIframe']}
-          frameborder="0"
-          src={src}></iframe>
-        {/* {isLoaded.value && (
-          <div class={styles.skeletonWrap}>
-            <div>
-              <NSkeleton text repeat={8} />
-            </div>
-          </div>
-        )} */}
-      </div>
-    );
-  }
-});
+import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';
+import { NSkeleton } from 'naive-ui';
+import styles from './musicScore.module.less';
+import { usePageVisibility } from '@vant/use';
+import { useUserStore } from '/src/store/modules/users';
+import { vaildMusicScoreUrl } from '/src/utils/urlUtils';
+import { iframeDislableKeyboard } from '/src/utils';
+
+export default defineComponent({
+  name: 'musicScore',
+  props: {
+    music: {
+      type: Object,
+      default: () => ({})
+    },
+    activeModel: {
+      type: Boolean
+    },
+    instrumentId: {
+      type: String
+    },
+    /** 当前是否为选中状态 */
+    activeStatus: {
+      type: Boolean
+    },
+    imagePos: {
+      type: String,
+      default: 'left'
+    }
+  },
+  emits: ['setIframe'],
+  setup(props, { emit }) {
+    const userStore = useUserStore();
+    const isLoading = ref(false);
+    const pageVisibility = usePageVisibility();
+    /** 页面显示和隐藏 */
+    watch(pageVisibility, value => {
+      console.log('🚀 ~ value:', value);
+      if (value == 'hidden') {
+        isLoading.value = false;
+      }
+    });
+    const iframeRef = ref();
+    const isLoaded = ref(false);
+    const renderError = ref(false);
+    const renderSuccess = ref(false);
+    let src = `${vaildMusicScoreUrl()}/instrument/?v=${+new Date()}&showGuide=true&showWebGuide=false&platform=pc&zoom=1.2&modelType=practise&id=${
+      props.music.content
+    }&Authorization=${userStore.getToken}&imagePos=${props.imagePos}`;
+    if (props.instrumentId) {
+      src += `&instrumentId=${props.instrumentId}`;
+    }
+    const checkView = () => {
+      fetch(src)
+        .then(() => {
+          renderSuccess.value = true;
+          renderError.value = false;
+        })
+        .catch(() => {
+          renderError.value = true;
+        });
+    };
+    watch(
+      () => props.music,
+      () => {
+        if (renderSuccess.value) return;
+        renderError.value = false;
+        if (props.music.display) {
+          checkView();
+        }
+      }
+    );
+
+    // 去云教练完整版
+    // const gotoAccomany = () => {
+    //   if (isLoading.value) return;
+    //   if (!browserInfo.ios) {
+    //     isLoading.value = true;
+    //   }
+    //   // const parmas = qs.stringify({
+    //   //   id: props.music.content
+    //   // });
+    //   // let src = `${location.origin}/orchestra-music-score/?` + parmas
+    //   const src = `https://test.lexiaoya.cn/orchestra-music-score/?_t=1687590480955&id=11707&modelType=practice&modeType=json&Authorization=bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsib2F1dGgyLXJlc291cmNlIl0sImNsaWVudFR5cGUiOiJCQUNLRU5EIiwidXNlcl9uYW1lIjoiMTgxNjI4NTU4MDAiLCJzY29wZSI6WyJhbGwiXSwidXNlcklkIjoiMTAwMDE0OSIsImF1dGhvcml0aWVzIjpbIjE4MTYyODU1ODAwIl0sImp0aSI6IjY0MzA2NjllLTE5NGItNDk3Yy1hMDQ5LWM4YWUxMGU0NDNiOCIsImNsaWVudF9pZCI6ImptZWR1LWJhY2tlbmQifQ.aeJ0o-lSfx1Ok-YptZuC-AUY6M7k3LK9rr0Bmx7sj81pPt2HDiDqeT2PuriYdJacxWnxboyhdG_lwU0QK-W-vON97c45NQpSEFLVpZ0m1xdIqwllwf20xhyj5YJwdOFUzxf1TNEfGsHZg66J7wEJQBSzlmQwcxmEE5lqLVD8o_3f2SBqnWCj9RqE4air7FUemllMnZiu8HsS-TKtLDaGa_XW8Yb_Zjzzz6r5UcYNI-C1uKPXg18o1dhHBJ8O-Pl0U8WivPRub_opvO2NSn5L9YtPt7Dd50UeSwaIOdMeCGdii1bg__h77Stek1_5IaZLYkoo2gvmUA-xk09TwCQBpA`;
+    //   postMessage(
+    //     {
+    //       api: 'openAccompanyWebView',
+    //       content: {
+    //         url: src,
+    //         orientation: 0,
+    //         isHideTitle: true,
+    //         statusBarTextColor: false,
+    //         isOpenLight: true
+    //       }
+    //     },
+    //     () => {
+    //       if (browserInfo.ios) {
+    //         isLoading.value = true;
+    //       }
+    //     }
+    //   );
+    // };
+
+    watch(
+      () => props.activeModel,
+      () => {
+        if (iframeRef.value.contentWindow && props.activeStatus) {
+          // console.log(
+          //   iframeRef.value.contentWindow,
+          //   props.activeModel,
+          //   'iframeRef'
+          // );
+          iframeRef.value.contentWindow.postMessage(
+            {
+              api: 'attendClassBarStatus',
+              hideMenu: !props.activeModel
+            },
+            '*'
+          );
+        }
+      }
+    );
+
+    return () => (
+      <div class={styles.musicScore}>
+        <iframe
+          ref={iframeRef}
+          onLoad={(val: any) => {
+            emit('setIframe', iframeRef.value);
+            isLoaded.value = true;
+            iframeDislableKeyboard(val.target);
+          }}
+          class={[styles.container, 'musicIframe']}
+          frameborder="0"
+          src={src}></iframe>
+        {/* {isLoaded.value && (
+          <div class={styles.skeletonWrap}>
+            <div>
+              <NSkeleton text repeat={8} />
+            </div>
+          </div>
+        )} */}
+      </div>
+    );
+  }
+});

+ 2 - 1
src/views/attend-class/component/rhythm-modal/index.tsx

@@ -3,6 +3,7 @@ import styles from './index.module.less';
 import { useUserStore } from '/src/store/modules/users';
 import { vaildMusicScoreUrl } from '/src/utils/urlUtils';
 import { iframeDislableKeyboard } from '/src/utils';
+import { getHttpOrigin } from '/src/helpers/utils';
 
 export default defineComponent({
   name: 'song-modal',
@@ -26,7 +27,7 @@ export default defineComponent({
     const iframeRef = ref();
     const isLoaded = ref(false);
     let src = `${
-      location.origin
+      getHttpOrigin()
     }/classroom-app/#/tempo-practice?v=${+new Date()}&platform=modal&dataJson=${
       props.item.dataJson
     }&Authorization=${userStore.getToken}&win=pc&imagePos=${props.imagePos}`;

+ 2 - 1
src/views/attend-class/component/roll-call/pen.tsx

@@ -4,6 +4,7 @@ import { ToolType } from '../../index';
 import { NButton, NModal, NSpace } from 'naive-ui';
 import { iframeDislableKeyboard } from '/src/utils';
 import { modalClickMask } from '/src/state';
+import { getHttpOrigin } from '/src/helpers/utils';
 
 export default defineComponent({
   name: 'pen-page',
@@ -34,7 +35,7 @@ export default defineComponent({
     const origin = /(localhost|192)/.test(location.host)
       ? // ? 'https://test.lexiaoya.cn/'
         'http://localhost:5002/'
-      : location.origin;
+      : getHttpOrigin();
     let src = `${origin}/classroom-whiteboard?t=${+new Date()}`;
 
     console.log(props.type, '121212');

+ 2 - 1
src/views/attend-class/component/tools/pen.tsx

@@ -7,6 +7,7 @@ import useDrag from '@/hooks/useDrag';
 import Dragbom from '@/hooks/useDrag/dragbom';
 import { useUserStore } from '@/store/modules/users';
 import { modalClickMask } from '/src/state';
+import { getHttpOrigin } from '/src/helpers/utils';
 
 export default defineComponent({
   name: 'pen-page',
@@ -50,7 +51,7 @@ export default defineComponent({
     const origin = /(localhost|192)/.test(location.host)
       ? 'https://test.lexiaoya.cn/'
       : // 'http://localhost:5002/'
-        location.origin;
+        getHttpOrigin();
     let src = `${origin}/classroom-whiteboard?t=${+new Date()}`;
 
     if (props.type === 'call') {

+ 2 - 1
src/views/home/index.tsx

@@ -38,6 +38,7 @@ import { modalClickMask, state } from '/src/state';
 import SubjectModal from './modals/subject-modal';
 import { vaildMusicScoreUrl } from '/src/utils/urlUtils';
 import GuideSection from '/src/components/layout/guide-section';
+import { getHttpOrigin } from '/src/helpers/utils';
 // import HomeGuide from '/src/custom-plugins/guide-page/home-guide';
 // import { state } from '/src/state';
 export const formatDateToDay = () => {
@@ -170,7 +171,7 @@ export default defineComponent({
                 onClick={() => {
                   const origin = /(localhost)/.test(location.host)
                     ? 'https://test.kt.colexiu.com'
-                    : location.origin;
+                    : getHttpOrigin();
                   const src = `${origin}/classroom-app/#/tempo-practice?Authorization=${userStore.getToken}&win=pc&platform=modal&back=show`;
                   if (window.matchMedia('(display-mode: standalone)').matches) {
                     state.application = window.matchMedia(

+ 2 - 1
src/views/notation/index.tsx

@@ -5,6 +5,7 @@ import { modalClickMask, state } from '/src/state';
 import { NButton, NModal, NSpace, NSpin } from 'naive-ui';
 import { eventGlobal } from '/src/utils';
 import { useRouter } from 'vue-router';
+import { getHttpOrigin } from '/src/helpers/utils';
 export default defineComponent({
   name: 'notation-a',
   setup() {
@@ -27,7 +28,7 @@ export default defineComponent({
           ? // ?
             // 'https://test.lexiaoya.cn'
             'http://localhost:3050'
-          : location.origin
+          : getHttpOrigin()
       }/notation/?t=${Date.now()}#/create?v=${Date.now()}&Authorization=${Authorization}${openCreateUrl}`
       //   src: `http://localhost:3050/#/create?Authorization=${Authorization}`
     };

+ 2 - 1
src/views/prepare-lessons/model/the-create/index.tsx

@@ -31,6 +31,7 @@ import { api_musicSheetCreationSave, api_subjectList } from '/src/pc/api';
 import { initMusic } from '/src/pc/home';
 import { encodeUrl } from '/src/utils';
 import { modalClickMask } from '/src/state';
+import { getHttpOrigin } from '/src/helpers/utils';
 const instruments = [
   {
     label: '竖笛',
@@ -129,7 +130,7 @@ export default defineComponent({
     };
 
     const handleOpenNotaion = (data: any) => {
-      const url = `${location.origin}/notation/#/?v=1.0.3&config=${encodeUrl(
+      const url = `${getHttpOrigin()}/notation/#/?v=1.0.3&config=${encodeUrl(
         data
       )}`;
       window.parent.postMessage(

+ 2 - 1
src/views/setting/components/schoolInfo/index.tsx

@@ -32,6 +32,7 @@ import AddteacherModel from '../../modal/addteacherModel';
 import TheEmpty from '/src/components/TheEmpty';
 import TheMessageDialog from '/src/components/TheMessageDialog';
 import { modalClickMask } from '/src/state';
+import { getHttpOrigin } from '/src/helpers/utils';
 export default defineComponent({
   name: 'school-info',
   emits: ['changeTab'],
@@ -311,7 +312,7 @@ export default defineComponent({
     const registerUrl = () => {
       const queryStr = `tenantId=${user.info.schoolInfos?.[0]?.tenantId}&schoolId=${user.info.schoolInfos?.[0]?.id}&schoolName=${user.info.schoolInfos?.[0]?.name}`;
       const url =
-        `${location.origin}/classroom-app/#/teaher-register?` + queryStr;
+        `${getHttpOrigin()}/classroom-app/#/teaher-register?` + queryStr;
       console.log(url);
       return url;
     };

+ 181 - 180
src/views/setting/modal/addteacherModel.tsx

@@ -1,180 +1,181 @@
-import {
-  NButton,
-  NSpace,
-  useMessage,
-  NForm,
-  NFormItem,
-  NSelect,
-  NImage
-} from 'naive-ui';
-import { defineComponent, onMounted, reactive, ref } from 'vue';
-import styles from '../components/schoolInfo/index.module.less';
-import CSelect from '/src/components/CSelect';
-import stunentStart from '@/views/studentList/images/studentStart.png';
-import studentCLose from '@/views/studentList/images/studentClose.png';
-import { useUserStore } from '@/store/modules/users';
-import TheQrCode from '/src/components/TheQrCode';
-import { vaildUrl } from '@/utils/urlUtils';
-import logo from '@/common/images/logo.png';
-import studentTitle from '../images/studentTitle.png';
-import studentInfo from '@/views/studentList/images/teacherCore.png';
-import codewrap from '@/views/studentList/images/cordWrap.png';
-import btnBg from '@/views/studentList/images/btnBg.png';
-import html2canvas from 'html2canvas';
-
-export default defineComponent({
-  props: {
-    activeRow: {
-      type: Object,
-      default: () => ({ id: '' })
-    },
-    gradeNumList: {
-      type: Array,
-      default: () => []
-    },
-    classArray: {
-      type: Array,
-      default: () => []
-    }
-  },
-  name: 'resetStudent',
-  emits: ['close', 'getList'],
-  setup(props, { emit }) {
-    const data = reactive({
-      uploading: false
-    });
-    const message = useMessage();
-    const userStore = useUserStore();
-    const foemsRef = ref();
-    const registerUrl = () => {
-      const queryStr = `tenantId=${userStore.info.schoolInfos?.[0]?.tenantId}&schoolId=${userStore.info.schoolInfos?.[0]?.id}&schoolName=${userStore.info.schoolInfos?.[0]?.name}`;
-      const url =
-        `${location.origin}/classroom-app/#/teaher-register?` + queryStr;
-
-      return url;
-    };
-
-    const queryStr = `tenantId=${userStore.info.schoolInfos?.[0]?.tenantId}&schoolId=${userStore.info.schoolInfos?.[0]?.id}&schoolName=${userStore.info.schoolInfos?.[0]?.name}`;
-    const url =
-      `${location.origin}/classroom-app/#/teaher-register?` + queryStr;
-    const imgs = reactive({
-      saveLoading: false,
-      image: null as any,
-      shareLoading: false
-    });
-    const downImg = () => {
-      if (imgs.saveLoading) {
-        return;
-      }
-      imgs.saveLoading = true;
-      // 判断是否已经生成图片
-      if (imgs.image) {
-        saveImg();
-      } else {
-        const container: any = document.getElementById(`preview-container`);
-
-        html2canvas(container, {
-          allowTaint: true,
-          useCORS: true,
-          backgroundColor: null
-        })
-          .then(async canvas => {
-            const url = canvas.toDataURL('image/png');
-            console.log(url, 'url===>');
-            imgs.image = url;
-
-            saveImg();
-          })
-          .catch(() => {
-            console.log('生成图片失败url===>');
-            imgs.saveLoading = false;
-          });
-      }
-    };
-
-    const saveImg = async () => {
-      // showLoadingToast({ message: '图片生成中...', forbidClick: true });
-      setTimeout(() => {
-        imgs.saveLoading = false;
-      }, 100);
-      const link = document.createElement('a');
-      link.setAttribute('download', '新增老师' + '.png');
-      // 添加时间戳,防止浏览器缓存图片
-      // console.log(imgUrl,'imgUrl')
-
-      link.href = imgs.image;
-      link.click();
-      // const res = await promisefiyPostMessage({
-      //   api: 'savePicture',
-      //   content: {
-      //     base64: imgs.image
-      //   }
-      // });
-      // if (res?.content?.status === 'success') {
-      //   showSuccessToast('保存成功');
-      // } else {
-      //   showFailToast('保存失败');
-      // }
-    };
-    return () => (
-      <div class={[styles.addStudentWrap]}>
-        <div
-          onClick={() => {
-            console.log('点击');
-            emit('close');
-          }}>
-          <NImage
-            src={studentCLose}
-            previewDisabled
-            class={styles.studentCLose}></NImage>
-        </div>
-        <NImage
-          previewDisabled
-          class={styles.stunentStart}
-          src={stunentStart}></NImage>
-        <NImage
-          class={[styles.addTitle, styles.addTeacherTitle]}
-          previewDisabled
-          src={studentTitle}></NImage>
-        <div class={styles.addStudentInfo} id="preview-container">
-          <NImage
-            class={styles.studentInfoBg}
-            previewDisabled
-            src={studentInfo}></NImage>
-
-          <div class={styles.studentCore}>
-            <img
-              alt="img"
-              crossorigin="anonymous"
-              class={styles.schoolLogo}
-              src={
-                userStore.getUserInfo.schoolInfos[0].logo +
-                `?some=${new Date().getTime()}`
-              }></img>
-            <div class={styles.studentCoreInfo}>
-              <h2>{userStore.getUserInfo.schoolInfos[0].name}</h2>
-              <p class={styles.studentCoreInfoSubtitle}>
-                邀请您成为
-                <span>音乐数字课堂老师</span>
-              </p>
-              <div class={styles.codewrap}>
-                {/* <img src={codewrap} class={styles.codewrapBg} alt="" /> */}
-                <TheQrCode margin={0} text={url} size={119} />
-              </div>
-              <div class={styles.codewrapSubmit}>
-                <NImage previewDisabled src={btnBg}></NImage>
-                请扫描上方二维码 <span>完成注册</span>{' '}
-              </div>
-            </div>
-          </div>
-        </div>
-        <div class={styles.studentBottom}>
-          <p>请将二维码图片发送给老师,扫码完成注册</p>
-          <div class={styles.downBtn} onClick={downImg}>
-            下载图片
-          </div>
-        </div>
-      </div>
-    );
-  }
-});
+import {
+  NButton,
+  NSpace,
+  useMessage,
+  NForm,
+  NFormItem,
+  NSelect,
+  NImage
+} from 'naive-ui';
+import { defineComponent, onMounted, reactive, ref } from 'vue';
+import styles from '../components/schoolInfo/index.module.less';
+import CSelect from '/src/components/CSelect';
+import stunentStart from '@/views/studentList/images/studentStart.png';
+import studentCLose from '@/views/studentList/images/studentClose.png';
+import { useUserStore } from '@/store/modules/users';
+import TheQrCode from '/src/components/TheQrCode';
+import { vaildUrl } from '@/utils/urlUtils';
+import logo from '@/common/images/logo.png';
+import studentTitle from '../images/studentTitle.png';
+import studentInfo from '@/views/studentList/images/teacherCore.png';
+import codewrap from '@/views/studentList/images/cordWrap.png';
+import btnBg from '@/views/studentList/images/btnBg.png';
+import html2canvas from 'html2canvas';
+import { getHttpOrigin } from '/src/helpers/utils';
+
+export default defineComponent({
+  props: {
+    activeRow: {
+      type: Object,
+      default: () => ({ id: '' })
+    },
+    gradeNumList: {
+      type: Array,
+      default: () => []
+    },
+    classArray: {
+      type: Array,
+      default: () => []
+    }
+  },
+  name: 'resetStudent',
+  emits: ['close', 'getList'],
+  setup(props, { emit }) {
+    const data = reactive({
+      uploading: false
+    });
+    const message = useMessage();
+    const userStore = useUserStore();
+    const foemsRef = ref();
+    const registerUrl = () => {
+      const queryStr = `tenantId=${userStore.info.schoolInfos?.[0]?.tenantId}&schoolId=${userStore.info.schoolInfos?.[0]?.id}&schoolName=${userStore.info.schoolInfos?.[0]?.name}`;
+      const url =
+        `${getHttpOrigin()}/classroom-app/#/teaher-register?` + queryStr;
+
+      return url;
+    };
+
+    const queryStr = `tenantId=${userStore.info.schoolInfos?.[0]?.tenantId}&schoolId=${userStore.info.schoolInfos?.[0]?.id}&schoolName=${userStore.info.schoolInfos?.[0]?.name}`;
+    const url =
+      `${getHttpOrigin()}/classroom-app/#/teaher-register?` + queryStr;
+    const imgs = reactive({
+      saveLoading: false,
+      image: null as any,
+      shareLoading: false
+    });
+    const downImg = () => {
+      if (imgs.saveLoading) {
+        return;
+      }
+      imgs.saveLoading = true;
+      // 判断是否已经生成图片
+      if (imgs.image) {
+        saveImg();
+      } else {
+        const container: any = document.getElementById(`preview-container`);
+
+        html2canvas(container, {
+          allowTaint: true,
+          useCORS: true,
+          backgroundColor: null
+        })
+          .then(async canvas => {
+            const url = canvas.toDataURL('image/png');
+            console.log(url, 'url===>');
+            imgs.image = url;
+
+            saveImg();
+          })
+          .catch(() => {
+            console.log('生成图片失败url===>');
+            imgs.saveLoading = false;
+          });
+      }
+    };
+
+    const saveImg = async () => {
+      // showLoadingToast({ message: '图片生成中...', forbidClick: true });
+      setTimeout(() => {
+        imgs.saveLoading = false;
+      }, 100);
+      const link = document.createElement('a');
+      link.setAttribute('download', '新增老师' + '.png');
+      // 添加时间戳,防止浏览器缓存图片
+      // console.log(imgUrl,'imgUrl')
+
+      link.href = imgs.image;
+      link.click();
+      // const res = await promisefiyPostMessage({
+      //   api: 'savePicture',
+      //   content: {
+      //     base64: imgs.image
+      //   }
+      // });
+      // if (res?.content?.status === 'success') {
+      //   showSuccessToast('保存成功');
+      // } else {
+      //   showFailToast('保存失败');
+      // }
+    };
+    return () => (
+      <div class={[styles.addStudentWrap]}>
+        <div
+          onClick={() => {
+            console.log('点击');
+            emit('close');
+          }}>
+          <NImage
+            src={studentCLose}
+            previewDisabled
+            class={styles.studentCLose}></NImage>
+        </div>
+        <NImage
+          previewDisabled
+          class={styles.stunentStart}
+          src={stunentStart}></NImage>
+        <NImage
+          class={[styles.addTitle, styles.addTeacherTitle]}
+          previewDisabled
+          src={studentTitle}></NImage>
+        <div class={styles.addStudentInfo} id="preview-container">
+          <NImage
+            class={styles.studentInfoBg}
+            previewDisabled
+            src={studentInfo}></NImage>
+
+          <div class={styles.studentCore}>
+            <img
+              alt="img"
+              crossorigin="anonymous"
+              class={styles.schoolLogo}
+              src={
+                userStore.getUserInfo.schoolInfos[0].logo +
+                `?some=${new Date().getTime()}`
+              }></img>
+            <div class={styles.studentCoreInfo}>
+              <h2>{userStore.getUserInfo.schoolInfos[0].name}</h2>
+              <p class={styles.studentCoreInfoSubtitle}>
+                邀请您成为
+                <span>音乐数字课堂老师</span>
+              </p>
+              <div class={styles.codewrap}>
+                {/* <img src={codewrap} class={styles.codewrapBg} alt="" /> */}
+                <TheQrCode margin={0} text={url} size={119} />
+              </div>
+              <div class={styles.codewrapSubmit}>
+                <NImage previewDisabled src={btnBg}></NImage>
+                请扫描上方二维码 <span>完成注册</span>{' '}
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class={styles.studentBottom}>
+          <p>请将二维码图片发送给老师,扫码完成注册</p>
+          <div class={styles.downBtn} onClick={downImg}>
+            下载图片
+          </div>
+        </div>
+      </div>
+    );
+  }
+});

+ 6 - 5
src/views/xiaoku-music/index.tsx

@@ -57,6 +57,7 @@ import { vaildMusicScoreUrl } from '/src/utils/urlUtils';
 import { getInstrumentName, sortMusical } from '/src/utils';
 import { audioPlayType } from '/src/utils/contants';
 import CCascader from '/src/components/CCascader';
+import { getHttpOrigin } from '/src/helpers/utils';
 
 export default defineComponent({
   name: 'XiaokuMusic',
@@ -414,9 +415,9 @@ export default defineComponent({
           // pdf
       const musicSheetType = details?.musicSheetType;
       let musicPdfUrl: any = ''
-      
+
       if(musicSheetType === "SINGLE" || data.musicInstrumentIndex === 999) {
-        
+
         if( data.showMusicImg === "first") {
           musicPdfUrl = details?.firstPdfUrl
         } else if(data.showMusicImg === 'fixed') {
@@ -447,7 +448,7 @@ export default defineComponent({
       data.musicPdfUrl = musicPdfUrl
       if(musicPdfUrl) {
         // data.iframeSrc = `https://test.kt.colexiu.com/classroom-app/pdf/web/viewer.html?file=${encodeURIComponent(data.musicPdfUrl)}&t=${Date.now()}`;
-        data.iframeSrc = `${location.origin}/classroom-app/pdf/web/viewer.html?file=${encodeURIComponent(data.musicPdfUrl)}&t=${Date.now()}`;
+        data.iframeSrc = `${getHttpOrigin()}/classroom-app/pdf/web/viewer.html?file=${encodeURIComponent(data.musicPdfUrl)}&t=${Date.now()}`;
       } else {
         data.iframeSrc = `${vaildMusicScoreUrl()}/instrument/?id=${
           details?.id
@@ -663,7 +664,7 @@ export default defineComponent({
             : 'first';
         data.showMusicImg = musicImgType;
       }
-      
+
       data.showTransBtn = checkConverTible(isConvertibleScore, scoreType);
     };
     watch(
@@ -951,7 +952,7 @@ export default defineComponent({
                 {!data.musicPdfUrl && <div class={styles.musicName}>
                   {activeItem.value.musicSheetName}
                 </div>}
-                
+
 
                 <img
                   id="music-2"