// pages/project/index.js import http from '../../utils/http' import util from '../../utils/util' import api from '../../utils/api' var app = getApp() Page({ /** * 页面的初始数据 */ data: { id: -1, userInfo: {}, device_rent_menus: [{ img: 'http://t18.9026.com/mini/create-order.png', title: '创建订单', desc: '创建外部设备租赁订单', url: '/pages/create-order/index' }, { img: 'http://t18.9026.com/mini/rent-check.png', title: '租赁审核', desc: '设备租赁订单审核' }, { img: 'http://t18.9026.com/mini/error-handle.png', title: '异常处理', desc: '订单流程变更审核处理' }, { img: 'http://t18.9026.com/mini/all-order.png', title: '所有订单', desc: '查看全部设备租赁订单', url: '/pages/order/index' }], device_use_menus: [{ img: 'http://t18.9026.com/mini/use-apply.png', title: '调用申请', desc: '机电负责人调用设备' }, { img: 'http://t18.9026.com/mini/rent-check.png', title: '调用审核', desc: '设备调用订单审核' }, { img: 'http://t18.9026.com/mini/error-handle.png', title: '异常处理', desc: '订单流程变更审核处理' }, { img: 'http://t18.9026.com/mini/all-order.png', title: '所有订单', desc: '查看全部设备调用订单' }], device_depot_menus: [{ img: 'http://t18.9026.com/mini/all-order.png', title: '所有设备', desc: '查看仓库所有设备' }, { img: 'http://t18.9026.com/mini/rent-check.png', title: '维修上报', desc: '设备维修上报' }] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var id = options.id ? options.id : 1 this.setData({ id: id, userInfo: app.globalData.userInfo }) api.getByName(this, 'getUserInfo', 'userInfo', function(res) { app.updateUserInfo(res.data); }); }, navigate: function(e) { wx.navigateTo({ url: e.currentTarget.dataset.url, }) }, getProject() { var that = this http({ url: 'projects/detail', data: { id: this.data.id }, success: function(res) { if(res.code == 0) { that.setData({ project: res.data }) wx.setNavigationBarTitle({ title: res.data.name, }) } } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getProject() }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })