Browse Source

日常开发

linxuxiang 1 week ago
parent
commit
3594c5575a
2 changed files with 10 additions and 20 deletions
  1. 10 16
      src/components/Header/index.vue
  2. 0 4
      src/types/components.d.ts

+ 10 - 16
src/components/Header/index.vue

@@ -136,22 +136,16 @@ const getMusic = async () => {
 
 //获取个人信息
 const getUserInfo = () => {
-  //用户信息
-  const myInfo: any = localStorage.getItem('userInfo');
-  if (myInfo) {
-    userInfo.value = JSON.parse(myInfo);
-  } else {
-    let params = {};
-    proxy?.$http.common.getUserInfo(params).then((res: any) => {
-      //保存信息
-      if (res.data.length) {
-        let myData = res.data[0];
-        userInfo.value = myData;
-        let info: any = JSON.stringify(myData);
-        localStorage.setItem("userInfo", info);
-      }
-    });
-  }
+  let params = {};
+  proxy?.$http.common.getUserInfo(params).then((res: any) => {
+    //保存信息
+    if (res.data.length) {
+      let myData = res.data[0];
+      userInfo.value = myData;
+      let info: any = JSON.stringify(myData);
+      localStorage.setItem("userInfo", info);
+    }
+  });
 };
 
 onBeforeMount(() => {

+ 0 - 4
src/types/components.d.ts

@@ -9,15 +9,11 @@ declare module 'vue' {
   export interface GlobalComponents {
     ChooseStudent: typeof import('./../components/ChooseStudent/index.vue')['default']
     copy: typeof import('./../components/SquareGame/index copy.vue')['default']
-    ElIcon: typeof import('element-plus/es')['ElIcon']
-    ElInput: typeof import('element-plus/es')['ElInput']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElSelect: typeof import('element-plus/es')['ElSelect']
-    ElSwitch: typeof import('element-plus/es')['ElSwitch']
     FaceWindow: typeof import('./../components/FaceWindow/index.vue')['default']
     Header: typeof import('./../components/Header/index.vue')['default']
     'Index copy': typeof import('./../components/SquareGame/index copy.vue')['default']
-    Index2: typeof import('./../components/SquareGame/index2.vue')['default']
     JumpRopeGame: typeof import('./../components/JumpRopeGame/index.vue')['default']
     MultipleItem: typeof import('./../components/MultipleItem/index.vue')['default']
     MultipleItemRanking: typeof import('./../components/MultipleItemRanking/index.vue')['default']