progressdetail.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. // index/pages/progressdetail/progressdetail.js
  2. const app = getApp();
  3. var utils = require("../../../utils/http");
  4. const util = require("../../../utils/util")
  5. let page = 1;
  6. let vrpage = 1;
  7. let videopage = 1;
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. clientype: app.globalData.clientype,
  14. cid: '',
  15. detail: {},
  16. companyobj: {},
  17. personMsg: {},
  18. progresslist: [],
  19. showContent: false,
  20. datashow: false,
  21. dialog: false,
  22. showCaseStyle: false,
  23. showArea: false,
  24. showInput: false,
  25. moreVrBol: false,
  26. moreVideoBol: false,
  27. type: 3,
  28. labelArr: [],
  29. constructlist: [],
  30. caselist: [],
  31. imageArr: [],
  32. VRlinklist: [],
  33. caseTypelist: [],
  34. videolink: {},
  35. constructnum: 0,
  36. allDataCount: 1,
  37. imgUrl: app.globalData.imgUrl,
  38. wshareshow: false,
  39. showVrOrVideo: false,
  40. showTask: true,
  41. showArticle: '',
  42. activeType: '',
  43. caseTypeActive: '',
  44. dscTitle: '',
  45. dscDataMsg: {},
  46. nowCaseStyleName: '',
  47. nowCaseStyleId: '',
  48. nowAreaName: '',
  49. nowAreaId: '',
  50. nowAreaStart: '',
  51. nowAreaEnd: '',
  52. casekeytext: '',
  53. showSortNum: 1,
  54. showType: 'vr',
  55. houseTypeActive: 0,
  56. showVideoNum: 1,
  57. currentVideoIndex: 0,
  58. tab: [{
  59. name: '实景',
  60. type: '',
  61. count: 1
  62. }, {
  63. name: '效果图',
  64. type: 'img',
  65. count: 0
  66. }, {
  67. name: 'VR',
  68. type: 'vr',
  69. count: 0
  70. }, {
  71. name: '视频',
  72. type: 'video',
  73. count: 0
  74. }],
  75. houseTypeTab: [],
  76. houseTypeArr: ['全部', '一居', '二居', '三居', '四居', '五居', '六居', '七居', '八居', '别墅'],
  77. houseTypelists: [],
  78. houseTypeItemlist: [],
  79. devCaselist: [],
  80. ltype: '',
  81. bType: "",
  82. pType: "",
  83. labelId: "",
  84. viewMore: 3,
  85. devCaseData: [],
  86. isBroker: false,
  87. loading: false,
  88. showApproval: false,
  89. remark: "",
  90. trackimgarr: [],
  91. nowimagearr: [],
  92. shareApprovallist: [],
  93. shareUrl: '',
  94. shareTitle: '',
  95. shareImage: '',
  96. shareType: '',
  97. shareId: '',
  98. shareQuery: ''
  99. },
  100. /**
  101. * 生命周期函数--监听页面加载
  102. */
  103. onLoad(options) {
  104. if (!!options.clg && options.clg == 6) {
  105. wx.reLaunch({
  106. url: '/pages/index/index?clientype=' + options.cty + "&cid=" + options.cid + "&clg=6",
  107. })
  108. return false;
  109. }
  110. page = 1;
  111. vrpage = 1;
  112. videopage = 1;
  113. if (!!options.cid) {
  114. wx.showLoading({
  115. title: '加载中...',
  116. })
  117. this.setData({
  118. companyobj: app.globalData.companyobj,
  119. cid: options.cid,
  120. personMsg: app.globalData.personMsg,
  121. })
  122. if (this.data.companyobj.company_name) {
  123. if (this.data.companyobj.company_name.length > 6) {
  124. this.data.companyobj.company_name = this.data.companyobj.company_name.substring(0, 6);
  125. this.setData({
  126. companyobj: this.data.companyobj
  127. })
  128. }
  129. }
  130. this.getBuildingProgressDetail();
  131. }
  132. if (!!options.ty) {
  133. this.setData({
  134. bType: options.ty,
  135. showTask: false
  136. })
  137. }
  138. if (!!options.tp) {
  139. this.setData({
  140. pType: options.tp
  141. })
  142. }
  143. if (options.type) {
  144. this.setData({
  145. ltype: options.type
  146. })
  147. }
  148. if (app.globalData.brokeruserId) {
  149. this.setData({
  150. isBroker: true
  151. })
  152. } else {
  153. this.setData({
  154. isBroker: false
  155. })
  156. }
  157. wx.hideShareMenu();
  158. },
  159. getPhoneNumberTap: function (res) {
  160. var that = this;
  161. if (res.detail.errMsg == 'getPhoneNumber:ok') {
  162. that.setData({
  163. loading: true,
  164. })
  165. utils.$post({
  166. url: app.globalData.webUrl + 'api/users/setUserMobile',
  167. data: {
  168. encryptedData: res.detail.encryptedData,
  169. iv: res.detail.iv
  170. },
  171. header: {
  172. 'Authorization': 'bearer ' + app.globalData.token
  173. },
  174. success: function (r) {
  175. if (r.data.code == '0') {
  176. that.submitMsg(r.data.mobile);
  177. }
  178. }
  179. })
  180. }
  181. },
  182. /**
  183. * 提交注册数据
  184. */
  185. submitMsg(mobile) {
  186. var that = this;
  187. utils.$post({
  188. url: app.globalData.webUrl + 'api/agents/add_agents',
  189. header: {
  190. 'Authorization': 'bearer ' + app.globalData.token
  191. },
  192. data: {
  193. name: '',
  194. phone: mobile,
  195. employee_id: app.globalData.brokerEmployeeId,
  196. wechat: '',
  197. type: app.globalData.brokerType
  198. },
  199. success: function (res) {
  200. if (res.data.code == '0') {
  201. app.globalData.brokeruserId = res.data.data;
  202. that.setData({
  203. isBroker: true,
  204. loading: false,
  205. })
  206. that.sharetap();
  207. }
  208. }
  209. })
  210. },
  211. getBuildingProgresslabel() {
  212. const that = this;
  213. utils.$post({
  214. url: app.globalData.webUrl + 'api/buildingLabel/index',
  215. header: {
  216. 'Authorization': 'bearer ' + app.globalData.token
  217. },
  218. data: {},
  219. success: function (res) {
  220. if (res.data.code == 0) {
  221. that.setData({
  222. labelArr: res.data.data
  223. })
  224. }
  225. }
  226. })
  227. },
  228. switchlabelFun(e) {
  229. page = 1;
  230. this.setData({
  231. labelId: e.currentTarget.dataset.id
  232. })
  233. wx.showLoading({
  234. title: '加载中...',
  235. })
  236. this.buildingProgress();
  237. },
  238. viewHouseType(e) {
  239. let cid = e.currentTarget.dataset.cid;
  240. wx.navigateTo({
  241. url: '/index/pages/housetype/housetype?cid=' + cid + '&buildId=' + this.data.cid + '&ty=' + this.data.bType,
  242. })
  243. },
  244. /**
  245. * 排序
  246. */
  247. compare(property) {
  248. return function (a, b) {
  249. var value1 = a[property];
  250. var value2 = b[property];
  251. return value1 - value2;
  252. }
  253. },
  254. toggleClass(e) {
  255. let id = e.currentTarget.dataset.cid;
  256. if (id == this.data.showArticle) {
  257. this.setData({
  258. showArticle: ''
  259. })
  260. } else {
  261. this.setData({
  262. showArticle: id
  263. })
  264. }
  265. },
  266. jumpNameCard() {
  267. wx.navigateTo({
  268. url: '/index/pages/namecard/namecard'
  269. })
  270. },
  271. devCaseDetail(e) {
  272. let id = e.currentTarget.dataset.id;
  273. let type = e.currentTarget.dataset.type;
  274. if (type == 1) {
  275. var that = this;
  276. utils.$get({
  277. url: app.globalData.webUrl + 'api/building/dev_case_detail',
  278. header: {
  279. 'Authorization': 'bearer ' + app.globalData.token
  280. },
  281. data: {
  282. id: id,
  283. },
  284. success: function (res) {
  285. if (res.data.code == '0') {
  286. let vrlink = res.data.data.vr_link;
  287. if (vrlink) {
  288. wx.navigateTo({
  289. 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,
  290. })
  291. } else {
  292. wx.showToast({
  293. title: '未上传VR链接',
  294. icon: 'none',
  295. duration: 1500
  296. })
  297. }
  298. } else {
  299. wx.showToast({
  300. title: res.data.msg,
  301. icon: 'none',
  302. duration: 1500
  303. })
  304. }
  305. }
  306. })
  307. } else {
  308. wx.navigateTo({
  309. url: '/index/pages/viewcase/viewcase?cid=' + id + '&type=1',
  310. })
  311. }
  312. },
  313. handleSwitch(e) {
  314. let type = e.currentTarget.dataset.type;
  315. let count = e.currentTarget.dataset.count;
  316. let swiperIndex = 0;
  317. if (type == 'img') {
  318. swiperIndex = 1;
  319. } else if (type == 'vr') {
  320. swiperIndex = this.data.imageArr.length + 1;
  321. } else if (type == 'video') {
  322. swiperIndex = this.data.imageArr.length + this.data.VRlinklist.length + 1;
  323. } else {
  324. swiperIndex = 0;
  325. }
  326. this.setData({
  327. swiperIndex: swiperIndex,
  328. activeType: type,
  329. allDataCount: count,
  330. showSortNum: 1,
  331. })
  332. },
  333. /**
  334. * 户型剖析
  335. */
  336. houseTypeDsc(e) {
  337. let index = e.currentTarget.dataset.index;
  338. let title = e.currentTarget.dataset.title;
  339. let room = e.currentTarget.dataset.room;
  340. this.setData({
  341. dscDataMsg: this.data.houseTypeItemlist[index],
  342. dscTitle: room == 9 ? '别墅' : title,
  343. dialog: true
  344. })
  345. },
  346. /**
  347. * 询问报价
  348. */
  349. inquiry() {
  350. if (this.data.bType == 'b') {
  351. wx.showToast({
  352. title: '装修推荐官无需询问',
  353. icon: 'none',
  354. duration: 1500
  355. })
  356. } else {
  357. wx.showToast({
  358. title: '员工无需询问',
  359. icon: 'none',
  360. duration: 1500
  361. })
  362. }
  363. },
  364. getImageAndVRAndVideo(type) {
  365. var that = this;
  366. let dataObj = {};
  367. if (type == 'vr') {
  368. dataObj = {
  369. id: that.data.cid,
  370. type: type,
  371. page: vrpage,
  372. };
  373. } else {
  374. dataObj = {
  375. id: that.data.cid,
  376. type: type,
  377. page: videopage,
  378. };
  379. }
  380. utils.$post({
  381. url: app.globalData.webUrl + 'api/building/progress',
  382. header: {
  383. 'Authorization': 'bearer ' + app.globalData.token
  384. },
  385. data: dataObj,
  386. success: function (res) {
  387. if (videopage > 1 || vrpage > 1) {
  388. setTimeout(() => { wx.hideLoading(); }, 1000)
  389. }
  390. if (res.data.code == '0') {
  391. if (type == 'vr') {
  392. that.getImageAndVRAndVideo('video');
  393. if (dataObj.page == 1) {
  394. that.data.VRlinklist = [];
  395. }
  396. if (res.data.data.length == 0) {
  397. that.setData({
  398. moreVrBol: true
  399. })
  400. }
  401. let vrlist = [];
  402. res.data.data.forEach(v => {
  403. if (v.vr && v.vr.length > 0) {
  404. vrlist.push(...v.vr);
  405. }
  406. })
  407. that.data.VRlinklist = that.data.VRlinklist.concat(vrlist);
  408. that.data.tab[2].count = that.data.VRlinklist.length;
  409. that.setData({
  410. VRlinklist: that.data.VRlinklist,
  411. tab: that.data.tab
  412. })
  413. if (dataObj.page > 1) {
  414. that.setData({
  415. allDataCount: that.data.VRlinklist.length
  416. })
  417. }
  418. } else {
  419. that.buildingProgress();
  420. if (dataObj.page == 1) {
  421. that.data.videolink = [];
  422. }
  423. if (res.data.data.length == 0) {
  424. that.setData({
  425. moreVideoBol: true
  426. })
  427. }
  428. let videoArr = res.data.data.map(v => {
  429. return { video: v.video, cover: v.img.length ? v.img[0] : '' }
  430. });
  431. that.data.videolink = that.data.videolink.concat(videoArr);
  432. that.data.tab[3].count = that.data.videolink.length;
  433. that.setData({
  434. videolink: that.data.videolink,
  435. tab: that.data.tab,
  436. })
  437. if (dataObj.page > 1) {
  438. that.setData({
  439. allDataCount: that.data.videolink.length
  440. })
  441. }
  442. }
  443. }
  444. }
  445. })
  446. },
  447. handlelist(e) {
  448. let type = e.currentTarget.dataset.type;
  449. let idx = e.currentTarget.dataset.index;
  450. let devCaselist = [];
  451. this.data.houseTypelists[idx].list.forEach(v => {
  452. if (v.devcase && v.devcase.length) {
  453. devCaselist.push(...v.devcase);
  454. }
  455. })
  456. this.setData({
  457. houseTypeActive: type,
  458. houseTypeItemlist: this.data.houseTypelists[idx].list,
  459. devCaseData: devCaselist
  460. })
  461. },
  462. /**
  463. * 进入案例详情
  464. */
  465. casemsgtap: function (e) {
  466. wx.navigateTo({
  467. url: '/index/pages/casemsg/casemsg?cid=' + e.currentTarget.dataset.cid,
  468. })
  469. },
  470. sitetap(e) {
  471. if (!this.data.ltype) {
  472. wx.navigateTo({
  473. url: '/index/pages/constructsite/constructsite?cid=' + e.currentTarget.dataset.cid,
  474. })
  475. } else {
  476. wx.navigateTo({
  477. url: '/customer/pages/sitemsg/sitemsg?cid=' + e.currentTarget.dataset.cid + '&type=' + this.data.ltype,
  478. })
  479. }
  480. },
  481. previewWechat() {
  482. if (this.data.personMsg.binded && this.data.personMsg.binded.qrcode) {
  483. if (this.data.personMsg.binded.qrcode.indexOf("https") < 0) {
  484. wx.previewImage({
  485. urls: [this.data.imgUrl + this.data.personMsg.binded.qrcode],
  486. })
  487. } else {
  488. wx.previewImage({
  489. urls: [this.data.personMsg.binded.qrcode],
  490. })
  491. }
  492. } else {
  493. wx.showToast({
  494. title: '暂未设置二维码',
  495. icon: "none"
  496. })
  497. }
  498. },
  499. mobileAction() {
  500. wx.makePhoneCall({
  501. phoneNumber: this.data.personMsg.phone,
  502. })
  503. },
  504. getBuildingProgressDetail() {
  505. var that = this;
  506. utils.$post({
  507. url: app.globalData.webUrl + 'api/building/view',
  508. header: {
  509. 'Authorization': 'bearer ' + app.globalData.token
  510. },
  511. data: {
  512. id: that.data.cid
  513. },
  514. success: function (res) {
  515. if (res.data.code == 0) {
  516. that.getBuildingProgresslabel();
  517. that.getImageAndVRAndVideo('vr');
  518. let dataMsg = res.data.data;
  519. dataMsg.update_time = dataMsg.update_time.split(' ')[0];
  520. dataMsg.areastr = dataMsg.area_list.map(v => `${v}㎡`).join('/');
  521. dataMsg.content = dataMsg.content.replace(/\r|\n/ig, "");
  522. let houseTypeArry = [];
  523. let devCaselist = [];
  524. if (dataMsg.housetype && Object.keys(dataMsg.housetype).length > 0) {
  525. Object.keys(dataMsg.housetype).forEach(v => {
  526. houseTypeArry.push({ name: that.data.houseTypeArr[v], id: v, count: dataMsg.housetype[v].length, list: dataMsg.housetype[v] })
  527. })
  528. if (houseTypeArry.length) {
  529. houseTypeArry[0].list.forEach(v => {
  530. if (v.devcase && v.devcase.length) {
  531. devCaselist.push(...v.devcase)
  532. }
  533. })
  534. }
  535. }
  536. that.data.tab[1].count = dataMsg.cover.length;
  537. that.setData({
  538. detail: dataMsg,
  539. imageArr: dataMsg.cover,
  540. tab: that.data.tab,
  541. houseTypelists: houseTypeArry.length ? houseTypeArry.sort(that.compare("id")) : [],
  542. houseTypeItemlist: houseTypeArry.length ? houseTypeArry[0].list : [],
  543. devCaseData: devCaselist
  544. })
  545. wx.setNavigationBarTitle({
  546. title: dataMsg.name,
  547. })
  548. }
  549. }
  550. })
  551. },
  552. openVRLink(e) {
  553. let type = e.currentTarget.dataset.type;
  554. if (type == 2) {
  555. let vrlink = e.currentTarget.dataset.vr;
  556. wx.navigateTo({
  557. 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,
  558. })
  559. } else {
  560. let id = e.currentTarget.dataset.id;
  561. let vrlink = e.currentTarget.dataset.vrlink;
  562. wx.navigateTo({
  563. url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&aid=' + id,
  564. })
  565. }
  566. },
  567. setcasekeywordtap: function (e) {
  568. this.setData({
  569. casekeytext: e.detail.value
  570. })
  571. },
  572. closeMask() {
  573. this.setData({
  574. showVrOrVideo: false,
  575. dialog: false,
  576. showArea: false,
  577. showCaseStyle: false,
  578. showInput: false,
  579. })
  580. },
  581. handleCaseStyle() {
  582. this.setData({
  583. showCaseStyle: true
  584. })
  585. },
  586. handleShowArea() {
  587. this.setData({
  588. showArea: true
  589. })
  590. },
  591. handleShowInput() {
  592. this.data.showInput = !this.data.showInput;
  593. this.setData({
  594. showInput: this.data.showInput
  595. })
  596. },
  597. dothis() { },
  598. showAllContent() {
  599. let showContent = !this.data.showContent;
  600. this.setData({
  601. showContent: showContent
  602. })
  603. },
  604. handleMore() {
  605. if (this.data.viewMore == this.data.progresslist.length) {
  606. this.setData({
  607. viewMore: 3
  608. })
  609. } else {
  610. this.setData({
  611. viewMore: this.data.progresslist.length
  612. })
  613. }
  614. },
  615. handleTips() {
  616. if (this.data.bType == 'b') {
  617. wx.showToast({
  618. title: '装修推荐官不可催更新',
  619. icon: 'none',
  620. duration: 1500
  621. })
  622. } else {
  623. wx.showToast({
  624. title: '员工不可催更新',
  625. icon: 'none',
  626. duration: 1500
  627. })
  628. }
  629. },
  630. /**
  631. * 放大图片
  632. * @param {*} e
  633. */
  634. previewImage(e) {
  635. let type = e.currentTarget.dataset.type;
  636. if (type == 'cover') {
  637. let imgUrl = e.currentTarget.dataset.img;
  638. if (imgUrl) {
  639. wx.previewImage({
  640. current: imgUrl,
  641. urls: [imgUrl]
  642. })
  643. } else {
  644. wx.showToast({
  645. title: '暂无图片展示',
  646. icon: 'none',
  647. })
  648. }
  649. } else if (type == 'image') {
  650. let imgUrl = e.currentTarget.dataset.img;
  651. wx.previewImage({
  652. current: imgUrl,
  653. urls: this.data.imageArr
  654. })
  655. } else if (type == 'vr') {
  656. this.setData({
  657. showVrOrVideo: true,
  658. showType: 'vr'
  659. })
  660. } else if (type == 'video') {
  661. this.setData({
  662. showVrOrVideo: true,
  663. showType: 'video',
  664. currentVideoIndex: this.data.showSortNum - 1 < 0 ? 0 : (this.data.showSortNum - 1),
  665. showVideoNum: this.data.showSortNum
  666. })
  667. } else if (type == 'himg') {
  668. let idx = e.currentTarget.dataset.index;
  669. let imgUrl = e.currentTarget.dataset.img;
  670. wx.previewImage({
  671. current: imgUrl,
  672. urls: this.data.houseTypeItemlist[idx].house_img,
  673. })
  674. } else {
  675. let imgUrl = e.currentTarget.dataset.img;
  676. let index = e.currentTarget.dataset.index;
  677. var arr = this.data.progresslist[index].img;
  678. wx.previewImage({
  679. current: imgUrl,
  680. urls: arr,
  681. })
  682. }
  683. },
  684. /**
  685. * 顶部轮播切换
  686. */
  687. swiperChange(e) {
  688. let currentItemId = e.detail.currentItemId;
  689. if (currentItemId.indexOf('img') > -1) {
  690. let index = currentItemId.split('-')[1];
  691. let type = currentItemId.split('-')[0];
  692. this.setData({
  693. activeType: type,
  694. showSortNum: parseInt(index) + 1,
  695. allDataCount: this.data.imageArr.length
  696. })
  697. }
  698. if (currentItemId.indexOf('vr') > -1) {
  699. let index = currentItemId.split('-')[1];
  700. let type = currentItemId.split('-')[0];
  701. this.setData({
  702. activeType: type,
  703. showSortNum: parseInt(index) + 1,
  704. allDataCount: this.data.VRlinklist.length
  705. })
  706. if (!this.data.moreVrBol && (index == (this.data.VRlinklist.length - 1))) {
  707. wx.showLoading({
  708. title: '正在加载数据...',
  709. })
  710. vrpage = vrpage * 1 + 1;
  711. this.getImageAndVRAndVideo('vr');
  712. }
  713. }
  714. if (currentItemId.indexOf('video') > -1) {
  715. let index = currentItemId.split('-')[1];
  716. let type = currentItemId.split('-')[0];
  717. this.setData({
  718. activeType: type,
  719. showSortNum: parseInt(index) + 1,
  720. allDataCount: this.data.videolink.length
  721. })
  722. for (let i = 0; i < this.data.videolink.length; i++) {
  723. let videoEle = this.selectComponent(`#videolink${i}`);
  724. videoEle.pause();
  725. }
  726. if (!this.data.moreVideoBol && (index == (this.data.videolink.length - 1))) {
  727. wx.showLoading({
  728. title: '正在加载数据...',
  729. })
  730. videopage = videopage * 1 + 1;
  731. this.getImageAndVRAndVideo('video');
  732. }
  733. }
  734. if (currentItemId.indexOf('cover') > -1) {
  735. this.setData({
  736. activeType: '',
  737. showSortNum: 1,
  738. allDataCount: 1
  739. })
  740. }
  741. },
  742. /**
  743. * 视频放大滑动切换
  744. */
  745. swiperVideoChange(e) {
  746. this.setData({
  747. showVideoNum: parseInt(e.detail.current) + 1
  748. })
  749. },
  750. handleFullPlay(e) {
  751. let videoId = e.currentTarget.dataset.id;
  752. var videoContext = this.selectComponent(`#${videoId}`);
  753. videoContext.requestFullScreen({ direction: 0 })
  754. },
  755. buildingProgress() {
  756. var that = this;
  757. utils.$post({
  758. url: app.globalData.webUrl + 'api/building/progress',
  759. header: {
  760. 'Authorization': 'bearer ' + app.globalData.token
  761. },
  762. data: {
  763. id: that.data.cid,
  764. page: page,
  765. label_id: that.data.labelId
  766. },
  767. success: function (res) {
  768. wx.hideLoading();
  769. if (res.data.code == '0') {
  770. let progress = res.data.data;
  771. that.setData({
  772. progresslist: progress,
  773. datashow: true
  774. })
  775. }
  776. }
  777. })
  778. },
  779. handleCollect(e) {
  780. const that = this;
  781. let detail = this.data.detail;
  782. let collect = that.data.detail.collected;
  783. let urllink = !collect ? app.globalData.webUrl + 'api/building/collect' : app.globalData.webUrl + 'api/building/collectCancel';
  784. utils.$post({
  785. url: urllink,
  786. header: {
  787. 'Authorization': 'bearer ' + app.globalData.token
  788. },
  789. data: {
  790. id: that.data.cid,
  791. },
  792. success: (res) => {
  793. if (res.data.code == 0) {
  794. detail.collected = !collect;
  795. this.setData({
  796. detail: detail
  797. })
  798. wx.showToast({
  799. title: res.data.msg,
  800. icon: 'none',
  801. duration: 1000
  802. })
  803. }
  804. }
  805. })
  806. },
  807. shareProgress(e) {
  808. let id = e.currentTarget.dataset.id;
  809. if (this.data.bType == 'b') {
  810. this.setData({
  811. shareId: id,
  812. shareType: 'buildingProgress',
  813. shareUrl: '/share/pages/buildShare/buildShare',
  814. shareQuery: 'cid=' + id + '&uid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + "&agid=" + app.globalData.brokeruserId,
  815. shareImage: this.data.detail.cover_share_img ? this.data.detail.cover_share_img : this.data.detail.cover[0],
  816. shareTitle: this.data.detail.name + '-楼盘进度',
  817. wshareshow: true
  818. })
  819. return false;
  820. }
  821. this.setData({
  822. shareId: id,
  823. shareType: 'buildingProgress',
  824. shareUrl: '/share/pages/buildShare/buildShare',
  825. shareQuery: 'cid=' + id + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  826. shareImage: this.data.detail.cover_share_img ? this.data.detail.cover_share_img : this.data.detail.cover[0],
  827. shareTitle: this.data.detail.name + '-楼盘进度',
  828. wshareshow: true
  829. })
  830. },
  831. sharetap() {
  832. if (this.data.bType == 'b') {
  833. this.setData({
  834. shareId: this.data.cid,
  835. shareType: 'building',
  836. shareUrl: '/share/pages/buildprogress/buildprogress',
  837. shareQuery: 'cid=' + this.data.cid + '&uid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + "&agid=" + app.globalData.brokeruserId,
  838. shareImage: this.data.detail.cover_share_img ? this.data.detail.cover_share_img : this.data.detail.cover[0],
  839. shareTitle: this.data.detail.name,
  840. wshareshow: true
  841. })
  842. return false;
  843. }
  844. this.setData({
  845. shareId: this.data.cid,
  846. shareType: 'building',
  847. shareUrl: '/share/pages/buildprogress/buildprogress',
  848. shareQuery: 'cid=' + this.data.cid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  849. shareImage: this.data.detail.cover_share_img ? this.data.detail.cover_share_img : this.data.detail.cover[0],
  850. shareTitle: this.data.detail.name,
  851. wshareshow: true
  852. })
  853. },
  854. setpostertap: function () {
  855. if (this.data.bType == 'b') {
  856. wx.navigateTo({
  857. url: '/index/pages/setposter/setposter?type=building&aid=' + this.data.cid + "&ty=b&listshare=",
  858. })
  859. } else {
  860. wx.navigateTo({
  861. url: '/index/pages/setposter/setposter?type='+this.data.shareType+'&aid=' + this.data.shareId + "&listshare=",
  862. })
  863. }
  864. },
  865. sendfriendtap() {
  866. this.sharelogtap();
  867. },
  868. shareurltap: function () {
  869. wx.showLoading({
  870. title: '加载中...',
  871. })
  872. if (this.data.bType == 'b') {
  873. 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', '');
  874. } else {
  875. util.schemefun(this.data.shareUrl, this.data.shareQuery, this.data.shareId, this.data.shareType, '');
  876. }
  877. this.sharelogtap();
  878. },
  879. /**
  880. * 生命周期函数--监听页面初次渲染完成
  881. */
  882. onReady() {
  883. },
  884. /**
  885. * 生命周期函数--监听页面显示
  886. */
  887. onShow() {
  888. this.setData({
  889. imgUrl: app.globalData.imgUrl,
  890. })
  891. },
  892. /**
  893. * 生命周期函数--监听页面隐藏
  894. */
  895. onHide() {
  896. },
  897. /**
  898. * 生命周期函数--监听页面卸载
  899. */
  900. onUnload() {
  901. },
  902. setypetap(e) {
  903. this.setData({
  904. type: e.currentTarget.dataset.type
  905. })
  906. },
  907. /**
  908. * 页面相关事件处理函数--监听用户下拉动作
  909. */
  910. onPullDownRefresh() { },
  911. /**
  912. * 页面上拉触底事件的处理函数
  913. */
  914. onReachBottom() {
  915. wx.showLoading({
  916. title: '加载中...',
  917. })
  918. var that = this;
  919. page = page * 1 + 1;
  920. utils.$post({
  921. url: app.globalData.webUrl + 'api/building/progress',
  922. header: {
  923. 'Authorization': 'bearer ' + app.globalData.token
  924. },
  925. data: {
  926. id: that.data.cid,
  927. page: page
  928. },
  929. success: function (res) {
  930. setTimeout(() => { wx.hideLoading(); }, 1000);
  931. if (res.data.code == '0') {
  932. let progress = res.data.data;
  933. if (page > 1 && !progress.length) {
  934. wx.showToast({
  935. title: '没有更多数据了',
  936. icon: "none"
  937. })
  938. return;
  939. }
  940. that.data.progresslist = that.data.progresslist.concat(progress);
  941. that.setData({
  942. progresslist: that.data.progresslist,
  943. datashow: true
  944. })
  945. }
  946. }
  947. })
  948. },
  949. sharelogtap: function () {
  950. var that = this;
  951. this.setData({
  952. nowflag: false,
  953. })
  954. utils.$post({
  955. url: app.globalData.webUrl + 'api/share/addlog',
  956. header: {
  957. 'Authorization': 'bearer ' + app.globalData.token
  958. },
  959. data: {
  960. id: that.data.shareId,
  961. type: that.data.shareType
  962. },
  963. success: function (r) { }
  964. })
  965. },
  966. /**
  967. * 用户点击右上角分享
  968. */
  969. onShareAppMessage(e) {
  970. const that = this;
  971. if (this.data.bType == 'b') {
  972. this.sharelogtap();
  973. return {
  974. title: that.data.detail.name,
  975. imageUrl: that.data.detail.cover_share_img ? that.data.detail.cover_share_img : that.data.detail.cover[0],
  976. path: '/share/pages/buildprogress/buildprogress?cid=' + that.data.cid + '&uid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + "&agid=" + app.globalData.brokeruserId
  977. }
  978. } else {
  979. this.sharelogtap();
  980. return {
  981. title: that.data.shareTitle,
  982. imageUrl: that.data.shareImage,
  983. path: `${that.data.shareUrl}?${that.data.shareQuery}`
  984. }
  985. }
  986. },
  987. onAddToFavorites(res) {
  988. const that = this;
  989. return {
  990. title: that.data.shareTitle,
  991. imageUrl: that.data.shareImage,
  992. query: 'cid=' + this.data.cid + '&cty=' + app.globalData.clientype + '&clg=6',
  993. }
  994. }
  995. })