var app=getApp(); var utils=require("../../../utils/http"); Page({ /** * 页面的初始数据 */ data: { top:app.globalData.statusBarHeight, hgt:app.globalData.titleBarHeight, siteobj:{}, cid:'', bType: '', canIUseGetUserProfile: false, loadflag:false, shareobj:{}, sharepersonMsg:app.globalData.sharepersonobj, employeeflag:false,//false是用户,true是员工 type:'', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (!!options.clg && options.clg == 7) { wx.reLaunch({ url: '/pages/index/index?clientype=' + options.cty + "&cid=" + options.cid + "&clg=7", }) return false; } var that=this; wx.showLoading({ title: '加载中...', }) if (options.type) { this.setData({ type: options.type }) } if (!!options.ty) { wx.hideShareMenu(); this.setData({ bType: options.ty }) } this.setData({ cid:options.cid, employeeflag:(!!app.globalData.personMsg.binded&&app.globalData.personMsg.binded.state=='在职')?true:false }) that.houseinfofun(); }, houseinfofun(){ const that=this; utils.$post({ url: app.globalData.webUrl + 'client/construction/view', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ id:that.data.cid }, success: function (res) { if(res.data.code=='0'){ that.setData({ siteobj:res.data.data }) } setTimeout(function(){ wx.hideLoading(); },200) } }) }, phonrtap:function(){ wx.makePhoneCall({ phoneNumber: app.globalData.sharepersonobj.phone //仅为示例,并非真实的电话号码 }) }, openVRLink(e) { let type = e.currentTarget.dataset.type; let vrlink = e.currentTarget.dataset.vr; wx.navigateTo({ url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&uid=' + (app.globalData.shareuserid?app.globalData.shareuserid:app.globalData.personMsg.id) + '&cty=construction' + '&ctp=' + app.globalData.clientype + '&aid=' + this.data.cid, }) }, prelookimgtap(){ if(!app.globalData.sharepersonobj.qrcode){ wx.showToast({ title: "当前专属客服的二维码为空!", icon: 'none', duration: 2000 }) return false; } wx.previewImage({ current: app.globalData.imgUrl+app.globalData.sharepersonobj.qrcode, // 当前显示图片的http链接 urls: [app.globalData.imgUrl+app.globalData.sharepersonobj.qrcode]// 需要预览的图片http链接列表 }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, golastap:function(){ wx.navigateBack() }, goindextap:function(){ wx.reLaunch({ url: '/pages/index/index?state=1', }) }, looktap(e){ wx.previewImage({ current: e.currentTarget.dataset.img, // 当前显示图片的 http 链接 urls: this.data.siteobj.step_list[e.currentTarget.dataset.idx].data.img // 需要预览的图片 http 链接列表 }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, shareaddlog:function(){ var that=this; utils.$post({ url: app.globalData.webUrl + 'api/share/addlog', header: { 'Authorization':'bearer '+app.globalData.token }, data: { id:that.data.cid, type:'Construction' }, success: function (r) { } }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { this.shareaddlog(); let img=this.data.siteobj.cover_share_img?this.data.siteobj.cover_share_img:this.data.siteobj.cover; return { title: this.data.siteobj.name, imageUrl: img, path: '/share/pages/constructsite/constructsite?cid='+this.data.cid+'&uid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype } }, onAddToFavorites(res) { let img=this.data.siteobj.cover_share_img?this.data.siteobj.cover_share_img:this.data.siteobj.cover; return { title: this.data.siteobj.name, imageUrl: img, query: 'cid=' + this.data.cid + '&cty=' + app.globalData.clientype + '&clg=7', } } })