// 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]
    this.setData({
      id: options.id,
      info:getInfo
    })
    //this.getInfo(options.id)
  },

  //查询详情
  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
      })
    })
  }

})