progressdetail.js 27 KB

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