添加银行和政府端小程序
This commit is contained in:
137
government-mini-program/pages/dashboard/dashboard.js
Normal file
137
government-mini-program/pages/dashboard/dashboard.js
Normal file
@@ -0,0 +1,137 @@
|
||||
// pages/dashboard/dashboard.js
|
||||
const dashboardService = require('../../services/dashboardService.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
overviewCards: [
|
||||
{
|
||||
key: 'supervision',
|
||||
icon: '🔍',
|
||||
label: '监管记录',
|
||||
value: '0',
|
||||
trend: 'up',
|
||||
trendText: '+0%',
|
||||
type: 'primary'
|
||||
},
|
||||
{
|
||||
key: 'approval',
|
||||
icon: '✅',
|
||||
label: '待审批',
|
||||
value: '0',
|
||||
trend: 'up',
|
||||
trendText: '+0%',
|
||||
type: 'success'
|
||||
},
|
||||
{
|
||||
key: 'personnel',
|
||||
icon: '👥',
|
||||
label: '人员总数',
|
||||
value: '0',
|
||||
trend: 'up',
|
||||
trendText: '+0%',
|
||||
type: 'warning'
|
||||
},
|
||||
{
|
||||
key: 'epidemic',
|
||||
icon: '🦠',
|
||||
label: '疫情预警',
|
||||
value: '0',
|
||||
trend: 'down',
|
||||
trendText: '-0%',
|
||||
type: 'danger'
|
||||
}
|
||||
],
|
||||
supervisionStats: [
|
||||
{ key: 'total', name: '总监管数', desc: '累计监管记录', value: '0' },
|
||||
{ key: 'today', name: '今日监管', desc: '今日新增记录', value: '0' },
|
||||
{ key: 'pending', name: '待处理', desc: '待处理事项', value: '0' },
|
||||
{ key: 'completed', name: '已完成', desc: '已完成事项', value: '0' }
|
||||
],
|
||||
recentActivities: [
|
||||
{
|
||||
id: 1,
|
||||
icon: '🔍',
|
||||
title: '监管检查',
|
||||
desc: '完成养殖场A的例行检查',
|
||||
time: '2小时前',
|
||||
status: 'success',
|
||||
statusText: '已完成'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
icon: '✅',
|
||||
title: '审批通过',
|
||||
desc: '通过养殖许可证申请',
|
||||
time: '4小时前',
|
||||
status: 'success',
|
||||
statusText: '已通过'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
icon: '⏳',
|
||||
title: '待审批',
|
||||
desc: '养殖场B的扩建申请',
|
||||
time: '6小时前',
|
||||
status: 'pending',
|
||||
statusText: '待处理'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadDashboardData()
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
this.loadDashboardData()
|
||||
setTimeout(() => {
|
||||
wx.stopPullDownRefresh()
|
||||
}, 1000)
|
||||
},
|
||||
|
||||
async loadDashboardData() {
|
||||
try {
|
||||
// 加载统计数据
|
||||
const [stats, supervisionStats] = await Promise.all([
|
||||
dashboardService.getStats(),
|
||||
dashboardService.getSupervisionStats()
|
||||
])
|
||||
|
||||
if (stats) {
|
||||
this.updateOverviewCards(stats)
|
||||
}
|
||||
|
||||
if (supervisionStats) {
|
||||
this.updateSupervisionStats(supervisionStats)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载看板数据失败:', error)
|
||||
wx.showToast({
|
||||
title: '加载数据失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
updateOverviewCards(data) {
|
||||
const overviewCards = this.data.overviewCards.map(card => {
|
||||
const newValue = data[card.key] || card.value
|
||||
return {
|
||||
...card,
|
||||
value: newValue
|
||||
}
|
||||
})
|
||||
this.setData({ overviewCards })
|
||||
},
|
||||
|
||||
updateSupervisionStats(data) {
|
||||
const supervisionStats = this.data.supervisionStats.map(stat => {
|
||||
const newValue = data[stat.key] || stat.value
|
||||
return {
|
||||
...stat,
|
||||
value: newValue
|
||||
}
|
||||
})
|
||||
this.setData({ supervisionStats })
|
||||
}
|
||||
})
|
||||
3
government-mini-program/pages/dashboard/dashboard.json
Normal file
3
government-mini-program/pages/dashboard/dashboard.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
71
government-mini-program/pages/dashboard/dashboard.wxml
Normal file
71
government-mini-program/pages/dashboard/dashboard.wxml
Normal file
@@ -0,0 +1,71 @@
|
||||
<!--pages/dashboard/dashboard.wxml-->
|
||||
<view class="dashboard-container">
|
||||
<!-- 数据概览卡片 -->
|
||||
<view class="overview-cards">
|
||||
<view
|
||||
wx:for="{{overviewCards}}"
|
||||
wx:key="key"
|
||||
class="overview-card {{item.type}}"
|
||||
>
|
||||
<view class="card-icon">{{item.icon}}</view>
|
||||
<view class="card-content">
|
||||
<view class="card-value">{{item.value}}</view>
|
||||
<view class="card-label">{{item.label}}</view>
|
||||
<view class="card-trend {{item.trend}}">
|
||||
{{item.trendText}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 图表区域 -->
|
||||
<view class="charts-section">
|
||||
<view class="section-title">数据图表</view>
|
||||
<view class="chart-container">
|
||||
<view class="chart-placeholder">
|
||||
<view class="chart-icon">📊</view>
|
||||
<view class="chart-text">图表数据加载中...</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 监管统计 -->
|
||||
<view class="supervision-stats">
|
||||
<view class="section-title">监管统计</view>
|
||||
<view class="stats-list">
|
||||
<view
|
||||
wx:for="{{supervisionStats}}"
|
||||
wx:key="key"
|
||||
class="stat-item"
|
||||
>
|
||||
<view class="stat-info">
|
||||
<view class="stat-name">{{item.name}}</view>
|
||||
<view class="stat-desc">{{item.desc}}</view>
|
||||
</view>
|
||||
<view class="stat-value">{{item.value}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 最近活动 -->
|
||||
<view class="recent-activities">
|
||||
<view class="section-title">最近活动</view>
|
||||
<view class="activity-list">
|
||||
<view
|
||||
wx:for="{{recentActivities}}"
|
||||
wx:key="id"
|
||||
class="activity-item"
|
||||
>
|
||||
<view class="activity-icon">{{item.icon}}</view>
|
||||
<view class="activity-content">
|
||||
<view class="activity-title">{{item.title}}</view>
|
||||
<view class="activity-desc">{{item.desc}}</view>
|
||||
<view class="activity-time">{{item.time}}</view>
|
||||
</view>
|
||||
<view class="activity-status {{item.status}}">
|
||||
{{item.statusText}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
210
government-mini-program/pages/dashboard/dashboard.wxss
Normal file
210
government-mini-program/pages/dashboard/dashboard.wxss
Normal file
@@ -0,0 +1,210 @@
|
||||
/* pages/dashboard/dashboard.wxss */
|
||||
.dashboard-container {
|
||||
min-height: 100vh;
|
||||
background: #f6f6f6;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.overview-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.overview-card.primary {
|
||||
border-left: 8rpx solid #1890ff;
|
||||
}
|
||||
|
||||
.overview-card.success {
|
||||
border-left: 8rpx solid #52c41a;
|
||||
}
|
||||
|
||||
.overview-card.warning {
|
||||
border-left: 8rpx solid #faad14;
|
||||
}
|
||||
|
||||
.overview-card.danger {
|
||||
border-left: 8rpx solid #ff4d4f;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
font-size: 48rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.card-value {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.card-label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.card-trend {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.card-trend.up {
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.card-trend.down {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
|
||||
.charts-section,
|
||||
.supervision-stats,
|
||||
.recent-activities {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
height: 400rpx;
|
||||
background: #f8f9fa;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.chart-placeholder {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.chart-icon {
|
||||
font-size: 80rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.chart-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.stats-list {
|
||||
space-y: 20rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.stat-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.stat-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.stat-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.stat-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
.activity-list {
|
||||
space-y: 20rpx;
|
||||
}
|
||||
|
||||
.activity-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.activity-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.activity-icon {
|
||||
font-size: 32rpx;
|
||||
margin-right: 20rpx;
|
||||
width: 60rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.activity-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.activity-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.activity-desc {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.activity-time {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.activity-status {
|
||||
font-size: 20rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.activity-status.success {
|
||||
background: #f6ffed;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.activity-status.pending {
|
||||
background: #fff7e6;
|
||||
color: #faad14;
|
||||
}
|
||||
Reference in New Issue
Block a user