123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185 |
- // 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}`
- }
- }
- }
- })
|