// pageage/samplingRetestingDetail/index.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { loadShow:false, radio:'', id:'', projectId:'', retesData:{}, ImageArr:[], //详情标识 detailFlag:"", state:"", result:"", photoUrl:[] }, onChange(event) { this.setData({ radio: event.detail, }); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let {id,projectId} = options this.setData({ id, projectId, }) this.getSamplingRetesDataInfoById() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, /** * 获取详情信息 */ getSamplingRetesDataInfoById(){ let that = this let {id,projectId} = this.data wx.request({ url: app.globalData.szhUrl + '/system/retestinfo/getRetestInfoById', method:"get", data:{ projectId, id }, header:{ 'content-type': 'application/x-www-form-urlencoded' }, success(res){ var data = res.data.data data.typeFlagName = that.convertRetesingName(data.typeFlag) that.setData({ retesData:data, photoUrl:data.photoUrl == null ? [] : data.photoUrl.split(',') }) } }) }, /** * 置换名称 */ convertRetesingName(typeFlag){ let typeName = "" switch(typeFlag){ case 1: typeName = "钢筋原材料取样复试" break; case 2: typeName = "钢筋试拉件取样复试" break; case 3: typeName = "钢筋试拉件取样复试" break; case 4: typeName = "混凝土试件取样复试" break; case 5: typeName = "混凝土试件取样复试" break; } return typeName; }, })