feat(salon): 服务端拦截未同意最新协议的用户并补充端侧 4510 处理
自动发布开发环境 Nacos 配置 / publish (push) Successful in 18s

This commit is contained in:
2026-11-05 09:43:01 +08:00
parent 88589e2575
commit fb19fcf05f
10 changed files with 503 additions and 45 deletions
@@ -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>