feat(ui): 重构底部导航与首页/个人中心视觉,退出登录入口迁移至「我的」

## 底部导航
- tabBar 配色调整为白底 #FFFFFF、未选中 #999999、选中 #106eff
- 页签重命名:「作业」改为「首页」,「工单」改为「应用」
- 新增 home/apps 及其选中态图标,补充 scripts/gen-tabbar-icons.cjs 生成脚本
- 隐藏 H5 端 tabBar 顶部分隔线;首页、应用、我的页面背景统一为 #f2f8ff

## 首页
- 原机构/人员切换区域调整为通知数据条 stat-strip,数据与通知弹窗同源,支持点击打开弹窗
- 头部改为透明层叠于蓝色渐变背景之上;通告跑马灯调整为半透明胶囊、白色文字并补充跳转箭头
- 页面最小高度设为 100vh,H5 端扣除 --window-bottom,避免内容被 tabBar 遮挡

## 个人中心
- 资料卡调整为蓝色渐变卡片,补充圆角、投影与装饰元素
- 操作列表改为白色圆角卡片,单元格补充箭头并去除末项分隔线
- 新增底部固定「退出登录」按钮,包含二次确认弹窗与加载态,H5 端适配 tabBar 高度

## 其他
- 设置页移除退出登录按钮及其逻辑与样式,能力迁移至个人中心
- edit-quick-actions 在功能列表加载期间展示加载态
- 扫描广播默认值调整为 action=android.intent.action.SCANRESULT、key=value

## 影响面
- 退出登录入口由设置页变更为个人中心页面底部
- 未自定义广播配置的终端,升级后将使用新的默认广播 Action 与 Key
This commit is contained in:
zm2000 2026-11-04 18:18:10 +08:00
parent ee6e52ff40
commit ab03288d67
16 changed files with 565 additions and 189 deletions

View File

