index-admin.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // pages/index-admin/index-admin.js
  2. const app = getApp();
  3. const util = require('../../utils/util.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. imgPath: app.globalData.imgPath,
  10. path: app.globalData.path,
  11. username: app.globalData.userInfo.usernameShow,
  12. role_name: app.globalData.roleInfo.name,
  13. app_bottom: '大城细管·大城众管·大城智管'
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. let that = this;
  20. if (!app.globalData.userInfo.usernameShow || !app.globalData.userInfo.nickName || !app.globalData.userInfo.headImgUrl) {
  21. wx.showModal({
  22. title: '提示',
  23. content: '轻应用需要取您的用户信息',
  24. showCancel: false,
  25. confirmText: '确定',
  26. success: (res) => {
  27. if (res.confirm) {
  28. wx.getUserProfile({
  29. desc: '提升用户体验感',
  30. success: (res) => {
  31. app.globalData.userInfo.usernameShow = res.userInfo.nickName;
  32. app.globalData.userInfo.nickName = res.userInfo.nickName;
  33. app.globalData.userInfo.headImgUrl = res.userInfo.avatarUrl;
  34. that.setData({
  35. username: app.globalData.userInfo.usernameShow,
  36. role_name: app.globalData.roleInfo.name
  37. });
  38. util.post({
  39. url: '/sys/user/updateNoAuth',
  40. data: {
  41. id: app.globalData.userInfo.id,
  42. nickName: res.userInfo.nickName,
  43. usernameShow: res.userInfo.nickName,
  44. headImgUrl: res.userInfo.avatarUrl
  45. }
  46. });
  47. },
  48. fail: (res) => {
  49. util.toast('拒绝授权将影响您的体验感');
  50. that.setData({
  51. username: '未知用户',
  52. role_name: app.globalData.roleInfo.name
  53. });
  54. }
  55. });
  56. }
  57. },
  58. });
  59. } else {
  60. that.setData({
  61. username: app.globalData.userInfo.usernameShow,
  62. role_name: app.globalData.roleInfo.name
  63. });
  64. }
  65. // 下一场会议
  66. util.get({
  67. url: '/api/meeting/info/getNextMeeting',
  68. success: (res) => {
  69. wx.hideLoading();
  70. if (res.data.code != 200) {
  71. util.toast(res.data.msg);
  72. } else {
  73. let datas = res.data.data;
  74. if (datas) {
  75. that.setData({
  76. nextTitle: datas.title,
  77. nextTime: util.formatDate(datas.receptionTime),
  78. nextUnit: datas.receptionObject
  79. });
  80. } else {
  81. util.toast('暂无下一场会议');
  82. }
  83. }
  84. }
  85. });
  86. },
  87. /**
  88. * 生命周期函数--监听页面初次渲染完成
  89. */
  90. onReady: function () {
  91. },
  92. /**
  93. * 生命周期函数--监听页面显示
  94. */
  95. onShow: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面隐藏
  99. */
  100. onHide: function () {
  101. },
  102. /**
  103. * 生命周期函数--监听页面卸载
  104. */
  105. onUnload: function () {
  106. },
  107. /**
  108. * 页面相关事件处理函数--监听用户下拉动作
  109. */
  110. onPullDownRefresh: function () {
  111. },
  112. /**
  113. * 页面上拉触底事件的处理函数
  114. */
  115. onReachBottom: function () {
  116. },
  117. /**
  118. * 用户点击右上角分享
  119. */
  120. onShareAppMessage: function () {
  121. },
  122. changeRole: function () {
  123. wx.redirectTo({
  124. url: '../index-guest/index-guest',
  125. })
  126. },
  127. informationRelease: function () {
  128. wx.navigateTo({
  129. url: '../information-release/information-release',
  130. })
  131. },
  132. chatRoom: function () {
  133. wx.navigateTo({
  134. url: '../chat-room/chat-room',
  135. })
  136. },
  137. lightMap: function () {
  138. wx.navigateTo({
  139. url: '../light-map/light-map',
  140. })
  141. },
  142. meetingCover: function () {
  143. wx.navigateTo({
  144. url: '../meeting-cover/meeting-cover',
  145. })
  146. }
  147. })