|
@@ -49,7 +49,7 @@
|
|
|
<CopyLink v-if="showLink" @close="showLink = false" @done="done" />
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { ref, defineProps, onMounted, watchEffect } from 'vue'
|
|
|
+import { ref, defineProps, onMounted, watchEffect, inject } from 'vue'
|
|
|
import { http } from '@/utils/request'
|
|
|
import browser from '@/utils/browser'
|
|
|
import Toast from '@/components/dialog/Toast'
|
|
@@ -64,7 +64,7 @@ const props = defineProps({
|
|
|
showAdjust: Boolean,
|
|
|
})
|
|
|
const emits = defineEmits(['update', 'getUserId'])
|
|
|
-
|
|
|
+const isLogin = inject('isLogin')
|
|
|
const user = ref(null)
|
|
|
const points = ref({ p1: null, p2: null })
|
|
|
const showLink = ref(false)
|
|
@@ -78,7 +78,8 @@ const done = () => {
|
|
|
}
|
|
|
const getUser = info => {
|
|
|
user.value = info
|
|
|
- emits('getUserId', localStorage.getItem('userId'))
|
|
|
+ isLogin.value = true
|
|
|
+ // emits('getUserId', localStorage.getItem('userId'))
|
|
|
}
|
|
|
const openLink = () => {
|
|
|
showLink.value = true
|
|
@@ -129,6 +130,7 @@ const getUserInfo = () => {
|
|
|
nickName: response.data.nickName,
|
|
|
}
|
|
|
localStorage.setItem('userId', response.data.id)
|
|
|
+ isLogin.value = true
|
|
|
} else {
|
|
|
if (response.code == 4008) {
|
|
|
// 未登录
|
|
@@ -149,7 +151,8 @@ const onLogout = () => [
|
|
|
localStorage.removeItem('password')
|
|
|
localStorage.removeItem('userId')
|
|
|
user.value = null
|
|
|
- emits('getUserId', null)
|
|
|
+ // emits('getUserId', null)
|
|
|
+ isLogin.value = false
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {}),
|