@ -0,0 +1,243 @@
/**
* 生成 uni-app 原生 tabBar 图标(81x81 PNG,RGBA)
* 输出:
* src/static/icon/home.png 首页-未选中 #555555
* src/static/icon/home_a.png 首页-选中 #24afd6
* src/static/icon/apps.png 应用-未选中 #555555
* src/static/icon/apps_a.png 应用-选中 #24afd6
*
* 用法:node scripts/gen-tabbar-icons.cjs
*/
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const SIZE = 81;
const SS = 4; // 超采样倍数,用于抗锯齿
/* ---------------- PNG 编码 ---------------- */
const CRC_TABLE = (() => {
const table = new Int32Array(256);
for (let n = 0; n < 256; n++) {
let c = n;
for (let k = 0; k < 8; k++) {
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
}
table[n] = c;
}
return table;
})();
function crc32(buf) {
let crc = -1;
for (let i = 0; i < buf.length; i++) {
crc = CRC_TABLE[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);
}
return (crc ^ -1) >>> 0;
}
function chunk(type, data) {
const typeBuf = Buffer.from(type, 'ascii');
const lenBuf = Buffer.alloc(4);
lenBuf.writeUInt32BE(data.length, 0);
const crcBuf = Buffer.alloc(4);
crcBuf.writeUInt32BE(crc32(Buffer.concat([typeBuf, data])), 0);
return Buffer.concat([lenBuf, typeBuf, data, crcBuf]);
}
function encodePNG(width, height, rgba) {
const sig = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
const ihdr = Buffer.alloc(13);
ihdr.writeUInt32BE(width, 0);
ihdr.writeUInt32BE(height, 4);
ihdr[8] = 8; // bit depth
ihdr[9] = 6; // color type: RGBA
ihdr[10] = 0; // compression
ihdr[11] = 0; // filter
ihdr[12] = 0; // interlace
const stride = width * 4;
const raw = Buffer.alloc((stride + 1) * height);
for (let y = 0; y < height; y++) {
raw[y * (stride + 1)] = 0; // filter: None
rgba.copy(raw, y * (stride + 1) + 1, y * stride, (y + 1) * stride);
}
const idat = zlib.deflateSync(raw, { level: 9 });
return Buffer.concat([sig, chunk('IHDR', ihdr), chunk('IDAT', idat), chunk('IEND', Buffer.alloc(0))]);
}
/* ---------------- 图形绘制(线条风格) ---------------- */
const STROKE_HALF = 3; // 线宽 6px 的一半(相对 7px 更柔和)
function roundedRectSDF(px, py, cx, cy, halfW, halfH, radius) {
const qx = Math.abs(px - cx) - (halfW - radius);
const qy = Math.abs(py - cy) - (halfH - radius);
const outside = Math.hypot(Math.max(qx, 0), Math.max(qy, 0));
const inside = Math.min(Math.max(qx, qy), 0);
return outside + inside - radius;
}
// 圆角矩形描边(line style)
function roundedRectStroke(px, py, cx, cy, halfW, halfH, radius) {
return Math.abs(roundedRectSDF(px, py, cx, cy, halfW, halfH, radius)) <= STROKE_HALF;
}
// 点到线段的距离(带圆头端点)
function segmentHit(px, py, x1, y1, x2, y2) {
const dx = x2 - x1;
const dy = y2 - y1;
const lenSq = dx * dx + dy * dy;
let t = lenSq === 0 ? 0 : ((px - x1) * dx + (py - y1) * dy) / lenSq;
t = Math.max(0, Math.min(1, t));
const nx = x1 + t * dx;
const ny = y1 + t * dy;
return Math.hypot(px - nx, py - ny) <= STROKE_HALF;
}
function polylineHit(x, y, points, closed = false) {
for (let i = 0; i < points.length - 1; i++) {
const [x1, y1] = points[i];
const [x2, y2] = points[i + 1];
if (segmentHit(x, y, x1, y1, x2, y2)) return true;
}
if (closed && points.length > 2) {
const [x1, y1] = points[points.length - 1];
const [x2, y2] = points[0];
if (segmentHit(x, y, x1, y1, x2, y2)) return true;
}
return false;
}
// 首页:带飞檐的屋顶 + 墙体 + 拱形门(线条风格)
function homeHit(x, y) {
// 屋顶:两侧檐口略宽于墙体
const apex = [40.5, 13];
const eaveLeft = [11, 41];
const eaveRight = [70, 41];
const roof = [eaveLeft, apex, eaveRight];
// 墙体顶部落在屋顶斜线上,避免多出一条横线
const wallLeft = 19;
const wallRight = 62;
const wallBottom = 73;
const slope = (apex[1] - eaveLeft[1]) / (apex[0] - eaveLeft[0]);
const wallTopY = apex[1] + (wallLeft - apex[0]) * slope;
const walls = [
[wallLeft, wallTopY],
[wallLeft, wallBottom],
[wallRight, wallBottom],
[wallRight, wallTopY]
];
// 拱形门:两侧竖线 + 上方半圆
const doorHalf = 6.5;
const doorCenterX = (wallLeft + wallRight) / 2;
const doorTopY = 61.5;
const archSteps = 14;
const arch = [];
for (let i = 0; i <= archSteps; i++) {
const t = Math.PI - (Math.PI * i) / archSteps;
arch.push([doorCenterX + doorHalf * Math.cos(t), doorTopY - doorHalf * Math.sin(t)]);
}
const door = [[doorCenterX - doorHalf, wallBottom], ...arch, [doorCenterX + doorHalf, wallBottom]];
return polylineHit(x, y, roof) || polylineHit(x, y, walls) || polylineHit(x, y, door);
}
// 应用:2x2 空心圆角方块(描边间留 3px 空隙,外框与首页图标对齐)
function appsHit(x, y) {
const half = 11.5;
const r = 5.5;
const centers = [
[24.5, 27],
[56.5, 27],
[24.5, 59],
[56.5, 59]
];
return centers.some(([cx, cy]) => roundedRectStroke(x, y, cx, cy, half, half, r));
}
// 我的:头部圆形 + 肩部拱形(线条风格)
function mimeHit(x, y) {
// 头部圆环
const headR = 10;
const headCY = 23;
const headDist = Math.hypot(x - 40.5, y - headCY);
if (Math.abs(headDist - headR) <= STROKE_HALF) return true;
// 肩部:两侧竖线 + 上方椭圆拱(比正圆更贴合人像比例)
const shoulderCY = 59;
const rx = 24;
const ry = 15;
const leftX = 40.5 - rx;
const rightX = 40.5 + rx;
const bottomY = 73;
if (segmentHit(x, y, leftX, bottomY, leftX, shoulderCY)) return true;
if (segmentHit(x, y, rightX, shoulderCY, rightX, bottomY)) return true;
const steps = 18;
const arch = [];
for (let i = 0; i <= steps; i++) {
const t = Math.PI - (Math.PI * i) / steps;
arch.push([40.5 + rx * Math.cos(t), shoulderCY - ry * Math.sin(t)]);
}
return polylineHit(x, y, arch);
}
function render(hitTest, hexColor) {
const r = parseInt(hexColor.slice(1, 3), 16);
const g = parseInt(hexColor.slice(3, 5), 16);
const b = parseInt(hexColor.slice(5, 7), 16);
const rgba = Buffer.alloc(SIZE * SIZE * 4, 0);
const step = 1 / SS;
for (let y = 0; y < SIZE; y++) {
for (let x = 0; x < SIZE; x++) {
let hits = 0;
for (let sy = 0; sy < SS; sy++) {
for (let sx = 0; sx < SS; sx++) {
const px = x + (sx + 0.5) * step;
const py = y + (sy + 0.5) * step;
if (hitTest(px, py)) hits++;
}
}
if (!hits) continue;
const coverage = hits / (SS * SS);
const idx = (y * SIZE + x) * 4;
rgba[idx] = r;
rgba[idx + 1] = g;
rgba[idx + 2] = b;
rgba[idx + 3] = Math.round(coverage * 255);
}
}
return encodePNG(SIZE, SIZE, rgba);
}
/* ---------------- 输出 ---------------- */
const outputDir = path.join(__dirname, '..', 'src', 'static', 'icon');
// 与“我的”图标保持一致(mime.png / mime_a.png 的主色)
const GRAY = '#999999';
const ACTIVE = '#106eff';
const targets = [
['home.png', homeHit, GRAY],
['home_a.png', homeHit, ACTIVE],
['apps.png', appsHit, GRAY],
['apps_a.png', appsHit, ACTIVE],
['mime.png', mimeHit, GRAY],
['mime_a.png', mimeHit, ACTIVE]
];
for (const [name, hitTest, color] of targets) {
const filePath = path.join(outputDir, name);
fs.writeFileSync(filePath, render(hitTest, color));
console.log('generated:', filePath);
}

