Files
zhgh_hrbnu/src/main/resources/views/mobile/home.html
T
2025-04-05 16:45:08 +08:00

705 lines
23 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;
}
.pwd_popup {
width: 96%;
height: auto;
border-radius: 20px;
}
.menu_item_name {
margin-top: 6px;
}
.card {
/*border: 1px solid #007bff;*/
/*background: #fff;*/
border-radius: 8px;
/*box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);*/
box-sizing: border-box;
position: relative;
}
.card-content {
padding: 30px;
}
h2 {
margin-top: 0;
color: #333;
font-size: 26px;
text-align: center;
}
.form-group {
position: relative;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 10px;
color: #555;
font-size: 16px;
}
input[type="password"],
input[type="text"] {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 50px;
font-size: 16px;
box-sizing: border-box;
transition: border-color 0.3s;
height: 40px;
}
input[type="password"]:focus,
input[type="text"]:focus {
border-color: #007bff;
outline: none;
}
button {
background-color: #e0f0ff;
color: #000;
border: 1px solid #007bff;
padding: 12px;
font-weight: bold;
border-radius: 50px;
cursor: pointer;
font-size: 16px;
width: 100%;
}
button:hover {
background-color: #87c4ed;
}
.note {
font-size: 16px;
color: #666;
padding: 30px;
}
.note ul {
padding-left: 0;
list-style-type: none;
}
.note li {
margin-bottom: 15px;
}
.card.modify-password {
flex: 7;
}
.card.note {
flex: 3;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
align-items: center;
justify-content: center;
}
.modal-content {
background: #fff;
border-radius: 8px;
border: 1px solid #007bff;
padding: 30px;
text-align: center;
max-width: 400px;
width: 100%;
height: 150px;
display: flex;
align-items: center;
justify-content: center;
}
.modal-content h3 {
margin: 0;
}
.toggle-password {
position: absolute;
right: 10px;
top: 70%;
transform: translateY(-50%);
cursor: pointer;
user-select: none;
font-size: 26px;
color: #555;
}
</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="updatePwd" class="menu_item">
<img src="/assets/mobile/img/home/1民主管理.jpg" alt="" class="menu_item_img" />
<span class="menu_item_name">修改密码</span>
</div>
<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-popup v-model="updatePwdShow" class="pwd_popup" :close-on-click-overlay="false" :closeable="!formData.isFirstLogin">
<div class="card modify-password">
<div class="card-content">
<h2>{{ formData.isFirstLogin ? '首次登录,请修改密码' : '修改密码' }}</h2>
<form id="password-form">
<div class="form-group" v-if="!formData.isFirstLogin">
<label for="current-password">当前密码</label>
<input type="password" id="current-password" name="current-password" maxlength="20" v-model="formData.sourcePwd" />
<span class="toggle-password" data-target="current-password">🔒</span>
</div>
<div class="form-group">
<label for="new-password">请输入新密码</label>
<input type="password" id="new-password" name="new-password" maxlength="20" v-model="formData.newPwd" @blur="checkPwd" />
<span class="toggle-password" data-target="new-password">🔒</span>
</div>
<div class="form-group">
<label for="confirm-password">请再次输入新密码</label>
<input
type="password"
id="confirm-password"
name="confirm-password"
maxlength="20"
v-model="formData.confirmPwd"
@blur="checkConfirmPwd"
/>
<span class="toggle-password" data-target="confirm-password">🔒</span>
</div>
</form>
<button @click="updatePwdSubmit">提交</button>
</div>
</div>
</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: ["/assets/mobile/img/home/home1.png", "/assets/mobile/img/home/home2.png", "/assets/mobile/img/home/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: [],
// 修改密码相关
updatePwdShow: false,
formData: {
sourcePwd: "",
newPwd: "",
confirmPwd: ""
},
errorInfo: "",
// 微信端登录次数
isFirstLogin: false
}
},
methods: {
updatePwd() {
this.updatePwdShow = true
},
async updatePwdSubmit() {
if (!this.formData.isFirstLogin && !this.formData.sourcePwd) {
this.$toast("请输入原密码")
}
if (!this.formData.newPwd) {
this.$toast("请输入新密码")
return
}
if (!this.formData.confirmPwd) {
this.$toast("请再次输入新密码")
return
}
const resp = await $.post("/mobile/login/updatePwd", this.formData)
if (resp.code === 0) {
this.$toast("修改成功")
this.updatePwdShow = false
} else {
this.$toast(resp.msg)
}
},
checkPwd() {
if (!this.formData.newPwd) {
this.errorInfo = "请输入新密码"
this.$toast("请输入新密码")
return
}
if (this.formData.newPwd.length < 6) {
this.errorInfo = "密码长度不能小于6位数"
this.$toast("密码长度不能小于6位数")
return
}
this.errorInfo = ""
},
checkConfirmPwd() {
// 检验输入是否大于6位数
if (!this.formData.confirmPwd) {
this.errorInfo = "请再次输入新密码"
this.$toast("请再次输入新密码")
return
}
if (this.formData.confirmPwd.length < 6) {
this.errorInfo = "密码长度不能小于6位数"
this.$toast("密码长度不能小于6位数")
return
}
if (this.formData.newPwd !== this.formData.confirmPwd) {
this.errorInfo = "新密码与再次输入新密码不一致"
this.$toast("新密码与再次输入新密码不一致")
return
}
this.errorInfo = ""
},
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)
},
// 获取微信端的登录次数
async getWeAppLoginCount() {
const resp = await $.post("/mobile/login/checkIsFirstLogin")
this.formData.isFirstLogin = resp.code !== 0
if (this.formData.isFirstLogin) {
this.updatePwdShow = true
}
}
},
beforeMount() {
this.setNeedItems()
},
async created() {
const data = window.localStorage.getItem("active")
if (data) {
this.$set(this, "active", data)
}
await this.getMenus()
this.initData()
await this.getWeAppLoginCount()
}
})
window.addEventListener("pageshow", (e) => {
if (e.persisted || (window.performance && window.performance.navigation.type === 2)) {
vue.getMenus()
vue.initData()
}
})
</script>
<!--#
}
#-->