begin.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var app = getApp();
  2. var that;
  3. import 'dingtalk-jsapi/entry/mobile';
  4. import openLink from 'dingtalk-jsapi/api/biz/util/openLink';
  5. Page({
  6. data: {
  7. num:0,
  8. str:'企业信息同步中...',
  9. },
  10. onLoad() {
  11. that = this;
  12. that.loginAll();
  13. },
  14. loginAll2(){
  15. openLink({
  16. url: 'https://h5.dingtalk.com/open-market/share.html?shareGoodsCode=D34E5A30A9AC7FC6327AB5E6D2D145418457E59F16C3FC9649BF22BF44CFA3D039FDE4A69694381C&token=523cb2f0e79525ea9b1719c0c5765a6b&shareUid=C5EB7B5C85793F3D909B2AC4771E12D7#/'
  17. })
  18. },
  19. loginAll(){
  20. app.login(app.globalData.corpId, function (is) {
  21. if(is){
  22. dd.reLaunch({
  23. url: '../workbench/index/index'
  24. })
  25. } else {
  26. dd.reLaunch({
  27. url: '../noJurisdiction/noJurisdiction'
  28. })
  29. }
  30. },function(data){
  31. if(data.code==3000){
  32. if(that.data.num==3){ return false}
  33. setTimeout(function(){
  34. let num=that.data.num;
  35. that.setData({ num:num+1 })
  36. that.loginAll();
  37. }, 3000);
  38. }else if(data.code==2001){
  39. that.setData({
  40. num:0,
  41. str:'企业授权已过期'
  42. })
  43. }else{
  44. that.setData({
  45. num:0,
  46. str:data.msg
  47. })
  48. }
  49. },true)
  50. },
  51. });