begin.js 798 B

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