1
0

shareCard.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. // share/pages/shareCard/shareCard.js
  2. var app = getApp();
  3. var utils = require("../../../utils/http");
  4. let evpage = 1, casepage = 1;
  5. let time = 0;
  6. var timer = null;
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. canIUseGetUserProfile: false,
  13. shareobj: {},
  14. employeeflag: false,//false是用户,true是员工
  15. top: app.globalData.statusBarHeight,
  16. hgt: app.globalData.titleBarHeight,
  17. companyobj: {},
  18. loginFlag: false,
  19. phoneFlag: false,
  20. imgUrl: app.globalData.imgUrl,
  21. mineinfo: {
  22. name: ''
  23. },
  24. logcount: 0,
  25. imgarr: [],
  26. type: 1,
  27. evidencetype: '',
  28. evidencelist: [],
  29. leftevidencelist: [],
  30. rightevidencelist: [],
  31. catetype: '',
  32. datashow: true,
  33. nowstyle: '',
  34. stylelist: [],
  35. square_start: '', //面积开始值
  36. square_end: '', //面积结束值
  37. nowcommunity: '',
  38. communitylist: [],
  39. nowhousetype: '',
  40. housetypelist: [],
  41. caselist: [],
  42. keyword: '',
  43. datashow: false,
  44. communityflag: false,
  45. isAgree: false,
  46. nowcommunitname: '',
  47. fromType: '',
  48. typearr: [
  49. { id: 1, name: '效果案例', type: 1 },
  50. { id: 2, name: '实景案例', type: 2 }
  51. ],
  52. noweffect: '',
  53. prelook: '',
  54. timeline: app.globalData.timeline
  55. },
  56. /**
  57. * 生命周期函数--监听页面加载
  58. */
  59. onLoad: function (opts) {
  60. var that = this;
  61. time = 0;
  62. if (opts.type == 'share') {
  63. this.setData({
  64. prelook: "share"
  65. })
  66. }
  67. if (app.globalData.timeline != 2) {
  68. wx.showLoading();
  69. }
  70. if (wx.getUserProfile) {
  71. this.setData({
  72. canIUseGetUserProfile: true
  73. })
  74. }
  75. that.setData({
  76. top: app.globalData.statusBarHeight,
  77. hgt: app.globalData.titleBarHeight,
  78. imgUrl: app.globalData.imgUrl,
  79. fromType: opts.ftype
  80. })
  81. app.globalData.clientype = opts.ctp;
  82. if (opts.empid) {
  83. app.globalData.sharempid = opts.empid;
  84. }
  85. app.globalData.shareuserid = opts.uid;
  86. },
  87. //用户同意隐私协议
  88. agreePrivacy() {
  89. this.setData({
  90. isAgree: true
  91. })
  92. this.loginfun();
  93. },
  94. sharecompany: function () {
  95. const that = this;
  96. utils.$post({
  97. url: app.globalData.webUrl + 'client/index/content_belong_company',
  98. header: {
  99. 'Authorization': 'bearer ' + app.globalData.token
  100. },
  101. data: {
  102. client_type: app.globalData.clientype,
  103. uid: app.globalData.shareuserid
  104. },
  105. success: function (res) {
  106. if (res.data.code == '0') {
  107. app.globalData.companyobj = res.data.data;
  108. that.setData({
  109. companyobj: res.data.data
  110. })
  111. app.globalData.sharempid = res.data.data.employee_id;
  112. }
  113. },
  114. complete(res) {
  115. wx.hideLoading()
  116. }
  117. })
  118. },
  119. loginfun: function (e) {
  120. var that = this;
  121. wx.showLoading({
  122. title: '加载中...',
  123. })
  124. if (!!e) {
  125. this.setData({
  126. type: e
  127. })
  128. }
  129. wx.login({
  130. success: function (data) {
  131. if (data.errMsg == 'login:ok') {
  132. utils.$post({
  133. url: app.globalData.webUrl + 'api/users/code2session',
  134. data: {
  135. code: data.code,
  136. share: app.globalData.shareuserid,
  137. clien_type: app.globalData.clientype
  138. },
  139. success: function (r) {
  140. if (r.data.code == '0') {
  141. app.globalData.sharepersonobj = r.data.share;
  142. app.globalData.token = r.data.token;
  143. that.sharecompany();
  144. if (r.data.share) {
  145. app.globalData.vrString = r.data.share.str;
  146. }
  147. that.setData({
  148. sharepersonMsg: app.globalData.sharepersonobj,
  149. })
  150. if (!!r.data.user.phone) {
  151. that.setData({
  152. loginFlag: false,
  153. phoneFlag: false,
  154. employeeflag: (!!r.data.user.binded && r.data.user.binded.state == '在职') ? true : false
  155. })
  156. app.globalData.personMsg = r.data.user;
  157. app.globalData.use_id = r.data.user.id;
  158. var obj = {
  159. detail: 1
  160. }
  161. that.cardfun(obj);
  162. } else {
  163. that.cardfun();
  164. wx.hideLoading();
  165. that.setData({
  166. loginFlag: false,
  167. phoneFlag: true
  168. })
  169. }
  170. }
  171. }
  172. })
  173. }
  174. }
  175. })
  176. },
  177. cardfun() {
  178. const that = this;
  179. utils.$post({
  180. url: app.globalData.webUrl + 'client/card/info',
  181. header: {
  182. 'Authorization': 'bearer ' + app.globalData.token
  183. },
  184. data: {
  185. user: app.globalData.shareuserid,
  186. },
  187. success: function (res) {
  188. wx.hideLoading();
  189. if (res.data.code == 0) {
  190. that.setData({
  191. mineinfo: res.data.data,
  192. logcount: res.data.logcount,
  193. imgarr: res.data.log
  194. })
  195. }
  196. that.evidenceCate();
  197. that.evidencelist();
  198. that.casestylefun();
  199. that.housestylefun();
  200. that.casecommunityfun();
  201. that.caselistfun();
  202. }
  203. })
  204. },
  205. setypetap(e) {
  206. this.setData({
  207. type: e.target.dataset.num
  208. })
  209. if (e.target.dataset.num == 3) {
  210. this.evidencelist();
  211. }
  212. },
  213. preimgtap() {
  214. if (!this.data.mineinfo.qrcode) {
  215. wx.showToast({
  216. title: '员工二维码为空!',
  217. icon: 'none',
  218. duration: 2000
  219. })
  220. return false;
  221. }
  222. let img = app.globalData.imgUrl + '/' + this.data.mineinfo.qrcode;
  223. wx.previewImage({
  224. current: img, // 当前显示图片的 http 链接
  225. urls: [img] // 需要预览的图片 http 链接列表
  226. })
  227. },
  228. copytap() {
  229. if (!this.data.mineinfo.wx) {
  230. wx.showToast({
  231. title: '员工微信为空!',
  232. icon: 'none',
  233. duration: 2000
  234. })
  235. return false;
  236. }
  237. wx.setClipboardData({
  238. data: this.data.mineinfo.wx,
  239. success(res) {
  240. }
  241. })
  242. },
  243. callphonetap() {
  244. wx.makePhoneCall({
  245. phoneNumber: this.data.mineinfo.phone //仅为示例,并非真实的电话号码
  246. })
  247. },
  248. openVRLink(e) {
  249. let vrlink = e.currentTarget.dataset.vrlink;
  250. let id = e.currentTarget.dataset.id;
  251. wx.navigateTo({
  252. url: '/pages/other/other?type=vr&vrurl=' + escape(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.shareuserid + '&ctp=' + app.globalData.clientype + '&aid=' + id,
  253. })
  254. },
  255. viewAuthorization() {
  256. return new Promise(function (resolve, reject) {
  257. wx.getSetting({
  258. success(res) {
  259. if (res.authSetting['scope.addPhoneContact']) {
  260. resolve({ authorize: true })
  261. } else {
  262. wx.openSetting({
  263. success(res) {
  264. if (res.authSetting['scope.addPhoneContact']) {
  265. wx.authorize({
  266. scope: 'scope.addPhoneContact',
  267. success: function (res) {
  268. console.log('success:', res);
  269. resolve({ authorize: true })
  270. },
  271. fail: function (error) {
  272. console.log('error:', error);
  273. reject({ authorize: false })
  274. }
  275. })
  276. } else {
  277. wx.authorize({
  278. scope: 'scope.addPhoneContact',
  279. success: function (res) {
  280. console.log('success:', res);
  281. resolve({ authorize: true })
  282. },
  283. fail: function (error) {
  284. console.log('error:', error);
  285. reject({ authorize: false })
  286. }
  287. })
  288. }
  289. },
  290. fail() {
  291. wx.authorize({
  292. scope: 'scope.addPhoneContact',
  293. success: function (res) {
  294. console.log('success:', res);
  295. resolve({ authorize: true })
  296. },
  297. fail: function (error) {
  298. console.log('error:', error);
  299. reject({ authorize: false })
  300. }
  301. })
  302. }
  303. })
  304. }
  305. }
  306. })
  307. })
  308. },
  309. async savenumtap() {
  310. let res = await this.viewAuthorization();
  311. if (res.authorize) {
  312. wx.addPhoneContact({
  313. firstName: this.data.mineinfo.name,
  314. photoFilePath: this.data.mineinfo.headimgurl,
  315. mobilePhoneNumber: this.data.mineinfo.phone,
  316. weChatNumber: this.data.mineinfo.wx,
  317. addressStreet: this.data.mineinfo.company_address,
  318. organization: this.data.mineinfo.company_name,
  319. title: this.data.mineinfo.position
  320. })
  321. return;
  322. }
  323. },
  324. evidenceCate: function () {
  325. var that = this;
  326. utils.$get({
  327. url: app.globalData.webUrl + 'client/material/evidenceCate',
  328. header: {
  329. 'Authorization': 'bearer ' + app.globalData.token
  330. },
  331. data: {},
  332. success: function (res) {
  333. that.setData({
  334. evidencetype: res.data.data
  335. })
  336. }
  337. })
  338. },
  339. seteffectap(e) {
  340. this.setData({
  341. noweffect: e.currentTarget.dataset.type
  342. })
  343. this.caselistfun();
  344. },
  345. setevitap(e) {
  346. this.setData({
  347. catetype: e.currentTarget.dataset.eid
  348. })
  349. this.evidencelist();
  350. },
  351. evidencelist: function () {
  352. const that = this;
  353. evpage = 1;
  354. utils.$get({
  355. url: app.globalData.webUrl + 'client/evidencelist',
  356. header: {
  357. 'Authorization': 'bearer ' + app.globalData.token
  358. },
  359. data: {
  360. uid: app.globalData.personMsg.id,
  361. page: 1,
  362. cate: that.data.catetype,
  363. },
  364. success: function (res) {
  365. setTimeout(function () {
  366. wx.hideLoading()
  367. }, 1000)
  368. if (res.data.code == '0') {
  369. that.setData({
  370. evidencelist: res.data.data,
  371. leftevidencelist: [],
  372. rightevidencelist: [],
  373. datashow: true
  374. })
  375. that.imgload();
  376. }
  377. },
  378. fail() {
  379. wx.hideLoading()
  380. }
  381. })
  382. },
  383. publictap: function (e) {
  384. wx.navigateTo({
  385. url: '/share/pages/publicpraisemsg/publicpraisemsg?type=3&eid=' + e.currentTarget.dataset.eid + "&uid=" + app.globalData.shareuserid + '&ctp=' + app.globalData.clientype
  386. })
  387. },
  388. imgload: function () {
  389. var that = this;
  390. var leftlist = that.data.leftevidencelist;
  391. var rightlist = that.data.rightevidencelist;
  392. var indexlist = that.data.evidencelist;
  393. if (indexlist.length == 0) {
  394. return false;
  395. }
  396. if (!indexlist[0]) {
  397. return false;
  398. }
  399. if (leftlist.length == 0) {
  400. leftlist.push(indexlist[0]);
  401. indexlist.shift();
  402. that.setData({
  403. evidencelist: indexlist,
  404. leftevidencelist: leftlist,
  405. rightevidencelist: rightlist
  406. })
  407. } else {
  408. var leftheight, rightheight;
  409. wx.createSelectorQuery().select('.leftpublicpraisebox').boundingClientRect(function (res) {
  410. leftheight = res.height;
  411. wx.createSelectorQuery().select('.rightpublicpraisebox').boundingClientRect(function (rs) {
  412. leftlist = that.data.leftevidencelist;
  413. rightlist = that.data.rightevidencelist;
  414. indexlist = that.data.evidencelist;
  415. rightheight = rs.height;
  416. if (leftheight <= rightheight) {
  417. leftlist.push(indexlist[0]);
  418. indexlist.shift();
  419. } else {
  420. rightlist.push(indexlist[0]);
  421. indexlist.shift();
  422. }
  423. that.setData({
  424. evidencelist: indexlist,
  425. leftevidencelist: leftlist,
  426. rightevidencelist: rightlist
  427. })
  428. }).exec();
  429. }).exec();
  430. }
  431. },
  432. setliketap() {
  433. var that = this;
  434. utils.$get({
  435. url: app.globalData.webUrl + 'client/card/like',
  436. header: {
  437. 'Authorization': 'bearer ' + app.globalData.token
  438. },
  439. data: {
  440. employee_id: app.globalData.sharempid
  441. },
  442. success: function (res) {
  443. let mineinfo = that.data.mineinfo;
  444. if (res.data.code == '0') {
  445. mineinfo.likes = mineinfo.likes * 1 + 1;
  446. that.setData({
  447. mineinfo: mineinfo
  448. })
  449. }
  450. }
  451. })
  452. },
  453. casestylefun: function () {
  454. var that = this;
  455. utils.$get({
  456. url: app.globalData.webUrl + 'client/stylelist',
  457. header: {
  458. 'Authorization': 'bearer ' + app.globalData.token
  459. },
  460. data: {},
  461. success: function (res) {
  462. if (res.data.code == '0') {
  463. that.setData({
  464. stylelist: res.data.data
  465. })
  466. }
  467. }
  468. })
  469. },
  470. housestylefun: function () {
  471. var that = this;
  472. utils.$get({
  473. url: app.globalData.webUrl + 'client/material/housetypelist',
  474. header: {
  475. 'Authorization': 'bearer ' + app.globalData.token
  476. },
  477. data: {},
  478. success: function (res) {
  479. if (res.data.code == '0') {
  480. that.setData({
  481. housetypelist: res.data.data
  482. })
  483. }
  484. }
  485. })
  486. },
  487. onChoose(e) {
  488. var that = this;
  489. that.setData({
  490. nowcommunity: e.detail.item.currentTarget.dataset.cid,
  491. nowcommunitname: e.detail.item.currentTarget.dataset.item.name,
  492. communityflag: false
  493. })
  494. wx.showLoading({
  495. title: '加载中...',
  496. })
  497. that.caselistfun();
  498. },
  499. casecommunityfun: function () {
  500. var that = this;
  501. utils.$get({
  502. url: app.globalData.webUrl + 'client/communitylist',
  503. header: {
  504. 'Authorization': 'bearer ' + app.globalData.token
  505. },
  506. data: {},
  507. success: function (res) {
  508. if (res.data.code == '0') {
  509. that.setData({
  510. communitylist: res.data.data
  511. })
  512. }
  513. that.getCitys();
  514. }
  515. })
  516. },
  517. getCitys() {
  518. const _this = this
  519. const cities = this.data.communitylist;
  520. // 按拼音排序
  521. cities.sort((c1, c2) => {
  522. let pinyin1 = c1.pinyin;
  523. let pinyin2 = c2.pinyin;
  524. return pinyin1.localeCompare(pinyin2)
  525. })
  526. // 添加首字母
  527. const map = new Map()
  528. for (const city of cities) {
  529. const alpha = city.pinyin.charAt(0).toUpperCase()
  530. if (!map.has(alpha)) map.set(alpha, [])
  531. map.get(alpha).push({ name: city.name, id: city.id })
  532. }
  533. const keys = []
  534. for (const key of map.keys()) {
  535. keys.push(key)
  536. }
  537. keys.sort()
  538. const list = []
  539. for (const key of keys) {
  540. list.push({
  541. alpha: key,
  542. subItems: map.get(key)
  543. })
  544. }
  545. for (let i = 0; i < list.length; i++) {
  546. for (let k = 0; k < list[i].subItems.length; k++) {
  547. for (let j = 0; j < cities.length; j++) {
  548. if (list[i].subItems[k].name == cities[j].name) {
  549. list[i].subItems[k].case_num = cities[j].case_num;
  550. list[i].id = cities[j].id;
  551. }
  552. }
  553. }
  554. }
  555. _this.setData({ list: list })
  556. },
  557. selectareatap: function (e) {
  558. this.setData({
  559. square_start: e.currentTarget.dataset.start,
  560. square_end: e.currentTarget.dataset.end,
  561. })
  562. this.caselistfun();
  563. },
  564. caselistfun: function (e) {
  565. var that = this;
  566. casepage = 1;
  567. utils.$get({
  568. url: app.globalData.webUrl + 'client/caselist',
  569. header: {
  570. 'Authorization': 'bearer ' + app.globalData.token
  571. },
  572. data: {
  573. page: 1,
  574. commu_id: that.data.nowcommunity, // 小区id
  575. style_id: that.data.nowstyle, //风格id
  576. square_start: that.data.square_start, //面积开始值
  577. square_end: that.data.square_end, //面积结束值
  578. keyword: that.data.keyword,
  579. housetype_id: that.data.nowhousetype,
  580. case_type: this.data.noweffect,
  581. },
  582. success: function (res) {
  583. that.setData({
  584. datashow: true
  585. })
  586. if (res.data.code == '0') {
  587. that.setData({
  588. caselist: res.data.data,
  589. })
  590. }
  591. setTimeout(function () {
  592. wx.hideLoading()
  593. }, 1000)
  594. },
  595. fail() {
  596. wx.hideLoading()
  597. }
  598. })
  599. },
  600. setstyletap: function (e) {
  601. this.setData({
  602. nowstyle: e.currentTarget.dataset.type
  603. })
  604. this.caselistfun();
  605. },
  606. setcommunitytap: function (e) {
  607. this.setData({
  608. nowcommunity: e.currentTarget.dataset.type,
  609. // communityflag:true,
  610. nowcommunitname: e.currentTarget.dataset.text,
  611. })
  612. this.caselistfun();
  613. },
  614. opencommunitytap: function () {
  615. this.setData({
  616. communityflag: true,
  617. })
  618. },
  619. dothis: function () { },
  620. colsecommunitytap: function () {
  621. this.setData({
  622. communityflag: false
  623. })
  624. },
  625. sethousetypetap: function (e) {
  626. this.setData({
  627. nowhousetype: e.currentTarget.dataset.type
  628. })
  629. this.caselistfun();
  630. },
  631. casemsgtap: function (e) {
  632. wx.navigateTo({
  633. url: '/index/pages/casemsg/casemsg?cid=' + e.currentTarget.dataset.cid,
  634. })
  635. },
  636. backTap: function () {
  637. if (this.data.fromType) {
  638. wx.navigateBack({
  639. delta: 1,
  640. })
  641. }
  642. // else {
  643. // wx.reLaunch({
  644. // url: '/pages/index/index?state=1',
  645. // })
  646. // }
  647. },
  648. casemsgtap: function (e) {
  649. wx.navigateTo({
  650. url: '/share/pages/materialcase/materialcase?type=3&cid=' + e.currentTarget.dataset.cid + '&uid=' + app.globalData.shareuserid + '&ctp=' + app.globalData.clientype
  651. })
  652. },
  653. getPhoneNumberTap: function (res) {
  654. var that = this;
  655. that.setData({
  656. phoneFlag: false,
  657. })
  658. if (res.detail.errMsg == 'getPhoneNumber:ok') {
  659. utils.$post({
  660. url: app.globalData.webUrl + 'api/users/setUserMobile',
  661. data: {
  662. encryptedData: res.detail.encryptedData,
  663. iv: res.detail.iv
  664. },
  665. header: {
  666. 'Authorization': 'bearer ' + app.globalData.token
  667. },
  668. success: function (r) {
  669. if (r.data.code == '0') {
  670. app.globalData.phone = true;
  671. that.setData({
  672. phoneFlag: false,
  673. })
  674. }
  675. }
  676. })
  677. }
  678. },
  679. searchplacetap() {
  680. if (!this.data.mineinfo.company_vr_address) {
  681. wx.showToast({
  682. title: 'VR链接为空!',
  683. icon: 'none',
  684. duration: 2000
  685. })
  686. return false;
  687. }
  688. app.globalData.vraddress = this.data.mineinfo.company_vr_address;
  689. let str = escape(app.globalData.vraddress);
  690. wx.navigateTo({
  691. url: '/pages/other/other?type=vr&ctp=' + app.globalData.clientype + '&uid=' + app.globalData.shareuserid + '&vrurl=' + str + '&aid=' + this.data.mineinfo.employee_id + '&cty=employeeCard',
  692. })
  693. },
  694. /**
  695. * 生命周期函数--监听页面初次渲染完成
  696. */
  697. onReady: function () {
  698. },
  699. /**
  700. * 生命周期函数--监听页面显示
  701. */
  702. onShow: function () {
  703. this.setData({
  704. timeline: app.globalData.timeline
  705. })
  706. if (app.globalData.timeline == 2) {
  707. wx.hideLoading()
  708. }
  709. timer = setInterval(function () {
  710. time = time * 1 + 1;
  711. }, 1000)
  712. },
  713. /**
  714. * 生命周期函数--监听页面隐藏
  715. */
  716. onHide: function () {
  717. if (timer) {
  718. clearInterval(timer)
  719. }
  720. this.visitimefun();
  721. },
  722. visitimefun() {
  723. if (!this.data.isAgree) {
  724. return false;
  725. }
  726. const that = this;
  727. utils.$post({
  728. url: app.globalData.webUrl + 'client/index/visit_due_time',
  729. header: {
  730. 'Authorization': 'bearer ' + app.globalData.token
  731. },
  732. data: {
  733. id: that.data.mineinfo.employee_id,
  734. pipe_type: 'card',
  735. time: time,
  736. },
  737. success: function (res) {
  738. }
  739. })
  740. },
  741. /**
  742. * 生命周期函数--监听页面卸载
  743. */
  744. onUnload: function () {
  745. this.visitimefun();
  746. },
  747. /**
  748. * 页面相关事件处理函数--监听用户下拉动作
  749. */
  750. onPullDownRefresh: function () {
  751. },
  752. /**
  753. * 页面上拉触底事件的处理函数
  754. */
  755. onReachBottom: function () {
  756. const that = this;
  757. if (this.data.type == 3) {
  758. evpage = evpage * 1 + 1;
  759. utils.$get({
  760. url: app.globalData.webUrl + 'client/evidencelist',
  761. header: {
  762. 'Authorization': 'bearer ' + app.globalData.token
  763. },
  764. data: {
  765. page: evpage,
  766. cate: that.data.catetype,
  767. },
  768. success: function (res) {
  769. if (res.data.code == '0') {
  770. let evidencelist = that.data.evidencelist;
  771. var arrflag = false
  772. if (evidencelist.length != 0) {
  773. arrflag = true;
  774. }
  775. for (let i = 0; i < res.data.data.length; i++) {
  776. evidencelist.push(res.data.data[i])
  777. }
  778. that.setData({
  779. evidencelist: evidencelist
  780. })
  781. if (!arrflag) {
  782. that.imgload();
  783. }
  784. }
  785. }
  786. })
  787. } else if (this.data.type == 2) {
  788. casepage = casepage * 1 + 1;
  789. utils.$get({
  790. url: app.globalData.webUrl + 'client/caselist',
  791. header: {
  792. 'Authorization': 'bearer ' + app.globalData.token
  793. },
  794. data: {
  795. page: casepage,
  796. commu_id: that.data.nowcommunity, // 小区id
  797. style_id: that.data.nowstyle, //风格id
  798. square_start: that.data.square_start, //面积开始值
  799. square_end: that.data.square_end, //面积结束值
  800. keyword: that.data.keyword,
  801. housetype_id: that.data.nowhousetype,
  802. case_type: this.data.noweffect,
  803. },
  804. success: function (res) {
  805. let caselist = that.data.caselist;
  806. if (res.data.code == '0') {
  807. caselist = caselist.concat(res.data.data);
  808. that.setData({
  809. caselist: caselist
  810. })
  811. }
  812. setTimeout(function () {
  813. wx.hideLoading()
  814. }, 1000)
  815. }
  816. })
  817. }
  818. },
  819. addsharetap: function (type) {
  820. let that = this;
  821. utils.$post({
  822. url: app.globalData.webUrl + 'api/share/addlog',
  823. header: {
  824. 'Authorization': 'bearer ' + app.globalData.token
  825. },
  826. data: {
  827. id: '0',
  828. type: type,
  829. },
  830. success: function (r) { }
  831. })
  832. },
  833. /**
  834. * 用户点击右上角分享
  835. */
  836. onShareAppMessage: function () {
  837. var that = this;
  838. that.addsharetap('card');
  839. wx.showShareMenu({
  840. withShareTicket: true,
  841. menus: ['shareAppMessage', 'shareTimeline']
  842. })
  843. return {
  844. title: this.data.mineinfo.name + "的个人名片",
  845. imageUrl: app.globalData.imgUrl + "/xcx/sharenamecard.png",
  846. path: '/share/pages/shareCard/shareCard?uid=' + app.globalData.shareuserid + '&empid=' + app.globalData.sharempid + '&ctp=' + app.globalData.clientype,
  847. };
  848. },
  849. onShareTimeline: function () {
  850. var that = this;
  851. that.addsharetap('card');
  852. app.globalData.shareuserid = app.globalData.personMsg.id;
  853. return {
  854. title: this.data.mineinfo.name + "的个人名片",
  855. query: 'uid=' + app.globalData.shareuserid + '&empid=' + app.globalData.personMsg.binded.id + '&ctp=' + app.globalData.clientype + '&type=share',
  856. imageUrl: app.globalData.imgUrl + "/xcx/sharenamecard.png",
  857. }
  858. }
  859. })