1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- // pages/car/info.js
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- info: {},
- fileList:[]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var pages = getCurrentPages();
- var prevPage = pages[pages.length - 2];
- let getInfo = prevPage.data.resData[options.index]
- //船舶证书 certificatePathList
- let certificatePathList = []
- if(getInfo.shipCertificatePath){
- let unloadImgArr = getInfo.shipCertificatePath.split(',')
- unloadImgArr.forEach(element => {
- certificatePathList.push({
- url : app.host.BASEIMG_URL+element,
- imgUrl : element,
- isImage : true
- })
- });
- }
- //安全环保合同 contractPathList
- let contractPathList = []
- if(getInfo.contractPath){
- let unloadImgArr = getInfo.contractPath.split(',')
- unloadImgArr.forEach(element => {
- contractPathList.push({
- url : app.host.BASEIMG_URL+element,
- imgUrl : element,
- isImage : true
- })
- });
- }
- this.setData({
- info : getInfo,
- certificatePathList : certificatePathList,
- contractPathList : contractPathList
- })
- //获取船主
- app.request.GET({
- url: app.API.userDetail,
- page: this,
- params: {
- 'id': getInfo.shipId
- },
- successFun: true
- }).then(res => {
- let getInfo = res.data.data;
- this.setData({
- shipIdName : getInfo.name,
- shipMobile : getInfo.phone
- })
- })
- },
- //查询详情
- getInfo: function (id) {
- //详情
- app.request.requestGetApi(app.API.api.carDetail, {
- 'id': id
- }, this, function (res, _that) {
- let data = res.data.data;
- let getPhotoArr = data.certificateNoImage.split(',');
- let getfileListArr = []
- for(let i=0;i<getPhotoArr.length;i++){
- getfileListArr.push({
- url:getPhotoArr[i]
- })
- }
- _that.setData({
- info: data,
- "fileList":getfileListArr
- })
- })
- }
- })
|