This commit is contained in:
2025-11-12 09:46:46 +08:00
parent 648f0d116f
commit 54e30e62b4
18 changed files with 1217 additions and 628 deletions
+82 -52
View File
@@ -3,47 +3,52 @@ const act = {
<!-- 活动 -->
<div class="section-wrapper">
<div class="section-act">
<!-- 标题 -->
<div class="section-act-title">
<span>工会活动</span>
</div>
<!-- Swiper容器 -->
<div class="activity-swiper-container">
<!-- 活动数据 - Swiper -->
<div class="swiper activity-swiper">
<div class="swiper-wrapper">
<div class="swiper-slide" v-for="(activity, index) in actList" :key="activity.id">
<div class="item" @click="go(activity)">
<div class="img-box">
<img :src="activity.cover || 'https://www.ncu.edu.cn/__local/8/52/2C/644986B4C9A030F7B65300178A6_8679CB08_18467.jpg'"
alt="">
<span class="status">
<div v-if="actList && actList.length > 0" class="activity-swiper-container">
<div class="activity-swiper-container">
<!-- 活动数据 - Swiper -->
<div class="swiper activity-swiper">
<div class="swiper-wrapper">
<div class="swiper-slide" v-for="(activity, index) in actList" :key="activity.id">
<div class="item" @click="go(activity)">
<div class="img-box">
<img :src="activity.cover || 'https://www.ncu.edu.cn/__local/8/52/2C/644986B4C9A030F7B65300178A6_8679CB08_18467.jpg'"
alt="">
<span class="status">
{{getStatusText(activity)}}
</span>
</div>
<h4 class="title">
{{ activity.name}}
</h4>
<!--报名时间-->
<div class="time">
<p>
<i class="fa fa-clock-o"></i>
时间:{{ activity.startDate }}至{{ activity.endDate }}
</p>
</div>
</div>
</div>
</div>
</div>
<!-- 导航按钮 -->
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<!-- 进度条 -->
<div class="swiper-pagination"></div>
</div>
<h4 class="title">
{{ activity.name}}
</h4>
<!--报名时间-->
<div class="time">
<p>
<i class="fa fa-clock-o"></i>
时间:{{ activity.startDate }}至{{ activity.endDate }}
</p>
</div>
</div>
</div>
</div>
</div>
<!-- 导航按钮 -->
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<!-- 进度条 -->
<div class="swiper-pagination"></div>
</div>
</div>
<div v-else class="no-activity-placeholder">
<div class="icon">📅</div>
<p>暂无近期活动</p>
<p class="subtext">敬请关注后续通知</p>
</div>
</div>
</div>
`,
@@ -86,13 +91,13 @@ const act = {
},
breakpoints: {
768: {
slidesPerView: 2,
slidesPerView: 1,
},
1024: {
slidesPerView: 3,
slidesPerView: 2,
},
1200: {
slidesPerView: 4,
slidesPerView: 3,
}
}
})
@@ -125,12 +130,6 @@ const act = {
width: 100%;
}
.section-act {
width: 80%;
max-width: 80%;
margin: 30px auto;
}
.section-act .section-act-title span {
font-size: 30px;
color: #000000;
@@ -172,12 +171,13 @@ const act = {
.activity-swiper-container {
position: relative;
width: 100%;
margin-top: 30px;
padding: 20px;
/*margin-top: 30px;*/
}
.activity-swiper {
width: 100%;
padding: 0 50px 20px 50px;
/*padding: 0 50px 20px 50px;*/
}
.activity-swiper .swiper-slide {
@@ -235,6 +235,7 @@ const act = {
.activity-swiper .swiper-slide .item .img-box {
width: 100%;
height: 200px;
border-radius: 12px;
overflow: hidden;
position: relative;
}
@@ -282,13 +283,13 @@ const act = {
}
.activity-swiper .swiper-slide .item .time {
margin-top: 8px;
/*margin-top: 8px;*/
}
.activity-swiper .swiper-slide .item .time p {
font-size: 14px;
font-size: 13px;
margin: 0;
line-height: 1.5;
/*line-height: 1.5;*/
color: #666;
}
@@ -296,5 +297,34 @@ const act = {
margin-right: 5px;
color: var(--color-primary);
}
/* 无活动占位提示 */
.no-activity-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px;
color: #94a3b8;
text-align: center;
}
.no-activity-placeholder .icon {
font-size: 48px;
margin-bottom: 12px;
opacity: 0.6;
}
.no-activity-placeholder p {
margin: 4px 0 0;
font-size: 16px;
font-weight: 500;
}
.no-activity-placeholder .subtext {
font-size: 13px;
opacity: 0.8;
}
`
}
};
+118 -191
View File
@@ -1,45 +1,35 @@
const entry = {
template: /*language=HTML*/ `
<div class="entry-wrapper">
<div class="entry-title">
<span>常用入口</span>
</div>
<div class="entry-container">
<!-- 左侧分类导航 -->
<div class="sidebar">
<div class="category" :class="{active: activeCategory === 'serv'}"
@click="setActiveCategory('serv')">
<i class="fa fa-star"></i>
<span>推荐服务</span>
</div>
<div class="category" :class="{active: activeCategory === 'app'}" @click="setActiveCategory('app')">
<i class="fa fa-fire"></i>
<span>推荐应用</span>
</div>
<div class="category" :class="{active: activeCategory === 'fav'}"
@click="setActiveCategory('fav')">
<i class="fa fa-heart"></i>
<span>收藏服务</span>
</div>
</div>
<!-- 右侧服务卡片区域 -->
<div class="content">
<div class="services-grid">
<div class="service-card" v-for="(service, index) in currentServices" :key="index"
@click="openService(service)">
<div class="service-icon">
<img :src="service.picIcon">
</div>
<div class="service-info">
<h4 class="service-name">{{ service.name }}</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="entry-wrapper">
<!-- 标签页导航 -->
<div class="tabs">
<div class="tab-item" :class="{ active: activeCategory === 'serv' }"
@click="setActiveCategory('serv')">
<i class="fa fa-star"></i> 推荐服务
</div>
<div class="tab-item" :class="{ active: activeCategory === 'app' }"
@click="setActiveCategory('app')">
<i class="fa fa-fire"></i> 推荐应用
</div>
<div class="tab-item" :class="{ active: activeCategory === 'fav' }"
@click="setActiveCategory('fav')">
<i class="fa fa-heart"></i> 我的收藏
</div>
</div>
<!-- 应用块区域 -->
<div class="apps-container">
<div class="app-grid">
<div class="app-item" v-for="(item, index) in currentServices" :key="index"
@click="openService(item)">
<div class="app-icon">
<img :src="item.picIcon" alt="" />
</div>
<div class="app-name">{{ item.name }}</div>
</div>
</div>
</div>
</div>
`,
data() {
return {
@@ -128,194 +118,131 @@ const entry = {
style: /*language=CSS*/ `
.entry-wrapper {
width: 100%;
background-image: url(https://www.ncu.edu.cn/images/bbg1.jpg);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
box-sizing: border-box;
}
.entry-title {
font-size: 30px;
color: #000000;
display: block;
font-weight: bold;
position: relative;
text-align: center;
padding: 40px 0;
}
/deep/ .entry-title span::before {
content: '';
width: 24px;
height: 11px;
background: url(https://www.ncu.edu.cn/images/titl.svg) no-repeat center;
background-size: 24px 11px;
display: inline-block;
margin-right: 0;
vertical-align: middle;
}
/deep/ .entry-title span::after {
content: '';
width: 24px;
height: 11px;
background: url(https://www.ncu.edu.cn/images/titr.svg) no-repeat center;
background-size: 24px 11px;
display: inline-block;
margin-left: 0;
vertical-align: middle;
}
.entry-container {
width: 80%;
max-width: 80%;
margin: 0 auto;
padding: 20px;
.tabs {
margin-top: 5px;
display: flex;
gap: 30px;
overflow: hidden;
gap: 20px;
margin-bottom: 20px;
border-bottom: 2px solid #e8e8e8;
padding-bottom: 10px;
}
.sidebar {
width: 200px;
flex-shrink: 0;
.tab-item {
display: flex;
align-items: center;
gap: 6px;
font-size: 14px;
color: #666;
cursor: pointer;
padding-bottom: 8px;
transition: color 0.2s ease;
}
.tab-item:hover {
color: #1890ff;
}
.tab-item.active {
color: #1890ff;
font-weight: bold;
border-bottom: 2px solid #1890ff;
}
.tab-item i {
font-size: 14px;
}
.apps-container {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.category {
display: flex;
align-items: center;
padding: 12px 16px;
margin-bottom: 2px;
cursor: pointer;
transition: background-color 0.2s ease;
border-left: 3px solid transparent;
}
.category:hover {
}
.category.active {
color: var(--color-primary);
}
.category i {
font-size: 14px;
margin-right: 10px;
width: 16px;
text-align: center;
}
.category span {
font-size: 18px;
font-weight: 700;
}
.content {
flex: 1;
height: 164px;
}
.services-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
grid-template-rows: repeat(2, 1fr);
overflow: hidden;
}
.service-card {
padding: 12px;
height: 72px;
cursor: pointer;
transition: background-color 0.2s ease;
border: none;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYEAAAB4CAYAAAAUs05BAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANrSURBVHgB7dzNapNZAMfh0zbNYGgosYql4wiCFEEZXLiYG3DrdryPuQbvpXMB7t24m4UOCiKuEtCKsaVNiTRaXhshLvyoSd/Yzf95oORA827PLycn5yxsdZ/crKql+6WG1uLy0d3Lm29Pes+jfm+1N9w/VwD4qXtXbmyf9P/Hu29Wng/6K6WOqnq6WACI1ZgM1pqt0Z31qztlBoMPh0sPXr+8OMsztzsbe9fanfcFgG9sdZ+tz/L+6+0LB7c6lw5meWZ7OGg+7HfPj8dWAgDBRAAgmAgABBMBgGAiABBMBACCiQBAsIV5nBiehXMCAD826zmBWpwYBsi2UFXV5vHrP6WGycnhae4QAuD0JncGneak8He8sBIACCYCAMEa//b+bx5vDJ/dRgQAtY2/EprDVdJ9KwGAYLWukgbgbI03g+tuCLtKGoDPRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEEwEAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgIgAQTAQAgokAQDARAAgmAgDBRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEEwEAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgIgAQTAQAgokAQDARAAgmAgDBRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEEwEAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgIgAQTAQAgokAQDARAAgmAgDBRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEKwxGbwbDZtb3WfrpYbW4vLR3cubbwsAv8Tj3Tcrzwf9lTInVgIAwRp///Hn6Ph1u9Qw+HC49OD1y4sFgDNxvX3h4Fbn0kGpZ8dKACCYCAAEW9jqPrlZVUv3yymtNVujv9Y29qb9Ouh2Z2PvWrvzvgDwjWl+oLM/OlwefBw1fm+1682lVfXUSgAg2JefiI4/0d9Zv7oz7YPbw0HzYb97fjxuL/92dO/KjRM3lx/1e6u94f65AsBPnTSnTubfWeftr58fj60EAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgc71Kehr/7b5aHf8VAGqZx7xtJQAQ7BOP4saDQA2PwQAAAABJRU5ErkJggg==) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
.app-grid {
display: grid;
/* 改为自适应列数:每格最小 80px,自动换行 */
grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
justify-items: center; /* 子项内容居中(图标和文字) */
justify-content: start; /* 整体网格靠左对齐,避免居中 */
gap: 12px;
padding: 12px;
background: #fff;
overflow-x: hidden;
max-height: calc(350px - 74px);
overflow-y: auto;
}
.service-card:hover {
.app-item {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
padding: 12px;
border-radius: 8px;
background: #fff;
width: 100%;
max-width: 100%;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.service-icon {
width: 32px;
height: 32px;
flex-shrink: 0;
.app-item:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.service-icon img {
.app-icon {
width: 46px;
height: 46px;
margin-bottom: 8px;
}
.app-icon img {
width: 100%;
height: 100%;
border-radius: 4px;
object-fit: cover;
object-fit: contain;
}
.service-info {
flex: 1;
min-width: 0;
overflow: hidden;
}
.service-name {
font-size: 14px;
font-weight: 400;
.app-name {
font-size: 12px;
color: #333;
margin: 0;
line-height: 1.4;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
text-align: center;
}
/* 响应式设计 */
@media (max-width: 768px) {
.entry-container {
flex-direction: column;
gap: 20px;
.tabs {
flex-wrap: wrap;
gap: 10px;
}
.sidebar {
width: 100%;
display: flex;
overflow-x: auto;
gap: 0;
border-bottom: 1px solid #e8e8e8;
padding-bottom: 0;
.tab-item {
padding: 8px 0;
font-size: 12px;
}
.category {
flex-shrink: 0;
margin-bottom: 0;
white-space: nowrap;
border-left: none;
border-bottom: 3px solid transparent;
.app-grid {
grid-template-columns: repeat(2, 1fr);
gap: 15px;
}
.category.active {
border-left: none;
border-bottom-color: #1890ff;
}
.services-grid {
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
.app-item {
padding: 12px;
}
}
@media (max-width: 480px) {
.services-grid {
grid-template-columns: 1fr 1fr;
}
.service-card {
padding: 12px;
.app-grid {
grid-template-columns: 1fr;
gap: 12px;
}
}
`
}
};
@@ -3,6 +3,7 @@ layout("/layouts/v4/baseLayout.html"){
#-->
<style>
.section-banner {
position: relative;
overflow: hidden;
@@ -23,37 +24,71 @@ layout("/layouts/v4/baseLayout.html"){
width: 100%;
}
.act-wrapper{
width: 100%;
background-image: url(https://www.ncu.edu.cn/images/bbg1.jpg);
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
.home-grid {
width: 80%;
margin: 20px auto;
display: grid;
/*grid-template-columns: 2.2fr 0.8fr;*/
gap: 24px;
align-items: stretch;
row-gap: 24px;
}
.entry-card {
display: flex;
/*align-items: center;*/
min-width: 320px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
padding: 16px;
transition: transform 0.2s, box-shadow 0.2s;
}
.entry-card:hover {
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.act-card {
display: flex;
align-items: center;
min-width: 320px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
padding: 16px;
transition: transform 0.2s, box-shadow 0.2s;
}
</style>
<div class="v4-container" id="v4-home-app">
<!-- 首页banner -->
<div class="section-banner">
<div class="banner-img">
<img src="${config.AppHomeImg!}" alt=""/>
<stats></stats>
</div>
</div>
<user></user>
<div class="">
<user></user>
<entry></entry>
<div class="home-grid">
<div class="entry-card">
<entry></entry>
</div>
<div class="act-card">
<act></act>
</div>
<!-- 工会活动 -->
<div class="section-wrapper act-wrapper">
<act/>
</div>
<!-- <jcdt :list="websiteNews.grassroots"></jcdt>-->
</div>
<!-- <jcdt :list="websiteNews.grassroots"></jcdt>-->
</div>
<script>
@@ -61,6 +96,9 @@ layout("/layouts/v4/baseLayout.html"){
<!--#include("jcdt.js"){}#-->
<!--#include("entry.js"){}#-->
<!--#include("user.js"){}#-->
<!--#include("stats.js"){}#-->
new Vue({
el: '#v4-home-app',
data(){
@@ -75,6 +113,7 @@ layout("/layouts/v4/baseLayout.html"){
'jcdt': jcdt,
'entry': entry,
'user': user,
'stats': stats,
},
mounted() {
this.getWebSiteNews()
@@ -2,18 +2,19 @@ const jcdt = {
template: /*language=HTML*/ `
<div class="jcdt-wrapper">
<div class="jcdt-container">
<div class="jcdt-title">
<span>基层动态</span>
</div>
<!-- <div class="jcdt-title">-->
<!-- <span>基层动态</span>-->
<!-- </div> -->
<div class="jcdt-content">
<div class="jcdt-list">
<div class="jcdt-item" v-for="item in list" :key="item.title" @click="onLink(item)">
<div class="date">{{item.date}}</div>
<div class="date" v-if="item.date">{{item.date}}</div>
<div class="title">{{item.title}}</div>
<div class="image">
<img :src="item.image" alt="">
</div>
<div class="summary">{{item.summary}}</div>
<!--<div class="image">
<img v-if="item.image" :src="item.image" alt="">
<img v-else src="/assets/platform/img/v4/not-image.png" alt="">
</div>-->
<!-- <div class="summary">{{item.summary}}</div>-->
</div>
</div>
</div>
@@ -38,7 +39,6 @@ const jcdt = {
style: /*language=CSS*/ `
.jcdt-wrapper {
width: 100%;
background-image: url(https://cdgh.ncu.edu.cn/images/index_bg2.png);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
@@ -48,6 +48,12 @@ const jcdt = {
width: 80%;
max-width: 80%;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 12px;
padding: 20px;
margin-bottom: 10px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.jcdt-title{
@@ -57,7 +63,7 @@ const jcdt = {
font-weight: bold;
position: relative;
text-align: center;
padding: 40px 0;
padding: 20px 0;
}
/deep/ .jcdt-container .jcdt-title span::before {
@@ -97,6 +103,8 @@ const jcdt = {
transition: all 0.3s ease;
cursor: pointer;
height: auto;
border-radius: 12px;
}
.jcdt-item:hover{
@@ -161,4 +169,4 @@ const jcdt = {
}
`
}
};
@@ -0,0 +1,196 @@
const stats = {
template: /*language=HTML*/ `
<div class="stats-section">
<div class="stats-grid">
<!-- 待办 -->
<div
class="stat-item pending"
@click="handleStatClick('todo')"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
>
<div class="stat-icon">
<i class="fa fa-clock-o"></i>
</div>
<div class="stat-content">
<div class="stat-label">待办</div>
<div class="stat-number">{{ stats.todoCount }}</div>
</div>
</div>
<!-- 已办 -->
<div
class="stat-item completed"
@click="handleStatClick('done')"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
>
<div class="stat-icon">
<i class="fa fa-check-circle"></i>
</div>
<div class="stat-content">
<div class="stat-label">已办</div>
<div class="stat-number">{{ stats.doneCount }}</div>
</div>
</div>
<!-- 消息 -->
<div
class="stat-item messages"
@click="handleStatClick('notification')"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
>
<div class="stat-icon">
<i class="fa fa-bell"></i>
</div>
<div class="stat-content">
<div class="stat-label">消息</div>
<div class="stat-number">{{ stats.notifications }}</div>
</div>
</div>
<!-- 发起 -->
<div
class="stat-item reminders"
@click="handleStatClick('started')"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
>
<div class="stat-icon">
<i class="fa fa-file-text"></i>
</div>
<div class="stat-content">
<div class="stat-label">发起</div>
<div class="stat-number">{{ stats.startedCount }}</div>
</div>
</div>
</div>
</div>
`,
data() {
return {
stats: {
todoCount: 0,
doneCount: 0,
notifications: 0,
startedCount: 0
}
}
},
methods: {
handleStatClick(type) {
if (['todo', 'done', 'started'].includes(type)) {
window.open('/flow/todoCenter?status=' + type)
} else if (type === 'notification') {
window.open('/platform/v4/msg')
}
},
onMouseEnter(event) {
event.target.style.transform = 'translateY(-2px)';
event.target.style.boxShadow = '0 4px 12px rgba(0,0,0,0.15)';
},
onMouseLeave(event) {
event.target.style.transform = 'none';
event.target.style.boxShadow = '0 2px 6px rgba(0,0,0,0.08)';
},
loadStats() {
this.$axios.post("/flow/todoCenter/statistics").then(res => {
if (res.code === 0) {
this.stats = res.data;
}
})
}
},
mounted() {
this.loadStats();
},
style: /*language=CSS*/ `
/* 右侧统计区域 */
.stats-section {
position: absolute;
bottom: 24px;
right: 24px;
/*background: white;*/
color: #333;
padding: 20px;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
z-index: 10;
width: 680px;
/*border: 1px solid #e8e8e8;*/
}
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
}
.stat-item {
background: #f8f9fa;
color: #495057;
padding: 14px;
border-radius: 8px;
display: flex;
align-items: center;
gap: 10px;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.stat-icon {
font-size: 20px;
width: 36px;
height: 36px;
background: #e6f7ff;
color: #1890ff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.stat-item.pending .stat-icon,
.stat-item.completed .stat-icon,
.stat-item.messages .stat-icon,
.stat-item.reminders .stat-icon {
background: #e6f7ff;
color: #1890ff;
}
.stat-item.completed .stat-icon {
color: #52c41a;
}
.stat-item.messages .stat-icon {
color: #faad14;
}
.stat-item.reminders .stat-icon {
color: #13c2c2;
}
.stat-content {
display: flex;
flex-direction: column;
}
.stat-label {
font-size: 15px;
opacity: 0.7;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.stat-number {
font-size: 18px;
font-weight: bold;
margin-top: 2px;
}
`
};
+479 -185
View File
@@ -1,249 +1,543 @@
const user = {
template: /*language=HTML*/ `
<div class="user-wrapper">
<!-- 用户容器:左右布局 -->
<div class="user-container">
<div class="user-info-section">
<!-- 左侧:用户信息卡片 -->
<div class="user-info-card">
<div class="user-details">
<div class="user-name">${@auth.getPrincipalProperty('username')}</div>
<div class="user-meta">
<div class="meta-item">
<span class="meta-label">工号:</span>
<span class="meta-value">${@auth.getPrincipalProperty('loginname')}</span>
<div class="user-meta-grid">
<div class="meta-row">
<span class="meta-icon">🆔</span>
<div>
<span class="meta-label">工号</span>
<span class="meta-value">${@auth.getPrincipalProperty('loginname')}</span>
</div>
</div>
<div class="meta-item">
<span class="meta-label">单位:</span>
<span class="meta-value">
<!--#if(!isEmpty(@auth.getPrincipalProperty('unit'))){#-->
${@auth.getPrincipalProperty('unit').getName()}
<!--#}#-->
</span>
<div class="meta-row">
<span class="meta-icon">🏢</span>
<div>
<span class="meta-label">单位信息</span>
<span class="meta-value">
<!--#if(!isEmpty(@auth.getPrincipalProperty('unit'))){#-->
${@auth.getPrincipalProperty('unit').getName()}
<!--#}#-->
(
<!--#if(!isEmpty(@auth.getPrincipalProperty('union'))){#-->
${@auth.getPrincipalProperty('union').getName()}
<!--#}#-->
)
</span>
</div>
</div>
<div class="meta-item">
<span class="meta-label">分工会:</span>
<span class="meta-value">
<!--#if(!isEmpty(@auth.getPrincipalProperty('union'))){#-->
${@auth.getPrincipalProperty('union').getName()}
<!--#}#-->
</span>
<div class="meta-row">
<span class="meta-icon">🎭</span>
<div>
<span class="meta-label">角色</span>
<span class="meta-value">{{ roleNames || '—' }}</span>
</div>
</div>
</div>
</div>
<!-- 天气区域 -->
<div v-if="weatherData" class="weather-section" :class="weatherData.bgClass">
<div style="display: flex; justify-content: space-around">
<div class="weather-header">
<span class="weather-location">{{ weatherData.name }}</span>
<span class="weather-text">{{ weatherData.text }}</span>
</div>
<div class="weather-main">
<span class="weather-emoji">{{ weatherData.emoji }}</span>
<span class="weather-temp">{{ weatherData.temp }}°</span>
</div>
</div>
<div class="weather-tip">{{ weatherData.tip }}</div>
</div>
<div v-else-if="weatherError" class="weather-error">
🌤️ 天气服务暂时不可用
</div>
</div>
<div class="stats-section">
<div class="stats-grid">
<div class="stat-item pending" @click="handleStatClick('todo')">
<div class="stat-icon">
<i class="fa fa-clock-o"></i>
</div>
<div class="stat-content">
<div class="stat-label">待办</div>
<div class="stat-number">{{ stats.todoCount }}</div>
</div>
</div>
<div class="stat-item completed" @click="handleStatClick('done')">
<div class="stat-icon">
<i class="fa fa-check-circle"></i>
</div>
<div class="stat-content">
<div class="stat-label">已办</div>
<div class="stat-number">{{ stats.doneCount }}</div>
</div>
</div>
<div class="stat-item messages" @click="handleStatClick('notification')">
<div class="stat-icon">
<i class="fa fa-bell"></i>
</div>
<div class="stat-content">
<div class="stat-label">消息</div>
<div class="stat-number">{{ stats.notifications }}</div>
</div>
</div>
<div class="stat-item reminders" @click="handleStatClick('started')">
<div class="stat-icon">
<i class="fa fa-file-text"></i>
</div>
<div class="stat-content">
<div class="stat-label">发起</div>
<div class="stat-number">{{ stats.startedCount }}</div>
</div>
</div>
<!-- 右侧:待办中心 -->
<div class="todo-center">
<!-- 标题和标签 -->
<div class="header">
<h3>待办中心</h3>
<el-tabs v-model="activeTab" type="card" @tab-click="handleTabClick">
<el-tab-pane label="待办事宜" name="todo"></el-tab-pane>
<el-tab-pane label="已办事宜" name="done"></el-tab-pane>
<el-tab-pane label="我的发起" name="started"></el-tab-pane>
<el-tab-pane label="办结事务" name="completed"></el-tab-pane>
</el-tabs>
</div>
<!-- 表格 -->
<el-table
:data="todoList"
style="width: 100%"
border
stripe
v-loading="loading"
:cell-style="{ padding: '8px' }"
:header-cell-style="{ background: '#f8f9fa', color: '#444', fontWeight: '500' }"
>
<el-table-column label="序号" type="index" :index="indexMethod" width="100px"></el-table-column>
<el-table-column prop="categoryName" label="流程分类" width="100"></el-table-column>
<el-table-column prop="title" label="流程名称" min-width="300">
<template slot-scope="scope">
<el-tooltip effect="dark" :content="scope.row.instanceName" placement="top">
<span class="table-title">{{ scope.row.instanceName }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="sender" label="申请人" width="120">
<template slot-scope="{row}">{{row.variable.initiatorName}}</template>
</el-table-column>
<el-table-column prop="date" label="发起日期" width="120">
<template slot-scope="{row}">
{{$moment(row.createdAt).format('YYYY-MM-DD')}}
</template>
</el-table-column>
<el-table-column label="操作" width="100px" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="openView(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
`,
mixins: [initTableMixins],
data() {
return {
stats: {
todoCount: 0,
doneCount: 0,
notifications: 0,
startedCount: 0
}
}
activeTab: 'todo',
todoList: [],
loading: false,
pageForm: {
pageNum: 1,
pageSize: 5,
totalCount: 0
},
// 🔆 天气相关数据
weatherData: null,
weatherError: false,
// 🔑 和风天气 API Key(请替换为你自己的)
QWEATHER_KEY: 'f916578cbb0e4b55b778b0de5847ecf5', // ←← 务必替换!
roleNames: ""
};
},
methods: {
handleStatClick(type) {
if (['todo', 'done', 'started'].includes(type)) {
window.open('/flow/todoCenter?status=' + type)
} else if (type === 'notification') {
window.open('/platform/v4/msg')
getWeatherInfo(iconCode, temp) {
const info = {
emoji: '🌤️',
tip: '今日天气宜人,心情也该放晴啦!',
bgClass: 'weather-sunny' // 用于 CSS 类
};
const tempNum = parseFloat(temp);
const isCold = tempNum < 10;
const isHot = tempNum > 28;
// 按照和风天气 iconCode 分类
if (['100'].includes(iconCode)) {
info.emoji = '☀️';
info.tip = isHot ? '高温预警!注意防暑降温,多喝水~' : '阳光灿烂,适合外出走走!';
info.bgClass = 'weather-sunny';
} else if (['101', '102', '103', '104'].includes(iconCode)) {
info.emoji = ['101', '103'].includes(iconCode) ? '⛅' : '☁️';
info.tip = isCold ? '天凉加衣,别让感冒找上门!' : '云层温柔,适合静心工作。';
info.bgClass = 'weather-cloudy';
} else if (['300', '301', '302', '305', '306', '399'].some(code => code === iconCode)) {
info.emoji = '🌧️';
info.tip = '🌧️ 下雨啦!记得带伞,小心路滑~';
info.bgClass = 'weather-rainy';
} else if (['307', '308', '309', '310'].includes(iconCode)) {
info.emoji = '⛈️';
info.tip = '⛈️ 雷雨天气,请减少外出,注意安全!';
info.bgClass = 'weather-storm';
} else if (['400', '401', '402', '403'].includes(iconCode)) {
info.emoji = '❄️';
info.tip = '❄️ 天寒地冻,保暖最重要!';
info.bgClass = 'weather-snowy';
} else if (['404', '405', '406', '407', '408', '409', '410'].includes(iconCode)) {
info.emoji = '🌫️';
info.tip = '🌫️ 能见度较低,出行请注意安全。';
info.bgClass = 'weather-foggy';
} else if (['500', '501', '502', '504'].includes(iconCode)) {
info.emoji = '🌀';
info.tip = '🌀 极端天气预警!请关注官方通知。';
info.bgClass = 'weather-extreme';
} else {
info.emoji = '🌤️';
info.tip = '今日天气未知,但愿你心情晴朗!';
info.bgClass = 'weather-default';
}
return info;
},
async getConfigKey(key) {
const resp = await this.$axios.post("/open/common/getConfigKey", {key})
return resp.data
},
// 🔆 获取天气
async fetchWeather() {
try {
// 存localStorage 112.13,32.01 广州 113.27,23.14
const AppMapCenterPointX = await this.getConfigKey("AppMapCenterPointX")
const AppMapCenterPointY = await this.getConfigKey("AppMapCenterPointY")
const dataString = sessionStorage.getItem('homeWeatherData');
if (dataString) {
this.weatherData = JSON.parse(dataString)
} else {
// 1. 先通过城市名获取 locationId
this.$axios.get("https://mx5rk62kvj.re.qweatherapi.com/geo/v2/city/lookup?location=" + AppMapCenterPointX + "," + AppMapCenterPointY + "&key=" + this.QWEATHER_KEY).then((geoRes) => {
if (geoRes.code !== '200' || !geoRes.location?.[0]) {
console.log('城市未找到')
}
const locationId = geoRes.location[0].id;
// 2. 获取当前天气
this.$axios.get("https://mx5rk62kvj.re.qweatherapi.com/v7/weather/now?location=" + locationId + "&key=" + this.QWEATHER_KEY).then((weatherRes) => {
if (weatherRes.code !== '200') {
console.warn('天气数据异常:', weatherRes);
}
const weatherInfo = this.getWeatherInfo(weatherRes.now.icon, weatherRes.now.temp);
this.weatherData = {
...weatherInfo,
temp: weatherRes.now.temp,
text: weatherRes.now.text,
name: geoRes.location[0].name
};
sessionStorage.setItem('homeWeatherData', JSON.stringify(this.weatherData));
this.weatherError = false;
})
})
}
} catch (err) {
console.warn('天气加载失败:', err);
this.weatherError = true;
this.weatherData = null;
}
},
loadStats() {
this.$axios.post("/flow/todoCenter/statistics").then(res => {
// 获取任务列表
async getTasks() {
this.loading = true
try {
const res = await $.post("/flow/todoCenter/" + this.activeTab, this.pageForm)
if (res.code === 0) {
this.stats = res.data;
this.todoList = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
} catch (error) {
this.$message.error("获取任务列表失败")
console.error("获取任务列表失败:", error)
} finally {
this.loading = false
}
},
pageData() {
this.getTasks()
},
handleTabClick(tab) {
this.pageData()
console.log('切换到:', tab.name);
},
// 处理任务
async openView(task) {
console.log(task)
const {taskId, taskKey, taskState, instanceId, businessNo, formKey} = task
if (!formKey) {
this.$message.warning("当前流程没有配置地址")
return
}
window.open(formKey + "?taskId=" + taskId + "bizId=" + businessNo + "taskKey=" + taskKey)
},
getRoleNames() {
$.post("/platform/sys/role/getRoleNames").then(res => {
if (res.code === 0) {
this.roleNames = res.data.roleNames
}
})
}
},
created() {
this.pageData()
this.getRoleNames()
},
mounted() {
this.loadStats();
this.fetchWeather()
},
style: /*language=CSS*/ `
.user-wrapper {
width: 100%;
background-image: url('/assets/platform/img/home/user-bg.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #f5f7fa;
}
.user-container {
width: 80%;
max-width: 80%;
margin: 0 auto;
padding: 20px;
display: flex;
gap: 30px;
overflow: hidden;
margin: 20px auto;
display: grid;
grid-template-columns: 0.7fr 2.3fr;
gap: 24px;
align-items: stretch;
row-gap: 24px;
}
.user-info-section {
display: flex;
align-items: center;
min-width: 0;
width: 390px;
background-image: url('/assets/platform/img/home/user-bg.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
padding: 12px;
}
.user-details {
flex: 1;
min-width: 0;
}
.user-name {
font-size: 20px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 12px;
}
.user-meta {
.user-info-card {
background: white;
border-radius: 16px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
padding: 24px;
display: flex;
flex-direction: column;
gap: 6px;
gap: 20px;
transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.meta-item {
display: flex;
align-items: center;
font-size: 14px;
.user-info-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.meta-label {
color: #666;
min-width: 60px;
flex-shrink: 0;
}
.meta-value {
color: #333;
font-weight: 500;
}
/* 右侧统计区域 */
.stats-section {
flex: 1;
min-width: 0;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 32px;
height: 100%;
}
.stat-item {
display: flex;
align-items: flex-start;
gap: 12px;
cursor: pointer;
transition: all 0.3s ease;
padding: 16px;
position: relative;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYEAAAB4CAYAAAAUs05BAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANrSURBVHgB7dzNapNZAMfh0zbNYGgosYql4wiCFEEZXLiYG3DrdryPuQbvpXMB7t24m4UOCiKuEtCKsaVNiTRaXhshLvyoSd/Yzf95oORA827PLycn5yxsdZ/crKql+6WG1uLy0d3Lm29Pes+jfm+1N9w/VwD4qXtXbmyf9P/Hu29Wng/6K6WOqnq6WACI1ZgM1pqt0Z31qztlBoMPh0sPXr+8OMsztzsbe9fanfcFgG9sdZ+tz/L+6+0LB7c6lw5meWZ7OGg+7HfPj8dWAgDBRAAgmAgABBMBgGAiABBMBACCiQBAsIV5nBiehXMCAD826zmBWpwYBsi2UFXV5vHrP6WGycnhae4QAuD0JncGneak8He8sBIACCYCAMEa//b+bx5vDJ/dRgQAtY2/EprDVdJ9KwGAYLWukgbgbI03g+tuCLtKGoDPRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEEwEAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgIgAQTAQAgokAQDARAAgmAgDBRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEEwEAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgIgAQTAQAgokAQDARAAgmAgDBRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEEwEAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgIgAQTAQAgokAQDARAAgmAgDBRAAgmAgABBMBgGAiABBMBACCiQBAMBEACCYCAMFEACCYCAAEEwGAYCIAEKwxGbwbDZtb3WfrpYbW4vLR3cubbwsAv8Tj3Tcrzwf9lTInVgIAwRp///Hn6Ph1u9Qw+HC49OD1y4sFgDNxvX3h4Fbn0kGpZ8dKACCYCAAEW9jqPrlZVUv3yymtNVujv9Y29qb9Ouh2Z2PvWrvzvgDwjWl+oLM/OlwefBw1fm+1682lVfXUSgAg2JefiI4/0d9Zv7oz7YPbw0HzYb97fjxuL/92dO/KjRM3lx/1e6u94f65AsBPnTSnTubfWeftr58fj60EAIKJAEAwEQAIJgIAwUQAIJgIAAQTAYBgc71Kehr/7b5aHf8VAGqZx7xtJQAQ7BOP4saDQA2PwQAAAABJRU5ErkJggg==) no-repeat;
background-size: 100% 100%;
}
.stat-item:hover {
transform: translateY(-2px);
}
.stat-icon {
position: absolute;
top: 12px;
right: 12px;
width: 32px;
height: 32px;
/* 头像占位符 */
.user-avatar-placeholder {
width: 64px;
height: 64px;
border-radius: 50%;
background: linear-gradient(135deg, #409eff, #1877f2);
color: white;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
font-size: 16px;
color: #999;
font-size: 24px;
font-weight: 600;
margin: 0 auto;
box-shadow: 0 4px 10px rgba(24, 127, 255, 0.3);
}
.stat-icon i {
font-size: 32px;
color: var(--color-primary-3);
/* 用户名 */
.user-name {
font-size: 20px;
font-weight: 700;
color: #1f2937;
text-align: center;
margin: 8px 0 0;
}
.stat-content {
flex: 1;
min-width: 0;
/* 元信息网格 */
.user-meta-grid {
display: flex;
flex-direction: column;
gap: 8px;
gap: 14px;
margin-top: 8px;
}
.stat-label {
font-size: 16px;
color: #333;
font-weight: 700;
line-height: 1;
.meta-row {
display: flex;
align-items: flex-start;
gap: 12px;
}
.meta-icon {
font-size: 18px;
min-width: 24px;
text-align: center;
padding: 15px 0;
color: #409eff;
margin-top: 2px;
}
.stat-number {
font-size: 32px;
font-weight: 700;
color: var(--color-primary);
line-height: 1;
.meta-row > div {
flex: 1;
text-align: center;
}
.meta-label {
font-size: 12px;
color: #6b7280;
font-weight: 500;
display: block;
margin-bottom: 2px;
}
.meta-value {
font-size: 15px;
color: #1f2937;
font-weight: 600;
word-break: break-word;
}
/* === 天气卡片 - 情感化设计 === */
.weather-section {
border-radius: 16px;
padding: 20px;
text-align: center;
color: white;
background: linear-gradient(135deg, #a8edea, #fed6e3); /* 默认柔和渐变 */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
/* 不同天气的背景主题 */
.weather-sunny {
background: linear-gradient(135deg, #FFD700, #FFA500);
color: #2c3e50;
}
.weather-cloudy {
background: linear-gradient(135deg, #B0C4DE, #708090);
color: white;
}
.weather-rainy {
background: linear-gradient(135deg, #4A6FA5, #1E3F66);
color: white;
}
.weather-storm {
background: linear-gradient(135deg, #2F2F2F, #0D0D0D);
color: #FFD700;
}
.weather-snowy {
background: linear-gradient(135deg, #E0F7FA, #B3E5FC);
color: #01579B;
}
.weather-foggy {
background: linear-gradient(135deg, #D7CCC8, #A1887F);
color: white;
}
.weather-extreme {
background: linear-gradient(135deg, #FF5252, #B71C1C);
color: white;
}
.weather-default {
background: linear-gradient(135deg, #E0E0E0, #90A4AE);
color: #333;
}
/* 天气头部:城市 + 描述 */
.weather-header {
margin-bottom: 12px;
}
.weather-location {
font-weight: 700;
font-size: 16px;
display: block;
}
.weather-text {
font-size: 13px;
opacity: 0.9;
display: block;
margin-top: 4px;
}
/* 主体:图标 + 温度 */
.weather-main {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
position: relative;
bottom: 8px;
}
.weather-emoji {
font-size: 36px;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.weather-temp {
font-size: 28px;
font-weight: 800;
}
/* 贴心提示语 */
.weather-tip {
font-size: 14px;
line-height: 1.5;
opacity: 0.95;
margin-top: 8px;
padding: 0 8px;
}
/* 错误状态 */
.weather-error {
text-align: center;
color: #94a3b8;
font-size: 14px;
padding: 16px;
background: #f8fafc;
border-radius: 12px;
border: 1px dashed #cbd5e1;
}
/* 右侧待办中心 */
.todo-center {
min-width: 320px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
padding: 16px;
transition: transform 0.2s, box-shadow 0.2s;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.header h3 {
font-size: 18px;
color: #333;
margin: 0;
border-left: 4px solid #1890ff;
padding-left: 10px;
font-weight: 600;
}
.el-tabs {
margin-top: 10px;
}
.table-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 280px;
display: inline-block;
}
.pagination {
margin-top: 20px;
text-align: right;
}
/* 响应式:小屏下堆叠 */
@media (max-width: 768px) {
.user-container {
flex-direction: column;
width: 95%;
}
.user-info-card, .todo-center {
min-width: 100%;
width: 100%;
}
}
`
}
};