other.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. // pages/other/other.js
  2. var app = getApp();
  3. const utils = require("../../utils/http");
  4. const util = require("../../utils/util");
  5. var time = 0;
  6. var timer = null;
  7. let title='',imgurl='';
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. webUrl: '',
  14. clientype: app.globalData.clientype,
  15. type:'1',//1是小红屋,2是酷家乐,3是建额全景,剩下的是其他
  16. companyobj:{},
  17. personobj:{},
  18. canIUseGetUserProfile:false,
  19. loginFlag:false,
  20. mobileflag:false,
  21. vrType: '',
  22. aid: '',
  23. imgUrl: app.globalData.imgUrl,
  24. platform:'',
  25. wshareshow:false,
  26. showTask:true,
  27. xhwwidth:'',
  28. bottom:26,
  29. emptype:'',
  30. isVr: "",
  31. userflag:false,
  32. isPrivacy: false,
  33. isAgree: false
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad: function (options) {
  39. time = 0;
  40. imgurl='';
  41. title='';
  42. this.setData({
  43. emptype:'',
  44. })
  45. if(!!options.emp){
  46. this.setData({
  47. emptype:'1',
  48. })
  49. }
  50. if(!!options.type&&options.type=='vr'){
  51. app.globalData.clientype=options.ctp;
  52. app.globalData.shareuserid = options.uid;
  53. this.setData({
  54. isVr: options.type
  55. })
  56. this.login();
  57. }
  58. if (!!options.aid) {
  59. this.setData({
  60. aid: options.aid
  61. })
  62. }
  63. if (!!options.cty) {
  64. this.setData({
  65. vrType: options.cty
  66. })
  67. }
  68. if (!!options.scene) {
  69. wx.hideHomeButton()
  70. options = unescape(options.scene);
  71. let arr = options.split('&');
  72. let obj = {};
  73. for (let i = 0; i < arr.length; i++) {
  74. let arr1 = arr[i].split('=');
  75. obj[arr1[0]] = arr1[1];
  76. }
  77. this.setData({
  78. isVr: obj.type
  79. })
  80. this.getmsgfun(obj.ticket);
  81. }else if (options.type == '21' || options.type == '23') {//新客户
  82. this.setData({
  83. webUrl: app.globalData.webUrl + 'applet.html#/customerMsg?token=' + app.globalData.token + '&cid=' + options.vid + '&client_type=' + app.globalData.clientype+"&platform="+app.globalData.platform,
  84. })
  85. } else if (options.type == '22') {//共有客户
  86. this.setData({
  87. webUrl: app.globalData.webUrl + 'applet.html#/client?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id + "&platform="+app.globalData.platform,
  88. })
  89. } else if (options.type == '3') {//共有客户
  90. this.setData({
  91. webUrl: app.globalData.webUrl + 'applet.html#/workReport?token=' + app.globalData.token + '&type=' + (options.state ? options.state : '') + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id+"&platform="+app.globalData.platform,
  92. })
  93. } else if (options.type == '2') {
  94. this.setData({
  95. webUrl: options.content,
  96. clientype: app.globalData.clientype,
  97. })
  98. } else if (options.type == '4') {
  99. // 日报详情
  100. this.setData({
  101. webUrl: app.globalData.webUrl + 'applet.html#/dailyDetail?token=' + app.globalData.token + '&id=' + options.did + '&type=' + 'sendout' + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  102. })
  103. }else if (options.type == '88') {
  104. this.setData({
  105. webUrl: app.globalData.webUrl + 'applet.html#/customermsg?token=' + app.globalData.token + "&aid=" + options.aid + "&cid=" + options.cid + '&client_type=' + app.globalData.clientype+"&platform="+app.globalData.platform
  106. })
  107. } else if (options.type == '11') {
  108. this.setData({
  109. webUrl: app.globalData.webUrl + 'applet.html#/trainmsg?token=' + app.globalData.token + '&tid=' + options.tid + '&client_type=' + app.globalData.clientype
  110. })
  111. } else if (options.type == '48') {//共有客户
  112. wx.setNavigationBarColor({
  113. frontColor: '#ffffff',
  114. backgroundColor: '#2376FF',
  115. })
  116. this.setData({
  117. webUrl: app.globalData.webUrl + 'applet.html#/custmanage?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  118. })
  119. } else if (options.type == '32') {
  120. wx.hideHomeButton();
  121. this.setData({
  122. webUrl: app.globalData.webUrl + 'applet.html#/trainCamp?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id
  123. })
  124. } else if (options.type == '77') {
  125. this.setData({
  126. webUrl: app.globalData.webUrl + 'applet.html#/recycle?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  127. })
  128. wx.setNavigationBarColor({
  129. backgroundColor: '#249efb',
  130. frontColor: '#ffffff',
  131. })
  132. } else if (options.type == '29') {
  133. this.setData({
  134. webUrl: app.globalData.webUrl + 'applet.html#/joinCustomer?token=' + app.globalData.token + '&actid=' + options.actid + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  135. })
  136. } else if (options.type == '63') {
  137. this.setData({
  138. webUrl: app.globalData.webUrl + 'applet.html#/winPrize?token=' + app.globalData.token + '&actid=' + options.actid + '&client_type=' + app.globalData.clientype,
  139. })
  140. } else if (options.type == '9') {
  141. this.setData({
  142. webUrl: app.globalData.webUrl + 'applet.html#/designerlist?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
  143. })
  144. } else if (options.type == '111') {
  145. // vr
  146. let vrurl1="https://wzh.nczyzs.com";
  147. let vrlink = JSON.parse(JSON.stringify(unescape(options.vrurl)));
  148. if (vrlink.indexOf(vrurl1) > -1) {
  149. if (vrlink.indexOf('/0/') < 0 && app.globalData.vrString) {
  150. vrlink = `${vrlink}/0/${app.globalData.vrString}`;
  151. } else {
  152. if (app.globalData.personMsg && app.globalData.personMsg.id) {
  153. vrlink = vrlink.substring(0, vrlink.indexOf('/0/'));
  154. vrlink = `${vrlink}/0/${app.globalData.vrString}`;
  155. }
  156. }
  157. }
  158. this.setData({
  159. webUrl: vrlink,
  160. })
  161. } else if (options.type == '121') {
  162. this.setData({
  163. webUrl: app.globalData.webUrl + 'applet.html#/collage?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  164. })
  165. } else if (options.type == 'vr') {
  166. // vr
  167. wx.hideHomeButton()
  168. let vrurl1="https://wzh.nczyzs.com";
  169. let vrlink = JSON.parse(JSON.stringify(unescape(options.vrurl)));
  170. if (vrlink.indexOf(vrurl1) > -1) {
  171. if (vrlink.indexOf('/0/') < 0 && app.globalData.vrString) {
  172. vrlink = `${vrlink}/0/${app.globalData.vrString}`;
  173. } else {
  174. if (app.globalData.personMsg && app.globalData.personMsg.id) {
  175. vrlink = vrlink.substring(0, vrlink.indexOf('/0/'));
  176. vrlink = `${vrlink}/0/${app.globalData.vrString}`;
  177. }
  178. }
  179. }
  180. this.setData({
  181. webUrl: vrlink,
  182. })
  183. } else if (options.type == '818') {
  184. this.setData({
  185. webUrl: app.globalData.webUrl + 'applet.html#/fiveDimensions?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + options.empid,
  186. })
  187. } else if (options.type == '919') {
  188. this.setData({
  189. webUrl: app.globalData.webUrl + 'applet.html#/overdue?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  190. })
  191. } else if (options.type == 'screen') {
  192. wx.setNavigationBarColor({
  193. backgroundColor: '#C40909',
  194. frontColor: '#ffffff',
  195. })
  196. this.setData({
  197. webUrl: app.globalData.webUrl + 'applet.html#/wbmanage?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  198. })
  199. } else if (options.type == "565") {
  200. // vr
  201. wx.hideHomeButton()
  202. let vrurl1="https://wzh.nczyzs.com";
  203. let vrlink = JSON.parse(JSON.stringify(decodeURIComponent(options.vrlink)));
  204. if (vrlink.indexOf(vrurl1) > -1) {
  205. if (vrlink.indexOf('/0/') < 0 && app.globalData.vrString) {
  206. vrlink = `${vrlink}/0/${app.globalData.vrString}`;
  207. } else {
  208. if (app.globalData.personMsg && app.globalData.personMsg.id) {
  209. vrlink = vrlink.substring(0, vrlink.indexOf('/0/'));
  210. vrlink = `${vrlink}/0/${app.globalData.vrString}`;
  211. }
  212. }
  213. }
  214. this.setData({
  215. webUrl: vrlink,
  216. })
  217. } else if (options.type == '999') {
  218. wx.setNavigationBarColor({
  219. frontColor: '#ffffff',
  220. backgroundColor: '#191c23',
  221. })
  222. this.setData({
  223. webUrl: app.globalData.webUrl + 'applet.html#/medal?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  224. })
  225. } else if (options.type == '525') {
  226. this.setData({
  227. webUrl: app.globalData.webUrl + 'applet.html#/addReport?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
  228. })
  229. } else if (options.type == '656') {
  230. wx.setNavigationBarColor({
  231. frontColor: '#ffffff',
  232. backgroundColor: '#249efb',
  233. })
  234. this.setData({
  235. webUrl: app.globalData.webUrl + 'applet.html#/brokerModule?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
  236. })
  237. } else if (options.type == '2277') {
  238. wx.setNavigationBarColor({
  239. frontColor: '#ffffff',
  240. backgroundColor: '#249efb',
  241. })
  242. this.setData({
  243. webUrl: app.globalData.webUrl + 'applet.html#/integral?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&brokerId=' + app.globalData.brokeruserId + '&btype=b',
  244. })
  245. } else if (options.type == '5566') {
  246. wx.setNavigationBarColor({
  247. frontColor: '#ffffff',
  248. backgroundColor: '#249efb',
  249. })
  250. this.setData({
  251. webUrl: app.globalData.webUrl + 'applet.html#/brokerDetail?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id + '&brokerId=' + options.cid,
  252. })
  253. } else if (options.type == '13') {
  254. wx.setNavigationBarColor({
  255. frontColor: '#ffffff',
  256. backgroundColor: '#249efb',
  257. })
  258. this.setData({
  259. webUrl: app.globalData.webUrl + 'applet.html#/sharestatistics?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
  260. })
  261. } else if (options.type == '987') {
  262. this.setData({
  263. webUrl: app.globalData.webUrl + 'applet.html#/buildinglist?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform + "&type=" + options.bType,
  264. })
  265. } else if (options.type == '090') {
  266. this.setData({
  267. webUrl: app.globalData.webUrl + 'applet.html#/publicQr?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  268. })
  269. }else if (options.type == '-87') {//未到访
  270. wx.setNavigationBarColor({
  271. frontColor: '#ffffff',
  272. backgroundColor: '#249efb',
  273. })
  274. this.setData({
  275. webUrl: app.globalData.webUrl + 'applet.html#/crmnotice?token=' + app.globalData.token + '&orgid=' + app.globalData.personMsg.binded.org_id + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id+'&time='+options.time,
  276. })
  277. } else if (options.type == '9009') {
  278. this.setData({
  279. webUrl: app.globalData.webUrl + 'applet.html#/Mbroker?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + "&platform="+app.globalData.platform,
  280. })
  281. } else if (options.type == '9889') {
  282. this.setData({
  283. webUrl: app.globalData.webUrl + 'applet.html#/addBuilding?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  284. })
  285. } else if (options.type == '6060') {
  286. this.setData({
  287. webUrl: app.globalData.webUrl + 'applet.html#/deadOrder?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  288. })
  289. } else if (options.type == '0111') {
  290. this.setData({
  291. webUrl: app.globalData.webUrl + 'applet.html#/Mapproval?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  292. })
  293. } else if (options.type == '0202') {
  294. this.setData({
  295. webUrl: app.globalData.webUrl + 'applet.html#/trainmsg?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform + '&tid=' + options.cid,
  296. })
  297. } else if(options.type=='viewgrades'){
  298. this.setData({
  299. webUrl: app.globalData.webUrl + 'applet.html#/viewGrades?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&pid=' + options.pid,
  300. })
  301. } else if(options.type=='assessmsg'){
  302. this.setData({
  303. webUrl: app.globalData.webUrl + 'applet.html#/assessMsg?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&pid=' + options.pid,
  304. })
  305. } else if (options.type == '6886') {
  306. this.setData({
  307. webUrl: app.globalData.webUrl + 'applet.html#/statistics?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  308. })
  309. } else if (options.type == '8992') {
  310. this.setData({
  311. webUrl: app.globalData.webUrl + 'applet.html#/construction?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  312. })
  313. } else if (options.type == '6709') {
  314. this.setData({
  315. webUrl: app.globalData.webUrl + 'applet.html#/exchange?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform + '&btype=b',
  316. })
  317. } else if (options.type == '6006') {
  318. this.setData({
  319. webUrl: app.globalData.webUrl + 'applet.html#/cluemsg?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform + "&cid=" + options.cid,
  320. })
  321. } else if (options.type == '0090') {
  322. this.setData({
  323. webUrl: app.globalData.webUrl + 'applet.html#/works?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
  324. })
  325. } else if (options.type == '5995') {
  326. this.setData({
  327. webUrl: app.globalData.webUrl + 'applet.html#/trainmsg?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform + "&from=1&tid=" + options.tid,
  328. })
  329. } else if (options.type == '5895') {
  330. this.setData({
  331. webUrl: app.globalData.webUrl + 'applet.html#/assessMsg?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform + "&from=1&pid=" + options.pid,
  332. })
  333. }
  334. this.setype();
  335. },
  336. //用户同意隐私协议
  337. agreePrivacy() {
  338. this.setData({
  339. isPrivacy: true,
  340. isAgree: true
  341. })
  342. },
  343. getmsgfun(ticket){
  344. const that=this;
  345. wx.request({
  346. url: app.globalData.webUrl + 'api/share/getQueryByTicket',
  347. method: 'GET',
  348. data: {
  349. ticket: ticket
  350. },
  351. success: (res) => {
  352. if(res.data.code==0){
  353. let arr=res.data.data.split('&');
  354. let obj = {};
  355. for (let i = 0; i < arr.length; i++) {
  356. let arr1 = arr[i].split('=');
  357. obj[arr1[0]] = arr1[1];
  358. }
  359. app.globalData.clientype=obj.c;
  360. app.globalData.shareuserid = obj.u;
  361. let str = unescape(obj.l);
  362. that.setData({
  363. aid: obj.a,
  364. vrType: obj.y,
  365. webUrl: str,
  366. })
  367. that.setype();
  368. that.login();
  369. }
  370. }
  371. })
  372. },
  373. sharecompany: function () {
  374. const that = this;
  375. utils.$post({
  376. url: app.globalData.webUrl + 'client/index/content_belong_company',
  377. header: {
  378. 'Authorization': 'bearer ' + app.globalData.token
  379. },
  380. data: {
  381. client_type: app.globalData.clientype,
  382. uid: app.globalData.shareuserid
  383. },
  384. success: function (res) {
  385. if (res.data.code == '0') {
  386. app.globalData.currentUserId = res.data.data.employee_id || '';
  387. app.globalData.companyobj=res.data.data;
  388. that.setData({
  389. companyobj: res.data.data
  390. })
  391. }
  392. },
  393. complete(res) {
  394. wx.hideLoading()
  395. }
  396. })
  397. },
  398. login: function () {
  399. var that = this;
  400. if(this.data.emptype){
  401. that.setData({
  402. showTask:true,
  403. })
  404. }else{
  405. that.setData({
  406. showTask:false,
  407. })
  408. }
  409. that.setData({
  410. userflag:true
  411. })
  412. wx.login({
  413. success: function (data) {
  414. if (data.errMsg == 'login:ok') {
  415. utils.$post({
  416. url: app.globalData.webUrl + 'api/users/code2session',
  417. data: {
  418. code: data.code,
  419. share: app.globalData.shareuserid,
  420. client_type:app.globalData.clientype
  421. },
  422. success: function (r) {
  423. if (r.data.code == '0') {
  424. app.globalData.sharepersonobj = r.data.share;
  425. app.globalData.companyobj = r.data.company_data;
  426. that.setData({
  427. companyobj: r.data.company_data,
  428. personobj:r.data.share
  429. })
  430. that.sharecompany();
  431. if (that.data.vrType!='housetype') {
  432. that.vrFooterRecord();
  433. }
  434. that.geTitle();
  435. if (!!r.data.user.phone) {
  436. that.setData({
  437. loginFlag: false,
  438. mobileflag: false,
  439. userflag:false
  440. })
  441. app.globalData.personMsg = r.data.user;
  442. wx.hideLoading();
  443. app.globalData.phone = true;//有手机号
  444. }else{
  445. wx.hideLoading();
  446. app.globalData.phone = false;//没有手机号
  447. that.setData({
  448. loginFlag: false,
  449. mobileflag:true
  450. })
  451. }
  452. }
  453. }
  454. })
  455. }
  456. }
  457. })
  458. },
  459. /**
  460. * vr获取足迹
  461. */
  462. vrFooterRecord() {
  463. var that = this;
  464. let dataObj = {};
  465. if (that.data.vrType === 'housetype') {
  466. dataObj = {
  467. type: that.data.vrType,
  468. id: that.data.aid,
  469. alertshow: "123",
  470. prompt: title
  471. }
  472. } else {
  473. dataObj = {
  474. type: that.data.vrType,
  475. id: that.data.aid,
  476. alertshow: "123",
  477. }
  478. }
  479. utils.$post({
  480. url: app.globalData.webUrl + 'client/material/vrfootprints',
  481. data: dataObj,
  482. header: {
  483. 'Authorization':'bearer '+app.globalData.token
  484. },
  485. success: function (r) {
  486. if(r.data.code=='0'){}
  487. }
  488. })
  489. },
  490. bindmessage(e){
  491. let arr=e.detail.data;
  492. for(let i in arr){
  493. this.viewlookfun(arr[i].sid,arr[i].vid,arr[i].time,arr[i].vdate);
  494. }
  495. },
  496. // vr场景浏览时长
  497. viewlookfun(sid,vid,time,hour){
  498. const that=this;
  499. utils.$post({
  500. url: app.globalData.webUrl + 'client/material/saveViewFoots',
  501. data: {
  502. sid:sid,//作品sid
  503. view_id:vid,//场景id
  504. time:time,//浏览时长
  505. viewtime:hour.split('-').join(':'),//浏览时间
  506. alertshow: "123"
  507. },
  508. header: {
  509. 'Authorization':'bearer '+app.globalData.token
  510. },
  511. success: function (r) {
  512. if(r.data.code=='0'){}
  513. }
  514. })
  515. },
  516. setype(){
  517. if(!this.data.vrType){
  518. this.setData({
  519. type:'',
  520. platform:''
  521. })
  522. wx.hideShareMenu({
  523. menus: ['shareAppMessage', 'shareTimeline']
  524. })
  525. return false;
  526. }
  527. this.setData({
  528. platform: app.globalData.platform
  529. })
  530. const that=this;
  531. let webUrl=this.data.webUrl;
  532. let redurltest='https://hnweizhihui.xiaohongwu.nczyzs.com';//41
  533. let kjlurltest="https://pano337.p.kujiale.com";
  534. let jeajurltest="https://vr-17.justeasy.nczyzs.com";
  535. let jeajurltest1="https://vr.justeasy.nczyzs.com";
  536. let wlurltest1="https://panorama.m2m88.com";//26
  537. let wlurltest2="https://panorama.wlwno1.com";//27
  538. let nowurl="https://wzh.nczyzs.com";//22
  539. let wl360="https://vr.3d66.nczyzs.com"//26
  540. if(webUrl.substr(0, 41)==redurltest){
  541. wx.getSystemInfo({
  542. success (res) {
  543. let width=(res.windowWidth-16)*0.48;
  544. that.setData({
  545. xhwwidth:width,
  546. bottom:res.platform=='android'?'26':36
  547. })
  548. }
  549. })
  550. this.setData({
  551. type:1,
  552. platform:app.globalData.platform,
  553. })
  554. }else if(webUrl.substr(0, 29)==kjlurltest){
  555. this.setData({
  556. type:2,
  557. platform:app.globalData.platform,
  558. })
  559. }else if(webUrl.substr(0, 33)==jeajurltest||webUrl.substr(0, 30)==jeajurltest1){
  560. this.setData({
  561. type:3,
  562. platform:app.globalData.platform,
  563. })
  564. }else if(webUrl.substr(0, 26)==wlurltest1||webUrl.substr(0, 27)==wlurltest2||webUrl.substr(0, 26)==wl360){
  565. this.setData({
  566. type:4,
  567. platform:app.globalData.platform,
  568. })
  569. } else if (webUrl.substr(0, 22)==nowurl){
  570. this.setData({
  571. type:5,
  572. platform:app.globalData.platform,
  573. })
  574. }
  575. if(!!app.globalData.token && !this.data.isVr){
  576. this.geTitle();
  577. }
  578. },
  579. // 分享
  580. shareurltap: function () {
  581. wx.showLoading({
  582. title: '加载中...',
  583. })
  584. this.addsharetap('toolAll');
  585. let str =this.data.webUrl;
  586. util.schemefun('/pages/other/other', 'uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype+ '&type=vr&aid=' + this.data.aid+ '&cty='+this.data.vrType+'_vr', this.data.aid, this.data.vrType+'_vr', '',str);
  587. },
  588. sendfriendtap() {
  589. this.addsharetap('toolAll');
  590. },
  591. setpostertap: function () {
  592. wx.navigateTo({
  593. url: '/index/pages/setposter/setposter?type=vr&aid=' + this.data.aid + "&listshare=&vrtype="+this.data.vrType+'&turl='+escape(this.data.webUrl),
  594. })
  595. },
  596. casesharetap(){
  597. this.setData({
  598. wshareshow:true
  599. })
  600. },
  601. /**
  602. * 生命周期函数--监听页面初次渲染完成
  603. */
  604. onReady: function () {
  605. },
  606. callphonetap(){
  607. wx.makePhoneCall({
  608. phoneNumber: this.data.personobj.phone
  609. })
  610. },
  611. toPageNameCard() {
  612. wx.navigateTo({
  613. url: '/share/pages/shareCard/shareCard?uid=' + (app.globalData.shareuserid?app.globalData.shareuserid:this.data.personobj.id)+ '&empid=' + (app.globalData.currentUserId?app.globalData.currentUserId:this.data.personobj.binded.id) + '&ctp=' + app.globalData.clientype + '&ftype=share',
  614. })
  615. },
  616. prelookimgtap() {
  617. let personobj=this.data.personobj;
  618. let qrcode='';
  619. if(!!personobj.qrcode){
  620. qrcode=personobj.qrcode;
  621. }else if(!!personobj.binded.qrcode){
  622. qrcode=personobj.binded.qrcode;
  623. }
  624. if (!qrcode) {
  625. wx.showToast({
  626. title: "当前装修顾问的二维码为空!",
  627. icon: 'none',
  628. duration: 2000
  629. })
  630. return false;
  631. }
  632. wx.previewImage({
  633. current: app.globalData.imgUrl + qrcode, // 当前显示图片的http链接
  634. urls: [app.globalData.imgUrl + qrcode]// 需要预览的图片http链接列表
  635. })
  636. },
  637. getPhoneNumberTap:function(res){
  638. var that=this;
  639. if(res.detail.errMsg=='getPhoneNumber:ok'){
  640. utils.$post({
  641. url: app.globalData.webUrl + 'api/users/setUserMobile',
  642. data: {
  643. encryptedData:res.detail.encryptedData,
  644. iv:res.detail.iv
  645. },
  646. header: {
  647. 'Authorization':'bearer '+app.globalData.token
  648. },
  649. success: function (r) {
  650. if(r.data.code=='0'){
  651. that.signup(r.data.mobile);
  652. }else{
  653. that.setData({
  654. errorText:r.data.msg,
  655. errorflag:true
  656. })
  657. }
  658. }
  659. })
  660. }
  661. },
  662. signup:function(mobile){
  663. const that=this;
  664. utils.$post({
  665. url: app.globalData.webUrl + 'client/index/signUp',
  666. data: {
  667. name:'',
  668. remark:'',
  669. mobile:mobile,
  670. type:that.data.vrType+'Vr',
  671. id: that.data.aid,
  672. },
  673. header: {
  674. 'Authorization':'bearer '+app.globalData.token
  675. },
  676. success: function (r) {
  677. if(r.data.code=='0'){
  678. wx.showToast({
  679. title: '恭喜您报名成功',
  680. icon:'none'
  681. })
  682. }
  683. }
  684. })
  685. },
  686. /**
  687. * 生命周期函数--监听页面显示
  688. */
  689. onShow: function () {
  690. timer = setInterval(function () {
  691. time = (time * 1) + 1;
  692. }, 1000)
  693. if(JSON.stringify(app.globalData.sharepersonobj) != "{}"&&!!app.globalData.sharepersonobj){
  694. this.setData({
  695. personobj:app.globalData.sharepersonobj
  696. })
  697. }else if(JSON.stringify(app.globalData.personMsg) != "{}"){
  698. var obj = app.globalData.personMsg;
  699. obj.name = app.globalData.personMsg.binded ? app.globalData.personMsg.binded.name : '';
  700. this.setData({
  701. personobj:obj
  702. })
  703. }
  704. this.setData({
  705. companyobj:app.globalData.companyobj,
  706. imgUrl: app.globalData.imgUrl,
  707. })
  708. },
  709. /**
  710. * 生命周期函数--监听页面隐藏
  711. */
  712. onHide: function () {
  713. if (timer) {
  714. clearInterval(timer);
  715. }
  716. if (!!this.data.aid) {
  717. this.visitimefun();
  718. if (this.data.vrType == 'housetype') {
  719. this.visitimefun(this.data.vrType);
  720. }
  721. }
  722. },
  723. visitimefun(typeStr) {
  724. if (!this.data.isAgree) {
  725. return false;
  726. }
  727. const that = this;
  728. utils.$post({
  729. url: app.globalData.webUrl + 'client/index/visit_due_time',
  730. header: {
  731. 'Authorization': 'bearer ' + app.globalData.token
  732. },
  733. data: {
  734. id: that.data.aid,
  735. pipe_type: typeStr ? typeStr : that.data.vrType+'Vr',
  736. time: time,
  737. },
  738. success: function (res) {
  739. console.log(res,'<<<<<');
  740. }
  741. })
  742. },
  743. /**
  744. * 生命周期函数--监听页面卸载
  745. */
  746. onUnload: function () {
  747. if (!!this.data.aid) {
  748. this.visitimefun();
  749. if (this.data.vrType == 'housetype') {
  750. this.visitimefun(this.data.vrType);
  751. }
  752. }
  753. },
  754. /**
  755. * 页面相关事件处理函数--监听用户下拉动作
  756. */
  757. onPullDownRefresh: function () {
  758. },
  759. /**
  760. * 页面上拉触底事件的处理函数
  761. */
  762. onReachBottom: function () {
  763. },
  764. geTitle(){
  765. const that = this;
  766. if (title && imgurl) {
  767. return false;
  768. }
  769. if(this.data.vrType=='company'){
  770. title="在线逛展厅-"+app.globalData.companyobj.company_name;
  771. imgurl=app.globalData.imgUrl + 'xcx/aaa/vrcover.png';
  772. }else if(this.data.vrType=='employeeCard'){
  773. title=app.globalData.companyobj.company_name+'VR寻址';
  774. imgurl=app.globalData.imgUrl+"/xcx/sharenamecard.png";
  775. }else if(this.data.vrType=='materialCase'){
  776. utils.$get({
  777. url: app.globalData.webUrl + 'client/casedetail',
  778. header: {
  779. 'Authorization': 'bearer ' + app.globalData.token
  780. },
  781. data: {
  782. id: this.data.aid,
  783. share:'146'
  784. },
  785. success: function (res) {
  786. if (res.data.code == '0') {
  787. title=res.data.data.title+'的VR';
  788. imgurl=res.data.data.cover_img;
  789. }
  790. }
  791. })
  792. }else if(this.data.vrType=='building'){
  793. utils.$get({
  794. url: app.globalData.webUrl + 'client/building/view',
  795. header: {
  796. 'Authorization': 'bearer ' + app.globalData.token
  797. },
  798. data: {
  799. id: this.data.aid,
  800. share:'146'
  801. },
  802. success: function (res) {
  803. if (res.data.code == '0') {
  804. title=res.data.data.name+'的VR';
  805. imgurl=res.data.data.cover[0];
  806. }
  807. }
  808. })
  809. }else if(this.data.vrType=='construction'){
  810. utils.$post({
  811. url: app.globalData.webUrl + 'client/construction/view',
  812. header: {
  813. 'Authorization': 'bearer ' + app.globalData.token
  814. },
  815. data: {
  816. id: this.data.aid,
  817. share:'146'
  818. },
  819. success: function (res) {
  820. if (res.data.code == '0') {
  821. title=res.data.data.name+'的VR';
  822. imgurl=res.data.data.cover;
  823. }
  824. }
  825. })
  826. } else if(this.data.vrType=='housetype'){
  827. utils.$post({
  828. url: app.globalData.webUrl + 'client/building/housetype_detail',
  829. header: {
  830. 'Authorization': 'bearer ' + app.globalData.token
  831. },
  832. data: {
  833. id: this.data.aid,
  834. share:'146'
  835. },
  836. success: function (res) {
  837. if (res.data.code == '0') {
  838. let dataObj = res.data.data;
  839. if (dataObj.room == 9) {
  840. dataObj.housetypename = "别墅";
  841. } else {
  842. dataObj.housetypename = `${dataObj.room}室${dataObj.hall}厅${dataObj.bathroom}卫`;
  843. }
  844. title = dataObj.housetypename;
  845. if (dataObj.house_img && dataObj.house_img.length) {
  846. imgurl = dataObj.house_img[0];
  847. } else {
  848. imgurl = "";
  849. }
  850. if (that.data.isVr === 'vr') {
  851. that.vrFooterRecord();
  852. }
  853. }
  854. }
  855. })
  856. }else if(this.data.vrType=='groupVr'){
  857. utils.$post({
  858. url: app.globalData.webUrl + 'mobile/share/getEasyRead',
  859. header: {
  860. 'Authorization': 'bearer ' + app.globalData.token
  861. },
  862. data: {
  863. sid: this.data.aid,
  864. share:'146'
  865. },
  866. success: function (res) {
  867. if (res.data.code == '0') {
  868. let dataObj = res.data.data;
  869. title = dataObj.title?dataObj.title:'未命名的作品';
  870. imgurl=dataObj.pic_path?dataObj.pic_path:'';
  871. }
  872. }
  873. })
  874. }
  875. },
  876. addsharetap: function (type) {
  877. let that = this;
  878. utils.$post({
  879. url: app.globalData.webUrl + 'api/share/addlog',
  880. header: {
  881. 'Authorization': 'bearer ' + app.globalData.token
  882. },
  883. data: {
  884. id: this.data.aid,
  885. type: this.data.vrType+'_vr',
  886. other_data:this.data.webUrl
  887. },
  888. success: function (r) {}
  889. })
  890. },
  891. /**
  892. * 用户点击右上角分享
  893. */
  894. onShareAppMessage: function () {
  895. if (this.data.vrType!='groupVr') {
  896. this.addsharetap('toolAll');
  897. }
  898. let str = escape(this.data.webUrl);
  899. return {
  900. title: title,
  901. imageUrl:imgurl,
  902. path: '/pages/other/other?ctp=' + app.globalData.clientype+'&uid='+ (app.globalData.shareuserid?app.globalData.shareuserid:app.globalData.personMsg.id) + '&type=vr&vrurl=' + str + '&aid=' + this.data.aid+ '&cty='+this.data.vrType
  903. };
  904. }
  905. })