begin.js 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var app = getApp();
  2. var that;
  3. Page({
  4. data: {
  5. num:0,
  6. str:'企业信息同步中...',
  7. },
  8. onLoad() {
  9. that = this;
  10. that.loginAll();
  11. },
  12. loginAll(){
  13. // dd.showLoading();
  14. app.login(app.globalData.corpId, function (is) {
  15. if(is){
  16. // dd.hideLoading();
  17. dd.reLaunch({
  18. url: '../workbench/index/index'
  19. })
  20. } else {
  21. dd.reLaunch({
  22. url: '../workbench/noJurisdiction/noJurisdiction'
  23. })
  24. }
  25. },function(data){
  26. console.log(data,that.data.num)
  27. if(data.code==2001&&data.msg!='企业授权已过期'){
  28. if(that.data.num==3){ return false}
  29. setTimeout(function(){
  30. let num=that.data.num;
  31. that.setData({ num:num+1 })
  32. that.loginAll();
  33. }, 3000);
  34. }else{
  35. that.setData({
  36. num:0,
  37. str:data.msg
  38. })
  39. }
  40. })
  41. },
  42. });