You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

784 lines
24 KiB

<template>
<!--<Loading class="loading-div" type="spinner" v-show="isLoading" color="#1989fa"/>-->
<div class="home app_content" v-if="!isLoading">
<!-- <div class="home app_content"> -->
<!-- 导航栏 -->
<!-- <div class="header_body">
<header-nav :leftArrow="false" titelText="执法监督码"></header-nav>
</div> -->
<!-- 中间 -->
<div class="warp_body">
<div class="logobox"></div>
<div class="noticeContent">
<ul v-if="data.notNull" class="notice_list" :class="data.noticeList.length>1?{notice_top:freshMap.animate}:''">
<li v-for="(item, index) in data.noticeList" :key="index" @click="toNoticeDetail(item) ">
<span>{{item.content}}</span>
<van-icon name="arrow" />
</li>
</ul>
<ul v-else class="notice_list" >
<li>近一星期暂无通知消息</li>
</ul>
</div>
<div class="carousel_box" @onLoad="onLoad">
</div>
<div class="boutique_box">
<!-- <van-cell :border="false" title="精品" /> -->
<div class="boutique_body">
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> -->
<!-- <div class="box-qr-code" @click="toScanCodeView">
<span class="box-qr-code-text">扫码入企</span>
</div> -->
<div class="box-qr-code">
<span class="box-qr-code-text">扫码入企</span>
<div class="link-text"><span @click="toScanCodeView">行政执法<van-icon name="arrow" /></span><span @click="toNonLawView">非行政执法<van-icon name="arrow" /></span></div>
</div>
</div>
<div class="boutique_body">
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> -->
<div class="box-info" @click="toRegistrationListView">
<span class="box-info-text">行政执法信息</span>
</div>
<div class="box-complaint" @click="toAnalyseView">
<span class="box-complaint-text">统计分析</span>
</div>
</div>
</div>
</div>
<!-- 底部 -->
<div class="footer_body" v-if="useCommon.hasLaw">
<footer-enforcement-nav></footer-enforcement-nav>
</div>
</div>
</template>
<script setup name="Home">
import Vconsolefrom from 'vconsole';
import {Loading, showFailToast,showToast, showSuccessToast} from 'vant';
import {getEnterpriseMerchantAuthorization} from '../api/enterprise';
import {getSzyptLoginAuth} from '../api/Home';
import {queryEnforcementNotice} from "@/api/enforce";
const isLoading = ref(true);
const {useCommon} = $globalStore;
const router = useRouter();
const route = useRoute();
var carouselList = reactive([]); // 轮播列表
let boutique = reactive([]); // 精品数据
let recommend = reactive([]); // 推荐
let freshMap = reactive({
refreshLoad: false, // 是否刷新
listLoading: false, // 是否加载中
listFinished: false, // 是否加载完成标识
key: 0,
animate: false
});
const noticeList = [];
// 模拟异步数据加载
// setTimeout(() => {
// // 如果不是执法用户 则跳转
// router.push(
// {
// path: "/noAccess"
// });
// isLoading.value = false;
// }, 3000);
//定时器
let noticeObj = reactive({
noticeList: [],
notificationtext: "",
noticeTimer: null,
itemWidth: 0,
offset: 0,
step: 3,
speed: 20,
});
const data = reactive({
noticeList: [],
notNull:true
});
const adviceList = reactive([]);
const boutiqueAttr = reactive({
columnNum: 4,
itemClass: "boutique_item",
goodsCradclass: "boutique-crad",
}); // 商品卡片展示
//获取轮播
const getCarousel = async () => {
// const res = await useHome.getCarousel();
// if (res?.code === 20000) {
// carouselList = res?.data;
// }
};
//精品
const boutiqueGoods = async () => {
// const res = await useHome.boutiqueGoods();
// if (res?.code === 20000) {
// boutique = res?.data;
// }
};
var noticeStr = reactive("");
/**扫码入企 */
const toScanCodeView = async () => {
if (useCommon.hasLaw) {
// 执法人员才有权限进入
router.push({path: "/enforce/scanQrCode"});
} else {
showFailToast('非行政执法人员无法使用该功能');
}
};
/** 非行政执法 */
const toNonLawView = async () => {
// 所有人都有权限进入
router.push({path: "/non-scan"});
};
const toRegistrationListView = async () => {
if (useCommon.hasLaw) {
// 执法人员才有权限进入
router.push({path: "/historyCheck"});
} else {
showFailToast('非行政执法人员无法使用该功能');
}
}
const toComplaintView = async () => {
router.push({
path: "/enterprise/complaint",
});
}
const toAnalyseView = async () => {
/* router.push({path: "/analyse"}); */
if (useCommon.hasLaw) {
// 执法人员才有权限进入
router.push({path: "/comprehensiveAnalysis"});
} else {
showFailToast('非行政执法人员无法使用该功能');
}
}
const toNoticeView = async () => {
router.push({
path: "/enforce/enforceNotice",
});
}
const toNoticeDetail = async (item) => {
if (null != item) {
router.push(
{
path: "/enforce/enforceNotice",
query: {
type:item.type
}
});
} else {
showFailToast("没有执行计划")
}
}
const queryList = () => {
queryEnforcementNotice({isPublish:1,dateType:4}, success => {
/* if (success.rows.length > 4) {
for (let i = 0; i < 5; i++) {
carouselList.push(success.rows[i]);
noticeObj.noticeList.push(success.rows[i].planName)
var obj = {
id: success.rows[i].id,
content: success.rows[i].planName,
url: null!=success.rows[i].fileObject?success.rows[i].fileObject.fileUrl:null,
}
data.noticeList.push(obj)
// noticeStr += success.data[i].planName + " ";
// noticeStr += success.data[i].planName != null ?success.data[i].planName + "":"";
}
noticeStr += success.rows[0].planName != null ? success.rows[0].planName + "" : "";
} else { */
carouselList = success.rows;
if(carouselList.length==0){
data.notNull=false
}
for (let index = 0; index < success.rows.length; index++) {
const element = success.rows[index];
console.log(element);
// element.planName = element.planYear + element.planName;
if(element.timeType == 'quarter'){
let val = "";
if(element.quarter == "1") val = "一季度";
if(element.quarter == "2") val = "二季度";
if(element.quarter == "3") val = "三季度";
if(element.quarter == "4") val = "四季度";
element.planName = element.planYear + "年" + val + element.planName;
}else if (element.timeType == 'mouth') {
const val = element.mouth + "月";
element.planName = element.planYear + "年" + val + element.planName;
}
element.planName = element.bureauDeptName + element.planName;
noticeObj.noticeList.push(element.planName);
var obj = {
content: element.planName,
id:element.id,
type:element.type
}
data.noticeList.push(obj)
}
freshMap.key = 1
console.log(carouselList);
console.log(data.noticeList);
// timerObj.timer = setInterval(flushMessage, 4000);
setNotificationMove();
}, error => {
})
}
const flushMessage = () => {
timerObj.value++;
freshMap.key = timerObj.value;
if (carouselList.length == timerObj.value) {
timerObj.value = 0;
}
freshMap.key = timerObj.value;
noticeStr = carouselList[timerObj.value].planName
}
//下拉刷新
const onRefresh = () => {
freshMap.listFinished = false;
freshMap.listLoading = true;
freshMap.refreshLoad = true;
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => {
// freshMap.refreshLoad = false;
// });
};
// 触底加载
const onLoad = () => {
// recommendGoods(true);
};
onMounted(() => {
// new Vconsolefrom();
let fullUrl = window.location.href;
let code = fullUrl.substring(fullUrl.indexOf('code=') + 5, fullUrl.indexOf('&state='));
console.log(useCommon.firstLoad)
isLoading.value = useCommon.firstLoad;
// getSzyptLoginAuth(route?.query?.code,success =>{
getSzyptLoginAuth(code, success => {
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);
useCommon.SET_ORG_ID("20210922212955057-A601-27251E588");
// useCommon.SET_HAS_LAW(true);
// if (useCommon.firstLoad) {
isLoading.value = false;
// }
//设置已经初始化
useCommon.SET_IS_FIRST_LOAD(false)
queryList();
// 如果不是执法用户 则跳转
// if (!success.data.lawOfficer) {
// // router.replace({ path: "/noAccess" });
// }
}, error => {
queryList();
})
setInterval(showNotice, 3000);
// isLoading.value = false;
// queryList();
});
const setNotificationMove = () => {
// 清除定时器
clearInterval(noticeObj.noticeTimer);
const notificationContainer = document.getElementById(
"notification-container"
);
const notificationWidth = notificationContainer.offsetWidth;
let index = 0;
// 播报内容赋值
noticeObj.notificationtext = noticeObj.noticeList[index];
const notification = document.getElementById("notification");
noticeObj.offset = notificationWidth;
// 初始化x轴平移距离
notification.style.transform = `translateX(${noticeObj.offset}px)`;
// 当前通知的宽度
noticeObj.itemWidth = noticeObj.notificationtext.length * 20;
noticeObj.noticeTimer = setInterval(() => {
noticeObj.offset -= noticeObj.step;
if (noticeObj.offset < -noticeObj.itemWidth) {
noticeObj.offset = notificationWidth;
if (index >= noticeObj.noticeList.length - 1) {
index = 0;
} else {
index++;
}
noticeObj.notificationtext = noticeObj.noticeList[index];
noticeObj.itemWidth = noticeObj.notificationtext.length * 20;
}
notification.style.transform = `translateX(${noticeObj.offset}px)`;
}, noticeObj.speed);
}
const delayNoticeMove = () => {
const notification = document.getElementById("notification");
let currentOffset = notification.style.transform;
if (currentOffset) {
currentOffset = currentOffset.split("(")[1];
currentOffset = currentOffset.substring(0, currentOffset.indexOf("px"));
let duration = ((Number(currentOffset) + noticeObj.itemWidth) / noticeObj.step) * noticeObj.speed;
// 判断当前还有多久滚动完毕 添加一个setTimeout等待滚动结束后重新计时
setTimeout(() => {
this.setNotificationMove();
}, duration);
} else {
this.setNotificationMove();
}
}
const showNotice = () => {
freshMap.animate = true
setTimeout(() => {
data.noticeList.push(data.noticeList[0])
data.noticeList.shift()
freshMap.animate = false
}, 500)
}
</script>
<style lang="less" scoped>
.home {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background-color: #f4f4f4;
.warp_body {
position: relative;
margin: 0;
width: 100%;
height: 100%;
background: #c6e6ff url("../assets/images/bg_el.jpg") no-repeat top;
background-size: auto 100%;
overflow-x: hidden;
overflow-y: auto;
.carousel_box {
height: 4rem;
width: 100%;
padding-bottom: 0.27rem;
}
}
.boutique_box {
position: absolute;
width: 100%;
bottom: 0.5rem;
.boutique_body {
padding: 0 0 0.27rem 0;
display: flex;
justify-content: center;
}
.box-qr-code {
position: relative;
margin: 2% 0;
width: 90%;
height: 3.67rem;
text-align: right;
border-radius: 0.27rem;
.box-qr-code-text {
position: absolute;
z-index: 10;
top: 6%;
left: 2.65rem;
display: block;
font-size: 0.5rem;
}
}
.box-qr-code::before {
content: "";
position: absolute;
top: -0.14rem;
left: -0.14rem;
z-index: 0;
width: calc(100% + 0.13rem);
height: calc(100% + 0.13rem);
background-color: #fff;
border: 0.14rem solid rgba(255, 255, 255, 0.5);
border-radius: 0.27rem;
}
.box-qr-code::after {
content: "";
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
border-radius: 0.27rem;
background: #fff url("../assets/images/item_scan2.jpg") no-repeat left;
background-size: auto 100%;
border: 0.01rem solid #8db4ff;
}
.box-info {
position: relative;
margin-right: 2%;
width: 50%;
height: 3.67rem;
text-align: right;
border-radius: 0.27rem;
.box-info-text {
position: absolute;
z-index: 10;
top: 6%;
right: 0.35rem;
display: block;
font-size: 0.5rem;
}
}
.box-info::before {
content: "";
position: absolute;
top: -0.14rem;
left: -0.14rem;
z-index: 0;
width: calc(100% + 0.13rem);
height: calc(100% + 0.13rem);
background-color: #fff;
border: 0.14rem solid rgba(255, 255, 255, 0.5);
border-radius: 0.27rem;
}
.box-info::after {
content: "";
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
border-radius: 0.27rem;
background: #fff url("../assets/images/item_check.jpg") no-repeat left;
background-size: auto 100%;
border: 1px solid #8db4ff;
}
.box-complaint {
position: relative;
margin-left: 3%;
width: 35%;
height: 3.67rem;
text-align: right;
border-radius: 0.27rem;
.box-complaint-text {
position: absolute;
z-index: 10;
top: 6%;
right: 0.35rem;
display: block;
font-size: 0.5rem;
}
}
}
.box-complaint::before {
content: "";
position: absolute;
top: -0.14rem;
left: -0.14rem;
z-index: 0;
width: calc(100% + 0.13rem);
height: calc(100% + 0.13rem);
background-color: #fff;
border: 0.14rem solid rgba(255, 255, 255, 0.5);
border-radius: 0.27rem;
}
.box-complaint::after {
content: "";
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
border-radius: 0.27rem;
background: #fff url("../assets/images/item_count.jpg") no-repeat left;
background-size: auto 100%;
border: 0.01rem solid #8db4ff;
}
.recommend_box {
.recommend_body {
width: 100%;
}
}
}
.streamer {
display: flex;
position: absolute;
top: calc(1% + 10vh);
right: 3%;
z-index: 999;
padding: 0 0.25rem;
width: 90%;
min-height: 1rem;
background-color: rgba(249, 238, 219, .9);
border-radius: 0.5rem;
color: #c35b01;
font-size: 0.42rem;
line-height: 1.0rem;
white-space: nowrap;
box-sizing: content-box;
}
.noticbox {
display: flex;
position: absolute;
top: calc(1% + 10vh);
right: 3%;
z-index: 999;
padding: 0 0.25rem;
width: 90%;
min-height: 1rem;
background-color: rgba(249, 238, 219, .9);
border-radius: 0.5rem;
color: #c35b01;
font-size: 0.42rem;
line-height: 1.0rem;
white-space: nowrap;
box-sizing: content-box;
}
.noticbox {
top: 33%;
right: 0;
padding: 0 0.2rem;
width: 1.9rem;
min-height: 1rem;
background-color: rgba(249, 238, 219, .7);
border-radius: 0.5rem 0 0 0.5rem;
color: #000;
}
.streamer > i, .noticbox > i {
display: inline-block;
position: relative;
top: 0.18rem;
margin: 0 0.3rem 0 0;
width: 0.6rem;
height: 0.6rem;
background: url("../assets/images/icon_notice.png") no-repeat;
background-size: auto 100%;
}
.noticbox > i {
top: 0.1rem;
margin: 0 0.2rem 0 0;
width: 0.8rem;
height: 0.8rem;
background: url("../assets/images/icon_notice3.png") no-repeat;
background-size: auto 100%;
}
.streamer .marquee {
display: inline-block;
width: calc(100% - 1rem); /* 或者你想要的宽度 */
overflow: hidden;
white-space: nowrap;
}
::v-deep .scroll-text {
display: inline-block;
padding-left: 100%; /* 初始时隐藏在右侧 */
animation: marquee 5s linear infinite; /* 设置动画 */
}
@keyframes marquee {
0% {
transform: translateX(0);
}
/* 动画开始时 */
100% {
transform: translateX(-100%);
}
/* 动画结束时,文字完全移动到左侧并重新开始 */
}
.noticbox span.new {
display: block;
position: absolute;
top: 0.1rem;
left: 0.85rem;
width: 0.2rem;
height: 0.2rem;
background: #ff1414;
border-radius: 50%;
}
.logobox {
position: relative;
top: 4%;
left: 5%;
z-index: 99;
width: 82%;
height: 10vh;
background: url("../assets/images/logo.png") no-repeat;
background-size: 100% auto;
}
.loading-div {
position: absolute;
top: 45%;
left: 48%;
}
.notice-bar-container {
margin-bottom: 0.27rem;
}
.notice-bar-container:last-child {
margin-bottom: 0;
}
@media screen and (max-width: 380px) {
.home .warp_body {
background: #c6e6ff url("../assets/images/bg_el.jpg") no-repeat top;
background-size: 100% auto;
}
}
@media screen and (min-width: 540px) {
.home .warp_body {
background: #c6e6ff url("../assets/images/bg_el.jpg") no-repeat top;
background-size: 100% auto;
}
}
.noticeContent {
position: absolute;
top: calc(2% + 10vh);
right: 3%;
z-index: 999;
padding: 0 0.25rem 0 1rem;
width: 94%;
min-height: 1rem;
background-color: rgba(249, 238, 219, 0.85);
border-radius: 0.25rem;
color: #df6104;
box-sizing: border-box;
overflow: hidden;
}
.noticeContent ul {
width: 100%;
}
.noticeContent li {
display: flex;
position: relative;
margin: 0.27rem 0 0 0;
padding: 0 0.25rem 0 1rem;
width: 100%;
text-align: left;
line-height: 1.25;
height: 0.5rem;
font-size: 0.37rem;
white-space: nowrap;
}
.noticeContent li::before {
display: inline-block;
position: absolute;
top: 0;
left: 0.3rem;
content: "";
width: 0.5rem;
height: 0.5rem;
background: url("../assets/images/icon_notice.png") no-repeat;
background-size: auto 85%;
}
.noticeContent li span {
width: calc(100% - 1.6rem);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box;
}
.notice_list {
display: block;
position: absolute;
top: 0;
left: 0;
}
.notice_list li i {
float: right;
margin-top: 0.05rem;
}
.notice_top {
transition: all 0.5s;
margin-top: -30px;
}
.link-text {
position: absolute;
z-index: 10;
top: 10%;
right: 0.35rem;
font-size: 0.4rem;
color: #666;
}
.link-text span {
position: relative;
display: flex;
align-items: center;
margin: 16% 0;
padding: 0.15rem 0.2rem;
width: 2.5rem;
background-color: #e3f3ff;
border: 0.02667rem solid #c6e6ff;
border-radius: 0.15rem;
box-shadow: 0 0 0.15rem #c4d7f7;
line-height: 1.5;
text-align: left;
}
.link-text span:first-child {
background-color: #336bff;
border-color: #336bff;
box-shadow: 0 0 0.15rem #2660f9;
color: #fff;
}
.link-text span i.van-icon {
position: absolute;
right: 0.1rem;
}
</style>