View File

@ -84,4 +84,10 @@ export default {
.uni-system-preview-image {
z-index: 10100 !important;
}
/* 底部导航栏去除顶部分隔线(tabBar.backgroundColor 为白色,borderStyle 已设为 white,
这里再兜底把 H5 渲染的 1px 边框元素隐藏;App 端为原生 tabBar,由 borderStyle 控制)。 */
uni-tabbar .uni-tabbar-border {
display: none !important;
}
</style>

View File

@ -5,8 +5,8 @@ import http from "../../request";
// 默认键值对设置
const defaultSettings = {
// 广播相关
'broadcast.action': 'com.pda.scan.RESULT',
'broadcast.key': 'scan_data',
'broadcast.action': 'android.intent.action.SCANRESULT',
'broadcast.key': 'value',
// 扫描相关
'scan.sound': 'true',

View File

@ -11,13 +11,15 @@
"path" : "pages/oa/index",
"style" :
{
"titleNView": false
"titleNView": false,
"backgroundColor": "#f2f8ff"
}
},
{
"path": "pages/index/index",
"style": {
"titleNView": false
"titleNView": false,
"backgroundColor": "#f2f8ff"
}
},
{
@ -29,7 +31,8 @@
{
"path": "pages/user/index",
"style": {
"titleNView": false
"titleNView": false,
"backgroundColor": "#f2f8ff"
}
},
{
@ -380,20 +383,20 @@
},
"tabBar": {
"borderStyle": "white",
"backgroundColor": "#333",
"color": "#555",
"selectedColor": "#24afd6",
"backgroundColor": "#FFFFFF",
"color": "#999999",
"selectedColor": "#106eff",
"list": [{
"text": "作业",
"text": "首页",
"pagePath": "pages/index/index",
"iconPath": "static/icon/index.png",
"selectedIconPath": "static/icon/index_a.png"
"iconPath": "static/icon/home.png",
"selectedIconPath": "static/icon/home_a.png"
},
{
"text": "工单",
"text": "应用",
"pagePath": "pages/oa/index",
"iconPath": "static/icon/oa.png",
"selectedIconPath": "static/icon/oa_a.png"
"iconPath": "static/icon/apps.png",
"selectedIconPath": "static/icon/apps_a.png"
},
{
"text": "我的",

View File

@ -49,7 +49,12 @@
</scroll-view>
<scroll-view class="page-scroll" scroll-y>
<view v-if="allActions.length === 0" class="empty-state">
<view v-if="isLoading" class="empty-state loading-state">
<u-loading mode="circle" color="#2979ff" size="26"></u-loading>
<text class="empty-text">正在加载功能列表...</text>
</view>
<view v-else-if="allActions.length === 0" class="empty-state">
<text class="empty-text">暂无可用功能</text>
</view>
@ -110,6 +115,7 @@
leftNavTargetId: '',
isEditMode: false,
selectedKeys: [],
isLoading: true,
FIXED_MENU_KEY: 'fixed_home_menus'
}
},
@ -170,7 +176,12 @@
}
},
async onLoad() {
await this.loadAllActions();
this.isLoading = true;
try {
await this.loadAllActions();
} finally {
this.isLoading = false;
}
},
methods: {
async loadAllActions() {
@ -716,4 +727,13 @@
color: #999;
}
}
.loading-state {
flex-direction: column;
align-items: center;
.empty-text {
margin-top: 20rpx;
}
}
</style>

View File

@ -3,19 +3,20 @@
<view class="status_bar">
</view>
<view class="compact-header">
<!-- 主体切换 -->
<view class="org-switcher">
<view class="org-block" @click="showStoreSelector">
<view class="org-info">
<text class="org-name">{{ userInfo.store_name || '选择主体' }}</text>
<text class="org-id">{{ userInfo.employees_name || '---' }}</text>
</view>
<u-icon class="org-arrow" name="arrow-down" size="14" color="#909399" v-if="userInfo.employees && userInfo.employees.length > 1"></u-icon>
<!-- 通知数据:与「通知信息」弹窗同源(noticeStatItems) -->
<view class="stat-strip" v-if="noticeStatItems.length" @click="openNoticePopup">
<view class="stat-item" v-for="item in noticeStatItems" :key="item.label">
<text class="stat-item__value">{{ item.value }}</text>
<text class="stat-item__label">{{ item.label }}</text>
</view>
</view>
<!-- 通知跑马灯 -->
<view class="org-switcher">
<view class="news-wrapper" @click="openNoticePopup">
<view class="news-pill">
<view class="news-pill__icon">
<u-icon name="bell-fill" size="14" color="#2979ff"></u-icon>
<u-icon name="bell-fill" size="14" color="#FFFFFF"></u-icon>
</view>
<view class="news-pill__body">
<view class="news-marquee">
@ -25,6 +26,7 @@
</view>
</view>
</view>
<u-icon class="news-pill__arrow" name="arrow-right" size="12" color="rgba(255,255,255,0.75)"></u-icon>
</view>
</view>
@ -1582,77 +1584,50 @@
.pda-home {
display: flex;
flex-direction: column;
background: #f8f9fa;
/* App 端 webview 高度已扣除原生 tabBar,100vh 即为 tabBar 顶边以上高度 */
min-height: 100vh;
/* #ifdef H5 */
/* H5 的 100vh 包含 tabBar 区域,扣除底部导航高度,避免内容被 tabBar 遮挡 */
min-height: calc(100vh - var(--window-bottom, 0px));
/* #endif */
// 顶部蓝色向下逐渐过渡到页面浅蓝,形成层次
background: linear-gradient(
180deg,
#106eff 0%,
#3d80ff 240rpx,
#a9c8ff 480rpx,
#f2f8ff 760rpx
);
}
// 紧凑型头部
// 紧凑型头部(透明,叠在页面顶部渐变上)
.compact-header {
padding: 12rpx 24rpx 16rpx;
background: #ffffff;
border-bottom: 1rpx solid #f0f2f5;
position: relative;
padding: 16rpx 24rpx 20rpx;
// 数据条与跑马灯之间的间距(数据条被 v-if 隐藏时自动失效)
.stat-strip + .org-switcher {
margin-top: 16rpx;
}
.org-switcher {
display: flex;
align-items: center;
.org-block {
display: flex;
align-items: center;
flex: 0 1 auto;
max-width: 46%;
min-width: 0;
padding: 4rpx 0;
&:active {
opacity: 0.7;
}
}
.org-arrow {
flex-shrink: 0;
margin-left: 6rpx;
}
.org-info {
flex: 1;
min-width: 0;
.org-name {
font-size: 32rpx;
font-weight: 600;
color: #1f2329;
display: block;
line-height: 1.3;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.org-id {
font-size: 24rpx;
color: #9aa0a6;
display: block;
line-height: 1.3;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.news-wrapper {
flex: 1;
min-width: 0;
margin-left: 16rpx;
overflow: hidden;
.news-pill {
display: flex;
align-items: center;
height: 56rpx;
padding: 0 20rpx;
background: #f2f7ff;
border: 0;
padding: 0 18rpx;
background: rgba(255, 255, 255, 0.16);
border: 1rpx solid rgba(255, 255, 255, 0.22);
border-radius: 28rpx;
box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, 0.25), 0 4rpx 12rpx rgba(6, 45, 120, 0.10);
box-sizing: border-box;
overflow: hidden;
@ -1663,6 +1638,11 @@
margin-right: 10rpx;
}
&__arrow {
flex-shrink: 0;
margin-left: 10rpx;
}
&__body {
flex: 1;
min-width: 0;
@ -1692,7 +1672,7 @@
white-space: nowrap;
padding-right: 60rpx;
font-size: 26rpx;
color: #2979ff;
color: #ffffff;
}
}
}
@ -1700,6 +1680,53 @@
}
}
// 顶部导航栏:通知信息弹窗的数据内容
.stat-strip {
display: flex;
align-items: stretch;
.stat-item {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 14rpx 8rpx;
background: rgba(255, 255, 255, 0.14);
border: 1rpx solid rgba(255, 255, 255, 0.22);
border-radius: 14rpx;
box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, 0.25), 0 6rpx 16rpx rgba(6, 45, 120, 0.12);
& + .stat-item {
margin-left: 12rpx;
}
&:active {
background: rgba(255, 255, 255, 0.26);
}
&__value {
font-size: 36rpx;
font-weight: 600;
color: #ffffff;
line-height: 1.1;
font-variant-numeric: tabular-nums;
}
&__label {
margin-top: 8rpx;
max-width: 100%;
font-size: 22rpx;
color: rgba(255, 255, 255, 0.78);
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
// 顶部公告无缝滚动

View File

@ -1,5 +1,5 @@
<template>
<view>
<view class="oa-page">
</view>
</template>
@ -18,5 +18,8 @@
</script>
<style>
.oa-page {
min-height: 100vh;
background-color: #f2f8ff;
}
</style>

View File

@ -21,7 +21,7 @@
<text class="label-text">广播名 (Action)</text>
</view>
<view class="item-content">
<u-input v-model="newAction" placeholder="输入广播名,如:com.pda.scan.RESULT" border="bottom"
<u-input v-model="newAction" placeholder="输入广播名,如:android.intent.action.SCANRESULT" border="bottom"
:clearable="true" :disabled="canChanges" class="value-input"></u-input>
</view>
<text class="current-value" v-if="broadcast.action && broadcast.action === newAction">
@ -35,7 +35,7 @@
<text class="label-text">数据键名 (Key)</text>
</view>
<view class="item-content">
<u-input v-model="newKey" placeholder="输入数据键名,如:scan_data" border="bottom" :clearable="true"
<u-input v-model="newKey" placeholder="输入数据键名,如:value" border="bottom" :clearable="true"
:disabled="canChanges" class="value-input"></u-input>
</view>
<text class="current-value" v-if="broadcast.key && broadcast.key === newKey">

View File

@ -32,29 +32,12 @@
</u-cell>
</u-cell-group>
</view>
<!-- 底部登出按钮 -->
<view class="logout-section">
<u-button type="error" shape="circle" @click="showLogoutConfirm" :loading="logoutLoading">
退出登录
</u-button>
</view>
<!-- 登出确认弹窗 -->
<u-modal :show="showLogoutModal" :show-cancel-button="true" confirm-text="确定退出" cancel-text="取消"
@confirm="logout" @cancel="showLogoutModal = false">
<view class="modal-content">
<u-icon name="info-circle" size="60" color="#f0ad4e"></u-icon>
<text class="modal-title">确认退出登录?</text>
<text class="modal-desc">退出后将需要重新登录</text>
</view>
</u-modal>
</view>
</view>
</template>
<script>
import { goLogin, isLoginRoute, getCurrentRoute } from '@/core/utils/auth-guard'
import { goLogin } from '@/core/utils/auth-guard'
export default {
data() {
@ -110,8 +93,6 @@
],
// 登出相关
showLogoutModal: false,
logoutLoading: false,
voiceBroadcastEnabled: true
}
},
@ -218,43 +199,6 @@
});
}
});
},
// 显示登出确认弹窗
showLogoutConfirm() {
this.showLogoutModal = true;
},
// 登出
async logout() {
this.logoutLoading = true;
try {
// 调用登出 action
await this.$store.dispatch('logout');
if (!isLoginRoute(getCurrentRoute())) {
await goLogin();
}
// 登出成功提示
uni.showToast({
title: '已退出登录',
icon: 'success',
duration: 1500
});
} catch (error) {
console.error('登出失败:', error);
uni.showToast({
title: '登出失败,请重试',
icon: 'error'
});
} finally {
this.logoutLoading = false;
this.showLogoutModal = false;
}
}
}
}
@ -327,41 +271,5 @@
color: #909399;
padding: 10rpx 24rpx 6rpx;
}
// 登出按钮区域
.logout-section {
padding: 40rpx 30rpx;
::v-deep .u-btn {
height: 100rpx;
font-size: 36rpx;
display: flex;
align-items: center;
justify-content: center;
}
}
// 模态框内容
.modal-content {
padding: 40rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.modal-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
margin-top: 30rpx;
margin-bottom: 20rpx;
}
.modal-desc {
font-size: 28rpx;
color: #666;
text-align: center;
}
}
}
</style>

