other.js 34 KB

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