ow
This commit is contained in:
1 parent
b5d2a2ede0
commit
aff58692bb
17 files changed
+1851
-240
No files matched your search
@@ -6,14 +6,38 @@
|
||||
* 版本号取 common/constant 的 APP_INFO(与 manifest/package 对齐);H5 无 plus.runtime.version。
|
||||
*/
|
||||
import { useLocale } from "uview-pro";
|
||||
import { computed } from "vue";
|
||||
import { APP_INFO } from "@/common/constant";
|
||||
import { useAuthGuard } from "@/composables";
|
||||
import { useAuthGuard, useThemeGradient, useThemeTokens } from "@/composables";
|
||||
import { usePermission } from "@/permission/permission-context";
|
||||
import { pageUrl } from "@/router/routes";
|
||||
import authService from "@/service/security/authService";
|
||||
import { useLoginProfileStore } from "@/stores";
|
||||
|
||||
const { t } = useLocale();
|
||||
|
||||
useAuthGuard();
|
||||
|
||||
const loginProfileStore = useLoginProfileStore();
|
||||
|
||||
/* 代理登录入口显隐,口径必须与后端 /Auth/LoginAgent 的 [PermissionOperate(name:"SecurityUser", operate:"LoginAgent")] 完全一致:
|
||||
后端 PermissionHandler 对非标准 operate 走 default 分支 → CanNone("SecurityUser","LoginAgent"),
|
||||
即查「数据级授权」里有没有一条 PermissionName=SecurityUser 且 DependentDetailName=LoginAgent 的行(只看挂没挂,不看 Y/N)。
|
||||
前端镜像就是 can("none","SecurityUser","LoginAgent")。之前误用 canNone("LoginAgent") 查的是功能级同名行,口径错位——
|
||||
会出现「入口看得见、一点就 403」。改成同口径后:见得到 == 用得了。 */
|
||||
const { can } = usePermission();
|
||||
const canSeeLoginAgent = computed(() => can("none", "SecurityUser", "LoginAgent"));
|
||||
|
||||
/* 统一风格:主题渐变底 + 主题色变量(与 family-person-enquiry / 族谱首页同一接线口径) */
|
||||
const { themeBackground } = useThemeGradient();
|
||||
const { primary, accentGradient, accentSoft, accentShadow } = useThemeTokens();
|
||||
const themeVars = computed(() => ({
|
||||
"--fg-primary": primary.value,
|
||||
"--fg-gradient": accentGradient.value,
|
||||
"--fg-soft": accentSoft.value,
|
||||
"--fg-shadow": accentShadow.value,
|
||||
}));
|
||||
|
||||
/** 进入「我的主题」页:theme 非 tab 页,用 navigateTo 保留历史以便返回 */
|
||||
function goTheme(): void {
|
||||
uni.navigateTo({ url: pageUrl("themePage") });
|
||||
@@ -28,63 +52,160 @@ function goSecurity(): void {
|
||||
function goFamilyPerson(): void {
|
||||
uni.navigateTo({ url: pageUrl("familyPersonEnquiry") });
|
||||
}
|
||||
|
||||
/** 进入「代理登录」页(/login-agent):管理员以被代理号身份切换会话 */
|
||||
function goLoginAgent(): void {
|
||||
uni.navigateTo({ url: pageUrl("loginAgent") });
|
||||
}
|
||||
|
||||
/** 进入「修改密码」页(/change-password):当前登录用户改密,成功后更新档案保持登录 */
|
||||
function goChangePassword(): void {
|
||||
uni.navigateTo({ url: pageUrl("changePassword") });
|
||||
}
|
||||
|
||||
/** 进入「修改昵称」页(/change-local-name):改用户名,成功后按旧系统约定退出重登刷新快照 */
|
||||
function goChangeLocalName(): void {
|
||||
uni.navigateTo({ url: pageUrl("changeLocalName") });
|
||||
}
|
||||
|
||||
/** 退出登录:确认后调后端 Logout、清本地档案,回登录页 */
|
||||
async function handleLogout(): Promise<void> {
|
||||
const confirmed = await new Promise<boolean>((resolve) => {
|
||||
uni.showModal({
|
||||
title: t("MinePage.logoutConfirmTitle"),
|
||||
content: t("MinePage.logoutConfirmContent"),
|
||||
success: res => resolve(!!res.confirm),
|
||||
fail: () => resolve(false),
|
||||
});
|
||||
});
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await authService.Logout();
|
||||
}
|
||||
catch {
|
||||
// 后端退出失败也要清本地态,避免卡在已登录的假象
|
||||
}
|
||||
loginProfileStore.clearStorage();
|
||||
uni.showToast({ title: t("MinePage.logoutSuccess"), icon: "none" });
|
||||
// mine 是 tab 页,用 reLaunch 清栈回登录页,避免返回键又回到「我的」
|
||||
setTimeout(() => uni.reLaunch({ url: pageUrl("login") }), 800);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<app-page :nav-title="t('MinePage.title')" :show-nav-back="false" :show-tabbar="true">
|
||||
<view class="mine-page">
|
||||
<!-- 我的主题:进入主题配色 / 深色模式设置页(/theme) -->
|
||||
<view class="mine-cell" @tap="goTheme">
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.myTheme") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 安全管理:进入权限体系基础设定聚合页(/security) -->
|
||||
<view class="mine-cell" @tap="goSecurity">
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.mySecurity") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 家族成员:族人档案检索(/family-person-enquiry) -->
|
||||
<view class="mine-cell" @tap="goFamilyPerson">
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.familyPerson") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 关于:应用名 + 当前版本 + 运行平台 -->
|
||||
<view class="mine-card">
|
||||
<text class="mine-card__title">
|
||||
{{ t("MinePage.aboutTitle") }}
|
||||
</text>
|
||||
<view class="mine-about__row">
|
||||
<text class="mine-about__label">
|
||||
{{ t("MinePage.appName") }}
|
||||
<!-- 统一风格:隐藏旧 u-navbar,改用与其他 tab 页同款透明 page-navbar 坐在主题渐变底上 -->
|
||||
<app-page :hide-nav="true" :show-tabbar="true">
|
||||
<view class="mine-page" :style="[{ background: themeBackground }, themeVars]">
|
||||
<page-navbar :title="t('MinePage.title')" :show-back="false" :show-transfer="false" :show-quick-toggle="false"
|
||||
:show-search-toggle="false" />
|
||||
<view class="mine-page__body">
|
||||
<!-- 我的主题:进入主题配色 / 深色模式设置页(/theme) -->
|
||||
<view class="mine-cell" @tap="goTheme">
|
||||
<view class="mine-cell__icon">
|
||||
<u-icon name="setting-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.myTheme") }}
|
||||
</text>
|
||||
<text class="mine-about__value">
|
||||
{{ APP_INFO.name }}
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 安全管理:进入权限体系基础设定聚合页(/security) -->
|
||||
<view class="mine-cell" @tap="goSecurity">
|
||||
<view class="mine-cell__icon">
|
||||
<u-icon name="lock-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.mySecurity") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 家族成员:族人档案检索(/family-person-enquiry) -->
|
||||
<view class="mine-cell" @tap="goFamilyPerson">
|
||||
<view class="mine-cell__icon">
|
||||
<u-icon name="account-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.familyPerson") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 代理登录:管理员以被代理号身份切换会话(/login-agent);仅授予 LoginAgent 功能者可见 -->
|
||||
<view v-if="canSeeLoginAgent" class="mine-cell" @tap="goLoginAgent">
|
||||
<view class="mine-cell__icon">
|
||||
<u-icon name="account-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.loginAgent") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 修改密码:当前登录用户改密(/change-password) -->
|
||||
<view class="mine-cell" @tap="goChangePassword">
|
||||
<view class="mine-cell__icon">
|
||||
<u-icon name="lock-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.changePassword") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 修改昵称:改用户名,成功后退出重登刷新快照(/change-local-name) -->
|
||||
<view class="mine-cell" @tap="goChangeLocalName">
|
||||
<view class="mine-cell__icon">
|
||||
<u-icon name="edit-pen-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.changeLocalName") }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" size="32" color="#9aa0a6" />
|
||||
</view>
|
||||
|
||||
<!-- 退出登录:确认后清会话回登录页 -->
|
||||
<view class="mine-cell mine-cell--logout" @tap="handleLogout">
|
||||
<view class="mine-cell__icon mine-cell__icon--logout">
|
||||
<u-icon name="close-circle-fill" size="30" color="#ffffff" />
|
||||
</view>
|
||||
<text class="mine-cell__title">
|
||||
{{ t("MinePage.logout") }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="mine-about__row">
|
||||
<text class="mine-about__label">
|
||||
{{ t("MinePage.versionLabel") }}
|
||||
</text>
|
||||
<text class="mine-about__value">
|
||||
v{{ APP_INFO.version }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="mine-about__row">
|
||||
<text class="mine-about__label">
|
||||
{{ t("MinePage.platformLabel") }}
|
||||
</text>
|
||||
<text class="mine-about__value">
|
||||
{{ APP_INFO.platform }}
|
||||
|
||||
<!-- 关于:应用名 + 当前版本 + 运行平台 -->
|
||||
<view class="mine-card">
|
||||
<text class="mine-card__title">
|
||||
{{ t("MinePage.aboutTitle") }}
|
||||
</text>
|
||||
<view class="mine-about__row">
|
||||
<text class="mine-about__label">
|
||||
{{ t("MinePage.appName") }}
|
||||
</text>
|
||||
<text class="mine-about__value">
|
||||
{{ APP_INFO.name }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="mine-about__row">
|
||||
<text class="mine-about__label">
|
||||
{{ t("MinePage.versionLabel") }}
|
||||
</text>
|
||||
<text class="mine-about__value">
|
||||
v{{ APP_INFO.version }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="mine-about__row">
|
||||
<text class="mine-about__label">
|
||||
{{ t("MinePage.platformLabel") }}
|
||||
</text>
|
||||
<text class="mine-about__value">
|
||||
{{ APP_INFO.platform }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -95,15 +216,25 @@ function goFamilyPerson(): void {
|
||||
.mine-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* 白底圆角卡片:与文件页分区卡片同一风格语言 */
|
||||
/* 内容区:page-navbar 之下,卡片间距与页边距统一 */
|
||||
.mine-page__body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
padding: 0 24rpx 24rpx;
|
||||
}
|
||||
|
||||
/* 白底圆角卡片:与文件页分区卡片同一风格语言(渐变底上轻阴影浮起) */
|
||||
.mine-card {
|
||||
padding: 32rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 4rpx 16rpx rgba(31, 35, 41, 0.06);
|
||||
}
|
||||
|
||||
.mine-card__title {
|
||||
@@ -112,22 +243,51 @@ function goFamilyPerson(): void {
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
/* 可点的列表行:标题左、箭头右,整行白底卡片 */
|
||||
/* 可点的列表行:主题渐变图标块 + 标题左、箭头右,整行白底卡片 */
|
||||
.mine-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 4rpx 16rpx rgba(31, 35, 41, 0.06);
|
||||
}
|
||||
|
||||
.mine-cell__icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 18rpx;
|
||||
background: var(--fg-gradient, linear-gradient(135deg, #ff9a3d, #ff7d1f));
|
||||
box-shadow: var(--fg-shadow, 0 6rpx 16rpx rgba(255, 125, 31, 0.35));
|
||||
}
|
||||
|
||||
.mine-cell__title {
|
||||
flex: 1;
|
||||
margin-left: 24rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
/* 退出登录:降权为描边行,标题居中、危险色,与普通入口区分 */
|
||||
.mine-cell--logout {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.mine-cell__icon--logout {
|
||||
background: linear-gradient(135deg, #ff7a7a, #fa3534);
|
||||
box-shadow: 0 6rpx 16rpx rgba(250, 53, 52, 0.35);
|
||||
}
|
||||
|
||||
.mine-cell--logout .mine-cell__title {
|
||||
flex: none;
|
||||
margin-left: 24rpx;
|
||||
color: #fa3534;
|
||||
}
|
||||
|
||||
/* 关于页行:标签左灰、值右深,横向两端对齐 */
|
||||
.mine-about__row {
|
||||
display: flex;
|
||||
|
||||
Reference in new issue
Block a user