Files
2026-09-24 16:25:22 +08:00

301 lines
7.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<hr-page page-bg="#F3F4F6" status-bg="#FFFFFF" nav-title="" :xloading="true">
<!-- ============ 个人 hero ============ -->
<view class="mine-hero">
<view class="mine-c1"></view>
<view class="mine-c2"></view>
<view class="mine-row">
<view class="mine-avt">
<text class="mine-avt-t">{{ user.avatar }}</text>
</view>
<view class="hr-flex1">
<text class="mine-name">{{ user.name }}</text>
<text class="mine-role">{{ user.title }} · {{ user.dept }} · 工号 {{ user.jobNo }}</text>
</view>
<view class="mine-edit" @click="onEdit">
<text class="mine-edit-t">编辑</text>
</view>
</view>
<view class="mine-tags">
<view v-for="(t, i) in user.tags" :key="i" class="mine-tag">
<text class="mine-tag-t">{{ t }}</text>
</view>
</view>
</view>
<!-- ============ 数据条(上浮压住 hero ============ -->
<view class="mine-stats">
<view class="mine-stat-cell">
<text class="mine-stat-b">{{ user.hours }}</text>
<text class="mine-stat-s">累计学时</text>
</view>
<view class="mine-stat-sep"></view>
<view class="mine-stat-cell">
<text class="mine-stat-b">{{ user.courseCount }}</text>
<text class="mine-stat-s">完成课程</text>
</view>
<view class="mine-stat-sep"></view>
<view class="mine-stat-cell">
<text class="mine-stat-b">{{ user.certCount }}</text>
<text class="mine-stat-s">有效证书</text>
</view>
</view>
<view class="hr-body" style="padding-top:16px">
<!-- 救援人员端:学习档案 -->
<hr-card v-if="isRescuer" variant="list">
<hr-lrow icon="▦" theme="pri" title="学习中心" sub="错题 12 · 收藏 8 · 笔记 5" value=""
@click="go('/pages/study/center')"></hr-lrow>
<hr-lrow icon="▤" theme="grn" title="我的证书" sub="3 张有效 · 1 张即将到期" value="" :is-last="true"
@click="go('/pages/study/certificates')"></hr-lrow>
</hr-card>
<!-- 仓管人员端:仓储概览 -->
<hr-card v-if="!isRescuer" variant="list">
<hr-lrow icon="!" theme="red" title="库存预警" sub="6 项低于预警线" value="去处理 " value-theme="red"
:value-bold="true" @click="go('/pages/warehouse/stock')"></hr-lrow>
<hr-lrow icon="⚑" theme="amb" title="借用审批" sub="3 条待审批" value="去审批 " value-theme="pri"
:value-bold="true" @click="go('/pages/message/index')"></hr-lrow>
<hr-lrow icon="⚙" theme="pri" title="设备台账" sub="24 台 · 4 台借出中" value="" :is-last="true"
@click="go('/pages/warehouse/devices')"></hr-lrow>
</hr-card>
<!-- 通用条目 -->
<hr-card variant="list" style="margin-top:10px">
<hr-lrow icon="✉" theme="amb" title="消息中心" :sub="msgSub" value=""
@click="go(isRescuer ? '/pages/message/list' : '/pages/message/index')">
<template v-slot:right>
<view v-if="hrUnread.msgCenter > 0" class="hr-badge">
<text class="hr-badge-t">{{ hrUnread.msgCenter }}</text>
</view>
</template>
</hr-lrow>
<hr-lrow v-if="isRescuer" icon="☎" title="通讯录" sub="指挥员 / 医院 / 同事" value=""
@click="go('/pages/message/contacts')"></hr-lrow>
<hr-lrow v-if="!isRescuer" icon="▦" theme="pri" title="扫码出入库" sub="连续扫码 · 三态即时反馈"
value="" @click="go('/pages/warehouse/scan')"></hr-lrow>
<hr-lrow icon="⚙" title="设置" sub="通知 / 隐私 / 关于" value="" :is-last="true"
@click="go('/pages/mine/settings')"></hr-lrow>
</hr-card>
<hr-card variant="list" style="margin-top:10px">
<hr-lrow icon="question-line" title="帮助与反馈" sub="使用手册 · 问题上报" value="" :is-last="true"
@click="onHelp"></hr-lrow>
</hr-card>
<view class="mine-logout" @click="onLogout">
<text class="mine-logout-t">退出登录</text>
</view>
<view style="height:14px"></view>
</view>
<template v-slot:tabbar>
<hr-tabbar :active="isRescuer ? 2 : 4"></hr-tabbar>
</template>
</hr-page>
</template>
<script lang="uts" setup>
import { computed } from 'vue'
import { hrSession, logout } from '@/utils/role.uts'
import { navTo, relaunchTo } from '@/utils/nav.uts'
import { hrUnread } from '@/utils/unread.uts'
/**
* s08 个人中心(双角色共用)
* 救援端:学习档案(学习中心 / 证书)+ 消息 + 通讯录
* 仓管端:仓储概览(库存预警 / 借用审批 / 设备台账)+ 消息 + 扫码
*/
const user = hrSession
const isRescuer = computed(() : boolean => {
return user.role != 'keeper'
})
const msgSub = computed(() : string => {
return isRescuer.value ? '派单通知 · 系统消息' : '库存预警 · 借用审批 · 系统'
})
function go(url : string) : void {
navTo(url)
}
function onEdit() : void {
uni.showToast({ title: '编辑个人资料', icon: 'none' })
}
function onHelp() : void {
uni.showModal({ title: '帮助与反馈', content: '使用手册 / 问题上报\n值班室电话 8801', showCancel: false })
}
function onLogout() : void {
uni.showModal({
title: '退出登录',
content: '确认退出当前账号?',
success: (res) => {
if (res.confirm) {
logout()
relaunchTo('/pages/login/index')
}
}
})
}
</script>
<style>
.mine-hero {
background-image: linear-gradient(to bottom right, #2563EB, #1E40AF);
padding: 32rpx 32rpx 52rpx 32rpx;
overflow: hidden;
position: relative;
}
.mine-c1 {
position: absolute;
right: -80rpx;
top: -96rpx;
width: 296rpx;
height: 296rpx;
border-radius: 148rpx;
background-color: rgba(255, 255, 255, 0.10);
}
.mine-c2 {
position: absolute;
right: 68rpx;
bottom: -104rpx;
width: 184rpx;
height: 184rpx;
border-radius: 92rpx;
background-color: rgba(255, 255, 255, 0.07);
}
.mine-row {
display: flex;
flex-direction: row;
align-items: center;
}
.mine-avt {
width: 112rpx;
height: 112rpx;
border-radius: 36rpx;
background-color: rgba(255, 255, 255, 0.22);
border: 3rpx solid rgba(255, 255, 255, 0.5);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-right: 26rpx;
}
.mine-avt-t {
font-size: 49.2rpx;
font-weight: bold;
color: #FFFFFF;
}
.mine-name {
font-size: 38rpx;
font-weight: bold;
color: #FFFFFF;
}
.mine-role {
font-size: 25.8rpx;
color: rgba(255, 255, 255, 0.85);
margin-top: 8rpx;
}
.mine-edit {
padding: 14rpx 24rpx 14rpx 24rpx;
border-radius: 18rpx;
background-color: rgba(255, 255, 255, 0.2);
}
.mine-edit-t {
font-size: 26.8rpx;
font-weight: bold;
color: #FFFFFF;
}
.mine-tags {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 18rpx;
}
.mine-tag {
padding: 6rpx 18rpx 6rpx 18rpx;
border-radius: 14rpx;
background-color: rgba(255, 255, 255, 0.18);
margin-right: 12rpx;
margin-bottom: 12rpx;
}
.mine-tag-t {
font-size: 23.6rpx;
color: #FFFFFF;
}
.mine-stats {
display: flex;
flex-direction: row;
background-color: #FFFFFF;
border-radius: 28rpx;
margin-top: -28rpx;
margin-left: 32rpx;
margin-right: 32rpx;
padding: 26rpx 8rpx 26rpx 8rpx;
box-shadow: 0 12rpx 36rpx rgba(15, 23, 42, 0.10);
}
.mine-stat-cell {
flex: 1;
flex-direction: column;
align-items: center;
}
.mine-stat-b {
font-size: 42.6rpx;
font-weight: bold;
color: #1F2937;
}
.mine-stat-s {
font-size: 23.6rpx;
color: #6B7280;
margin-top: 6rpx;
}
.mine-stat-sep {
width: 2rpx;
height: 56rpx;
background-color: #F3F4F6;
margin-top: 6rpx;
}
.mine-logout {
margin-top: 32rpx;
height: 88rpx;
border-radius: 24rpx;
background-color: #FFFFFF;
border: 2rpx solid #E5E7EB;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.mine-logout-t {
font-size: 32.4rpx;
font-weight: bold;
color: #DC2626;
}
</style>