View File

@ -2,8 +2,8 @@
<view class="personal-center">
<view class="status_bar">
</view>
<!-- 资料卡 -->
<view class="profile-card" @click="navigateTo('profile')">
<!-- 账号信息卡片 -->
<view class="account-card" @click="navigateTo('profile')">
<u-avatar :src="userInfo.avatar" size="60" mode="aspectFill"></u-avatar>
<view class="user-info">
<text class="user-name">{{ userInfo.employees_name }}</text>
@ -14,8 +14,8 @@
</view>
</view>
<!-- 操作列表 - 使用数据循环 -->
<view class="operation-list">
<!-- 内容信息卡片 - 操作列表 -->
<view class="content-card">
<u-cell-group :border="false">
<!-- 使用 v-for 循环渲染列表项 -->
<u-cell
@ -24,16 +24,42 @@
:title="item.title"
:icon="item.icon"
:icon-color="item.iconColor"
:is-link="true"
:border="index !== operationList.length - 1"
@click="handleOperationClick(item)"
>
</u-cell>
</u-cell-group>
</view>
<!-- 退出登录 -->
<view class="logout-section">
<u-button
type="error"
plain
:custom-style="logoutBtnStyle"
:loading="logoutLoading"
loading-text="退出中..."
@click="showLogoutConfirm"
>
退出登录
</u-button>
</view>
<!-- 退出登录确认弹窗 -->
<u-modal :show="showLogoutModal" :show-cancel-button="true" confirm-text="确定退出" cancel-text="取消"
@confirm="logout" @cancel="showLogoutModal = false">
<view class="modal-content">
<u-icon name="info-circle" size="60" color="#f0ad4e"></u-icon>
<text class="modal-title">确认退出登录?</text>
<text class="modal-desc">退出后将需要重新登录</text>
</view>
</u-modal>
</view>
</template>
<script>
import { goLogin } from '@/core/utils/auth-guard'
import { goLogin, isLoginRoute, getCurrentRoute } from '@/core/utils/auth-guard'
export default {
data() {
@ -90,7 +116,20 @@
],
// 当前选中的组织
currentOrg: null
currentOrg: null,
// 退出登录
showLogoutModal: false,
logoutLoading: false,
logoutBtnStyle: {
height: '92rpx',
fontSize: '34rpx',
borderRadius: '20rpx',
border: 'none',
borderWidth: 0,
backgroundColor: '#fff',
color: '#606266'
}
}
},
onLoad() {
@ -259,6 +298,38 @@
return !!token;
},
// 显示退出登录确认弹窗
showLogoutConfirm() {
this.showLogoutModal = true;
},
// 退出登录
async logout() {
this.logoutLoading = true;
try {
await this.$store.dispatch('logout');
if (!isLoginRoute(getCurrentRoute())) {
await goLogin();
}
uni.showToast({
title: '已退出登录',
icon: 'success',
duration: 1500
});
} catch (error) {
console.error('登出失败:', error);
uni.showToast({
title: '登出失败,请重试',
icon: 'error'
});
} finally {
this.logoutLoading = false;
this.showLogoutModal = false;
}
},
navigateTo(pageName, customUrl = null) {
const routeMap = {
profile: '/pages/personal/profile',
@ -299,22 +370,62 @@
<style lang="scss" scoped>
.personal-center {
background-color: #f8f8f8;
min-height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
// 为固定底部的退出登录按钮预留空间
padding-bottom: 180rpx;
/* #ifdef H5 */
min-height: calc(100vh - var(--window-bottom, 0px));
/* #endif */
background-color: #f2f8ff;
// 资料卡样式
.profile-card {
// 账号信息卡片
.account-card {
display: flex;
align-items: center;
margin: 20rpx 24rpx 0;
padding: 40rpx 30rpx;
background: linear-gradient(135deg, #4cd964, #5ac8fa);
background: linear-gradient(135deg, #2979ff 0%, #1fa2ff 100%);
border-radius: 20rpx;
box-shadow: 0 10rpx 24rpx rgba(41, 121, 255, 0.25);
color: #fff;
position: relative;
overflow: hidden;
// 装饰光晕
&::before,
&::after {
content: '';
position: absolute;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.12);
pointer-events: none;
}
&::before {
width: 220rpx;
height: 220rpx;
right: -70rpx;
top: -90rpx;
}
&::after {
width: 140rpx;
height: 140rpx;
right: 90rpx;
bottom: -80rpx;
}
.user-info {
flex: 1;
margin-left: 30rpx;
display: flex;
flex-direction: column;
min-width: 0;
position: relative;
z-index: 1;
.user-name {
font-size: 36rpx;
@ -336,10 +447,14 @@
}
}
// 操作列表样式
.operation-list {
margin-top: 20rpx;
// 内容信息卡片
.content-card {
margin: 24rpx;
padding: 10rpx 0;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
overflow: hidden;
::v-deep .u-cell {
padding: 10rpx 20rpx !important;
@ -349,5 +464,56 @@
font-size: 32rpx !important;
}
}
// 退出登录按钮区域,固定贴在底部导航上方
.logout-section {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
padding: 20rpx 24rpx calc(45rpx + env(safe-area-inset-bottom));
background-color: #f2f8ff;
/* #ifdef H5 */
bottom: var(--window-bottom, 0px);
/* #endif */
::v-deep .u-button {
height: 92rpx;
font-size: 34rpx;
font-weight: 500;
letter-spacing: 2rpx;
border: none !important;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
transition: background-color 0.2s;
}
::v-deep .u-button--active {
background-color: #f5f6f7 !important;
}
}
// 模态框内容
.modal-content {
padding: 40rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.modal-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
margin-top: 30rpx;
margin-bottom: 20rpx;
}
.modal-desc {
font-size: 28rpx;
color: #666;
text-align: center;
}
}
}
</style>

BIN
src/static/icon/apps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

BIN
src/static/icon/apps_a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

BIN
src/static/icon/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

BIN
src/static/icon/home_a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 606 B