index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // pages/project/index.js
  2. import http from '../../utils/http'
  3. import util from '../../utils/util'
  4. import api from '../../utils/api'
  5. var app = getApp()
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. id: -1,
  12. userInfo: {},
  13. device_rent_menus: [{
  14. img: 'http://t18.9026.com/mini/create-order.png',
  15. title: '创建订单',
  16. desc: '创建外部设备租赁订单',
  17. url: '/pages/create-order/index'
  18. }, {
  19. img: 'http://t18.9026.com/mini/rent-check.png',
  20. title: '租赁审核',
  21. desc: '设备租赁订单审核',
  22. url: '/pages/order/index?type=check'
  23. }, {
  24. img: 'http://t18.9026.com/mini/error-handle.png',
  25. title: '异常处理',
  26. desc: '订单流程变更审核处理',
  27. url: '/pages/order/index?index=4'
  28. }, {
  29. img: 'http://t18.9026.com/mini/all-order.png',
  30. title: '所有订单',
  31. desc: '查看全部设备租赁订单',
  32. url: '/pages/order/index'
  33. }],
  34. device_use_menus: [{
  35. img: 'http://t18.9026.com/mini/use-apply.png',
  36. title: '调用申请',
  37. desc: '机电负责人调用设备',
  38. url: '/pages/create-order-inner/index'
  39. }, {
  40. img: 'http://t18.9026.com/mini/rent-check.png',
  41. title: '调用审核',
  42. desc: '设备调用订单审核',
  43. url: '/pages/order-inner/index?type=check'
  44. }, {
  45. img: 'http://t18.9026.com/mini/error-handle.png',
  46. title: '异常处理',
  47. desc: '订单流程变更审核处理',
  48. url: '/pages/order-inner/index?index=4'
  49. }, {
  50. img: 'http://t18.9026.com/mini/all-order.png',
  51. title: '所有订单',
  52. desc: '查看全部设备调用订单',
  53. url: '/pages/order-inner/index'
  54. }],
  55. device_depot_menus: [{
  56. img: 'http://t18.9026.com/mini/all-order.png',
  57. title: '所有设备',
  58. desc: '查看仓库所有设备',
  59. url: '/pages/device-inner/index'
  60. }, {
  61. img: 'http://t18.9026.com/mini/rent-check.png',
  62. title: '维修上报',
  63. desc: '设备维修上报'
  64. }]
  65. },
  66. /**
  67. * 生命周期函数--监听页面加载
  68. */
  69. onLoad: function (options) {
  70. var id = options.id ? options.id : 1
  71. this.setData({
  72. id: id,
  73. userInfo: app.globalData.userInfo
  74. })
  75. api.getByName(this, 'getUserInfo', 'userInfo', {}, function(res) {
  76. app.updateUserInfo(res);
  77. });
  78. },
  79. navigate: function(e) {
  80. wx.navigateTo({
  81. url: e.currentTarget.dataset.url,
  82. })
  83. },
  84. getProject() {
  85. var that = this
  86. http({
  87. url: 'projects/detail',
  88. data: {
  89. id: this.data.id
  90. },
  91. success: function(res) {
  92. if(res.code == 0) {
  93. that.setData({
  94. project: res.data
  95. })
  96. wx.setNavigationBarTitle({
  97. title: res.data.name,
  98. })
  99. }
  100. }
  101. })
  102. },
  103. /**
  104. * 生命周期函数--监听页面初次渲染完成
  105. */
  106. onReady: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面显示
  110. */
  111. onShow: function () {
  112. this.getProject()
  113. },
  114. /**
  115. * 生命周期函数--监听页面隐藏
  116. */
  117. onHide: function () {
  118. },
  119. /**
  120. * 生命周期函数--监听页面卸载
  121. */
  122. onUnload: function () {
  123. },
  124. /**
  125. * 页面相关事件处理函数--监听用户下拉动作
  126. */
  127. onPullDownRefresh: function () {
  128. },
  129. /**
  130. * 页面上拉触底事件的处理函数
  131. */
  132. onReachBottom: function () {
  133. },
  134. /**
  135. * 用户点击右上角分享
  136. */
  137. onShareAppMessage: function () {
  138. }
  139. })