1
0

shareCard.js 25 KB

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