login.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const _Http = getApp().globalData.http;
  2. function loginMsg(res) {
  3. wx.setStorageSync('account_list', res.account_list)
  4. if (res.account_list.length == 1) {
  5. wx.setStorageSync('userMsg', res.account_list[0])
  6. wx.switchTab({
  7. url: '/pages/tabbar/home/index'
  8. })
  9. query_userauth();
  10. } else {
  11. wx.redirectTo({
  12. url: './selectSite',
  13. })
  14. }
  15. }
  16. /* 获取用户权限 */
  17. function query_userauth(i = 0) {
  18. if (i == 5) return wx.showToast({
  19. title: '权限查询失败,请稍后再试',
  20. icon: "none"
  21. })
  22. if (i == 0) querySite_Parameter();
  23. _Http.basic({
  24. "classname": "sysmanage.develop.userauth.userauth",
  25. "method": "query_userauth",
  26. content: {}
  27. }).then(res => {
  28. if (res.msg != '成功') return query_userauth(i + 1);
  29. wx.setStorageSync('userauth', res.data);
  30. })
  31. }
  32. function querySite_Parameter(i = 0) {
  33. if (i == 5) return;
  34. _Http.basic({
  35. "classname": "webmanage.site.site",
  36. "method": "querySite_Parameter",
  37. "content": {}
  38. }).then(res => {
  39. if (res.msg != '成功') return query_userauth(i + 1);
  40. wx.setStorageSync('siteP', res.data);
  41. })
  42. }
  43. /* 站点数据查询 */
  44. module.exports = {
  45. loginMsg,
  46. query_userauth
  47. }