You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
2.7 KiB
JavaScript

2 years ago
const app = getApp();
const commonUtil = require('../../utils/commonUtil.js');
const dateUtil = require('../../utils/dateUtil.js');
Page({
/**
* 页面的初始数据
*/
data: {
agencyId:'',
agencyDetail:{},
files: [],
dataLoading:false
},
goEditAgent:function(e){
var id = this.data.agencyId
wx.navigateTo({
url: '/pages/editAgent/index?agencyId=' + id,
})
},
previewImage: function (e) {
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表
})
},
getDetailById: function () {
var that = this;
wx.request({
url: app.globalData.ip + '/agency/getDetailById',
data: {
id: that.data.agencyId
},
header: app.globalData.header,
method: "GET",
success: function (res) {
console.log(res.data);
if (res.data.status == 200) {
var filesTemp = [];
if (app.isNotEmptyCheck(res.data.data.imageList)) {
res.data.data.imageList.forEach(item => {
filesTemp.push(item.url);
});
}
that.setData({
agencyDetail: res.data.data,
// phoneNumber: res.data.data.tel,
// lat: res.data.data.lat,
// lng: res.data.data.lng,
// detailAddress: res.data.data.address,
files: filesTemp,
});
} else {
app.showTips(that, res.data.msg);
}
that.setData({
dataLoading:true
});
wx.hideLoading()
},
fail: function (res) {
console.log(res);
that.setData({
dataLoading:true
});
wx.hideLoading()
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
if (app.isNotEmptyCheck(options.agencyId)) {
this.setData({
agencyId: options.agencyId
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
wx.showLoading({
title: '加载中...',
})
this.getDetailById();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})