- 后端:RlzDispatch/Profit/Promotion/Region 控制器、服务、Mapper、领域模型 - 权限:MethodSecurityConfig + PermissionInterceptor - 管理后台:派单/分润/推广/区域 页面与 API - Android 陪护端:派单/运营/退款 Fragment 及布局 - 小程序:推广员子包、派单/运营/退款/检索子包、自定义 tabBar - 文档:多角色系统方案、角色权限矩阵、用户操作手册等 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
894 B
JavaScript
40 lines
894 B
JavaScript
var app = getApp();
|
||
|
||
Component({
|
||
data: {
|
||
selected: 0,
|
||
tabs: []
|
||
},
|
||
|
||
lifetimes: {
|
||
attached() {
|
||
this._lastRole = '';
|
||
this.updateTabs();
|
||
}
|
||
},
|
||
|
||
pageLifetimes: {
|
||
show() {
|
||
this.updateTabs();
|
||
}
|
||
},
|
||
|
||
methods: {
|
||
// 仅当角色实际变化时才更新 tabs,避免无意义重渲染
|
||
updateTabs() {
|
||
var userType = app.globalData.userType || 'C';
|
||
if (this._lastRole === userType) return;
|
||
this._lastRole = userType;
|
||
var tabs = app.globalData.ROLE_TABS[userType] || app.globalData.ROLE_TABS['C'];
|
||
this.setData({ tabs: tabs });
|
||
},
|
||
|
||
switchTab(e) {
|
||
var index = e.currentTarget.dataset.index;
|
||
var pages = ['/pages/index/index', '/pages/service/service', '/pages/order/order', '/pages/my/my'];
|
||
if (this.data.selected === index) return;
|
||
wx.switchTab({ url: pages[index] });
|
||
}
|
||
}
|
||
});
|