123456789101112131415161718192021222324252627282930313233343536 |
- Component({
- data: {
- },
- methods: {
- //普通用户
- selectRegularUser(e) {
- let data = e.currentTarget.dataset;
- let url = data.path;
- // 存储普通用户信息到本地缓存
- wx.setStorageSync('userRole', 'regular'); // 存储角色为普通用户
- wx.setStorageSync('rolePath', url); // 存储路径(可选)
- // 可能还需要进行页面跳转或其他逻辑
- wx.reLaunch({
- url: '/shoping/Home/Home',
- });
- },
- //管理员
- selectAdmin(e) {
- let data = e.currentTarget.dataset;
- let url = data.path;
- // 存储管理员信息到本地缓存
- wx.setStorageSync('userRole', 'admin'); // 存储角色为管理员
- wx.setStorageSync('rolePath', url); // 存储路径(可选)
- // 可能还需要进行页面跳转或其他逻辑
- wx.reLaunch({
- url: '/pages/threshold/threshold',
- });
- },
- // 隐藏返回首页按钮
- onShow: function() {
- if(wx.canIUse('hideHomeButton')) {
- wx.hideHomeButton();
- }
- }
- },
- });
|