|
|
|
@ -1,5 +1,10 @@ |
|
|
|
<template> |
|
|
|
<div class="home app_content"> |
|
|
|
<!-- 全局 Loading --> |
|
|
|
<van-loading v-if="isLoading" class="global-loading" type="spinner" size="36px" color="#2b7de9" vertical> |
|
|
|
加载中... |
|
|
|
</van-loading> |
|
|
|
|
|
|
|
<!-- 顶部蓝色背景区域 --> |
|
|
|
<div class="header-bg"> |
|
|
|
<div class="header-city-bg"></div> |
|
|
|
@ -96,6 +101,9 @@ const { useCommon } = $globalStore; |
|
|
|
// 是否执法人员(hasLaw=true 时所有模块可用,false 时仅非行政执法可用) |
|
|
|
const hasLaw = computed(() => !!useCommon.hasLaw); |
|
|
|
|
|
|
|
// ========== 全局 Loading ========== |
|
|
|
const isLoading = ref(true); |
|
|
|
|
|
|
|
// 非执法人员点击受限模块时的提示 |
|
|
|
const checkLawPermission = () => { |
|
|
|
if (!hasLaw.value) { |
|
|
|
@ -120,7 +128,6 @@ const noticeText = computed(() => { |
|
|
|
const fetchNoticeList = () => { |
|
|
|
getNoticeInfoList({}, (res) => { |
|
|
|
if (res && res.rows) { |
|
|
|
// 接口返回结构为 { total, rows, code, msg } |
|
|
|
noticeList.value = res.rows || []; |
|
|
|
} |
|
|
|
}, (err) => { |
|
|
|
@ -134,7 +141,6 @@ const bannerList = ref([]); |
|
|
|
const fetchBannerList = () => { |
|
|
|
getCarouselBannerList({}, (res) => { |
|
|
|
if (res && res.rows) { |
|
|
|
// 接口返回结构为 { total, rows, code, msg } |
|
|
|
bannerList.value = (res.rows || []).map(item => ({ |
|
|
|
...item, |
|
|
|
imageUrl: baseUrl + item.imageUrl |
|
|
|
@ -195,33 +201,44 @@ const toBannerDetail = (item) => { |
|
|
|
|
|
|
|
// ========== 页面挂载 ========== |
|
|
|
onMounted(() => { |
|
|
|
// new Vconsolefrom(); |
|
|
|
console.log("执法端 Home onMounted"); |
|
|
|
let fullUrl = window.location.href; |
|
|
|
console.log(fullUrl) |
|
|
|
let code = fullUrl.substring(fullUrl.indexOf("code=") + 5, fullUrl.indexOf("&state=")); |
|
|
|
console.log(code) |
|
|
|
|
|
|
|
isLoading.value = useCommon.firstLoad; |
|
|
|
|
|
|
|
// 安全超时:20秒后强制关闭loading,防止异常导致一直转圈 |
|
|
|
setTimeout(() => { |
|
|
|
isLoading.value = false; |
|
|
|
}, 20000); |
|
|
|
|
|
|
|
if (useCommon.token) { |
|
|
|
isLoading.value = false; |
|
|
|
fetchNoticeList(); |
|
|
|
fetchBannerList(); |
|
|
|
return; |
|
|
|
} |
|
|
|
// isLoading.value = useCommon.firstLoad; |
|
|
|
|
|
|
|
getSzyptLoginAuth(code, (success) => { |
|
|
|
console.log("登录成功: ", success.data); |
|
|
|
useCommon.SET_USER_ID(success.data.userId); |
|
|
|
useCommon.SET_TOKEN(success.data.token); |
|
|
|
useCommon.SET_HAS_LAW(success.data.lawOfficer); |
|
|
|
useCommon.SET_ORG_ID(success.data.bureauDept.deptId); |
|
|
|
// isLoading.value = false; |
|
|
|
//设置已经初始化 |
|
|
|
useCommon.SET_IS_FIRST_LOAD(false); |
|
|
|
console.log(useCommon) |
|
|
|
|
|
|
|
useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
|
useCommon.SET_USER_ID(response.data.userId); |
|
|
|
useCommon.SET_USER_NAME(response.data.userName || ""); |
|
|
|
useCommon.SET_NICK_NAME(response.data.nickName || ""); |
|
|
|
useCommon.SET_TOKEN(response.data.token); |
|
|
|
useCommon.SET_DEPT_ID(response.data.deptId); |
|
|
|
useCommon.SET_DEPT_NAME(response.data.deptName || ""); |
|
|
|
useCommon.SET_ORGAN_ID(response.data.organId); |
|
|
|
useCommon.SET_ORGAN_NAME(response.data.organName || ""); |
|
|
|
useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId); |
|
|
|
useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || ""); |
|
|
|
useCommon.SET_HAS_LAW(response.data.lawOfficer || ""); |
|
|
|
isLoading.value = false; |
|
|
|
fetchNoticeList(); |
|
|
|
fetchBannerList(); |
|
|
|
}, (error) => {}, |
|
|
|
); |
|
|
|
}, (error) => { |
|
|
|
isLoading.value = false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
</script> |
|
|
|
@ -235,6 +252,20 @@ onMounted(() => { |
|
|
|
background: #fbfdff; |
|
|
|
} |
|
|
|
|
|
|
|
/* ===== 全局 Loading ===== */ |
|
|
|
.global-loading { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
right: 0; |
|
|
|
bottom: 0; |
|
|
|
background: rgba(255, 255, 255, 0.85); |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
z-index: 9999; |
|
|
|
} |
|
|
|
|
|
|
|
/* ===== 顶部蓝色背景区域 ===== */ |
|
|
|
.header-bg { |
|
|
|
text-align: center; |
|
|
|
|