1
0

morecontent.js 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913
  1. const app = getApp();
  2. var utils = require("../../../utils/http");
  3. const util = require("../../../utils/util");
  4. let page = 1;
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. ordertype: '',
  11. unlogin: false,//默认未登录状态,false未登录,true登录成功,并是公司成员
  12. imgUrl: app.globalData.imgUrl,
  13. mattertype: '拓客案例',
  14. toptype: '素材库',
  15. casefiltratetype: 3,
  16. list: [],
  17. filtrateflag: false,
  18. casestyletype: '',
  19. caselist: [],
  20. datashow: false,
  21. evidencelist: [],
  22. leftevidencelist: [],
  23. rightevidencelist: [],
  24. catetype: '',//口碑
  25. wxfriendlist: [],
  26. square_start: '',//面积开始值
  27. square_end: '',//面积结束值
  28. commu_id: '',
  29. communame: '',
  30. videoid: [],
  31. playBtn: true,
  32. casepage: 1,
  33. friendpage: 1,
  34. evidencepage: 1,
  35. page: 1,
  36. nowtype: '',
  37. nowid: '',
  38. downflag: false,
  39. downloaded: false,
  40. downlen: 0,
  41. num: 0,
  42. syslabel: [],
  43. companylabel: [],
  44. wxlabel: '',
  45. casekeytext: '',
  46. friendkeytext: '',
  47. evidencekeytext: '',
  48. evidencetype: [],
  49. nowstyleid: '',
  50. nowfirst: '',
  51. nowtitbtn: '',
  52. nowtitle: '',
  53. nowimg: '',
  54. titlist: [],
  55. secondtitlist: [],
  56. videotext: '',
  57. videolist: [],
  58. leftlist: [],
  59. rightlist: [],
  60. articletext: '',
  61. articletitlist: [],
  62. articlesecondtitlist: [],
  63. articlepage: 1,
  64. articlenowfirst: '',
  65. articlelist: [],
  66. articlenowtitbtn: '',
  67. wshareshow: false,
  68. listshare: false,
  69. poster: '',
  70. qrcode: '',
  71. islist: false,
  72. indexList: [],
  73. constructlist: [],
  74. casecommunitylist: [],
  75. site_id: '',
  76. sitename: '',
  77. sourceflag: false,
  78. articleflag: false,
  79. cateflag: false,
  80. nowtext: '',
  81. nowarticletext: '',
  82. nowcatetit: '',
  83. otherarr: [
  84. { id: 1, name: '最新', type: 'time' },
  85. { id: 2, name: '最热', type: 'hot' },
  86. { id: 3, name: '拓客效果', type: 'clue_number' }
  87. ],//ordertype
  88. nowotherid: '',
  89. otherflag: false,
  90. evidarr: [
  91. { id: 1, name: '视频', type: '1' },
  92. { id: 2, name: '图文', type: '2' }
  93. ],
  94. square: [
  95. { id: 1, name: '60㎡以下', start: 0, end: 60 },
  96. { id: 2, name: '60㎡—90㎡', start: 60, end: 90 },
  97. { id: 3, name: '90㎡—110㎡', start: 90, end: 110 },
  98. { id: 4, name: '110㎡—140㎡', start: 110, end: 140 },
  99. { id: 5, name: '140㎡—170㎡', start: 140, end: 170 },
  100. { id: 6, name: '170㎡—210㎡', start: 170, end: 210 },
  101. { id: 7, name: '210㎡—240㎡', start: 210, end: 240 },
  102. { id: 8, name: '240㎡—270㎡', start: 240, end: 270 },
  103. { id: 9, name: '270㎡以上', start: 270, end: '' }
  104. ],
  105. nowevidtype: '',
  106. nowevidtypetext: '',
  107. catetypeflag: false,
  108. casetype: '',
  109. styleflag: false,
  110. housestyleflag: false,
  111. squareflag: false,
  112. nowstyletext: '',
  113. nowsquare: '',
  114. nowhousestyletext: '',
  115. nowcommunitytext: '',
  116. casestylelist: [],
  117. housestylelist: [],
  118. leftcaselist: [],
  119. rightcaselist: [],
  120. typearr:[
  121. {id:1,name:'效果案例',type:1},
  122. {id:2,name:'实景案例',type:2}
  123. ],
  124. noweffect:'',
  125. noweffectid:'',
  126. effectflag:false,
  127. },
  128. /**
  129. * 生命周期函数--监听页面加载
  130. */
  131. onLoad: function (options) {
  132. var that = this;
  133. wx.hideShareMenu({
  134. menus: ['shareAppMessage', 'shareTimeline']
  135. })
  136. wx.showLoading({
  137. title: '加载中...',
  138. })
  139. this.articletit();
  140. this.articlefun();
  141. this.videotitfun();
  142. this.caselistfun();
  143. // this.communitylistfun();
  144. this.housestylefun();
  145. this.casestylefun();
  146. this.communityfun();
  147. },
  148. deltap(e) {
  149. var that = this;
  150. that.setData({
  151. site_id: '',
  152. sitename: ''
  153. })
  154. that.constructfun();
  155. },
  156. setcollectap(e) {
  157. const that = this;
  158. let num = e.currentTarget.dataset.idx;
  159. let str = "";
  160. let constructlist = that.data.constructlist;
  161. if (constructlist[num].collect == 0) {
  162. str = 'api/construction/collect'
  163. } else {
  164. str = 'api/construction/collectCancel'
  165. }
  166. utils.$post({
  167. url: app.globalData.webUrl + str,
  168. header: {
  169. 'Authorization': 'bearer ' + app.globalData.token
  170. },
  171. data: {
  172. id: e.currentTarget.dataset.cid
  173. },
  174. success: function (res) {
  175. wx.hideLoading();
  176. if (res.data.code == 0) {
  177. if (str == 'api/construction/collect') {
  178. constructlist[num].collect = 1;
  179. } else {
  180. constructlist[num].collect = 0;
  181. }
  182. that.setData({
  183. constructlist: constructlist
  184. })
  185. }
  186. }
  187. })
  188. },
  189. evidenceCate: function () {
  190. var that = this;
  191. utils.$get({
  192. url: app.globalData.webUrl + 'api/material/evidenceCate',
  193. header: {
  194. 'Authorization': 'bearer ' + app.globalData.token
  195. },
  196. data: {},
  197. success: function (res) {
  198. that.setData({
  199. evidencetype: res.data.data
  200. })
  201. }
  202. })
  203. },
  204. casemsgtap: function (e) {
  205. wx.navigateTo({
  206. url: '/index/pages/casemsg/casemsg?cid=' + e.currentTarget.dataset.cid,
  207. })
  208. },
  209. setordertypetap(e) {
  210. if (e.currentTarget.dataset.type == '2') {
  211. this.setData({
  212. otherflag: true,
  213. articleflag: false,
  214. cateflag: false,
  215. sourceflag: false
  216. })
  217. } else if (e.currentTarget.dataset.type == '3') {
  218. this.setData({
  219. otherflag: false,
  220. catetypeflag: this.data.mattertype == '客户好评' ? 'true' : 'false',
  221. })
  222. } else {
  223. this.setData({
  224. otherflag: false,
  225. sourceflag: this.data.mattertype == '拓客视频' && e.currentTarget.dataset.type == '2' ? 'false' : this.data.mattertype == '拓客视频' ? true : '',
  226. cateflag: this.data.mattertype == '客户好评' && e.currentTarget.dataset.type == '2' ? 'false' : this.data.mattertype == '客户好评' ? true : '',
  227. articleflag: this.data.mattertype == '拓客图文' && e.currentTarget.dataset.type == '2' ? 'false' : this.data.mattertype == '拓客图文' ? true : '',
  228. })
  229. }
  230. },
  231. casetypetap(e) {
  232. this.setData({
  233. casetype: e.currentTarget.dataset.type,
  234. styleflag: e.currentTarget.dataset.type == 1 ? true : '',
  235. housestyleflag: e.currentTarget.dataset.type == 3 ? true : '',
  236. squareflag: e.currentTarget.dataset.type == 2 ? true : '',
  237. // filtrateflag: e.currentTarget.dataset.type == 4 ? true : false,
  238. otherflag: e.currentTarget.dataset.type == 5 ? true : false,
  239. effectflag: e.currentTarget.dataset.type == 4 ? true : false,
  240. })
  241. },
  242. setstyletap(e) {
  243. if (e.detail == "") {
  244. this.setData({
  245. styleflag: false
  246. })
  247. return false;
  248. }
  249. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  250. this.setData({
  251. casestyletype: e.detail.currentTarget.dataset.text,
  252. styleflag: false,
  253. nowstyletext: this.data.casestylelist[e.detail.currentTarget.dataset.idx].name
  254. })
  255. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  256. this.setData({
  257. casestyletype: '',
  258. styleflag: false,
  259. nowstyletext: ''
  260. })
  261. }
  262. this.caselistfun();
  263. },
  264. setsquaretap(e) {
  265. if (e.detail == "") {
  266. this.setData({
  267. squareflag: false
  268. })
  269. return false;
  270. }
  271. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  272. this.setData({
  273. nowsquare: e.detail.currentTarget.dataset.text,
  274. squareflag: false,
  275. square_start: this.data.square[e.detail.currentTarget.dataset.idx].start,//面积开始值
  276. square_end: this.data.square[e.detail.currentTarget.dataset.idx].end,//面积结束值
  277. })
  278. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  279. this.setData({
  280. nowsquare: '',
  281. squareflag: false,
  282. square_start: '',//面积开始值
  283. square_end: '',//面积结束值
  284. })
  285. }
  286. this.caselistfun();
  287. },
  288. sethousestyletap(e) {
  289. if (e.detail == "") {
  290. this.setData({
  291. housestyleflag: false
  292. })
  293. return false;
  294. }
  295. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  296. this.setData({
  297. nowstyleid: e.detail.currentTarget.dataset.text,
  298. housestyleflag: false,
  299. nowhousestyletext: this.data.housestylelist[e.detail.currentTarget.dataset.idx].name
  300. })
  301. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  302. this.setData({
  303. nowstyleid: '',
  304. housestyleflag: false,
  305. nowhousestyletext: ''
  306. })
  307. }
  308. this.caselistfun();
  309. },
  310. communitytap(e) {
  311. this.setData({
  312. commu_id: e.detail.item.target.dataset.cid,
  313. nowcommunitytext: e.detail.item.target.dataset.item.name,
  314. filtrateflag: false,
  315. casetype:''
  316. })
  317. this.caselistfun();
  318. },
  319. clearcommunitytap() {
  320. this.setData({
  321. nowcommunitytext: '',
  322. commu_id: ''
  323. })
  324. this.caselistfun();
  325. },
  326. casestylefun: function () {
  327. var that = this;
  328. utils.$get({
  329. url: app.globalData.webUrl + 'api/stylelist',
  330. header: {
  331. 'Authorization': 'bearer ' + app.globalData.token
  332. },
  333. data: {},
  334. success: function (res) {
  335. if (res.data.code == '0') {
  336. that.setData({
  337. casestylelist: res.data.data
  338. })
  339. }
  340. }
  341. })
  342. },
  343. housestylefun: function () {
  344. var that = this;
  345. utils.$get({
  346. url: app.globalData.webUrl + 'api/material/housetypelist',
  347. header: {
  348. 'Authorization': 'bearer ' + app.globalData.token
  349. },
  350. data: {},
  351. success: function (res) {
  352. if (res.data.code == '0') {
  353. that.setData({
  354. housestylelist: res.data.data
  355. })
  356. }
  357. }
  358. })
  359. },
  360. caselistfun: function (e) {
  361. var that = this;
  362. if (!!e) {
  363. that.setData({
  364. filtrateflag: false
  365. })
  366. }
  367. that.setData({
  368. casepage: 1,
  369. })
  370. utils.$get({
  371. url: app.globalData.webUrl + 'api/caselist',
  372. header: {
  373. 'Authorization': 'bearer ' + app.globalData.token
  374. },
  375. data: {
  376. uid: app.globalData.personMsg.id,
  377. page: 1,
  378. limit:10,
  379. commu_id: that.data.commu_id,// 小区id
  380. style_id: that.data.casestyletype,//风格id
  381. square_start: that.data.square_start,//面积开始值
  382. square_end: that.data.square_end,//面积结束值
  383. keyword: that.data.casekeytext,
  384. housetype_id: that.data.nowstyleid,
  385. case_type:this.data.noweffectid,
  386. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'shared_times':''
  387. },
  388. success: function (res) {
  389. that.setData({
  390. datashow: true
  391. })
  392. if (res.data.code == '0') {
  393. that.setData({
  394. caselist: res.data.data,
  395. leftcaselist: [],
  396. rightcaselist: [],
  397. datashow: true
  398. })
  399. that.caseimgload();
  400. }
  401. setTimeout(function () {
  402. wx.hideLoading()
  403. }, 500)
  404. }, fail() {
  405. wx.hideLoading()
  406. }
  407. })
  408. },
  409. caseimgload: function () {
  410. var that = this;
  411. var leftlist = that.data.leftcaselist;
  412. var rightlist = that.data.rightcaselist;
  413. var indexlist = that.data.caselist;
  414. if (indexlist.length == 0) {
  415. return false;
  416. }
  417. if (!indexlist[0]) {
  418. return false;
  419. }
  420. if (leftlist.length == 0) {
  421. leftlist.push(indexlist[0]);
  422. indexlist.shift();
  423. that.setData({
  424. caselist: indexlist,
  425. leftcaselist: leftlist,
  426. rightcaselist: rightlist
  427. })
  428. } else {
  429. var leftheight, rightheight;
  430. wx.createSelectorQuery().in(this).select('#leftcasebox').boundingClientRect(function (res) {
  431. // if(!res){
  432. // return false;
  433. // }
  434. leftheight = res.height;
  435. wx.createSelectorQuery().in(that).select('#rightcasebox').boundingClientRect(function (rs) {
  436. // if(!rs){
  437. // return false;
  438. // }
  439. leftlist = that.data.leftcaselist;
  440. rightlist = that.data.rightcaselist;
  441. indexlist = that.data.caselist;
  442. rightheight = rs.height;
  443. if (!indexlist[0]) {
  444. return false;
  445. }
  446. if (leftheight <= rightheight) {
  447. leftlist.push(indexlist[0]);
  448. indexlist.shift();
  449. } else {
  450. rightlist.push(indexlist[0]);
  451. indexlist.shift();
  452. }
  453. that.setData({
  454. caselist: indexlist,
  455. leftcaselist: leftlist,
  456. rightcaselist: rightlist
  457. })
  458. }).exec();
  459. }).exec();
  460. }
  461. },
  462. setothertap(e) {
  463. if (e.detail == "") {
  464. this.setData({
  465. otherflag: false
  466. })
  467. return false;
  468. }
  469. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  470. this.setData({
  471. nowotherid: e.detail.currentTarget.dataset.text,
  472. otherflag: false,
  473. ordertype: this.data.otherarr[e.detail.currentTarget.dataset.idx].type
  474. })
  475. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  476. this.setData({
  477. nowotherid: '',
  478. otherflag: false,
  479. ordertype: '',
  480. })
  481. }
  482. if (this.data.mattertype == '拓客视频') {
  483. this.videodata();
  484. } else if (this.data.mattertype == '客户好评') {
  485. this.evidencelistfun();
  486. } else if (this.data.mattertype == '拓客图文') {
  487. this.articlefun();
  488. }else if (this.data.mattertype == '拓客案例') {
  489. this.caselistfun();
  490. }
  491. },
  492. seteffectap(e) {
  493. if (e.detail == "") {
  494. this.setData({
  495. effectflag: false
  496. })
  497. return false;
  498. }
  499. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  500. this.setData({
  501. noweffect: this.data.typearr[e.detail.currentTarget.dataset.idx].name,
  502. effectflag: false,
  503. noweffectid: this.data.typearr[e.detail.currentTarget.dataset.idx].type
  504. })
  505. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  506. this.setData({
  507. noweffectid: '',
  508. effectflag: false,
  509. noweffect: '',
  510. })
  511. }
  512. this.caselistfun();
  513. },
  514. videotitfun: function () {
  515. var that = this;
  516. wx.showLoading({
  517. title: '加载中...',
  518. })
  519. utils.$post({
  520. url: app.globalData.webUrl + 'api/video/type',
  521. header: {
  522. 'Authorization': 'bearer ' + app.globalData.token
  523. },
  524. data: {},
  525. success: function (res) {
  526. wx.hideLoading();
  527. if (res.data.code == 0) {
  528. that.setData({
  529. titlist: res.data.data,
  530. // secondtitlist:res.data.data[0].sonLabel,
  531. // nowfirst:res.data.data[0].val
  532. })
  533. that.videodata();
  534. }
  535. }
  536. })
  537. },
  538. firstitbtn: function (e) {
  539. var that = this;
  540. if (!e.currentTarget.dataset.text) {
  541. this.setData({
  542. nowfirst: '',
  543. nowtitbtn: '',
  544. page: 1,
  545. videolist: [],
  546. secondtitlist: '',
  547. })
  548. } else {
  549. this.setData({
  550. nowfirst: e.currentTarget.dataset.text,
  551. nowtitbtn: '',
  552. page: 1,
  553. videolist: [],
  554. secondtitlist: that.data.titlist[e.currentTarget.dataset.idx].sonLabel,
  555. })
  556. }
  557. that.videodata();
  558. },
  559. setcasekeywordtap: function (e) {
  560. this.setData({
  561. casekeytext: e.detail.value
  562. })
  563. },
  564. secondtitap: function (e) {
  565. var that = this;
  566. this.setData({
  567. nowtitbtn: e.currentTarget.dataset.text,
  568. page: 1,
  569. videolist: [],
  570. filtrateflag: false
  571. })
  572. wx.showLoading({
  573. title: '加载中...',
  574. })
  575. that.videodata();
  576. },
  577. videodata: function () {
  578. var that = this;
  579. that.setData({
  580. datashow: true,
  581. page: 1
  582. })
  583. util.goTop();
  584. utils.$post({
  585. url: app.globalData.webUrl + 'api/video/list',
  586. header: {
  587. 'Authorization': 'bearer ' + app.globalData.token
  588. },
  589. data: {
  590. type: that.data.nowfirst,
  591. label: that.data.nowtitbtn,
  592. page: 1,
  593. limit: "10",
  594. keyword: that.data.videotext,
  595. order: that.data.ordertype == 'clue_number' ? 'clue_number' : that.data.ordertype == 'hot'?'shared_times':'uploadtime'
  596. },
  597. success: function (res) {
  598. if (res.data.code == 0) {
  599. that.setData({
  600. videolist: res.data.data,
  601. leftlist: [],
  602. rightlist: []
  603. })
  604. that.videoimgload();
  605. }
  606. setTimeout(function () {
  607. wx.hideLoading();
  608. }, 500)
  609. }
  610. })
  611. },
  612. videoimgload: function () {
  613. var that = this;
  614. if (that.data.mattertype != '拓客视频') {
  615. return false;
  616. }
  617. var leftlist = that.data.leftlist;
  618. var rightlist = that.data.rightlist;
  619. var videolist = that.data.videolist;
  620. if (videolist.length == 0) {
  621. return false;
  622. }
  623. let vidoemsg = videolist[0];
  624. if (!vidoemsg) {
  625. that.setData({
  626. videolist: [],
  627. })
  628. return false;
  629. }
  630. if (leftlist.length == 0) {
  631. leftlist.push(vidoemsg);
  632. videolist.shift();
  633. that.setData({
  634. videolist: videolist,
  635. leftlist: leftlist,
  636. rightlist: rightlist
  637. })
  638. } else {
  639. // setTimeout(() => {
  640. var leftheight, rightheight;
  641. const query = wx.createSelectorQuery()
  642. query.select('.leftvideolistbox').boundingClientRect();
  643. query.exec(function (res) {
  644. leftheight = res[0].height;
  645. const queryright = wx.createSelectorQuery()
  646. queryright.select('.rightvideolistbox').boundingClientRect();
  647. queryright.exec(function (rs) {
  648. leftlist = that.data.leftlist;
  649. rightlist = that.data.rightlist;
  650. rightheight = rs[0].height;
  651. if (leftheight <= rightheight) {
  652. leftlist.push(vidoemsg);
  653. videolist.shift();
  654. } else {
  655. rightlist.push(vidoemsg);
  656. videolist.shift();
  657. }
  658. that.setData({
  659. videolist: videolist,
  660. leftlist: leftlist,
  661. rightlist: rightlist
  662. })
  663. })
  664. })
  665. // }, 50);
  666. }
  667. },
  668. articletit: function () {
  669. var that = this;
  670. wx.showLoading({
  671. title: '加载中...',
  672. })
  673. utils.$post({
  674. url: app.globalData.webUrl + 'api/article/type',
  675. header: {
  676. 'Authorization': 'bearer ' + app.globalData.token
  677. },
  678. data: {},
  679. success: function (res) {
  680. wx.hideLoading();
  681. if (res.data.code == 0) {
  682. that.setData({
  683. articletitlist: res.data.data,
  684. articlesecondtitlist: []
  685. })
  686. }
  687. }
  688. })
  689. },
  690. articlefirstitbtn: function (e) {
  691. var that = this;
  692. if (!e.currentTarget.dataset.text) {
  693. this.setData({
  694. articlenowfirst: '',
  695. articlenowtitbtn: '',
  696. articlepage: 1,
  697. articlelist: [],
  698. articlesecondtitlist: '',
  699. })
  700. } else {
  701. this.setData({
  702. articlenowfirst: e.currentTarget.dataset.text,
  703. articlenowtitbtn: '',
  704. articlepage: 1,
  705. articlelist: [],
  706. articlesecondtitlist: that.data.articletitlist[e.currentTarget.dataset.idx].sonLabel,
  707. })
  708. }
  709. this.articlefun();
  710. },
  711. articlesecondtitap: function (e) {
  712. var that = this;
  713. this.setData({
  714. articlenowtitbtn: e.currentTarget.dataset.text,
  715. articlepage: 1,
  716. articlelist: [],
  717. filtrateflag: false
  718. })
  719. wx.showLoading({
  720. title: '加载中...',
  721. })
  722. this.articlefun();
  723. },
  724. articlefun: function () {
  725. var that = this;
  726. that.setData({
  727. articlepage: 1
  728. })
  729. utils.$post({
  730. url: app.globalData.webUrl + 'api/article/list',
  731. header: {
  732. 'Authorization': 'bearer ' + app.globalData.token
  733. },
  734. data: {
  735. type: that.data.articlenowfirst,
  736. label: that.data.articlenowtitbtn,
  737. page: 1,
  738. limit: "10",
  739. keyword: that.data.articletext,
  740. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'? 'shared_times':'uploadtime'
  741. },
  742. success: function (res) {
  743. that.setData({
  744. datashow: true
  745. })
  746. if (res.data.code == 0) {
  747. that.setData({
  748. articlelist: res.data.data
  749. })
  750. }
  751. wx.hideLoading()
  752. }
  753. })
  754. },
  755. articleTap: function (e) {
  756. wx.navigateTo({
  757. url: "/index/pages/articleshare/articleshare?aid=" + e.currentTarget.dataset.aid,
  758. });
  759. },
  760. setvideokeywordtap: function (e) {
  761. let that = this;
  762. this.setData({
  763. videotext: e.detail.value
  764. })
  765. },
  766. setarticlekeywordtap: function (e) {
  767. this.setData({
  768. articletext: e.detail.value
  769. })
  770. },
  771. /**
  772. * 拓客案例收藏
  773. */
  774. casecollectap: function (e) {
  775. var that = this;
  776. let caselist = '';
  777. if (e.currentTarget.dataset.type == 'rightcaselist') {
  778. caselist = that.data.rightcaselist;
  779. } else {
  780. caselist = that.data.leftcaselist;
  781. }
  782. utils.$post({
  783. url: app.globalData.webUrl + 'api/collect',
  784. header: {
  785. 'Authorization': 'bearer ' + app.globalData.token
  786. },
  787. data: {
  788. user_id: app.globalData.personMsg.id,
  789. content_type: "materialCase",
  790. content_id: e.currentTarget.dataset.cid
  791. },
  792. success: function (res) {
  793. if (res.data.code == '0') {
  794. wx.showToast({
  795. title: res.data.msg,
  796. icon: 'none',
  797. duration: 2000
  798. })
  799. caselist[e.currentTarget.dataset.idx].collected = !caselist[e.currentTarget.dataset.idx].collected;
  800. if (e.currentTarget.dataset.type == 'rightcaselist') {
  801. that.setData({
  802. rightcaselist: caselist
  803. })
  804. } else {
  805. that.setData({
  806. leftcaselist: caselist
  807. })
  808. }
  809. }
  810. }
  811. })
  812. },
  813. articlecollectap: function (e) {
  814. let that = this, aurl = '', articlelist = this.data.articlelist;
  815. if (e.currentTarget.dataset.num == true) {
  816. aurl = 'api/article/collectCancel';
  817. } else {
  818. aurl = 'api/article/collect';
  819. }
  820. utils.$post({
  821. url: app.globalData.webUrl + aurl,
  822. header: {
  823. 'Authorization': 'bearer ' + app.globalData.token
  824. },
  825. data: {
  826. id: e.currentTarget.dataset.aid
  827. },
  828. success: function (res) {
  829. if (res.data.code == '0') {
  830. wx.showToast({
  831. title: res.data.msg,
  832. icon: 'none',
  833. duration: 2000
  834. })
  835. articlelist[e.currentTarget.dataset.idx].isCollection = !articlelist[e.currentTarget.dataset.idx].isCollection;
  836. that.setData({
  837. articlelist: articlelist
  838. })
  839. }
  840. }
  841. })
  842. },
  843. setsourcetap(e) {
  844. if (e.detail == "") {
  845. this.setData({
  846. sourceflag: false
  847. })
  848. return false;
  849. }
  850. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  851. this.setData({
  852. nowfirst: e.detail.currentTarget.dataset.text,
  853. sourceflag: false,
  854. nowtext: this.data.titlist[e.detail.currentTarget.dataset.idx].name
  855. })
  856. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  857. this.setData({
  858. nowfirst: '',
  859. sourceflag: false,
  860. nowtext: '',
  861. })
  862. }
  863. this.videodata();
  864. },
  865. setarticletap(e) {
  866. console.log(e)
  867. if (e.detail == "") {
  868. this.setData({
  869. articleflag: false
  870. })
  871. return false;
  872. }
  873. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  874. this.setData({
  875. articlenowfirst: e.detail.currentTarget.dataset.text,
  876. articleflag: false,
  877. nowarticletext: this.data.articletitlist[e.detail.currentTarget.dataset.idx].name
  878. })
  879. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  880. this.setData({
  881. articlenowfirst: '',
  882. articleflag: false,
  883. nowarticletext: ''
  884. })
  885. }
  886. this.articlefun();
  887. },
  888. setcatetypetap(e) {
  889. if (e.detail == "") {
  890. this.setData({
  891. catetypeflag: false
  892. })
  893. return false;
  894. }
  895. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  896. this.setData({
  897. nowevidtype: e.detail.currentTarget.dataset.text,
  898. catetypeflag: false,
  899. nowevidtypetext: this.data.evidarr[e.detail.currentTarget.dataset.idx].name
  900. })
  901. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  902. this.setData({
  903. nowevidtype: '',
  904. catetypeflag: false,
  905. nowevidtypetext: ''
  906. })
  907. }
  908. this.evidencelistfun();
  909. },
  910. setcatetap(e) {
  911. if (e.detail == "") {
  912. this.setData({
  913. cateflag: false
  914. })
  915. return false;
  916. }
  917. if (e.detail.currentTarget.dataset.type == 1 && e.detail.currentTarget.dataset.idx != '-1') {
  918. this.setData({
  919. catetype: e.detail.currentTarget.dataset.text,
  920. cateflag: false,
  921. nowcatetit: this.data.evidencetype[e.detail.currentTarget.dataset.idx].name
  922. })
  923. } else if (e.detail.currentTarget.dataset.idx == '-1') {
  924. this.setData({
  925. catetype: '',
  926. cateflag: false,
  927. nowcatetit: ''
  928. })
  929. }
  930. this.evidencelistfun();
  931. },
  932. setevidencekeywordtap: function (e) {
  933. this.setData({
  934. evidencekeytext: e.detail.value
  935. })
  936. },
  937. previewImg: function (e) {
  938. var that = this;
  939. var idx = e.target.dataset.src, current;
  940. var imglist = [];
  941. for (var i = 0; i < that.data.wxfriendlist.length; i++) {
  942. if (that.data.wxfriendlist[i].id == idx) {
  943. imglist = that.data.wxfriendlist[i].picture;
  944. }
  945. }
  946. for (var j = 0; j < imglist.length; j++) {
  947. imglist[j] = app.globalData.imgUrl + imglist[j];
  948. }
  949. current = e.target.dataset.vsrc;
  950. wx.previewImage({
  951. current: current, // 当前显示图片的http链接
  952. urls: imglist, // 需要预览的图片http链接列表
  953. fail(res) {
  954. console.log(res)
  955. }
  956. })
  957. },
  958. praisecollecttap: function (e) {
  959. var that = this;
  960. let list = [];
  961. if (e.currentTarget.dataset.type == 'left') {
  962. list = that.data.leftevidencelist;
  963. } else {
  964. list = that.data.rightevidencelist
  965. }
  966. utils.$post({
  967. url: app.globalData.webUrl + 'api/collect',
  968. header: {
  969. 'Authorization': 'bearer ' + app.globalData.token
  970. },
  971. data: {
  972. user_id: app.globalData.personMsg.id,
  973. content_type: "materialEvidence",
  974. content_id: e.currentTarget.dataset.eid
  975. },
  976. success: function (res) {
  977. if (res.data.code == '0') {
  978. wx.showToast({
  979. title: res.data.msg,
  980. icon: 'none',
  981. duration: 2000
  982. })
  983. list[e.currentTarget.dataset.idx].collected = !list[e.currentTarget.dataset.idx].collected;
  984. if (e.currentTarget.dataset.type == 'left') {
  985. that.setData({
  986. leftevidencelist: list
  987. })
  988. } else {
  989. that.setData({
  990. rightevidencelist: list
  991. })
  992. }
  993. }
  994. }
  995. })
  996. },
  997. dothis: function () { },
  998. openVRLink(e) {
  999. let id = e.currentTarget.dataset.id;
  1000. let vrlink = e.currentTarget.dataset.vrlink;
  1001. wx.navigateTo({
  1002. url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&aid=' + id,
  1003. })
  1004. },
  1005. mattertitap: function (e) {
  1006. this.setData({
  1007. mattertype: e.currentTarget.dataset.type,
  1008. filtrateflag: false,
  1009. ordertype: '',
  1010. nowotherid: ''
  1011. })
  1012. wx.showLoading({
  1013. title: '加载中...',
  1014. })
  1015. if (this.data.mattertype == '拓客图文' && this.data.articlelist.length == 0) {
  1016. wx.pageScrollTo({
  1017. scrollTop: 0,
  1018. duration: 5
  1019. })
  1020. this.articlefun();
  1021. } else if (this.data.mattertype == '拓客视频') {
  1022. if (this.data.leftlist.length != 0 || this.data.rightlist.length != 0) {
  1023. wx.hideLoading()
  1024. } else {
  1025. wx.pageScrollTo({
  1026. scrollTop: 0,
  1027. duration: 5
  1028. })
  1029. this.videodata();
  1030. }
  1031. } else if (this.data.mattertype == '客户好评') {
  1032. if (this.data.leftevidencelist.length != 0 || this.data.rightevidencelist.length != 0) {
  1033. wx.hideLoading()
  1034. } else {
  1035. wx.pageScrollTo({
  1036. scrollTop: 0,
  1037. duration: 5
  1038. })
  1039. this.evidencelistfun();
  1040. }
  1041. } else {
  1042. wx.hideLoading()
  1043. }
  1044. },
  1045. topchangetap: function (e) {
  1046. this.setData({
  1047. toptype: e.currentTarget.dataset.type
  1048. })
  1049. },
  1050. casefiltratetap: function (e) {
  1051. this.setData({
  1052. casefiltratetype: e.currentTarget.dataset.type
  1053. })
  1054. },
  1055. allfiltratetap: function () {
  1056. this.setData({
  1057. filtrateflag: true,
  1058. casetype: 5
  1059. })
  1060. },
  1061. closefiltratetap: function () {
  1062. this.setData({
  1063. filtrateflag: false,
  1064. casetype:''
  1065. })
  1066. },
  1067. /**
  1068. * 拓客案例分享
  1069. */
  1070. casesharetap: function (e) {
  1071. var that = this;
  1072. that.setData({
  1073. nowtype: 'materialCase',
  1074. nowid: e.currentTarget.dataset.cid,
  1075. nowtitle: e.currentTarget.dataset.title,
  1076. nowimg: e.currentTarget.dataset.img,
  1077. wshareshow: true,
  1078. islist: false,
  1079. })
  1080. },
  1081. /**
  1082. * 图文分享
  1083. */
  1084. articlesharetap: function (e) {
  1085. var that = this;
  1086. that.setData({
  1087. nowtype: 'article',
  1088. nowid: e.currentTarget.dataset.aid,
  1089. nowtitle: e.currentTarget.dataset.title,
  1090. nowimg: e.currentTarget.dataset.img,
  1091. islist: false,
  1092. wshareshow: true
  1093. })
  1094. },
  1095. listsharetap: function () {
  1096. const that = this;
  1097. this.setData({
  1098. wshareshow: true,
  1099. nowid: '',
  1100. islist: true,
  1101. listshare: true
  1102. })
  1103. if (that.data.mattertype == '拓客案例') {
  1104. that.setData({
  1105. nowimg: app.globalData.imgUrl + "xcx/caseposter.jpg"
  1106. })
  1107. } else if (that.data.mattertype == '客户好评') {
  1108. that.setData({
  1109. nowimg: app.globalData.imgUrl + "xcx/praiseimg.jpg",
  1110. })
  1111. }
  1112. },
  1113. shareurltap: function () {
  1114. let that = this;
  1115. if (this.data.listshare) {
  1116. wx.showLoading({
  1117. title: '加载中...',
  1118. })
  1119. if (this.data.mattertype == '拓客案例') { //u=69&c=&s=&st=&e=&h=
  1120. util.schemefun('/share/pages/caselist/caselist', 's=' + app.globalData.personMsg.id + '&c=' + that.data.commu_id + '&s=' + that.data.casestyletype + '&st=' + that.data.square_start + '&e=' + that.data.square_end + '&k=&h=' + that.data.nowstyleid + '&ctp=' + app.globalData.clientype, '', 'materialCase', '');
  1121. } else if (this.data.mattertype == '客户好评') {
  1122. util.schemefun('/share/pages/praiselist/praiselist', 'uid=' + app.globalData.personMsg.id + '&cate=' + this.data.catetype + '&ctp=' + app.globalData.clientype, '', 'materialEvidence', '');
  1123. } else if (this.data.mattertype == '拓客视频') {
  1124. util.schemefun('/share/pages/videolist/videolist', 'uid=' + app.globalData.personMsg.id + '&firsTitext=' + this.data.nowfirst + '&nowTagText=' + that.data.nowtitbtn + '&ctp=' + app.globalData.clientype, '', 'video', '');
  1125. } else if (this.data.mattertype == '拓客图文') {
  1126. util.schemefun('/share/pages/articleshare/articleshare', 'userid=' + app.globalData.personMsg.id+'&aid='+this.data.nowid + '&ctp=' + app.globalData.clientype, '', 'article', '');
  1127. }
  1128. this.setData({
  1129. listshare: false
  1130. })
  1131. return false;
  1132. }
  1133. switch (that.data.nowtype) {
  1134. case 'materialCase':
  1135. wx.showLoading({
  1136. title: '加载中...',
  1137. })
  1138. util.schemefun('/share/pages/materialcase/materialcase', 'cid=' + that.data.nowid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, that.data.nowid, 'materialCase', '');
  1139. this.sharelogtap();
  1140. break;
  1141. case 'materialEvidence':
  1142. wx.showLoading({
  1143. title: '加载中...',
  1144. })
  1145. util.schemefun('/share/pages/publicpraisemsg/publicpraisemsg', 'eid=' + that.data.nowid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, that.data.nowid, 'materialEvidence', '');
  1146. this.sharelogtap();
  1147. break;
  1148. case 'video':
  1149. wx.showLoading({
  1150. title: '加载中...',
  1151. })
  1152. util.schemefun('/share/pages/videoshare/videoshare', 'vid=' + that.data.nowid + '&userid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, that.data.nowid, 'video', '');
  1153. this.sharelogtap();
  1154. break;
  1155. case 'article':
  1156. wx.showLoading({
  1157. title: '加载中...',
  1158. })
  1159. util.schemefun('/share/pages/articleshare/articleshare', 'aid=' + that.data.nowid + '&userid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, that.data.nowid, 'article', '');
  1160. this.sharelogtap();
  1161. break;
  1162. case 'Construction':
  1163. wx.showLoading({
  1164. title: '加载中...',
  1165. })
  1166. util.schemefun('/share/pages/constructsite/constructsite', 'uid=' + app.globalData.personMsg.id + '&cid=' + that.data.nowid + '&ctp=' + app.globalData.clientype, '', 'Construction', '');
  1167. this.sharelogtap();
  1168. default:
  1169. console.log('1')
  1170. }
  1171. },
  1172. setpostertap: function () {
  1173. let that = this;
  1174. let type = that.data.nowtype, usrl = "";
  1175. if (this.data.mattertype == '拓客视频') {
  1176. type = "video";
  1177. usrl = '&ftext=' + this.data.nowfirst + '&nText=' + that.data.nowtitbtn;
  1178. } else if (this.data.mattertype == '拓客图文') {
  1179. type = "article";
  1180. } else if (this.data.mattertype == '拓客案例') {
  1181. type = "materialCase";
  1182. usrl = '&u=' + app.globalData.personMsg.id + '&c=' + that.data.commu_id + '&s=' + that.data.casestyletype + '&st=' + that.data.square_start + '&e=' + that.data.square_end + '&h=' + that.data.nowstyleid
  1183. }
  1184. wx.navigateTo({
  1185. url: '/index/pages/setposter/setposter?type=' + type + '&aid=' + this.data.nowid + "&listshare=" + (that.data.listshare ? '123' : '') + usrl,
  1186. })
  1187. },
  1188. sendfriendtap: function () {
  1189. this.sharelogtap();
  1190. },
  1191. getcodeimg: function (type, usrl) {
  1192. let that = this, query = '', path = '';
  1193. if (type == 'video') {
  1194. query = 'vid=' + that.data.nowid + '&userid=' + app.globalData.personMsg.id;
  1195. path = 'share/pages/videoshare/videoshare';
  1196. }
  1197. if (type == 'article') {
  1198. query = 'aid=' + that.data.nowid + '&userid=' + app.globalData.personMsg.id;
  1199. path = 'share/pages/articleshare/articleshare';
  1200. }
  1201. utils.$post({
  1202. url: app.globalData.webUrl + 'api/share/qrcode',
  1203. header: {
  1204. 'Authorization': 'bearer ' + app.globalData.token
  1205. },
  1206. data: {
  1207. query: query,
  1208. path: path
  1209. },
  1210. success: function (res) {
  1211. if (res.data.code == "0") {
  1212. that.setData({
  1213. qrcodeimg: res.data.data
  1214. })
  1215. // setTimeout(function(){
  1216. // that.createdCode();
  1217. // },300)
  1218. }
  1219. },
  1220. fail() {
  1221. }
  1222. })
  1223. },
  1224. videosharetap: function (e) {
  1225. var that = this;
  1226. this.setData({
  1227. nowtype: 'video',
  1228. nowid: e.currentTarget.dataset.vid,
  1229. nowtitle: e.currentTarget.dataset.title,
  1230. nowimg: e.currentTarget.dataset.img,
  1231. wshareshow: true,
  1232. islist: false
  1233. })
  1234. },
  1235. sharelogtap: function (e) {
  1236. var that = this;
  1237. utils.$post({
  1238. url: app.globalData.webUrl + 'api/share/addlog',
  1239. header: {
  1240. 'Authorization': 'bearer ' + app.globalData.token
  1241. },
  1242. data: {
  1243. id: that.data.nowid,
  1244. type: that.data.nowtype
  1245. },
  1246. success: function (r) {
  1247. }
  1248. })
  1249. },
  1250. // communitylistfun: function (e) {
  1251. // var that = this;
  1252. // that.setData({
  1253. // casepage: 1,
  1254. // })
  1255. // utils.$get({
  1256. // url: app.globalData.webUrl + 'api/communitylist',
  1257. // header: {
  1258. // 'Authorization': 'bearer ' + app.globalData.token
  1259. // },
  1260. // data: {
  1261. // page: 1,
  1262. // sort: this.data.ordertype == 'time' ? '' : 'updatetime'
  1263. // },
  1264. // success: function (res) {
  1265. // that.setData({
  1266. // datashow: true
  1267. // })
  1268. // let indexList = [], str = '';
  1269. // if (res.data.code == '0') {
  1270. // for (let i in res.data.data) {
  1271. // res.data.data[i].firstword = res.data.data[i].pinyin.slice(0, 1).toUpperCase();
  1272. // if (res.data.data[i].pinyin.slice(0, 1).toUpperCase() != str) {
  1273. // str = res.data.data[i].pinyin.slice(0, 1).toUpperCase() + '';
  1274. // indexList.push(str);
  1275. // }
  1276. // }
  1277. // that.setData({
  1278. // caselist: res.data.data,
  1279. // indexList: indexList
  1280. // })
  1281. // }
  1282. // setTimeout(function () {
  1283. // wx.hideLoading()
  1284. // }, 1000)
  1285. // }, fail() {
  1286. // wx.hideLoading()
  1287. // }
  1288. // })
  1289. // },
  1290. communityfun: function (e) {
  1291. var that = this;
  1292. that.setData({
  1293. casepage: 1,
  1294. })
  1295. utils.$get({
  1296. url: app.globalData.webUrl + 'api/communitylist',
  1297. header: {
  1298. 'Authorization': 'bearer ' + app.globalData.token
  1299. },
  1300. data: {
  1301. page: 1,
  1302. sort: ''
  1303. },
  1304. success: function (res) {
  1305. that.setData({
  1306. datashow: true
  1307. })
  1308. let indexList = [], str = '';
  1309. if (res.data.code == '0') {
  1310. for (let i in res.data.data) {
  1311. res.data.data[i].firstword = res.data.data[i].pinyin.slice(0, 1).toUpperCase();
  1312. if (res.data.data[i].pinyin.slice(0, 1).toUpperCase() != str) {
  1313. str = res.data.data[i].pinyin.slice(0, 1).toUpperCase() + '';
  1314. indexList.push(str);
  1315. }
  1316. }
  1317. that.setData({
  1318. communitycaselist: res.data.data,
  1319. indexList: indexList
  1320. })
  1321. that.communitygetCitys();
  1322. }
  1323. setTimeout(function () {
  1324. wx.hideLoading()
  1325. }, 500)
  1326. }, fail() {
  1327. wx.hideLoading()
  1328. }
  1329. })
  1330. },
  1331. communitygetCitys() {
  1332. const _this = this
  1333. const cities = this.data.communitycaselist;
  1334. // 按拼音排序
  1335. cities.sort((c1, c2) => {
  1336. let pinyin1 = c1.pinyin;
  1337. let pinyin2 = c2.pinyin;
  1338. return pinyin1.localeCompare(pinyin2)
  1339. })
  1340. // 添加首字母
  1341. const map = new Map()
  1342. for (const city of cities) {
  1343. const alpha = city.pinyin.charAt(0).toUpperCase()
  1344. if (!map.has(alpha)) map.set(alpha, [])
  1345. map.get(alpha).push({ name: city.name, id: city.id })
  1346. }
  1347. const keys = []
  1348. for (const key of map.keys()) {
  1349. keys.push(key)
  1350. }
  1351. keys.sort()
  1352. const list = []
  1353. for (const key of keys) {
  1354. list.push({
  1355. alpha: key,
  1356. subItems: map.get(key)
  1357. })
  1358. }
  1359. for (let i = 0; i < list.length; i++) {
  1360. list[i].subItems[0].case_num = '0';
  1361. for (let k = 0; k < list[i].subItems.length; k++) {
  1362. for (let j = 0; j < cities.length; j++) {
  1363. if (list[i].subItems[k].name == cities[j].name) {
  1364. list[i].subItems[k].case_num = cities[j].case_num;
  1365. list[i].id = cities[j].id;
  1366. }
  1367. }
  1368. }
  1369. }
  1370. _this.setData({ communitylist: list })
  1371. },
  1372. catetap: function (e) {
  1373. this.setData({
  1374. catetype: e.currentTarget.dataset.text
  1375. })
  1376. this.evidencelistfun();
  1377. },
  1378. evidencelistfun: function (e) {
  1379. var that = this;
  1380. if (!!e) {
  1381. that.setData({
  1382. filtrateflag: false
  1383. })
  1384. }
  1385. this.setData({
  1386. evidencepage: 1,
  1387. })
  1388. utils.$get({
  1389. url: app.globalData.webUrl + 'api/evidencelist',
  1390. header: {
  1391. 'Authorization': 'bearer ' + app.globalData.token
  1392. },
  1393. data: {
  1394. uid: app.globalData.personMsg.id,
  1395. page: 1,
  1396. limit:10,
  1397. cate: that.data.catetype,
  1398. keyword: that.data.evidencekeytext,
  1399. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'view_times':'addtime',
  1400. difference: !that.data.nowevidtype ? 0 : that.data.nowevidtype
  1401. },
  1402. success: function (res) {
  1403. setTimeout(function () {
  1404. wx.hideLoading()
  1405. }, 500)
  1406. if (res.data.code == '0') {
  1407. that.setData({
  1408. evidencelist: res.data.data,
  1409. leftevidencelist: [],
  1410. rightevidencelist: [],
  1411. datashow: true
  1412. })
  1413. that.imgload();
  1414. }
  1415. },
  1416. fail() {
  1417. wx.hideLoading()
  1418. }
  1419. })
  1420. },
  1421. imgload: function () {
  1422. var that = this;
  1423. var leftlist = that.data.leftevidencelist;
  1424. var rightlist = that.data.rightevidencelist;
  1425. var indexlist = that.data.evidencelist;
  1426. if (indexlist.length == 0) {
  1427. return false;
  1428. }
  1429. if (that.data.mattertype != '客户好评') {
  1430. return false;
  1431. }
  1432. if (leftlist.length == 0) {
  1433. leftlist.push(indexlist[0]);
  1434. indexlist.shift();
  1435. that.setData({
  1436. evidencelist: indexlist,
  1437. leftevidencelist: leftlist,
  1438. rightevidencelist: rightlist
  1439. })
  1440. } else {
  1441. var leftheight, rightheight;
  1442. wx.createSelectorQuery().select('.leftpublicpraisebox').boundingClientRect(function (res) {
  1443. leftheight = res.height;
  1444. wx.createSelectorQuery().select('.rightpublicpraisebox').boundingClientRect(function (rs) {
  1445. leftlist = that.data.leftevidencelist;
  1446. rightlist = that.data.rightevidencelist;
  1447. indexlist = that.data.evidencelist;
  1448. rightheight = rs.height;
  1449. if (leftheight <= rightheight) {
  1450. leftlist.push(indexlist[0]);
  1451. indexlist.shift();
  1452. } else {
  1453. rightlist.push(indexlist[0]);
  1454. indexlist.shift();
  1455. }
  1456. that.setData({
  1457. evidencelist: indexlist,
  1458. leftevidencelist: leftlist,
  1459. rightevidencelist: rightlist
  1460. })
  1461. }).exec();
  1462. }).exec();
  1463. }
  1464. },
  1465. arrfun: function (str) {
  1466. var that = this;
  1467. let arr = str.split(',');
  1468. return arr;
  1469. },
  1470. alltextap: function (e) {
  1471. var that = this;
  1472. var wxfriendlist = this.data.wxfriendlist;
  1473. wxfriendlist[e.currentTarget.dataset.idx].textflag = 1;
  1474. this.setData({
  1475. wxfriendlist: wxfriendlist
  1476. })
  1477. },
  1478. publictap: function (e) {
  1479. wx.navigateTo({
  1480. url: '/index/pages/publicpraisemsg/publicpraisemsg?eid=' + e.currentTarget.dataset.eid + "&title=" + e.currentTarget.dataset.title,
  1481. })
  1482. },
  1483. evidencetap: function (e) {
  1484. var that = this;
  1485. that.setData({
  1486. nowtype: 'materialEvidence',
  1487. nowid: e.currentTarget.dataset.eid,
  1488. nowtitle: e.currentTarget.dataset.title,
  1489. nowimg: e.currentTarget.dataset.img,
  1490. islist: false,
  1491. wshareshow: true
  1492. })
  1493. },
  1494. /**
  1495. * 生命周期函数--监听页面初次渲染完成
  1496. */
  1497. onReady: function () {
  1498. },
  1499. /**
  1500. * 生命周期函数--监听页面显示
  1501. */
  1502. onShow: function () {
  1503. },
  1504. /**
  1505. * 生命周期函数--监听页面隐藏
  1506. */
  1507. onHide: function () {
  1508. },
  1509. /**
  1510. * 生命周期函数--监听页面卸载
  1511. */
  1512. onUnload: function () {
  1513. },
  1514. /**
  1515. * 页面相关事件处理函数--监听用户下拉动作
  1516. */
  1517. onPullDownRefresh: function () {
  1518. var that = this;
  1519. if (that.data.mattertype == '拓客视频') {
  1520. this.setData({
  1521. page: 1
  1522. })
  1523. utils.$post({
  1524. url: app.globalData.webUrl + 'api/video/list',
  1525. header: {
  1526. 'Authorization': 'bearer ' + app.globalData.token
  1527. },
  1528. data: {
  1529. type: that.data.nowfirst,
  1530. label: that.data.nowtitbtn,
  1531. page: 1,
  1532. limit: "10",
  1533. keyword: that.data.videotext,
  1534. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'shared_times':'uploadtime'
  1535. },
  1536. success: function (res) {
  1537. wx.stopPullDownRefresh();
  1538. if (res.data.code == 0) {
  1539. that.setData({
  1540. videolist: res.data.data,
  1541. leftlist: [],
  1542. rightlist: []
  1543. })
  1544. that.videoimgload();
  1545. }
  1546. setTimeout(function () {
  1547. wx.hideLoading();
  1548. }, 500)
  1549. }
  1550. })
  1551. } else if (that.data.mattertype == '拓客案例') {
  1552. that.setData({
  1553. casepage: 1,
  1554. })
  1555. utils.$get({
  1556. url: app.globalData.webUrl + 'api/caselist',
  1557. header: {
  1558. 'Authorization': 'bearer ' + app.globalData.token
  1559. },
  1560. data: {
  1561. uid: app.globalData.personMsg.id,
  1562. page: 1,
  1563. limit:10,
  1564. commu_id: that.data.commu_id,// 小区id
  1565. style_id: that.data.casestyletype,//风格id
  1566. square_start: that.data.square_start,//面积开始值
  1567. square_end: that.data.square_end,//面积结束值
  1568. keyword: that.data.casekeytext,
  1569. housetype_id: that.data.nowstyleid,
  1570. case_type:this.data.noweffectid,
  1571. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'shared_times':''
  1572. },
  1573. success: function (res) {
  1574. wx.stopPullDownRefresh();
  1575. if (res.data.code == '0') {
  1576. that.setData({
  1577. caselist: res.data.data,
  1578. leftcaselist: [],
  1579. rightcaselist: [],
  1580. })
  1581. that.caseimgload();
  1582. }
  1583. }
  1584. })
  1585. } else {
  1586. var that = this;
  1587. that.setData({
  1588. articlepage: 1
  1589. })
  1590. utils.$post({
  1591. url: app.globalData.webUrl + 'api/article/list',
  1592. header: {
  1593. 'Authorization': 'bearer ' + app.globalData.token
  1594. },
  1595. data: {
  1596. type: that.data.articlenowfirst,
  1597. label: that.data.articlenowtitbtn,
  1598. page: 1,
  1599. limit: "10",
  1600. keyword: that.data.articletext,
  1601. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'shared_times':'uploadtime'
  1602. },
  1603. success: function (res) {
  1604. wx.stopPullDownRefresh()
  1605. if (res.data.code == 0) {
  1606. that.setData({
  1607. articlelist: res.data.data
  1608. })
  1609. }
  1610. }
  1611. })
  1612. }
  1613. },
  1614. /**
  1615. * 页面上拉触底事件的处理函数
  1616. */
  1617. onReachBottom: function () {
  1618. var that = this;
  1619. if (that.data.mattertype == '拓客视频') {
  1620. var page = that.data.page;
  1621. page = page * 1 + 1;
  1622. that.setData({
  1623. page: page
  1624. })
  1625. wx.showLoading({
  1626. title: '加载中...',
  1627. })
  1628. utils.$post({
  1629. url: app.globalData.webUrl + 'api/video/list',
  1630. header: {
  1631. 'Authorization': 'bearer ' + app.globalData.token
  1632. },
  1633. data: {
  1634. type: that.data.nowfirst,
  1635. label: that.data.nowtitbtn,
  1636. page: page,
  1637. limit: "10",
  1638. keyword: that.data.videotext,
  1639. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'? 'shared_times':'uploadtime'
  1640. },
  1641. success: function (res) {
  1642. wx.hideLoading();
  1643. if (res.data.code == 0) {
  1644. var arr = res.data.data;
  1645. var arrflag = false;
  1646. var videolist = that.data.videolist;
  1647. if (videolist.length != 0) {
  1648. arrflag = true;
  1649. }
  1650. for (var i = 0; i < arr.length; i++) {
  1651. videolist.push(arr[i]);
  1652. }
  1653. that.setData({
  1654. videolist: videolist,
  1655. })
  1656. if (!arrflag) {
  1657. that.videoimgload();
  1658. }
  1659. }
  1660. }
  1661. })
  1662. } else if (that.data.mattertype == '拓客案例') {
  1663. var page = that.data.casepage;
  1664. page = page * 1 + 1;
  1665. that.setData({
  1666. casepage: page
  1667. })
  1668. wx.showLoading({
  1669. title: '加载中...',
  1670. })
  1671. utils.$get({
  1672. url: app.globalData.webUrl + 'api/caselist',
  1673. header: {
  1674. 'Authorization': 'bearer ' + app.globalData.token
  1675. },
  1676. data: {
  1677. uid: app.globalData.personMsg.id,
  1678. page: that.data.casepage,
  1679. limit:10,
  1680. commu_id: that.data.commu_id,// 小区id
  1681. style_id: that.data.casestyletype,//风格id
  1682. square_start: that.data.square_start,//面积开始值
  1683. square_end: that.data.square_end,//面积结束值
  1684. keyword: that.data.casekeytext,
  1685. housetype_id: that.data.nowstyleid,
  1686. case_type:this.data.noweffectid,
  1687. order:that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'shared_times':''
  1688. },
  1689. success: function (res) {
  1690. wx.hideLoading();
  1691. if (res.data.code == '0') {
  1692. let arrflag = false;
  1693. let caselist = that.data.caselist;
  1694. if (caselist.length != 0) {
  1695. arrflag = true;
  1696. }
  1697. caselist = caselist.concat(res.data.data)
  1698. that.setData({
  1699. caselist: caselist
  1700. })
  1701. if (!arrflag) {
  1702. that.caseimgload();
  1703. }
  1704. }
  1705. }
  1706. })
  1707. } else {
  1708. var articlepage = that.data.articlepage;
  1709. articlepage = articlepage * 1 + 1;
  1710. that.setData({
  1711. articlepage: articlepage
  1712. })
  1713. utils.$post({
  1714. url: app.globalData.webUrl + 'api/article/list',
  1715. header: {
  1716. 'Authorization': 'bearer ' + app.globalData.token
  1717. },
  1718. data: {
  1719. type: that.data.articlenowfirst,
  1720. label: that.data.articlenowtitbtn,
  1721. page: articlepage,
  1722. limit: "10",
  1723. keyword: that.data.articletext,
  1724. order: that.data.ordertype == 'clue_number' ? 'clue_number' :that.data.ordertype == 'hot'?'shared_times':'uploadtime'
  1725. },
  1726. success: function (res) {
  1727. let articlelist = that.data.articlelist;
  1728. if (res.data.code == 0) {
  1729. articlelist = articlelist.concat(res.data.data)
  1730. that.setData({
  1731. articlelist: articlelist
  1732. })
  1733. }
  1734. wx.hideLoading()
  1735. }
  1736. })
  1737. }
  1738. },
  1739. videoTap: function (e) {
  1740. wx.navigateTo({
  1741. url: "/index/pages/videoshare/videoshare?vid=" + e.currentTarget.dataset.vid,
  1742. });
  1743. },
  1744. videocollectap: function (e) {
  1745. var that = this;
  1746. var vurl = '';
  1747. var videoObj = '';
  1748. if (e.currentTarget.dataset.type == 'leftlist') {
  1749. videoObj = that.data.leftlist;
  1750. } else {
  1751. videoObj = that.data.rightlist;
  1752. }
  1753. if (e.currentTarget.dataset.num == '0') {
  1754. vurl = "api/video/collect"
  1755. } else {
  1756. vurl = "api/video/collectCancel"
  1757. }
  1758. utils.$post({
  1759. url: app.globalData.webUrl + vurl,
  1760. header: {
  1761. 'Authorization': 'bearer ' + app.globalData.token
  1762. },
  1763. data: {
  1764. id: e.currentTarget.dataset.vid,
  1765. },
  1766. success: function (res) {
  1767. if (res.data.code == "0") {
  1768. if (videoObj[e.currentTarget.dataset.idx].isCollection == '0') {
  1769. videoObj[e.currentTarget.dataset.idx].isCollection = 1;
  1770. if (e.currentTarget.dataset.type == 'leftlist') {
  1771. that.setData({
  1772. leftlist: videoObj
  1773. })
  1774. } else {
  1775. that.setData({
  1776. rightlist: videoObj
  1777. })
  1778. }
  1779. wx.showToast({
  1780. title: res.data.msg,
  1781. icon: 'none',
  1782. duration: 2000
  1783. })
  1784. } else {
  1785. wx.showToast({
  1786. title: res.data.msg,
  1787. icon: 'none',
  1788. duration: 2000
  1789. })
  1790. videoObj[e.currentTarget.dataset.idx].isCollection = 0;
  1791. if (e.currentTarget.dataset.type == 'leftlist') {
  1792. that.setData({
  1793. leftlist: videoObj
  1794. })
  1795. } else {
  1796. that.setData({
  1797. rightlist: videoObj
  1798. })
  1799. }
  1800. }
  1801. } else {
  1802. if (res.data.msg == '您已收藏') {
  1803. videoObj[e.currentTarget.dataset.idx].isCollection = 1;
  1804. if (e.currentTarget.dataset.type == 'leftlist') {
  1805. that.setData({
  1806. leftlist: videoObj
  1807. })
  1808. } else {
  1809. that.setData({
  1810. rightlist: videoObj
  1811. })
  1812. }
  1813. }
  1814. }
  1815. }
  1816. })
  1817. },
  1818. /**
  1819. * 用户点击右上角分享
  1820. */
  1821. onShareAppMessage: function () {
  1822. let that = this;
  1823. this.setData({
  1824. wshareshow: false
  1825. })
  1826. that.setData({
  1827. wshareshow: false
  1828. })
  1829. if (that.data.nowtype == 'video') {
  1830. this.sharelogtap();
  1831. return {
  1832. title: that.data.nowtitle,
  1833. imageUrl: that.data.nowimg,
  1834. path: '/share/pages/videoshare/videoshare?vid=' + that.data.nowid + '&userid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  1835. }
  1836. }
  1837. if (that.data.nowtype == 'article') {
  1838. this.sharelogtap();
  1839. return {
  1840. title: that.data.nowtitle,
  1841. imageUrl: that.data.nowimg,
  1842. path: '/share/pages/articleshare/articleshare?aid=' + that.data.nowid + '&userid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  1843. }
  1844. }
  1845. if (that.data.nowtype == 'materialEvidence') {
  1846. this.sharelogtap();
  1847. return {
  1848. title: that.data.nowtitle,
  1849. imageUrl: that.data.nowimg,
  1850. path: '/share/pages/publicpraisemsg/publicpraisemsg?eid=' + that.data.nowid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  1851. }
  1852. }
  1853. // if (this.data.mattertype == '拓客案例') {
  1854. // this.sharelogtap();
  1855. // return {
  1856. // title: app.globalData.personMsg.binded.name + "的拓客案例",
  1857. // imageUrl: app.globalData.imgUrl + "xcx/caseposter.jpg",
  1858. // path: '/share/pages/caselist/caselist?u=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&c=' + that.data.commu_id + '&s=' + that.data.casestyletype + '&st=' + that.data.square_start + '&e=' + that.data.square_end + '&h=' + that.data.nowstyleid
  1859. // }
  1860. // }
  1861. var img = that.data.nowimg;
  1862. img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/');
  1863. if (that.data.nowtype == 'materialCase') {
  1864. this.sharelogtap();
  1865. return {
  1866. title: that.data.nowtitle,
  1867. imageUrl: that.data.nowimg,
  1868. path: '/share/pages/materialcase/materialcase?cid=' + that.data.nowid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  1869. }
  1870. }
  1871. }
  1872. })