Quellcode durchsuchen

在APP中跳转到学生详情

liushengqiang vor 2 Jahren
Ursprung
Commit
5db2c046c7

+ 24 - 11
src/views/home/component/Attendance.tsx

@@ -14,6 +14,8 @@ import * as echarts from 'echarts';
 import { IStudentAttendance } from '../type';
 import { useRouter } from 'vue-router';
 import icon_4 from '../image/icon_4.png';
+import { browser } from '@/helpers/utils';
+import { postMessage } from '@/helpers/native-message';
 
 type EChartsOption = echarts.EChartsOption;
 const colors = [
@@ -69,7 +71,7 @@ export default defineComponent({
   emits: ['change'],
   setup(props, { emit }) {
     const firstInit = ref(false);
-    const echratsRef = ref()
+    const echratsRef = ref();
     const router = useRouter();
     const { data } = toRefs(props);
     watch(
@@ -83,7 +85,7 @@ export default defineComponent({
     );
     let myChart: echarts.ECharts;
     const handleInit = () => {
-      if (!data.value.attendanceRate) return
+      if (!data.value.attendanceRate) return;
       if (myChart) {
         myChart.dispose();
       }
@@ -142,6 +144,24 @@ export default defineComponent({
 
       option && myChart.setOption(option);
     };
+
+    const gotoStudnetManage = () => {
+      if (browser().isApp) {
+        const url = `${location.origin}${location.pathname}student-manage`;
+        postMessage({
+          api: 'openWebView',
+          content: {
+            url,
+            orientation: 1,
+            isHideTitle: false
+          }
+        });
+      } else {
+        router.push({
+          path: '/student-manage'
+        });
+      }
+    };
     return () => (
       <div class={styles.item}>
         <div class={styles.top}>
@@ -152,22 +172,15 @@ export default defineComponent({
         <div class={styles.tabsContainer}>
           <Tabs
             shrink
-            active={"本周"}
+            active={'week'}
             onChange={value => {
-              console.log(value, 123);
               emit('change', value);
             }}>
             <Tab name="week" title="本周"></Tab>
             <Tab name="month" title="本月"></Tab>
             <Tab name="term" title="本学期"></Tab>
           </Tabs>
-          <div
-            class={styles.tagRight}
-            onClick={() => {
-              router.push({
-                path: '/student-manage'
-              });
-            }}>
+          <div class={styles.tagRight} onClick={() => gotoStudnetManage()}>
             学员信息 <Icon name="arrow" color="rgba(216,216,216,1)" />
           </div>
         </div>

+ 1 - 1
src/views/home/component/MusicGroup.tsx

@@ -136,7 +136,7 @@ export default defineComponent({
     const handleInit = () => {
       if (!list.value.length) return;
       const musicGrade = filterData(list.value);
-      console.log('🚀 ~ musicGrade:', musicGrade);
+      // console.log('🚀 ~ musicGrade:', musicGrade);
       if (myChart) {
         myChart.dispose();
       }

+ 1 - 1
src/views/home/component/Practice.tsx

@@ -46,7 +46,7 @@ export default defineComponent({
         <div class={styles.tabsContainer}>
           <Tabs
             shrink
-            active={"本周"}
+            active={"week"}
             onChange={value => {
               console.log(value);
               emit('change', value);

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

@@ -31,7 +31,6 @@ export default defineComponent({
           swipeThreshold={3}
           animated
           swipeable
-          lazyRender
           sticky>
           <Tab title="数据汇总">
             <ContentItem />