index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. }, {
  44. img: 'http://t18.9026.com/mini/error-handle.png',
  45. title: '异常处理',
  46. desc: '订单流程变更审核处理'
  47. }, {
  48. img: 'http://t18.9026.com/mini/all-order.png',
  49. title: '所有订单',
  50. desc: '查看全部设备调用订单'
  51. }],
  52. device_depot_menus: [{
  53. img: 'http://t18.9026.com/mini/all-order.png',
  54. title: '所有设备',
  55. desc: '查看仓库所有设备'
  56. }, {
  57. img: 'http://t18.9026.com/mini/rent-check.png',
  58. title: '维修上报',
  59. desc: '设备维修上报'
  60. }]
  61. },
  62. /**
  63. * 生命周期函数--监听页面加载
  64. */
  65. onLoad: function (options) {
  66. var id = options.id ? options.id : 1
  67. this.setData({
  68. id: id,
  69. userInfo: app.globalData.userInfo
  70. })
  71. api.getByName(this, 'getUserInfo', 'userInfo', {}, function(res) {
  72. app.updateUserInfo(res);
  73. });
  74. },
  75. navigate: function(e) {
  76. wx.navigateTo({
  77. url: e.currentTarget.dataset.url,
  78. })
  79. },
  80. getProject() {
  81. var that = this
  82. http({
  83. url: 'projects/detail',
  84. data: {
  85. id: this.data.id
  86. },
  87. success: function(res) {
  88. if(res.code == 0) {
  89. that.setData({
  90. project: res.data
  91. })
  92. wx.setNavigationBarTitle({
  93. title: res.data.name,
  94. })
  95. }
  96. }
  97. })
  98. },
  99. /**
  100. * 生命周期函数--监听页面初次渲染完成
  101. */
  102. onReady: function () {
  103. },
  104. /**
  105. * 生命周期函数--监听页面显示
  106. */
  107. onShow: function () {
  108. this.getProject()
  109. },
  110. /**
  111. * 生命周期函数--监听页面隐藏
  112. */
  113. onHide: function () {
  114. },
  115. /**
  116. * 生命周期函数--监听页面卸载
  117. */
  118. onUnload: function () {
  119. },
  120. /**
  121. * 页面相关事件处理函数--监听用户下拉动作
  122. */
  123. onPullDownRefresh: function () {
  124. },
  125. /**
  126. * 页面上拉触底事件的处理函数
  127. */
  128. onReachBottom: function () {
  129. },
  130. /**
  131. * 用户点击右上角分享
  132. */
  133. onShareAppMessage: function () {
  134. }
  135. })