Browse Source

修改返回

lex 2 years ago
parent
commit
7e01249151

+ 4 - 4
src/school/companion-teacher/companion-teacher-register.module.less

@@ -224,15 +224,15 @@ span {
   padding: 0 13px;
   font-size: 12px;
   color: #aaaaaa;
-  line-height: 17px;
+  // line-height: 17px;
   :global {
     .van-checkbox {
       flex-shrink: 0;
     }
   }
-  & > div {
-    flex: 1 auto;
-  }
+  // & > div {
+  //   flex: 1 auto;
+  // }
 }
 
 .protocol .c {

+ 13 - 1
src/school/companion-teacher/index.tsx

@@ -20,7 +20,7 @@ import {
   showToast,
   Tag
 } from 'vant'
-import { defineComponent, onMounted, reactive } from 'vue'
+import { defineComponent, onMounted, onUnmounted, reactive } from 'vue'
 import styles from './index.module.less'
 import iconSaveImage from '@/school/orchestra/images/icon-save-image.png'
 import iconWechat from '@/school/orchestra/images/icon-wechat.png'
@@ -162,6 +162,18 @@ export default defineComponent({
     onMounted(async () => {
       getSubjects()
       getList()
+
+      // 处理返回上一页的问题
+      window.history.pushState(null, '', document.URL)
+      window.addEventListener('popstate', onBack, false)
+    })
+
+    const onBack = () => {
+      postMessage({ api: 'back' })
+    }
+
+    onUnmounted(() => {
+      window.removeEventListener('popstate', onBack)
     })
     return () => (
       <div class={!form.listState.dataShow && 'emptyRootContainer'}>

+ 1 - 2
src/school/manage-teacher/manage-teacher-register.module.less

@@ -225,14 +225,13 @@ span {
   padding: 0 13px;
   font-size: 12px;
   color: #aaaaaa;
-  line-height: 17px;
   :global {
     .van-checkbox {
       flex-shrink: 0;
     }
   }
   & > div {
-    flex: 1 auto;
+    // flex: 1 auto;
   }
 }