Files
zhgh_hrbnu/src/main/resources/views/mobile/home.html
T
2024-11-22 16:56:54 +08:00

474 lines
16 KiB
HTML

<!--#
layout("/mobile/platform.html"){
#-->
<style>
#app {
background-color: #f6f7f9;
}
.swiper {
height: 200px;
}
.swiper img {
height: 200px;
}
.module {
margin: 10px 10px 20px 10px;
box-shadow: 0 8px 12px #ebedf0;
border-radius: 10px;
}
.van-sidebar-item {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
font-weight: bold;
}
.menu {
display: flex;
flex-wrap: wrap;
row-gap: 10px;
background-color: white;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
padding: 6px 0px;
}
.menu_item {
width: calc(100% / 4);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 2px 0;
position: relative;
}
.menu_item_img {
width: 46px;
height: 46px;
}
.menu_item_name {
white-space: nowrap;
overflow: hidden;
width: 80%;
text-align: center;
font-size: 12px;
font-family: "微软雅黑", Helvetica, STHeiTi, sans-serif;
color: grey;
}
.number_text {
font-size: 36px;
color: #409eff;
}
.van-doc-card {
margin: 14px;
padding: 12px 38px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 36px;
font-size: 13px;
position: relative;
}
.title {
text-align: center;
font-size: 18px;
}
.middle {
background-color: white;
margin: 6px 10px 10px 10px;
padding: 10px;
}
.middle_item {
margin-bottom: 6px;
}
.middle_item:last-of-type {
margin-bottom: 0;
}
.middle_item_pic {
margin-right: 10px;
}
.middle_item_img {
width: 100%;
height: 140px;
object-fit: revert;
display: block;
}
.middle_item_img img {
border-radius: 10px;
}
.middle_item_text {
font-size: 12px;
margin-top: 6px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.middle_item_text > div:nth-of-type(1) {
font-size: 14px;
font-weight: bold;
display: flex;
}
.van-badge {
position: absolute;
right: 20px;
top: -2px;
}
.middle .van-empty {
position: unset;
transform: none;
}
.sort_div {
display: flex;
font-size: 12px;
align-items: center;
color: #1867b0;
justify-content: flex-end;
margin-right: 16px;
}
.van-tabs .van-icon::before {
position: relative;
top: 2px;
}
.msg_div_text {
display: flex;
align-items: flex-start;
width: 100%;
justify-content: space-between;
margin-left: 10px;
}
.sign_popup {
width: 96%;
height: 640px;
border-radius: 20px;
}
.menu_item_name {
margin-top: 6px;
}
</style>
<div id="app">
<!--首页-->
<div style="margin-bottom: 100px" v-if="active === 'home'">
<!--轮播图-->
<van-swipe :autoplay="3000" class="swiper">
<van-swipe-item v-for="(image, index) in images" :key="index">
<img :src="image" width="100%" />
</van-swipe-item>
</van-swipe>
<!--应用窗格-->
<van-row class="first module">
<div class="menu" style="border-radius: 10px">
<div @click="switchModuleMenus(item)" v-for="item in moduleMenus" class="menu_item">
<img :src="CREATE_PREVIEW_URL(item.iconClass)" alt="" class="menu_item_img" />
<span class="menu_item_name">{{item.moduleName}}</span>
</div>
</div>
</van-row>
<!--下方功能区,包含活动、功能入口、消息列表-->
<van-row>
<div v-if="clickIndex !== 1" @click="clickIndex = 1" class="sort_div">
<van-icon name="sort" style="transform: rotate(90deg)"></van-icon>
<span>切换活动列表</span>
</div>
<!--活动列表-->
<template v-if="clickIndex === 1">
<div v-if="activityOptions.length > 0" v-for="item in activityOptions" class="middle" style="border-radius: 10px">
<van-row gutter="20">
<van-col span="24" @click="menuClick(item.h5Url)" class="middle_item">
<div>
<van-image :src="CREATE_PREVIEW_URL(item.cover)" class="middle_item_img">
<template slot="loading">
<van-loading type="spinner" size="13" />
</template>
</van-image>
</div>
<div class="middle_item_text">
<van-icon name="fire" color="red" size="12" style="top: 1px"></van-icon>
{{ item.name }}
</div>
<div style="margin-top: 6px; color: grey; font-size: 11px; display: flex">
<div>开始时间:{{ moment(item.startDate).format('YYYY/MM/DD HH:mm') }}</div>
<div style="margin-left: 25px">结束时间:{{ moment(item.endDate).format('YYYY/MM/DD HH:mm') }}</div>
</div>
</van-col>
</van-row>
</div>
<div v-else>
<van-empty description="近期暂无活动"></van-empty>
</div>
</template>
<!--功能入口-->
<template v-else-if="clickIndex === 2">
<div class="middle" style="border-radius: 10px">
<div class="van-sidebar-item van-sidebar-item--select">{{clickMenu.moduleName}}</div>
<div class="menu" style="margin-top: 10px">
<div
v-for="m in clickMenu.menuList"
:key="m.menuId"
class="menu_item"
v-if="(m.url == '/mobile/member/apply' && ${@shiro.lacksRole('H01')}) || m.url != '/mobile/member/apply'"
@click="menuClick(m.url)"
>
<img :src="CREATE_PREVIEW_URL(m.menuIcon)" alt="" class="menu_item_img" />
<span class="menu_item_name">{{m.menuName}}</span>
</div>
</div>
</div>
</template>
</van-row>
</div>
<!--我的办理-->
<div v-if="active === 'handle'" style="background-color: #f6f7f9; min-height: 100vh">
<van-notice-bar left-icon="volume-o" color="#1989fa" background="#ecf9ff" text="温馨提示:只显示当前年份的待办和已办事项"></van-notice-bar>
<van-tabs v-model="activeName" @click="initData">
<van-tab title="待办" name="0">
<div style="min-height: 80vh">
<div v-for="o in needItems">
<div v-if="o.count > 0" @click="toUrl(o)" class="van-doc-card">
<div class="title">{{ o.title }}</div>
<div style="display: flex; align-items: center; justify-content: space-between">
<div>
<div style="color: grey; font-size: 15px">{{ o.name }}</div>
</div>
<div class="number_text">
<span>{{ o.count }}</span>
</div>
</div>
</div>
</div>
<van-empty
style="margin-top: 44px"
v-if="needItems.length === 0"
class="custom-image"
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
description="暂无待办"
></van-empty>
</div>
</van-tab>
<van-tab title="已办" name="1">
<div style="min-height: 80vh">
<div @click="toHref(o)" class="van-doc-card" v-for="o in completedItems">
<div class="title">{{ o.moduleName }}</div>
<div style="display: flex; align-items: center; justify-content: space-between">
<div>
<span>{{ o.auditState }}</span>
</div>
<div>
<div style="color: grey; font-size: 15px">{{ o.auditTime }}</div>
</div>
</div>
</div>
<van-empty
style="margin-top: 44px"
v-if="completedItems.length === 0"
class="custom-image"
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
description="暂无已办"
></van-empty>
</div>
</van-tab>
</van-tabs>
</div>
<!--工作台-->
<div style="margin-bottom: 150px" v-if="active === 'work'">
<van-row v-for="m in moduleMenus" class="module">
<div class="van-sidebar-item van-sidebar-item--select">{{m.moduleName}}</div>
<div class="menu">
<div v-for="m in m.menuList" :key="m.menuId" class="menu_item" @click="menuClick(m.url)">
<img :src="CREATE_PREVIEW_URL(m.menuIcon)" alt="" class="menu_item_img" />
<span class="menu_item_name">{{m.menuName}}</span>
</div>
</div>
</van-row>
</div>
<van-popup v-model="qianShow" class="sign_popup">
<mobile-sign-points></mobile-sign-points>
</van-popup>
<van-tabbar v-model="active" @change="tabbrChange">
<van-tabbar-item icon="home-o" name="home">首页</van-tabbar-item>
<van-tabbar-item :dot="needCount" icon="envelop-o" name="handle">我的办理</van-tabbar-item>
<van-tabbar-item icon="apps-o" name="work">工作台</van-tabbar-item>
</van-tabbar>
</div>
<script>
const vue = new Vue({
el: "#app",
data() {
return {
swipeShow: false,
images: ["${AppDomain!}" + "/home1.png", "${AppDomain!}" + "/home2.png", "${AppDomain!}" + "/home3.png"],
qianShow: false,
msgActive: "unread",
moduleMenus: [],
roles: [],
active: "home",
needCount: 0,
needItems: [],
activeName: "0",
completedItems: [],
activityOptions: [],
clickMenu: {},
clickIndex: 1,
msgPageForm: {},
msgList: [],
msgCount: null,
integralShow: false,
integralForm: {},
integralViewData: [],
totalIntegral: null,
yearList: [],
monthList: []
}
},
methods: {
switchModuleMenus(item) {
this.clickMenu = item
this.clickIndex = 2
},
async getMenus() {
const { data } = await $.post("/platform/sys/appMenu/appMenus")
this.moduleMenus = data
},
menuClick(url) {
if (url) {
pjaxReplace(url)
// location.href = url
}
},
tabbrChange(o) {
// this.needItems = []
// this.initData()
window.localStorage.setItem("active", this.active)
},
toUrl(o) {
location.href = o.mobileHref
},
toHref(o) {
location.href = o.mobileUrl + "?audit=1"
},
async getNeedItems() {
const { data, code } = await $.get("/platform/needItems/getNeedItems")
if (code === 0) {
const obj = data.filter((v) => {
return v.mobileHref != null && v.count > 0
})
this.needItems = obj
}
},
async getCompletes() {
const { data, code } = await $.get("/platform/sys/completed/getCompletes")
if (code === 0) {
this.completedItems = data
}
},
/**
* 会员个人核对待办
* @returns {Promise<void>}
*/
async getMemberCheckSelfAgenda() {
const { data, code } = await $.get("/platform/memberSelf/agenda/getAgenda")
if (code === 0) {
this.needItems = this.needItems.concat(data.filter((v) => v.count > 0))
}
},
/**
* 福利个人核对待办
* @returns {Promise<void>}
*/
async getWelfareCheckSelfAgenda() {
const { data, code } = await $.get("/platform/welfareSelf/agenda/getAgenda")
if (code === 0) {
this.needItems = this.needItems.concat(data.filter((v) => v.count > 0))
}
},
async initData() {
// await this.getNeedItems()
// await this.getMemberCheckSelfAgenda()
// await this.getWelfareCheckSelfAgenda()
// await this.getCompletes()
await this.listActivity()
this.needCount = this.needItems.length
},
async setNeedItems() {
const { data, code } = await $.get("/platform/needItems/getNeedItems")
if (code === 0) {
const obj = data.filter((v) => {
return v.mobileHref != null && v.count > 0
})
window.localStorage.setItem("needItems", escape(JSON.stringify(obj)))
}
},
async listActivity() {
const resp = await $.post("/platform/sys/homeActivity/listHomeActivity")
if (resp.code === 0) {
this.activityOptions = resp.data
if (!resp.data || resp.data.length === 0) {
this.switchFirstModule()
}
}
},
switchFirstModule() {
const data = this.moduleMenus.find((v) => v.orderNum === 1)
this.switchModuleMenus(data)
}
},
beforeMount() {
this.setNeedItems()
},
async created() {
const data = window.localStorage.getItem("active")
if (data) {
this.$set(this, "active", data)
}
await this.getMenus()
this.initData()
}
})
window.addEventListener("pageshow", (e) => {
if (e.persisted || (window.performance && window.performance.navigation.type === 2)) {
vue.getMenus()
vue.initData()
}
})
</script>
<!--#
}
#-->