This commit is contained in:
@@ -93,7 +93,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { DownOutlined, HomeOutlined, LogoutOutlined, MenuFoldOutlined, MenuOutlined, MenuUnfoldOutlined, SafetyCertificateOutlined, TeamOutlined, ToolOutlined, UserOutlined } from '@ant-design/icons-vue'
|
||||
@@ -104,7 +104,7 @@ import { completeAdminLogout } from '@/utils/admin-logout'
|
||||
import { runWithGlobalLoading } from '@/utils/action-loading'
|
||||
import { useAdminViewport } from '@/composables/useAdminViewport'
|
||||
import { legalAgreementApi, type AgreementPending } from '@/api/auth'
|
||||
import { setAgreementPending } from '@/utils/agreement-gate'
|
||||
import { AGREEMENT_REQUIRED_EVENT, setAgreementPending } from '@/utils/agreement-gate'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
@@ -157,10 +157,18 @@ const acceptAgreements = async () => {
|
||||
}
|
||||
|
||||
watch(() => route.path, path => { selectedKeys.value = [path] }, { immediate: true })
|
||||
/**
|
||||
* 服务端返回 4510 时由请求层广播该事件,这里复用既有弹层逻辑重新检查协议状态。
|
||||
*/
|
||||
const handleAgreementRequired = () => { checkAgreementGate() }
|
||||
onMounted(() => {
|
||||
try { userInfo.value = JSON.parse(localStorage.getItem('adminUserInfo') || 'null') } catch { userInfo.value = null }
|
||||
window.addEventListener(AGREEMENT_REQUIRED_EVENT, handleAgreementRequired)
|
||||
checkAgreementGate()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener(AGREEMENT_REQUIRED_EVENT, handleAgreementRequired)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user