org.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. var app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. openId: "",
  8. orgList: [],
  9. orgId: "",
  10. orgName: ""
  11. },
  12. onLoad: function (options) {
  13. wx.showNavigationBarLoading()
  14. var that = this;
  15. var url = app.globalData.cloudBase + "/Wx/Rtu/Org/List";
  16. wx.request({
  17. url: url,
  18. method: 'GET',
  19. // data: {
  20. // openid: this.data.openid
  21. // },
  22. header: {
  23. "Content-Type": "json"
  24. },
  25. success: function (res) {
  26. wx.hideNavigationBarLoading();
  27. if (res.data.code === "0") {
  28. that.setData({
  29. orgList: res.data.data
  30. });
  31. }
  32. },
  33. fail: function (error) {
  34. wx.hideNavigationBarLoading();
  35. }
  36. })
  37. },
  38. radioChange: function (e) {
  39. const value = e.detail.value;
  40. const values = value.split(":");
  41. const id = values[0];
  42. const name = values[1];
  43. var pages = getCurrentPages();
  44. var prevPage = pages[pages.length - 2]; //上一个页面 的数据data
  45. prevPage.setData({
  46. orgId: id,
  47. orgName: name
  48. })
  49. this.setData({
  50. orgId: id,
  51. orgName: name
  52. });
  53. }
  54. })