arLogin.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var app = getApp();
  2. var that;
  3. Page({
  4. data: {
  5. code:'',
  6. str:'企业信息同步中...',
  7. isShow:false,
  8. },
  9. onLoad(e) {
  10. that = this;
  11. dd.setNavigationBar({ title: "授权登录" });
  12. if (e.code) {
  13. this.setData({ code: e.code })
  14. }
  15. },
  16. onShow() {
  17. if (app.globalData.userData&&app.globalData.isSuperAdministrator) {
  18. that.setData({ //获取扫码进入参数
  19. isShow: true
  20. })
  21. } else {
  22. app.login(app.globalData.corpId, function (is) {
  23. if (is&&app.globalData.isSuperAdministrator) {
  24. that.setData({ //获取扫码进入参数
  25. isShow: true
  26. })
  27. } else {
  28. dd.reLaunch({
  29. url: '../../noJurisdiction/noJurisdiction'
  30. })
  31. }
  32. }, function () { })
  33. }
  34. },
  35. loginAll2(){
  36. app.globalData.showToast("已取消");
  37. dd.reLaunch({
  38. url: '../workbench/index/index'
  39. })
  40. },
  41. loginAll(){
  42. app.$post("api/auth/qr",{code:this.data.code}).then((res) => {
  43. app.globalData.showToast("已登录");
  44. setTimeout(() => {
  45. dd.reLaunch({
  46. url: '../workbench/index/index'
  47. })
  48. }, 1000);
  49. })
  50. },
  51. });