begin.js 964 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. app.login(app.globalData.corpId, function (is,is2) {
  14. if (is) {
  15. dd.reLaunch({
  16. url: '../../home/home/home'
  17. })
  18. } else {
  19. if(is2){
  20. dd.reLaunch({
  21. url: '../noJurisdiction/noJurisdiction?id=1'
  22. })
  23. }else{
  24. dd.reLaunch({
  25. url: '../noJurisdiction/noJurisdiction'
  26. })
  27. }
  28. }
  29. }, function (data) {
  30. if (data.code == 4000||data.code == 4001) {
  31. if (that.data.num == 3) { return false }
  32. setTimeout(function () {
  33. let num = that.data.num;
  34. that.setData({ num: num + 1 })
  35. that.loginAll();
  36. }, 3000);
  37. } else {
  38. that.setData({
  39. num: 0,
  40. str: data.msg
  41. })
  42. }
  43. }, true)
  44. },
  45. });