fix(mini): 修复设置页绑定漂移并新增 WXML-JS 一致性检查
Publish Mini Program Dev Version / publish (push) Successful in 1m5s

settings.js 同步绑定名 loggedIn→logged、login→wxLogin、navTo→navigateTo,恢复登录按钮与全部菜单项响应;npm test 接入新增 ci/check-bindings.cjs 门禁;calendar/wish-detail 各 1 处历史遗留漂移登记为仅告警另行跟进
This commit is contained in:
gouki
2026-09-30 00:48:50 +00:00
parent 59d1af73b9
commit 0e21d8e63f
4 changed files with 261 additions and 16 deletions
+6 -6
View File
@@ -5,7 +5,7 @@ const birthProfile = require('../../utils/birth-profile.js');
Page({
data: {
userInfo: null,
loggedIn: false,
logged: false,
logging: false,
// 菜单角标
profileCount: 0,
@@ -25,7 +25,7 @@ Page({
refreshUser() {
const token = wx.getStorageSync('token');
const userInfo = wx.getStorageSync('lunar-user-info');
this.setData({ loggedIn: !!token, userInfo: userInfo || null });
this.setData({ logged: !!token, userInfo: userInfo || null });
},
refreshCounts() {
@@ -39,7 +39,7 @@ Page({
// ==================== 登录 ====================
login() {
wxLogin() {
if (this.data.logging) return;
this.setData({ logging: true });
wx.login({
@@ -57,7 +57,7 @@ Page({
if (res && res.code === 0 && res.data && res.data.token) {
wx.setStorageSync('token', res.data.token);
wx.setStorageSync('lunar-user-info', res.data.user);
this.setData({ userInfo: res.data.user, loggedIn: true, logging: false });
this.setData({ userInfo: res.data.user, logged: true, logging: false });
wx.showToast({ title: '登录成功', icon: 'success' });
// 登录后拉取云端生辰档案,保证菜单计数准确
birthProfile.syncFromServer().then(() => this.refreshCounts()).catch(() => {});
@@ -85,13 +85,13 @@ Page({
if (!res.confirm) return;
wx.removeStorageSync('token');
wx.removeStorageSync('lunar-user-info');
this.setData({ userInfo: null, loggedIn: false });
this.setData({ userInfo: null, logged: false });
wx.showToast({ title: '已退出', icon: 'success' });
}
});
},
navTo(e) {
navigateTo(e) {
const url = e.currentTarget.dataset.url;
// tabBar 页面必须用 switchTab 打开
const tabPages = ['/pages/home/home', '/pages/wish-tree/wish-tree', '/pages/bazi/bazi', '/pages/wiki/wiki', '/pages/settings/settings'];