jinx пре 2 година
родитељ
комит
3633eca7fc
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      src/components/header/index.vue

+ 3 - 2
src/components/header/index.vue

@@ -63,6 +63,7 @@ const props = defineProps({
     project: Object,
     showAdjust: Boolean,
 })
+const projectId = browser.valueFromUrl('projectId') || ''
 const emits = defineEmits(['update', 'getUserId'])
 const isLogin = inject('isLogin')
 const isAuth = inject('isAuth')
@@ -132,7 +133,7 @@ const onSetP2 = () => {
     emits('update', 'p2', points.value.p2)
 }
 const getAuth = () => {
-    http.post(`smart-site/validatedProject/${props.project.projectId}`)
+    http.post(`smart-site/validatedProject/${projectId}`)
         .then(res => {
             if (res.code == 0) {
                 isAuth.value = true
@@ -147,13 +148,13 @@ const getUserInfo = () => {
     http.post(`smart-site/getUserInfo`)
         .then(response => {
             if (response.success) {
-                getAuth()
                 user.value = {
                     head: response.data.head,
                     nickName: response.data.nickName,
                 }
                 localStorage.setItem('userId', response.data.id)
                 isLogin.value = true
+                getAuth()
             } else {
                 if (response.code == 4008) {
                     // 未登录