Browse Source

角色判断bug

xiaohaizhao 3 months ago
parent
commit
61eb41d60d
2 changed files with 3 additions and 0 deletions
  1. 1 0
      pages/login/modules/login.js
  2. 2 0
      pages/login/selectSite.js

+ 1 - 0
pages/login/modules/login.js

@@ -7,6 +7,7 @@ function loginMsg(res) {
 	wx.setStorageSync('isAgree', true)
 	wx.setStorageSync('account_list', res.account_list);
 	if (res.account_list.length == 1) {
+        wx.removeStorageSync('userrole')
 		wx.setStorageSync('userrole', res.account_list[0].usertype == 1 ? '业务员' : '经销商');
 		wx.removeStorageSync('userMsg')
 		wx.setStorageSync('userMsg', res.account_list[0])

+ 2 - 0
pages/login/selectSite.js

@@ -45,6 +45,8 @@ Page({
         })
     },
     toHome(e) {
+        wx.removeStorageSync('userrole')
+        wx.setStorageSync('userrole', e.currentTarget.dataset.item.usertype == 1 ? '业务员' : '经销商');
         wx.removeStorageSync('userMsg')
         wx.setStorageSync('userMsg', e.currentTarget.dataset.item);
         require('./modules/login').init();