// index/pages/progressdetail/progressdetail.js const app = getApp(); var utils = require("../../../utils/http"); const util = require("../../../utils/util") let page = 1; let vrpage = 1; let videopage = 1; Page({ /** * 页面的初始数据 */ data: { cid: '', detail: {}, companyobj: {}, personMsg: {}, progresslist: [], showContent: false, datashow: false, dialog: false, showCaseStyle: false, showArea: false, showInput: false, moreVrBol: false, moreVideoBol: false, type: 3, labelArr: [], constructlist: [], caselist: [], imageArr: [], VRlinklist: [], caseTypelist: [], videolink: {}, constructnum: 0, allDataCount: 1, imgUrl: app.globalData.imgUrl, wshareshow: false, showVrOrVideo: false, showTask: true, showArticle: '', activeType: '', caseTypeActive: '', dscTitle: '', dscDataMsg: {}, nowCaseStyleName: '', nowCaseStyleId: '', nowAreaName: '', nowAreaId: '', nowAreaStart: '', nowAreaEnd: '', casekeytext: '', showSortNum: 1, showType: 'vr', houseTypeActive: 0, showVideoNum: 1, currentVideoIndex: 0, tab: [{ name: '实景', type: '', count: 1 }, { name: '效果图', type: 'img', count: 0 }, { name: 'VR', type: 'vr', count: 0 }, { name: '视频', type: 'video', count: 0 }], houseTypeTab: [], houseTypeArr: ['全部', '一居', '二居', '三居', '四居', '五居', '六居', '七居', '八居', '别墅'], houseTypelists: [], houseTypeItemlist: [], devCaselist: [], ltype: '', bType: "", pType: "", labelId: "", viewMore: 3, devCaseData: [], showCutImage: false, loading: false, showApproval: false, remark: "", trackimgarr: [], nowimagearr: [], shareApprovallist: [], shareUrl: '', shareTitle: '', shareImage: '', shareType: '', shareId: '', shareQuery: '' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { page = 1; vrpage = 1; videopage = 1; if (!!options.cid) { wx.showLoading({ title: '加载中...', }) this.setData({ companyobj: app.globalData.companyobj, cid: options.cid, personMsg: app.globalData.personMsg, }) if (this.data.companyobj.company_name) { if (this.data.companyobj.company_name.length > 6) { this.data.companyobj.company_name = this.data.companyobj.company_name.substring(0, 6); this.setData({ companyobj: this.data.companyobj }) } } this.getBuildingProgressDetail(); } if (!!options.ty) { this.setData({ bType: options.ty, showTask: false }) } if (!!options.tp) { this.setData({ pType: options.tp }) } if (options.type) { this.setData({ ltype: options.type }) } }, handShowUpload: function () { this.setData({ trackimgarr: [], nowimagearr: [], remark: "", showCutImage: true }) }, handleShowApproval() { this.setData({ showApproval: true }) wx.showLoading({ title: '加载中...', }) this.getBrokerApprovallist(); }, //获取审核列表 getBrokerApprovallist() { const that = this; utils.$post({ url: app.globalData.webUrl + 'api/agentEmp/share_list', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.cid, type: "Building" }, success: function (res) { wx.hideLoading(); if (res.data.code == 0) { that.setData({ shareApprovallist: res.data.data }) } } }) }, getBuildingProgresslabel() { const that = this; utils.$post({ url: app.globalData.webUrl + 'api/buildingLabel/index', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: {}, success: function (res) { if (res.data.code == 0) { that.setData({ labelArr: res.data.data }) } } }) }, switchlabelFun(e) { page = 1; this.setData({ labelId: e.currentTarget.dataset.id }) wx.showLoading({ title: '加载中...', }) this.buildingProgress(); }, previewImageEvent(e) { let index = parseInt(e.currentTarget.dataset.index); let idx = parseInt(e.currentTarget.dataset.idx); wx.previewImage({ urls: this.data.shareApprovallist[index].img, current: this.data.shareApprovallist[index].img[idx] }) }, closeDialog: function () { this.setData({ showCutImage: false, showApproval: false }) }, getTextarea(e) { this.setData({ remark: e.detail.value }) }, //审核通过 confirmApproval(e) { let id = e.currentTarget.dataset.id; const that = this; wx.showModal({ title: '审核提醒', content: '您确认通过审核吗?', complete: (res) => { if (res.confirm) { utils.$post({ url: app.globalData.webUrl + 'api/agentEmp/validate_share', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { share_id: id, status: 1 }, success: function (res) { if (res.data.code == 0) { wx.showToast({ title: '已通过审核', icon: "none", duration: 1500, success: function () { setTimeout(() => { that.getBrokerApprovallist(); }, 1000) } }) } } }) } } }) }, //审核拒绝 rejectApproval(e) { let id = e.currentTarget.dataset.id; const that = this; wx.showModal({ title: '审核提醒', content: '您确认驳回审核吗?', complete: (res) => { if (res.confirm) { utils.$post({ url: app.globalData.webUrl + 'api/agentEmp/validate_share', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { share_id: id, status: 2 }, success: function (res) { if (res.data.code == 0) { wx.showToast({ title: '已驳回审核', icon: "none", duration: 1500, success: function () { setTimeout(() => { that.getBrokerApprovallist(); }, 1000) } }) } } }) } } }) }, //上传分享截图 submitData() { if (!this.data.trackimgarr.length) { wx.showToast({ title: '请上传分享截图!', icon: "none", duration: 1500, }) return false; } this.setData({ loading: true }) this.ossuploadimg(); }, uploadImage() { let _this = this; wx.chooseMedia({ count: 9, mediaType: ["image"], sourceType: ["album", "camera"], sizeType: ['original', 'compressed'], success: function (res) { if (res.errMsg == "chooseMedia:ok") { _this.createImagePayment(res.tempFiles); } } }) }, //删除图片 imageDel(e) { let index = e.currentTarget.dataset.index; this.data.trackimgarr.splice(index, 1); this.setData({ trackimgarr: this.data.trackimgarr }) }, //选择添加图片 createImagePayment: function (imgUrl) { var that = this; if (imgUrl.length == 0) return; var lent = that.data.trackimgarr.length + imgUrl.length; if (lent > 9) { lent = 9 } else { lent = lent; } let trackimgarr = that.data.trackimgarr; let len = imgUrl.length; if ((trackimgarr.length + len) > 9) { for (let j = 0; j < len; j++) { if (trackimgarr.length < 9) { trackimgarr.push(imgUrl[j]); } } } else { trackimgarr = trackimgarr.concat(imgUrl); } that.setData({ trackimgarr: trackimgarr }) }, //oss上传图片到阿里云 ossuploadimg: function (e) { let that = this; let trackimgarr = that.data.trackimgarr; var arr = []; for (let i = 0; i < trackimgarr.length; i++) { //获取文件后缀 // 随机生成文件名称 let rstr = trackimgarr[i].tempFilePath.split('.'); var fileRandName = Date.now() + "" + parseInt(Math.random() * 10000) + i; var imgName = fileRandName + '.' + 'png'; // var fileName = that.data.; var date = new Date(); var time = date.getFullYear() + '' + (date.getMonth() * 1 + 1) + '' + date.getDate(); var imgstr = 'broker/' + time + '/' + imgName; var nowimagearr = that.data.nowimagearr; nowimagearr.push(imgstr); that.setData({ nowimagearr: nowimagearr }) wx.uploadFile({ url: 'https://wzh-zqxg.oss-cn-hangzhou.aliyuncs.com', filePath: trackimgarr[i].tempFilePath, name: 'file', formData: { // name: that.data.imgSrc[0], key: 'broker/' + time + '/' + imgName, policy: "eyJleHBpcmF0aW9uIjoiMjA0MC0wMS0wMVQxMjowMDowMC4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF1dfQ==", OSSAccessKeyId: "LTAI5tHjWupJSCAycy2yVbQZ", success_action_status: "200", signature: "GPu5wBYVzdhICS/hdJH6rKG0kos=", }, header: { "Content-Type": "multipart/form-data", 'accept': 'application/json', }, success: function (rs) { if (rs.errMsg == 'uploadFile:ok') { arr.push('0'); if (arr.length == trackimgarr.length) { that.requestUploadImageApi(); } } }, fail(res) { wx.hideLoading() } }) } }, //提交数据 requestUploadImageApi() { let that = this; let imgs = that.data.nowimagearr.map(v => { return { serverId: "", img: v, }; }) utils.$post({ url: app.globalData.webUrl + 'api/agentsWork/upload_share_log', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { article_id: that.data.cid, file_media_id: imgs, remarks: that.data.remark, type: "Building" }, success: function (res) { that.setData({ loading: false }) if (res.data.code == '0') { wx.showToast({ title: '上传成功', icon: "success", duration: 1500 }) that.setData({ showCutImage: false }) } } }) }, viewHouseType(e) { let cid = e.currentTarget.dataset.cid; wx.navigateTo({ url: '/index/pages/housetype/housetype?cid=' + cid + '&buildId=' + this.data.cid + '&ty=' + this.data.bType, }) }, /** * 排序 */ compare(property) { return function (a, b) { var value1 = a[property]; var value2 = b[property]; return value1 - value2; } }, toggleClass(e) { let id = e.currentTarget.dataset.cid; if (id == this.data.showArticle) { this.setData({ showArticle: '' }) } else { this.setData({ showArticle: id }) } }, jumpNameCard() { wx.navigateTo({ url: '/index/pages/namecard/namecard' }) }, devCaseDetail(e) { let id = e.currentTarget.dataset.id; let type = e.currentTarget.dataset.type; if (type == 1) { var that = this; utils.$get({ url: app.globalData.webUrl + 'api/building/dev_case_detail', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: id, }, success: function (res) { if (res.data.code == '0') { let vrlink = res.data.data.vr_link; if (vrlink) { wx.navigateTo({ url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&uid=' + (app.globalData.shareuserid ? app.globalData.shareuserid : app.globalData.personMsg.id) + '&cty=building' + '&ctp=' + app.globalData.clientype + '&aid=' + that.data.detail.id, }) } else { wx.showToast({ title: '未上传VR链接', icon: 'none', duration: 1500 }) } } else { wx.showToast({ title: res.data.msg, icon: 'none', duration: 1500 }) } } }) } else { wx.navigateTo({ url: '/index/pages/viewcase/viewcase?cid=' + id + '&type=1', }) } }, handleSwitch(e) { let type = e.currentTarget.dataset.type; let count = e.currentTarget.dataset.count; let swiperIndex = 0; if (type == 'img') { swiperIndex = 1; } else if (type == 'vr') { swiperIndex = this.data.imageArr.length + 1; } else if (type == 'video') { swiperIndex = this.data.imageArr.length + this.data.VRlinklist.length + 1; } else { swiperIndex = 0; } this.setData({ swiperIndex: swiperIndex, activeType: type, allDataCount: count, showSortNum: 1, }) }, /** * 户型剖析 */ houseTypeDsc(e) { let index = e.currentTarget.dataset.index; let title = e.currentTarget.dataset.title; let room = e.currentTarget.dataset.room; this.setData({ dscDataMsg: this.data.houseTypeItemlist[index], dscTitle: room == 9 ? '别墅' : title, dialog: true }) }, /** * 询问报价 */ inquiry() { if (this.data.bType == 'b') { wx.showToast({ title: '装修推荐官无需询问', icon: 'none', duration: 1500 }) } else { wx.showToast({ title: '员工无需询问', icon: 'none', duration: 1500 }) } }, getImageAndVRAndVideo(type) { var that = this; let dataObj = {}; if (type == 'vr') { dataObj = { id: that.data.cid, type: type, page: vrpage, }; } else { dataObj = { id: that.data.cid, type: type, page: videopage, }; } utils.$post({ url: app.globalData.webUrl + 'api/building/progress', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: dataObj, success: function (res) { if (videopage > 1 || vrpage > 1) { setTimeout(() => { wx.hideLoading(); }, 1000) } if (res.data.code == '0') { if (type == 'vr') { that.getImageAndVRAndVideo('video'); if (dataObj.page == 1) { that.data.VRlinklist = []; } if (res.data.data.length == 0) { that.setData({ moreVrBol: true }) } let vrlist = []; res.data.data.forEach(v => { if (v.vr && v.vr.length > 0) { vrlist.push(...v.vr); } }) that.data.VRlinklist = that.data.VRlinklist.concat(vrlist); that.data.tab[2].count = that.data.VRlinklist.length; that.setData({ VRlinklist: that.data.VRlinklist, tab: that.data.tab }) if (dataObj.page > 1) { that.setData({ allDataCount: that.data.VRlinklist.length }) } } else { that.buildingProgress(); if (dataObj.page == 1) { that.data.videolink = []; } if (res.data.data.length == 0) { that.setData({ moreVideoBol: true }) } let videoArr = res.data.data.map(v => { return { video: v.video, cover: v.img.length ? v.img[0] : '' } }); that.data.videolink = that.data.videolink.concat(videoArr); that.data.tab[3].count = that.data.videolink.length; that.setData({ videolink: that.data.videolink, tab: that.data.tab, }) if (dataObj.page > 1) { that.setData({ allDataCount: that.data.videolink.length }) } } } } }) }, handlelist(e) { let type = e.currentTarget.dataset.type; let idx = e.currentTarget.dataset.index; let devCaselist = []; this.data.houseTypelists[idx].list.forEach(v => { if (v.devcase && v.devcase.length) { devCaselist.push(...v.devcase); } }) this.setData({ houseTypeActive: type, houseTypeItemlist: this.data.houseTypelists[idx].list, devCaseData: devCaselist }) }, /** * 进入案例详情 */ casemsgtap: function (e) { wx.navigateTo({ url: '/index/pages/casemsg/casemsg?cid=' + e.currentTarget.dataset.cid, }) }, sitetap(e) { if (!this.data.ltype) { wx.navigateTo({ url: '/index/pages/constructsite/constructsite?cid=' + e.currentTarget.dataset.cid, }) } else { wx.navigateTo({ url: '/customer/pages/sitemsg/sitemsg?cid=' + e.currentTarget.dataset.cid + '&type=' + this.data.ltype, }) } }, previewWechat() { if (this.data.personMsg.binded && this.data.personMsg.binded.qrcode) { if (this.data.personMsg.binded.qrcode.indexOf("https") < 0) { wx.previewImage({ urls: [this.data.imgUrl + this.data.personMsg.binded.qrcode], }) } else { wx.previewImage({ urls: [this.data.personMsg.binded.qrcode], }) } } else { wx.showToast({ title: '暂未设置二维码', icon: "none" }) } }, mobileAction() { wx.makePhoneCall({ phoneNumber: this.data.personMsg.phone, }) }, getBuildingProgressDetail() { var that = this; utils.$post({ url: app.globalData.webUrl + 'api/building/view', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.cid }, success: function (res) { if (res.data.code == 0) { that.getBuildingProgresslabel(); that.getImageAndVRAndVideo('vr'); let dataMsg = res.data.data; dataMsg.update_time = dataMsg.update_time.split(' ')[0]; dataMsg.areastr = dataMsg.area_list.map(v => `${v}㎡`).join('/'); dataMsg.content = dataMsg.content.replace(/\r|\n/ig, ""); let houseTypeArry = []; let devCaselist = []; if (dataMsg.housetype && Object.keys(dataMsg.housetype).length > 0) { Object.keys(dataMsg.housetype).forEach(v => { houseTypeArry.push({ name: that.data.houseTypeArr[v], id: v, count: dataMsg.housetype[v].length, list: dataMsg.housetype[v] }) }) if (houseTypeArry.length) { houseTypeArry[0].list.forEach(v => { if (v.devcase && v.devcase.length) { devCaselist.push(...v.devcase) } }) } } that.data.tab[1].count = dataMsg.cover.length; that.setData({ detail: dataMsg, imageArr: dataMsg.cover, tab: that.data.tab, houseTypelists: houseTypeArry.length ? houseTypeArry.sort(that.compare("id")) : [], houseTypeItemlist: houseTypeArry.length ? houseTypeArry[0].list : [], devCaseData: devCaselist }) wx.setNavigationBarTitle({ title: dataMsg.name, }) } } }) }, openVRLink(e) { let type = e.currentTarget.dataset.type; if (type == 2) { 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=building' + '&ctp=' + app.globalData.clientype + '&aid=' + this.data.detail.id, }) } else { let id = e.currentTarget.dataset.id; let vrlink = e.currentTarget.dataset.vrlink; wx.navigateTo({ url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&aid=' + id, }) } }, setcasekeywordtap: function (e) { this.setData({ casekeytext: e.detail.value }) }, closeMask() { this.setData({ showVrOrVideo: false, dialog: false, showArea: false, showCaseStyle: false, showInput: false, }) }, handleCaseStyle() { this.setData({ showCaseStyle: true }) }, handleShowArea() { this.setData({ showArea: true }) }, handleShowInput() { this.data.showInput = !this.data.showInput; this.setData({ showInput: this.data.showInput }) }, dothis() { }, showAllContent() { let showContent = !this.data.showContent; this.setData({ showContent: showContent }) }, handleMore() { if (this.data.viewMore == this.data.progresslist.length) { this.setData({ viewMore: 3 }) } else { this.setData({ viewMore: this.data.progresslist.length }) } }, handleTips() { if (this.data.bType == 'b') { wx.showToast({ title: '装修推荐官不可催更新', icon: 'none', duration: 1500 }) } else { wx.showToast({ title: '员工不可催更新', icon: 'none', duration: 1500 }) } }, /** * 放大图片 * @param {*} e */ previewImage(e) { let type = e.currentTarget.dataset.type; if (type == 'cover') { let imgUrl = e.currentTarget.dataset.img; if (imgUrl) { wx.previewImage({ current: imgUrl, urls: [imgUrl] }) } else { wx.showToast({ title: '暂无图片展示', icon: 'none', }) } } else if (type == 'image') { let imgUrl = e.currentTarget.dataset.img; wx.previewImage({ current: imgUrl, urls: this.data.imageArr }) } else if (type == 'vr') { this.setData({ showVrOrVideo: true, showType: 'vr' }) } else if (type == 'video') { this.setData({ showVrOrVideo: true, showType: 'video', currentVideoIndex: this.data.showSortNum - 1 < 0 ? 0 : (this.data.showSortNum - 1), showVideoNum: this.data.showSortNum }) } else if (type == 'himg') { let idx = e.currentTarget.dataset.index; let imgUrl = e.currentTarget.dataset.img; wx.previewImage({ current: imgUrl, urls: this.data.houseTypeItemlist[idx].house_img, }) } else { let imgUrl = e.currentTarget.dataset.img; let index = e.currentTarget.dataset.index; var arr = this.data.progresslist[index].img; wx.previewImage({ current: imgUrl, urls: arr, }) } }, /** * 顶部轮播切换 */ swiperChange(e) { let currentItemId = e.detail.currentItemId; if (currentItemId.indexOf('img') > -1) { let index = currentItemId.split('-')[1]; let type = currentItemId.split('-')[0]; this.setData({ activeType: type, showSortNum: parseInt(index) + 1, allDataCount: this.data.imageArr.length }) } if (currentItemId.indexOf('vr') > -1) { let index = currentItemId.split('-')[1]; let type = currentItemId.split('-')[0]; this.setData({ activeType: type, showSortNum: parseInt(index) + 1, allDataCount: this.data.VRlinklist.length }) if (!this.data.moreVrBol && (index == (this.data.VRlinklist.length - 1))) { wx.showLoading({ title: '正在加载数据...', }) vrpage = vrpage * 1 + 1; this.getImageAndVRAndVideo('vr'); } } if (currentItemId.indexOf('video') > -1) { let index = currentItemId.split('-')[1]; let type = currentItemId.split('-')[0]; this.setData({ activeType: type, showSortNum: parseInt(index) + 1, allDataCount: this.data.videolink.length }) for (let i = 0; i < this.data.videolink.length; i++) { let videoEle = this.selectComponent(`#videolink${i}`); videoEle.pause(); } if (!this.data.moreVideoBol && (index == (this.data.videolink.length - 1))) { wx.showLoading({ title: '正在加载数据...', }) videopage = videopage * 1 + 1; this.getImageAndVRAndVideo('video'); } } if (currentItemId.indexOf('cover') > -1) { this.setData({ activeType: '', showSortNum: 1, allDataCount: 1 }) } }, /** * 视频放大滑动切换 */ swiperVideoChange(e) { this.setData({ showVideoNum: parseInt(e.detail.current) + 1 }) }, handleFullPlay(e) { let videoId = e.currentTarget.dataset.id; var videoContext = this.selectComponent(`#${videoId}`); videoContext.requestFullScreen({ direction: 0 }) }, buildingProgress() { var that = this; utils.$post({ url: app.globalData.webUrl + 'api/building/progress', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.cid, page: page, label_id: that.data.labelId }, success: function (res) { wx.hideLoading(); if (res.data.code == '0') { let progress = res.data.data; that.setData({ progresslist: progress, datashow: true }) } } }) }, handleCollect(e) { const that = this; let detail = this.data.detail; let collect = that.data.detail.collected; let urllink = !collect ? app.globalData.webUrl + 'api/building/collect' : app.globalData.webUrl + 'api/building/collectCancel'; utils.$post({ url: urllink, header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.cid, }, success: (res) => { if (res.data.code == 0) { detail.collected = !collect; this.setData({ detail: detail }) wx.showToast({ title: res.data.msg, icon: 'none', duration: 1000 }) } } }) }, shareProgress(e) { let id = e.currentTarget.dataset.id; this.setData({ shareId: id, shareType: 'buildingProgress', shareUrl: '/share/pages/buildShare/buildShare', shareQuery: 'cid=' + id + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id, shareImage: this.data.detail.cover_share_img ? this.data.detail.cover_share_img : this.data.detail.cover[0], shareTitle: this.data.detail.name + '-楼盘进度', wshareshow: true }) }, sharetap() { this.setData({ shareId: this.data.cid, shareType: 'building', shareUrl: '/share/pages/buildprogress/buildprogress', shareQuery: 'cid=' + this.data.cid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id, shareImage: this.data.detail.cover_share_img ? this.data.detail.cover_share_img : this.data.detail.cover[0], shareTitle: this.data.detail.name, wshareshow: true }) }, setpostertap: function () { if (this.data.bType == 'b') { wx.navigateTo({ url: '/index/pages/setposter/setposter?type=building&aid=' + this.data.cid + "&ty=b&listshare=", }) } else { wx.navigateTo({ url: '/index/pages/setposter/setposter?type='+this.data.shareType+'&aid=' + this.data.shareId + "&listshare=", }) } }, sendfriendtap() { this.sharelogtap(); }, shareurltap: function () { wx.showLoading({ title: '加载中...', }) if (this.data.bType == 'b') { util.schemefun('/share/pages/buildprogress/buildprogress', 'uid=' + app.globalData.agentEmployeEid + '&cid=' + this.data.cid + '&ctp=' + app.globalData.clientype + "&agid=" + app.globalData.brokeruserId, this.data.cid, 'building', ''); } else { util.schemefun(this.data.shareUrl, this.data.shareQuery, this.data.shareId, this.data.shareType, ''); } this.sharelogtap(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.setData({ imgUrl: app.globalData.imgUrl, }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, setypetap(e) { this.setData({ type: e.currentTarget.dataset.type }) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { wx.showLoading({ title: '加载中...', }) var that = this; page = page * 1 + 1; utils.$post({ url: app.globalData.webUrl + 'api/building/progress', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.cid, page: page }, success: function (res) { setTimeout(() => { wx.hideLoading(); }, 1000); if (res.data.code == '0') { let progress = res.data.data; if (page > 1 && !progress.length) { wx.showToast({ title: '没有更多数据了', icon: "none" }) return; } that.data.progresslist = that.data.progresslist.concat(progress); that.setData({ progresslist: that.data.progresslist, datashow: true }) } } }) }, sharelogtap: function () { var that = this; this.setData({ nowflag: false, }) utils.$post({ url: app.globalData.webUrl + 'api/share/addlog', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.shareId, type: that.data.shareType }, success: function (r) { } }) }, /** * 用户点击右上角分享 */ onShareAppMessage(e) { const that = this; if (this.data.bType == 'b') { this.sharelogtap(); return { title: that.data.detail.name, imageUrl: that.data.detail.cover_share_img ? that.data.detail.cover_share_img : that.data.detail.cover[0], path: '/share/pages/buildprogress/buildprogress?cid=' + that.data.cid + '&uid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + "&agid=" + app.globalData.brokeruserId } } else { this.sharelogtap(); return { title: that.data.shareTitle, imageUrl: that.data.shareImage, path: `${that.data.shareUrl}?${that.data.shareQuery}` } } } })