Browse Source

Merge branch 'master' of http://git.dayaedu.com/lex/orchestra-app

lex 2 năm trước cách đây
mục cha
commit
a970722ef6

+ 4 - 1
src/views/accompany/category.tsx

@@ -1,6 +1,6 @@
 import request from '@/helpers/request'
 import { state } from '@/state'
-import { Icon } from 'vant'
+import { Button, Icon } from 'vant'
 import { defineComponent, reactive, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
 import { getImage } from './images'
@@ -44,6 +44,9 @@ export default defineComponent({
             </div>
           )
         })}
+        <Button onClick={() => {
+            location.href = `http://192.168.3.114:1000/#/accompany`
+        }}>测试</Button>
       </div>
     )
   }

+ 6 - 0
src/views/accompany/index.module.less

@@ -43,6 +43,12 @@
     div{
         box-sizing: border-box;
     }
+    .heade{
+        position: fixed;
+        top: 0;
+        width: 100%;
+        z-index: 10;
+    }
     .filter{
         display: flex;
         align-items: center;

+ 10 - 5
src/views/accompany/index.tsx

@@ -1,6 +1,6 @@
 import request from '@/helpers/request'
 import { state } from '@/state'
-import { defineComponent, reactive, onMounted,watch } from 'vue'
+import { defineComponent, reactive, onMounted, watch } from 'vue'
 import { RouterView, useRoute } from 'vue-router'
 import Category from './category'
 import { getImage } from './images'
@@ -67,11 +67,16 @@ export default defineComponent({
       handleOpen()
     }
     const handleOpen = () => {
-      data.childPath = route.path.replaceAll('/', '')
+      const src: string = route?.path || 'accompany'
+    //   console.log('🚀 ~ route.path', src)
+      data.childPath = src.replace(/\//g, '') || 'accompany'
     }
-    watch(() => route.path, () => {
-        data.childPath = route.path.replaceAll('/', '')
-    })
+    watch(
+      () => route.path,
+      () => {
+        handleOpen()
+      }
+    )
     onMounted(() => {
       getTree()
     })

+ 42 - 16
src/views/accompany/music-list.tsx

@@ -1,7 +1,9 @@
 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 { useRect } from '@vant/use'
 import {
   Cell,
   CellGroup,
@@ -15,7 +17,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'
 
@@ -46,7 +48,7 @@ export default defineComponent({
     })
     const option1 = computed(() => {
       const v1: any = props.musicTree.find((n: any) => n.id == route.query.categorieid)
-      console.log('🚀 ~ v1', v1)
+    //   console.log('🚀 ~ v1', v1)
       if (Array.isArray(v1?.musicSheetCategoriesList)) {
         const list = v1.musicSheetCategoriesList.map((m: any) => {
           if (!data.value1) {
@@ -87,7 +89,7 @@ export default defineComponent({
         const res: any = await request.post(state.platformApi + '/musicSheet/page', {
           data: {
             ...data.pagenation,
-            keyword: data.keyword,
+            keyword: data.keyword
             // musicTag: data.value2 || data.value1
           }
         })
@@ -133,11 +135,7 @@ export default defineComponent({
     //进入云教练
     const openView = (item: any) => {
       const Authorization = sessionStorage.getItem('Authorization') || ''
-      const dev = /(localhost|192)/.test(location.host)
-      console.log(dev, 'https://ponline.colexiu.com')
-      let src = `${
-        dev ? `http://192.168.3.114:3000` : location.origin
-      }/orchestra-music-score/#/?id=${item.id}&Authorization=${Authorization}`
+      let src = `${location.origin}/orchestra-music-score/?id=${item.id}`
       postMessage({
         api: 'openAccompanyWebView',
         content: {
@@ -149,9 +147,17 @@ export default defineComponent({
         }
       })
     }
+    const headeRef = ref()
+    const headerData = reactive({
+        height: 0
+    })
+    onMounted(() => {
+        const rect = useRect(headeRef)
+        headerData.height = rect.height
+    })
     return () => (
       <div class={styles['accompany-music-list']}>
-        <Sticky>
+        <div class={styles.heade} ref={headeRef}>
           <DropdownMenu>
             <DropdownItem
               v-model:modelValue={data.value1}
@@ -196,7 +202,31 @@ export default defineComponent({
               }}
             </Search>
           </div>
-        </Sticky>
+        </div>
+        {headerData.height && <div style={{height: headerData.height + 'px'}}></div>}
+        <Cell
+          center
+          title="无别,胜强测试"
+          isLink
+          onClick={() => {
+            let src = `http://192.168.3.114:3000/orchestra-music-score/?id=1603573996544364546`
+            console.log("🚀 ~ 去云教练的src", src)
+            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}>
           <List
             immediateCheck={false}
@@ -210,12 +240,7 @@ export default defineComponent({
             <CellGroup inset>
               {data.list.map((item: any) => {
                 return (
-                  <Cell
-                    center
-                    title={item.musicSheetName}
-                    isLink
-                    onClick={() => openView(item)}
-                  >
+                  <Cell center title={item.musicSheetName} isLink onClick={() => openView(item)}>
                     {{
                       icon: () => (
                         <Icon style={{ marginRight: '12px' }} size={40} name={imgDefault} />
@@ -227,6 +252,7 @@ export default defineComponent({
             </CellGroup>
           </List>
         </PullRefresh>
+
         {!data.loading && !data.list.length && <OEmpty tips="空空如也" />}
       </div>
     )

+ 2 - 2
src/views/courseList/index.tsx

@@ -115,14 +115,14 @@ export default defineComponent({
             )
           })}
         </Grid>
-        <Button
+        {/* <Button
           onClick={() => {
             location.href =
               'http://192.168.3.114:1000/teacher.html#/coursewarePlay?id=1610595720511209474'
           }}
         >
           测试
-        </Button>
+        </Button> */}
         {!data.list.length && <Empty description="空空如也" />}
       </div>
     )

+ 13 - 16
src/views/coursewarePlay/component/musicScore.tsx

@@ -1,5 +1,6 @@
 import { defineComponent, ref, nextTick } from 'vue'
 import styles from './musicScore.module.less'
+import qs from 'query-string'
 
 export default defineComponent({
   name: 'musicScore',
@@ -7,27 +8,23 @@ export default defineComponent({
     music: {
       type: Object,
       default: () => {}
-    },
+    }
   },
   setup(props, {}) {
     const Authorization = sessionStorage.getItem('Authorization') || ''
-    const dev = /(localhost|192)/.test(location.host)
-    console.log(dev, 'https://ponline.colexiu.com')
-    let src = `${dev ? `http://192.168.3.114:3000` : location.origin}/orchestra-music-score/#/?id=${
-      props.music.content
-    }&Authorization=${Authorization}&modelType=practice`
+    const origin = /(localhost|192)/.test(location.host)
+      ? 'http://192.168.3.114:3000'
+      : location.origin
+    const query = qs.stringify({
+      id: props.music.content,
+      modelType: 'practice',
+      Authorization: Authorization
+    })
+    let src = `${origin}/orchestra-music-score/?` + query
     console.log('src', src)
-    
     return () => (
-      <div
-        class={styles.musicScore}
-      >
-        <iframe
-          class={[styles.container, 'musicIframe']}
-          frameborder="0"
-          src={src}
-        ></iframe>
-        {/* <div class={styles.musicModel}></div> */}
+      <div class={styles.musicScore}>
+        <iframe class={[styles.container, 'musicIframe']} frameborder="0" src={src}></iframe>
       </div>
     )
   }