Browse Source

会员返回逻辑

黄琪勇 8 months ago
parent
commit
0d56b402ca
1 changed files with 9 additions and 8 deletions
  1. 9 8
      src/page-instrument/component/vip/index.tsx

+ 9 - 8
src/page-instrument/component/vip/index.tsx

@@ -8,6 +8,7 @@ import { storeData } from "/src/store"
 import { postMessage } from "/src/utils/native-message"
 import { usePageVisibility } from "@vant/use"
 import { studentQueryUserInfo } from "/src/page-instrument/api"
+import { api_back } from "/src/helpers/communication";
 
 export const vipData = reactive({
    show: false
@@ -60,6 +61,13 @@ export default defineComponent({
             vipData.show = false
          }
       }
+      function handleClose() {
+         if (state.isHomeWork) {
+            api_back()
+         } else {
+            vipData.show = false
+         }
+      }
       const pageVisibility = usePageVisibility()
       watch(pageVisibility, value => {
          if (state.isHomeWork && value === "visible") {
@@ -77,14 +85,7 @@ export default defineComponent({
       })
       return () => (
          <>
-            <Popup
-               zIndex={9999999}
-               show={vipData.show}
-               get-container="body"
-               closeable={!state.isHomeWork}
-               onClickCloseIcon={() => (vipData.show = false)}
-               round
-            >
+            <Popup zIndex={9999999} show={vipData.show} get-container="body" closeable onClickCloseIcon={handleClose} round>
                <div class={styles.vip}>
                   <img src={TipsIcon} />
                   <p>{getContent.value}</p>