index.js 3.1 KB

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