bzkf3 преди 2 години
родител
ревизия
7c0aadfc89
променени са 3 файла, в които са добавени 10 реда и са изтрити 7 реда
  1. 3 3
      src/pages/_home/index.vue
  2. 6 4
      src/pages/_user/index.vue
  3. 1 0
      src/store/child.js

+ 3 - 3
src/pages/_home/index.vue

@@ -39,9 +39,9 @@ function gridHandle(item) {
     } else {
       switch (user._role) {
         case 'jz':
-          // if(!child){
-          //   return showToast('家长需绑定孩子方可进入')
-          // }
+          if(!child){
+            return showToast('家长需绑定孩子方可进入')
+          }
           // window.open('https://nmlm.bozedu.net/#/stxk/jz', '_self')
           router.push('/stxk/jz')
           return

+ 6 - 4
src/pages/_user/index.vue

@@ -176,6 +176,7 @@
 </template>
 <script>
 import { showToast } from "vant";
+import { setChild } from "~/store/child";
 
 export default {
   data() {
@@ -283,10 +284,11 @@ export default {
       this.childId = item.user_role_id;
       this.childName = item.user_realname;
       this.activeChild = item.user_id;
-      localStorage.setItem(
-        "childInfo_" + this.userInfo.user_id,
-        JSON.stringify(item)
-      );
+      // localStorage.setItem(
+      //   "childInfo_" + this.userInfo.user_id,
+      //   JSON.stringify(item)
+      // );
+      setChild(item);
     },
     submitDM() {
       showToast("切换成功~");

+ 1 - 0
src/store/child.js

@@ -1,6 +1,7 @@
 import { user } from './user';
 
 export let child = JSON.parse(localStorage.getItem(`childInfo_${user?.user_id}`))
+console.log('child', child)
 
 export function setChild(data) {
   child = data;