const util = require("../../utils/util.js"); Component({ properties: { type:{ type: Number, observer:function(val){ this.setData({type:val}); } }, aid:{ type: String, observer:function(val){ this.setData({aid:val}); } }, ishome:{ type: Boolean, observer:function(val){ this.setData({ishome:val}); } }, show:{ type: Boolean, observer:function(newVal){ this.setData({show: newVal }); if (newVal && (this.data.aid || this.data.ishome)) { this.getInfo(); } } } }, data: { show:false, aid:'', phone:'', imgUrl:'', ishome:false, type:0 }, methods: { getInfo() { var that = this; util.ajax({ func: "article/wx_info", data: { "aid": that.data.aid }, load: false }, function (res) { if (res.code == 0) { that.setData({ phone: res.data.weixin, imgUrl: res.data.wxlogo }) } else { util.showTips(res.reason); } }) }, makePhoneCall() { wx.makePhoneCall({ phoneNumber: this.data.phone }); }, close(e){ this.setData({show:e.detail}) this.triggerEvent('close',e.detail) }, lookImg() { let urls = []; urls.push(this.data.imgUrl) wx.previewImage({ current: this.data.imgUrl, // 当前显示图片的http链接 urls: urls // 需要预览的图片http链接列表 }); } } })