Browse Source

用户信息同步修改

canghailong 6 months ago
parent
commit
5e65fe9159
2 changed files with 6 additions and 1 deletions
  1. 5 1
      src/views/portal/components/Header.vue
  2. 1 0
      src/views/student/user/index.vue

+ 5 - 1
src/views/portal/components/Header.vue

@@ -60,11 +60,15 @@
 	import { useRouter, useRoute } from 'vue-router'
 	import tool from '@/utils/tool'
 	import headerIcon from './headerIcon.vue'
+	import { globalStore } from '@/store'
 	const router = useRouter()
 	const route = useRoute()
 	const current = ref([route.path.slice(1)]) // 默认选中“资源中心”
 	const emit = defineEmits(['onChangeCurrent'])
-	const userInfo = tool.data.get('USER_INFO')
+	const store = globalStore()
+	const userInfo = computed(() => {
+		return store.userInfo
+	})
 
 	watch(route, (newValue) => {
 		current.value = []

+ 1 - 0
src/views/student/user/index.vue

@@ -126,6 +126,7 @@
 			// 更新缓存
 			tool.data.set('USER_INFO', userInfo.value)
 			global_store.setUserInfo(userInfo.value)
+			formData.value = cloneDeep(global_store.userInfo)
 		})
 	}