// pages/institutions/institutionsdetail.js
const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        noticeContent: '',
        inId: '',
        detailBean: null
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            inId: options.id
        })
        this.getInstitutionDetail()
    },
    getInstitutionDetail() {
        var _self = this
        wx.showLoading({
            title: '加载中...',
        })
        app.restAjax.get(app.restAjax.path(app.apis.getInstitutionDetailById, [app.baseUrls.cardUrl, _self.data.inId]), {}, {},
            (code, data) => {
                wx.hideLoading({})
                if (code == 200) {
                    if (data.institutionImage) {
                        var ps = data.institutionImage.split(',')
                        var photos = []
                        for (var i = 0; i < ps.length; i++) {
                            var urls = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + ps[i]
                            photos = photos.concat(urls)
                        }
                        data.showPhoto = photos
                    }
                    _self.setData({
                        detailBean: data
                    })
                }
            }, (code, error) => {
                wx.hideLoading({})
            })
    }
})