chore(lint): 升级检查工具链并发布 1.2.1

eslint 10、eslint-plugin-vue 10、stylelint 17、commitlint 21
eslint 配置改为 flat config,去掉自动导入 globals 文件
环境变量改成 VITE_API_BASE 与 VITE_API_URL
函数注释改成多行 JSDoc,去掉行末句号
列表项 id 改为必填,去掉非空断言
新增 useFormDialog 统一表单弹窗流程
菜单表单在小程序端改由 flex 派生滚动区高度
声明 packageManager 为 pnpm@10.34.5
This commit is contained in:
Ray.Hao committed 2026-11-04 19:04:25 +08:00
1 parent e58a00bd59
commit 1bf312c125
105 files changed
+11854 -1229

No files matched your search

+14 -14
View File
@@ -82,7 +82,7 @@
<view class="chart-wrapper__canvas">
<qiun-data-charts
type="area"
:chartData="chartData"
:chart-data="chartData"
:opts="chartOpts"
background="transparent"
:canvas2d="true"
@@ -145,7 +145,7 @@ const isAuthenticated = computed(() => userStore.isAuthenticated);
// 快捷入口最多展示的数量
const QUICK_NAV_LIMIT = 4;
// 登录后按权限筛选入口;未登录时保留入口作为登录引导。
// 登录后按权限筛选入口;未登录时保留入口作为登录引导
const quickNavList = computed<WorkMenuItem[]>(() => {
const result: WorkMenuItem[] = [];
for (const group of workMenuGroups) {
@@ -178,10 +178,10 @@ const chartOpts = computed(() => ({
}));
/**
* 仅登录后加载首页通知,忽略旧会话结果。
* 仅登录后加载首页通知,忽略旧会话结果
*/
async function fetchNoticeData() {
// 请求返回前可能切换账号,旧公告不能回填新会话。
// 请求返回前可能切换账号,旧公告不能回填新会话
const token = userStore.accessToken;
if (!isAuthenticated.value) {
noticeList.value = [];
@@ -196,7 +196,7 @@ async function fetchNoticeData() {
}
/**
* 在途刷新只记录一次补拉,避免连续提示并发查询同一列表。
* 在途刷新只记录一次补拉,避免连续提示并发查询同一列表
*/
function loadNoticeData(): void {
if (disposed || !pageVisible) return;
@@ -219,7 +219,7 @@ onScopeDispose(() => {
});
/**
* 加载首页访问概览。
* 加载首页访问概览
*/
function loadVisitOverviewData() {
LogAPI.getVisitOverview()
@@ -228,7 +228,7 @@ function loadVisitOverviewData() {
}
/**
* 按所选范围加载访问趋势。
* 按所选范围加载访问趋势
*/
async function loadVisitTrendData() {
const endDate = dayjs().format("YYYY-MM-DD");
@@ -244,7 +244,7 @@ async function loadVisitTrendData() {
{ name: "访客数", data: data.uvList || [] },
{ name: "浏览量", data: data.pvList || [] },
],
})
}),
);
} catch {
chartData.value = { categories: [], series: [] };
@@ -252,7 +252,7 @@ async function loadVisitTrendData() {
}
/**
* 检查入口要求并跳转目标页面。
* 检查入口要求并跳转目标页面
*/
function handleNavItemClick(item: WorkMenuItem) {
if (!isAuthenticated.value) {
@@ -263,7 +263,7 @@ function handleNavItemClick(item: WorkMenuItem) {
}
/**
* 进入登录页面。
* 进入登录页面
*/
function navigateToLogin() {
const pages = getCurrentPages();
@@ -273,7 +273,7 @@ function navigateToLogin() {
}
/**
* 进入通知页面,未登录时先跳转登录。
* 进入通知页面,未登录时先跳转登录
*/
function handleNoticeClick() {
if (!isAuthenticated.value) {
@@ -284,7 +284,7 @@ function handleNoticeClick() {
}
/**
* 切换统计范围并更新趋势。
* 切换统计范围并更新趋势
*/
function switchRange(value: number) {
if (trendDays.value === value) return;
@@ -443,11 +443,11 @@ onHide(() => {
&__text {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 1;
line-clamp: 1;
font-size: 26rpx;
font-weight: 500;
color: var(--color-text);
-webkit-line-clamp: 1;
line-clamp: 1;
-webkit-box-orient: vertical;
}
}
+11 -5
View File
@@ -70,6 +70,9 @@ import { getErrorMessage } from "@/utils/error";
// 微信静默登录后需绑定手机号时,由父组件打开本弹窗
const visible = defineModel<boolean>({ required: true });
/**
* 绑定成功后通知父组件跳转
*/
const emit = defineEmits<{
/** 绑定成功(会话已就绪),父组件负责跳转 */
(e: "success"): void;
@@ -86,7 +89,7 @@ const isSubmitting = ref(false);
/**
* 打开绑定弹窗
*
* 重置输入;微信身份不由弹窗保存,提交时重新通过 wx.login 确认。
* 重置输入;微信身份不由弹窗保存,提交时重新通过 wx.login 确认
*/
function open() {
mobile.value = "18888888888";
@@ -95,7 +98,7 @@ function open() {
}
/**
* 停止倒计时并清空验证码,保留已填手机号。
* 停止倒计时并清空验证码,保留已填手机号
*/
function handleClose() {
resetCountdown();
@@ -103,14 +106,14 @@ function handleClose() {
}
/**
* 请求发送绑定手机号的验证码。
* 请求发送绑定手机号的验证码
*/
async function handleSendCode() {
await sendCode(mobile.value);
}
/**
* 校验并绑定手机号,成功后通知父组件。
* 校验并绑定手机号,成功后通知父组件
*/
async function handleConfirm() {
if (isSubmitting.value) return;
@@ -124,7 +127,7 @@ async function handleConfirm() {
}
isSubmitting.value = true;
try {
// 静默登录的 code 已消费,绑定时必须重新获取一次。
// 静默登录的 code 已消费,绑定时必须重新获取一次
const { code: loginCode } = await uni.login();
if (!loginCode) throw new Error("未获取到微信登录凭证,请重试");
await userStore.bindMobileForWxMa({ loginCode, mobile: mobile.value, smsCode: code.value });
@@ -139,6 +142,9 @@ async function handleConfirm() {
}
}
/**
* 暴露给父组件打开弹窗
*/
defineExpose({ open });
</script>
+13 -13
View File
@@ -251,7 +251,7 @@ const isCaptchaLoading = ref(false);
const redirect = ref("/pages/index/index");
// 绑定手机号弹窗显隐;微信身份由提交时的新 code 确认。
// 绑定手机号弹窗显隐;微信身份由提交时的新 code 确认
const showBindMobilePopup = ref(false);
const pendingLoginAction = ref<"FORM" | "WECHAT_PHONE" | null>(null);
@@ -296,7 +296,7 @@ const formSchema = computed<FormSchema>(() => ({
}));
/**
* 加载图形验证码。
* 加载图形验证码
*/
const loadCaptcha = async () => {
if (isCaptchaLoading.value) return;
@@ -314,7 +314,7 @@ const loadCaptcha = async () => {
};
/**
* 切换登录方式,保留手机号验证码冷却。
* 切换登录方式,保留手机号验证码冷却
*/
const toggleLoginMode = () => {
if (loginMode.value === "PASSWORD") {
@@ -333,7 +333,7 @@ const toggleLoginMode = () => {
};
/**
* 展示登录所需的协议确认。
* 展示登录所需的协议确认
*/
const openPolicyDialog = (action: "FORM" | "WECHAT_PHONE", phoneCode = "") => {
pendingLoginAction.value = action;
@@ -359,7 +359,7 @@ const openPolicyDialog = (action: "FORM" | "WECHAT_PHONE", phoneCode = "") => {
};
/**
* 校验表单并执行当前方式的登录。
* 校验表单并执行当前方式的登录
*/
async function doFormLogin() {
if (isLoggingIn.value) return;
@@ -389,7 +389,7 @@ async function doFormLogin() {
}
/**
* 确认协议后提交表单登录。
* 确认协议后提交表单登录
*/
const handleLogin = async () => {
// 先校验表单必填项(内联提示,不再弹窗)
@@ -406,7 +406,7 @@ const handleLogin = async () => {
};
/**
* 发送手机登录验证码并启动倒计时。
* 发送手机登录验证码并启动倒计时
*/
const handleSendCode = async () => {
await sendCode(formData.value.username);
@@ -418,7 +418,7 @@ interface WxPhoneLoginEvent {
}
/**
* 确认协议后处理微信手机号授权。
* 确认协议后处理微信手机号授权
*/
const handleWechatPhoneLogin = async (e: WxPhoneLoginEvent) => {
const phoneCode = e.detail.code;
@@ -434,7 +434,7 @@ const handleWechatPhoneLogin = async (e: WxPhoneLoginEvent) => {
};
/**
* 使用微信手机号授权凭证登录。
* 使用微信手机号授权凭证登录
*/
async function doWechatPhoneLogin(phoneCode: string) {
if (!phoneCode) {
@@ -456,7 +456,7 @@ async function doWechatPhoneLogin(phoneCode: string) {
}
/**
* 使用微信登录凭证登录,必要时引导绑定手机号。
* 使用微信登录凭证登录,必要时引导绑定手机号
*/
const doWechatSilentLogin = async () => {
isLoggingIn.value = true;
@@ -477,7 +477,7 @@ const doWechatSilentLogin = async () => {
};
/**
* 加载用户资料,显示成功提示后回跳来源页面。
* 加载用户资料,显示成功提示后回跳来源页面
*/
async function completeLogin() {
await userStore.loadUserInfo();
@@ -485,7 +485,7 @@ async function completeLogin() {
}
/**
* 打开用户协议或隐私政策。
* 打开用户协议或隐私政策
*/
const navigateToAgreement = (type: string) => {
const url =
@@ -526,8 +526,8 @@ onLoad((options) => {
.login__circle {
position: absolute;
filter: blur(64px);
border-radius: 50%;
filter: blur(64px);
&--1 {
top: -160rpx;
+3 -7
View File
@@ -19,9 +19,7 @@
<script lang="ts" setup>
/**
* 设置菜单项
*
* 只描述展示所需字段,跳转目标与动作由调用方的配置补充。
* 设置菜单项的展示数据
*/
export interface SettingsMenuItem {
/** 稳定标识,用于分发,不用展示文案 */
@@ -33,7 +31,7 @@ export interface SettingsMenuItem {
value?: string;
}
// 语义色映射:tone 决定图标底色变体与图标颜色
// 按菜单语义选择图标颜色
const iconColors: Record<SettingsMenuItem["tone"], string> = {
primary: "var(--color-primary)",
warning: "var(--color-warning)",
@@ -48,9 +46,7 @@ defineProps<{
}>();
/**
* select:上报被点击项
*
* 载荷是菜单项 id 而不是标题,展示文案可能重复,不能作为标识。
* 按菜单项 ID 上报选择事件
*/
const emit = defineEmits<{
select: [id: string];
@@ -19,7 +19,9 @@
</template>
<script lang="ts" setup>
/** open:请求进入公众号介绍页,目标地址由父级决定 */
/**
* open:请求进入公众号介绍页,目标地址由父级决定
*/
const emit = defineEmits<{
open: [];
}>();
@@ -130,11 +132,11 @@ const emit = defineEmits<{
display: -webkit-box;
margin-top: 10rpx;
overflow: hidden;
-webkit-line-clamp: 2;
line-clamp: 2;
font-size: 24rpx;
line-height: 1.55;
color: var(--color-text-secondary);
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
+4 -1
View File
@@ -42,6 +42,9 @@
</template>
<script lang="ts" setup>
/**
* 用户资料卡展示所需数据
*/
defineProps<{
/** 已登录时展示账号与部门,未登录展示登录入口 */
isAuthenticated: boolean;
@@ -55,7 +58,7 @@ defineProps<{
/**
* profile / login / scan:只上报点击意图
*
* scan 表示请求调起扫码流程,票据校验与登录在扫码确认页完成。
* scan 表示请求调起扫码流程,票据校验与登录在扫码确认页完成
*/
const emit = defineEmits<{
profile: [];
+5 -3
View File
@@ -22,7 +22,9 @@
</template>
<script lang="ts" setup>
/** profile / account:只上报点击意图,登录校验与跳转由父级决定 */
/**
* 上报点击事件,登录校验与跳转由父组件处理
*/
const emit = defineEmits<{
profile: [];
account: [];
@@ -79,11 +81,11 @@ const emit = defineEmits<{
.quick-card__title {
display: block;
overflow: hidden;
text-overflow: ellipsis;
font-size: 28rpx;
font-weight: 500;
line-height: 1.35;
color: var(--color-text);
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -91,10 +93,10 @@ const emit = defineEmits<{
display: block;
margin-top: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
font-size: 22rpx;
line-height: 1.6;
color: var(--color-text-secondary);
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
+23 -9
View File
@@ -103,10 +103,10 @@ const userInfo = computed(() => userStore.userInfo);
const defaultAvatar = "/static/images/default-avatar.png";
const avatar = computed(() =>
isAuthenticated.value && userInfo.value?.avatar ? userInfo.value.avatar : defaultAvatar
isAuthenticated.value && userInfo.value?.avatar ? userInfo.value.avatar : defaultAvatar,
);
const displayName = computed(() =>
isAuthenticated.value ? userInfo.value?.nickname || "匿名用户" : "欢迎使用"
isAuthenticated.value ? userInfo.value?.nickname || "匿名用户" : "欢迎使用",
);
const username = computed(() => userInfo.value?.username || "未设置账号");
const deptName = computed(() => (isAuthenticated.value ? userInfo.value?.deptName || "" : ""));
@@ -186,7 +186,9 @@ const helpMenuItems = computed<SettingsMenuEntry[]>(() => [
},
]);
// 菜单分发:先按 id 找到配置,再按 kind 走跳转或本地动作
/**
* 菜单分发:先按 id 找到配置,再按 kind 走跳转或本地动作
*/
function handleMenuSelect(id: string) {
const entry = [...toolMenuItems.value, ...helpMenuItems.value].find((item) => item.id === id);
if (!entry) return;
@@ -202,7 +204,9 @@ function handleMenuSelect(id: string) {
uni.navigateTo({ url: entry.target });
}
// 登录页带回跳地址,登录成功后原路返回
/**
* 登录页带回跳地址,登录成功后原路返回
*/
function navigateToLogin() {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
@@ -212,7 +216,9 @@ function navigateToLogin() {
});
}
// 资料页要求登录,未登录先跳登录页
/**
* 资料页要求登录,未登录先跳登录页
*/
function navigateToProfile() {
if (!isAuthenticated.value) {
navigateToLogin();
@@ -221,7 +227,9 @@ function navigateToProfile() {
uni.navigateTo({ url: "/subPages/mine/profile/index" });
}
// 账号安全页要求登录,未登录先跳登录页
/**
* 账号安全页要求登录,未登录先跳登录页
*/
function navigateToAccountSecurity() {
if (!isAuthenticated.value) {
navigateToLogin();
@@ -230,7 +238,9 @@ function navigateToAccountSecurity() {
uni.navigateTo({ url: "/subPages/mine/account/index" });
}
// 公众号介绍页对游客开放,不需要登录
/**
* 公众号介绍页对游客开放,不需要登录
*/
function navigateToOfficialAccount() {
uni.navigateTo({
url: "/subPages/mine/official/index",
@@ -243,7 +253,9 @@ const hasUserProfile = computed(() => {
return !!(info && (info.userId || info.username || info.nickname));
});
// 资料未加载时补拉一次,失败不阻塞页面渲染
/**
* 资料未加载时补拉一次,失败不阻塞页面渲染
*/
async function ensureUserInfoLoaded() {
if (!isAuthenticated.value || hasUserProfile.value) return;
try {
@@ -253,7 +265,9 @@ async function ensureUserInfoLoaded() {
}
}
// 小程序端版本号以发布版本为准,其他端取构建时注入的包版本
/**
* 小程序端版本号以发布版本为准,其他端取构建时注入的包版本
*/
function syncAppVersion() {
// #ifdef MP-WEIXIN
appVersion.value = uni.getAccountInfoSync().miniProgram.version || appVersion.value;